Quotients of Polynomial Functors #
We assume the following:
P
: a polynomial functorW
: its W-typeM
: its M-typeF
: a functor
We define:
The main goal is to construct:
Fix
: the initial algebra with structure mapF Fix → Fix
.Cofix
: the final coalgebra with structure mapCofix → F Cofix
We also show that the composition of qpfs is a qpf, and that the quotient of a qpf is a qpf.
The present theory focuses on the univariate case for qpfs
References #
- [Jeremy Avigad, Mario M. Carneiro and Simon Hudon, Data Types as Quotients of Polynomial Functors][avigad-carneiro-hudon2019]
Quotients of polynomial functors.
Roughly speaking, saying that F
is a quotient of a polynomial functor means that for each α
,
elements of F α
are represented by pairs ⟨a, f⟩
, where a
is the shape of the object and
f
indexes the relevant elements of α
, in a suitably natural manner.
- P : PFunctor.{u}
Instances
two trees are equivalent if their F-abstractions are
- ind: ∀ {F : Type u → Type u} [q : QPF F] (a : (QPF.P F).A) (f f' : (QPF.P F).B a → (QPF.P F).W), (∀ (x : (QPF.P F).B a), QPF.Wequiv (f x) (f' x)) → QPF.Wequiv (WType.mk a f) (WType.mk a f')
- abs: ∀ {F : Type u → Type u} [q : QPF F] (a : (QPF.P F).A) (f : (QPF.P F).B a → (QPF.P F).W) (a' : (QPF.P F).A) (f' : (QPF.P F).B a' → (QPF.P F).W), QPF.abs ⟨a, f⟩ = QPF.abs ⟨a', f'⟩ → QPF.Wequiv (WType.mk a f) (WType.mk a' f')
- trans: ∀ {F : Type u → Type u} [q : QPF F] (u v w : (QPF.P F).W), QPF.Wequiv u v → QPF.Wequiv v w → QPF.Wequiv u w
Instances For
access the underlying W-type of a fixpoint data type
Equations
- QPF.fixToW = Quotient.lift QPF.Wrepr ⋯
Instances For
constructor of a type defined by a qpf
Equations
- QPF.Fix.mk x = Quot.mk (⇑QPF.Wsetoid) (PFunctor.W.mk ((QPF.P F).map QPF.fixToW (QPF.repr x)))
Instances For
destructor of a type defined by a qpf
Equations
- QPF.Fix.dest = QPF.Fix.rec (Functor.map QPF.Fix.mk)
Instances For
does recursion on q.P.M
using g : α → F α
rather than g : α → P α
Equations
- QPF.corecF g = PFunctor.M.corec fun (x : α) => QPF.repr (g x)
Instances For
A pre-congruence on q.P.M
viewed as an F-coalgebra. Not necessarily symmetric.
Equations
Instances For
The maximal congruence on q.P.M
.
Equations
- QPF.Mcongr x y = ∃ (r : (QPF.P F).M → (QPF.P F).M → Prop), QPF.IsPrecongr r ∧ r x y
Instances For
corecursor for type defined by Cofix
Equations
- QPF.Cofix.corec g x = Quot.mk QPF.Mcongr (QPF.corecF g x)
Instances For
Given a qpf F
and a well-behaved surjection FG_abs
from F α
to
functor G α
, G
is a qpf. We can consider G
a quotient on F
where
elements x y : F α
are in the same equivalence class if
FG_abs x = FG_abs y
.
Equations
Instances For
A qpf is said to be uniform if every polynomial functor representing a single value all have the same range.
Equations
Instances For
does abs
preserve Liftp
?
Equations
- QPF.LiftpPreservation = ∀ ⦃α : Type ?u.4⦄ (p : α → Prop) (x : ↑(QPF.P F) α), Functor.Liftp p (QPF.abs x) ↔ Functor.Liftp p x
Instances For
does abs
preserve supp
?
Equations
- QPF.SuppPreservation = ∀ ⦃α : Type ?u.18⦄ (x : ↑(QPF.P F) α), Functor.supp (QPF.abs x) = Functor.supp x