Tag. finite
Notes (5)
Definition. A Grammar of Finite Cardinals finite-cardinal-grammar
Define a grammar for each finite cardinal .
Then define the grammar of all finite cardinals as
Definition. Finite Unambiguity finite-unambiguity
Define a grammar to be finitely unambiguous if .
There is likely a better name for this.
Finite Unambiguity is Not Equivalent to Unambiguity finite-unambiguity-not-unambiguity
For a while I believed finite unambiguity to be equivalent to the other definitions of unambiguity.
Definition 0.1. Finite Unambiguity finite-unambiguity
Define a grammar to be finitely unambiguous if .
There is likely a better name for this.
Definition 0.2. Unambiguity as Subterminality unambiguity-as-subterminality
A grammar is unambiguous if the unique map into the terminal object is a monomorphism. That is, is a subobject of .
Definition 0.3. Unambiguity as Unique Map into Codomain unambiguity-as-unique-map
A grammar is unambiguous if for all grammars and maps we have .
In a category with terminal objects, this is equivalent to unambiguity defined via subterminality.
Definition 0.3.1. Unambiguity as Subterminality unambiguity-as-subterminality
A grammar is unambiguous if the unique map into the terminal object is a monomorphism. That is, is a subobject of .
We may use an analogy from the category of sets, however I had missed the infinite case when translating this idea to grammars.
It is true that if a grammar is unambiguous, then it is finitely unambiguous. However, the converse does not hold unless the grammar has finitely many parse trees for each string. This finiteness condition is a semantic one. If this proof of unambiguity were to be internalized, then it could maybe be captured through the lens of some grammar of finite cardinals.
Let . is finitely unambiguous but not unambiguous. The isomorphism between and amounts to building a bijection between and , which is straightforward.
What Connectives Preserve Finiteness? finiteness-preserving-connectives
In order to bridge the gap between finite unambiguity and unambiguity, we can try to restrict to grammars that have finitely many parse trees. Weβd expect this to address the concern semantically, as that fixes the problem when the parses are interpreted in .
We can define when a grammar is finite, and then try to prove that finiteness is preserved on some sane operations on grammars. For instance, , , and each preserve finiteness. I havenβt proven this myself (which would be a useful exercise), but the following is substantiated in any topos with a natural numbers object [johnstone-2002].
0.4 Finite Cardinal Arithmetic in a Topos finite-cardinal-arithmetic-topos
In a topos with a natural numbers object , you can define finite cardinals as objects that arise as the pullback along a morphism of the generic finite cardinal. Write for the cardinal corresponding to .
The above characterization is a little obtuse and does warrant some more explanation. One way to make it more concrete is that and , and that finite cardinals warrant a nice induction principle. If is a property expressible in the internal language such that satisfies , and that whenever satisfies then satisfies ; then every finite cardinal satisfies . That is, forms a -closed subobject of and thus is all of .
My working mental model is in a presheaf topos, where the natural numbers object can be defined explicitly as .
Definition 0.4.1. Constant Presheaf constant-presheaf
The constant presheaf of a set on a category is a functor such that
I often call this the discrete presheaf for , but I donβt know if thatβs standard.
The finite cardinals with respect to can be characterized then as,
These obey nice algebraic properties.
The case of is more problematic. Semantically, for all we may bound the size of the set of parse trees
Precisely knowing this bound isnβt too important, but certainly it exists. We could capture this behavior by just adding an axiom that if and are each finite, then is finite. Although, Iβd rather not add an axiom.
We could directly try to prove that preserves finiteness. The statement would follow from showing that preserves monomorphisms. That is, if and , it suffices to show that is a monomorphism. This would imply finiteness, because you may then apply this for and as . However, you would also need to show that is finite, which isnβt immediately clear.
Internal Finiteness internally-finite-grammar
Define a grammar to be finite (or perhaps subfinite) if it is a subobject of grammar of finite cardinals.
Where is defined as follows.
Definition 0.5. A Grammar of Finite Cardinals finite-cardinal-grammar
Define a grammar for each finite cardinal .
Then define the grammar of all finite cardinals as