File: Mathlib/Data/QPF/Multivariate/Constructions/Fix.lean

full_name: MvQPF.recF
code: /-- `recF` is used as a basis for defining the recursor on `Fix F α`. `recF`
traverses recursively the W-type generated by `q.P` using a function on `F`
as a recursive step -/
def recF {α : TypeVec n} {β : Type u} (g : F (α.append1 β) → β) : q.P.W α → β 
goal: (MvQPF.P F).W α → β

full_name: MvQPF.recF_eq
code: theorem recF_eq {α : TypeVec n} {β : Type u} (g : F (α.append1 β) → β) (a : q.P.A)
    (f' : q.P.drop.B a ⟹ α) (f : q.P.last.B a → q.P.W α) :
    recF g (q.P.wMk a f' f) = g (abs ⟨a, splitFun f' (recF g ∘ f)⟩) 
goal: MvQPF.recF g ((MvQPF.P F).wMk a f' f) = g (MvQPF.abs ⟨a, TypeVec.splitFun f' (MvQPF.recF g ∘ f)⟩)

full_name: MvQPF.recF_eq'
code: theorem recF_eq' {α : TypeVec n} {β : Type u} (g : F (α.append1 β) → β) (x : q.P.W α) :
    recF g x = g (abs (appendFun id (recF g) <$$> q.P.wDest' x)) 
goal: MvQPF.recF g x = g (MvQPF.abs (MvFunctor.map (TypeVec.id ::: MvQPF.recF g) ((MvQPF.P F).wDest' x)))

full_name: MvQPF.WEquiv.abs
code: /-- Equivalence relation on W-types that represent the same `Fix F`
value -/
inductive WEquiv {α : TypeVec n} : q.P.W α → q.P.W α → Prop
  | ind (a : q.P.A) (f' : q.P.drop.B a ⟹ α) (f₀ f₁ : q.P.last.B a → q.P.W α) :
    (∀ x, WEquiv (f₀ x) (f₁ x)) → WEquiv (q.P.wMk a f' f₀) (q.P.wMk a f' f₁)
  | abs (a₀ : q.P.A) (f'₀ : q.P.drop.B a₀ ⟹ α) (f₀ : q.P.last.B a₀ → q.P.W α) (a₁ : q.P.A)
    (f'₁ : q.P.drop.B a₁ ⟹ α) (f₁ : q.P.last.B a₁ → q.P.W α) :
    abs ⟨a₀, q.P.appendContents f'₀ f₀⟩ = abs ⟨a₁, q.P.appendContents f'₁ f₁⟩ →
      WEquiv (q.P.wMk a₀ f'₀ f₀) (q.P.wMk a₁ f'₁ f₁)
  | trans (u v w : q.P.W α) : WEquiv u v → WEquiv v w → WEquiv u w
goal: MvQPF.abs ⟨a₀, (MvQPF.P F).appendContents f'₀ f₀⟩ = MvQPF.abs ⟨a₁, (MvQPF.P F).appendContents f'₁ f₁⟩ →
  MvQPF.WEquiv ((MvQPF.P F).wMk a₀ f'₀ f₀) ((MvQPF.P F).wMk a₁ f'₁ f₁)

full_name: MvQPF.WEquiv.trans
code: /-- Equivalence relation on W-types that represent the same `Fix F`
value -/
inductive WEquiv {α : TypeVec n} : q.P.W α → q.P.W α → Prop
  | ind (a : q.P.A) (f' : q.P.drop.B a ⟹ α) (f₀ f₁ : q.P.last.B a → q.P.W α) :
    (∀ x, WEquiv (f₀ x) (f₁ x)) → WEquiv (q.P.wMk a f' f₀) (q.P.wMk a f' f₁)
  | abs (a₀ : q.P.A) (f'₀ : q.P.drop.B a₀ ⟹ α) (f₀ : q.P.last.B a₀ → q.P.W α) (a₁ : q.P.A)
    (f'₁ : q.P.drop.B a₁ ⟹ α) (f₁ : q.P.last.B a₁ → q.P.W α) :
    abs ⟨a₀, q.P.appendContents f'₀ f₀⟩ = abs ⟨a₁, q.P.appendContents f'₁ f₁⟩ →
      WEquiv (q.P.wMk a₀ f'₀ f₀) (q.P.wMk a₁ f'₁ f₁)
  | trans (u v w : q.P.W α) : WEquiv u v → WEquiv v w → WEquiv u w
goal: MvQPF.WEquiv u v → MvQPF.WEquiv v w → MvQPF.WEquiv u w

full_name: MvQPF.WEquiv.ind
code: /-- Equivalence relation on W-types that represent the same `Fix F`
value -/
inductive WEquiv {α : TypeVec n} : q.P.W α → q.P.W α → Prop
  | ind (a : q.P.A) (f' : q.P.drop.B a ⟹ α) (f₀ f₁ : q.P.last.B a → q.P.W α) :
    (∀ x, WEquiv (f₀ x) (f₁ x)) → WEquiv (q.P.wMk a f' f₀) (q.P.wMk a f' f₁)
  | abs (a₀ : q.P.A) (f'₀ : q.P.drop.B a₀ ⟹ α) (f₀ : q.P.last.B a₀ → q.P.W α) (a₁ : q.P.A)
    (f'₁ : q.P.drop.B a₁ ⟹ α) (f₁ : q.P.last.B a₁ → q.P.W α) :
    abs ⟨a₀, q.P.appendContents f'₀ f₀⟩ = abs ⟨a₁, q.P.appendContents f'₁ f₁⟩ →
      WEquiv (q.P.wMk a₀ f'₀ f₀) (q.P.wMk a₁ f'₁ f₁)
  | trans (u v w : q.P.W α) : WEquiv u v → WEquiv v w → WEquiv u w
goal: (∀ (x : (MvQPF.P F).last.B a), MvQPF.WEquiv (f₀ x) (f₁ x)) →
  MvQPF.WEquiv ((MvQPF.P F).wMk a f' f₀) ((MvQPF.P F).wMk a f' f₁)

full_name: MvQPF.WEquiv
code: /-- Equivalence relation on W-types that represent the same `Fix F`
value -/
inductive WEquiv {α : TypeVec n} : q.P.W α → q.P.W α → Prop
  | ind (a : q.P.A) (f' : q.P.drop.B a ⟹ α) (f₀ f₁ : q.P.last.B a → q.P.W α) :
    (∀ x, WEquiv (f₀ x) (f₁ x)) → WEquiv (q.P.wMk a f' f₀) (q.P.wMk a f' f₁)
  | abs (a₀ : q.P.A) (f'₀ : q.P.drop.B a₀ ⟹ α) (f₀ : q.P.last.B a₀ → q.P.W α) (a₁ : q.P.A)
    (f'₁ : q.P.drop.B a₁ ⟹ α) (f₁ : q.P.last.B a₁ → q.P.W α) :
    abs ⟨a₀, q.P.appendContents f'₀ f₀⟩ = abs ⟨a₁, q.P.appendContents f'₁ f₁⟩ →
      WEquiv (q.P.wMk a₀ f'₀ f₀) (q.P.wMk a₁ f'₁ f₁)
  | trans (u v w : q.P.W α) : WEquiv u v → WEquiv v w → WEquiv u w
goal: (MvQPF.P F).W α → (MvQPF.P F).W α → Prop

full_name: MvQPF.recF_eq_of_wEquiv
code: theorem recF_eq_of_wEquiv (α : TypeVec n) {β : Type u} (u : F (α.append1 β) → β) (x y : q.P.W α) :
    WEquiv x y → recF u x = recF u y 
goal: MvQPF.WEquiv x y → MvQPF.recF u x = MvQPF.recF u y

full_name: MvQPF.wEquiv.abs'
code: theorem wEquiv.abs' {α : TypeVec n} (x y : q.P.W α)
    (h : MvQPF.abs (q.P.wDest' x) = MvQPF.abs (q.P.wDest' y)) :
    WEquiv x y 
goal: MvQPF.WEquiv x y

full_name: MvQPF.wEquiv.refl
code: theorem wEquiv.refl {α : TypeVec n} (x : q.P.W α) : WEquiv x x 
goal: MvQPF.WEquiv x x

full_name: MvQPF.wEquiv.symm
code: theorem wEquiv.symm {α : TypeVec n} (x y : q.P.W α) : WEquiv x y → WEquiv y x 
goal: MvQPF.WEquiv x y → MvQPF.WEquiv y x

full_name: MvQPF.wrepr
code: /-- maps every element of the W type to a canonical representative -/
def wrepr {α : TypeVec n} : q.P.W α → q.P.W α 
goal: (MvQPF.P F).W α → (MvQPF.P F).W α

full_name: MvQPF.wrepr_wMk
code: theorem wrepr_wMk {α : TypeVec n} (a : q.P.A) (f' : q.P.drop.B a ⟹ α)
    (f : q.P.last.B a → q.P.W α) :
    wrepr (q.P.wMk a f' f) =
      q.P.wMk' (repr (abs (appendFun id wrepr <$$> ⟨a, q.P.appendContents f' f⟩))) 
goal: MvQPF.wrepr ((MvQPF.P F).wMk a f' f) =
  (MvQPF.P F).wMk'
    (MvQPF.repr (MvQPF.abs (MvFunctor.map (TypeVec.id ::: MvQPF.wrepr) ⟨a, (MvQPF.P F).appendContents f' f⟩)))

full_name: MvQPF.wrepr_equiv
code: theorem wrepr_equiv {α : TypeVec n} (x : q.P.W α) : WEquiv (wrepr x) x 
goal: MvQPF.WEquiv (MvQPF.wrepr x) x

full_name: MvQPF.wEquiv_map
code: theorem wEquiv_map {α β : TypeVec n} (g : α ⟹ β) (x y : q.P.W α) :
    WEquiv x y → WEquiv (g <$$> x) (g <$$> y) 
goal: MvQPF.WEquiv x y → MvQPF.WEquiv (MvFunctor.map g x) (MvFunctor.map g y)

full_name: MvQPF.wSetoid
code: /-- Define the fixed point as the quotient of trees under the equivalence relation.
-/
def wSetoid (α : TypeVec n) : Setoid (q.P.W α) 
goal: Setoid ((MvQPF.P F).W α)

full_name: MvQPF.Fix
code: /-- Least fixed point of functor F. The result is a functor with one fewer parameters
than the input. For `F a b c` a ternary functor, `Fix F` is a binary functor such that

```lean
Fix F a b = F a b (Fix F a b)
```
-/
def Fix {n : ℕ} (F : TypeVec (n + 1) → Type*) [q : MvQPF F] (α : TypeVec n) 
goal: Type u_1

full_name: MvQPF.Fix.map
code: /-- `Fix F` is a functor -/
def Fix.map {α β : TypeVec n} (g : α ⟹ β) : Fix F α → Fix F β 
goal: MvQPF.Fix F α → MvQPF.Fix F β

full_name: MvQPF.Fix.mvfunctor
code: instance Fix.mvfunctor : MvFunctor (Fix F) 
goal: MvFunctor (MvQPF.Fix F)

full_name: MvQPF.Fix.rec
code: /-- Recursor for `Fix F` -/
def Fix.rec {β : Type u} (g : F (α ::: β) → β) : Fix F α → β 
goal: MvQPF.Fix F α → β

full_name: MvQPF.fixToW
code: /-- Access W-type underlying `Fix F`  -/
def fixToW : Fix F α → q.P.W α 
goal: MvQPF.Fix F α → (MvQPF.P F).W α

full_name: MvQPF.Fix.mk
code: /-- Constructor for `Fix F` -/
def Fix.mk (x : F (append1 α (Fix F α))) : Fix F α 
goal: MvQPF.Fix F α

full_name: MvQPF.Fix.dest
code: /-- Destructor for `Fix F` -/
def Fix.dest : Fix F α → F (append1 α (Fix F α)) 
goal: MvQPF.Fix F α → F (α ::: MvQPF.Fix F α)

full_name: MvQPF.Fix.rec_eq
code: theorem Fix.rec_eq {β : Type u} (g : F (append1 α β) → β) (x : F (append1 α (Fix F α))) :
    Fix.rec g (Fix.mk x) = g (appendFun id (Fix.rec g) <$$> x) 
goal: MvQPF.Fix.rec g (MvQPF.Fix.mk x) = g (MvFunctor.map (TypeVec.id ::: MvQPF.Fix.rec g) x)

full_name: MvQPF.Fix.ind_aux
code: theorem Fix.ind_aux (a : q.P.A) (f' : q.P.drop.B a ⟹ α) (f : q.P.last.B a → q.P.W α) :
    Fix.mk (abs ⟨a, q.P.appendContents f' fun x => ⟦f x⟧⟩) = ⟦q.P.wMk a f' f⟧ 
goal: MvQPF.Fix.mk (MvQPF.abs ⟨a, (MvQPF.P F).appendContents f' fun x => ⟦f x⟧⟩) = ⟦(MvQPF.P F).wMk a f' f⟧

full_name: MvQPF.Fix.ind_rec
code: theorem Fix.ind_rec {β : Type u} (g₁ g₂ : Fix F α → β)
    (h :
      ∀ x : F (append1 α (Fix F α)),
        appendFun id g₁ <$$> x = appendFun id g₂ <$$> x → g₁ (Fix.mk x) = g₂ (Fix.mk x)) :
    ∀ x, g₁ x = g₂ x 
goal: g₁ x = g₂ x

full_name: MvQPF.Fix.rec_unique
code: theorem Fix.rec_unique {β : Type u} (g : F (append1 α β) → β) (h : Fix F α → β)
    (hyp : ∀ x, h (Fix.mk x) = g (appendFun id h <$$> x)) : Fix.rec g = h 
goal: MvQPF.Fix.rec g = h

full_name: MvQPF.Fix.mk_dest
code: theorem Fix.mk_dest (x : Fix F α) : Fix.mk (Fix.dest x) = x 
goal: MvQPF.Fix.mk x.dest = x

full_name: MvQPF.Fix.dest_mk
code: theorem Fix.dest_mk (x : F (append1 α (Fix F α))) : Fix.dest (Fix.mk x) = x 
goal: (MvQPF.Fix.mk x).dest = x

full_name: MvQPF.Fix.ind
code: theorem Fix.ind {α : TypeVec n} (p : Fix F α → Prop)
    (h : ∀ x : F (α.append1 (Fix F α)), LiftP (PredLast α p) x → p (Fix.mk x)) : ∀ x, p x 
goal: p x

full_name: MvQPF.mvqpfFix
code: instance mvqpfFix : MvQPF (Fix F) 
goal: MvQPF (MvQPF.Fix F)

full_name: MvQPF.Fix.drec
code: /-- Dependent recursor for `fix F` -/
def Fix.drec {β : Fix F α → Type u}
    (g : ∀ x : F (α ::: Sigma β), β (Fix.mk <| (id ::: Sigma.fst) <$$> x)) (x : Fix F α) : β x 
goal: β x