Skip to content

Commit 90c0e18

Browse files
authored
chore: bump toolchain to v4.23.0-rc2 (#28454)
1 parent 3f11243 commit 90c0e18

File tree

161 files changed

+384
-519
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+384
-519
lines changed

Archive/Wiedijk100Theorems/BallotProblem.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ theorem counted_succ_succ (p q : ℕ) :
119119
Nat.add_sub_cancel]
120120
· rw [List.count_tail, hl₁, List.head?_eq_head, hlast, if_neg (by decide), Nat.sub_zero]
121121
· exact fun x hx => hl₂ x (List.mem_of_mem_tail hx)
122-
· rw [← hlast, List.head_cons_tail]
122+
· rw [← hlast, List.cons_head_tail]
123123
· refine Or.inr ⟨l.tail, ⟨?_, ?_, ?_⟩, ?_⟩
124124
· rw [List.count_tail, hl₀, List.head?_eq_head, hlast, if_neg (by decide), Nat.sub_zero]
125125
· rw [List.count_tail, hl₁, List.head?_eq_head, hlast, beq_self_eq_true, if_pos rfl,
126126
Nat.add_sub_cancel]
127127
· exact fun x hx => hl₂ x (List.mem_of_mem_tail hx)
128-
· rw [← hlast, List.head_cons_tail]
128+
· rw [← hlast, List.cons_head_tail]
129129
· rintro (⟨t, ⟨ht₀, ht₁, ht₂⟩, rfl⟩ | ⟨t, ⟨ht₀, ht₁, ht₂⟩, rfl⟩)
130130
· refine ⟨?_, ?_, ?_⟩
131131
· rw [List.count_cons, beq_self_eq_true, if_pos rfl, ht₀]

Cache/IO.lean

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -325,39 +325,43 @@ def allExist (paths : List (FilePath × Bool)) : IO Bool := do
325325
if required then if !(← path.pathExists) then return false
326326
pure true
327327

