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

Commit a223bbb

Browse files
gebnerJLimperg
andcommitted
chore(*): switch to lean 3.10.0 (#2587)
There have been two changes in Lean 3.10 that have a significant effect on mathlib: - `rename'` has been moved to core. Therefore `rename'` has been removed. - Given a term `⇑f x`, the simplifier can now rewrite in both `f` and `x`. In many cases we had both `⇑f = ⇑f'` and `⇑f x = ⇑f' x` as simp lemmas; the latter is redundant now and has been removed (or just not marked simp anymore). The new and improved congruence lemmas are also used by `convert` and `congr`, these tactics have become more powerful as well. I've also sneaked in two related changes that I noticed while fixing the proofs affected by the changes above: - `@[to_additive, simp]` has been replaced by `@[simp, to_additive]` in the monoid localization file. The difference is that `@[to_additive, simp]` only marks the multiplicative lemma as simp. - `def prod_comm : α × β ≃ β × α` (etc.) is no longer marked `@[simp]`. Marking this kind of lemmas as simp causes the simplifier to unfold the definition of `prod_comm` (instead of just rewriting `α × β` to `β × α` in the `≃` simp relation). This has become a bigger issue now since the simplifier can rewrite the `f` in `⇑f x`. Co-authored-by: Jannis Limperg <jannis@limperg.de>
1 parent d1eae21 commit a223bbb

File tree

25 files changed

+99
-302
lines changed

25 files changed

+99
-302
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.9.0"
4+
lean_version = "leanprover-community/lean:3.10.0"
55
path = "src"
66

77
[dependencies]

src/algebra/category/Group/Z_Module_equivalence.lean

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@ instance : full (forget₂ (Module ℤ) AddCommGroup) :=
2222
{ preimage := λ A B f,
2323
{ to_fun := f,
2424
add := λ x y, add_monoid_hom.map_add f x y,
25-
smul := λ n x,
26-
begin
27-
convert add_monoid_hom.map_int_module_smul f n x,
28-
apply congr_arg, congr,
29-
end } }
25+
smul := λ n x, by convert add_monoid_hom.map_int_module_smul f n x } }
3026

3127
/-- The forgetful functor from `ℤ` modules to `AddCommGroup` is essentially surjective. -/
3228
instance : ess_surj (forget₂ (Module ℤ) AddCommGroup) :=

