Skip to content

Commit b254bb3

Browse files
committed
chore(Data/Fin/Tuple/Basic): rename recursor arguments (#35703)
1 parent 243a7e8 commit b254bb3

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

Mathlib/Data/Fin/Tuple/Basic.lean

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -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

186186
set_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]
726727
def 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

733735
theorem snoc_injective_of_injective {α} {x₀ : α} {x : Fin n → α}
734736
(hx : Function.Injective x) (hx₀ : x₀ ∉ Set.range x) :

Mathlib/Topology/Connected/PathConnected.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,11 +465,11 @@ theorem IsPathConnected.exists_path_through_family {n : ℕ}
465465
Path.target_mem_range, and_true] at hp ⊢
466466
obtain ⟨hp, hx⟩ := hp
467467
induction p using snocInduction generalizing x with
468-
| h0 =>
468+
| elim0 =>
469469
simp only [snoc_zero]
470470
use Path.refl x
471471
simp [hx]
472-
| @h n p y hp₂ =>
472+
| @snoc n p y hp₂ =>
473473
simp only [forall_fin_succ', snoc_castSucc, snoc_last, snoc_apply_zero, Path.cast_coe] at hp ⊢
474474
obtain ⟨hp, hy⟩ := hp
475475
specialize hp₂ y hp hy

0 commit comments

Comments
 (0)