328+
private structure PackTask where
329+
sourceFile : FilePath
330+
zip : String
331+
task? : Option (Task (Except IO.Error Unit))
332+
328333
/-- Compresses build files into the local cache and returns an array with the compressed files -/
329334
def packCache (hashMap : ModuleHashMap) (overwrite verbose unpackedOnly : Bool)
330335
(comment : Option String := none) :
331336
CacheM <| Array String := do
332337
IO.FS.createDirAll CACHEDIR
333338
IO.println "Compressing cache"
334339
let sp := (← read).srcSearchPath
335-
let mut acc := #[]
336-
let mut tasks := #[]
340+
let mut acc : Array PackTask := #[]
337341
for (mod, hash) in hashMap.toList do
338342
let sourceFile ← Lean.findLean sp mod
339343
let zip := hash.asLTar
340344
let zipPath := CACHEDIR / zip
341345
let buildPaths ← mkBuildPaths mod
342346
if ← allExist buildPaths then
343347
if overwrite || !(← zipPath.pathExists) then
344-
acc := acc.push (sourceFile, zip)
345-
tasks := tasks.push <| ← IO.asTask do
348+
let task ← IO.asTask do
346349
-- Note here we require that the `.trace` file is first
347350
-- in the list generated by `mkBuildPaths`.
348351
let trace :: args := (← buildPaths.filterM (·.1.pathExists)) |>.map (·.1.toString)
349352
| unreachable!
350-
runCmd (← getLeanTar) <| #[zipPath.toString, trace] ++
353+
discard <| runCmd (← getLeanTar) <| #[zipPath.toString, trace] ++
351354
(if let some c := comment then #["-c", s!"git=mathlib4@{c}"] else #[]) ++ args
355+
acc := acc.push {sourceFile, zip, task? := some task}
352356
else if !unpackedOnly then
353-
acc := acc.push (sourceFile, zip)
354-
for task in tasks do
355-
_ ← IO.ofExcept task.get
356-
acc := acc.qsort (·.1.1 < ·.1.1)
357-
if verbose then
358-
for (path, zip) in acc do
359-
println! "packing {path} as {zip}"
360-
return acc.map (·.2)
357+
acc := acc.push {sourceFile, zip, task? := none}
358+
acc := acc.qsort (·.sourceFile.toString < ·.sourceFile.toString)
359+
acc.mapM fun {sourceFile, zip, task?} => do
360+
if let some task := task? then
361+
if verbose then
362+
IO.println s!"packing {sourceFile} as {zip}"
363+
IO.ofExcept task.get
364+
return zip
361365

362366
/-- Gets the set of all cached files -/
363367
def getLocalCacheSet : IO <| Std.TreeSet String compare := do

Cache/Requests.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ def getRemoteRepo (mathlibDepPath : FilePath) : IO RepoInfo := do
240240
IO.println s!"Using cache from {remoteName}: {repo}"
241241
return {repo := repo, useFirst := false}
242242

243-
-- FRO cache is flaky so disable until we work out the kinks: https://leanprover.zulipchat.com/#narrow/channel/113488-general/topic/The.20cache.20doesn't.20work/near/411058849
244-
def useFROCache : Bool := false
243+
-- FRO cache may be flaky: https://leanprover.zulipchat.com/#narrow/channel/113488-general/topic/The.20cache.20doesn't.20work/near/411058849
244+
def useFROCache : Bool := true
245245

246246
/-- Public URL for mathlib cache -/
247247
def URL : String :=
@@ -266,7 +266,7 @@ Given a file name like `"1234.tar.gz"`, makes the URL to that file on the server
266266
The `f/` prefix means that it's a common file for caching.
267267
-/
268268
def mkFileURL (repo URL fileName : String) : String :=
269-
let pre := if repo == MATHLIBREPO then "" else s!"{repo}/"
269+
let pre := if !useFROCache && repo == MATHLIBREPO then "" else s!"{repo}/"
270270
s!"{URL}/f/{pre}{fileName}"
271271

272272
section Get

Counterexamples/MapFloor.lean

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,14 @@ open scoped Polynomial
4646

4747
/-- The integers with infinitesimals adjoined. -/
4848
def IntWithEpsilon :=
49-
ℤ[X] deriving Nontrivial
49+
ℤ[X] deriving Nontrivial, CommRing, Inhabited
5050

5151
local notation "ℤ[ε]" => IntWithEpsilon
5252

5353
local notation "ε" => (X : ℤ[ε])
5454

5555
namespace IntWithEpsilon
5656

57-
instance nontrivial : Nontrivial IntWithEpsilon := inferInstance
58-
59-
-- The `CommRing` and `Inhabited` instances should be constructed by a deriving handler.
60-
-- https://github.com/leanprover-community/mathlib4/issues/380
61-
instance commRing : CommRing IntWithEpsilon := Polynomial.commRing
62-
63-
instance inhabited : Inhabited IntWithEpsilon := ⟨69
64-
6557
instance linearOrder : LinearOrder ℤ[ε] :=
6658
LinearOrder.lift' (toLex ∘ coeff) coeff_injective
6759

Counterexamples/SorgenfreyLine.lean

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,12 @@ noncomputable section
4646
It is the real line with the topology space structure generated by
4747
half-open intervals `Set.Ico a b`. -/
4848
def SorgenfreyLine : Type := ℝ
49-
-- The `ConditionallyCompleteLinearOrder, LinearOrderedField, Archimedean` instances should be
50-
-- constructed by a deriving handler.
51-
-- https://github.com/leanprover-community/mathlib4/issues/380
49+
deriving ConditionallyCompleteLinearOrder, Field, IsStrictOrderedRing, Archimedean
5250

5351
@[inherit_doc]
5452
scoped[SorgenfreyLine] notation "ℝₗ" => Counterexample.SorgenfreyLine
5553
open scoped SorgenfreyLine
5654

57-
instance : ConditionallyCompleteLinearOrder ℝₗ :=
58-
inferInstanceAs (ConditionallyCompleteLinearOrder ℝ)
59-
60-
instance : Field ℝₗ := inferInstanceAs (Field ℝ)
61-
62-
instance : IsStrictOrderedRing ℝₗ := inferInstanceAs (IsStrictOrderedRing ℝ)
63-
64-
instance : Archimedean ℝₗ := inferInstanceAs (Archimedean ℝ)
65-
6655
namespace SorgenfreyLine
6756

6857
/-- Ring homomorphism between the Sorgenfrey line and the standard real line. -/

Mathlib/Algebra/BigOperators/Group/Finset/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ theorem prod_bij_ne_one {s : Finset ι} {t : Finset κ} {f : ι → M} {g : κ
502502
prod_bij (fun a ha => i a (mem_filter.mp ha).1 <| by simpa using (mem_filter.mp ha).2)
503503
?_ ?_ ?_ ?_
504504
_ = ∏ x ∈ t, g x := prod_filter_ne_one _
505-
· grind [mem_filter]
505+
· grind
506506
· solve_by_elim
507507
· intros b hb
508508
refine (mem_filter.mp hb).elim fun h₁ h₂ ↦ ?_

Mathlib/Algebra/Category/ModuleCat/ChangeOfRings.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ The natural transformation from identity functor to the composition of restricti
554554
of scalars.
555555
-/
556556
@[simps]
557-
protected def unit' : 𝟭 (ModuleCat S) ⟶ restrictScalars f ⋙ coextendScalars f where
557+
protected noncomputable def unit' : 𝟭 (ModuleCat S) ⟶ restrictScalars f ⋙ coextendScalars f where
558558
app Y := ofHom (app' f Y)
559559
naturality Y Y' g :=
560560
hom_ext <| LinearMap.ext fun y : Y => LinearMap.ext fun s : S => by

Mathlib/Algebra/ContinuedFractions/Computation/CorrectnessTerminating.lean

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,7 @@ theorem compExactValue_correctness_of_stream_eq_some :
146146
-- ifp_succ_n.fr ≠ 0
147147
-- use the IH to show that the following equality suffices
148148
suffices
149-
compExactValue ppconts pconts ifp_n.fr = compExactValue pconts conts ifp_succ_n.fr by
150-
#adaptation_note /-- 2025-08-10 replace the following with grind after
151-
https://github.com/leanprover/lean4/issues/9825 is fixed -/
152-
have : v = compExactValue ppconts pconts ifp_n.fr := IH nth_stream_eq
153-
conv_lhs => rw [this]
154-
assumption
149+
compExactValue ppconts pconts ifp_n.fr = compExactValue pconts conts ifp_succ_n.fr by grind
155150
-- get the correspondence between ifp_n and ifp_succ_n
156151
obtain ⟨ifp_n', nth_stream_eq', ifp_n_fract_ne_zero, ⟨refl⟩⟩ :
157152
∃ ifp_n, IntFractPair.stream v n = some ifp_n ∧
@@ -196,12 +191,7 @@ theorem compExactValue_correctness_of_stream_eq_some :
196191
field_simp [compExactValue, contsAux_recurrence s_nth_eq ppconts_eq pconts_eq,
197192
nextConts, nextNum, nextDen]
198193
have hfr : (IntFractPair.of (1 / ifp_n.fr)).fr = f := rfl
199-
#adaptation_note /-- 2025-08-10 replace the following with grind after
200-
https://github.com/leanprover/lean4/issues/9825 is fixed -/
201-
rw [one_div, if_neg _, ← one_div, hfr]
202-
· field_simp [pA, pB, ppA, ppB, pconts, ppconts, hA, hB]
203-
ac_rfl
204-
· rwa [inv_eq_one_div, hfr]
194+
grind
205195

206196
open GenContFract (of_terminatedAt_n_iff_succ_nth_intFractPair_stream_eq_none)
207197

Mathlib/Algebra/DirectSum/Basic.lean

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,7 @@ variable (ι : Type v) (β : ι → Type w)
3333
Note: `open DirectSum` will enable the notation `⨁ i, β i` for `DirectSum ι β`. -/
3434
def DirectSum [∀ i, AddCommMonoid (β i)] : Type _ :=
3535
Π₀ i, β i
36-
37-
-- The `AddCommMonoid, Inhabited` instances should be constructed by a deriving handler.
38-
-- https://github.com/leanprover-community/mathlib4/issues/380
39-
40-
instance [∀ i, AddCommMonoid (β i)] : Inhabited (DirectSum ι β) :=
41-
inferInstanceAs (Inhabited (Π₀ i, β i))
42-
43-
instance [∀ i, AddCommMonoid (β i)] : AddCommMonoid (DirectSum ι β) :=
44-
inferInstanceAs (AddCommMonoid (Π₀ i, β i))
45-
46-
instance [∀ i, AddCommMonoid (β i)] : DFunLike (DirectSum ι β) _ fun i : ι => β i :=
47-
inferInstanceAs (DFunLike (Π₀ i, β i) _ _)
48-
49-
instance [∀ i, AddCommMonoid (β i)] : CoeFun (DirectSum ι β) fun _ => ∀ i : ι, β i :=
50-
inferInstanceAs (CoeFun (Π₀ i, β i) fun _ => ∀ i : ι, β i)
36+
deriving AddCommMonoid, Inhabited, DFunLike, CoeFun
5137

5238
/-- `⨁ i, f i` is notation for `DirectSum _ f` and equals the direct sum of `fun i ↦ f i`.
5339
Taking the direct sum over multiple arguments is possible, e.g. `⨁ (i) (j), f i j`. -/

Mathlib/Algebra/Field/Basic.lean

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@ variable [Field K]
158158

159159
instance (priority := 100) Field.toGrindField [Field K] : Lean.Grind.Field K :=
160160
{ CommRing.toGrindCommRing K, ‹Field K› with
161+
zpow := ⟨fun a n => a^n⟩
162+
zpow_zero a := by simp
163+
zpow_succ a n := by
164+
by_cases h : a = 0
165+
· rw [← Int.natCast_add_one, zpow_natCast, zpow_natCast, pow_succ]
166+
· rw [zpow_add_one₀ h]
167+
zpow_neg a n := by simp
161168
zero_ne_one := zero_ne_one' K }
162169

163170
attribute [local simp] mul_assoc mul_comm mul_left_comm

0 commit comments

Comments
 (0)