Computing Functions with Turing Machines
410 likes | 504 Vues
Learn about computable functions, domains, parameters, and Turing Machines. Explore examples using unary representation and pseudocode. Discuss the power of Turing Machines in computer science.
Computing Functions with Turing Machines
E N D
Presentation Transcript
A function has: Domain: Result Region:
A function may have many parameters: Example: Addition function
We prefer unary representation: easier to manipulate Integer Domain Decimal: 5 Binary: 101 Unary: 11111
Definition: A function is computable if there is a Turing Machine such that: Initial configuration Final configuration initial state final state For all Domain
In other words: A function is computable if there is a Turing Machine such that: Initial Configuration Final Configuration For all Domain
Example is computable The function are integers Turing Machine: Input string: unary Output string: unary
Start initial state Finish final state
Execution Example: Time 0 (2) (2) Final Result
Time 12 HALT & accept
Another Example is computable The function is integer Turing Machine: Input string: unary Output string: unary
Start initial state Finish final state
Turing Machine Pseudocode for • Replace every 1 with $ • Repeat: • Find rightmost $, replace it with 1 • Go to right end, insert 1 Until no more $ remain
Example Start Finish
Another Example if The function if is computable
Turing Machine for if if Input: or Output:
Turing Machine Pseudocode: • Repeat Match a 1 from with a 1 from Until all of or is matched • If a 1 from is not matched • erase tape, write 1 • else • erase tape, write 0
Block Diagram Turing Machine input output
Example: if if Adder Comparer Eraser
Question: Do Turing machines have the same power with a digital computer? Intuitive answer: Yes There is no formal answer!!!
Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
Computer Science Law: A computation is mechanical if and only if it can be performed by a Turing Machine There is no known model of computation more powerful than Turing Machines
Definition of Algorithm: An algorithm for function is a Turing Machine which computes
Algorithms are Turing Machines When we say: There exists an algorithm We mean: There exists a Turing Machine