l3lab/ntp-mathlib huggingface dataset:
theorem Cofix.abs_repr {α} (x : Cofix F α) : Quot.mk _ (Cofix.repr x) = x := by
  let R := fun x y : Cofix F α => abs (repr y) = x
  refine' Cofix.bisim₂ R _ _ _ rfl
  clear x;
  rintro x y h;
  subst h
  dsimp [Cofix.dest, Cofix.abs]
  induction y using Quot.ind
  simp only [Cofix.repr, M.dest_corec, abs_map, MvQPF.abs_repr, Function.comp]
  conv =>
    congr
    rfl
    

Proof state:
case a
n : ℕ
F✝ : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F✝
q✝ : MvQPF F✝
F : TypeVec.{u} (n + 1) → Type u
inst✝ : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x
a✝ : M (P F) α
| (TypeVec.id ::: Quot.mk Mcongr) <$$>
    (TypeVec.id ::: M.corec (P F) fun x => MvQPF.repr (dest x)) <$$> dest (Quot.mk Mcongr a✝)
case a
n : ℕ
F✝ : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F✝
q✝ : MvQPF F✝
F : TypeVec.{u} (n + 1) → Type u
inst✝ : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x
a✝ : M (P F) α
| (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a✝)

Next tactic:
rw [Cofix.dest]
theorem Cofix.abs_repr {α} (x : Cofix F α) : Quot.mk _ (Cofix.repr x) = x := by
  let R := fun x y : Cofix F α => abs (repr y) = x
  refine' Cofix.bisim₂ R _ _ _ rfl
  clear x;
  rintro x y h;
  subst h
  dsimp [Cofix.dest, Cofix.abs]
  induction y using Quot.ind
  simp only [Cofix.repr, M.dest_corec, abs_map, MvQPF.abs_repr, Function.comp]
  conv =>
    congr
    rfl
    rw [Cofix.dest]
  

Proof state:
case mk
n : ℕ
F✝ : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F✝
q✝ : MvQPF F✝
F : TypeVec.{u} (n + 1) → Type u
inst✝ : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x
a✝ : M (P F) α
⊢ LiftR' (RelLast' α fun x y => Quot.mk Mcongr (M.corec (P F) (fun x => MvQPF.repr (dest x)) y) = x)
    ((TypeVec.id ::: Quot.mk Mcongr) <$$>
      (TypeVec.id :::
          M.corec (P F) fun x =>
            MvQPF.repr
              (Quot.lift (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x))
                (_ :
                  ∀ (x y : M (P F) α),
                    Mcongr x y →
                      (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) x =
                        (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) y)
                x)) <$$>
        Quot.lift (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x))
          (_ :
            ∀ (x y : M (P F) α),
              Mcongr x y →
                (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) x =
                  (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) y)
          (Quot.mk Mcongr a✝))
    ((TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a✝))

Next tactic:
rw [MvFunctor.map_map, MvFunctor.map_map, ← appendFun_comp_id, ← appendFun_comp_id]
theorem Cofix.abs_repr {α} (x : Cofix F α) : Quot.mk _ (Cofix.repr x) = x := by
  let R := fun x y : Cofix F α => abs (repr y) = x
  refine' Cofix.bisim₂ R _ _ _ rfl
  clear x;
  rintro x y h;
  subst h
  dsimp [Cofix.dest, Cofix.abs]
  induction y using Quot.ind
  simp only [Cofix.repr, M.dest_corec, abs_map, MvQPF.abs_repr, Function.comp]
  conv =>
    congr
    rfl
    rw [Cofix.dest]
  rw [MvFunctor.map_map, MvFunctor.map_map, ← appendFun_comp_id, ← appendFun_comp_id]
  

