Skip to content

Commit 2c8d12c

Browse files
kim-emalexkeizer
andcommitted
chore: bump to std#260 (#7134)
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Alex Keizer <alex@keizer.dev>
1 parent bb43800 commit 2c8d12c

File tree

9 files changed

+23
-102
lines changed

9 files changed

+23
-102
lines changed

Mathlib/Combinatorics/Composition.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ theorem length_splitWrtComposition (l : List α) (c : Composition n) :
690690
theorem map_length_splitWrtCompositionAux {ns : List ℕ} :
691691
∀ {l : List α}, ns.sum ≤ l.length → map length (l.splitWrtCompositionAux ns) = ns := by
692692
induction' ns with n ns IH <;> intro l h <;> simp at h
693-
· simp
693+
· simp [splitWrtCompositionAux]
694694
have := le_trans (Nat.le_add_right _ _) h
695695
simp only [splitWrtCompositionAux_cons, this]; dsimp
696696
rw [length_take, IH] <;> simp [length_drop]

Mathlib/Data/List/Basic.lean

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -651,10 +651,6 @@ theorem length_dropLast : ∀ l : List α, length l.dropLast = length l - 1
651651
simp
652652
#align list.length_init List.length_dropLast
653653

654-
-- Porting note: `rw [dropLast]` in Lean4 generates a goal `(b::l) ≠ []`
655-
-- so we use this lemma instead
656-
theorem dropLast_cons_cons (a b : α) (l : List α) : dropLast (a::b::l) = a::dropLast (b::l) := rfl
657-
658654
/-! ### getLast -/
659655

660656
@[simp]
@@ -699,7 +695,7 @@ theorem dropLast_append_getLast : ∀ {l : List α} (h : l ≠ []), dropLast l +
699695
| [], h => absurd rfl h
700696
| [a], h => rfl
701697
| a :: b :: l, h => by
702-
rw [dropLast_cons_cons, cons_append, getLast_cons (cons_ne_nil _ _)]
698+
rw [dropLast_cons₂, cons_append, getLast_cons (cons_ne_nil _ _)]
703699
congr
704700
exact dropLast_append_getLast (cons_ne_nil b l)
705701
#align list.init_append_last List.dropLast_append_getLast
@@ -782,7 +778,7 @@ theorem dropLast_append_getLast? : ∀ {l : List α}, ∀ a ∈ l.getLast?, drop
782778
| [a], _, rfl => rfl
783779
| a :: b :: l, c, hc => by
784780
rw [getLast?_cons_cons] at hc
785-
rw [dropLast_cons_cons, cons_append, dropLast_append_getLast? _ hc]
781+
rw [dropLast_cons₂, cons_append, dropLast_append_getLast? _ hc]
786782
#align list.init_append_last' List.dropLast_append_getLast?
787783

788784
theorem getLastI_eq_getLast? [Inhabited α] : ∀ l : List α, l.getLastI = l.getLast?.iget
@@ -1877,9 +1873,6 @@ theorem zipWith_flip (f : α → β → γ) : ∀ as bs, zipWith (flip f) bs as
18771873

18781874
/-! ### take, drop -/
18791875

1880-
@[simp]
1881-
theorem take_zero (l : List α) : take 0 l = [] :=
1882-
rfl
18831876
#align list.take_zero List.take_zero
18841877

18851878
#align list.take_nil List.take_nil
@@ -2043,7 +2036,7 @@ theorem dropLast_take {n : ℕ} {l : List α} (h : n < l.length) :
20432036
#align list.init_take List.dropLast_take
20442037

20452038
theorem dropLast_cons_of_ne_nil {α : Type*} {x : α}
2046-
{l : List α} (h : l ≠ []) : (x :: l).dropLast = x :: l.dropLast := by simp [h]
2039+
{l : List α} (h : l ≠ []) : (x :: l).dropLast = x :: l.dropLast := by simp [h, dropLast]
20472040
#align list.init_cons_of_ne_nil List.dropLast_cons_of_ne_nil
20482041

