Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DescriptionNumber ¶
type DescriptionNumber string
The StandardDescription converted uniquely to a number
type MConfiguration ¶
type MConfiguration struct { // The possible behaviour of the machine at any moment is determined by the m-configuration qn... Name string // ...and the scanned symbol S(r) Symbols []string // In some of the configurations in which the scanned square is blank (i.e. bears no symbol) // the machine writes down a new symbol on the scanned square: in other configurations it // erases the scanned symbol. The machine may also change the square which is being scanned, // but only by shifting it one place to right or left. Operations []string // In addition to any of these operations the m-configuration may be changed. FinalMConfiguration string }
An m-configuration contains four components
type Machine ¶
type Machine struct {
// contains filtered or unexported fields
}
Turing's Machine
func (*Machine) CompleteConfiguration ¶
Returns the machine's Complete Configuration of the single-line form
func (*Machine) MoveN ¶
Moves the machine n times and stops early if halted. Returns the amount of moves the machine took.
func (*Machine) TapeString ¶
Return the Tape represented as a string
func (*Machine) TapeStringFromUniversalMachine ¶
Helper function to isolate the computed sequence between the colons
type MachineInput ¶
type MachineInput struct { // ...which is only capable of a finite number of conditions q1, q2, ..., qR which // will be called "m-configurations". MConfigurations []MConfiguration // The machine is supplied with a "tape" (the analogue of paper) running through it, // and divided into sections (called "squares") each capable of bearing a "symbol". Tape Tape // The m-configuration that the machine should start with. If empty the first m-configuration // in the list is chosen. StartingMConfiguration string // A list of all symbols the machine is capable of reading or printing. // This field is used when dealing with special symbols `*` (Any), `!` (Not) // Note: The ` ` (None) symbol does not have to be provided (it is assumed). PossibleSymbols []string // Defaults to ` ` (None), but can optionally be overridden here. NoneSymbol string // If `true`, the machine's complete configurations are printed at the end of each move. Debug bool }
We may compare a man in the process of computing a real number to a machine...
func NewAbbreviatedTable ¶
func NewAbbreviatedTable(input AbbreviatedTableInput) MachineInput
Gives MachineInput for the abbreviated table. This requires "compiling" the abbreviated table.
func NewMachineFromDescriptionNumber ¶
func NewMachineFromDescriptionNumber(dn DescriptionNumber) (MachineInput, error)
Converts a D.N. to a Machine. Returns an error if the D.N. is not well-defined.
func NewUniversalMachine ¶
func NewUniversalMachine(input UniversalMachineInput) MachineInput
If `M` is a Machine that computes a sequence, this function takes the Standard Description of `M` and returns MachineInput that will print `M`'s sequence using `U` (the Universal Machine).
type StandardDescription ¶
type StandardDescription string
A string representing the full m-configuration list of a Machine
type StandardTable ¶
type StandardTable struct { // The first is input to a machine that has been standardized. MachineInput MachineInput // The second is a mapping from our new symbols to our symbols. // This is not essential but helps with debugging and testing. SymbolMap SymbolMap // Turing's Standard Description (S.D.) StandardDescription StandardDescription // Turing's Description Number (D.N.) DescriptionNumber DescriptionNumber }
Our StandardTable is a wrapper for Turing's standard forms
func NewStandardTable ¶
func NewStandardTable(input MachineInput) StandardTable
Standardizes MachineInput so it conforms to Turing's standard form.
type SymbolMap ¶
A map of new symbols to old symbols, used to verify Tape output
func (SymbolMap) TranslateTape ¶
Translates a tape to the original symbol set.
type Tape ¶
type Tape []string
Our "tape" is a slice of strings because squares can contain multiple characters
type UniversalMachineInput ¶
type UniversalMachineInput struct { StandardDescription SymbolMap }
Input for the UniversalMachine