#include <turing_machine.hpp>
Collaboration diagram for turing_machine< T >:
Public Types | |
typedef std::vector< state< T > >::size_type | transition_index_type |
typedef infinite_tape< T >::direction | move_type |
typedef state< T >::transition_result | result_type |
typedef unsigned long int | transition_count_type |
Public Member Functions | |
turing_machine (const turing_machine< T > &rhs) | |
copies a turing machine. | |
turing_machine (T default_tape_value) | |
default-most constructor. | |
turing_machine (transition_index_type N, T default_tape_value) | |
creates an N-state stturing_machine whose tape has a given T as its default value | |
turing_machine (const infinite_tape< T > &new_tape) | |
creates a machine with an empty set of states and the given tape. | |
~turing_machine () | |
trivial destructor | |
transition_index_type | add_state () |
adds an additional state to the transition function. | |
bool | set_halt_state (transition_index_type new_halt_state) |
set the halt state. | |
bool | add_transition (transition_index_type start_state, T read, T write, move_type move, transition_index_type end_state) |
adds a full transition. | |
bool | add_write_transition (transition_index_type start_state, T read, T write, transition_index_type end_state) |
adds a 4-tuple write-only transition | |
bool | add_move_transition (transition_index_type start_state, T read, move_type move, transition_index_type end_state) |
adds a 4-tuple move-only transition | |
bool | bounds_check (transition_index_type to_check) |
returns whether to_check refers to an existing state in the FA or not | |
result_type | run_one () |
run one step and return whether the machine is running or has halted | |
transition_index_type | count_occurrences (T to_count) const |
count occurrences of to_count on the tape ... | |
const infinite_tape< T > & | access_tape () const |
provides fairly low-overhead read-only access to the infinite_tape. | |
infinite_tape< T > & | access_tape_read_write () |
provides read-write access to the tape. | |
bool | in_standard_position () const |
determine if the tape is in standard position or not. | |
bool | blank_tape () const |
determine if the tape is blank or not. | |
transition_index_type | count_states () const |
provide access to certain information about the FA. | |
transition_index_type | get_current_state () const |
returns the number of the FA's current state | |
result_type | get_status () const |
whether or not the machine is running. | |
transition_count_type | get_steps_count () const |
returns how many times the transition function has been called. | |
bool | in_halt_state () const |
returns if the machine is in the halt state | |
long_int | number_represented () const |
number of equivalent machines that this machine represents | |
long_int | number_represented_explicit () const |
number of equivalent machines that this machine represents | |
void | print (std::ostream &out) const |
prints the turing machine in a rather messy (but correct and informative) form. | |
bool | is_tn_possible () const |
is it possible to tree-normalise this machine? | |
template<typename OutputIterator> void | generate_tn_quadruple_children (const std::list< T > &alphabet, OutputIterator destination) const |
creates children in the tree for quadruple implicit halt | |
template<typename OutputIterator> void | generate_tn_quadruple_children_explicit (const std::list< T > &alphabet, OutputIterator destination) const |
creates children in the tree for quadruple explicit halt | |
template<typename OutputIterator> void | generate_all_tn_quadruple_children (const std::list< T > &alphabet, OutputIterator destination) const |
creates all children (implicit and explicit) in the tree for the quadruple formulation. | |
bool | resetMachine () |
resets the machine to a blank tape and current state to starting state | |
turing_machine< T > | reverseMachine () |
get the mirror machine of *this. | |
void | rigMachine (typename std::vector< T > &riggedTape, int originalReadHead, int desiredReadHead, typename std::vector< state< T > >::size_type state, typename std::list< T >::iterator &leftBound, typename std::list< T >::iterator &rightBound, typename std::list< T >::iterator &desiredLocation) |
Rig the machine to a specified set of conditions Used for testing non-halt transformations, sets a portion of the tape equal to the elements in riggedTape; the read head is updated to the corresponding location of originalReadHead on the riggedTape; the desiredReadHead is used to set the desiredLocation iterator which is the hopeful location of the read head on the tape after the non-halt transformation is performed. | |
std::vector< state< T > > & | stateSet () |
accessor to the states. | |
transition_index_type | haltState () |
accessor to the halt_state | |
move_type | nextMove () |
simulates the next move on the tape without actually running the tape. | |
void | printTMO (std::ostream &out) const |
prints the turing machine in tmo (Turing Machine Owen) format. | |
bool | implicitMachine () const |
Returns whether this machine is an implicit halt machine. | |
Static Public Attributes | |
const move_type | left = infinite_tape<T>::left |
const move_type | right = infinite_tape<T>::right |
const move_type | do_nothing = infinite_tape<T>::do_nothing |
const move_type | halt_move = infinite_tape<T>::halt_move |
const result_type | run = state<T>::run |
const result_type | halt = state<T>::halt |
Protected Attributes | |
bool | halt_state_exists |
transition_index_type | current |
transition_index_type | halt_state |
transition_index_type | first_unreachable_state |
std::vector< state< T > > | transition_function |
infinite_tape< T > | tape |
transition_count_type | steps |
result_type | run_status |
Private Member Functions | |
template<typename OutputIterator> void | output_machine (turing_machine< T > &to_output, OutputIterator destination) const |
template<typename OutputIterator> void | output_machine (turing_machine< T > &to_output, OutputIterator destination, const std::list< T > &alphabet) const |
bool | run_checks (const turing_machine< T > &to_check, const std::list< T > &alphabet) const |
run normalization checks |
Definition at line 112 of file turing_machine.hpp.
|
copies a turing machine.
Definition at line 133 of file turing_machine.hpp. |
|
default-most constructor. creates a turing machine from T representing default tape value
Definition at line 148 of file turing_machine.hpp. |
|
creates an N-state stturing_machine whose tape has a given T as its default value
Definition at line 164 of file turing_machine.hpp. |
|
creates a machine with an empty set of states and the given tape.
Definition at line 179 of file turing_machine.hpp. |
|
trivial destructor
Definition at line 191 of file turing_machine.hpp. |
|
provides fairly low-overhead read-only access to the infinite_tape.
Definition at line 363 of file turing_machine.hpp. Referenced by simpleLoopCheck(). |
|
provides read-write access to the tape. hmmm, I can't really justify this function except that it's sometimes useful to mangle the contents of the tape ... it's a gross violation of encapsulation, so it should be used *very* carefully used carefully by Owen in non-halt routines :)
Definition at line 375 of file turing_machine.hpp. Referenced by checkCounterConversion(), checkCounterRun(), checkLeaningChristmasTree(), checkLeaningChristmasTreeGrammar(), checkMultiSweepChristmasTree(), checkMultiSweepFirstPass(), checkMultiSweepSecondPass(), establishSweep(), getNextBlankLocation(), getNextChunk(), getNextChunkUnevenCheck(), getNextLeaningRightBound(), getNextRightBound(), simpleLoopCheck(), and testCounter(). |
|
adds a 4-tuple move-only transition
Definition at line 306 of file turing_machine.hpp. References turing_machine< T >::add_transition(). Referenced by turing_machine< T >::generate_all_tn_quadruple_children(), turing_machine< T >::generate_tn_quadruple_children(), turing_machine< T >::generate_tn_quadruple_children_explicit(), and turing_machine< T >::reverseMachine(). |
|
adds an additional state to the transition function.
Definition at line 205 of file turing_machine.hpp. |
|
adds a full transition.
Definition at line 258 of file turing_machine.hpp. References turing_machine< T >::bounds_check(). Referenced by turing_machine< T >::add_move_transition(), and turing_machine< T >::add_write_transition(). |
|
adds a 4-tuple write-only transition
Definition at line 291 of file turing_machine.hpp. References turing_machine< T >::add_transition(). Referenced by turing_machine< T >::generate_all_tn_quadruple_children(), turing_machine< T >::generate_tn_quadruple_children(), turing_machine< T >::generate_tn_quadruple_children_explicit(), and turing_machine< T >::reverseMachine(). |
|
determine if the tape is blank or not.
Definition at line 399 of file turing_machine.hpp. Referenced by simpleLoopCheck(). |
|
returns whether to_check refers to an existing state in the FA or not
Definition at line 318 of file turing_machine.hpp. Referenced by turing_machine< T >::add_transition(), and turing_machine< T >::set_halt_state(). |
|
count occurrences of to_count on the tape ... e.g. to find productivity.
Definition at line 353 of file turing_machine.hpp. |
|
provide access to certain information about the FA.
Definition at line 409 of file turing_machine.hpp. Referenced by turing_machine< T >::number_represented(), and turing_machine< T >::number_represented_explicit(). |
|
creates all children (implicit and explicit) in the tree for the quadruple formulation.
Definition at line 763 of file turing_machine.hpp. References turing_machine< T >::add_move_transition(), turing_machine< T >::add_write_transition(), turing_machine< T >::number_represented(), and turing_machine< T >::number_represented_explicit(). |
|
creates children in the tree for quadruple implicit halt
Definition at line 566 of file turing_machine.hpp. References turing_machine< T >::add_move_transition(), turing_machine< T >::add_write_transition(), and turing_machine< T >::number_represented(). |
|
creates children in the tree for quadruple explicit halt
Definition at line 661 of file turing_machine.hpp. References turing_machine< T >::add_move_transition(), and turing_machine< T >::add_write_transition(). |
|
returns the number of the FA's current state
Definition at line 419 of file turing_machine.hpp. Referenced by checkCounterConversion(), checkCounterRun(), checkLeaningChristmasTree(), checkLeaningChristmasTreeGrammar(), checkMultiSweepChristmasTree(), checkMultiSweepFirstPass(), checkMultiSweepSecondPass(), simpleLoopCheck(), and testCounter(). |
|
whether or not the machine is running.
Definition at line 430 of file turing_machine.hpp. |
|
returns how many times the transition function has been called.
Definition at line 440 of file turing_machine.hpp. |
|
accessor to the halt_state
Definition at line 986 of file turing_machine.hpp. Referenced by backTrack(), and loopStates(). |
|
Returns whether this machine is an implicit halt machine.
Definition at line 1110 of file turing_machine.hpp. Referenced by turing_machine< T >::printTMO(), and turing_machine< T >::run_checks(). |
|
returns if the machine is in the halt state
Definition at line 450 of file turing_machine.hpp. |
|
determine if the tape is in standard position or not. standard position is defined as: the read head is on either the leftmost or rightmost symbol ... may also be accomplished (by user) in the following way: turing_machine<T> x; x.access_tape.in_standard_position();
Definition at line 389 of file turing_machine.hpp. |
|
is it possible to tree-normalise this machine?
Definition at line 546 of file turing_machine.hpp. |
|
simulates the next move on the tape without actually running the tape.
Definition at line 998 of file turing_machine.hpp. Referenced by checkCounterConversion(), checkCounterRun(), checkLeaningChristmasTree(), checkMultiSweepChristmasTree(), establishSweep(), getNextBlankLocation(), getNextChunk(), getNextChunkUnevenCheck(), getNextLeaningRightBound(), getNextRightBound(), and testCounter(). |
|
number of equivalent machines that this machine represents
Definition at line 460 of file turing_machine.hpp. References turing_machine< T >::count_states(). Referenced by turing_machine< T >::generate_all_tn_quadruple_children(), turing_machine< T >::generate_tn_quadruple_children(), turing_machine< T >::printTMO(), and turing_machine< T >::run_checks(). |
|
number of equivalent machines that this machine represents
Definition at line 487 of file turing_machine.hpp. References turing_machine< T >::count_states(). Referenced by turing_machine< T >::generate_all_tn_quadruple_children(), and turing_machine< T >::run_checks(). |
|
prints the turing machine in a rather messy (but correct and informative) form.
Definition at line 517 of file turing_machine.hpp. |
|
prints the turing machine in tmo (Turing Machine Owen) format. parsable by Owen's TM Simulator and also in valid dot format for creating visual graphs
Definition at line 1014 of file turing_machine.hpp. References turing_machine< T >::implicitMachine(), and turing_machine< T >::number_represented(). |
|
resets the machine to a blank tape and current state to starting state
Definition at line 869 of file turing_machine.hpp. Referenced by checkCounterRun(), checkLeaningChristmasTree(), checkLeaningChristmasTreeGrammar(), checkMultiSweepChristmasTree(), checkMultiSweepChristmasTreeGrammar(), turing_machine< T >::rigMachine(), simpleLoopCheck(), and testCounter(). |
|
get the mirror machine of *this.
Definition at line 885 of file turing_machine.hpp. References turing_machine< T >::add_move_transition(), and turing_machine< T >::add_write_transition(). Referenced by counter(), leaningChristmasTree(), and multiSweepChristmasTree(). |
|
Rig the machine to a specified set of conditions Used for testing non-halt transformations, sets a portion of the tape equal to the elements in riggedTape; the read head is updated to the corresponding location of originalReadHead on the riggedTape; the desiredReadHead is used to set the desiredLocation iterator which is the hopeful location of the read head on the tape after the non-halt transformation is performed.
Definition at line 940 of file turing_machine.hpp. References turing_machine< T >::resetMachine(). Referenced by checkCounterConversion(). |
|
run normalization checks
Definition at line 1169 of file turing_machine.hpp. References turing_machine< T >::current, turing_machine< T >::first_unreachable_state, turing_machine< T >::halt_state, turing_machine< T >::implicitMachine(), turing_machine< T >::number_represented(), turing_machine< T >::number_represented_explicit(), turing_machine< T >::tape, and turing_machine< T >::transition_function. |
|
run one step and return whether the machine is running or has halted
Definition at line 330 of file turing_machine.hpp. Referenced by checkCounterConversion(), checkCounterRun(), checkLeaningChristmasTree(), checkLeaningChristmasTreeGrammar(), checkMultiSweepChristmasTree(), checkMultiSweepFirstPass(), establishSweep(), getNextBlankLocation(), getNextChunk(), getNextChunkUnevenCheck(), getNextLeaningRightBound(), getNextRightBound(), simpleLoopCheck(), and testCounter(). |
|
set the halt state.
Definition at line 217 of file turing_machine.hpp. References turing_machine< T >::bounds_check(). |
|
accessor to the states.
Definition at line 976 of file turing_machine.hpp. Referenced by backTrack(), and loopStates(). |