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

tactic: apply ext'
state_before: F : PFunctor
X : Type ?u.14923
f : X → Obj F X
x : M F
⊢ M.mk (dest x) = x

tactic: intro n
state_before: case H
F : PFunctor
X : Type ?u.14923
f : X → Obj F X
x : M F
⊢ ∀ (i : ℕ), MIntl.approx (M.mk (dest x)) i = MIntl.approx x i

tactic: dsimp only [M.mk]
state_before: case H
F : PFunctor
X : Type ?u.14923
f : X → Obj F X
x : M F
n : ℕ
⊢ MIntl.approx (M.mk (dest x)) n = MIntl.approx x n

tactic: induction' n with n
state_before: case H
F : PFunctor
X : Type ?u.14923
f : X → Obj F X
x : M F
n : ℕ
⊢ Approx.sMk (dest x) n = MIntl.approx x n

tactic: dsimp only [Approx.sMk, dest, head]
state_before: case H.succ
F : PFunctor
X : Type ?u.14923
f : X → Obj F X
x : M F
n : ℕ
n_ih✝ : Approx.sMk (dest x) n = MIntl.approx x n
⊢ Approx.sMk (dest x) (succ n) = MIntl.approx x (succ n)

tactic: cases' h : x.approx (succ n) with _ hd ch
state_before: case H.succ
F : PFunctor
X : Type ?u.14923
f : X → Obj F X
x : M F
n : ℕ
n_ih✝ : Approx.sMk (dest x) n = MIntl.approx x n
⊢ (CofixA.intro (head' (MIntl.approx x 1)) fun i => MIntl.approx (children x i) n) = MIntl.approx x (succ n)

tactic: have h' : hd = head' (x.approx 1) := by
  rw [← head_succ' n, h, head']
  apply x.consistent
state_before: case H.succ.intro
F : PFunctor
X : Type ?u.14923
f : X → Obj F X
x : M F
n : ℕ
n_ih✝ : Approx.sMk (dest x) n = MIntl.approx x n
hd : F.A
ch : B F hd → CofixA F n
h : MIntl.approx x (succ n) = CofixA.intro hd ch
⊢ (CofixA.intro (head' (MIntl.approx x 1)) fun i => MIntl.approx (children x i) n) = CofixA.intro hd ch

tactic: revert ch
state_before: case H.succ.intro
F : PFunctor
X : Type ?u.14923
f : X → Obj F X
x : M F
n : ℕ
n_ih✝ : Approx.sMk (dest x) n = MIntl.approx x n
hd : F.A
ch : B F hd → CofixA F n
h : MIntl.approx x (succ n) = CofixA.intro hd ch
h' : hd = head' (MIntl.approx x 1)
⊢ (CofixA.intro (head' (MIntl.approx x 1)) fun i => MIntl.approx (children x i) n) = CofixA.intro hd ch

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

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

tactic: congr
state_before: case H.succ.intro
F : PFunctor
X : Type ?u.14923
f : X → Obj F X
x : M F
n : ℕ
n_ih✝ : Approx.sMk (dest x) n = MIntl.approx x n
hd : F.A
h' : hd = head' (MIntl.approx x 1)
ch : B F (head' (MIntl.approx x 1)) → CofixA F n
h : MIntl.approx x (succ n) = CofixA.intro (head' (MIntl.approx x 1)) ch
⊢ (CofixA.intro (head' (MIntl.approx x 1)) fun i => MIntl.approx (children x i) n) =
    CofixA.intro (head' (MIntl.approx x 1)) ch

tactic: apply @Subsingleton.elim _ CofixA.instSubsingleton
state_before: case H.zero
F : PFunctor
X : Type ?u.14923
f : X → Obj F X
x : M F
⊢ Approx.sMk (dest x) zero = MIntl.approx x zero

tactic: rw [← head_succ' n, h, head']
state_before: F : PFunctor
X : Type ?u.14923
f : X → Obj F X
x : M F
n : ℕ
n_ih✝ : Approx.sMk (dest x) n = MIntl.approx x n
hd : F.A
ch : B F hd → CofixA F n
h : MIntl.approx x (succ n) = CofixA.intro hd ch
⊢ hd = head' (MIntl.approx x 1)

tactic: apply x.consistent
state_before: case Hconsistent
F : PFunctor
X : Type ?u.14923
f : X → Obj F X
x : M F
n : ℕ
n_ih✝ : Approx.sMk (dest x) n = MIntl.approx x n
hd : F.A
ch : B F hd → CofixA F n
h : MIntl.approx x (succ n) = CofixA.intro hd ch
⊢ AllAgree x.approx

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

tactic: dsimp only [children]
state_before: case H.succ.intro.e_a.h
F : PFunctor
X : Type ?u.14923
f : X → Obj F X
x : M F
n : ℕ
n_ih✝ : Approx.sMk (dest x) n = MIntl.approx x n
hd : F.A
h' : hd = head' (MIntl.approx x 1)
ch : B F (head' (MIntl.approx x 1)) → CofixA F n
h : MIntl.approx x (succ n) = CofixA.intro (head' (MIntl.approx x 1)) ch
a : B F (head' (MIntl.approx x 1))
⊢ MIntl.approx (children x a) n = ch a

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

tactic: rw [cast_eq_iff_heq] at hh
state_before: case H.succ.intro.e_a.h
F : PFunctor
X : Type ?u.14923
f : X → Obj F X
x : M F
n : ℕ
n_ih✝ : Approx.sMk (dest x) n = MIntl.approx x n
hd : F.A
h' : hd = head' (MIntl.approx x 1)
ch : B F (head' (MIntl.approx x 1)) → CofixA F n
h : MIntl.approx x (succ n) = CofixA.intro (head' (MIntl.approx x 1)) ch
a : B F (head' (MIntl.approx x 1))
a'' : B F (head' (MIntl.approx x (succ n)))
hh : cast (_ : B F (head x) = B F (head' (MIntl.approx x (succ n)))) a = a''
⊢ children' (MIntl.approx x (succ n)) a'' = ch a

tactic: revert a''
state_before: case H.succ.intro.e_a.h
F : PFunctor
X : Type ?u.14923
f : X → Obj F X
x : M F
n : ℕ
n_ih✝ : Approx.sMk (dest x) n = MIntl.approx x n
hd : F.A
h' : hd = head' (MIntl.approx x 1)
ch : B F (head' (MIntl.approx x 1)) → CofixA F n
h : MIntl.approx x (succ n) = CofixA.intro (head' (MIntl.approx x 1)) ch
a : B F (head' (MIntl.approx x 1))
a'' : B F (head' (MIntl.approx x (succ n)))
hh : HEq a a''
⊢ children' (MIntl.approx x (succ n)) a'' = ch a

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

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

tactic: cases hh
state_before: case H.succ.intro.e_a.h
F : PFunctor
X : Type ?u.14923
f : X → Obj F X
x : M F
n : ℕ
n_ih✝ : Approx.sMk (dest x) n = MIntl.approx x n
hd : F.A
h' : hd = head' (MIntl.approx x 1)
ch : B F (head' (MIntl.approx x 1)) → CofixA F n
h : MIntl.approx x (succ n) = CofixA.intro (head' (MIntl.approx x 1)) ch
a : B F (head' (MIntl.approx x 1))
a''✝ : B F (head' (CofixA.intro (head' (MIntl.approx x 1)) ch))
hh : HEq a a''✝
⊢ children' (CofixA.intro (head' (MIntl.approx x 1)) ch) a''✝ = ch a

tactic: rfl
state_before: case H.succ.intro.e_a.h.refl
F : PFunctor
X : Type ?u.14923
f : X → Obj F X
x : M F
n : ℕ
n_ih✝ : Approx.sMk (dest x) n = MIntl.approx x n
hd : F.A
h' : hd = head' (MIntl.approx x 1)
ch : B F (head' (MIntl.approx x 1)) → CofixA F n
h : MIntl.approx x (succ n) = CofixA.intro (head' (MIntl.approx x 1)) ch
a : B F (head' (MIntl.approx x 1))
⊢ children' (CofixA.intro (head' (MIntl.approx x 1)) ch) a = ch a