Skip to content

Commit f033799

Browse files
kim-emleanprover-community-mathlib4-botjcommelinmattrobballTwoFX
authored
chore: bump toolchain to v4.20.0-rc1 (#1219)
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> Co-authored-by: Rob23oba <152706811+Rob23oba@users.noreply.github.com>
1 parent f5d04a9 commit f033799

File tree

13 files changed

+38
-35
lines changed

13 files changed

+38
-35
lines changed

Batteries/Control/AlternativeMonad.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ instance : LawfulAlternative Option.{u} where
120120
map_failure _ := rfl
121121
failure_seq _ := rfl
122122
orElse_failure := Option.orElse_none
123-
failure_orElse := Option.none_orElse
123+
failure_orElse := by simp [failure]
124124
orElse_assoc | some _, _, _ => rfl | none, _, _ => rfl
125125
map_orElse | some _ => by simp | none => by simp
126126

Batteries/Data/BitVec/Lemmas.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ theorem getLsbD_ofFnLE (f : Fin n → Bool) (i) :
5858
(ofFnLE f).getLsbD i = if h : i < n then f ⟨i, h⟩ else false := by
5959
split
6060
· next h => rw [getLsbD_eq_getElem h, getElem_ofFnLE]
61-
· next h => rw [getLsbD_ge _ _ (Nat.ge_of_not_lt h)]
61+
· next h => rw [getLsbD_of_ge _ _ (Nat.ge_of_not_lt h)]
6262

6363
@[simp] theorem getMsb'_ofFnLE (f : Fin n → Bool) (i) : (ofFnLE f).getMsb' i = f i.rev := by
6464
simp [getMsb'_eq_getLsb', Fin.rev]; congr 2; omega
@@ -70,7 +70,7 @@ theorem getMsbD_ofFnLE (f : Fin n → Bool) (i) :
7070
have heq : n - 1 - i = n - (i + 1) := by omega
7171
have hlt : n - (i + 1) < n := by omega
7272
simp [getMsbD_eq_getLsbD, getLsbD_ofFnLE, Fin.rev, h, heq, hlt]
73-
· next h => rw [getMsbD_ge _ _ (Nat.ge_of_not_lt h)]
73+
· next h => rw [getMsbD_of_ge _ _ (Nat.ge_of_not_lt h)]
7474

7575
theorem msb_ofFnLE (f : Fin n → Bool) :
7676
(ofFnLE f).msb = if h : n ≠ 0 then f ⟨n-1, Nat.sub_one_lt h⟩ else false := by

Batteries/Data/Fin/Lemmas.lean

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ theorem findSome?_succ {f : Fin (n+1) → Option α} :
2525
findSome? f = (f 0 <|> findSome? fun i => f i.succ) := by
2626
simp only [findSome?, foldl_succ, Option.none_orElse, Function.comp_apply]
2727
cases f 0
28-
· rw [Option.none_orElse]
29-
· rw [Option.some_orElse]
28+
· rw [Option.orElse_eq_orElse, Option.none_orElse, Option.none_orElse]
29+
· simp only [Option.some_orElse, Option.orElse_eq_orElse, Option.none_orElse]
3030
induction n with
3131
| zero => rfl
3232
| succ n ih => rw [foldl_succ, Option.some_orElse, ih (f := fun i => f i.succ)]
@@ -51,11 +51,11 @@ theorem exists_of_findSome?_eq_some {f : Fin n → Option α} (h : findSome? f =
5151
rw [findSome?_succ] at h
5252
match heq : f 0 with
5353
| some x =>
54-
rw [heq, Option.some_orElse] at h
54+
rw [heq, Option.orElse_eq_orElse, Option.some_orElse] at h
5555
exists 0
5656
rw [heq, h]
5757
| none =>
58-
rw [heq, Option.none_orElse] at h
58+
rw [heq, Option.orElse_eq_orElse, Option.none_orElse] at h
5959
match ih h with | ⟨i, _⟩ => exists i.succ
6060

6161
theorem eq_none_of_findSome?_eq_none {f : Fin n → Option α} (h : findSome? f = none) (i) :
@@ -66,10 +66,10 @@ theorem eq_none_of_findSome?_eq_none {f : Fin n → Option α} (h : findSome? f
6666
rw [findSome?_succ] at h
6767
match heq : f 0 with
6868
| some x =>
69-
rw [heq, Option.some_orElse] at h
69+
rw [heq, Option.orElse_eq_orElse, Option.some_orElse] at h
7070
contradiction
7171
| none =>
72-
rw [heq, Option.none_orElse] at h
72+
rw [heq, Option.orElse_eq_orElse, Option.none_orElse] at h
7373
cases i using Fin.cases with
7474
| zero => exact heq
7575
| succ i => exact ih h i
@@ -106,7 +106,7 @@ theorem map_findSome? (f : Fin n → Option α) (g : α → β) :
106106
| zero => rfl
107107
| succ n ih => simp [findSome?_succ, Function.comp_def, Option.map_orElse, ih]
108108

109-
theorem findSome?_guard {p : Fin n → Bool} : findSome? (Option.guard fun i => p i) = find? p := rfl
109+
theorem findSome?_guard {p : Fin n → Bool} : findSome? (Option.guard p) = find? p := rfl
110110

111111
theorem findSome?_eq_findSome?_finRange (f : Fin n → Option α) :
112112
findSome? f = (List.finRange n).findSome? f := by

Batteries/Data/List/Lemmas.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ theorem dropInfix?_go_eq_some_iff [BEq α] {i l acc p s : List α} :
575575
rw [cons_eq_append_iff] at h₁
576576
simp at h₁
577577
obtain (⟨⟨rfl, rfl⟩, rfl⟩ | ⟨a', h₁, rfl⟩) := h₁
578-
· simp only [nil_beq_iff, isEmpty_iff] at h₂
578+
· simp only [nil_beq_eq, isEmpty_iff] at h₂
579579
simp only [h₂] at h
580580
simp at h
581581
· rw [append_eq_cons_iff] at h₁
@@ -647,7 +647,7 @@ theorem append_eq_of_isPrefixOf?_eq_some [BEq α] [LawfulBEq α] {xs ys zs : Lis
647647

648648
@[simp] theorem isSuffixOf?_eq_some_iff_append_eq [BEq α] [LawfulBEq α] {xs ys zs : List α} :
649649
xs.isSuffixOf? ys = some zs ↔ zs ++ xs = ys := by
650-
simp only [isSuffixOf?, map_eq_some', isPrefixOf?_eq_some_iff_append_eq]
650+
simp only [isSuffixOf?, map_eq_some_iff, isPrefixOf?_eq_some_iff_append_eq]
651651
constructor
652652
· intro
653653
| ⟨_, h, heq⟩ =>

Batteries/Data/Nat/Gcd.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ theorem Coprime.eq_one_of_dvd {k m : Nat} (H : Coprime k m) (d : k ∣ m) : k =
171171

172172
theorem Coprime.gcd_mul (k : Nat) (h : Coprime m n) : gcd k (m * n) = gcd k m * gcd k n :=
173173
Nat.dvd_antisymm
174-
(gcd_mul_dvd_mul_gcd k m n)
174+
(gcd_mul_right_dvd_mul_gcd k m n)
175175
((h.gcd_both k k).mul_dvd_of_dvd_of_dvd
176176
(gcd_dvd_gcd_mul_right_right ..)
177177
(gcd_dvd_gcd_mul_left_right ..))
@@ -183,5 +183,5 @@ theorem gcd_mul_gcd_of_coprime_of_mul_eq_mul
183183
rw [← h]
184184
apply Nat.mul_dvd_mul (gcd_dvd ..).1 (gcd_dvd ..).1
185185
· rw [gcd_comm a, gcd_comm b]
186-
refine Nat.dvd_trans ?_ (gcd_mul_dvd_mul_gcd ..)
186+
refine Nat.dvd_trans ?_ (gcd_mul_right_dvd_mul_gcd ..)
187187
rw [h, gcd_mul_right_right d c]; apply Nat.dvd_refl

Batteries/Data/RBMap/Lemmas.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ theorem zoom_del {t : RBNode α} :
711711
t.zoom cut path = (t', path') →
712712
path.del (t.del cut) (match t with | node c .. => c | _ => red) =
713713
path'.del t'.delRoot (match t' with | node c .. => c | _ => red) := by
714-
unfold RBNode.del; split <;> simp [zoom]
714+
rw [RBNode.del.eq_def]; split <;> simp [zoom]
715715
· intro | rfl, rfl => rfl
716716
· next c a y b =>
717717
split
@@ -1152,7 +1152,7 @@ theorem findEntry?_some_mem_toList {t : RBMap α β cmp} (h : t.findEntry? x = s
11521152

11531153
theorem find?_some_mem_toList {t : RBMap α β cmp} (h : t.find? x = some v) :
11541154
∃ y, (y, v) ∈ toList t ∧ cmp x y = .eq := by
1155-
obtain ⟨⟨y, v⟩, h', rfl⟩ := Option.map_eq_some'.1 h
1155+
obtain ⟨⟨y, v⟩, h', rfl⟩ := Option.map_eq_some_iff.1 h
11561156
exact ⟨_, findEntry?_some_mem_toList h', findEntry?_some_eq_eq h'⟩
11571157

11581158
theorem mem_toList_unique [@TransCmp α cmp] {t : RBMap α β cmp}
@@ -1176,7 +1176,7 @@ theorem findEntry?_some [@TransCmp α cmp] {t : RBMap α β cmp} :
11761176

11771177
theorem find?_some [@TransCmp α cmp] {t : RBMap α β cmp} :
11781178
t.find? x = some v ↔ ∃ y, (y, v) ∈ toList t ∧ cmp x y = .eq := by
1179-
simp only [find?, findEntry?_some, Option.map_eq_some']; constructor
1179+
simp only [find?, findEntry?_some, Option.map_eq_some_iff]; constructor
11801180
· rintro ⟨_, h, rfl⟩; exact ⟨_, h⟩
11811181
· rintro ⟨b, h⟩; exact ⟨_, h, rfl⟩
11821182

@@ -1185,7 +1185,7 @@ theorem contains_iff_findEntry? {t : RBMap α β cmp} :
11851185

11861186
theorem contains_iff_find? {t : RBMap α β cmp} :
11871187
t.contains x ↔ ∃ v, t.find? x = some v := by
1188-
simp only [contains_iff_findEntry?, Prod.exists, find?, Option.map_eq_some', and_comm,
1188+
simp only [contains_iff_findEntry?, Prod.exists, find?, Option.map_eq_some_iff, and_comm,
11891189
exists_eq_left]
11901190
rw [exists_comm]
11911191

Batteries/Data/Rat/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ dividing both `num` and `den` by `g` (which is the gcd of the two) if it is not
4848
if hg : g = 1 then
4949
{ num, den
5050
den_nz := by simp [hg] at den_nz; exact den_nz
51-
reduced := by simp [hg, Int.natAbs_ofNat] at reduced; exact reduced }
51+
reduced := by simp [hg, Int.natAbs_natCast] at reduced; exact reduced }
5252
else { num := num.tdiv g, den := den / g, den_nz, reduced }
5353

5454
theorem Rat.normalize.den_nz {num : Int} {den g : Nat} (den_nz : den ≠ 0)

Batteries/Data/Rat/Lemmas.lean

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ theorem normalize_self (r : Rat) : normalize r.num r.den r.den_nz = r := (mk_eq_
5252
theorem normalize_mul_left {a : Nat} (d0 : d ≠ 0) (a0 : a ≠ 0) :
5353
normalize (↑a * n) (a * d) (Nat.mul_ne_zero a0 d0) = normalize n d d0 := by
5454
simp [normalize_eq, mk'.injEq, Int.natAbs_mul, Nat.gcd_mul_left,
55-
Nat.mul_div_mul_left _ _ (Nat.pos_of_ne_zero a0), Int.ofNat_mul,
55+
Nat.mul_div_mul_left _ _ (Nat.pos_of_ne_zero a0), Int.natCast_mul,
5656
Int.mul_ediv_mul_of_pos _ _ (Int.ofNat_pos.2 <| Nat.pos_of_ne_zero a0)]
5757

5858
theorem normalize_mul_right {a : Nat} (d0 : d ≠ 0) (a0 : a ≠ 0) :
@@ -68,7 +68,7 @@ theorem normalize_eq_iff (z₁ : d₁ ≠ 0) (z₂ : d₂ ≠ 0) :
6868
have hd₁ := Int.ofNat_dvd.2 <| Nat.gcd_dvd_right n₁.natAbs d₁
6969
have hd₂ := Int.ofNat_dvd.2 <| Nat.gcd_dvd_right n₂.natAbs d₂
7070
rw [← Int.ediv_mul_cancel (Int.dvd_trans hd₂ (Int.dvd_mul_left ..)),
71-
Int.mul_ediv_assoc _ hd₂, ← Int.ofNat_ediv, ← h.2, Int.ofNat_ediv,
71+
Int.mul_ediv_assoc _ hd₂, ← Int.natCast_ediv, ← h.2, Int.natCast_ediv,
7272
← Int.mul_ediv_assoc _ hd₁, Int.mul_ediv_assoc' _ hn₁,
7373
Int.mul_right_comm, h.1, Int.ediv_mul_cancel hn₂]
7474
· rw [← normalize_mul_right _ z₂, ← normalize_mul_left z₂ z₁, Int.mul_comm d₁, h]
@@ -172,10 +172,10 @@ theorem divInt_num_den (z : d ≠ 0) (h : n /. d = ⟨n', d', z', c⟩) :
172172
rcases Int.eq_nat_or_neg d with ⟨_, rfl | rfl⟩ <;>
173173
simp_all [divInt_neg', Int.ofNat_eq_zero, Int.neg_eq_zero]
174174
· have ⟨m, h₁, h₂⟩ := mkRat_num_den z h; exists m
175-
simp [Int.ofNat_eq_zero, Int.ofNat_mul, h₁, h₂]
175+
simp [Int.ofNat_eq_zero, Int.natCast_mul, h₁, h₂]
176176
· have ⟨m, h₁, h₂⟩ := mkRat_num_den z h; exists -m
177177
rw [← Int.neg_inj, Int.neg_neg] at h₂
178-
simp [Int.ofNat_eq_zero, Int.ofNat_mul, h₁, h₂, Int.mul_neg, Int.neg_eq_zero]
178+
simp [Int.ofNat_eq_zero, Int.natCast_mul, h₁, h₂, Int.mul_neg, Int.neg_eq_zero]
179179

180180
@[simp] theorem ofInt_ofNat : ofInt (OfNat.ofNat n) = OfNat.ofNat n := rfl
181181

@@ -209,7 +209,7 @@ theorem normalize_add_normalize (n₁ n₂) {d₁ d₂} (z₁ z₂) :
209209
cases e₁ : normalize n₁ d₁ z₁; rcases normalize_num_den e₁ with ⟨g₁, zg₁, rfl, rfl⟩
210210
cases e₂ : normalize n₂ d₂ z₂; rcases normalize_num_den e₂ with ⟨g₂, zg₂, rfl, rfl⟩
211211
simp only [add_def]; rw [← normalize_mul_right _ (Nat.mul_ne_zero zg₁ zg₂)]; congr 1
212-
· rw [Int.add_mul]; simp [Int.ofNat_mul, Int.mul_assoc, Int.mul_left_comm, Int.mul_comm]
212+
· rw [Int.add_mul]; simp [Int.natCast_mul, Int.mul_assoc, Int.mul_left_comm, Int.mul_comm]
213213
· simp [Nat.mul_left_comm, Nat.mul_comm]
214214

215215
theorem mkRat_add_mkRat (n₁ n₂ : Int) {d₁ d₂} (z₁ : d₁ ≠ 0) (z₂ : d₂ ≠ 0) :
@@ -220,8 +220,8 @@ theorem divInt_add_divInt (n₁ n₂ : Int) {d₁ d₂} (z₁ : d₁ ≠ 0) (z
220220
n₁ /. d₁ + n₂ /. d₂ = (n₁ * d₂ + n₂ * d₁) /. (d₁ * d₂) := by
221221
rcases Int.eq_nat_or_neg d₁ with ⟨_, rfl | rfl⟩ <;>
222222
rcases Int.eq_nat_or_neg d₂ with ⟨_, rfl | rfl⟩ <;>
223-
simp_all [-Int.natCast_mul, Int.ofNat_eq_zero, Int.neg_eq_zero, divInt_neg', Int.mul_neg,
224-
Int.ofNat_mul_ofNat, Int.neg_add, Int.neg_mul, mkRat_add_mkRat]
223+
simp_all [Int.natCast_mul, Int.ofNat_eq_zero, Int.neg_eq_zero, divInt_neg', Int.mul_neg,
224+
Int.neg_add, Int.neg_mul, mkRat_add_mkRat]
225225

226226
@[simp] theorem neg_num (a : Rat) : (-a).num = -a.num := rfl
227227
@[simp] theorem neg_den (a : Rat) : (-a).den = a.den := rfl
@@ -246,7 +246,7 @@ theorem sub_def (a b : Rat) :
246246
(Nat.dvd_trans (Nat.gcd_dvd_right ..) <|
247247
Nat.dvd_trans (Nat.gcd_dvd_right ..) (Nat.dvd_mul_left ..)),
248248
← normalize_mul_right _ this]; congr 1
249-
· simp only [Int.sub_mul, Int.mul_assoc, Int.ofNat_mul_ofNat,
249+
· simp only [Int.sub_mul, Int.mul_assoc, Int.natCast_mul,
250250
Nat.div_mul_cancel (Nat.gcd_dvd_left ..), Nat.div_mul_cancel (Nat.gcd_dvd_right ..)]
251251
· rw [Nat.mul_right_comm, Nat.div_mul_cancel (Nat.gcd_dvd_left ..)]
252252

@@ -267,7 +267,7 @@ theorem mul_def (a b : Rat) :
267267
have H1 : a.num.natAbs.gcd b.den ≠ 0 := Nat.gcd_ne_zero_right b.den_nz
268268
have H2 : b.num.natAbs.gcd a.den ≠ 0 := Nat.gcd_ne_zero_right a.den_nz
269269
rw [mk_eq_normalize, ← normalize_mul_right _ (Nat.mul_ne_zero H1 H2)]; congr 1
270-
· rw [Int.ofNat_mul, ← Int.mul_assoc, Int.mul_right_comm (Int.tdiv ..),
270+
· rw [Int.natCast_mul, ← Int.mul_assoc, Int.mul_right_comm (Int.tdiv ..),
271271
Int.tdiv_mul_cancel (Int.ofNat_dvd_left.2 <| Nat.gcd_dvd_left ..), Int.mul_assoc,
272272
Int.tdiv_mul_cancel (Int.ofNat_dvd_left.2 <| Nat.gcd_dvd_left ..)]
273273
· rw [← Nat.mul_assoc, Nat.mul_right_comm, Nat.mul_right_comm (_/_),
@@ -288,7 +288,7 @@ theorem normalize_mul_normalize (n₁ n₂) {d₁ d₂} (z₁ z₂) :
288288
cases e₁ : normalize n₁ d₁ z₁; rcases normalize_num_den e₁ with ⟨g₁, zg₁, rfl, rfl⟩
289289
cases e₂ : normalize n₂ d₂ z₂; rcases normalize_num_den e₂ with ⟨g₂, zg₂, rfl, rfl⟩
290290
simp only [mul_def]; rw [← normalize_mul_right _ (Nat.mul_ne_zero zg₁ zg₂)]; congr 1
291-
· simp [Int.ofNat_mul, Int.mul_assoc, Int.mul_left_comm]
291+
· simp [Int.natCast_mul, Int.mul_assoc, Int.mul_left_comm]
292292
· simp [Nat.mul_left_comm, Nat.mul_comm]
293293

294294
theorem mkRat_mul_mkRat (n₁ n₂ : Int) (d₁ d₂) :
@@ -300,8 +300,7 @@ theorem divInt_mul_divInt (n₁ n₂ : Int) {d₁ d₂} (z₁ : d₁ ≠ 0) (z
300300
(n₁ /. d₁) * (n₂ /. d₂) = (n₁ * n₂) /. (d₁ * d₂) := by
301301
rcases Int.eq_nat_or_neg d₁ with ⟨_, rfl | rfl⟩ <;>
302302
rcases Int.eq_nat_or_neg d₂ with ⟨_, rfl | rfl⟩ <;>
303-
simp_all [-Int.natCast_mul, divInt_neg', Int.mul_neg, Int.ofNat_mul_ofNat, Int.neg_mul,
304-
mkRat_mul_mkRat]
303+
simp_all [← Int.natCast_mul, divInt_neg', Int.mul_neg, Int.neg_mul, mkRat_mul_mkRat]
305304

306305
theorem inv_def (a : Rat) : a.inv = a.den /. a.num := by
307306
unfold Rat.inv; split

Batteries/Data/String/Lemmas.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ theorem revFindAux_of_valid (p) : ∀ l r,
300300
simp only [utf8Len_reverse, Char.reduceDefault, List.headD_cons] at h1 h2
301301
simp only [List.reverse_cons, List.append_assoc, List.singleton_append, utf8Len_cons, h2, h1]
302302
cases p c <;> simp only [Bool.false_eq_true, ↓reduceIte, Bool.not_false, Bool.not_true,
303-
List.tail?_cons, Option.map_some']
303+
List.tail?_cons, Option.map_some]
304304
exact revFindAux_of_valid p l (c::r)
305305

306306
theorem revFind_of_valid (p s) :

Batteries/Tactic/Lint/Frontend.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ The first `drop_fn_chars` characters are stripped from the filename.
149149
-/
150150
def groupedByFilename (results : Std.HashMap Name MessageData) (useErrorFormat : Bool := false) :
151151
CoreM MessageData := do
152-
let sp ← if useErrorFormat then initSrcSearchPath ["."] else pure {}
152+
let sp ← if useErrorFormat then getSrcSearchPath else pure {}
153153
let grouped : Std.HashMap Name (System.FilePath × Std.HashMap Name MessageData) ←
154154
results.foldM (init := {}) fun grouped declName msg => do
155155
let mod ← findModuleOf? declName

0 commit comments

Comments
 (0)