Proof state:
case mk
n : ℕ
F✝ : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F✝
q✝ : MvQPF F✝
F : TypeVec.{u} (n + 1) → Type u
inst✝ : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x
a✝ : M (P F) α
⊢ LiftR' (RelLast' α fun x y => Quot.mk Mcongr (M.corec (P F) (fun x => MvQPF.repr (dest x)) y) = x)
    ((TypeVec.id :::
        (Quot.mk Mcongr ∘
            M.corec (P F) fun x =>
              MvQPF.repr
                (Quot.lift (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x))
                  (_ :
                    ∀ (x y : M (P F) α),
                      Mcongr x y →
                        (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) x =
                          (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) y)
                  x)) ∘
          Quot.mk Mcongr) <$$>
      MvQPF.abs (M.dest (P F) a✝))
    ((TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) a✝))

Next tactic:
apply liftR_map_last
theorem Cofix.abs_repr {α} (x : Cofix F α) : Quot.mk _ (Cofix.repr x) = x := by
  let R := fun x y : Cofix F α => abs (repr y) = x
  refine' Cofix.bisim₂ R _ _ _ rfl
  clear x;
  rintro x y h;
  subst h
  dsimp [Cofix.dest, Cofix.abs]
  induction y using Quot.ind
  simp only [Cofix.repr, M.dest_corec, abs_map, MvQPF.abs_repr, Function.comp]
  conv =>
    congr
    rfl
    rw [Cofix.dest]
  rw [MvFunctor.map_map, MvFunctor.map_map, ← appendFun_comp_id, ← appendFun_comp_id]
  apply liftR_map_last
  

Proof state:
case mk.hh
n : ℕ
F✝ : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F✝
q✝ : MvQPF F✝
F : TypeVec.{u} (n + 1) → Type u
inst✝ : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x
a✝ : M (P F) α
⊢ ∀ (x : M (P F) α),
    Quot.mk Mcongr (M.corec (P F) (fun x => MvQPF.repr (dest x)) (Quot.mk Mcongr x)) =
      ((Quot.mk Mcongr ∘
            M.corec (P F) fun x =>
              MvQPF.repr
                (Quot.lift (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x))
                  (_ :
                    ∀ (x y : M (P F) α),
                      Mcongr x y →
                        (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) x =
                          (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) y)
                  x)) ∘
          Quot.mk Mcongr)
        x

Next tactic:
intros
theorem Cofix.abs_repr {α} (x : Cofix F α) : Quot.mk _ (Cofix.repr x) = x := by
  let R := fun x y : Cofix F α => abs (repr y) = x
  refine' Cofix.bisim₂ R _ _ _ rfl
  clear x;
  rintro x y h;
  subst h
  dsimp [Cofix.dest, Cofix.abs]
  induction y using Quot.ind
  simp only [Cofix.repr, M.dest_corec, abs_map, MvQPF.abs_repr, Function.comp]
  conv =>
    congr
    rfl
    rw [Cofix.dest]
  rw [MvFunctor.map_map, MvFunctor.map_map, ← appendFun_comp_id, ← appendFun_comp_id]
  apply liftR_map_last
  intros
  

Proof state:
case mk.hh
n : ℕ
F✝ : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F✝
q✝ : MvQPF F✝
F : TypeVec.{u} (n + 1) → Type u
inst✝ : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
R : Cofix F α → Cofix F α → Prop := fun x y => abs (repr y) = x
a✝ x✝ : M (P F) α
⊢ Quot.mk Mcongr (M.corec (P F) (fun x => MvQPF.repr (dest x)) (Quot.mk Mcongr x✝)) =
    ((Quot.mk Mcongr ∘
          M.corec (P F) fun x =>
            MvQPF.repr
              (Quot.lift (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x))
                (_ :
                  ∀ (x y : M (P F) α),
                    Mcongr x y →
                      (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) x =
                        (fun x => (TypeVec.id ::: Quot.mk Mcongr) <$$> MvQPF.abs (M.dest (P F) x)) y)
                x)) ∘
        Quot.mk Mcongr)
      x✝

Next tactic:
rfl
theorem corec_roll {α : TypeVec n} {X Y} {x₀ : X} (f : X → Y) (g : Y → F (α ::: X)) :
    Cofix.corec (g ∘ f) x₀ = Cofix.corec (MvFunctor.map (id ::: f) ∘ g) (f x₀) := by
  

