Skip to content

Commit f513eb6

Browse files
kim-emchabulhwikmillScott Morrisondigama0
committed
chore: bump dependencies (#4012)
This just bumps the Std dependency, to get access to Mario's new "Try this:" implementation. Co-authored-by: Bulhwi Cha <chabulhwi@semmalgil.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com>
1 parent 8886682 commit f513eb6

File tree

9 files changed

+40
-347
lines changed

9 files changed

+40
-347
lines changed

Mathlib/Data/Char.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ theorem Char.utf8Size_pos (c : Char) : 0 < c.utf8Size := by
2727
repeat (split; decide)
2828
decide
2929

30-
theorem String.csize_pos : (c : Char) → 0 < String.csize c := Char.utf8Size_pos
31-
3230
/--
3331
Provides a `LinearOrder` instance on `Char`. `Char` is the type of Unicode scalar values.
3432
-/

Mathlib/Data/List/Infix.lean

Lines changed: 7 additions & 223 deletions
Original file line numberDiff line numberDiff line change
@@ -43,56 +43,17 @@ variable {l l₁ l₂ l₃ : List α} {a b : α} {m n : ℕ}
4343

4444
section Fix
4545

46-
@[simp]
47-
theorem prefix_append (l₁ l₂ : List α) : l₁ <+: l₁ ++ l₂ :=
48-
⟨l₂, rfl⟩
4946
#align list.prefix_append List.prefix_append
50-
51-
@[simp]
52-
theorem suffix_append (l₁ l₂ : List α) : l₂ <:+ l₁ ++ l₂ :=
53-
⟨l₁, rfl⟩
5447
#align list.suffix_append List.suffix_append
55-
56-
theorem infix_append (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ l₂ ++ l₃ :=
57-
⟨l₁, l₃, rfl⟩
5848
#align list.infix_append List.infix_append
59-
60-
@[simp]
61-
theorem infix_append' (l₁ l₂ l₃ : List α) : l₂ <:+: l₁ ++ (l₂ ++ l₃) := by
62-
rw [← List.append_assoc]; apply infix_append
6349
#align list.infix_append' List.infix_append'
64-
65-
theorem isPrefix.isInfix : l₁ <+: l₂ → l₁ <:+: l₂ := fun ⟨t, h⟩ => ⟨[], t, h⟩
6650
#align list.is_prefix.is_infix List.isPrefix.isInfix
67-
68-
theorem isSuffix.isInfix : l₁ <:+ l₂ → l₁ <:+: l₂ := fun ⟨t, h⟩ => ⟨t, [], by rw [h, append_nil]⟩
6951
#align list.is_suffix.is_infix List.isSuffix.isInfix
70-
71-
theorem nil_prefix (l : List α) : [] <+: l :=
72-
⟨l, rfl⟩
7352
#align list.nil_prefix List.nil_prefix
74-
75-
theorem nil_suffix (l : List α) : [] <:+ l :=
76-
⟨l, append_nil _⟩
7753
#align list.nil_suffix List.nil_suffix
78-
79-
theorem nil_infix (l : List α) : [] <:+: l :=
80-
(nil_prefix _).isInfix
8154
#align list.nil_infix List.nil_infix
82-
83-
@[refl]
84-
theorem prefix_refl (l : List α) : l <+: l :=
85-
⟨[], append_nil _⟩
8655
#align list.prefix_refl List.prefix_refl
87-
88-
@[refl]
89-
theorem suffix_refl (l : List α) : l <:+ l :=
90-
⟨[], rfl⟩
9156
#align list.suffix_refl List.suffix_refl
92-
93-
@[refl]
94-
theorem infix_refl (l : List α) : l <:+: l :=
95-
(prefix_refl l).isInfix
9657
#align list.infix_refl List.infix_refl
9758

9859
theorem prefix_rfl : l <+: l :=
@@ -107,80 +68,24 @@ theorem infix_rfl : l <:+: l :=
10768
infix_refl _
10869
#align list.infix_rfl List.infix_rfl
10970

110-
@[simp]
111-
theorem suffix_cons (a : α) : ∀ l, l <:+ a :: l :=
112-
suffix_append [a]
11371
#align list.suffix_cons List.suffix_cons
11472

11573
theorem prefix_concat (a : α) (l) : l <+: concat l a := by simp
11674
#align list.prefix_concat List.prefix_concat
11775

118-
theorem infix_cons : l₁ <:+: l₂ → l₁ <:+: a :: l₂ := fun ⟨L₁, L₂, h⟩ => ⟨a :: L₁, L₂, h ▸ rfl⟩
11976
#align list.infix_cons List.infix_cons
120-
121-
theorem infix_concat : l₁ <:+: l₂ → l₁ <:+: concat l₂ a := fun ⟨L₁, L₂, h⟩ =>
122-
⟨L₁, concat L₂ a, by simp_rw [← h, concat_eq_append, append_assoc]⟩
12377
#align list.infix_concat List.infix_concat
124-
125-
@[trans]
126-
theorem isPrefix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <+: l₂ → l₂ <+: l₃ → l₁ <+: l₃
127-
| _, _, _, ⟨r₁, rfl⟩, ⟨r₂, rfl⟩ => ⟨r₁ ++ r₂, (append_assoc _ _ _).symm⟩
12878
#align list.is_prefix.trans List.isPrefix.trans
129-
130-
@[trans]
131-
theorem isSuffix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+ l₂ → l₂ <:+ l₃ → l₁ <:+ l₃
132-
| _, _, _, ⟨l₁, rfl⟩, ⟨l₂, rfl⟩ => ⟨l₂ ++ l₁, append_assoc _ _ _⟩
13379
#align list.is_suffix.trans List.isSuffix.trans
134-
135-
@[trans]
136-
theorem isInfix.trans : ∀ {l₁ l₂ l₃ : List α}, l₁ <:+: l₂ → l₂ <:+: l₃ → l₁ <:+: l₃
137-
| l, _, _, ⟨l₁, r₁, rfl⟩, ⟨l₂, r₂, rfl⟩ => ⟨l₂ ++ l₁, r₁ ++ r₂, by simp only [append_assoc]⟩
13880
#align list.is_infix.trans List.isInfix.trans
139-
140-
protected theorem isInfix.sublist : l₁ <:+: l₂ → l₁ <+ l₂ := fun ⟨s, t, h⟩ => by
141-
rw [← h]
142-
exact (sublist_append_right _ _).trans (sublist_append_left _ _)
14381
#align list.is_infix.sublist List.isInfix.sublist
144-
145-
protected theorem isInfix.subset (hl : l₁ <:+: l₂) : l₁ ⊆ l₂ :=
146-
hl.sublist.subset
14782
#align list.is_infix.subset List.isInfix.subset
148-
149-
protected theorem isPrefix.sublist (h : l₁ <+: l₂) : l₁ <+ l₂ :=
150-
h.isInfix.sublist
15183
#align list.is_prefix.sublist List.isPrefix.sublist
152-
153-
protected theorem isPrefix.subset (hl : l₁ <+: l₂) : l₁ ⊆ l₂ :=
154-
hl.sublist.subset
15584
#align list.is_prefix.subset List.isPrefix.subset
156-
157-
protected theorem isSuffix.sublist (h : l₁ <:+ l₂) : l₁ <+ l₂ :=
158-
h.isInfix.sublist
15985
#align list.is_suffix.sublist List.isSuffix.sublist
160-
161-
protected theorem isSuffix.subset (hl : l₁ <:+ l₂) : l₁ ⊆ l₂ :=
162-
hl.sublist.subset
16386
#align list.is_suffix.subset List.isSuffix.subset
164-
165-
@[simp]
166-
theorem reverse_suffix : reverse l₁ <:+ reverse l₂ ↔ l₁ <+: l₂ :=
167-
fun ⟨r, e⟩ => ⟨reverse r, by rw [← reverse_reverse l₁, ← reverse_append, e, reverse_reverse]⟩,
168-
fun ⟨r, e⟩ => ⟨reverse r, by rw [← reverse_append, e]⟩⟩
16987
#align list.reverse_suffix List.reverse_suffix
170-
171-
@[simp]
172-
theorem reverse_prefix : reverse l₁ <+: reverse l₂ ↔ l₁ <:+ l₂ := by
173-
rw [← reverse_suffix]; simp only [reverse_reverse]
17488
#align list.reverse_prefix List.reverse_prefix
175-
176-
@[simp]
177-
theorem reverse_infix : reverse l₁ <:+: reverse l₂ ↔ l₁ <:+: l₂ :=
178-
fun ⟨s, t, e⟩ =>
179-
⟨reverse t, reverse s, by
180-
rw [← reverse_reverse l₁, append_assoc, ← reverse_append, ← reverse_append, e,
181-
reverse_reverse]⟩,
182-
fun ⟨s, t, e⟩ =>
183-
⟨reverse t, reverse s, by rw [append_assoc, ← reverse_append, ← reverse_append, e]⟩⟩
18489
#align list.reverse_infix List.reverse_infix
18590

18691
alias reverse_prefix ↔ _ isSuffix.reverse
@@ -192,46 +97,22 @@ alias reverse_suffix ↔ _ isPrefix.reverse
19297
alias reverse_infix ↔ _ isInfix.reverse
19398
#align list.is_infix.reverse List.isInfix.reverse
19499

195-
theorem isInfix.length_le (h : l₁ <:+: l₂) : l₁.length ≤ l₂.length :=
196-
h.sublist.length_le
197100
#align list.is_infix.length_le List.isInfix.length_le
198-
199-
theorem isPrefix.length_le (h : l₁ <+: l₂) : l₁.length ≤ l₂.length :=
200-
h.sublist.length_le
201101
#align list.is_prefix.length_le List.isPrefix.length_le
202-
203-
theorem isSuffix.length_le (h : l₁ <:+ l₂) : l₁.length ≤ l₂.length :=
204-
h.sublist.length_le
205102
#align list.is_suffix.length_le List.isSuffix.length_le
103+
#align list.infix_nil_iff List.infix_nil
104+
#align list.prefix_nil_iff List.prefix_nil
105+
#align list.suffix_nil_iff List.suffix_nil
206106

207-
theorem eq_nil_of_infix_nil (h : l <:+: []) : l = [] :=
208-
eq_nil_of_sublist_nil h.sublist
107+
alias infix_nil ↔ eq_nil_of_infix_nil _
209108
#align list.eq_nil_of_infix_nil List.eq_nil_of_infix_nil
210109

211-
@[simp]
212-
theorem infix_nil_iff : l <:+: [] ↔ l = [] :=
213-
fun h => eq_nil_of_sublist_nil h.sublist, fun h => h ▸ infix_rfl⟩
214-
#align list.infix_nil_iff List.infix_nil_iff
215-
216-
@[simp]
217-
theorem prefix_nil_iff : l <+: [] ↔ l = [] :=
218-
fun h => eq_nil_of_infix_nil h.isInfix, fun h => h ▸ prefix_rfl⟩
219-
#align list.prefix_nil_iff List.prefix_nil_iff
220-
221-
@[simp]
222-
theorem suffix_nil_iff : l <:+ [] ↔ l = [] :=
223-
fun h => eq_nil_of_infix_nil h.isInfix, fun h => h ▸ suffix_rfl⟩
224-
#align list.suffix_nil_iff List.suffix_nil_iff
225-
226-
alias prefix_nil_iff ↔ eq_nil_of_prefix_nil _
110+
alias prefix_nil ↔ eq_nil_of_prefix_nil _
227111
#align list.eq_nil_of_prefix_nil List.eq_nil_of_prefix_nil
228112

229-
alias suffix_nil_iff ↔ eq_nil_of_suffix_nil _
113+
alias suffix_nil ↔ eq_nil_of_suffix_nil _
230114
#align list.eq_nil_of_suffix_nil List.eq_nil_of_suffix_nil
231115

232-
theorem infix_iff_prefix_suffix (l₁ l₂ : List α) : l₁ <:+: l₂ ↔ ∃ t, l₁ <+: t ∧ t <:+ l₂ :=
233-
fun ⟨s, t, e⟩ => ⟨l₁ ++ t, ⟨_, rfl⟩, by rw [← e, append_assoc]; exact ⟨_, rfl⟩⟩,
234-
fun ⟨_, ⟨t, rfl⟩, s, e⟩ => ⟨s, t, by rw [append_assoc]; exact e⟩⟩
235116
#align list.infix_iff_prefix_suffix List.infix_iff_prefix_suffix
236117

237118
theorem eq_of_infix_of_length_eq (h : l₁ <:+: l₂) : l₁.length = l₂.length → l₁ = l₂ :=
@@ -246,101 +127,22 @@ theorem eq_of_suffix_of_length_eq (h : l₁ <:+ l₂) : l₁.length = l₂.lengt
246127
h.sublist.eq_of_length
247128
#align list.eq_of_suffix_of_length_eq List.eq_of_suffix_of_length_eq
248129

249-
theorem prefix_of_prefix_length_le : ∀ { l₁ l₂ l₃ : List α } ,
250-
l₁ <+: l₃ → l₂ <+: l₃ → length l₁ ≤ length l₂ → l₁ <+: l₂
251-
| [] , l₂ , _, _, _, _ => nil_prefix _
252-
| a :: l₁ , b :: l₂ , _ , ⟨ r₁ , rfl ⟩ , ⟨ r₂ , e ⟩ , ll => by
253-
injection e with _ e'
254-
subst b
255-
rcases prefix_of_prefix_length_le ⟨ _ , rfl ⟩ ⟨ _ , e' ⟩
256-
(le_of_succ_le_succ ll) with ⟨ r₃ , rfl ⟩
257-
exact ⟨ r₃ , rfl ⟩
258130
#align list.prefix_of_prefix_length_le List.prefix_of_prefix_length_le
259-
260-
theorem prefix_or_prefix_of_prefix (h₁ : l₁ <+: l₃) (h₂ : l₂ <+: l₃) : l₁ <+: l₂ ∨ l₂ <+: l₁ :=
261-
(le_total (length l₁) (length l₂)).imp (prefix_of_prefix_length_le h₁ h₂)
262-
(prefix_of_prefix_length_le h₂ h₁)
263131
#align list.prefix_or_prefix_of_prefix List.prefix_or_prefix_of_prefix
264-
265-
theorem suffix_of_suffix_length_le (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) (ll : length l₁ ≤ length l₂) :
266-
l₁ <:+ l₂ :=
267-
reverse_prefix.1 <|
268-
prefix_of_prefix_length_le (reverse_prefix.2 h₁) (reverse_prefix.2 h₂) (by simp [ll])
269132
#align list.suffix_of_suffix_length_le List.suffix_of_suffix_length_le
270-
271-
theorem suffix_or_suffix_of_suffix (h₁ : l₁ <:+ l₃) (h₂ : l₂ <:+ l₃) : l₁ <:+ l₂ ∨ l₂ <:+ l₁ :=
272-
(prefix_or_prefix_of_prefix (reverse_prefix.2 h₁) (reverse_prefix.2 h₂)).imp reverse_prefix.1
273-
reverse_prefix.1
274133
#align list.suffix_or_suffix_of_suffix List.suffix_or_suffix_of_suffix
275-
276-
theorem suffix_cons_iff : l₁ <:+ a :: l₂ ↔ l₁ = a :: l₂ ∨ l₁ <:+ l₂ := by
277-
constructor
278-
· rintro ⟨⟨hd, tl⟩, hl₃⟩
279-
· exact Or.inl hl₃
280-
· simp only [cons_append] at hl₃
281-
injection hl₃ with _ hl₄
282-
exact Or.inr ⟨_, hl₄⟩
283-
· rintro (rfl | hl₁)
284-
· exact (a :: l₂).suffix_refl
285-
· exact hl₁.trans (l₂.suffix_cons _)
286134
#align list.suffix_cons_iff List.suffix_cons_iff
287-
288-
theorem infix_cons_iff : l₁ <:+: a :: l₂ ↔ l₁ <+: a :: l₂ ∨ l₁ <:+: l₂ := by
289-
constructor
290-
· rintro ⟨⟨hd, tl⟩, t, hl₃⟩
291-
· exact Or.inl ⟨t, hl₃⟩
292-
· simp only [cons_append] at hl₃
293-
injection hl₃ with _ hl₄
294-
exact Or.inr ⟨_, t, hl₄⟩
295-
· rintro (h | hl₁)
296-
· exact h.isInfix
297-
· exact infix_cons hl₁
298135
#align list.infix_cons_iff List.infix_cons_iff
299-
300-
theorem infix_of_mem_join : ∀ {L : List (List α)}, l ∈ L → l <:+: join L
301-
| l' :: _, h =>
302-
match h with
303-
| List.Mem.head .. => infix_append [] _ _
304-
| List.Mem.tail _ hlMemL =>
305-
isInfix.trans (infix_of_mem_join hlMemL) <| (suffix_append _ _).isInfix
306136
#align list.infix_of_mem_join List.infix_of_mem_join
307-
308-
theorem prefix_append_right_inj (l) : l ++ l₁ <+: l ++ l₂ ↔ l₁ <+: l₂ :=
309-
exists_congr fun r => by rw [append_assoc, append_right_inj]
310137
#align list.prefix_append_right_inj List.prefix_append_right_inj
311-
312-
theorem prefix_cons_inj (a) : a :: l₁ <+: a :: l₂ ↔ l₁ <+: l₂ :=
313-
prefix_append_right_inj [a]
314138
#align list.prefix_cons_inj List.prefix_cons_inj
315-
316-
theorem take_prefix (n) (l : List α) : take n l <+: l :=
317-
⟨_, take_append_drop _ _⟩
318139
#align list.take_prefix List.take_prefix
319-
320-
theorem drop_suffix (n) (l : List α) : drop n l <:+ l :=
321-
⟨_, take_append_drop _ _⟩
322140
#align list.drop_suffix List.drop_suffix
323-
324-
theorem take_sublist (n) (l : List α) : take n l <+ l :=
325-
(take_prefix n l).sublist
326141
#align list.take_sublist List.take_sublist
327-
328-
theorem drop_sublist (n) (l : List α) : drop n l <+ l :=
329-
(drop_suffix n l).sublist
330142
#align list.drop_sublist List.drop_sublist
331-
332-
theorem take_subset (n) (l : List α) : take n l ⊆ l :=
333-
(take_sublist n l).subset
334143
#align list.take_subset List.take_subset
335-
336-
theorem drop_subset (n) (l : List α) : drop n l ⊆ l :=
337-
(drop_sublist n l).subset
338144
#align list.drop_subset List.drop_subset
339-
340-
theorem mem_of_mem_take (h : a ∈ l.take n) : a ∈ l :=
341-
take_subset n l h
342145
#align list.mem_of_mem_take List.mem_of_mem_take
343-
344146
#align list.mem_of_mem_drop List.mem_of_mem_drop
345147

346148
lemma dropSlice_sublist (n m : ℕ) (l : List α) : l.dropSlice n m <+ l :=
@@ -505,25 +307,8 @@ theorem isPrefix.reduceOption {l₁ l₂ : List (Option α)} (h : l₁ <+: l₂)
505307
h.filter_map id
506308
#align list.is_prefix.reduce_option List.isPrefix.reduceOption
507309

508-
theorem isPrefix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <+: l₂) :
509-
l₁.filter p <+: l₂.filter p := by
510-
obtain ⟨xs, rfl⟩ := h
511-
rw [filter_append]
512-
exact prefix_append _ _
513310
#align list.is_prefix.filter List.isPrefix.filter
514-
515-
theorem isSuffix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+ l₂) :
516-
l₁.filter p <:+ l₂.filter p := by
517-
obtain ⟨xs, rfl⟩ := h
518-
rw [filter_append]
519-
exact suffix_append _ _
520311
#align list.is_suffix.filter List.isSuffix.filter
521-
522-
theorem isInfix.filter (p : α → Bool) ⦃l₁ l₂ : List α⦄ (h : l₁ <:+: l₂) :
523-
l₁.filter p <:+: l₂.filter p := by
524-
obtain ⟨xs, ys, rfl⟩ := h
525-
rw [filter_append, filter_append]
526-
exact infix_append _ _ _
527312
#align list.is_infix.filter List.isInfix.filter
528313

