Skip to content

Commit 965500f

Browse files
kim-emleanprover-community-mathlib4-botleanprover-community-mathlib4-botmathlib4-botgithub-actions
authored
chore: bump toolchain to v4.29.0-rc1 (#1682)
Co-authored-by: leanprover-community-mathlib4-bot <129911861+leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: mathlib4-bot <github-mathlib4-bot@leanprover.zulipchat.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Markus Himmel <markus@lean-fro.org> Co-authored-by: Joachim Breitner <mail@joachim-breitner.de> Co-authored-by: Sebastian Ullrich <sebasti@nullri.ch> Co-authored-by: Rob23oba <152706811+Rob23oba@users.noreply.github.com> Co-authored-by: Johan Commelin <johan@commelin.net> Co-authored-by: Matthew Ballard <matt@mrb.email> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com> Co-authored-by: Mac Malone <mac@lean-fro.org> Co-authored-by: Anne C.A. Baanen <vierkantor@vierkantor.com> Co-authored-by: Paul Reichert <6992158+datokrat@users.noreply.github.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Parth Shastri <31370288+cppio@users.noreply.github.com> Co-authored-by: Joseph Rotella <7482866+jrr6@users.noreply.github.com> Co-authored-by: Sebastian Graf <sgraf1337@gmail.com> Co-authored-by: Marc Huisinga <mhuisi@protonmail.com> Co-authored-by: Eric Wieser <efw@google.com> Co-authored-by: François G. Dorais <fgdorais@gmail.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: mathlib-nightly-testing[bot] <258991302+mathlib-nightly-testing[bot]@users.noreply.github.com> Co-authored-by: mathlib-nightly-testing[bot] <mathlib-nightly-testing[bot]@users.noreply.github.com>
1 parent d38a304 commit 965500f

File tree

19 files changed

+107
-87
lines changed

19 files changed

+107
-87
lines changed

Batteries/Classes/SatisfiesM.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ theorem SatisfiesM_ReaderT_eq [Monad m] :
193193
(exists_congr fun a => by exact ⟨fun eq _ => eq ▸ rfl, funext⟩).trans Classical.skolem.symm
194194

195195
theorem SatisfiesM_StateRefT_eq [Monad m] :
196-
SatisfiesM (m := StateRefT' ω σ m) p x ↔ ∀ s, SatisfiesM p (x s) := by
197-
simp [SatisfiesM_ReaderT_eq, ReaderT.run]
196+
SatisfiesM (m := StateRefT' ω σ m) p x ↔ ∀ s, SatisfiesM p (x s) :=
197+
SatisfiesM_ReaderT_eq
198198

199199
theorem SatisfiesM_StateT_eq [Monad m] [LawfulMonad m] :
200200
SatisfiesM (m := StateT ρ m) (α := α) p x ↔ ∀ s, SatisfiesM (m := m) (p ·.1) (x.run s) := by

Batteries/Control/AlternativeMonad.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,9 @@ instance [AlternativeMonad m] : AlternativeMonad (StateRefT' ω σ m) where
197197

198198
instance [AlternativeMonad m] [LawfulAlternative m] :
199199
LawfulAlternative (StateRefT' ω σ m) :=
200-
inferInstanceAs (LawfulAlternative (ReaderT _ _))
200+
inferInstanceAs (LawfulAlternative (ReaderT (ST.Ref ω σ) m))
201201

202202
instance [AlternativeMonad m] : LawfulAlternativeLift m (StateRefT' ω σ m) :=
203-
inferInstanceAs (LawfulAlternativeLift m (ReaderT _ _))
203+
inferInstanceAs (LawfulAlternativeLift m (ReaderT (ST.Ref ω σ) m))
204204

205205
end StateRefT'

Batteries/Control/LawfulMonadState.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,4 @@ instance {m σ ρ} [Monad m] [LawfulMonad m] [MonadStateOf σ m] [LawfulMonadSta
222222

223223
instance {m ω σ} [Monad m] [LawfulMonad m] [MonadStateOf σ m] [LawfulMonadStateOf σ m] :
224224
LawfulMonadStateOf σ (StateRefT' ω σ m) :=
225-
inferInstanceAs (LawfulMonadStateOf σ (ReaderT _ _))
225+
inferInstanceAs (LawfulMonadStateOf σ (ReaderT (ST.Ref ω σ) m))

Batteries/Data/Array/Basic.lean

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -27,100 +27,110 @@ arrays, remove duplicates and then compare them elementwise.
2727
def equalSet [BEq α] (xs ys : Array α) : Bool :=
2828
xs.all (ys.contains ·) && ys.all (xs.contains ·)
2929

30-
set_option linter.unusedVariables.funArgs false in
3130
/--
3231
Returns the first minimal element among `d` and elements of the array.
33-
If `start` and `stop` are given, only the subarray `xs[start:stop]` is
32+
If `start` and `stop` are given, only the subarray `xs[start...stop]` is
3433
considered (in addition to `d`).
3534
-/
3635
@[inline]
37-
protected def minWith [ord : Ord α]
36+
protected def rangeMinWith [ord : Ord α]
3837
(xs : Array α) (d : α) (start := 0) (stop := xs.size) : α :=
3938
xs.foldl (init := d) (start := start) (stop := stop) fun min x =>
4039
if compare x min |>.isLT then x else min
4140

42-
set_option linter.unusedVariables.funArgs false in
41+
@[inherit_doc Array.rangeMinWith, deprecated Array.rangeMinWith (since := "2026-01-08")]
42+
protected def minWith := @Array.rangeMinWith
43+
4344
/--
4445
Find the first minimal element of an array. If the array is empty, `d` is
45-
returned. If `start` and `stop` are given, only the subarray `xs[start:stop]` is
46+
returned. If `start` and `stop` are given, only the subarray `xs[start...stop]` is
4647
considered.
4748
-/
4849
@[inline]
49-
protected def minD [ord : Ord α]
50+
protected def rangeMinD [ord : Ord α]
5051
(xs : Array α) (d : α) (start := 0) (stop := xs.size) : α :=
5152
if h: start < xs.size ∧ start < stop then
52-
xs.minWith xs[start] (start + 1) stop
53+
xs.rangeMinWith xs[start] (start + 1) stop
5354
else
5455
d
5556

56-
set_option linter.unusedVariables.funArgs false in
57+
@[inherit_doc Array.rangeMinD, deprecated Array.rangeMinD (since := "2026-01-08")]
58+
protected def minD := @Array.rangeMinD
59+
5760
/--
5861
Find the first minimal element of an array. If the array is empty, `none` is
59-
returned. If `start` and `stop` are given, only the subarray `xs[start:stop]` is
62+
returned. If `start` and `stop` are given, only the subarray `xs[start...stop]` is
6063
considered.
6164
-/
6265
@[inline]
63-
protected def min? [ord : Ord α]
66+
protected def rangeMin? [ord : Ord α]
6467
(xs : Array α) (start := 0) (stop := xs.size) : Option α :=
6568
if h : start < xs.size ∧ start < stop then
66-
some $ xs.minD xs[start] start stop
69+
some $ xs.rangeMinD xs[start] start stop
6770
else
6871
none
6972

70-
set_option linter.unusedVariables.funArgs false in
7173
/--
7274
Find the first minimal element of an array. If the array is empty, `default` is
73-
returned. If `start` and `stop` are given, only the subarray `xs[start:stop]` is
75+
returned. If `start` and `stop` are given, only the subarray `xs[start...stop]` is
7476
considered.
7577
-/
7678
@[inline]
77-
protected def minI [ord : Ord α] [Inhabited α]
79+
protected def rangeMinI [ord : Ord α] [Inhabited α]
7880
(xs : Array α) (start := 0) (stop := xs.size) : α :=
79-
xs.minD default start stop
81+
xs.rangeMinD default start stop
82+
83+
@[inherit_doc Array.rangeMinI, deprecated Array.rangeMinI (since := "2026-01-08")]
84+
protected def minI := @Array.rangeMinI
8085

81-
set_option linter.unusedVariables.funArgs false in
8286
/--
8387
Returns the first maximal element among `d` and elements of the array.
84-
If `start` and `stop` are given, only the subarray `xs[start:stop]` is
88+
If `start` and `stop` are given, only the subarray `xs[start...stop]` is
8589
considered (in addition to `d`).
8690
-/
8791
@[inline]
88-
protected def maxWith [ord : Ord α]
92+
protected def rangeMaxWith [ord : Ord α]
8993
(xs : Array α) (d : α) (start := 0) (stop := xs.size) : α :=
90-
xs.minWith (ord := ord.opposite) d start stop
94+
xs.rangeMinWith (ord := ord.opposite) d start stop
95+
96+
@[inherit_doc Array.rangeMaxWith, deprecated Array.rangeMaxWith (since := "2026-01-08")]
97+
protected def maxWith := @Array.rangeMaxWith
9198

92-
set_option linter.unusedVariables.funArgs false in
9399
/--
94100
Find the first maximal element of an array. If the array is empty, `d` is
95-
returned. If `start` and `stop` are given, only the subarray `xs[start:stop]` is
101+
returned. If `start` and `stop` are given, only the subarray `xs[start...stop]` is
96102
considered.
97103
-/
98104
@[inline]
99-
protected def maxD [ord : Ord α]
105+
protected def rangeMaxD [ord : Ord α]
100106
(xs : Array α) (d : α) (start := 0) (stop := xs.size) : α :=
101-
xs.minD (ord := ord.opposite) d start stop
107+
xs.rangeMinD (ord := ord.opposite) d start stop
108+
109+
@[inherit_doc Array.rangeMaxD, deprecated Array.rangeMaxD (since := "2026-01-08")]
110+
protected def maxD := @Array.rangeMaxD
102111

103-
set_option linter.unusedVariables.funArgs false in
104112
/--
105113
Find the first maximal element of an array. If the array is empty, `none` is
106-
returned. If `start` and `stop` are given, only the subarray `xs[start:stop]` is
114+
returned. If `start` and `stop` are given, only the subarray `xs[start...stop]` is
107115
considered.
108116
-/
109117
@[inline]
110-
protected def max? [ord : Ord α]
118+
protected def rangeMax? [ord : Ord α]
111119
(xs : Array α) (start := 0) (stop := xs.size) : Option α :=
112-
xs.min? (ord := ord.opposite) start stop
120+
xs.rangeMin? (ord := ord.opposite) start stop
113121

114-
set_option linter.unusedVariables.funArgs false in
115122
/--
116123
Find the first maximal element of an array. If the array is empty, `default` is
117-
returned. If `start` and `stop` are given, only the subarray `xs[start:stop]` is
124+
returned. If `start` and `stop` are given, only the subarray `xs[start...stop]` is
118125
considered.
119126
-/
120127
@[inline]
121-
protected def maxI [ord : Ord α] [Inhabited α]
128+
protected def rangeMaxI [ord : Ord α] [Inhabited α]
122129
(xs : Array α) (start := 0) (stop := xs.size) : α :=
123-
xs.minI (ord := ord.opposite) start stop
130+
xs.rangeMinI (ord := ord.opposite) start stop
131+
132+
@[inherit_doc Array.rangeMaxI, deprecated Array.rangeMaxI (since := "2026-01-08")]
133+
protected def maxI := @Array.rangeMaxI
124134

125135
@[deprecated set (since := "2026-02-02")]
126136
alias setN := set

Batteries/Data/Array/Scan.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Prove basic results about `Array.scanl`, `Array.scanr`, `Array.scanlM` and `Arra
1919
-/
2020
namespace Array
2121

22+
set_option backward.isDefEq.respectTransparency false in
2223
theorem scanlM.loop_toList [Monad m] [LawfulMonad m]
2324
{f : β → α → m β} {stop : Nat} (h : stop ≤ as.size) :
2425
Array.toList <$> scanlM.loop f init as start stop h acc =

Batteries/Data/ByteArray.lean

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ theorem getElem_eq_data_getElem (a : ByteArray) (h : i < a.size) : a[i] = a.data
2727

2828
/-! ### push -/
2929

30-
@[simp] theorem size_push (a : ByteArray) (b : UInt8) : (a.push b).size = a.size + 1 :=
31-
Array.size_push ..
32-
3330
@[simp] theorem get_push_eq (a : ByteArray) (x : UInt8) : (a.push x)[a.size] = x :=
3431
Array.getElem_push_eq ..
3532

@@ -81,7 +78,7 @@ theorem get_extract_aux {a : ByteArray} {start stop} (h : i < (a.extract start s
8178

8279
@[simp] theorem get_extract {a : ByteArray} {start stop} (h : i < (a.extract start stop).size) :
8380
(a.extract start stop)[i] = a[start+i]'(get_extract_aux h) := by
84-
simp [getElem_eq_data_getElem]
81+
simp [getElem_eq_data_getElem]; rfl
8582

8683
/-! ### ofFn -/
8784

Batteries/Data/Fin/Fold.lean

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ theorem dfoldrM_loop_zero [Monad m] (f : (i : Fin n) → α i.succ → m (α i.c
2020
theorem dfoldrM_loop_succ [Monad m] (f : (i : Fin n) → α i.succ → m (α i.castSucc)) (x) :
2121
dfoldrM.loop n α f (i+1) h x = f ⟨i, by omega⟩ x >>= dfoldrM.loop n α f i (by omega) := rfl
2222

23+
-- TODO: This proof needs adjustment for lean4#12179 (backward.isDefEq.respectTransparency)
24+
set_option backward.isDefEq.respectTransparency false in
2325
theorem dfoldrM_loop [Monad m] [LawfulMonad m] (f : (i : Fin (n+1)) → α i.succ → m (α i.castSucc))
2426
(x) : dfoldrM.loop (n+1) α f (i+1) h x =
2527
dfoldrM.loop n (α ∘ succ) (f ·.succ) i (by omega) x >>= f 0 := by
@@ -77,7 +79,7 @@ theorem dfoldlM_loop_lt [Monad m] (f : ∀ (i : Fin n), α i.castSucc → m (α
7779

7880
theorem dfoldlM_loop_eq [Monad m] (f : ∀ (i : Fin n), α i.castSucc → m (α i.succ)) (x) :
7981
dfoldlM.loop n α f n (Nat.le_refl _) x = pure x := by
80-
rw [dfoldlM.loop, dif_neg (Nat.lt_irrefl _), cast_eq]
82+
rw [dfoldlM.loop, dif_neg (Nat.lt_irrefl _)]; rfl
8183

8284
@[simp] theorem dfoldlM_zero [Monad m] (f : (i : Fin 0) → α i.castSucc → m (α i.succ)) (x) :
8385
dfoldlM 0 α f x = pure x := by simp [dfoldlM, dfoldlM.loop]
@@ -93,7 +95,7 @@ theorem dfoldlM_loop [Monad m] (f : (i : Fin (n+1)) → α i.castSucc → m (α
9395
cases Nat.le_antisymm (Nat.le_of_lt_succ h) (Nat.not_lt.1 h')
9496
rw [dfoldlM_loop_lt _ h]
9597
congr; funext
96-
rw [dfoldlM_loop_eq, dfoldlM_loop_eq]
98+
rw [dfoldlM_loop_eq, dfoldlM_loop_eq]; rfl
9799

98100
theorem dfoldlM_succ [Monad m] (f : (i : Fin (n+1)) → α i.castSucc → m (α i.succ)) (x) :
99101
dfoldlM (n+1) α f x = f 0 x >>= (dfoldlM n (α ∘ succ) (f ·.succ ·) .) :=

Batteries/Data/List/Lemmas.lean

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,11 +1373,6 @@ theorem sum_singleton [Add α] [Zero α] [Std.LawfulRightIdentity (α := α) (·
13731373
theorem sum_pair [Add α] [Zero α] [Std.LawfulRightIdentity (α := α) (· + ·) 0] {a b : α} :
13741374
[a, b].sum = a + b := by simp [Std.LawfulRightIdentity.right_id]
13751375

1376-
@[simp, grind =]
1377-
theorem sum_append [Add α] [Zero α] [Std.LawfulLeftIdentity (α := α) (· + ·) 0]
1378-
[Std.Associative (α := α) (· + ·)] {l₁ l₂ : List α} : (l₁ ++ l₂).sum = l₁.sum + l₂.sum := by
1379-
induction l₁ with simp [Std.LawfulLeftIdentity.left_id, Std.Associative.assoc, *]
1380-
13811376
theorem sum_concat [Add α] [Zero α] [Std.LawfulIdentity (α := α) (· + ·) 0]
13821377
[Std.Associative (α := α) (· + ·)] {l : List α} {a : α} :
13831378
(l.concat a).sum = l.sum + a := by simp [Std.LawfulRightIdentity.right_id]
@@ -1388,9 +1383,6 @@ theorem sum_flatten [Add α] [Zero α] [Std.LawfulIdentity (α := α) (· + ·)
13881383
l.flatten.sum = (l.map sum).sum := by
13891384
induction l with simp [*]
13901385

1391-
theorem sum_eq_foldr [Add α] [Zero α] {l : List α} :
1392-
l.sum = l.foldr (· + ·) 0 := rfl
1393-
13941386
theorem sum_eq_foldl [Add α] [Zero α] [Std.Associative (α := α) (· + ·)]
13951387
[Std.LawfulIdentity (α := α) (· + ·) 0] {l : List α} :
13961388
l.sum = l.foldl (· + ·) 0 := foldr_eq_foldl ..
@@ -1401,5 +1393,4 @@ theorem take_succ_drop {l : List α} {n stop : Nat}
14011393
rw [← List.take_append_getElem (by simpa [← List.length_drop] using h)]
14021394
simp [List.getElem_drop]
14031395

1404-
@[simp]
1405-
theorem reverse_singleton {a : α} : [a].reverse = [a] := rfl
1396+
attribute [simp] reverse_singleton

Batteries/Data/String/Lemmas.lean

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,6 @@ end Pos.Raw
182182
theorem endPos_eq_zero (s : String) : rawEndPos s = 0 ↔ s = "" :=
183183
rawEndPos_eq_zero_iff
184184

185-
theorem isEmpty_iff (s : String) : isEmpty s ↔ s = "" := by
186-
simp [isEmpty]
187-
188185
/--
189186
Induction along the valid positions in a list of characters.
190187
(This definition is intended only for specification purposes.)

Batteries/Data/Vector/Lemmas.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ theorem get_tail (v : Vector α (n + 1)) (i : Fin n) :
100100

101101
@[simp]
102102
theorem finIdxOf?_empty [BEq α] (v : Vector α 0) : v.finIdxOf? a = none := by
103-
simp [v.eq_empty]
103+
simp [v.eq_empty]; rfl
104104

105105
@[simp]
106106
theorem finIdxOf?_eq_none_iff [BEq α] [LawfulBEq α] {v : Vector α n} {a : α} :

0 commit comments

Comments
 (0)