@@ -179,14 +179,15 @@ def consEquiv (α : Fin (n + 1) → Type*) : α 0 × (∀ i, α (succ i)) ≃
179179
180180/-- Recurse on an `n+1`-tuple by splitting it into a single element and an `n`-tuple. -/
181181@[elab_as_elim]
182- def consCases {P : (∀ i : Fin n.succ, α i) → Sort v} (h : ∀ x₀ x, P (Fin.cons x₀ x))
183- (x : ∀ i : Fin n.succ, α i) : P x :=
184- _root_.cast (by rw [cons_self_tail]) <| h (x 0 ) (tail x)
182+ def consCases {motive : (∀ i : Fin n.succ, α i) → Sort v} (cons : ∀ x₀ x, motive (Fin.cons x₀ x))
183+ (x : ∀ i : Fin n.succ, α i) : motive x :=
184+ _root_.cast (by rw [cons_self_tail]) <| cons (x 0 ) (tail x)
185185
186186set_option backward.isDefEq.respectTransparency false in
187187@[simp]
188- theorem consCases_cons {P : (∀ i : Fin n.succ, α i) → Sort v} (h : ∀ x₀ x, P (Fin.cons x₀ x))
189- (x₀ : α 0 ) (x : ∀ i : Fin n, α i.succ) : consCases h (cons x₀ x) = h x₀ x := by
188+ theorem consCases_cons {motive : (∀ i : Fin n.succ, α i) → Sort v}
189+ (cons : ∀ x₀ x, motive (Fin.cons x₀ x))
190+ (x₀ : α 0 ) (x : ∀ i : Fin n, α i.succ) : consCases cons (Fin.cons x₀ x) = cons x₀ x := by
190191 rw [consCases, cast_eq]
191192 congr
192193
@@ -710,25 +711,26 @@ def snocEquiv (α : Fin (n + 1) → Type*) : α (last n) × (∀ i, α (castSucc
710711
711712/-- Recurse on an `n+1`-tuple by splitting it its initial `n`-tuple and its last element. -/
712713@ [elab_as_elim, inline]
713- def snocCases {P : (∀ i : Fin n.succ, α i) → Sort *}
714- (h : ∀ xs x, P (Fin.snoc xs x))
715- (x : ∀ i : Fin n.succ, α i) : P x :=
716- _root_.cast (by rw [Fin.snoc_init_self]) <| h (Fin.init x) (x <| Fin.last _)
714+ def snocCases {motive : (∀ i : Fin n.succ, α i) → Sort *}
715+ (snoc : ∀ xs x, motive (Fin.snoc xs x))
716+ (x : ∀ i : Fin n.succ, α i) : motive x :=
717+ _root_.cast (by rw [Fin.snoc_init_self]) <| snoc (Fin.init x) (x <| Fin.last _)
717718
718719@[simp] lemma snocCases_snoc
719- {P : (∀ i : Fin (n + 1 ), α i) → Sort *} (h : ∀ x x₀, P (Fin.snoc x x₀))
720+ {motive : (∀ i : Fin (n + 1 ), α i) → Sort *} (snoc : ∀ x x₀, motive (Fin.snoc x x₀))
720721 (x : ∀ i : Fin n, (Fin.init α) i) (x₀ : α (Fin.last _)) :
721- snocCases h (Fin.snoc x x₀) = h x x₀ := by
722+ snocCases snoc (Fin.snoc x x₀) = snoc x x₀ := by
722723 rw [snocCases, cast_eq_iff_heq, Fin.init_snoc, Fin.snoc_last]
723724
724725/-- Recurse on a tuple by splitting into `Fin.elim0` and `Fin.snoc`. -/
725726@[elab_as_elim]
726727def snocInduction {α : Sort *}
727- {P : ∀ {n : ℕ}, (Fin n → α) → Sort *}
728- (h0 : P Fin.elim0)
729- (h : ∀ {n} (x : Fin n → α) (x₀), P x → P (Fin.snoc x x₀)) : ∀ {n : ℕ} (x : Fin n → α), P x
730- | 0 , x => by convert h0
731- | _ + 1 , x => snocCases (fun _ _ ↦ h _ _ <| snocInduction h0 h _) x
728+ {motive : ∀ {n : ℕ}, (Fin n → α) → Sort *}
729+ (elim0 : motive Fin.elim0)
730+ (snoc : ∀ {n} (x : Fin n → α) (x₀), motive x → motive (Fin.snoc x x₀)) :
731+ ∀ {n : ℕ} (x : Fin n → α), motive x
732+ | 0 , x => by convert elim0
733+ | _ + 1 , x => snocCases (fun _ _ ↦ snoc _ _ <| snocInduction elim0 snoc _) x
732734
733735theorem snoc_injective_of_injective {α} {x₀ : α} {x : Fin n → α}
734736 (hx : Function.Injective x) (hx₀ : x₀ ∉ Set.range x) :
0 commit comments