Langlib

Langlib.Grammars.Indexed.Shrinking.Critical

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.

inductive IndexedGrammar.NFParse.AllBetaIn {T : Type} {g : IndexedGrammar T} (Z : Set (List (g.nt T))) {A : g.nt} {sigma : List g.flag} {w : List T} :
g.NFParse A sigma wProp

Every parse node in p, including its root, has beta word in Z.

Instances For
    def IndexedGrammar.NFParse.IsCritical {T : Type} {g : IndexedGrammar T} (Z : Set (List (g.nt T))) {A : g.nt} {sigma : List g.flag} {w : List T} (p : g.NFParse A sigma w) :

    A node outside Z all of whose proper descendants lie in Z.

    Equations
    Instances For
      theorem IndexedGrammar.NFParse.beta_mem_of_allBetaIn {T : Type} {g : IndexedGrammar T} {Z : Set (List (g.nt T))} {A : g.nt} {sigma : List g.flag} {w : List T} {p : g.NFParse A sigma w} (h : AllBetaIn Z p) :
      p.beta Z
      theorem IndexedGrammar.NFParse.properBetaIn_of_allBetaIn {T : Type} {g : IndexedGrammar T} {Z : Set (List (g.nt T))} {A : g.nt} {sigma : List g.flag} {w : List T} {p : g.NFParse A sigma w} (h : AllBetaIn Z p) :
      structure IndexedGrammar.NFParse.LocatedCritical {T : Type} (g : IndexedGrammar T) (Z : Set (List (g.nt T))) (rootNT : g.nt) (rootStack : List g.flag) (whole : List T) :

      A critical subparse together with its position in the surrounding yield.

      Instances For
        theorem IndexedGrammar.NFParse.exists_locatedCritical_of_not_allBetaIn {T : Type} {g : IndexedGrammar T} (Z : Set (List (g.nt T))) {A : g.nt} {sigma : List g.flag} {w : List T} (p : g.NFParse A sigma w) (hout : ¬AllBetaIn Z p) :
        Nonempty (LocatedCritical g Z A sigma w)

        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 #

        theorem IndexedGrammar.NFParse.scopeAt_succ_length_le_of_allBetaIn {T : Type} {g : IndexedGrammar T} {Z : Set (List (g.nt T))} {C : } (hC : 1 C) (hbound : zZ, z.length C) {A : g.nt} {sigma : List g.flag} {w : List T} {p : g.NFParse A sigma w} (hall : AllBetaIn Z p) (k : ) (hk : k + 1 < sigma.length) :
        (p.scopeAt (k + 1)).length (p.scopeAt k).length * C

        Advancing the cut from one inherited flag occurrence to the next expands the frontier by at most the uniform beta-word bound.

        theorem IndexedGrammar.NFParse.yield_length_le_scopeAt_mul_of_bottom {T : Type} {g : IndexedGrammar T} {Z : Set (List (g.nt T))} {C : } (hC : 1 C) (hbound : zZ, z.length C) {A : g.nt} {sigma : List g.flag} {w : List T} {p : g.NFParse A sigma w} (hall : AllBetaIn Z p) (k : ) (hk : k < sigma.length) (hbottom : List.drop (k + 1) sigma = []) :

        If the cut occurrence is the bottom flag, the terminal yield is at most C times the size of its scope frontier.

        theorem IndexedGrammar.NFParse.beta_length_le_sq_of_critical {T : Type} {g : IndexedGrammar T} {Z : Set (List (g.nt T))} {C : } (hC : 2 C) (hbound : zZ, z.length C) {A : g.nt} {sigma : List g.flag} {w : List T} {p : g.NFParse A sigma w} (hcritical : IsCritical Z p) :

        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.