File: Mathlib/Data/PFunctor/Univariate/Basic.lean

full_name: PFunctor
code: /-- A polynomial functor `P` is given by a type `A` and a family `B` of types over `A`. `P` maps
any type `α` to a new type `P α`, which is defined as the sigma type `Σ x, P.B x → α`.

An element of `P α` is a pair `⟨a, f⟩`, where `a` is an element of a type `A` and
`f : B a → α`. Think of `a` as the shape of the object and `f` as an index to the relevant
elements of `α`.
-/
@[pp_with_univ]
structure PFunctor where
  /-- The head type -/
  A : Type u
  /-- The child family of types -/
  B : A → Type u
goal: Type (u + 1)

full_name: PFunctor.B
code: /-- A polynomial functor `P` is given by a type `A` and a family `B` of types over `A`. `P` maps
any type `α` to a new type `P α`, which is defined as the sigma type `Σ x, P.B x → α`.

An element of `P α` is a pair `⟨a, f⟩`, where `a` is an element of a type `A` and
`f : B a → α`. Think of `a` as the shape of the object and `f` as an index to the relevant
elements of `α`.
-/
@[pp_with_univ]
structure PFunctor where
  /-- The head type -/
  A : Type u
  /-- The child family of types -/
  B : A → Type u
goal: self.A → Type u

full_name: PFunctor.A
code: /-- A polynomial functor `P` is given by a type `A` and a family `B` of types over `A`. `P` maps
any type `α` to a new type `P α`, which is defined as the sigma type `Σ x, P.B x → α`.

An element of `P α` is a pair `⟨a, f⟩`, where `a` is an element of a type `A` and
`f : B a → α`. Think of `a` as the shape of the object and `f` as an index to the relevant
elements of `α`.
-/
@[pp_with_univ]
structure PFunctor where
  /-- The head type -/
  A : Type u
  /-- The child family of types -/
  B : A → Type u
goal: Type u

full_name: PFunctor.instInhabited
code: instance : Inhabited PFunctor 
goal: Inhabited PFunctor.{u_1}

full_name: PFunctor.Obj
code: /-- Applying `P` to an object of `Type` -/
@[coe]
def Obj (α : Type v) 
goal: Type (max u u v)

full_name: PFunctor.instCoeFunForallType
code: instance : CoeFun PFunctor.{u} (fun _ => Type v → Type (max u v)) 
goal: CoeFun PFunctor.{u} fun x => Type v → Type (max u v)

full_name: PFunctor.map
code: /-- Applying `P` to a morphism of `Type` -/
def map (f : α → β) : P α → P β 
goal: ↑P α → ↑P β

full_name: PFunctor.Obj.inhabited
code: instance Obj.inhabited [Inhabited P.A] [Inhabited α] : Inhabited (P α) 
goal: Inhabited (↑P α)

full_name: PFunctor.instFunctorObj
code: instance : Functor.{v, max u v} P.Obj 
goal: Functor ↑P

full_name: PFunctor.map_eq_map
code: /-- We prefer `PFunctor.map` to `Functor.map` because it is universe-polymorphic. -/
@[simp]
theorem map_eq_map {α β : Type v} (f : α → β) (x : P α) : f <$> x = P.map f x 
goal: f <$> x = P.map f x

full_name: PFunctor.map_eq
code: @[simp]
protected theorem map_eq (f : α → β) (a : P.A) (g : P.B a → α) :
    P.map f ⟨a, g⟩ = ⟨a, f ∘ g⟩ 
goal: P.map f ⟨a, g⟩ = ⟨a, f ∘ g⟩

full_name: PFunctor.id_map
code: @[simp]
protected theorem id_map : ∀ x : P α, P.map id x = x 
goal: P.map id x = x

full_name: PFunctor.map_map
code: @[simp]
protected theorem map_map (f : α → β) (g : β → γ) :
    ∀ x : P α, P.map g (P.map f x) = P.map (g ∘ f) x 
goal: P.map g (P.map f x) = P.map (g ∘ f) x

full_name: PFunctor.instLawfulFunctorObj
code: instance : LawfulFunctor.{v, max u v} P.Obj 
goal: LawfulFunctor ↑P

full_name: PFunctor.W
code: /-- re-export existing definition of W-types and
adapt it to a packaged definition of polynomial functor -/
def W 
goal: Type u

full_name: PFunctor.W.head
code: /-- root element of a W tree -/
def W.head : W P → P.A
  
goal: P.W → P.A

full_name: PFunctor.W.children
code: /-- children of the root of a W tree -/
def W.children : ∀ x : W P, P.B (W.head x) → W P
  
