Tag. well-founded
Notes (12)
Predecessors simplify later predecessors-simplify-later
A predecessor of is a top element of its strict downset: a strict morphism through which every strict morphism into factors uniquely. Equivalently, β the downset is representable.
The Yoneda lemma then collapses later to evaluation:
with becoming restriction along . The name is from the naturals: every strict map into factors through , so on β in the topos of trees β later is just the shift
and a LΓΆb step is a base value together with a rule producing the value at from the value at .
When this predecessor exists, we can give a simpler description of later, as in the topos of trees, but this may not be possible in all direct categories.
Definition. Direct categories direct-category
A well-founded order is a set with a proposition-valued transitive relation admitting no infinite descent: every element is accessible. Write for .
A direct structure on a category over is a functor
into the well-founded order viewed as a poset category. The functor organizes two pieces of data at once: an ordering on the objects, and the invariant that morphisms respect it β forces .
A direct structure equips the objects with a well-founded strict relation
Intuitively, direct categories are the right generalization of well-foundedness to the categorical setting: a direct category is essentially one whose underlying graph is a directed acyclic graph, layered by degree, so that data at an object may be defined by recursion from data at all objects strictly below it.
The degrees order the objects, while the morphisms of say how an object sits over its predecessors.
Definition. Earlier on presheaves earlier-presheaf
Later takes a limit over smaller indices. Dually, the earlier modality takes a colimit over larger indices: an element of at is a -element sitting at some object strictly above , carried down along a chosen morphism .
Earlier is left adjoint to later:
Under this adjunction, corresponds to
.
Definition. Later on families later-family
Conjugation with the adjunction between presheaves and families lets us induce a later construction on families from the one on presheaves,
Concretely, later on families evaluates to
Definition. Later on presheaves later-presheaf
The later modality for presheaves on a direct category is given by the presheaf of natural transformations
out of the strict downset.
An element of at is a coherent choice of -elements at all objects strictly smaller than .
Restriction in along precomposes with the induced map . At an object of minimal degree the strict downset is empty, so is trivial there.
Via functoriality, every presheaf restricts to smaller indices. Thus we may define the map
that sends an element over to the family of all its restrictions along morphisms from strictly lower objects.
Theorem. LΓΆb induction on families lob-family
Like later on families, the recursion principle for families is inherited from that on presheaves. Given a family and a step
the construction is a chain of transpositions with LΓΆb for presheaves used in the middle:
Just as for presheaves, the fixed point constructed above is unique: the two transpositions are bijections, and the presheaf-level fixed point is already unique.
Theorem. LΓΆb induction for presheaves on a direct category lob-presheaf
Let be a direct category and a presheaf on it. Every map
has a fixed point: a global element with
and this fixed point is unique.
The hypothesis says: the value of at any object is determined by its values over the strict past β turns a coherent family over the strict downset of into a value at . The proof is recursion along the well-founded : at each , the section already constructed over the past assembles into an element of , and extends it to .
Definition. Locally contractive endofunctors locally-contractive-functor
Write for the presheaf of morphisms . An endofunctor on presheaves is locally contractive when its action on morphisms factors through later: there is a map
Well-founded posets are thin direct categories well-founded-poset-as-thin
Every poset forms a thin category. Similarly, if the poset is well-founded then it induces a thin direct category.
Definition. Later on Grammars grammar-later
Write when is a proper suffix of , that is, with . The later of a grammar is
A parse of over is a parse of over every proper suffix of . In particular is a singleton.
This is later on families for strings under the proper-suffix order. That order is well-founded because it strictly decreases length, so it is a thin direct category. There is at most one map , so the product over maps from the strict past has one factor per proper suffix. Guarded recursion is modelled by presheaves on , the topos of trees, and more generally by sheaves over a well-founded base [1]. Here the later acts on families, which is what grammars are, and there is no clock.
Later is the right adjoint of the proper-suffix derivative. Let be the grammar of non-empty strings. Then the derivative has the right adjoint
so . Splitting into its summands gives the form of that the calculus can define:
The component at says: if the string begins with , then the rest parses as .
The restriction to non-empty is what makes this a later. At the component is . Including it would give a projection , and LΓΆb would then prove every grammar. For the same reason the later is a product over suffixes. A sum such as is empty at , and at it is . The identity step would then give LΓΆb a proof of .
In the Agda this is β· in Grammar/Later/Base.agda, which is defined as the indexed conjunction of βl-string. The mirror image β·r, over proper prefixes, is defined in the same way. See also the bilateral later and the later along an arbitrary well-founded order.
Theorem. LΓΆb Induction for Grammars grammar-lob
For every grammar and every term , where is the later on grammars, there is a unique global parse with
Here restricts a global parse to every proper suffix.
The proof is recursion on the length of the string. At , the parses already built at the proper suffixes of form an element of , and turns it into a parse at . Uniqueness is LΓΆb for families over the proper-suffix order. In the Agda, lob in Grammar/Later/Base.agda is this recursion, done by well-founded induction on length.
To prove an entailment this way, apply LΓΆb to . The hypothesis is the induction hypothesis at every proper suffix. It becomes usable once a non-nullable grammar has been consumed. If , then
because a parse of over splits with non-empty, so . This is β·-app-NE in Grammar/Later/Properties.agda. Induction on a Kleene star is the standard use.
Definition. Recursive coalgebra recursive-coalgebra
Fix an endofunctor . A coalgebra is recursive when for every algebra there is exactly one hylomorphism from to , that is, exactly one solution of
Equivalently, the functor of the hylomorphism profunctor is constantly a singleton.
Recursiveness is a coalgebraic form of well-foundedness: decomposes each input into subproblems, and recursiveness says that every divide-and-conquer program built on this decomposition has a unique meaning, without mentioning an order on inputs. [1] use recursive coalgebras on categories of indexed families to obtain algorithms that are correct by the type of the map they compute.
Example. If is an initial algebra, then is invertible (Lambekβs lemma) and is a recursive coalgebra. Precomposing with the isomorphism , the equation is equivalent to , which says is an algebra map out of the initial algebra; there is exactly one, .
The dual notion is a corecursive algebra.