150 likes | 269 Views
Computer Science 101. More Theory of Computing. Another Example: Odd Parity. A parity bit is added to the right end of a string of bits if it makes the total number of 1’s odd; otherwise, add a 0 100011 -> 100010 -> 000000 ->. Design Strategy. Three states
E N D
Computer Science 101 More Theory of Computing
Another Example: Odd Parity • A parity bit is added to the right end of a string of bits if it makes the total number of 1’s odd; otherwise, add a 0 • 100011 -> • 100010 -> • 000000 ->
Design Strategy • Three states • Even parity: if we read a blank here, we have an even number of 1s, so we write a 1 and goto the halt state • Odd parity: if we read a blank here, we have an odd number of 1s, so we write a 0 and goto the halt state • Halt
Design Strategy • Even parity • We stay here while we keep reading 0s • Otherwise, we goto odd parity • Odd parity • We stay here while we keep reading 0s • Otherwise, we goto even parity
State Diagram for Odd Parity TM Evenparity Odd parity Halt
Tuples for Transitions • The Turing machine program • (1,1,1,2,R) Even parity state reading 1, change state • (1,0,0,1,R) Even parity state reading 0, don’t change state • (2,1,1,1,R) Odd parity state reading 1, change state • (2,0,0,2,R) Odd parity state reading 0, don’t change state • (1,b,1,3,R) End of string in even parity state, write 1 and go to state 3 • (2,b,0,3,R) End of string in odd parity state, write 0 and go to state 3
The Church-Turing Thesis • Church-Turing Thesis • If there exists an algorithm to do a symbol manipulation task, then there exists a Turing machine to do that task • Thesis • Statement advanced for consideration and maintained by argument • Theorem • Ideas that can be proved in a formal, mathematical way
A Universal TM • Represent the algorithm as symbols on the tape • Put the algorithm’s inputs on the tape as well • Run the universal TM to run the algorithm • The universal TM is like a stored program computer (von Neumann machine)
Unsolvable Problems • Problem to investigate Decide, given any collection of Turing machine instructions together with any initial tape contents, whether that Turing machine will ever halt if started on that tape
The Proposed Solution T* = TM being tested t = T’s input P = The testing TM
A Proposed Counterexample T* = TM being tested t = T’s input Q = The testing TM
An Actual Counterexample S* = TM being tested S*bS* = S’s input S = The testing TM
Other Unsolvable Problems • Unsolvable problems, related to the halting problem, have the following consequences • No program can be written to decide whether any given program always stops eventually, no matter what the input • No program can be written to decide whether any two programs are equivalent • No program can be written to decide whether any given program run on any given input will ever produce some specific output