529314
instance : IsPartialOrder (List α) (· <+: ·) where
@@ -569,8 +354,7 @@ theorem mem_inits : ∀ s t : List α, s ∈ inits t ↔ s <+: t
569354
@[simp]
570355
theorem mem_tails : ∀ s t : List α, s ∈ tails t ↔ s <:+ t
571356
| s, [] => by
572-
simp only [tails, mem_singleton]
573-
exact ⟨fun h => by rw [h], eq_nil_of_suffix_nil⟩
357+
simp only [tails, mem_singleton, suffix_nil]
574358
| s, a :: t => by
575359
simp only [tails, mem_cons, mem_tails s t];
576360
exact

Mathlib/Data/Nat/Order/Basic.lean

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,7 @@ theorem lt_one_iff {n : ℕ} : n < 1 ↔ n = 0 :=
175175

176176
/-! ### `add` -/
177177

178-
179-
theorem add_pos_left {m : ℕ} (h : 0 < m) (n : ℕ) : 0 < m + n :=
180-
calc
181-
m + n > 0 + n := Nat.add_lt_add_right h n
182-
_ = n := Nat.zero_add n
183-
_ ≥ 0 := zero_le n
184178
#align nat.add_pos_left Nat.add_pos_left
185-
186-
theorem add_pos_right (m : ℕ) {n : ℕ} (h : 0 < n) : 0 < m + n := by
187-
rw [add_comm]
188-
exact add_pos_left h m
189179
#align nat.add_pos_right Nat.add_pos_right
190180

191181
theorem add_pos_iff_pos_or_pos (m n : ℕ) : 0 < m + n ↔ 0 < m ∨ 0 < n :=

0 commit comments

Comments
 (0)