Skip to content

Commit 5a56dfa

Browse files
kim-emleanprover-community-mathlib4-botjcommelinmattrobballTwoFX
authored
chore: bump toolchain to v4.19.0-rc1 (#1186)
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Johan Commelin <johan@commelin.net> Co-authored-by: Matthew Ballard <matt@mrb.email> Co-authored-by: Markus Himmel <markus@lean-fro.org> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com> Co-authored-by: Sebastian Ullrich <sebasti@nullri.ch> Co-authored-by: Joachim Breitner <mail@joachim-breitner.de> Co-authored-by: Mac Malone <mac@lean-fro.org>
1 parent 6135103 commit 5a56dfa

File tree

20 files changed

+56
-58
lines changed

20 files changed

+56
-58
lines changed

Batteries/Classes/SatisfiesM.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,9 @@ instance [Monad m] [LawfulMonad m] [MonadSatisfying m] : MonadSatisfying (Except
275275
satisfying {α p x} h :=
276276
let x' := satisfying (SatisfiesM_ExceptT_eq.mp h)
277277
ExceptT.mk ((fun ⟨y, w⟩ => y.pmap fun a h => ⟨a, w _ h⟩) <$> x')
278-
val_eq {α p x} h:= by
278+
val_eq {α p x} h := by
279279
ext
280-
rw [← MonadSatisfying.val_eq (SatisfiesM_ExceptT_eq.mp h)]
280+
refine Eq.trans ?_ (MonadSatisfying.val_eq (SatisfiesM_ExceptT_eq.mp h))
281281
simp
282282

283283
instance : MonadSatisfying (EStateM ε σ) where

Batteries/Data/AssocList.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def toListTR (as : AssocList α β) : List (α × β) :=
7878

7979
@[csimp] theorem toList_eq_toListTR : @toList = @toListTR := by
8080
funext α β as; simp [toListTR]
81-
exact .symm <| (Array.foldl_toList_eq_map (toList as) _ id).trans (List.map_id _)
81+
exact .symm <| Array.foldl_toList_eq_map.trans (List.map_id _)
8282

8383
/-- `O(n)`. Run monadic function `f` on all elements in the list, from head to tail. -/
8484
@[specialize] def forM [Monad m] (f : α → β → m PUnit) : AssocList α β → m PUnit

Batteries/Data/ByteArray.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ theorem getElem_eq_data_getElem (a : ByteArray) (h : i < a.size) : a[i] = a.data
2121

2222
/-! ### empty -/
2323

24-
@[simp] theorem data_mkEmpty (cap) : (mkEmpty cap).data = #[] := rfl
24+
@[simp] theorem data_mkEmpty (cap) : (emptyWithCapacity cap).data = #[] := rfl
2525

2626
@[simp] theorem data_empty : empty.data = #[] := rfl
2727

@@ -51,7 +51,7 @@ theorem get_push_lt (a : ByteArray) (x : UInt8) (i : Nat) (h : i < a.size) :
5151
Array.size_set ..
5252

5353
@[simp] theorem get_set_eq (a : ByteArray) (i : Fin a.size) (v : UInt8) : (a.set i v)[i.val] = v :=
54-
Array.getElem_set_self _ _ _ _
54+
Array.getElem_set_self _
5555

5656
theorem get_set_ne (a : ByteArray) (i : Fin a.size) (v : UInt8) (hj : j < a.size) (h : i.val ≠ j) :
5757
(a.set i v)[j]'(a.size_set .. ▸ hj) = a[j] :=
@@ -114,13 +114,13 @@ theorem get_extract_aux {a : ByteArray} {start stop} (h : i < (a.extract start s
114114

115115
/--- `ofFn f` with `f : Fin n → UInt8` returns the byte array whose `i`th element is `f i`. --/
116116
@[inline] def ofFn (f : Fin n → UInt8) : ByteArray :=
117-
Fin.foldl n (fun acc i => acc.push (f i)) (mkEmpty n)
117+
Fin.foldl n (fun acc i => acc.push (f i)) (emptyWithCapacity n)
118118

119119
@[simp] theorem ofFn_zero (f : Fin 0 → UInt8) : ofFn f = empty := rfl
120120

121121
theorem ofFn_succ (f : Fin (n+1) → UInt8) :
122122
ofFn f = (ofFn fun i => f i.castSucc).push (f (Fin.last n)) := by
123-
simp [ofFn, Fin.foldl_succ_last, mkEmpty]
123+
simp [ofFn, Fin.foldl_succ_last, emptyWithCapacity]
124124

125125
@[simp] theorem data_ofFn (f : Fin n → UInt8) : (ofFn f).data = .ofFn f := by
126126
induction n with

Batteries/Data/HashMap/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ abbrev _root_.Batteries.HashMap (α : Type u) (β : Type v) [BEq α] [Hashable
2323

2424
/-- Make a new hash map with the specified capacity. -/
2525
@[inline] def _root_.Batteries.mkHashMap [BEq α] [Hashable α] (capacity := 0) : HashMap α β :=
26-
⟨.empty capacity, .empty
26+
⟨.emptyWithCapacity capacity, .emptyWithCapacity
2727

2828
instance [BEq α] [Hashable α] : Inhabited (HashMap α β) where
2929
default := mkHashMap

Batteries/Data/HashMap/Lemmas.lean

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Kim Morrison
55
-/
66
import Batteries.Data.HashMap.Basic
7+
import Batteries.Tactic.Alias
78

89
/-!
910
# Lemmas for `Batteries.HashMap`
@@ -14,5 +15,5 @@ more lemmas. See the module `Std.Data.HashMap.Lemmas`.
1415

1516
namespace Batteries.HashMap
1617

17-
@[simp] theorem empty_find? [BEq α] [Hashable α] {a : α} :
18-
(∅ : HashMap α β).find? a = none := Std.HashMap.getElem?_empty
18+
@[deprecated (since := "2025-03-31")]
19+
alias empty_find? := Std.HashMap.getElem?_empty

Batteries/Data/List/Lemmas.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ theorem dropLast_eq_eraseIdx {xs : List α} {i : Nat} (last_idx : i + 1 = xs.len
3838

3939
/-! ### set -/
4040

41-
theorem set_eq_modify (a : α) : ∀ n (l : List α), set l n a = modify (fun _ => a) n l
41+
theorem set_eq_modify (a : α) : ∀ n (l : List α), l.set n a = l.modify n (fun _ => a)
4242
| 0, l => by cases l <;> rfl
4343
| _+1, [] => rfl
4444
| _+1, _ :: _ => congrArg (cons _) (set_eq_modify _ _ _)
@@ -48,7 +48,7 @@ theorem set_eq_take_cons_drop (a : α) {n l} (h : n < length l) :
4848
rw [set_eq_modify, modify_eq_take_cons_drop h]
4949

5050
theorem modify_eq_set_getElem? (f : α → α) :
51-
∀ n (l : List α), l.modify f n = ((fun a => l.set n (f a)) <$> l[n]?).getD l
51+
∀ n (l : List α), l.modify n f = ((fun a => l.set n (f a)) <$> l[n]?).getD l
5252
| 0, l => by cases l <;> simp
5353
| _+1, [] => rfl
5454
| n+1, b :: l =>
@@ -57,7 +57,7 @@ theorem modify_eq_set_getElem? (f : α → α) :
5757
@[deprecated (since := "2025-02-15")] alias modify_eq_set_get? := modify_eq_set_getElem?
5858

5959
theorem modify_eq_set_get (f : α → α) {n} {l : List α} (h) :
60-
l.modify f n = l.set n (f (l.get ⟨n, h⟩)) := by
60+
l.modify n f = l.set n (f (l.get ⟨n, h⟩)) := by
6161
rw [modify_eq_set_getElem?, getElem?_eq_getElem h]; rfl
6262

6363
theorem getElem?_set_eq_of_lt (a : α) {n} {l : List α} (h : n < length l) :
@@ -184,7 +184,7 @@ theorem disjoint_of_disjoint_cons_left {l₁ l₂} : Disjoint (a :: l₁) l₂
184184
theorem disjoint_of_disjoint_cons_right {l₁ l₂} : Disjoint l₁ (a :: l₂) → Disjoint l₁ l₂ :=
185185
disjoint_of_subset_right (subset_cons_self _ _)
186186

187-
@[simp] theorem disjoint_nil_left (l : List α) : Disjoint [] l := fun a => (not_mem_nil a).elim
187+
@[simp] theorem disjoint_nil_left (l : List α) : Disjoint [] l := fun _ => not_mem_nil.elim
188188

189189
@[simp] theorem disjoint_nil_right (l : List α) : Disjoint l [] := by
190190
rw [disjoint_comm]; exact disjoint_nil_left _
@@ -328,7 +328,7 @@ theorem Sublist.diff_right : ∀ {l₁ l₂ l₃ : List α}, l₁ <+ l₂ → l
328328

329329
theorem Sublist.erase_diff_erase_sublist {a : α} :
330330
∀ {l₁ l₂ : List α}, l₁ <+ l₂ → (l₂.erase a).diff (l₁.erase a) <+ l₂.diff l₁
331-
| [], _, _ => erase_sublist _ _
331+
| [], _, _ => erase_sublist
332332
| b :: l₁, l₂, h => by
333333
if heq : b = a then
334334
simp [heq]

Batteries/Data/List/Monadic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ theorem satisfiesM_foldlM [Monad m] [LawfulMonad m] {f : β → α → m β} (h
2020
| cons hd tl ih =>
2121
simp only [foldlM_cons]
2222
apply SatisfiesM.bind_pre
23-
let ⟨q, qh⟩ := h₁ b h₀ hd (mem_cons_self hd tl)
23+
let ⟨q, qh⟩ := h₁ b h₀ hd mem_cons_self
2424
exact ⟨(fun ⟨b, bh⟩ => ⟨b, ih bh (fun b bh a am => h₁ b bh a (mem_cons_of_mem hd am))⟩) <$> q,
2525
by simpa using qh⟩
2626

@@ -33,7 +33,7 @@ theorem satisfiesM_foldrM [Monad m] [LawfulMonad m] {f : α → β → m β} (h
3333
simp only [foldrM_cons]
3434
apply SatisfiesM.bind_pre
3535
let ⟨q, qh⟩ := ih (fun a am b hb => h₁ a (mem_cons_of_mem hd am) b hb)
36-
exact ⟨(fun ⟨b, bh⟩ => ⟨b, h₁ hd (mem_cons_self hd tl) b bh⟩) <$> q,
36+
exact ⟨(fun ⟨b, bh⟩ => ⟨b, h₁ hd mem_cons_self b bh⟩) <$> q,
3737
by simpa using qh⟩
3838

3939
end List

Batteries/Data/List/Pairwise.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ theorem pwFilter_map [DecidableRel (α := α) R] (f : β → α) :
5353
| x :: xs => by
5454
if h : ∀ b ∈ pwFilter R (map f xs), R (f x) b then
5555
have h' : ∀ b : β, b ∈ pwFilter (fun x y : β => R (f x) (f y)) xs → R (f x) (f b) :=
56-
fun b hb => h _ (by rw [pwFilter_map f xs]; apply mem_map_of_mem _ hb)
56+
fun b hb => h _ (by rw [pwFilter_map f xs]; apply mem_map_of_mem hb)
5757
rw [map, pwFilter_cons_of_pos h, pwFilter_cons_of_pos h', pwFilter_map f xs, map]
5858
else
5959
rw [map, pwFilter_cons_of_neg h, pwFilter_cons_of_neg ?_, pwFilter_map f xs]
@@ -99,7 +99,7 @@ theorem forall_mem_pwFilter [DecidableRel (α := α) R]
9999
(∀ b ∈ pwFilter R l, R a b) ↔ ∀ b ∈ l, R a b := by
100100
refine ⟨?_, fun h b hb => h _ <| pwFilter_subset (R := R) _ hb⟩
101101
induction l with
102-
| nil => exact fun _ _ h => (not_mem_nil _ h).elim
102+
| nil => exact fun _ _ h => (not_mem_nil h).elim
103103
| cons x l IH =>
104104
simp only [forall_mem_cons]
105105
if h : ∀ y ∈ pwFilter R l, R x y then

Batteries/Data/List/Perm.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ theorem Subperm.filter (p : α → Bool) ⦃l l' : List α⦄ (h : l <+~ l') :
7979
end Subperm
8080

8181
theorem Subperm.countP_le (p : α → Bool) {l₁ l₂ : List α} : l₁ <+~ l₂ → countP p l₁ ≤ countP p l₂
82-
| ⟨_l, p', s⟩ => p'.countP_eq p ▸ s.countP_le p
82+
| ⟨_l, p', s⟩ => p'.countP_eq p ▸ s.countP_le
8383

8484
theorem Subperm.count_le [DecidableEq α] {l₁ l₂ : List α} (s : l₁ <+~ l₂) (a) :
8585
count a l₁ ≤ count a l₂ := s.countP_le _
@@ -102,7 +102,7 @@ theorem cons_subperm_of_not_mem_of_mem {a : α} {l₁ l₂ : List α} (h₁ : a
102102
| .inl e => subst_vars; exact ⟨_ :: r₁, p.cons _, s'.cons₂ _⟩
103103
| .inr m => let ⟨t, p', s'⟩ := ih h₁ m p; exact ⟨t, p', s'.cons _⟩
104104
| @cons₂ _ r₂ b _ ih =>
105-
have bm : b ∈ l₁ := p.subset <| mem_cons_self _ _
105+
have bm : b ∈ l₁ := p.subset mem_cons_self
106106
have am : a ∈ r₂ := by
107107
simp only [find?, mem_cons] at h₂
108108
exact h₂.resolve_left fun e => h₁ <| e.symm ▸ bm
@@ -174,7 +174,7 @@ theorem subperm_cons_erase (a : α) (l : List α) : l <+~ a :: l.erase a :=
174174
else
175175
(erase_of_not_mem h).symm ▸ (sublist_cons_self _ _).subperm
176176

177-
theorem erase_subperm (a : α) (l : List α) : l.erase a <+~ l := (erase_sublist _ _).subperm
177+
theorem erase_subperm (a : α) (l : List α) : l.erase a <+~ l := erase_sublist.subperm
178178

179179
theorem Subperm.erase {l₁ l₂ : List α} (a : α) (h : l₁ <+~ l₂) : l₁.erase a <+~ l₂.erase a :=
180180
let ⟨l, hp, hs⟩ := h
@@ -248,7 +248,7 @@ theorem subperm_append_diff_self_of_count_le {l₁ l₂ : List α}
248248
refine IH fun x hx => ?_
249249
specialize h x (.tail _ hx)
250250
rw [perm_iff_count.mp this] at h
251-
if hx : x = hd then subst hd; simpa [Nat.succ_le_succ_iff] using h
251+
if hx : hd = x then subst hd; simpa [Nat.succ_le_succ_iff] using h
252252
else simpa [hx] using h
253253

254254
/-- The list version of `Multiset.le_iff_count`. -/
@@ -271,7 +271,7 @@ theorem Subperm.cons_left {l₁ l₂ : List α} (h : l₁ <+~ l₂) (x : α) (hx
271271
if hy' : y = x then
272272
subst x; simpa using Nat.succ_le_of_lt hx
273273
else
274-
rw [count_cons_of_ne hy']
274+
rw [count_cons_of_ne (Ne.symm hy')]
275275
refine h y ?_
276276
simpa [hy'] using hy
277277

Batteries/Data/String/Lemmas.lean

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,10 +430,8 @@ theorem splitAux_of_valid (p l m r acc) :
430430
_ ∧ _ ∧ _),
431431
List.splitOnP.go, List.reverse_reverse]
432432
split <;> rename_i h
433-
· simp_all only [List.head?_cons, Option.getD_some]
434-
simpa [Nat.add_assoc] using splitAux_of_valid p (l++m++[c]) [] r (⟨m⟩::acc)
435-
· simp_all only [List.head?_cons, Option.getD_some]
436-
simpa [Nat.add_assoc] using splitAux_of_valid p l (m++[c]) r acc
433+
· simpa [Nat.add_assoc] using splitAux_of_valid p (l++m++[c]) [] r (⟨m⟩::acc)
434+
· simpa [Nat.add_assoc] using splitAux_of_valid p l (m++[c]) r acc
437435

438436
theorem split_of_valid (s p) : split s p = (List.splitOnP p s.1).map mk := by
439437
simpa [split] using splitAux_of_valid p [] [] s.1 []

0 commit comments

Comments
 (0)