Proof state:
n : ℕ
F : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
X Y : Type u
x₀ : X
f : X → Y
g : Y → F (α ::: X)
⊢ Cofix.corec (g ∘ f) x₀ = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x₀)

Next tactic:
mv_bisim x₀ with R a b x Ha Hb
theorem corec_roll {α : TypeVec n} {X Y} {x₀ : X} (f : X → Y) (g : Y → F (α ::: X)) :
    Cofix.corec (g ∘ f) x₀ = Cofix.corec (MvFunctor.map (id ::: f) ∘ g) (f x₀) := by
  mv_bisim x₀ with R a b x Ha Hb
  

Proof state:
case intro.intro
n : ℕ
F : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
X Y : Type u
x₀ : X
f : X → Y
g : Y → F (α ::: X)
R : Cofix F α → Cofix F α → Prop :=
  fun a b => ∃ x, a = Cofix.corec (g ∘ f) x ∧ b = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x)
a b : Cofix F α
x : X
Ha : a = Cofix.corec (g ∘ f) x
Hb : b = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x)
⊢ LiftR' (RelLast' α R) (Cofix.dest a) (Cofix.dest b)

Next tactic:
rw [Ha, Hb, Cofix.dest_corec, Cofix.dest_corec, Function.comp_apply, Function.comp_apply]
theorem corec_roll {α : TypeVec n} {X Y} {x₀ : X} (f : X → Y) (g : Y → F (α ::: X)) :
    Cofix.corec (g ∘ f) x₀ = Cofix.corec (MvFunctor.map (id ::: f) ∘ g) (f x₀) := by
  mv_bisim x₀ with R a b x Ha Hb
  rw [Ha, Hb, Cofix.dest_corec, Cofix.dest_corec, Function.comp_apply, Function.comp_apply]
  

Proof state:
case intro.intro
n : ℕ
F : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
X Y : Type u
x₀ : X
f : X → Y
g : Y → F (α ::: X)
R : Cofix F α → Cofix F α → Prop :=
  fun a b => ∃ x, a = Cofix.corec (g ∘ f) x ∧ b = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x)
a b : Cofix F α
x : X
Ha : a = Cofix.corec (g ∘ f) x
Hb : b = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x)
⊢ LiftR' (RelLast' α R) ((TypeVec.id ::: Cofix.corec (g ∘ f)) <$$> g (f x))
    ((TypeVec.id ::: Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g)) <$$> (TypeVec.id ::: f) <$$> g (f x))

Next tactic:
rw [MvFunctor.map_map, ← appendFun_comp_id]
theorem corec_roll {α : TypeVec n} {X Y} {x₀ : X} (f : X → Y) (g : Y → F (α ::: X)) :
    Cofix.corec (g ∘ f) x₀ = Cofix.corec (MvFunctor.map (id ::: f) ∘ g) (f x₀) := by
  mv_bisim x₀ with R a b x Ha Hb
  rw [Ha, Hb, Cofix.dest_corec, Cofix.dest_corec, Function.comp_apply, Function.comp_apply]
  rw [MvFunctor.map_map, ← appendFun_comp_id]
  

Proof state:
case intro.intro
n : ℕ
F : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
X Y : Type u
x₀ : X
f : X → Y
g : Y → F (α ::: X)
R : Cofix F α → Cofix F α → Prop :=
  fun a b => ∃ x, a = Cofix.corec (g ∘ f) x ∧ b = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x)
a b : Cofix F α
x : X
Ha : a = Cofix.corec (g ∘ f) x
Hb : b = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x)
⊢ LiftR' (RelLast' α R) ((TypeVec.id ::: Cofix.corec (g ∘ f)) <$$> g (f x))
    ((TypeVec.id ::: Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) ∘ f) <$$> g (f x))

