LBA → Context-Sensitive Grammar (Myhill's Construction) #
This file constructs a context-sensitive grammar from a nondeterministic linear bounded automaton (LBA), establishing the direction LBA → CSG.
Given an LBA M with tape alphabet Γ, states Λ, and input embedding embed : T ↪ Γ,
we construct a context-sensitive grammar whose language equals the LBA's language.
The nonterminals encode the LBA's computation at each tape cell, simulation rules mirror transitions, and cleanup rules recover terminals upon acceptance.
Simulation rules #
For interior head moves (left/right), the simulation uses a three-step process because CS rules can only rewrite one nonterminal at a time:
Step 1: Remove the head from the current cell, write the new tape symbol, and record the pending state in a
cellPendingnonterminal. The transition check(q', a', d) ∈ M.transition q ais enforced here.Step 2: Place the head on the adjacent cell with the correct state
q'. The state is read from thecellPendingcontext, ensuring correctness.Step 3: Convert the
cellPendingnonterminal back to a normalcellwithq = none.
References #
- Myhill, J. (1960), "Linear bounded automata"
- Hopcroft, Motwani, Ullman, Introduction to Automata Theory, Chapter 9
Nonterminal Type #
Nonterminals for the Myhill construction.
- start {T Γ Λ : Type} : MyhillNT T Γ Λ
- startAux {T Γ Λ : Type} : MyhillNT T Γ Λ
- cell {T Γ Λ : Type} (lb rb : Bool) (q : Option Λ) (a : Γ) (t : T) : MyhillNT T Γ Λ
- cellPending {T Γ Λ : Type} (lb rb dir : Bool) (q' : Λ) (a : Γ) (t : T) : MyhillNT T Γ Λ
Instances For
Equations
- One or more equations did not get rendered due to their size.
- MyhillConstruction.instDecidableEqMyhillNT.decEq MyhillConstruction.MyhillNT.start MyhillConstruction.MyhillNT.start = isTrue ⋯
- MyhillConstruction.instDecidableEqMyhillNT.decEq MyhillConstruction.MyhillNT.start MyhillConstruction.MyhillNT.startAux = isFalse ⋯
- MyhillConstruction.instDecidableEqMyhillNT.decEq MyhillConstruction.MyhillNT.start (MyhillConstruction.MyhillNT.cell lb rb q a t) = isFalse ⋯
- MyhillConstruction.instDecidableEqMyhillNT.decEq MyhillConstruction.MyhillNT.start (MyhillConstruction.MyhillNT.cellPending lb rb dir q' a t) = isFalse ⋯
- MyhillConstruction.instDecidableEqMyhillNT.decEq MyhillConstruction.MyhillNT.startAux MyhillConstruction.MyhillNT.start = isFalse ⋯
- MyhillConstruction.instDecidableEqMyhillNT.decEq MyhillConstruction.MyhillNT.startAux MyhillConstruction.MyhillNT.startAux = isTrue ⋯
- MyhillConstruction.instDecidableEqMyhillNT.decEq MyhillConstruction.MyhillNT.startAux (MyhillConstruction.MyhillNT.cell lb rb q a t) = isFalse ⋯
- MyhillConstruction.instDecidableEqMyhillNT.decEq MyhillConstruction.MyhillNT.startAux (MyhillConstruction.MyhillNT.cellPending lb rb dir q' a t) = isFalse ⋯
- MyhillConstruction.instDecidableEqMyhillNT.decEq (MyhillConstruction.MyhillNT.cell lb rb q a t) MyhillConstruction.MyhillNT.start = isFalse ⋯
- MyhillConstruction.instDecidableEqMyhillNT.decEq (MyhillConstruction.MyhillNT.cell lb rb q a t) MyhillConstruction.MyhillNT.startAux = isFalse ⋯
- MyhillConstruction.instDecidableEqMyhillNT.decEq (MyhillConstruction.MyhillNT.cell lb rb q a t) (MyhillConstruction.MyhillNT.cellPending lb_1 rb_1 dir q' a_1 t_1) = isFalse ⋯
- MyhillConstruction.instDecidableEqMyhillNT.decEq (MyhillConstruction.MyhillNT.cellPending lb rb dir q' a t) MyhillConstruction.MyhillNT.start = isFalse ⋯
- MyhillConstruction.instDecidableEqMyhillNT.decEq (MyhillConstruction.MyhillNT.cellPending lb rb dir q' a t) MyhillConstruction.MyhillNT.startAux = isFalse ⋯
- MyhillConstruction.instDecidableEqMyhillNT.decEq (MyhillConstruction.MyhillNT.cellPending lb rb dir q' a t) (MyhillConstruction.MyhillNT.cell lb_1 rb_1 q a_1 t_1) = isFalse ⋯
Instances For
Abbreviation for a cell nonterminal as a grammar symbol.
Equations
- MyhillConstruction.cellSym lb rb q a t = symbol.nonterminal (MyhillConstruction.MyhillNT.cell lb rb q a t)
Instances For
Abbreviation for a cellPending nonterminal as a grammar symbol. The dir flag records the
move direction (true = right move, false = left move) so that only the matching step2
rule can consume the pending — without it, an interior pending (false, false) would be
accepted by both step2 rules, letting a right move's state land on the wrong (left) neighbour.
Equations
- MyhillConstruction.cellPendingSym lb rb dir q' a t = symbol.nonterminal (MyhillConstruction.MyhillNT.cellPending lb rb dir q' a t)
Instances For
All grammar rules for the Myhill construction, organized by phase.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Every rule in the Myhill construction has non-empty output string.
The Myhill context-sensitive grammar recognizing the LBA's language.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Rightmost initial cell (laid first, with startAux on its left).
A middle initial cell, inserted just to the right of startAux.
Leftmost initial cell carrying the start state (laid last, removing startAux).