Flag scopes in normal-form indexed parse trees #
This file formalizes the scope construction used in Gilman's shrinking lemma.
For one occurrence in the root flag stack, NFParse.scopeAt follows every
branch until that occurrence is consumed. Its ordered frontier consists of
terminals and of the continuation parses immediately below the consuming
pop. Carrying those continuation parses makes both the frontier derivation
and the corresponding factorization of the terminal yield explicit.
Reference #
- R. H. Gilman, "A shrinking lemma for indexed languages", Theoretical Computer Science 163 (1996), 277--281.
One leaf of a flag scope. A pending leaf remembers the complete parse below the pop which consumed the distinguished flag occurrence.
- terminal {T : Type} {g : IndexedGrammar T} {suffix : List g.flag} (a : T) : g.ScopePiece suffix
- pending {T : Type} {g : IndexedGrammar T} {suffix : List g.flag} {A : g.nt} {w : List T} (parse : g.NFParse A suffix w) : g.ScopePiece suffix
Instances For
The terminal factor contributed by one scope-frontier leaf.
Equations
- (IndexedGrammar.ScopePiece.terminal a).word = [a]
- (IndexedGrammar.ScopePiece.pending parse).word = w
Instances For
The unstacked sentential symbol displayed by a scope-frontier leaf.
Equations
Instances For
Interpret a scope piece as an indexed-grammar sentential symbol.
Equations
Instances For
Cut a concrete parse at the first consumption of the root-stack
occurrence numbered k. The remaining stack below that occurrence is
sigma.drop (k + 1), which is exactly the stack carried by pending frontier
leaves.
Equations
- (IndexedGrammar.NFParse.binary hr hlhs hc hrhs left right).scopeAt k = left.scopeAt k ++ right.scopeAt k
- (IndexedGrammar.NFParse.pop hr hlhs hc hrhs rest).scopeAt 0 = [IndexedGrammar.ScopePiece.pending rest]
- (IndexedGrammar.NFParse.pop hr hlhs hc hrhs rest).scopeAt k_2.succ = rest.scopeAt k_2
- (IndexedGrammar.NFParse.push hr hlhs hc hrhs rest).scopeAt k = rest.scopeAt (k + 1)
- (IndexedGrammar.NFParse.terminal hr hlhs hc hrhs).scopeAt k = [IndexedGrammar.ScopePiece.terminal a]
Instances For
Concatenate the terminal factors represented by a scope frontier.
Equations
Instances For
Forget continuation certificates and retain the unstacked frontier word.
Equations
Instances For
Interpret an unstacked frontier word as a sentential form.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Interpret a scope frontier at the concrete suffix carried by its pieces.
Equations
Instances For
Independently finish every pending scope piece.
The concrete parse derives its scope frontier at the suffix below the distinguished occurrence.
Remove the common suffix below a scope. The same rule certificates derive the unstacked frontier from the prefix ending at the distinguished occurrence.
Gilman's beta(p): the full terminal yield at an empty stack, and the
unstacked frontier of the top flag scope at a nonempty stack.
Equations
Instances For
The concrete scope pieces whose symbol word is beta. At an empty
stack the pieces are the individual terminal leaves.
Equations
- p_2.betaPieces = List.map IndexedGrammar.ScopePiece.terminal w
- p_2.betaPieces = p_2.scopeAt 0
Instances For
The one-symbol source from which beta is derived.
Equations
Instances For
Every parse-tree beta word is derivable from its unstacked source.
A derivable unstacked subfrontier can be reattached to the concrete suffix and its surviving pieces can then finish their original parses.