Polynomial functors
This file defines polynomial functors and the W-type construction as a polynomial functor. (For the M-type construction, see pfunctor/M.lean.)
- A : Type ?
- B : c.A → Type ?
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.obj α
, which is defined as the sigma type Σ x, P.B x → α
.
An element of P.obj α
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 α
.
@[instance]
Equations
- pfunctor.inhabited = {default := {A := default (Type u_1) sort.inhabited, B := default (default (Type u_1) → Type u_1) (pi.inhabited (default (Type u_1)))}}
root element of a W tree
Equations
- pfunctor.W.head (W.mk a f) = a
children of the root of a W tree
Equations
- pfunctor.W.children (W.mk a f) = f
destructor for W-types
Equations
- pfunctor.W.dest (W.mk a f) = ⟨a, f⟩
constructor for W-types
Equations
- pfunctor.W.mk ⟨a, f⟩ = W.mk a f
@[simp]
def
pfunctor.obj.iget
{P : pfunctor}
[decidable_eq P.A]
{α : Type u_2}
[inhabited α]
(x : P.obj α)
(i : P.Idx) :
α
x.iget i
takes the component of x
designated by i
if any is or returns
a default value
theorem
pfunctor.liftp_iff'
{P : pfunctor}
{α : Type u}
(p : α → Prop)
(a : P.A)
(f : P.B a → α) :
functor.liftp p ⟨a, f⟩ ↔ ∀ (i : P.B a), p (f i)
theorem
pfunctor.supp_eq
{P : pfunctor}
{α : Type u}
(a : P.A)
(f : P.B a → α) :
functor.supp ⟨a, f⟩ = f '' set.univ