20492042
@[simp]
@@ -2343,26 +2336,9 @@ theorem foldr_ext (f g : α → β → β) (b : β) {l : List α} (H : ∀ a ∈
23432336
simp only [foldr, ih H.2, H.1]
23442337
#align list.foldr_ext List.foldr_ext
23452338

2346-
@[simp]
2347-
theorem foldl_nil (f : α → β → α) (a : α) : foldl f a [] = a :=
2348-
rfl
23492339
#align list.foldl_nil List.foldl_nil
2350-
2351-
@[simp]
2352-
theorem foldl_cons (f : α → β → α) (a : α) (b : β) (l : List β) :
2353-
foldl f a (b :: l) = foldl f (f a b) l :=
2354-
rfl
23552340
#align list.foldl_cons List.foldl_cons
2356-
2357-
@[simp]
2358-
theorem foldr_nil (f : α → β → β) (b : β) : foldr f b [] = b :=
2359-
rfl
23602341
#align list.foldr_nil List.foldr_nil
2361-
2362-
@[simp]
2363-
theorem foldr_cons (f : α → β → β) (b : β) (a : α) (l : List α) :
2364-
foldr f b (a :: l) = f a (foldr f b l) :=
2365-
rfl
23662342
#align list.foldr_cons List.foldr_cons
23672343

23682344
#align list.foldl_append List.foldl_append
@@ -2748,18 +2724,9 @@ section FoldlMFoldrM
27482724

27492725
variable {m : Type v → Type w} [Monad m]
27502726

2751-
@[simp]
2752-
theorem foldlM_nil (f : β → α → m β) {b} : List.foldlM f b [] = pure b :=
2753-
rfl
27542727
#align list.mfoldl_nil List.foldlM_nil
2755-
27562728
-- Porting note: now in std
27572729
#align list.mfoldr_nil List.foldrM_nil
2758-
2759-
@[simp]
2760-
theorem foldlM_cons {f : β → α → m β} {b a l} :
2761-
List.foldlM f b (a :: l) = f b a >>= fun b' => List.foldlM f b' l :=
2762-
rfl
27632730
#align list.mfoldl_cons List.foldlM_cons
27642731

27652732
/- Porting note: now in std; now assumes an instance of `LawfulMonad m`, so we make everything
@@ -2795,9 +2762,6 @@ end FoldlMFoldrM
27952762

27962763
/-! ### intersperse -/
27972764

2798-
@[simp]
2799-
theorem intersperse_nil {α : Type u} (a : α) : intersperse a [] = [] :=
2800-
rfl
28012765
#align list.intersperse_nil List.intersperse_nil
28022766

28032767
@[simp]
@@ -3195,18 +3159,13 @@ section find?
31953159

31963160
variable {p : α → Bool} {l : List α} {a : α}
31973161

3198-
@[simp]
3199-
theorem find?_nil (p : α → Bool) : find? p [] = none :=
3200-
rfl
32013162
#align list.find_nil List.find?_nil
32023163

3203-
-- Porting note: List.find? is given @[simp] in Std.Data.List.Init.Lemmas
32043164
-- @[simp]
32053165
-- Later porting note (at time of this lemma moving to Std): removing attribute `nolint simpNF`
32063166
attribute [simp 1100] find?_cons_of_pos
32073167
#align list.find_cons_of_pos List.find?_cons_of_pos
32083168

3209-
-- Porting note: List.find? is given @[simp] in Std.Data.List.Init.Lemmas
32103169
-- @[simp]
32113170
-- Later porting note (at time of this lemma moving to Std): removing attribute `nolint simpNF`
32123171
attribute [simp 1100] find?_cons_of_neg
@@ -3818,15 +3777,8 @@ theorem enum_nil : enum ([] : List α) = [] :=
38183777
rfl
38193778
#align list.enum_nil List.enum_nil
38203779

3821-
@[simp]
3822-
theorem enumFrom_nil (n : ℕ) : enumFrom n ([] : List α) = [] :=
3823-
rfl
38243780
#align list.enum_from_nil List.enumFrom_nil
38253781

3826-
@[simp]
3827-
theorem enumFrom_cons (x : α) (xs : List α) (n : ℕ) :
3828-
enumFrom n (x :: xs) = (n, x) :: enumFrom (n + 1) xs :=
3829-
rfl
38303782
#align list.enum_from_cons List.enumFrom_cons
38313783

38323784
@[simp]

Mathlib/Data/List/Chain.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ theorem chain_iff_forall₂ :
7272
| a, [] => by simp
7373
| a, b :: l => by
7474
by_cases h : l = [] <;>
75-
simp [@chain_iff_forall₂ b l, *]
75+
simp [@chain_iff_forall₂ b l, dropLast, *]
7676
#align list.chain_iff_forall₂ List.chain_iff_forall₂
7777

7878
theorem chain_append_singleton_iff_forall₂ : Chain R a (l ++ [b]) ↔ Forall₂ R (a :: l) (l ++ [b]) :=

Mathlib/Data/List/EditDistance/Defs.lean

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -251,21 +251,17 @@ theorem suffixLevenshtein_eq_tails_map (xs ys) :
251251

252252
@[simp]
253253
theorem levenshtein_nil_nil : levenshtein C [] [] = 0 := by
254-
simp [levenshtein]
254+
simp [levenshtein, suffixLevenshtein]
255255

256256
@[simp]
257257
theorem levenshtein_nil_cons (y) (ys) :
258258
levenshtein C [] (y :: ys) = C.insert y + levenshtein C [] ys := by
259-
dsimp [levenshtein]
259+
dsimp [levenshtein, suffixLevenshtein, impl]
260260
congr
261261
rw [List.getLast_eq_get]
262262
congr
263263
rw [show (List.length _) = 1 from _]
264-
induction ys with
265-
| nil => simp
266-
| cons y ys ih =>
267-
simp only [List.foldr]
268-
rw [impl_length] <;> simp [ih]
264+
induction ys <;> simp
269265

270266
@[simp]
271267
theorem levenshtein_cons_nil (x : α) (xs : List α) :

Mathlib/Data/List/Indexes.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,15 @@ theorem mapIdx_eq_enum_map (l : List α) (f : ℕ → α → β) :
167167
induction' l with hd tl hl generalizing f
168168
· rfl
169169
· rw [List.oldMapIdx, List.oldMapIdxCore, List.oldMapIdxCore_eq, hl]
170-
simp [enum_eq_zip_range, map_uncurry_zip_eq_zipWith]
170+
simp [map, enum_eq_zip_range, map_uncurry_zip_eq_zipWith]
171171
#align list.map_with_index_eq_enum_map List.mapIdx_eq_enum_map
172172

173173
@[simp]
174174
theorem mapIdx_cons {α β} (l : List α) (f : ℕ → α → β) (a : α) :
175175
mapIdx f (a :: l) = f 0 a :: mapIdx (fun i ↦ f (i + 1)) l := by
176176
simp [mapIdx_eq_enum_map, enum_eq_zip_range, map_uncurry_zip_eq_zipWith,
177177
range_succ_eq_map, zipWith_map_left]
178+
rfl
178179
#align list.map_with_index_cons List.mapIdx_cons
179180

180181
theorem mapIdx_append {α} (K L : List α) (f : ℕ → α → β) :

Mathlib/Data/List/Zip.lean

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,52 +30,29 @@ namespace List
3030

3131
variable {α : Type u} {β γ δ ε : Type*}
3232

33-
@[simp]
34-
theorem zipWith_cons_cons (f : α → β → γ) (a : α) (b : β) (l₁ : List α) (l₂ : List β) :
35-
zipWith f (a :: l₁) (b :: l₂) = f a b :: zipWith f l₁ l₂ := rfl
3633
#align list.zip_with_cons_cons List.zipWith_cons_cons
37-
38-
@[simp]
39-
theorem zip_cons_cons (a : α) (b : β) (l₁ : List α) (l₂ : List β) :
40-
zip (a :: l₁) (b :: l₂) = (a, b) :: zip l₁ l₂ := rfl
4134
#align list.zip_cons_cons List.zip_cons_cons
42-
43-
@[simp]
44-
theorem zipWith_nil_left (f : α → β → γ) (l) : zipWith f [] l = [] := rfl
4535
#align list.zip_with_nil_left List.zipWith_nil_left
46-
47-
theorem zipWith_nil_right (f : α → β → γ) (l) : zipWith f l [] = [] := by simp
4836
#align list.zip_with_nil_right List.zipWith_nil_right
4937

5038
@[simp]
5139
theorem zipWith_eq_nil_iff {f : α → β → γ} {l l'} : zipWith f l l' = [] ↔ l = [] ∨ l' = [] := by
5240
cases l <;> cases l' <;> simp
5341
#align list.zip_with_eq_nil_iff List.zipWith_eq_nil_iff
5442

55-
@[simp]
56-
theorem zip_nil_left (l : List α) : zip ([] : List β) l = [] :=
57-
rfl
5843
#align list.zip_nil_left List.zip_nil_left
59-
60-
@[simp]
61-
theorem zip_nil_right (l : List α) : zip l ([] : List β) = [] :=
62-
zipWith_nil_right _ l
6344
#align list.zip_nil_right List.zip_nil_right
6445

6546
@[simp]
6647
theorem zip_swap : ∀ (l₁ : List α) (l₂ : List β), (zip l₁ l₂).map Prod.swap = zip l₂ l₁
67-
| [], l₂ => (zip_nil_right _).symm
48+
| [], l₂ => zip_nil_right.symm
6849
| l₁, [] => by rw [zip_nil_right]; rfl
6950
| a :: l₁, b :: l₂ => by
7051
simp only [zip_cons_cons, map_cons, zip_swap l₁ l₂, Prod.swap_prod_mk]
7152
#align list.zip_swap List.zip_swap
7253

7354
#align list.length_zip_with List.length_zipWith
7455

75-
@[simp]
76-
theorem length_zip :
77-
∀ (l₁ : List α) (l₂ : List β), length (zip l₁ l₂) = min (length l₁) (length l₂) :=
78-
length_zipWith _
7956
#align list.length_zip List.length_zip
8057

8158
theorem all₂_zipWith {f : α → β → γ} {p : γ → Prop} :
@@ -199,13 +176,8 @@ theorem map_snd_zip :
199176
rw [map_snd_zip as bs h]
200177
#align list.map_snd_zip List.map_snd_zip
201178

202-
@[simp]
203-
theorem unzip_nil : unzip (@nil (α × β)) = ([], []) := rfl
204179
#align list.unzip_nil List.unzip_nil
205180

206-
@[simp]
207-
theorem unzip_cons (a : α) (b : β) (l : List (α × β)) :
208-
unzip ((a, b) :: l) = (a :: (unzip l).1, b :: (unzip l).2) := rfl
209181
#align list.unzip_cons List.unzip_cons
210182

211183
theorem unzip_eq_map : ∀ l : List (α × β), unzip l = (l.map Prod.fst, l.map Prod.snd)
@@ -268,7 +240,7 @@ theorem map_prod_right_eq_zip {l : List α} (f : α → β) :
268240

269241
theorem zipWith_comm (f : α → β → γ) :
270242
∀ (la : List α) (lb : List β), zipWith f la lb = zipWith (fun b a => f a b) lb la
271-
| [], _ => (List.zipWith_nil_right _ _).symm
243+
| [], _ => List.zipWith_nil_right.symm
272244
| _ :: _, [] => rfl
273245
| _ :: as, _ :: bs => congr_arg _ (zipWith_comm f as bs)
274246
#align list.zip_with_comm List.zipWith_comm

Mathlib/Data/UnionFind.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ theorem setParent {arr : Array (UFNode α)} {n} {m : UFModel n} (hm : m.Models a
150150
(m.setParent i j H).Models (arr.set ⟨i.1, hi⟩ x) :=
151151
⟨hm.1.set
152152
(fun k (h : (k:ℕ) ≠ i) ↦ by simp [UFModel.setParent, h.symm])
153-
(fun hby simp [UFModel.setParent, hp]),
153+
(fun _by simp [UFModel.setParent, hp]),
154154
hm.2.set (fun _ _ ↦ rfl) (fun _ ↦ hrk.trans $ hm.2.get_eq ..)⟩
155155

156156
end UFModel.Models
@@ -277,7 +277,7 @@ def link (self : UnionFind α) (x y : Fin self.size)
277277
(by simpa [← hm.parent_eq'] using yroot), ?_⟩
278278
let parent (i : Fin n) := (if x.1 = i then y else m.parent i).1
279279
have : UFModel.Agrees arr₁ (·.parent) parent :=
280-
hm.1.set (fun i h ↦ by simp; rw [if_neg h.symm]) (fun hby simp)
280+
hm.1.set (fun i h ↦ by simp; rw [if_neg h.symm]) (fun _by simp)
281281
have H1 : UFModel.Agrees arr₂ (·.parent) parent := by
282282
simp; split
283283
· exact this.set (fun i h ↦ by simp [h.symm]) (fun h ↦ by simp [ne, hm.parent_eq'])

Mathlib/Data/Vector/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ theorem scanl_get (i : Fin n) :
393393
· exact i.elim0
394394
induction' n with n hn generalizing b
395395
· have i0 : i = 0 := Fin.eq_zero _
396-
simp [scanl_singleton, i0, get_zero]; simp [get_eq_get]
396+
simp [scanl_singleton, i0, get_zero]; simp [get_eq_get, List.get]
397397
· rw [← cons_head_tail v, scanl_cons, get_cons_succ]
398398
refine' Fin.cases _ _ i
399399
· simp only [get_zero, scanl_head, Fin.castSucc_zero, head_cons]

lake-manifest.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22
"packagesDir": "lake-packages",
33
"packages":
44
[{"git":
5-
{"url": "https://github.com/leanprover/std4",
6-
"subDir?": null,
7-
"rev": "538a09123ed1080bb7227fb5d133abe0e2183b8d",
8-
"opts": {},
9-
"name": "std",
10-
"inputRev?": "main",
11-
"inherited": false}},
12-
{"git":
135
{"url": "https://github.com/gebner/quote4",
146
"subDir?": null,
157
"rev": "a387c0eb611857e2460cf97a8e861c944286e6b2",
@@ -40,5 +32,13 @@
4032
"opts": {},
4133
"name": "proofwidgets",
4234
"inputRev?": "v0.0.16",
35+
"inherited": false}},
36+
{"git":
37+
{"url": "https://github.com/leanprover/std4",
38+
"subDir?": null,
39+
"rev": "f2df4ab8c0726fce3bafb73a5727336b0c3120ea",
40+
"opts": {},
41+
"name": "std",
42+
"inputRev?": "main",
4343
"inherited": false}}],
4444
"name": "mathlib"}

0 commit comments

Comments
 (0)