File: Mathlib/Data/PFunctor/Multivariate/W.lean

full_name: MvPFunctor.WPath
code: /-- A path from the root of a tree to one of its node -/
inductive WPath : P.last.W → Fin2 n → Type u
  | root (a : P.A) (f : P.last.B a → P.last.W) (i : Fin2 n) (c : P.drop.B a i) : WPath ⟨a, f⟩ i
  | child (a : P.A) (f : P.last.B a → P.last.W) (i : Fin2 n) (j : P.last.B a)
    (c : WPath (f j) i) : WPath ⟨a, f⟩ i
goal: P.last.W → Fin2 n → Type u

full_name: MvPFunctor.WPath.child
code: /-- A path from the root of a tree to one of its node -/
inductive WPath : P.last.W → Fin2 n → Type u
  | root (a : P.A) (f : P.last.B a → P.last.W) (i : Fin2 n) (c : P.drop.B a i) : WPath ⟨a, f⟩ i
  | child (a : P.A) (f : P.last.B a → P.last.W) (i : Fin2 n) (j : P.last.B a)
    (c : WPath (f j) i) : WPath ⟨a, f⟩ i
goal: P.WPath (WType.mk a f) i

full_name: MvPFunctor.WPath.root
code: /-- A path from the root of a tree to one of its node -/
inductive WPath : P.last.W → Fin2 n → Type u
  | root (a : P.A) (f : P.last.B a → P.last.W) (i : Fin2 n) (c : P.drop.B a i) : WPath ⟨a, f⟩ i
  | child (a : P.A) (f : P.last.B a → P.last.W) (i : Fin2 n) (j : P.last.B a)
    (c : WPath (f j) i) : WPath ⟨a, f⟩ i
goal: P.WPath (WType.mk a f) i

full_name: MvPFunctor.WPath.inhabited
code: instance WPath.inhabited (x : P.last.W) {i} [I : Inhabited (P.drop.B x.head i)] :
    Inhabited (WPath P x i) 
goal: Inhabited (P.WPath x i)

