Skip to content

Commit

Permalink
chore: bump toolchain to v4.16.0-rc1, and merge bump/v4.16.0 (#20464)
Browse files Browse the repository at this point in the history
Co-authored-by: leanprover-community-mathlib4-bot <[email protected]>
Co-authored-by: Johan Commelin <[email protected]>
  • Loading branch information
3 people committed Jan 5, 2025
1 parent 1e25efc commit d2eaa22
Show file tree
Hide file tree
Showing 69 changed files with 186 additions and 541 deletions.
2 changes: 1 addition & 1 deletion Archive/Imo/Imo2024Q5.lean
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ lemma Path.tail_induction {motive : Path N → Prop} (ind : ∀ p, motive p.tail
case cons head tail hi =>
by_cases h : (p'.cells[1]'p'.one_lt_length_cells).1 = 0
· refine ind p' ?_
simp_rw [Path.tail, if_pos h, List.tail_cons]
simp_rw [Path.tail, if_pos h, p', List.tail_cons]
exact hi _ _ _ _
· exact base p' h

Expand Down
1 change: 0 additions & 1 deletion Mathlib.lean
Original file line number Diff line number Diff line change
Expand Up @@ -4841,7 +4841,6 @@ import Mathlib.Tactic.DefEqTransformations
import Mathlib.Tactic.DeprecateTo
import Mathlib.Tactic.DeriveCountable
import Mathlib.Tactic.DeriveFintype
import Mathlib.Tactic.DeriveToExpr
import Mathlib.Tactic.DeriveTraversable
import Mathlib.Tactic.Eqns
import Mathlib.Tactic.Eval
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Algebra/BigOperators/Fin.lean
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ theorem prod_Ioi_succ {M : Type*} [CommMonoid M] {n : ℕ} (i : Fin n) (v : Fin

@[to_additive]
theorem prod_congr' {M : Type*} [CommMonoid M] {a b : ℕ} (f : Fin b → M) (h : a = b) :
(∏ i : Fin a, f (cast h i)) = ∏ i : Fin b, f i := by
(∏ i : Fin a, f (i.cast h)) = ∏ i : Fin b, f i := by
subst h
congr

Expand Down
5 changes: 0 additions & 5 deletions Mathlib/Algebra/BigOperators/Group/List.lean
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Authors: Johannes Hölzl, Floris van Doorn, Sébastien Gouëzel, Alex J. Best
-/
import Mathlib.Algebra.Divisibility.Basic
import Mathlib.Algebra.Group.Int
import Mathlib.Data.List.Lemmas
import Mathlib.Data.List.Dedup
import Mathlib.Data.List.Flatten
import Mathlib.Data.List.Pairwise
Expand Down Expand Up @@ -637,10 +636,6 @@ end MonoidHom

end MonoidHom

set_option linter.deprecated false in
@[simp, deprecated "No deprecation message was provided." (since := "2024-10-17")]
lemma Nat.sum_eq_listSum (l : List ℕ) : Nat.sum l = l.sum := rfl

namespace List

lemma length_sigma {σ : α → Type*} (l₁ : List α) (l₂ : ∀ a, List (σ a)) :
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Algebra/MvPolynomial/SchwartzZippel.lean
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ lemma schwartz_zippel_sup_sum :
calc
#{x₀ ∈ S 0 | eval (cons x₀ xₜ) p = 0} ≤ #pₓ.roots.toFinset := by
gcongr
simp (config := { contextual := true }) [subset_iff, eval_eq_eval_mv_eval', pₓ, hpₓ₀]
simp +contextual [subset_iff, eval_eq_eval_mv_eval', pₓ, hpₓ₀, p']
_ ≤ Multiset.card pₓ.roots := pₓ.roots.toFinset_card_le
_ ≤ pₓ.natDegree := pₓ.card_roots'
_ = k := hpₓdeg
Expand Down
3 changes: 2 additions & 1 deletion Mathlib/AlgebraicGeometry/EllipticCurve/NormalForms.lean
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,8 @@ theorem toCharThreeNF_spec_of_b₂_ne_zero (hb₂ : W.b₂ ≠ 0) :
constructor
· simp
· simp
· field_simp [W.toShortNFOfCharThree_a₂ ▸ hb₂]
· have ha₂ : W'.a₂ ≠ 0 := W.toShortNFOfCharThree_a₂ ▸ hb₂
field_simp [ha₂]
linear_combination (W'.a₄ * W'.a₂ ^ 2 + W'.a₄ ^ 2) * CharP.cast_eq_zero F 3

theorem toCharThreeNF_spec_of_b₂_eq_zero (hb₂ : W.b₂ = 0) :
Expand Down
8 changes: 4 additions & 4 deletions Mathlib/Analysis/Calculus/ContDiff/FaaDiBruno.lean
Original file line number Diff line number Diff line change
Expand Up @@ -401,10 +401,10 @@ def extendMiddle (c : OrderedFinpartition n) (k : Fin c.length) : OrderedFinpart
rcases eq_or_ne (c.index i) k with rfl | hi
· have A : update c.partSize (c.index i) (c.partSize (c.index i) + 1) (c.index i) =
c.partSize (c.index i) + 1 := by simp
exact ⟨c.index i, cast A.symm (succ (c.invEmbedding i)), by simp⟩
exact ⟨c.index i, (succ (c.invEmbedding i)).cast A.symm , by simp⟩
· have A : update c.partSize k (c.partSize k + 1) (c.index i) = c.partSize (c.index i) := by
simp [hi]
exact ⟨c.index i, cast A.symm (c.invEmbedding i), by simp [hi]⟩
exact ⟨c.index i, (c.invEmbedding i).cast A.symm, by simp [hi]⟩

lemma index_extendMiddle_zero (c : OrderedFinpartition n) (i : Fin c.length) :
(c.extendMiddle i).index 0 = i := by
Expand Down Expand Up @@ -678,8 +678,8 @@ def extendEquiv (n : ℕ) :
· simp only [↓reduceDIte, comp_apply]
rcases eq_or_ne j 0 with rfl | hj
· simpa using c.emb_zero
· let j' := Fin.pred (cast B.symm j) (by simpa using hj)
have : j = cast B (succ j') := by simp [j']
· let j' := Fin.pred (j.cast B.symm) (by simpa using hj)
have : j = (succ j').cast B := by simp [j']
simp only [this, coe_cast, val_succ, cast_mk, cases_succ', comp_apply, succ_mk,
Nat.succ_eq_add_one, succ_pred]
rfl
Expand Down
3 changes: 2 additions & 1 deletion Mathlib/Analysis/Convex/Continuous.lean
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ lemma ConvexOn.lipschitzOnWith_of_abs_le (hf : ConvexOn ℝ (ball x₀ r) f) (h
ε * (f x - f y) ≤ ‖x - y‖ * (f z - f x) := by
rw [mul_sub, mul_sub, sub_le_sub_iff, ← add_mul]
have h := hf.2 hy' hz (by positivity) (by positivity) hab
field_simp [← hxyz, a, b, ← mul_div_right_comm] at h
rw [← hxyz] at h
field_simp [a, b, ← mul_div_right_comm] at h
rwa [← le_div_iff₀' (by positivity), add_comm (_ * _)]
_ ≤ _ := by
rw [sub_eq_add_neg (f _), two_mul]
Expand Down
10 changes: 6 additions & 4 deletions Mathlib/CategoryTheory/Galois/Decomposition.lean
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,14 @@ lemma connected_component_unique {X A B : C} [IsConnected A] [IsConnected B] (a
have : IsIso v := IsConnected.noTrivialComponent Y v hn
use (asIso u).symm ≪≫ asIso v
have hu : G.map u y = a := by
simp only [y, e, ← PreservesPullback.iso_hom_fst G, fiberPullbackEquiv, Iso.toEquiv_comp,
Equiv.symm_trans_apply, Iso.toEquiv_symm_fun, types_comp_apply, inv_hom_id_apply]
simp only [u, G, y, e, ← PreservesPullback.iso_hom_fst G, fiberPullbackEquiv,
Iso.toEquiv_comp, Equiv.symm_trans_apply, Iso.toEquiv_symm_fun, types_comp_apply,
inv_hom_id_apply]
erw [Types.pullbackIsoPullback_inv_fst_apply (F.map i) (F.map j)]
have hv : G.map v y = b := by
simp only [y, e, ← PreservesPullback.iso_hom_snd G, fiberPullbackEquiv, Iso.toEquiv_comp,
Equiv.symm_trans_apply, Iso.toEquiv_symm_fun, types_comp_apply, inv_hom_id_apply]
simp only [v, G, y, e, ← PreservesPullback.iso_hom_snd G, fiberPullbackEquiv,
Iso.toEquiv_comp, Equiv.symm_trans_apply, Iso.toEquiv_symm_fun, types_comp_apply,
inv_hom_id_apply]
erw [Types.pullbackIsoPullback_inv_snd_apply (F.map i) (F.map j)]
rw [← hu, ← hv]
show (F.toPrefunctor.map u ≫ F.toPrefunctor.map _) y = F.toPrefunctor.map v y
Expand Down
37 changes: 18 additions & 19 deletions Mathlib/Computability/TMToPartrec.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ theorem move_ok {p k₁ k₂ q s L₁ o L₂} {S : K' → List Γ'} (h₁ : k₁
swap
· rw [Function.update_of_ne h₁.symm, List.reverseAux_nil]
refine TransGen.head' rfl ?_
simp only [TM2.step, Option.mem_def, TM2.stepAux, Option.elim, ne_eq]
rw [tr]; simp only [pop', TM2.stepAux]
revert e; cases' S k₁ with a Sk <;> intro e
· cases e
rfl
Expand All @@ -1248,7 +1248,7 @@ theorem move_ok {p k₁ k₂ q s L₁ o L₂} {S : K' → List Γ'} (h₁ : k₁
simp only [e]
rfl
· refine TransGen.head rfl ?_
simp only [TM2.step, Option.mem_def, TM2.stepAux, Option.elim, ne_eq, List.reverseAux_cons]
rw [tr]; simp only [pop', Option.elim, TM2.stepAux, push']
cases' e₁ : S k₁ with a' Sk <;> rw [e₁, splitAtPred] at e
· cases e
cases e₂ : p a' <;> simp only [e₂, cond] at e
Expand All @@ -1273,16 +1273,15 @@ theorem move₂_ok {p k₁ k₂ q s L₁ o L₂} {S : K' → List Γ'} (h₁ : k
⟨some q, none, update (update S k₁ (o.elim id List.cons L₂)) k₂ (L₁ ++ S k₂)⟩ := by
refine (move_ok h₁.1 e).trans (TransGen.head rfl ?_)
simp only [TM2.step, Option.mem_def, TM2.stepAux, id_eq, ne_eq, Option.elim]
cases o <;> simp only [Option.elim, id]
· simp only [TM2.stepAux, Option.isSome, cond_false]
convert move_ok h₁.2.1.symm (splitAtPred_false _) using 2
cases o <;> simp only [Option.elim] <;> rw [tr]
<;> simp only [id, TM2.stepAux, Option.isSome, cond_true, cond_false]
· convert move_ok h₁.2.1.symm (splitAtPred_false _) using 2
simp only [Function.update_comm h₁.1, Function.update_idem]
rw [show update S rev [] = S by rw [← h₂, Function.update_eq_self]]
simp only [Function.update_of_ne h₁.2.2.symm, Function.update_of_ne h₁.2.1,
Function.update_of_ne h₁.1.symm, List.reverseAux_eq, h₂, Function.update_self,
List.append_nil, List.reverse_reverse]
· simp only [TM2.stepAux, Option.isSome, cond_true]
convert move_ok h₁.2.1.symm (splitAtPred_false _) using 2
· convert move_ok h₁.2.1.symm (splitAtPred_false _) using 2
simp only [h₂, Function.update_comm h₁.1, List.reverseAux_eq, Function.update_self,
List.append_nil, Function.update_idem]
rw [show update S rev [] = S by rw [← h₂, Function.update_eq_self]]
Expand All @@ -1293,7 +1292,7 @@ theorem clear_ok {p k q s L₁ o L₂} {S : K' → List Γ'} (e : splitAtPred p
Reaches₁ (TM2.step tr) ⟨some (Λ'.clear p k q), s, S⟩ ⟨some q, o, update S k L₂⟩ := by
induction' L₁ with a L₁ IH generalizing S s
· refine TransGen.head' rfl ?_
simp only [TM2.step, Option.mem_def, TM2.stepAux, Option.elim]
rw [tr]; simp only [pop', TM2.step, Option.mem_def, TM2.stepAux, Option.elim]
revert e; cases' S k with a Sk <;> intro e
· cases e
rfl
Expand All @@ -1303,7 +1302,7 @@ theorem clear_ok {p k q s L₁ o L₂} {S : K' → List Γ'} (e : splitAtPred p
rcases e with ⟨e₁, e₂⟩
rw [e₁, e₂]
· refine TransGen.head rfl ?_
simp only [TM2.step, Option.mem_def, TM2.stepAux, Option.elim]
rw [tr]; simp only [pop', TM2.step, Option.mem_def, TM2.stepAux, Option.elim]
cases' e₁ : S k with a' Sk <;> rw [e₁, splitAtPred] at e
· cases e
cases e₂ : p a' <;> simp only [e₂, cond] at e
Expand All @@ -1322,9 +1321,10 @@ theorem copy_ok (q s a b c d) :
· refine TransGen.single ?_
simp
refine TransGen.head rfl ?_
rw [tr]
simp only [TM2.step, Option.mem_def, TM2.stepAux, elim_rev, List.head?_cons, Option.isSome_some,
List.tail_cons, elim_update_rev, ne_eq, Function.update_of_ne, elim_main, elim_update_main,
elim_stack, elim_update_stack, cond_true, List.reverseAux_cons]
elim_stack, elim_update_stack, cond_true, List.reverseAux_cons, pop', push']
exact IH _ _ _

theorem trPosNum_natEnd : ∀ (n), ∀ x ∈ trPosNum n, natEnd x = false
Expand Down Expand Up @@ -1358,6 +1358,7 @@ theorem head_main_ok {q s L} {c d : List Γ'} :
(splitAtPred_eq _ _ (trNat L.headI) o (trList L.tail) (trNat_natEnd _) ?_)).trans
(TransGen.head rfl (TransGen.head rfl ?_))
· cases L <;> simp [o]
rw [tr]
simp only [TM2.step, Option.mem_def, TM2.stepAux, elim_update_main, elim_rev, elim_update_rev,
Function.update_self, trList]
rw [if_neg (show o ≠ some Γ'.consₗ by cases L <;> simp [o])]
Expand All @@ -1375,6 +1376,7 @@ theorem head_stack_ok {q s L₁ L₂ L₃} :
(move_ok (by decide)
(splitAtPred_eq _ _ [] (some Γ'.consₗ) L₃ (by rintro _ ⟨⟩) ⟨rfl, rfl⟩))
(TransGen.head rfl (TransGen.head rfl ?_))
rw [tr]
simp only [TM2.step, Option.mem_def, TM2.stepAux, ite_true, id_eq, trList, List.nil_append,
elim_update_stack, elim_rev, List.reverseAux_nil, elim_update_rev, Function.update_self,
List.headI_nil, trNat_default]
Expand Down Expand Up @@ -1428,7 +1430,8 @@ theorem succ_ok {q s n} {c d : List Γ'} :
simp [PosNum.succ, trPosNum]
rfl
· refine ⟨l₁, _, some Γ'.bit0, rfl, TransGen.single ?_⟩
simp only [TM2.step, TM2.stepAux, elim_main, elim_update_main, ne_eq, Function.update_of_ne,
simp only [TM2.step]; rw [tr]
simp only [TM2.stepAux, pop', elim_main, elim_update_main, ne_eq, Function.update_of_ne,
elim_rev, elim_update_rev, Function.update_self, Option.mem_def, Option.some.injEq]
rfl

Expand All @@ -1445,11 +1448,9 @@ theorem pred_ok (q₁ q₂ s v) (c d : List Γ') : ∃ s',
simp only [TM2.step, trList, trNat.eq_1, trNum, Nat.cast_succ, Num.add_one, Num.succ,
List.tail_cons, List.headI_cons]
cases' (n : Num) with a
· simp only [trPosNum, List.singleton_append, List.nil_append]
· simp only [trPosNum, Num.succ', List.singleton_append, List.nil_append]
refine TransGen.head rfl ?_
simp only [Option.mem_def, TM2.stepAux, elim_main, List.head?_cons, Option.some.injEq,
decide_false, List.tail_cons, elim_update_main, ne_eq, Function.update_of_ne, elim_rev,
elim_update_rev, natEnd, Function.update_self, cond_true, cond_false]
rw [tr]; simp only [pop', TM2.stepAux, cond_false]
convert unrev_ok using 2
simp
simp only [Num.succ']
Expand Down Expand Up @@ -1555,13 +1556,11 @@ theorem tr_ret_respects (k v s) : ∃ b₂,
by_cases h : v.headI = 0 <;> simp only [h, ite_true, ite_false] at this ⊢
· obtain ⟨c, h₁, h₂⟩ := IH v.tail (trList v).head?
refine ⟨c, h₁, TransGen.head rfl ?_⟩
simp only [Option.mem_def, TM2.stepAux, trContStack, contStack, elim_main, this, cond_true,
elim_update_main]
rw [trCont, tr]; simp only [pop', TM2.stepAux, elim_main, this, elim_update_main]
exact h₂
· obtain ⟨s', h₁, h₂⟩ := trNormal_respects f (Cont.fix f k) v.tail (some Γ'.cons)
refine ⟨_, h₁, TransGen.head rfl <| TransGen.trans ?_ h₂⟩
simp only [Option.mem_def, TM2.stepAux, elim_main, this.1, cond_false, elim_update_main,
trCont]
rw [trCont, tr]; simp only [pop', TM2.stepAux, elim_main, this.1]
convert clear_ok (splitAtPred_eq _ _ (trNat v.headI).tail (some Γ'.cons) _ _ _) using 2
· simp
convert rfl
Expand Down
11 changes: 6 additions & 5 deletions Mathlib/Computability/TuringMachine.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1828,12 +1828,12 @@ theorem tr_respects : Respects (TM0.step M) (TM1.step (tr M)) fun a b ↦ trCfg
cases' s with d a <;> rfl
intro e
refine TransGen.head ?_ (TransGen.head' this ?_)
· simp only [TM1.step, TM1.stepAux]
· simp only [TM1.step, TM1.stepAux, tr]
rw [e]
rfl
cases e' : M q' _
· apply ReflTransGen.single
simp only [TM1.step, TM1.stepAux]
simp only [TM1.step, TM1.stepAux, tr]
rw [e']
rfl
· rfl
Expand Down Expand Up @@ -1926,7 +1926,6 @@ section
variable [DecidableEq K]

/-- The step function for the TM2 model. -/
@[simp]
def stepAux : Stmt₂ → σ → (∀ k, List (Γ k)) → Cfg₂
| push k f q, v, S => stepAux q v (update S k (f v :: S k))
| peek k f q, v, S => stepAux q (f v (S k).head?) S
Expand All @@ -1937,11 +1936,13 @@ def stepAux : Stmt₂ → σ → (∀ k, List (Γ k)) → Cfg₂
| halt, v, S => ⟨none, v, S⟩

/-- The step function for the TM2 model. -/
@[simp]
def step (M : Λ → Stmt₂) : Cfg₂ → Option Cfg₂
| ⟨none, _, _⟩ => none
| ⟨some l, v, S⟩ => some (stepAux (M l) v S)

attribute [simp] stepAux.eq_1 stepAux.eq_2 stepAux.eq_3
stepAux.eq_4 stepAux.eq_5 stepAux.eq_6 stepAux.eq_7 step.eq_1 step.eq_2

/-- The (reflexive) reachability relation for the TM2 model. -/
def Reaches (M : Λ → Stmt₂) : Cfg₂ → Cfg₂ → Prop :=
ReflTransGen fun a b ↦ b ∈ step M a
Expand Down Expand Up @@ -2292,7 +2293,7 @@ noncomputable def trStmts₁ : Stmt₂ → Finset Λ'₂₁

theorem trStmts₁_run {k : K} {s : StAct₂ k} {q : Stmt₂} :
trStmts₁ (stRun s q) = {go k s q, ret q} ∪ trStmts₁ q := by
cases s <;> simp only [trStmts₁]
cases s <;> simp only [trStmts₁, stRun]

theorem tr_respects_aux₂ [DecidableEq K] {k : K} {q : Stmt₂₁} {v : σ} {S : ∀ k, List (Γ k)}
{L : ListBlank (∀ k, Option (Γ k))}
Expand Down
20 changes: 10 additions & 10 deletions Mathlib/Data/Fin/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ This one instead uses a `NeZero n` typeclass hypothesis.
theorem pos_iff_ne_zero' [NeZero n] (a : Fin n) : 0 < a ↔ a ≠ 0 := by
rw [← val_fin_lt, val_zero', Nat.pos_iff_ne_zero, Ne, Ne, Fin.ext_iff, val_zero']

@[simp] lemma cast_eq_self (a : Fin n) : cast rfl a = a := rfl
@[simp] lemma cast_eq_self (a : Fin n) : a.cast rfl = a := rfl

@[simp] theorem cast_eq_zero {k l : ℕ} [NeZero k] [NeZero l]
(h : k = l) (x : Fin k) : Fin.cast h x = 0 ↔ x = 0 := by simp [← val_eq_val]
Expand Down Expand Up @@ -299,7 +299,7 @@ theorem revPerm_symm : (@revPerm n).symm = revPerm :=
rfl

theorem cast_rev (i : Fin n) (h : n = m) :
cast h i.rev = (i.cast h).rev := by
i.rev.cast h = (i.cast h).rev := by
subst h; simp

theorem rev_eq_iff {i j : Fin n} : rev i = j ↔ i = rev j := by
Expand Down Expand Up @@ -619,23 +619,23 @@ theorem coe_of_injective_castLE_symm {n k : ℕ} (h : n ≤ k) (i : Fin k) (hi)
rw [← coe_castLE h]
exact congr_arg Fin.val (Equiv.apply_ofInjective_symm _ _)

theorem leftInverse_cast (eq : n = m) : LeftInverse (cast eq.symm) (cast eq) :=
theorem leftInverse_cast (eq : n = m) : LeftInverse (Fin.cast eq.symm) (Fin.cast eq) :=
fun _ => rfl

theorem rightInverse_cast (eq : n = m) : RightInverse (cast eq.symm) (cast eq) :=
theorem rightInverse_cast (eq : n = m) : RightInverse (Fin.cast eq.symm) (Fin.cast eq) :=
fun _ => rfl

theorem cast_lt_cast (eq : n = m) {a b : Fin n} : cast eq a < cast eq b ↔ a < b :=
theorem cast_lt_cast (eq : n = m) {a b : Fin n} : a.cast eq < b.cast eq ↔ a < b :=
Iff.rfl

theorem cast_le_cast (eq : n = m) {a b : Fin n} : cast eq a ≤ cast eq b ↔ a ≤ b :=
theorem cast_le_cast (eq : n = m) {a b : Fin n} : a.cast eq ≤ b.cast eq ↔ a ≤ b :=
Iff.rfl

/-- The 'identity' equivalence between `Fin m` and `Fin n` when `m = n`. -/
@[simps]
def _root_.finCongr (eq : n = m) : Fin n ≃ Fin m where
toFun := cast eq
invFun := cast eq.symm
toFun := Fin.cast eq
invFun := Fin.cast eq.symm
left_inv := leftInverse_cast eq
right_inv := rightInverse_cast eq

Expand All @@ -656,12 +656,12 @@ a generic theorem about `cast`. -/
lemma _root_.finCongr_eq_equivCast (h : n = m) : finCongr h = .cast (h ▸ rfl) := by subst h; simp

@[simp]
theorem cast_zero {n' : ℕ} [NeZero n] {h : n = n'} : cast h (0 : Fin n) =
theorem cast_zero {n' : ℕ} [NeZero n] {h : n = n'} : (0 : Fin n).cast h =
by { haveI : NeZero n' := by {rw [← h]; infer_instance}; exact 0} := rfl

/-- While in many cases `Fin.cast` is better than `Equiv.cast`/`cast`, sometimes we want to apply
a generic theorem about `cast`. -/
theorem cast_eq_cast (h : n = m) : (cast h : Fin n → Fin m) = _root_.cast (h ▸ rfl) := by
theorem cast_eq_cast (h : n = m) : (Fin.cast h : Fin n → Fin m) = _root_.cast (h ▸ rfl) := by
subst h
ext
rfl
Expand Down
Loading

0 comments on commit d2eaa22

Please sign in to comment.