Rightmost derivations #
This file supplies the structural facts about rightmost derivations which are independent of the LR conflict condition. In particular, an ordinary context-free derivation whose result is a terminal word can always be scheduled rightmost.
Counted rightmost derivations #
A rightmost derivation using exactly n production steps. Unlike
DerivesRightmost, this relation retains the measure needed for well-founded
arguments which trace a surviving nonterminal back through its ancestors.
- refl {T : Type} {G : CF_grammar T} (w : List (symbol T G.nt)) : G.DerivesRightmostIn 0 w w
- tail {T : Type} {G : CF_grammar T} {n : ℕ} {u v w : List (symbol T G.nt)} : G.DerivesRightmostIn n u v → G.ProducesRightmost v w → G.DerivesRightmostIn (n + 1) u w
Instances For
Context closure #
Rightmost derivations of adjacent pieces can be scheduled from right to left. This is the basic commutation principle used below.
Terminal sentential forms #
Splitting rightmost derivations #
A rightmost step in an append either occurs in the right component, or it occurs in the left component after the right component is already terminal.
Trace a nonterminal in the result of one rightmost step. It was either already to the left of the rewritten (rightmost) nonterminal, or it occurs in the right-hand side of the rule used by the step.
A derivation of an append to a terminal word uniquely separates into rightmost derivations of its two components.
Ancestry of a surviving nonterminal #
A nonterminal surviving in a right-sentential form is either the untouched start symbol, or descends from a concrete occurrence in the right-hand side of a rule. The rule's suffix derives exactly the terminal segment immediately following that occurrence; the remaining terminal suffix was already present when the rule was applied.
Counted form of derivesRightmost_nonterminal_ancestry. In the non-base
case the parent prehandle is reached in strictly fewer steps than the displayed
surviving configuration. This strict measure supports terminating reverse
item-closure and ancestry arguments even when the grammar contains cycles.
Equivalence with unrestricted scheduling on terminal results #
Every context-free derivation ending in terminals has a rightmost scheduling.