Critical scopes in indexed parse trees #
For a finite set Z of small frontier words, a critical parse node is the
last node on some branch whose beta word lies outside Z. Thus its own
frontier is large while every proper descendant has a frontier in Z.
This file locates such a node and proves Gilman's quadratic bound on its
frontier length.
Every parse node in p, including its root, has beta word in Z.
- binary {T : Type} {g : IndexedGrammar T} {Z : Set (List (g.nt ⊕ T))} {A B C : g.nt} {sigma : List g.flag} {u v : List T} {r : IRule T g.nt g.flag} (hr : r ∈ g.rules) (hlhs : r.lhs = A) (hc : r.consume = none) (hrhs : r.rhs = [IRhsSymbol.nonterminal B none, IRhsSymbol.nonterminal C none]) (left : g.NFParse B sigma u) (right : g.NFParse C sigma v) (root : (NFParse.binary hr hlhs hc hrhs left right).beta ∈ Z) (leftAll : AllBetaIn Z left) (rightAll : AllBetaIn Z right) : AllBetaIn Z (NFParse.binary hr hlhs hc hrhs left right)
- pop {T : Type} {g : IndexedGrammar T} {Z : Set (List (g.nt ⊕ T))} {A B : g.nt} {f : g.flag} {suffix : List g.flag} {w : List T} {r : IRule T g.nt g.flag} (hr : r ∈ g.rules) (hlhs : r.lhs = A) (hc : r.consume = some f) (hrhs : r.rhs = [IRhsSymbol.nonterminal B none]) (rest : g.NFParse B suffix w) (root : (NFParse.pop hr hlhs hc hrhs rest).beta ∈ Z) (restAll : AllBetaIn Z rest) : AllBetaIn Z (NFParse.pop hr hlhs hc hrhs rest)
- push {T : Type} {g : IndexedGrammar T} {Z : Set (List (g.nt ⊕ T))} {A B : g.nt} {f : g.flag} {sigma : List g.flag} {w : List T} {r : IRule T g.nt g.flag} (hr : r ∈ g.rules) (hlhs : r.lhs = A) (hc : r.consume = none) (hrhs : r.rhs = [IRhsSymbol.nonterminal B (some f)]) (rest : g.NFParse B (f :: sigma) w) (root : (NFParse.push hr hlhs hc hrhs rest).beta ∈ Z) (restAll : AllBetaIn Z rest) : AllBetaIn Z (NFParse.push hr hlhs hc hrhs rest)
- terminal {T : Type} {g : IndexedGrammar T} {Z : Set (List (g.nt ⊕ T))} {A : g.nt} {sigma : List g.flag} {a : T} {r : IRule T g.nt g.flag} (hr : r ∈ g.rules) (hlhs : r.lhs = A) (hc : r.consume = none) (hrhs : r.rhs = [IRhsSymbol.terminal a]) (root : (NFParse.terminal hr hlhs hc hrhs).beta ∈ Z) : AllBetaIn Z (NFParse.terminal hr hlhs hc hrhs)
Instances For
Every proper descendant of the root of p has beta word in Z.
Equations
- IndexedGrammar.NFParse.ProperBetaIn Z (IndexedGrammar.NFParse.binary hr hlhs hc hrhs left right) = (IndexedGrammar.NFParse.AllBetaIn Z left ∧ IndexedGrammar.NFParse.AllBetaIn Z right)
- IndexedGrammar.NFParse.ProperBetaIn Z (IndexedGrammar.NFParse.pop hr hlhs hc hrhs rest) = IndexedGrammar.NFParse.AllBetaIn Z rest
- IndexedGrammar.NFParse.ProperBetaIn Z (IndexedGrammar.NFParse.push hr hlhs hc hrhs rest) = IndexedGrammar.NFParse.AllBetaIn Z rest
- IndexedGrammar.NFParse.ProperBetaIn Z (IndexedGrammar.NFParse.terminal hr hlhs hc hrhs) = True
Instances For
A node outside Z all of whose proper descendants lie in Z.
Equations
- IndexedGrammar.NFParse.IsCritical Z p = (p.beta ∉ Z ∧ IndexedGrammar.NFParse.ProperBetaIn Z p)
Instances For
A critical subparse together with its position in the surrounding yield.
- leftContext : List T
- factor : List T
- rightContext : List T
- nt : g.nt
- critical : IsCritical Z self.parse
- rebuild {replacement : List T} : g.NFParse self.nt self.stack replacement → g.NFParse rootNT rootStack (self.leftContext ++ replacement ++ self.rightContext)
Instances For
Every parse tree containing a beta word outside Z contains a last such
node, located as a contiguous factor of the original yield.
The quadratic critical-frontier bound #
Advancing the cut from one inherited flag occurrence to the next expands the frontier by at most the uniform beta-word bound.
If the cut occurrence is the bottom flag, the terminal yield is at most
C times the size of its scope frontier.
Gilman's critical-scope estimate: if every proper descendant has beta
length at most C, then the critical beta word has length at most C^2.