Totalizer Annotated Stack #
This file defines the finite stack annotations and regular lookahead queries used
by the DPDA totalizer once a RegularEpsilonAnalysis has been built.
The vector of DFA transition summaries stored for the stack suffix below a symbol.
- accept (q : Q) : A.AcceptState q → A.AcceptState q
Instances For
AnalysisSummary is just a pair of finite dependent function spaces.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- DPDA.instFintypeAnalysisSummary A = Fintype.ofEquiv (((q : Q) → A.StopState q → A.StopState q) × ((q : Q) → A.AcceptState q → A.AcceptState q)) (DPDA.AnalysisSummary.equivProd A).symm
The empty-suffix summary vector.
Equations
- DPDA.AnalysisSummary.id A = { stop := fun (x : Q) (x_1 : A.StopState x) => x_1, accept := fun (x : Q) (x_1 : A.AcceptState x) => x_1 }
Instances For
A summary vector represents an original stack suffix when every component is the DFA transition function induced by reading that suffix.
Equations
- DPDA.SummaryRepresents A summary γ = ((∀ (q : Q), summary.stop q = (A.stopDFA q).stackSummary γ) ∧ ∀ (q : Q), summary.accept q = (A.acceptDFA q).stackSummary γ)
Instances For
The identity summary represents the empty stack suffix.
Update a summary vector by placing a block of original stack symbols above it.
Equations
- DPDA.AnalysisSummary.above A below γ = { stop := fun (q : Q) => (A.stopDFA q).summaryAbove (below.stop q) γ, accept := fun (q : Q) => (A.acceptDFA q).summaryAbove (below.accept q) γ }
Instances For
Updating a correct summary with a block keeps it correct for the larger suffix.
Placing one top symbol above a represented suffix gives a represented full stack.
Stack symbols of the totalized machine. none is the permanent bottom marker;
some (Z, s) is an original stack symbol annotated with the summary vector of the
original stack suffix below it.
Equations
Instances For
Annotate a replacement block above an already summarized suffix.
Equations
- DPDA.annotateAbove A below [] = []
- DPDA.annotateAbove A below (Z :: γ) = some (Z, DPDA.AnalysisSummary.above A below γ) :: DPDA.annotateAbove A below γ
Instances For
Erase annotations from a totalized stack, dropping the bottom marker.
Equations
- DPDA.eraseAnnotatedStack A [] = []
- DPDA.eraseAnnotatedStack A (none :: γ) = DPDA.eraseAnnotatedStack A γ
- DPDA.eraseAnnotatedStack A (some (Z, snd) :: γ) = Z :: DPDA.eraseAnnotatedStack A γ
Instances For
The annotation invariant for totalizer stacks. Every original stack symbol stores
a summary for the erased suffix below it; none is the unique bottom marker.
Equations
- DPDA.StackWellAnnotated A [] = True
- DPDA.StackWellAnnotated A (none :: γ) = (γ = [])
- DPDA.StackWellAnnotated A (some (Z, snd) :: γ) = (DPDA.SummaryRepresents A snd (DPDA.eraseAnnotatedStack A γ) ∧ DPDA.StackWellAnnotated A γ)
Instances For
Reachable totalizer stacks retain a permanent bottom marker.
Equations
- DPDA.StackHasBottom A [] = False
- DPDA.StackHasBottom A (none :: rest) = (rest = [])
- DPDA.StackHasBottom A (some val :: rest) = DPDA.StackHasBottom A rest
Instances For
Does the semantic epsilon phase terminate from the configuration represented by the current top stack symbol?
Equations
Instances For
If the input is exhausted at the configuration represented by the current top stack symbol, does the original machine accept along its epsilon closure?
Equations
Instances For
The full original-stack summary represented by the current top symbol.
Equations
- DPDA.fullSummaryOfTop A none = DPDA.AnalysisSummary.id A
- DPDA.fullSummaryOfTop A (some (Z, below)) = DPDA.AnalysisSummary.above A below [Z]
Instances For
The stop lookahead evaluated from a full-stack summary.
Equations
Instances For
The epsilon-acceptance lookahead evaluated from a full-stack summary.
Equations
Instances For
Stop-lookahead correctness for a summary representing the current original stack.
Epsilon-acceptance lookahead correctness for a summary representing the current original stack.
Boolean form of acceptsFromSummary, used in the finite control.
Equations
- DPDA.acceptBit A q summary = if DPDA.acceptsFromSummary A q summary then true else false