Langlib

Langlib.Grammars.LR.Equivalence.DPDAToLR.PendingFrontierTrace

Counted traces of pending characteristic frontiers #

A concrete characteristic spine records which grammar symbols have become visible, but ordinary reachability forgets when that happened. This module keeps the two views together. A trace starts with one fixed input word and records, at every spine position, the already completed part and the still unconsumed part of that word.

The visible constructors have their literal operational cost. A read consumes one terminal and appends that terminal to the pending frontier. A splitRight executes the selected positive retained-frame completion of its left single, and appends the single marker only at the return endpoint. start, epsilon, and splitLeft do not change the pending frontier.

The final section packages structural extension of a trace. If such an extension has the same pending frontier at both ends, its read and split-right cases are impossible; the extension is therefore a counted zero-visible tail. This is the ancestry statement needed before comparing independently selected return intervals.

structure DPDA_to_LR.PendingFrontierPosition {Q T S : Type} [Fintype Q] [Fintype T] [Fintype S] (M : DPDA Q T S) :

All indices attached to one point of a pending-frontier execution.

Instances For
    theorem DPDA_to_LR.PendingFrontierPosition.ext {Q T S : Type} {inst✝ : Fintype Q} {inst✝¹ : Fintype T} {inst✝² : Fintype S} {M : DPDA Q T S} {x y : PendingFrontierPosition M} (frontier : x.frontier = y.frontier) (node : x.node = y.node) (suffix : x.suffix = y.suffix) (consumed : x.consumed = y.consumed) (context : x.context = y.context) (remaining : x.remaining = y.remaining) :
    x = y
    theorem DPDA_to_LR.PendingFrontierPosition.ext_iff {Q T S : Type} {inst✝ : Fintype Q} {inst✝¹ : Fintype T} {inst✝² : Fintype S} {M : DPDA Q T S} {x y : PendingFrontierPosition M} :

    The physical PDA configuration represented by a frontier position.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      inductive DPDA_to_LR.PendingFrontierTrace {Q T S : Type} [Fintype Q] [Fintype T] [Fintype S] (M : DPDA Q T S) (word : List T) :

      A normalized spine annotated by an exact counted computation on one fixed whole input word. The word consumed by a completed single is stored on the splitRight constructor, together with its positive retained run.

      Instances For
        theorem DPDA_to_LR.PendingFrontierTrace.word_eq {Q T S : Type} [Fintype Q] [Fintype T] [Fintype S] (M : DPDA Q T S) {word : List T} {position : PendingFrontierPosition M} {steps : } (h : PendingFrontierTrace M word position steps) :
        word = position.consumed ++ position.remaining

        The completion word is always the consumed prefix followed by the input still present at the represented cut.

        theorem DPDA_to_LR.PendingFrontierTrace.concreteOperationalSpine {Q T S : Type} [Fintype Q] [Fintype T] [Fintype S] (M : DPDA Q T S) {word : List T} {position : PendingFrontierPosition M} {steps : } (h : PendingFrontierTrace M word position steps) :
        ConcreteOperationalSpine M position.frontier position.node position.suffix position.consumed position.context

        Forgetting counts and the unconsumed completion suffix recovers the underlying normalized concrete spine.

        theorem DPDA_to_LR.PendingFrontierTrace.reachesIn {Q T S : Type} [Fintype Q] [Fintype T] [Fintype S] (M : DPDA Q T S) {word : List T} {position : PendingFrontierPosition M} {steps : } (h : PendingFrontierTrace M word position steps) :
        PDA.ReachesIn steps { state := (emptyStackPDA M).initial_state, input := word, stack := [(emptyStackPDA M).start_symbol] } (PendingFrontierPosition.cut M position)

        Exact counted operational meaning of an annotated trace.

        theorem DPDA_to_LR.ConcreteOperationalSpine.exists_pendingFrontierTrace {Q T S : Type} [Fintype Q] [Fintype T] [Fintype S] (M : DPDA Q T S) {p : List (symbol T (Nonterminal M))} {A : Nonterminal M} {suffix consumed remaining : List T} {context : List (StackSymbol M)} (h : ConcreteOperationalSpine M p A suffix consumed context) :
        ∃ (steps : ), PendingFrontierTrace M (consumed ++ remaining) { frontier := p, node := A, suffix := suffix, consumed := consumed, context := context, remaining := remaining } steps

        Every normalized concrete spine admits a counted annotation after an arbitrary still-unconsumed suffix is appended to its chosen completion.

        Structural extension and zero-visible ancestry #

        inductive DPDA_to_LR.PendingFrontierExtension {Q T S : Type} [Fintype Q] [Fintype T] [Fintype S] (M : DPDA Q T S) (startPosition : PendingFrontierPosition M) :

        A suffix of an annotated execution. Its step count is relative to the starting position.

        Instances For
          theorem DPDA_to_LR.PendingFrontierExtension.reachesIn {Q T S : Type} [Fintype Q] [Fintype T] [Fintype S] (M : DPDA Q T S) {startPosition endPosition : PendingFrontierPosition M} {steps : } (h : PendingFrontierExtension M startPosition endPosition steps) :

          The counted subrun represented by a structural frontier extension.

          theorem DPDA_to_LR.PendingFrontierTrace.extend {Q T S : Type} [Fintype Q] [Fintype T] [Fintype S] (M : DPDA Q T S) {word : List T} {startPosition endPosition : PendingFrontierPosition M} {startSteps extraSteps : } (htrace : PendingFrontierTrace M word startPosition startSteps) (hextension : PendingFrontierExtension M startPosition endPosition extraSteps) :
          PendingFrontierTrace M word endPosition (startSteps + extraSteps)

          Extending an annotated trace by a structural suffix preserves the fixed whole input word and adds the suffix's exact step count.

          theorem DPDA_to_LR.PendingFrontierExtension.prefix_eq_append {Q T S : Type} [Fintype Q] [Fintype T] [Fintype S] (M : DPDA Q T S) {startPosition endPosition : PendingFrontierPosition M} {steps : } (h : PendingFrontierExtension M startPosition endPosition steps) :
          ∃ (added : List (symbol T (Nonterminal M))), endPosition.frontier = startPosition.frontier ++ added

          The end frontier of an extension is the start frontier followed by the visible events occurring in that extension.

          inductive DPDA_to_LR.ZeroVisibleFrontierExtension {Q T S : Type} [Fintype Q] [Fintype T] [Fintype S] (M : DPDA Q T S) (startPosition : PendingFrontierPosition M) :

          A counted structural suffix containing only start, epsilon, and split-left events.

          Instances For
            theorem DPDA_to_LR.PendingFrontierExtension.zeroVisible_of_prefix_eq {Q T S : Type} [Fintype Q] [Fintype T] [Fintype S] (M : DPDA Q T S) {startPosition endPosition : PendingFrontierPosition M} {steps : } (h : PendingFrontierExtension M startPosition endPosition steps) (hprefix : endPosition.frontier = startPosition.frontier) :
            ZeroVisibleFrontierExtension M startPosition endPosition steps

            Equal pending frontiers force a structural extension to contain no read or completed-single event, even when that single completes on epsilon.

            theorem DPDA_to_LR.ZeroVisibleFrontierExtension.zeroVisibleTail {Q T S : Type} [Fintype Q] [Fintype T] [Fintype S] (M : DPDA Q T S) {startPosition endPosition : PendingFrontierPosition M} {steps : } (h : ZeroVisibleFrontierExtension M startPosition endPosition steps) :
            ZeroVisibleTail M startPosition.frontier startPosition.consumed startPosition.node startPosition.suffix startPosition.context endPosition.node endPosition.suffix endPosition.context

            A counted zero-visible frontier suffix is the existing structural ZeroVisibleTail after forgetting its count and remaining input.

            theorem DPDA_to_LR.ZeroVisibleFrontierExtension.reachesIn {Q T S : Type} [Fintype Q] [Fintype T] [Fintype S] (M : DPDA Q T S) {startPosition endPosition : PendingFrontierPosition M} {steps : } (h : ZeroVisibleFrontierExtension M startPosition endPosition steps) :

            Zero-visible frontier suffixes retain their remaining input and have the exact counted operational meaning advertised by their index.

            theorem DPDA_to_LR.ZeroVisibleFrontierExtension.remaining_eq {Q T S : Type} [Fintype Q] [Fintype T] [Fintype S] (M : DPDA Q T S) {startPosition endPosition : PendingFrontierPosition M} {steps : } (h : ZeroVisibleFrontierExtension M startPosition endPosition steps) :
            endPosition.remaining = startPosition.remaining

            Zero-visible suffixes preserve the unconsumed part of the fixed word.

            theorem DPDA_to_LR.ZeroVisibleFrontierExtension.consumed_eq {Q T S : Type} [Fintype Q] [Fintype T] [Fintype S] (M : DPDA Q T S) {startPosition endPosition : PendingFrontierPosition M} {steps : } (h : ZeroVisibleFrontierExtension M startPosition endPosition steps) :
            endPosition.consumed = startPosition.consumed

            Zero-visible suffixes preserve the completed part of the fixed word.

            theorem DPDA_to_LR.PendingFrontierTrace.extend_same_frontier {Q T S : Type} [Fintype Q] [Fintype T] [Fintype S] (M : DPDA Q T S) {word : List T} {startPosition endPosition : PendingFrontierPosition M} {startSteps extraSteps : } (htrace : PendingFrontierTrace M word startPosition startSteps) (hextension : PendingFrontierExtension M startPosition endPosition extraSteps) (hfrontier : endPosition.frontier = startPosition.frontier) :
            PendingFrontierTrace M word endPosition (startSteps + extraSteps) endPosition.remaining = startPosition.remaining endPosition.consumed = startPosition.consumed ZeroVisibleTail M startPosition.frontier startPosition.consumed startPosition.node startPosition.suffix startPosition.context endPosition.node endPosition.suffix endPosition.context PDA.ReachesIn extraSteps (PendingFrontierPosition.cut M startPosition) (PendingFrontierPosition.cut M endPosition)

            Packaged ancestry consequence for two points of one annotated execution. The endpoint trace has the summed count, and equality of visible frontiers forces the entire extra counted segment to be zero-visible.