Multivariate polynomial functors.
Multivariate polynomial functors are used for defining M-types and W-types.
They map a type vector α
to the type Σ a : A, B a ⟹ α
, with A : Type
and
B : A → typevec n
. They interact well with Lean's inductive definitions because
they guarantee that occurrences of α
are positive.
multivariate polynomial functors
Applying P
to an object of Type
@[instance]
theorem
mvpfunctor.id_map
{n : ℕ}
(P : mvpfunctor n)
{α : typevec n}
(x : P.obj α) :
typevec.id <$$> x = x
@[instance]
Constant functor where the input object does not affect the output
Constructor for the constant functor
Equations
- mvpfunctor.const.mk n x = ⟨x, λ (i : fin2 n) (a : (mvpfunctor.const n A).B x i), pempty.elim a⟩
def
mvpfunctor.const.get
{n : ℕ}
{A : Type u}
{α : typevec n}
(x : (mvpfunctor.const n A).obj α) :
A
Destructor for the constant functor
Equations
- mvpfunctor.const.get x = x.fst
@[simp]
theorem
mvpfunctor.const.get_map
{n : ℕ}
{A : Type u}
{α β : typevec n}
(f : α ⟹ β)
(x : (mvpfunctor.const n A).obj α) :
@[simp]
theorem
mvpfunctor.const.get_mk
{n : ℕ}
{A : Type u}
{α : typevec n}
(x : A) :
mvpfunctor.const.get (mvpfunctor.const.mk n x) = x
@[simp]
theorem
mvpfunctor.const.mk_get
{n : ℕ}
{A : Type u}
{α : typevec n}
(x : (mvpfunctor.const n A).obj α) :
mvpfunctor.const.mk n (mvpfunctor.const.get x) = x
Functor composition on polynomial functors
def
mvpfunctor.comp.mk
{n m : ℕ}
{P : mvpfunctor n}
{Q : fin2 n → mvpfunctor m}
{α : typevec m}
(x : P.obj (λ (i : fin2 n), (Q i).obj α)) :
Constructor for functor composition
def
mvpfunctor.comp.get
{n m : ℕ}
{P : mvpfunctor n}
{Q : fin2 n → mvpfunctor m}
{α : typevec m}
(x : (P.comp Q).obj α) :
Destructor for functor composition
theorem
mvpfunctor.comp.get_map
{n m : ℕ}
{P : mvpfunctor n}
{Q : fin2 n → mvpfunctor m}
{α β : typevec m}
(f : α ⟹ β)
(x : (P.comp Q).obj α) :
mvpfunctor.comp.get (f <$$> x) = (λ (i : fin2 n) (x : (Q i).obj α), f <$$> x) <$$> mvpfunctor.comp.get x
@[simp]
theorem
mvpfunctor.comp.get_mk
{n m : ℕ}
{P : mvpfunctor n}
{Q : fin2 n → mvpfunctor m}
{α : typevec m}
(x : P.obj (λ (i : fin2 n), (Q i).obj α)) :
@[simp]
theorem
mvpfunctor.comp.mk_get
{n m : ℕ}
{P : mvpfunctor n}
{Q : fin2 n → mvpfunctor m}
{α : typevec m}
(x : (P.comp Q).obj α) :
theorem
mvpfunctor.liftp_iff'
{n : ℕ}
{P : mvpfunctor n}
{α : typevec n}
(p : Π ⦃i : fin2 n⦄, α i → Prop)
(a : P.A)
(f : P.B a ⟹ α) :
mvfunctor.liftp p ⟨a, f⟩ ↔ ∀ (i : fin2 n) (x : P.B a i), p (f i x)
theorem
mvpfunctor.supp_eq
{n : ℕ}
{P : mvpfunctor n}
{α : typevec n}
(a : P.A)
(f : P.B a ⟹ α)
(i : fin2 n) :
mvfunctor.supp ⟨a, f⟩ i = f i '' set.univ
Split polynomial functor, get a n-ary functor
from a n+1
-ary functor
def
mvpfunctor.append_contents
{n : ℕ}
(P : mvpfunctor (n + 1))
{α : typevec n}
{β : Type u_1}
{a : P.A}
(f' : P.drop.B a ⟹ α)
(f : P.last.B a → β) :
append arrows of a polynomial functor application
Equations
- P.append_contents f' f = typevec.split_fun f' f