src/analysis/calculus/times_cont_diff.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,7 @@ lemma iterated_fderiv_within_zero_fun {n : ℕ} :
11821182
iterated_fderiv 𝕜 n (λ x : E, (0 : F)) = 0 :=
11831183
begin
11841184
induction n with n IH,
1185-
{ ext m, simp, refl },
1185+
{ ext m, simp },
11861186
{ ext x m,
11871187
rw [iterated_fderiv_succ_apply_left, IH],
11881188
change (fderiv 𝕜 (λ (x : E), (0 : (E [×n]→L[𝕜] F))) x : E → (E [×n]→L[𝕜] F)) (m 0) (tail m) = _,

src/analysis/normed_space/multilinear.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,8 @@ begin
10141014
have : x = 0 := subsingleton.elim _ _, subst this,
10151015
refine le_antisymm (by simpa using f.le_op_norm 0) _,
10161016
have : ∥continuous_multilinear_map.curry0 𝕜 G (f.uncurry0)∥ ≤ ∥f.uncurry0∥ :=
1017-
continuous_multilinear_map.op_norm_le_bound _ (norm_nonneg _) (λm, by simp),
1017+
continuous_multilinear_map.op_norm_le_bound _ (norm_nonneg _) (λm,
1018+
by simp [-continuous_multilinear_map.apply_zero_curry0]),
10181019
simpa
10191020
end
10201021

src/category_theory/limits/concrete_category.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ local attribute [instance] concrete_category.has_coe_to_fun
3030
(G.map f) ((s.π.app j) x) = (s.π.app j') x :=
3131
begin
3232
convert congr_fun (congr_arg (λ k : s.X ⟶ G.obj j', (k : s.X → G.obj j')) (s.π.naturality f).symm) x;
33-
{ dsimp, simp },
33+
{ dsimp, simp [-cone.w] },
3434
end
3535

3636
end cone
@@ -48,7 +48,7 @@ local attribute [instance] concrete_category.has_coe_to_fun
4848
(s.ι.app j') ((G.map f) x) = (s.ι.app j) x :=
4949
begin
5050
convert congr_fun (congr_arg (λ k : G.obj j ⟶ s.X, (k : G.obj j → s.X)) (s.ι.naturality f)) x;
51-
{ dsimp, simp },
51+
{ dsimp, simp [-nat_trans.naturality, -cocone.w] },
5252
end
5353

5454
end cocone

src/data/equiv/basic.lean

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,6 @@ lemma eq_symm_apply {α β} (e : α ≃ β) {x y} : y = e.symm x ↔ e y = x :=
129129

130130
@[simp] theorem symm_symm (e : α ≃ β) : e.symm.symm = e := by { cases e, refl }
131131

132-
@[simp] theorem symm_symm_apply (e : α ≃ β) (a : α) : e.symm.symm a = e a := by { cases e, refl }
133-
134132
@[simp] theorem trans_refl (e : α ≃ β) : e.trans (equiv.refl β) = e := by { cases e, refl }
135133

136134
@[simp] theorem refl_symm : (equiv.refl α).symm = equiv.refl α := rfl
@@ -322,20 +320,20 @@ def punit_equiv_punit : punit.{v} ≃ punit.{w} :=
322320
⟨λ _, punit.star, λ _, punit.star, λ u, by { cases u, refl }, λ u, by { cases u, reflexivity }⟩
323321

324322
section
325-
@[simp] def arrow_punit_equiv_punit (α : Sort*) : (α → punit.{v}) ≃ punit.{w} :=
323+
def arrow_punit_equiv_punit (α : Sort*) : (α → punit.{v}) ≃ punit.{w} :=
326324
⟨λ f, punit.star, λ u f, punit.star,
327325
λ f, by { funext x, cases f x, refl }, λ u, by { cases u, reflexivity }⟩
328326

329-
@[simp] def punit_arrow_equiv (α : Sort*) : (punit.{u} → α) ≃ α :=
327+
def punit_arrow_equiv (α : Sort*) : (punit.{u} → α) ≃ α :=
330328
⟨λ f, f punit.star, λ a u, a, λ f, by { funext x, cases x, refl }, λ u, rfl⟩
331329

332-
@[simp] def empty_arrow_equiv_punit (α : Sort*) : (empty → α) ≃ punit.{u} :=
330+
def empty_arrow_equiv_punit (α : Sort*) : (empty → α) ≃ punit.{u} :=
333331
⟨λ f, punit.star, λ u e, e.rec _, λ f, funext $ λ x, x.rec _, λ u, by { cases u, refl }⟩
334332

335-
@[simp] def pempty_arrow_equiv_punit (α : Sort*) : (pempty → α) ≃ punit.{u} :=
333+
def pempty_arrow_equiv_punit (α : Sort*) : (pempty → α) ≃ punit.{u} :=
336334
⟨λ f, punit.star, λ u e, e.rec _, λ f, funext $ λ x, x.rec _, λ u, by { cases u, refl }⟩
337335

338-
@[simp] def false_arrow_equiv_punit (α : Sort*) : (false → α) ≃ punit.{u} :=
336+
def false_arrow_equiv_punit (α : Sort*) : (false → α) ≃ punit.{u} :=
339337
calc (false → α) ≃ (empty → α) : arrow_congr false_equiv_empty (equiv.refl _)
340338
... ≃ punit : empty_arrow_equiv_punit _
341339

@@ -350,37 +348,39 @@ end
350348
prod_congr e₁ e₂ (a, b) = (e₁ a, e₂ b) :=
351349
rfl
352350

353-
@[simp] def prod_comm (α β : Sort*) : α × β ≃ β × α :=
351+
def prod_comm (α β : Sort*) : α × β ≃ β × α :=
354352
⟨λ p, (p.2, p.1), λ p, (p.2, p.1), λ⟨a, b⟩, rfl, λ⟨a, b⟩, rfl⟩
355353

356-
@[simp] def prod_assoc (α β γ : Sort*) : (α × β) × γ ≃ α × (β × γ) :=
354+
@[simp] lemma prod_comm_apply {α β} (a b) : prod_comm α β ⟨a, b⟩ = ⟨b, a⟩ := rfl
355+
356+
def prod_assoc (α β γ : Sort*) : (α × β) × γ ≃ α × (β × γ) :=
357357
⟨λ p, ⟨p.1.1, ⟨p.1.2, p.2⟩⟩, λp, ⟨⟨p.1, p.2.1⟩, p.2.2⟩, λ ⟨⟨a, b⟩, c⟩, rfl, λ ⟨a, ⟨b, c⟩⟩, rfl⟩
358358

359359
@[simp] theorem prod_assoc_apply {α β γ : Sort*} (p : (α × β) × γ) :
360360
prod_assoc α β γ p = ⟨p.1.1, ⟨p.1.2, p.2⟩⟩ := rfl
361361

362362
section
363-
@[simp] def prod_punit (α : Sort*) : α × punit.{u+1} ≃ α :=
363+
def prod_punit (α : Sort*) : α × punit.{u+1} ≃ α :=
364364
⟨λ p, p.1, λ a, (a, punit.star), λ ⟨_, punit.star⟩, rfl, λ a, rfl⟩
365365

366366
@[simp] theorem prod_punit_apply {α : Sort*} (a : α × punit.{u+1}) : prod_punit α a = a.1 := rfl
367367

368-
@[simp] def punit_prod (α : Sort*) : punit.{u+1} × α ≃ α :=
368+
def punit_prod (α : Sort*) : punit.{u+1} × α ≃ α :=
369369
calc punit × α ≃ α × punit : prod_comm _ _
370370
... ≃ α : prod_punit _
371371

372372
@[simp] theorem punit_prod_apply {α : Sort*} (a : punit.{u+1} × α) : punit_prod α a = a.2 := rfl
373373

374-
@[simp] def prod_empty (α : Sort*) : α × empty ≃ empty :=
374+
def prod_empty (α : Sort*) : α × empty ≃ empty :=
375375
equiv_empty (λ ⟨_, e⟩, e.rec _)
376376

377-
@[simp] def empty_prod (α : Sort*) : empty × α ≃ empty :=
377+
def empty_prod (α : Sort*) : empty × α ≃ empty :=
378378
equiv_empty (λ ⟨e, _⟩, e.rec _)
379379

380-
@[simp] def prod_pempty (α : Sort*) : α × pempty ≃ pempty :=
380+
def prod_pempty (α : Sort*) : α × pempty ≃ pempty :=
381381
equiv_pempty (λ ⟨_, e⟩, e.rec _)
382382

383-
@[simp] def pempty_prod (α : Sort*) : pempty × α ≃ pempty :=
383+
def pempty_prod (α : Sort*) : pempty × α ≃ pempty :=
384384
equiv_pempty (λ ⟨e, _⟩, e.rec _)
385385
end
386386

@@ -421,13 +421,17 @@ noncomputable def Prop_equiv_bool : Prop ≃ bool :=
421421
⟨λ p, @to_bool p (classical.prop_decidable _),
422422
λ b, b, λ p, by simp, λ b, by simp⟩
423423

424-
@[simp] def sum_comm (α β : Sort*) : α ⊕ β ≃ β ⊕ α :=
424+
def sum_comm (α β : Sort*) : α ⊕ β ≃ β ⊕ α :=
425425
⟨λ s, match s with inl a := inr a | inr b := inl b end,
426426
λ s, match s with inl b := inr b | inr a := inl a end,
427427
λ s, by cases s; refl,
428428
λ s, by cases s; refl⟩
429429

430-
@[simp] def sum_assoc (α β γ : Sort*) : (α ⊕ β) ⊕ γ ≃ α ⊕ (β ⊕ γ) :=
430+
@[simp] lemma sum_comm_apply_inl (α β) (a) : sum_comm α β (sum.inl a) = sum.inr a := rfl
431+
@[simp] lemma sum_comm_apply_inr (α β) (b) : sum_comm α β (sum.inr b) = sum.inl b := rfl
432+
@[simp] lemma sum_comm_symm (α β) : (sum_comm α β).symm = sum_comm β α := by ext x; cases x; refl
433+
434+
def sum_assoc (α β γ : Sort*) : (α ⊕ β) ⊕ γ ≃ α ⊕ (β ⊕ γ) :=
431435
⟨λ s, match s with inl (inl a) := inl a | inl (inr b) := inr (inl b) | inr c := inr (inr c) end,
432436
λ s, match s with inl a := inl (inl a) | inr (inl b) := inl (inr b) | inr (inr c) := inr c end,
433437
λ s, by rcases s with ⟨_ | _⟩ | _; refl,
@@ -437,30 +441,42 @@ noncomputable def Prop_equiv_bool : Prop ≃ bool :=
437441
@[simp] theorem sum_assoc_apply_in2 {α β γ} (b) : sum_assoc α β γ (inl (inr b)) = inr (inl b) := rfl
438442
@[simp] theorem sum_assoc_apply_in3 {α β γ} (c) : sum_assoc α β γ (inr c) = inr (inr c) := rfl
439443

440-
@[simp] def sum_empty (α : Sort*) : α ⊕ empty ≃ α :=
444+
def sum_empty (α : Sort*) : α ⊕ empty ≃ α :=
441445
⟨λ s, match s with inl a := a | inr e := empty.rec _ e end,
442446
inl,
443447
λ s, by { rcases s with _ | ⟨⟨⟩⟩, refl },
444448
λ a, rfl⟩
445449

446-
@[simp] def empty_sum (α : Sort*) : empty ⊕ α ≃ α :=
450+
@[simp] lemma sum_empty_apply_inl {α} (a) : sum_empty α (sum.inl a) = a := rfl
451+
452+
def empty_sum (α : Sort*) : empty ⊕ α ≃ α :=
447453
(sum_comm _ _).trans $ sum_empty _
448454

449-
@[simp] def sum_pempty (α : Sort*) : α ⊕ pempty ≃ α :=
455+
@[simp] lemma empty_sum_apply_inr {α} (a) : empty_sum α (sum.inr a) = a := rfl
456+
457+
def sum_pempty (α : Sort*) : α ⊕ pempty ≃ α :=
450458
⟨λ s, match s with inl a := a | inr e := pempty.rec _ e end,
451459
inl,
452460
λ s, by { rcases s with _ | ⟨⟨⟩⟩, refl },
453461
λ a, rfl⟩
454462

455-
@[simp] def pempty_sum (α : Sort*) : pempty ⊕ α ≃ α :=
463+
@[simp] lemma sum_pempty_apply_inl {α} (a) : sum_pempty α (sum.inl a) = a := rfl
464+
465+
def pempty_sum (α : Sort*) : pempty ⊕ α ≃ α :=
456466
(sum_comm _ _).trans $ sum_pempty _
457467

458-
@[simp] def option_equiv_sum_punit (α : Sort*) : option α ≃ α ⊕ punit.{u+1} :=
468+
@[simp] lemma pempty_sum_apply_inr {α} (a) : pempty_sum α (sum.inr a) = a := rfl
469+
470+
def option_equiv_sum_punit (α : Sort*) : option α ≃ α ⊕ punit.{u+1} :=
459471
⟨λ o, match o with none := inr punit.star | some a := inl a end,
460472
λ s, match s with inr _ := none | inl a := some a end,
461473
λ o, by cases o; refl,
462474
λ s, by rcases s with _ | ⟨⟨⟩⟩; refl⟩
463475

476+
@[simp] lemma option_equiv_sum_punit_none {α} : option_equiv_sum_punit α none = sum.inr () := rfl
477+
@[simp] lemma option_equiv_sum_punit_some {α} (a) :
478+
option_equiv_sum_punit α (some a) = sum.inl a := rfl
479+
464480
/-- The set of `x : option α` such that `is_some x` is equivalent to `α`. -/
465481
def option_is_some_equiv (α : Type*) : {x : option α // x.is_some} ≃ α :=
466482
{ to_fun := λ o, option.get o.2,
@@ -592,7 +608,7 @@ def nat_equiv_nat_sum_punit : ℕ ≃ ℕ ⊕ punit.{u+1} :=
592608
λ n, begin cases n, repeat { refl } end,
593609
λ s, begin cases s with a u, { refl }, {cases u, { refl }} end
594610

595-
@[simp] def nat_sum_punit_equiv_nat : ℕ ⊕ punit.{u+1} ≃ ℕ :=
611+
def nat_sum_punit_equiv_nat : ℕ ⊕ punit.{u+1} ≃ ℕ :=
596612
nat_equiv_nat_sum_punit.symm
597613

598614
def int_equiv_nat_sum_nat : ℤ ≃ ℕ ⊕ ℕ :=

src/data/finsupp.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -928,8 +928,8 @@ lemma sum_comap_domain {α₁ α₂ β γ : Type*} [has_zero β] [add_comm_monoi
928928
(hf : set.bij_on f (f ⁻¹' l.support.to_set) l.support.to_set) :
929929
(comap_domain f l hf.inj_on).sum (g ∘ f) = l.sum g :=
930930
begin
931-
unfold sum,
932-
simp only [comap_domain, comap_domain_apply, finset.sum_preimage f _ _ (λ (x : α₂), g x (l x))],
931+
simp [sum],
932+
simp [comap_domain, finset.sum_preimage f _ _ (λ (x : α₂), g x (l x))]
933933
end
934934

935935
lemma eq_zero_of_comap_domain_eq_zero {α₁ α₂ γ : Type*} [add_comm_monoid γ]

src/data/finsupp/pointwise.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ instance [semiring β] : semigroup (α →₀ β) :=
5353
mul_assoc := λ f g h, by { ext, simp only [mul_apply, mul_assoc], }, }
5454

5555
instance [ring β] : distrib (α →₀ β) :=
56-
{ left_distrib := λ f g h, by { ext, simp only [mul_apply, add_apply, left_distrib], },
57-
right_distrib := λ f g h, by { ext, simp only [mul_apply, add_apply, right_distrib], },
56+
{ left_distrib := λ f g h, by { ext, simp only [mul_apply, add_apply, left_distrib] {proj := ff} },
57+
right_distrib := λ f g h, by { ext, simp only [mul_apply, add_apply, right_distrib] {proj := ff} },
5858
..(infer_instance : semigroup (α →₀ β)),
5959
..(infer_instance : add_comm_group (α →₀ β)) }
6060

src/data/list/defs.lean

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,6 @@ def take_while (p : α → Prop) [decidable_pred p] : list α → list α
105105
| [] := []
106106
| (a::l) := if p a then a :: take_while l else []
107107

108-
/-- `after p xs` is the suffix of `xs` after the first element that satisfies
109-
`p`, not including that element.
110-
111-
```lean
112-
after (eq 1) [0, 1, 2, 3] = [2, 3]
113-
drop_while (not ∘ eq 1) [0, 1, 2, 3] = [1, 2, 3]
114-
```
115-
-/
116-
def after (p : α → Prop) [decidable_pred p] : list α → list α
117-
| [] := []
118-
| (x :: xs) := if p x then xs else after xs
119-
120108
/-- Fold a function `f` over the list from the left, returning the list
121109
of partial results.
122110

src/data/list/sigma.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ lemma mem_ext {l₀ l₁ : list (sigma β)}
103103
(nd₀ : l₀.nodup) (nd₁ : l₁.nodup)
104104
(h : ∀ x, x ∈ l₀ ↔ x ∈ l₁) : l₀ ~ l₁ :=
105105
begin
106-
induction l₀ with x xs generalizing l₁; cases l₁ with x ys,
106+
induction l₀ with x xs generalizing l₁; cases l₁ with y ys,
107107
{ constructor },
108108
iterate 2
109-
{ specialize h x, simp at h,
109+
{ specialize h x <|> specialize h y, simp at h,
110110
cases h },
111-
simp at nd₀ nd₁, rename x y, classical,
111+
simp at nd₀ nd₁, classical,
112112
cases nd₀, cases nd₁,
113113
by_cases h' : x = y,
114114
{ subst y, constructor, apply l₀_ih ‹ _ › ‹ nodup ys ›,

0 commit comments

Comments
 (0)