full_name: MvPFunctor.wPathCasesOn
code: /-- Specialized destructor on `WPath` -/
def wPathCasesOn {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W} (g' : P.drop.B a ⟹ α)
    (g : ∀ j : P.last.B a, P.WPath (f j) ⟹ α) : P.WPath ⟨a, f⟩ ⟹ α 
goal: TypeVec.Arrow (P.WPath (WType.mk a f)) α

full_name: MvPFunctor.wPathDestLeft
code: /-- Specialized destructor on `WPath` -/
def wPathDestLeft {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W}
    (h : P.WPath ⟨a, f⟩ ⟹ α) : P.drop.B a ⟹ α 
goal: (P.drop.B a).Arrow α

full_name: MvPFunctor.wPathDestRight
code: /-- Specialized destructor on `WPath` -/
def wPathDestRight {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W}
    (h : P.WPath ⟨a, f⟩ ⟹ α) : ∀ j : P.last.B a, P.WPath (f j) ⟹ α 
goal: TypeVec.Arrow (P.WPath (f j)) α

full_name: MvPFunctor.wPathDestLeft_wPathCasesOn
code: theorem wPathDestLeft_wPathCasesOn {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W}
    (g' : P.drop.B a ⟹ α) (g : ∀ j : P.last.B a, P.WPath (f j) ⟹ α) :
    P.wPathDestLeft (P.wPathCasesOn g' g) = g' 
goal: P.wPathDestLeft (P.wPathCasesOn g' g) = g'

full_name: MvPFunctor.wPathDestRight_wPathCasesOn
code: theorem wPathDestRight_wPathCasesOn {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W}
    (g' : P.drop.B a ⟹ α) (g : ∀ j : P.last.B a, P.WPath (f j) ⟹ α) :
    P.wPathDestRight (P.wPathCasesOn g' g) = g 
goal: P.wPathDestRight (P.wPathCasesOn g' g) = g

full_name: MvPFunctor.wPathCasesOn_eta
code: theorem wPathCasesOn_eta {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W}
    (h : P.WPath ⟨a, f⟩ ⟹ α) : P.wPathCasesOn (P.wPathDestLeft h) (P.wPathDestRight h) = h 
goal: P.wPathCasesOn (P.wPathDestLeft h) (P.wPathDestRight h) = h

full_name: MvPFunctor.comp_wPathCasesOn
code: theorem comp_wPathCasesOn {α β : TypeVec n} (h : α ⟹ β) {a : P.A} {f : P.last.B a → P.last.W}
    (g' : P.drop.B a ⟹ α) (g : ∀ j : P.last.B a, P.WPath (f j) ⟹ α) :
    h ⊚ P.wPathCasesOn g' g = P.wPathCasesOn (h ⊚ g') fun i => h ⊚ g i 
goal: TypeVec.comp h (P.wPathCasesOn g' g) = P.wPathCasesOn (TypeVec.comp h g') fun i => TypeVec.comp h (g i)

full_name: MvPFunctor.wp
code: /-- Polynomial functor for the W-type of `P`. `A` is a data-less well-founded
tree whereas, for a given `a : A`, `B a` is a valid path in tree `a` so
that `Wp.obj α` is made of a tree and a function from its valid paths to
the values it contains  -/
def wp : MvPFunctor n 
goal: MvPFunctor.{u} n

full_name: MvPFunctor.W
code: /-- W-type of `P` -/
-- Porting note(#5171): used to have @[nolint has_nonempty_instance]
def W (α : TypeVec n) : Type _ 
goal: Type u

full_name: MvPFunctor.mvfunctorW
code: instance mvfunctorW : MvFunctor P.W 
goal: MvFunctor P.W

full_name: MvPFunctor.wpMk
code: /-- Constructor for `wp` -/
def wpMk {α : TypeVec n} (a : P.A) (f : P.last.B a → P.last.W) (f' : P.WPath ⟨a, f⟩ ⟹ α) :
    P.W α 
goal: P.W α

full_name: MvPFunctor.wpRec
code: def wpRec {α : TypeVec n} {C : Type*}
    (g : ∀ (a : P.A) (f : P.last.B a → P.last.W), P.WPath ⟨a, f⟩ ⟹ α → (P.last.B a → C) → C) :
    ∀ (x : P.last.W) (_ : P.WPath x ⟹ α), C
  
goal: TypeVec.Arrow (P.WPath x) α → C

full_name: MvPFunctor.wpRec_eq
code: theorem wpRec_eq {α : TypeVec n} {C : Type*}
    (g : ∀ (a : P.A) (f : P.last.B a → P.last.W), P.WPath ⟨a, f⟩ ⟹ α → (P.last.B a → C) → C)
    (a : P.A) (f : P.last.B a → P.last.W) (f' : P.WPath ⟨a, f⟩ ⟹ α) :
    P.wpRec g ⟨a, f⟩ f' = g a f f' fun i => P.wpRec g (f i) (P.wPathDestRight f' i) 
goal: P.wpRec g (WType.mk a f) f' = g a f f' fun i => P.wpRec g (f i) (P.wPathDestRight f' i)

full_name: MvPFunctor.wp_ind
code: theorem wp_ind {α : TypeVec n} {C : ∀ x : P.last.W, P.WPath x ⟹ α → Prop}
    (ih : ∀ (a : P.A) (f : P.last.B a → P.last.W) (f' : P.WPath ⟨a, f⟩ ⟹ α),
        (∀ i : P.last.B a, C (f i) (P.wPathDestRight f' i)) → C ⟨a, f⟩ f') :
    ∀ (x : P.last.W) (f' : P.WPath x ⟹ α), C x f'
  
goal: C x f'

full_name: MvPFunctor.wMk
code: /-- Constructor for `W` -/
def wMk {α : TypeVec n} (a : P.A) (f' : P.drop.B a ⟹ α) (f : P.last.B a → P.W α) : P.W α 
goal: P.W α

full_name: MvPFunctor.wRec
code: /-- Recursor for `W` -/
def wRec {α : TypeVec n} {C : Type*}
    (g : ∀ a : P.A, P.drop.B a ⟹ α → (P.last.B a → P.W α) → (P.last.B a → C) → C) : P.W α → C
  
goal: P.W α → C

full_name: MvPFunctor.wRec_eq
code: /-- Defining equation for the recursor of `W` -/
theorem wRec_eq {α : TypeVec n} {C : Type*}
    (g : ∀ a : P.A, P.drop.B a ⟹ α → (P.last.B a → P.W α) → (P.last.B a → C) → C) (a : P.A)
    (f' : P.drop.B a ⟹ α) (f : P.last.B a → P.W α) :
    P.wRec g (P.wMk a f' f) = g a f' f fun i => P.wRec g (f i) 
goal: P.wRec g (P.wMk a f' f) = g a f' f fun i => P.wRec g (f i)

full_name: MvPFunctor.w_ind
code: /-- Induction principle for `W` -/
theorem w_ind {α : TypeVec n} {C : P.W α → Prop}
    (ih : ∀ (a : P.A) (f' : P.drop.B a ⟹ α) (f : P.last.B a → P.W α),
        (∀ i, C (f i)) → C (P.wMk a f' f)) :
    ∀ x, C x 
goal: C x

full_name: MvPFunctor.w_cases
code: theorem w_cases {α : TypeVec n} {C : P.W α → Prop}
    (ih : ∀ (a : P.A) (f' : P.drop.B a ⟹ α) (f : P.last.B a → P.W α), C (P.wMk a f' f)) :
    ∀ x, C x 
goal: C x

full_name: MvPFunctor.wMap
code: /-- W-types are functorial -/
def wMap {α β : TypeVec n} (g : α ⟹ β) : P.W α → P.W β 
goal: P.W α → P.W β

full_name: MvPFunctor.wMk_eq
code: theorem wMk_eq {α : TypeVec n} (a : P.A) (f : P.last.B a → P.last.W) (g' : P.drop.B a ⟹ α)
    (g : ∀ j : P.last.B a, P.WPath (f j) ⟹ α) :
    (P.wMk a g' fun i => ⟨f i, g i⟩) = ⟨⟨a, f⟩, P.wPathCasesOn g' g⟩ 
goal: (P.wMk a g' fun i => ⟨f i, g i⟩) = ⟨WType.mk a f, P.wPathCasesOn g' g⟩

full_name: MvPFunctor.w_map_wMk
code: theorem w_map_wMk {α β : TypeVec n} (g : α ⟹ β) (a : P.A) (f' : P.drop.B a ⟹ α)
    (f : P.last.B a → P.W α) : g <$$> P.wMk a f' f = P.wMk a (g ⊚ f') fun i => g <$$> f i 
goal: MvFunctor.map g (P.wMk a f' f) = P.wMk a (TypeVec.comp g f') fun i => MvFunctor.map g (f i)

full_name: MvPFunctor.objAppend1
code: /-- Constructor of a value of `P.obj (α ::: β)` from components.
Useful to avoid complicated type annotation -/
abbrev objAppend1 {α : TypeVec n} {β : Type u} (a : P.A) (f' : P.drop.B a ⟹ α)
    (f : P.last.B a → β) : P (α ::: β) 
goal: ↑P (α ::: β)

full_name: MvPFunctor.map_objAppend1
code: theorem map_objAppend1 {α γ : TypeVec n} (g : α ⟹ γ) (a : P.A) (f' : P.drop.B a ⟹ α)
    (f : P.last.B a → P.W α) :
    appendFun g (P.wMap g) <$$> P.objAppend1 a f' f =
      P.objAppend1 a (g ⊚ f') fun x => P.wMap g (f x) 
goal: MvFunctor.map (g ::: P.wMap g) (P.objAppend1 a f' f) = P.objAppend1 a (TypeVec.comp g f') fun x => P.wMap g (f x)

full_name: MvPFunctor.wMk'
code: /-- Constructor for the W-type of `P` -/
def wMk' {α : TypeVec n} : P (α ::: P.W α) → P.W α
  
goal: ↑P (α ::: P.W α) → P.W α

full_name: MvPFunctor.wDest'
code: /-- Destructor for the W-type of `P` -/
def wDest' {α : TypeVec.{u} n} : P.W α → P (α.append1 (P.W α)) 
goal: P.W α → ↑P (α ::: P.W α)

full_name: MvPFunctor.wDest'_wMk
code: theorem wDest'_wMk {α : TypeVec n} (a : P.A) (f' : P.drop.B a ⟹ α) (f : P.last.B a → P.W α) :
    P.wDest' (P.wMk a f' f) = ⟨a, splitFun f' f⟩ 
goal: P.wDest' (P.wMk a f' f) = ⟨a, TypeVec.splitFun f' f⟩

full_name: MvPFunctor.wDest'_wMk'
code: theorem wDest'_wMk' {α : TypeVec n} (x : P (α.append1 (P.W α))) : P.wDest' (P.wMk' x) = x 
goal: P.wDest' (P.wMk' x) = x