Next tactic:
refine' liftR_map_last _ _ _ _ _
theorem corec_roll {α : TypeVec n} {X Y} {x₀ : X} (f : X → Y) (g : Y → F (α ::: X)) :
    Cofix.corec (g ∘ f) x₀ = Cofix.corec (MvFunctor.map (id ::: f) ∘ g) (f x₀) := by
  mv_bisim x₀ with R a b x Ha Hb
  rw [Ha, Hb, Cofix.dest_corec, Cofix.dest_corec, Function.comp_apply, Function.comp_apply]
  rw [MvFunctor.map_map, ← appendFun_comp_id]
  refine' liftR_map_last _ _ _ _ _
  

Proof state:
case intro.intro
n : ℕ
F : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
X Y : Type u
x₀ : X
f : X → Y
g : Y → F (α ::: X)
R : Cofix F α → Cofix F α → Prop :=
  fun a b => ∃ x, a = Cofix.corec (g ∘ f) x ∧ b = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x)
a b : Cofix F α
x : X
Ha : a = Cofix.corec (g ∘ f) x
Hb : b = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x)
⊢ ∀ (x : X), R (Cofix.corec (g ∘ f) x) ((Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) ∘ f) x)

Next tactic:
intro a
theorem corec_roll {α : TypeVec n} {X Y} {x₀ : X} (f : X → Y) (g : Y → F (α ::: X)) :
    Cofix.corec (g ∘ f) x₀ = Cofix.corec (MvFunctor.map (id ::: f) ∘ g) (f x₀) := by
  mv_bisim x₀ with R a b x Ha Hb
  rw [Ha, Hb, Cofix.dest_corec, Cofix.dest_corec, Function.comp_apply, Function.comp_apply]
  rw [MvFunctor.map_map, ← appendFun_comp_id]
  refine' liftR_map_last _ _ _ _ _
  intro a; 

Proof state:
case intro.intro
n : ℕ
F : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
X Y : Type u
x₀ : X
f : X → Y
g : Y → F (α ::: X)
R : Cofix F α → Cofix F α → Prop :=
  fun a b => ∃ x, a = Cofix.corec (g ∘ f) x ∧ b = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x)
a✝ b : Cofix F α
x : X
Ha : a✝ = Cofix.corec (g ∘ f) x
Hb : b = Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) (f x)
a : X
⊢ R (Cofix.corec (g ∘ f) a) ((Cofix.corec (MvFunctor.map (TypeVec.id ::: f) ∘ g) ∘ f) a)

