M-types #
M types are potentially infinite tree-like structures. They are defined as the greatest fixpoint of a polynomial functor.
CofixA F n is an n level approximation of an M-type
- continue {F : PFunctor.{uA, uB}} : CofixA F 0
- intro {F : PFunctor.{uA, uB}} {n : β} (a : F.A) : (F.B a β CofixA F n) β CofixA F n.succ
Instances For
default inhabitant of CofixA
Instances For
The label of the root of the tree for a non-trivial approximation of the cofix of a pfunctor.
Instances For
for a non-trivial approximation, return all the subtrees of the root
Instances For
Relation between two approximations of the cofix of a pfunctor that state they both contain the same data until one of them is truncated
- continu {F : PFunctor.{uA, uB}} (x : CofixA F 0) (y : CofixA F 1) : Agree x y
- intro {F : PFunctor.{uA, uB}} {n : β} {a : F.A} (x : F.B a β CofixA F n) (x' : F.B a β CofixA F (n + 1)) : (β (i : F.B a), Agree (x i) (x' i)) β Agree (CofixA.intro a x) (CofixA.intro a x')
Instances For
truncate a turns a into a more limited approximation
Instances For
sCorec f i n creates an approximation of height n
of the final coalgebra of f
Instances For
Path F provides indices to access internal nodes in Corec F
Instances For
Internal definition for M. It is needed to avoid name clashes
between M.mk and M.casesOn and the declarations generated for
the structure
- approx (n : β) : Approx.CofixA F n
An
n-th level approximation, for each depthn - consistent : Approx.AllAgree self.approx
Each approximation agrees with the next
Instances For
For polynomial functor F, M F is its final coalgebra
Instances For
Corecursor for the M-type defined by F.
Instances For
given a tree generated by F, head gives us the first piece of data
it contains
Instances For
return all the subtrees of the root of a tree x : M F
Instances For
select a subtree using an i : F.Idx or return an arbitrary tree if
i designates no subtree of x
Instances For
unfold an M-type
Instances For
generates the approximations needed for M.mk
Instances For
constructor for M-types
Instances For
Agree' n relates two trees of type M F that
are the same up to depth n
- trivial {F : PFunctor.{uA, uB}} (x y : F.M) : Agree' 0 x y
- step {F : PFunctor.{uA, uB}} {n : β} {a : F.A} (x y : F.B a β F.M) {x' y' : F.M} : x' = M.mk β¨a, xβ© β y' = M.mk β¨a, yβ© β (β (i : F.B a), Agree' n (x i) (y i)) β Agree' n.succ x' y'
Instances For
destructor for M-types
Instances For
destructor for M-types
Instances For
destructor for M-types, similar to casesOn but also
gives access directly to the root and subtrees on an M-type
Instances For
IsPath p x tells us if p is a valid path through x
- nil {F : PFunctor.{uA, uB}} (x : F.M) : IsPath [] x
- cons {F : PFunctor.{uA, uB}} (xs : Approx.Path F) {a : F.A} (x : F.M) (f : F.B a β F.M) (i : F.B a) : x = M.mk β¨a, fβ© β IsPath xs (f i) β IsPath (β¨a, iβ© :: xs) x
Instances For
follow a path through a value of M F and return the subtree
found at the end of the path if it is a valid path for that value and
return a default tree
Instances For
similar to isubtree but returns the data at the end of the path instead
of the whole subtree
Instances For
Bisimulation is the standard proof technique for equality between infinite tree-like structures
- head {a a' : F.A} {f : F.B a β F.M} {f' : F.B a' β F.M} : R (M.mk β¨a, fβ©) (M.mk β¨a', f'β©) β a = a'
The head of the trees are equal
- tail {a : F.A} {f f' : F.B a β F.M} : R (M.mk β¨a, fβ©) (M.mk β¨a, f'β©) β β (i : F.B a), R (f i) (f' i)
The tails are equal
Instances For
corecursor for M F with swapped arguments
Instances For
corecursor where the state of the computation can be sent downstream in the form of a recursive call
Instances For
corecursor where it is possible to return a fully formed value at any point of the computation