Theorem: PFunctor.M.mk_dest
File: Mathlib/Data/PFunctor/Univariate/M.lean

tactic: apply ext'
state_before: F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
⊢ M.mk x.dest = x
state_after: case H
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
⊢ ∀ (i : ℕ), (M.mk x.dest).approx i = x.approx i

tactic: intro n
state_before: case H
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
⊢ ∀ (i : ℕ), (M.mk x.dest).approx i = x.approx i
state_after: case H
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
⊢ (M.mk x.dest).approx n = x.approx n

tactic: dsimp only [M.mk]
state_before: case H
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
⊢ (M.mk x.dest).approx n = x.approx n
state_after: case H
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
⊢ Approx.sMk x.dest n = x.approx n

tactic: induction' n with n
state_before: case H
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
⊢ Approx.sMk x.dest n = x.approx n
state_after: case H.zero
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
⊢ Approx.sMk x.dest 0 = x.approx 0

case H.succ
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
⊢ Approx.sMk x.dest (n + 1) = x.approx (n + 1)

tactic: dsimp only [Approx.sMk, dest, head]
state_before: case H.succ
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
⊢ Approx.sMk x.dest (n + 1) = x.approx (n + 1)
state_after: case H.succ
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
⊢ (CofixA.intro (head' (x.approx 1)) fun i => (x.children i).approx n) = x.approx (n + 1)

tactic: cases' h : x.approx (succ n) with _ hd ch
state_before: case H.succ
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
⊢ (CofixA.intro (head' (x.approx 1)) fun i => (x.children i).approx n) = x.approx (n + 1)
state_after: case H.succ.intro
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
ch : F.B hd → CofixA F n
h : x.approx n.succ = CofixA.intro hd ch
⊢ (CofixA.intro (head' (x.approx 1)) fun i => (x.children i).approx n) = CofixA.intro hd ch

tactic: revert ch
state_before: case H.succ.intro
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
ch : F.B hd → CofixA F n
h : x.approx n.succ = CofixA.intro hd ch
h' : hd = head' (x.approx 1)
⊢ (CofixA.intro (head' (x.approx 1)) fun i => (x.children i).approx n) = CofixA.intro hd ch
state_after: case H.succ.intro
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
⊢ ∀ (ch : F.B hd → CofixA F n),
    x.approx n.succ = CofixA.intro hd ch →
      (CofixA.intro (head' (x.approx 1)) fun i => (x.children i).approx n) = CofixA.intro hd ch

tactic: rw [h']
state_before: case H.succ.intro
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
⊢ ∀ (ch : F.B hd → CofixA F n),
    x.approx n.succ = CofixA.intro hd ch →
      (CofixA.intro (head' (x.approx 1)) fun i => (x.children i).approx n) = CofixA.intro hd ch
state_after: case H.succ.intro
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
⊢ ∀ (ch : F.B (head' (x.approx 1)) → CofixA F n),
    x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch →
      (CofixA.intro (head' (x.approx 1)) fun i => (x.children i).approx n) = CofixA.intro (head' (x.approx 1)) ch

tactic: intros ch h
state_before: case H.succ.intro
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
⊢ ∀ (ch : F.B (head' (x.approx 1)) → CofixA F n),
    x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch →
      (CofixA.intro (head' (x.approx 1)) fun i => (x.children i).approx n) = CofixA.intro (head' (x.approx 1)) ch
state_after: case H.succ.intro
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
ch : F.B (head' (x.approx 1)) → CofixA F n
h : x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch
⊢ (CofixA.intro (head' (x.approx 1)) fun i => (x.children i).approx n) = CofixA.intro (head' (x.approx 1)) ch

tactic: congr
state_before: case H.succ.intro
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
ch : F.B (head' (x.approx 1)) → CofixA F n
h : x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch
⊢ (CofixA.intro (head' (x.approx 1)) fun i => (x.children i).approx n) = CofixA.intro (head' (x.approx 1)) ch
state_after: case H.succ.intro.e_a
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
ch : F.B (head' (x.approx 1)) → CofixA F n
h : x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch
⊢ (fun i => (x.children i).approx n) = ch

tactic: ext a
state_before: case H.succ.intro.e_a
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
ch : F.B (head' (x.approx 1)) → CofixA F n
h : x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch
⊢ (fun i => (x.children i).approx n) = ch
state_after: case H.succ.intro.e_a.h
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
ch : F.B (head' (x.approx 1)) → CofixA F n
h : x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch
a : F.B (head' (x.approx 1))
⊢ (x.children a).approx n = ch a

tactic: dsimp only [children]
state_before: case H.succ.intro.e_a.h
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
ch : F.B (head' (x.approx 1)) → CofixA F n
h : x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch
a : F.B (head' (x.approx 1))
⊢ (x.children a).approx n = ch a
state_after: case H.succ.intro.e_a.h
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
ch : F.B (head' (x.approx 1)) → CofixA F n
h : x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch
a : F.B (head' (x.approx 1))
⊢ children' (x.approx n.succ) (cast ⋯ a) = ch a

tactic: generalize hh : cast _ a = a''
state_before: case H.succ.intro.e_a.h
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
ch : F.B (head' (x.approx 1)) → CofixA F n
h : x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch
a : F.B (head' (x.approx 1))
⊢ children' (x.approx n.succ) (cast ⋯ a) = ch a
state_after: case H.succ.intro.e_a.h
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
ch : F.B (head' (x.approx 1)) → CofixA F n
h : x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch
a : F.B (head' (x.approx 1))
a'' : F.B (head' (x.approx n.succ))
hh : cast ⋯ a = a''
⊢ children' (x.approx n.succ) a'' = ch a

tactic: rw [cast_eq_iff_heq] at hh
state_before: case H.succ.intro.e_a.h
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
ch : F.B (head' (x.approx 1)) → CofixA F n
h : x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch
a : F.B (head' (x.approx 1))
a'' : F.B (head' (x.approx n.succ))
hh : cast ⋯ a = a''
⊢ children' (x.approx n.succ) a'' = ch a
state_after: case H.succ.intro.e_a.h
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
ch : F.B (head' (x.approx 1)) → CofixA F n
h : x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch
a : F.B (head' (x.approx 1))
a'' : F.B (head' (x.approx n.succ))
hh : HEq a a''
⊢ children' (x.approx n.succ) a'' = ch a

tactic: revert a''
state_before: case H.succ.intro.e_a.h
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
ch : F.B (head' (x.approx 1)) → CofixA F n
h : x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch
a : F.B (head' (x.approx 1))
a'' : F.B (head' (x.approx n.succ))
hh : HEq a a''
⊢ children' (x.approx n.succ) a'' = ch a
state_after: case H.succ.intro.e_a.h
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
ch : F.B (head' (x.approx 1)) → CofixA F n
h : x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch
a : F.B (head' (x.approx 1))
⊢ ∀ (a'' : F.B (head' (x.approx n.succ))), HEq a a'' → children' (x.approx n.succ) a'' = ch a

tactic: rw [h]
state_before: case H.succ.intro.e_a.h
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
ch : F.B (head' (x.approx 1)) → CofixA F n
h : x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch
a : F.B (head' (x.approx 1))
⊢ ∀ (a'' : F.B (head' (x.approx n.succ))), HEq a a'' → children' (x.approx n.succ) a'' = ch a
state_after: case H.succ.intro.e_a.h
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
ch : F.B (head' (x.approx 1)) → CofixA F n
h : x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch
a : F.B (head' (x.approx 1))
⊢ ∀ (a'' : F.B (head' (CofixA.intro (head' (x.approx 1)) ch))),
    HEq a a'' → children' (CofixA.intro (head' (x.approx 1)) ch) a'' = ch a

tactic: intros _ hh
state_before: case H.succ.intro.e_a.h
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
ch : F.B (head' (x.approx 1)) → CofixA F n
h : x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch
a : F.B (head' (x.approx 1))
⊢ ∀ (a'' : F.B (head' (CofixA.intro (head' (x.approx 1)) ch))),
    HEq a a'' → children' (CofixA.intro (head' (x.approx 1)) ch) a'' = ch a
state_after: case H.succ.intro.e_a.h
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
ch : F.B (head' (x.approx 1)) → CofixA F n
h : x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch
a : F.B (head' (x.approx 1))
a''✝ : F.B (head' (CofixA.intro (head' (x.approx 1)) ch))
hh : HEq a a''✝
⊢ children' (CofixA.intro (head' (x.approx 1)) ch) a''✝ = ch a

tactic: cases hh
state_before: case H.succ.intro.e_a.h
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
ch : F.B (head' (x.approx 1)) → CofixA F n
h : x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch
a : F.B (head' (x.approx 1))
a''✝ : F.B (head' (CofixA.intro (head' (x.approx 1)) ch))
hh : HEq a a''✝
⊢ children' (CofixA.intro (head' (x.approx 1)) ch) a''✝ = ch a
state_after: case H.succ.intro.e_a.h.refl
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
ch : F.B (head' (x.approx 1)) → CofixA F n
h : x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch
a : F.B (head' (x.approx 1))
⊢ children' (CofixA.intro (head' (x.approx 1)) ch) a = ch a

tactic: rfl
state_before: case H.succ.intro.e_a.h.refl
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
h' : hd = head' (x.approx 1)
ch : F.B (head' (x.approx 1)) → CofixA F n
h : x.approx n.succ = CofixA.intro (head' (x.approx 1)) ch
a : F.B (head' (x.approx 1))
⊢ children' (CofixA.intro (head' (x.approx 1)) ch) a = ch a
state_after: no goals

tactic: apply @Subsingleton.elim _ CofixA.instSubsingleton
state_before: case H.zero
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
⊢ Approx.sMk x.dest 0 = x.approx 0
state_after: no goals

tactic: rw [← head_succ' n, h, head']
state_before: F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
ch : F.B hd → CofixA F n
h : x.approx n.succ = CofixA.intro hd ch
⊢ hd = head' (x.approx 1)
state_after: F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
ch : F.B hd → CofixA F n
h : x.approx n.succ = CofixA.intro hd ch
⊢ hd =
    match n, CofixA.intro hd ch with
    | x, CofixA.intro i a => i

case Hconsistent
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
ch : F.B hd → CofixA F n
h : x.approx n.succ = CofixA.intro hd ch
⊢ AllAgree x.approx

tactic: split
state_before: F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
ch : F.B hd → CofixA F n
h : x.approx n.succ = CofixA.intro hd ch
⊢ hd =
    match n, CofixA.intro hd ch with
    | x, CofixA.intro i a => i
state_after: F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
hd : F.A
x✝² x✝¹ : ℕ
x✝ : CofixA F x✝¹.succ
i✝ : F.A
a✝¹ : F.B i✝ → CofixA F x✝²
a✝ : Approx.sMk x.dest x✝² = x.approx x✝²
ch : F.B hd → CofixA F x✝²
h : x.approx x✝².succ = CofixA.intro hd ch
heq✝ : CofixA.intro hd ch = CofixA.intro i✝ a✝¹
⊢ hd = i✝

tactic: injections
state_before: F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
hd : F.A
x✝² x✝¹ : ℕ
x✝ : CofixA F x✝¹.succ
i✝ : F.A
a✝¹ : F.B i✝ → CofixA F x✝²
a✝ : Approx.sMk x.dest x✝² = x.approx x✝²
ch : F.B hd → CofixA F x✝²
h : x.approx x✝².succ = CofixA.intro hd ch
heq✝ : CofixA.intro hd ch = CofixA.intro i✝ a✝¹
⊢ hd = i✝
state_after: no goals

tactic: apply x.consistent
state_before: case Hconsistent
F : PFunctor.{u}
X : Type u_1
f : X → ↑F X
x : F.M
n : ℕ
a✝ : Approx.sMk x.dest n = x.approx n
hd : F.A
ch : F.B hd → CofixA F n
h : x.approx n.succ = CofixA.intro hd ch
⊢ AllAgree x.approx
state_after: no goals