goal: P.B x.head → P.W

full_name: PFunctor.W.dest
code: /-- destructor for W-types -/
def W.dest : W P → P (W P)
  
goal: P.W → ↑P P.W

full_name: PFunctor.W.mk
code: /-- constructor for W-types -/
def W.mk : P (W P) → W P
  
goal: ↑P P.W → P.W

full_name: PFunctor.W.dest_mk
code: @[simp]
theorem W.dest_mk (p : P (W P)) : W.dest (W.mk p) = p 
goal: (PFunctor.W.mk p).dest = p

full_name: PFunctor.W.mk_dest
code: @[simp]
theorem W.mk_dest (p : W P) : W.mk (W.dest p) = p 
goal: PFunctor.W.mk p.dest = p

full_name: PFunctor.Idx
code: /-- `Idx` identifies a location inside the application of a pfunctor.
For `F : PFunctor`, `x : F α` and `i : F.Idx`, `i` can designate
one part of `x` or is invalid, if `i.1 ≠ x.1` -/
def Idx 
goal: Type u

full_name: PFunctor.Idx.inhabited
code: instance Idx.inhabited [Inhabited P.A] [Inhabited (P.B default)] : Inhabited P.Idx 
goal: Inhabited P.Idx

full_name: PFunctor.Obj.iget
code: /-- `x.iget i` takes the component of `x` designated by `i` if any is or returns
a default value -/
def Obj.iget [DecidableEq P.A] {α} [Inhabited α] (x : P α) (i : P.Idx) : α 
goal: α

full_name: PFunctor.fst_map
code: @[simp]
theorem fst_map (x : P α) (f : α → β) : (P.map f x).1 = x.1 
goal: (P.map f x).fst = x.fst

full_name: PFunctor.iget_map
code: @[simp]
theorem iget_map [DecidableEq P.A] [Inhabited α] [Inhabited β] (x : P α)
    (f : α → β) (i : P.Idx) (h : i.1 = x.1) : (P.map f x).iget i = f (x.iget i) 
goal: (P.map f x).iget i = f (x.iget i)

full_name: PFunctor.comp
code: /-- functor composition for polynomial functors -/
def comp (P₂ P₁ : PFunctor.{u}) : PFunctor.{u} 
goal: PFunctor.{u}

full_name: PFunctor.comp.mk
code: /-- constructor for composition -/
def comp.mk (P₂ P₁ : PFunctor.{u}) {α : Type} (x : P₂ (P₁ α)) : comp P₂ P₁ α 
goal: ↑(P₂.comp P₁) α

full_name: PFunctor.comp.get
code: /-- destructor for composition -/
def comp.get (P₂ P₁ : PFunctor.{u}) {α : Type} (x : comp P₂ P₁ α) : P₂ (P₁ α) 
goal: ↑P₂ (↑P₁ α)

full_name: PFunctor.liftp_iff
code: theorem liftp_iff {α : Type u} (p : α → Prop) (x : P α) :
    Liftp p x ↔ ∃ a f, x = ⟨a, f⟩ ∧ ∀ i, p (f i) 
goal: Functor.Liftp p x ↔ ∃ a f, x = ⟨a, f⟩ ∧ ∀ (i : P.B a), p (f i)

full_name: PFunctor.liftp_iff'
code: theorem liftp_iff' {α : Type u} (p : α → Prop) (a : P.A) (f : P.B a → α) :
    @Liftp.{u} P.Obj _ α p ⟨a, f⟩ ↔ ∀ i, p (f i) 
goal: Functor.Liftp p ⟨a, f⟩ ↔ ∀ (i : P.B a), p (f i)

full_name: PFunctor.liftr_iff
code: theorem liftr_iff {α : Type u} (r : α → α → Prop) (x y : P α) :
    Liftr r x y ↔ ∃ a f₀ f₁, x = ⟨a, f₀⟩ ∧ y = ⟨a, f₁⟩ ∧ ∀ i, r (f₀ i) (f₁ i) 
goal: Functor.Liftr r x y ↔ ∃ a f₀ f₁, x = ⟨a, f₀⟩ ∧ y = ⟨a, f₁⟩ ∧ ∀ (i : P.B a), r (f₀ i) (f₁ i)

full_name: PFunctor.supp_eq
code: theorem supp_eq {α : Type u} (a : P.A) (f : P.B a → α) :
    @supp.{u} P.Obj _ α (⟨a, f⟩ : P α) = f '' univ 
goal: Functor.supp ⟨a, f⟩ = f '' Set.univ