Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 4274ddd

Browse files
robertylewisgebner
andcommitted
chore(*): bump to Lean 3.18.4 (#3610)
* Remove `pi_arity` and the `vm_override` for `by_cases`, which have moved to core * Fix fallout from the change to the definition of `max` * Fix a small number of errors caused by changes to instance caching * Remove `min_add`, which is generalized by `min_add_add_right` and make `to_additive` generate some lemmas Co-authored-by: Gabriel Ebner <gebner@gebner.org> Co-authored-by: Rob Lewis <rob.y.lewis@gmail.com>
1 parent 92a20e6 commit 4274ddd

File tree

18 files changed

+38
-106
lines changed

18 files changed

+38
-106
lines changed

leanpkg.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "mathlib"
33
version = "0.1"
4-
lean_version = "leanprover-community/lean:3.17.1"
4+
lean_version = "leanprover-community/lean:3.18.4"
55
path = "src"
66

77
[dependencies]

src/algebra/order_functions.lean

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ theorem min_choice (a b : α) : min a b = a ∨ min a b = b :=
9797
by by_cases h : a ≤ b; simp [min, h]
9898

9999
theorem max_choice (a b : α) : max a b = a ∨ max a b = b :=
100-
by by_cases h : ab; simp [max, h]
100+
by by_cases h : ba; simp [max, h]
101101

102102
lemma le_of_max_le_left {a b c : α} (h : max a b ≤ c) : a ≤ c :=
103103
le_trans (le_max_left _ _) h
@@ -107,34 +107,18 @@ le_trans (le_max_right _ _) h
107107

108108
end
109109

110-
lemma min_add {α : Type u} [decidable_linear_ordered_add_comm_group α] (a b c : α) :
111-
min a b + c = min (a + c) (b + c) :=
112-
if hle : a ≤ b then
113-
have a - c ≤ b - c, from sub_le_sub hle (le_refl _),
114-
by simp * at *
115-
else
116-
have b - c ≤ a - c, from sub_le_sub (le_of_lt (lt_of_not_ge hle)) (le_refl _),
117-
by simp * at *
118-
119110
lemma min_sub {α : Type u} [decidable_linear_ordered_add_comm_group α] (a b c : α) :
120111
min a b - c = min (a - c) (b - c) :=
121-
by simp [min_add, sub_eq_add_neg]
122-
112+
by simp only [min_add_add_right, sub_eq_add_neg]
123113

124114
/- Some lemmas about types that have an ordering and a binary operation, with no
125115
rules relating them. -/
126-
lemma fn_min_add_fn_max [decidable_linear_order α] [add_comm_semigroup β] (f : α → β) (n m : α) :
127-
f (min n m) + f (max n m) = f n + f m :=
128-
by { cases le_total n m with h h; simp [h, add_comm] }
129-
130-
lemma min_add_max [decidable_linear_order α] [add_comm_semigroup α] (n m : α) :
131-
min n m + max n m = n + m :=
132-
fn_min_add_fn_max id n m
133-
116+
@[to_additive]
134117
lemma fn_min_mul_fn_max [decidable_linear_order α] [comm_semigroup β] (f : α → β) (n m : α) :
135118
f (min n m) * f (max n m) = f n * f m :=
136119
by { cases le_total n m with h h; simp [h, mul_comm] }
137120

121+
@[to_additive]
138122
lemma min_mul_max [decidable_linear_order α] [comm_semigroup α] (n m : α) :
139123
min n m * max n m = n * m :=
140124
fn_min_mul_fn_max id n m
@@ -219,18 +203,9 @@ end
219203

220204
lemma abs_max_sub_max_le_abs (a b c : α) : abs (max a c - max b c) ≤ abs (a - b) :=
221205
begin
222-
simp only [max],
223-
split_ifs,
224-
{ rw [sub_self, abs_zero], exact abs_nonneg _ },
225-
{ calc abs (c - b) = - (c - b) : abs_of_neg (sub_neg_of_lt (lt_of_not_ge h_1))
226-
... = b - c : neg_sub _ _
227-
... ≤ b - a : by { rw sub_le_sub_iff_left, exact h }
228-
... = - (a - b) : by rw neg_sub
229-
... ≤ abs (a - b) : neg_le_abs_self _ },
230-
{ calc abs (a - c) = a - c : abs_of_pos (sub_pos_of_lt (lt_of_not_ge h))
231-
... ≤ a - b : by { rw sub_le_sub_iff_left, exact h_1 }
232-
... ≤ abs (a - b) : le_abs_self _ },
233-
{ refl }
206+
simp_rw [abs_le, le_sub_iff_add_le, sub_le_iff_le_add, ← max_add_add_left],
207+
split; apply max_le_max; simp only [← le_sub_iff_add_le, ← sub_le_iff_le_add, sub_self, neg_le,
208+
neg_le_abs_self, neg_zero, abs_nonneg, le_abs_self]
234209
end
235210

236211
lemma max_sub_min_eq_abs' (a b : α) : max a b - min a b = abs (a - b) :=

src/algebra/ordered_group.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ decidable_linear_order.lift coe units.ext
231231
@[simp, to_additive, norm_cast]
232232
theorem max_coe [monoid α] [decidable_linear_order α] {a b : units α} :
233233
(↑(max a b) : α) = max a b :=
234-
by by_cases ab; simp [max, h]
234+
by by_cases ba; simp [max, h]
235235

236236
@[simp, to_additive, norm_cast]
237237
theorem min_coe [monoid α] [decidable_linear_order α] {a b : units α} :

src/computability/primrec.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ theorem nat_le : primrec_rel ((≤) : ℕ → ℕ → Prop) :=
581581
end
582582

583583
theorem nat_min : primrec₂ (@min ℕ _) := ite nat_le fst snd
584-
theorem nat_max : primrec₂ (@max ℕ _) := ite nat_le snd fst
584+
theorem nat_max : primrec₂ (@max ℕ _) := ite (nat_le.comp primrec.snd primrec.fst) fst snd
585585

586586
theorem dom_bool (f : bool → α) : primrec f :=
587587
(cond primrec.id (const (f tt)) (const (f ff))).of_eq $

src/control/traversable/equiv.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ protected def is_lawful_traversable' [_i : traversable t']
109109
map f = equiv.map eqv f)
110110
(h₁ : ∀ {α β} (f : β),
111111
map_const f = (equiv.map eqv ∘ function.const α) f)
112-
(h₂ : ∀ {F : Type u → Type u} [applicative F] [is_lawful_applicative F]
112+
(h₂ : ∀ {F : Type u → Type u} [applicative F],
113+
by exactI ∀ [is_lawful_applicative F]
113114
{α β} (f : α → F β),
114115
traverse f = equiv.traverse eqv f) :
115116
_root_.is_lawful_traversable t' :=

src/data/int/cast.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ by by_cases a ≤ b; simp [h, min]
151151

152152
@[simp, norm_cast] theorem cast_max [decidable_linear_ordered_comm_ring α] {a b : ℤ} :
153153
(↑(max a b) : α) = max a b :=
154-
by by_cases ab; simp [h, max]
154+
by by_cases ba; simp [h, max]
155155

156156
@[simp, norm_cast] theorem cast_abs [decidable_linear_ordered_comm_ring α] {q : ℤ} :
157157
((abs q : ℤ) : α) = abs q :=

src/data/list/min_max.lean

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,22 +237,23 @@ theorem le_minimum_of_mem' {a : α} {l : list α} (ha : a ∈ l) : minimum l ≤
237237
theorem maximum_concat (a : α) (l : list α) : maximum (l ++ [a]) = max (maximum l) a :=
238238
begin
239239
rw max_comm,
240-
simp only [maximum, argmax_concat, id, max],
240+
simp only [maximum, argmax_concat, id],
241241
cases h : argmax id l,
242-
{ rw [if_neg], refl, exact not_le_of_gt (with_bot.bot_lt_some _) },
242+
{ rw [max_eq_left], refl, exact bot_le },
243243
change (coe : α → with_bot α) with some,
244-
simp
244+
rw [max_comm],
245+
simp [max]
245246
end
246247

247248
theorem minimum_concat (a : α) (l : list α) : minimum (l ++ [a]) = min (minimum l) a :=
248-
by simp only [min_comm _ (a : with_top α)]; exact @maximum_concat (order_dual α) _ _ _
249+
@maximum_concat (order_dual α) _ _ _
249250

250251
theorem maximum_cons (a : α) (l : list α) : maximum (a :: l) = max a (maximum l) :=
251252
list.reverse_rec_on l (by simp [@max_eq_left (with_bot α) _ _ _ bot_le])
252253
(λ tl hd ih, by rw [← cons_append, maximum_concat, ih, maximum_concat, max_assoc])
253254

254255
theorem minimum_cons (a : α) (l : list α) : minimum (a :: l) = min a (minimum l) :=
255-
min_comm (minimum l) a ▸ @maximum_cons (order_dual α) _ _ _
256+
@maximum_cons (order_dual α) _ _ _
256257

257258
theorem maximum_eq_coe_iff {m : α} {l : list α} :
258259
maximum l = m ↔ m ∈ l ∧ (∀ a ∈ l, a ≤ m) :=

src/data/polynomial/monic.lean

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ begin
160160
{ rw nontrivial_iff at h, push_neg at h, apply h, },
161161
haveI := h, clear h,
162162
have := monic.nat_degree_mul hp hq,
163-
dsimp [next_coeff], rw this, simp [hp, hq], clear this,
163+
dsimp only [next_coeff], rw this,
164+
simp only [hp, hq, degree_eq_zero_iff_eq_one, add_eq_zero_iff], clear this,
164165
split_ifs; try { tauto <|> simp [h_1, h_2] },
165166
rename h_1 hp0, rename h_2 hq0, clear h,
166167
rw ← degree_eq_zero_iff_eq_one at hp0 hq0, assumption',
@@ -170,19 +171,21 @@ begin
170171
have : {(dp, dq - 1), (dp - 1, dq)} ⊆ nat.antidiagonal (dp + dq - 1),
171172
{ rw insert_subset, split,
172173
work_on_goal 0 { rw [nat.mem_antidiagonal, nat.add_sub_assoc] },
173-
work_on_goal 1 { simp only [singleton_subset_iff, nat.mem_antidiagonal], apply nat.sub_add_eq_add_sub },
174+
work_on_goal 1 { simp only [singleton_subset_iff, nat.mem_antidiagonal],
175+
apply nat.sub_add_eq_add_sub },
174176
all_goals { apply nat.succ_le_of_lt, apply nat.pos_of_ne_zero, assumption } },
175177
rw ← sum_subset this,
176178
{ rw [sum_insert, sum_singleton], iterate 2 { rw coeff_nat_degree }, ring, assumption',
177179
suffices : dp ≠ dp - 1, { rw mem_singleton, simp [this] }, omega }, clear this,
178-
intros x hx hx1, simp only [nat.mem_antidiagonal] at hx, simp only [mem_insert, mem_singleton] at hx1,
180+
intros x hx hx1,
181+
simp only [nat.mem_antidiagonal] at hx, simp only [mem_insert, mem_singleton] at hx1,
179182
suffices : p.coeff x.fst = 0 ∨ q.coeff x.snd = 0, cases this; simp [this],
180183
suffices : dp < x.fst ∨ dq < x.snd, cases this,
181184
{ left, apply coeff_eq_zero_of_nat_degree_lt, assumption },
182185
{ right, apply coeff_eq_zero_of_nat_degree_lt, assumption },
183-
by_cases h : dp < x.fst, { tauto }, push_neg at h, right,
184-
have : x.fst ≠ dp - 1, { contrapose! hx1, right, ext, assumption, dsimp, omega },
185-
have : x.fst ≠ dp, { contrapose! hx1, left, ext, assumption, dsimp, omega },
186+
by_cases h : dp < x.fst, { left, exact h }, push_neg at h, right,
187+
have : x.fst ≠ dp - 1, { contrapose! hx1, right, ext, assumption, dsimp only, omega },
188+
have : x.fst ≠ dp, { contrapose! hx1, left, ext, assumption, dsimp only, omega },
186189
omega,
187190
end
188191

src/data/rat/cast.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ by by_cases a ≤ b; simp [h, min]
233233

234234
@[simp, norm_cast] theorem cast_max [discrete_linear_ordered_field α] {a b : ℚ} :
235235
(↑(max a b) : α) = max a b :=
236-
by by_cases ab; simp [h, max]
236+
by by_cases ba; simp [h, max]
237237

238238
@[simp, norm_cast] theorem cast_abs [discrete_linear_ordered_field α] {q : ℚ} :
239239
((abs q : ℚ) : α) = abs q :=

src/measure_theory/borel_space.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ hf.prod_mk hg is_measurable_le'
333333
lemma measurable.max [decidable_linear_order α] [order_closed_topology α] [second_countable_topology α]
334334
{f g : δ → α} (hf : measurable f) (hg : measurable g) :
335335
measurable (λa, max (f a) (g a)) :=
336-
hg.piecewise (is_measurable_le hf hg) hf
336+
hf.piecewise (is_measurable_le hg hf) hg
337337

338338
lemma measurable.min [decidable_linear_order α] [order_closed_topology α] [second_countable_topology α]
339339
{f g : δ → α} (hf : measurable f) (hg : measurable g) :

0 commit comments

Comments
 (0)