Next tactic:
refine' ⟨a, rfl, rfl⟩
theorem Cofix.dest_corec' {α : TypeVec.{u} n} {β : Type u}
    (g : β → F (α.append1 (Cofix F α ⊕ β))) (x : β) :
    Cofix.dest (Cofix.corec' g x) =
      appendFun id (Sum.elim _root_.id (Cofix.corec' g)) <$$> g x := by
  

Proof state:
n : ℕ
F : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
β : Type u
g : β → F (α ::: (Cofix F α ⊕ β))
x : β
⊢ dest (corec' g x) = (TypeVec.id ::: Sum.elim _root_.id (corec' g)) <$$> g x

Next tactic:
rw [Cofix.corec', Cofix.dest_corec]
theorem Cofix.dest_corec' {α : TypeVec.{u} n} {β : Type u}
    (g : β → F (α.append1 (Cofix F α ⊕ β))) (x : β) :
    Cofix.dest (Cofix.corec' g x) =
      appendFun id (Sum.elim _root_.id (Cofix.corec' g)) <$$> g x := by
  rw [Cofix.corec', Cofix.dest_corec]; 

Proof state:
n : ℕ
F : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
β : Type u
g : β → F (α ::: (Cofix F α ⊕ β))
x : β
⊢ (TypeVec.id ::: corec (Sum.elim (MvFunctor.map (TypeVec.id ::: Sum.inl) ∘ dest) g)) <$$>
      Sum.elim (MvFunctor.map (TypeVec.id ::: Sum.inl) ∘ dest) g (Sum.inr x) =
    (TypeVec.id ::: Sum.elim _root_.id (corec' g)) <$$> g x

Next tactic:
dsimp
theorem Cofix.dest_corec' {α : TypeVec.{u} n} {β : Type u}
    (g : β → F (α.append1 (Cofix F α ⊕ β))) (x : β) :
    Cofix.dest (Cofix.corec' g x) =
      appendFun id (Sum.elim _root_.id (Cofix.corec' g)) <$$> g x := by
  rw [Cofix.corec', Cofix.dest_corec]; dsimp
  

Proof state:
n : ℕ
F : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
β : Type u
g : β → F (α ::: (Cofix F α ⊕ β))
x : β
⊢ (TypeVec.id ::: corec (Sum.elim (MvFunctor.map (TypeVec.id ::: Sum.inl) ∘ dest) g)) <$$> g x =
    (TypeVec.id ::: Sum.elim _root_.id (corec' g)) <$$> g x

Next tactic:
congr!
theorem Cofix.dest_corec' {α : TypeVec.{u} n} {β : Type u}
    (g : β → F (α.append1 (Cofix F α ⊕ β))) (x : β) :
    Cofix.dest (Cofix.corec' g x) =
      appendFun id (Sum.elim _root_.id (Cofix.corec' g)) <$$> g x := by
  rw [Cofix.corec', Cofix.dest_corec]; dsimp
  congr!; 

Proof state:
case h.e'_6.h.e'_7
n : ℕ
F : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
β : Type u
g : β → F (α ::: (Cofix F α ⊕ β))
x : β
⊢ corec (Sum.elim (MvFunctor.map (TypeVec.id ::: Sum.inl) ∘ dest) g) = Sum.elim _root_.id (corec' g)

Next tactic:
ext (i | i)
theorem Cofix.dest_corec' {α : TypeVec.{u} n} {β : Type u}
    (g : β → F (α.append1 (Cofix F α ⊕ β))) (x : β) :
    Cofix.dest (Cofix.corec' g x) =
      appendFun id (Sum.elim _root_.id (Cofix.corec' g)) <$$> g x := by
  rw [Cofix.corec', Cofix.dest_corec]; dsimp
  congr!; ext (i | i) <;> 

Proof state:
case h.e'_6.h.e'_7.h.inl
n : ℕ
F : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
β : Type u
g : β → F (α ::: (Cofix F α ⊕ β))
x : β
i : Cofix F α
⊢ corec (Sum.elim (MvFunctor.map (TypeVec.id ::: Sum.inl) ∘ dest) g) (Sum.inl i) =
    Sum.elim _root_.id (corec' g) (Sum.inl i)

Next tactic:
erw [corec_roll]
theorem Cofix.dest_corec' {α : TypeVec.{u} n} {β : Type u}
    (g : β → F (α.append1 (Cofix F α ⊕ β))) (x : β) :
    Cofix.dest (Cofix.corec' g x) =
      appendFun id (Sum.elim _root_.id (Cofix.corec' g)) <$$> g x := by
  rw [Cofix.corec', Cofix.dest_corec]; dsimp
  congr!; ext (i | i) <;> 

Proof state:
case h.e'_6.h.e'_7.h.inr
n : ℕ
F : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
β : Type u
g : β → F (α ::: (Cofix F α ⊕ β))
x i : β
⊢ corec (Sum.elim (MvFunctor.map (TypeVec.id ::: Sum.inl) ∘ dest) g) (Sum.inr i) =
    Sum.elim _root_.id (corec' g) (Sum.inr i)

Next tactic:
erw [corec_roll]
theorem Cofix.dest_corec' {α : TypeVec.{u} n} {β : Type u}
    (g : β → F (α.append1 (Cofix F α ⊕ β))) (x : β) :
    Cofix.dest (Cofix.corec' g x) =
      appendFun id (Sum.elim _root_.id (Cofix.corec' g)) <$$> g x := by
  rw [Cofix.corec', Cofix.dest_corec]; dsimp
  congr!; ext (i | i) <;> erw [corec_roll] <;> 

Proof state:
case h.e'_6.h.e'_7.h.inl
n : ℕ
F : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
β : Type u
g : β → F (α ::: (Cofix F α ⊕ β))
x : β
i : Cofix F α
⊢ corec
      (MvFunctor.map (TypeVec.id ::: fun x => x) ∘
        Sum.rec (fun val => (MvFunctor.map (TypeVec.id ::: Sum.inl) ∘ dest) val) fun val => g val)
      (Sum.inl i) =
    Sum.elim _root_.id (corec' g) (Sum.inl i)

Next tactic:
dsimp [Cofix.corec']
theorem Cofix.dest_corec' {α : TypeVec.{u} n} {β : Type u}
    (g : β → F (α.append1 (Cofix F α ⊕ β))) (x : β) :
    Cofix.dest (Cofix.corec' g x) =
      appendFun id (Sum.elim _root_.id (Cofix.corec' g)) <$$> g x := by
  rw [Cofix.corec', Cofix.dest_corec]; dsimp
  congr!; ext (i | i) <;> erw [corec_roll] <;> 

Proof state:
case h.e'_6.h.e'_7.h.inr
n : ℕ
F : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
β : Type u
g : β → F (α ::: (Cofix F α ⊕ β))
x i : β
⊢ corec
      (MvFunctor.map (TypeVec.id ::: fun x => x) ∘
        Sum.rec (fun val => (MvFunctor.map (TypeVec.id ::: Sum.inl) ∘ dest) val) fun val => g val)
      (Sum.inr i) =
    Sum.elim _root_.id (corec' g) (Sum.inr i)

Next tactic:
dsimp [Cofix.corec']
theorem Cofix.dest_corec' {α : TypeVec.{u} n} {β : Type u}
    (g : β → F (α.append1 (Cofix F α ⊕ β))) (x : β) :
    Cofix.dest (Cofix.corec' g x) =
      appendFun id (Sum.elim _root_.id (Cofix.corec' g)) <$$> g x := by
  rw [Cofix.corec', Cofix.dest_corec]; dsimp
  congr!; ext (i | i) <;> erw [corec_roll] <;> dsimp [Cofix.corec']
  · 

Proof state:
case h.e'_6.h.e'_7.h.inl
n : ℕ
F : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
β : Type u
g : β → F (α ::: (Cofix F α ⊕ β))
x : β
i : Cofix F α
⊢ corec
      (MvFunctor.map (TypeVec.id ::: fun x => x) ∘
        Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val)
      (Sum.inl i) =
    i

Next tactic:
mv_bisim i with R a b x Ha Hb
theorem Cofix.dest_corec' {α : TypeVec.{u} n} {β : Type u}
    (g : β → F (α.append1 (Cofix F α ⊕ β))) (x : β) :
    Cofix.dest (Cofix.corec' g x) =
      appendFun id (Sum.elim _root_.id (Cofix.corec' g)) <$$> g x := by
  rw [Cofix.corec', Cofix.dest_corec]; dsimp
  congr!; ext (i | i) <;> erw [corec_roll] <;> dsimp [Cofix.corec']
  · mv_bisim i with R a b x Ha Hb
    

Proof state:
case h.e'_6.h.e'_7.h.inl.intro.intro
n : ℕ
F : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
β : Type u
g : β → F (α ::: (Cofix F α ⊕ β))
x✝ : β
i : Cofix F α
R : Cofix F α → Cofix F α → Prop :=
  fun a b =>
    ∃ x,
      a =
          corec
            (MvFunctor.map (TypeVec.id ::: fun x => x) ∘
              Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val)
            (Sum.inl x) ∧
        b = x
a b x : Cofix F α
Ha :
  a =
    corec
      (MvFunctor.map (TypeVec.id ::: fun x => x) ∘
        Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val)
      (Sum.inl x)
Hb : b = x
⊢ LiftR' (RelLast' α R) (dest a) (dest b)

Next tactic:
rw [Ha, Hb, Cofix.dest_corec]
theorem Cofix.dest_corec' {α : TypeVec.{u} n} {β : Type u}
    (g : β → F (α.append1 (Cofix F α ⊕ β))) (x : β) :
    Cofix.dest (Cofix.corec' g x) =
      appendFun id (Sum.elim _root_.id (Cofix.corec' g)) <$$> g x := by
  rw [Cofix.corec', Cofix.dest_corec]; dsimp
  congr!; ext (i | i) <;> erw [corec_roll] <;> dsimp [Cofix.corec']
  · mv_bisim i with R a b x Ha Hb
    rw [Ha, Hb, Cofix.dest_corec]
    

Proof state:
case h.e'_6.h.e'_7.h.inl.intro.intro
n : ℕ
F : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
β : Type u
g : β → F (α ::: (Cofix F α ⊕ β))
x✝ : β
i : Cofix F α
R : Cofix F α → Cofix F α → Prop :=
  fun a b =>
    ∃ x,
      a =
          corec
            (MvFunctor.map (TypeVec.id ::: fun x => x) ∘
              Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val)
            (Sum.inl x) ∧
        b = x
a b x : Cofix F α
Ha :
  a =
    corec
      (MvFunctor.map (TypeVec.id ::: fun x => x) ∘
        Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val)
      (Sum.inl x)
Hb : b = x
⊢ LiftR' (RelLast' α R)
    ((TypeVec.id :::
        corec
          (MvFunctor.map (TypeVec.id ::: fun x => x) ∘
            Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val)) <$$>
      (MvFunctor.map (TypeVec.id ::: fun x => x) ∘
          Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val)
        (Sum.inl x))
    (dest x)

Next tactic:
dsimp [Function.comp_def]
theorem Cofix.dest_corec' {α : TypeVec.{u} n} {β : Type u}
    (g : β → F (α.append1 (Cofix F α ⊕ β))) (x : β) :
    Cofix.dest (Cofix.corec' g x) =
      appendFun id (Sum.elim _root_.id (Cofix.corec' g)) <$$> g x := by
  rw [Cofix.corec', Cofix.dest_corec]; dsimp
  congr!; ext (i | i) <;> erw [corec_roll] <;> dsimp [Cofix.corec']
  · mv_bisim i with R a b x Ha Hb
    rw [Ha, Hb, Cofix.dest_corec]
    dsimp [Function.comp_def]
    

Proof state:
case h.e'_6.h.e'_7.h.inl.intro.intro
n : ℕ
F : TypeVec.{u} (n + 1) → Type u
mvf : MvFunctor F
q : MvQPF F
α : TypeVec.{u} n
β : Type u
g : β → F (α ::: (Cofix F α ⊕ β))
x✝ : β
i : Cofix F α
R : Cofix F α → Cofix F α → Prop :=
  fun a b =>
    ∃ x,
      a =
          corec
            (MvFunctor.map (TypeVec.id ::: fun x => x) ∘
              Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val)
            (Sum.inl x) ∧
        b = x
a b x : Cofix F α
Ha :
  a =
    corec
      (MvFunctor.map (TypeVec.id ::: fun x => x) ∘
        Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) fun val => g val)
      (Sum.inl x)
Hb : b = x
⊢ LiftR'
    (RelLast' α fun a b =>
      ∃ x,
        a =
            corec
              (fun x =>
                (TypeVec.id ::: fun x => x) <$$>
                  Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) (fun val => g val) x)
              (Sum.inl x) ∧
          b = x)
    ((TypeVec.id :::
        corec fun x =>
          (TypeVec.id ::: fun x => x) <$$>
            Sum.rec (fun val => (TypeVec.id ::: Sum.inl) <$$> dest val) (fun val => g val) x) <$$>
      (TypeVec.id ::: fun x => x) <$$> (TypeVec.id ::: Sum.inl) <$$> dest x)
    (dest x)

Next tactic:
repeat rw [MvFunctor.map_map, ← appendFun_comp_id]