Nondeterministic Two-Way Automaton #
A Nondeterministic Two-Way Automaton (TwoWayNA) reads a finite input word on a tape and may move
its input head in either direction. A transition reads the symbol under the head and, besides
changing the state, moves the head one cell to the left, keeps it in place, or moves it one cell to
the right.
The input head cannot leave the input word to the left (in the sense that execution gets stuck in this case) and once it leaves the word to the right, it stops. A run is accepting if and only if it ends in an accepting state with the head just past the end of the input.
Main definitions #
TwoWayNA, the automaton itselfTwoWayNACfg, a configuration of aTwoWayNA: Its input plus a state and the head position.TwoWayNA.toCfgNA, the finite acceptor on configurations whose runs on a fixed input are the runs of the two-way automaton on that input. It also provides theAcceptorinstance.
Implementation notes #
The definition of TwoWayNA is kept close to Vardi's, because the main point is to
prove that it accepts the same languages as NA.FinAcc via his proof. This means we do not allow
the head to move off the input to the left (in the sense that if the transition relation has an
entry that would cause that, there is no successor configuration, the computation is stuck), but
also do not provide an end marker. Once the head moves off to the right, the machine instantly
stops, so it also cannot move back into the word.
References #
A nondeterministic two-way automaton: a transition relation that reads an input symbol and moves the input head, together with a set of initial and a set of accepting states.
The transition relation.
Tr q x m q'means that, while reading the symbolx, the automaton attempts to transition from stateqto stateq'and move its head according tom.- start : Set State
The set of initial states of the automaton.
- accept : Set State
The set of accepting states of the automaton.
Instances For
The configuration of a two-way nondeterministic automaton.
- input : List Symbol
The original input to the automaton.
- state : State
The state of the automaton.
The input head position of the automaton: it can be on any symbol of the input or on the position one step to the right of the input.
Instances For
This defines the set of initial configurations on a specific input.
Equations
Instances For
If a configuration is a accepting.
Equations
Instances For
Returns a nondeterministic finite acceptor on the configurations as states, accepting exactly
the runs of the two-way automaton on input that end in an accepting configuration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A step reads the symbol at the head position, which therefore lies inside the input.