# Theory of Computation CS3102 – Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer.

## Presentation on theme: "Theory of Computation CS3102 – Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer."— Presentation transcript:

Theory of Computation CS3102 – Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer Science University of Virginia

Midterm Grading Don’t panic! We’re generous with extra credit
The class is absolutely curved… usually heavily Curve assessed before extra credit I am open to requests for changing the grading scheme provided: The new scheme is proposed by a student and accompanied by a reasonable fairness argument (Have fun with this! The exercise could be useful in asking for a raise in the future.) The originally posted scheme remains a lower bound on each student’s grade The scheme is approved by class vote.

Closure Properties of Decidable Languages
Exercise: Is this language decidable? 𝐿= if Kentucky wins the tournament otherwise

Closure Properties of Decidable Languages
Theorem: The decidable langs are closed under concatenation. Using a 3-tape machine: Tape 1: save input remember factor attempts Tape 2: tape for Machine 1 Tape 3: tape for Machine 2 a b b a \$ 1 input index a a b b b b a a

Closure Properties of Decidable Languages
Theorem: The decidable langs are closed under concatenation. Using non-determinism: Tape 1: input Tape 2: tape for Machine 1 Tape 3: tape for Machine 2 Copy some characters from the first tape to tape 2 Nondeterminstically decide when to copy the rest onto tape 3 a b b a a b b a

Closure Properties of Decidable Languages
Theorem: The decidable langs are closed under Kleene star. Similar to concatenation, but now we also try all possible numbers of concatenations. Tape 1: a b b a \$ \$ input index Number of concatenations

Closure Properties of Decidable Languages
Theorem: The decidable langs are closed under Kleene star. Similar to concatenation, but now we also try all possible numbers of concatenations. Alternative method using non-determinism: Non-deterministically insert \$’s into the input. The machine must accept each of these substrings. a \$ b b \$ a

Bogus Sentences “In a very real sense, these problems are beyond the theoretical limits of computation.” [referring to problems unsolvable by Turing Machines] Why it’s not bogus: Turing machines have become the definition of computation. “Students commonly ask this question, especially when preparing solutions to exercises and problems…” [the question being about proper level of detail] My inbox last week disagrees

My Bogus Sentence “A turing machine can do everything a real computer can do.” Correctly guessed by Tory Steining. Why it’s bogus: Things “real” computers can do: Stop a door Lodge fish Snuggle Generate Heat

We have shown now: “Can be simulated by” Regular TM 2-dimensional TM

Can one TM simulate every TM?
Can a TM simulate a TM? Yes, obviously. Can one TM simulate every TM?

An every Turing Machine
Input: < Description of some TM M, w > Output: result of running M on w M Universal Turing Machine Output Tape for running TM-M starting on tape w w How do we know these exist?

Examples of Universal Turing Machines

Lego Turing Machines See:

Tinker Toy Computers Plays tic-tac-toe!

Hydraulic Computers Theorem: fluid-based “circuits”
Wire Diode Resistor Capacitor Simple circuit Theorem: fluid-based “circuits” are Turing-complete / universal! Transistor

Universal Turing Machines
People have designed Universal Turing Machines with 4 symbols, 7 states (Marvin Minsky) 4 symbols, 5 states 2 symbols, 22 states 18 symbols, 2 states 2 states, 5 symbols (Stephen Wolfram) November 2007: 2 state, 3 symbols

2-state, 3-symbol Universal TM
Sequence of configurations

Alex Smith, University of Birmingham
Of course, simplicity is in the eye of the beholder. The 2,3 Turing machine described in the dense new 40-page proof “chews up a lot of tape” to perform even a simple job, Smith says. Programming it to calculate 2 + 2, he notes, would take up more memory than any known computer contains. And image processing? “It probably wouldn't finish before the end of the universe,” he says.

Acceptance Problem How can we state this as a language problem?
Input: A Turing Machine M and an input w. Output: Yes/no indicating if M eventually enters qAccept on input w. How can we state this as a language problem?

Acceptance Language Is ATM Turing-recognizable?
ATM = { <M, w> | M is a TM description and M accepts input w } If we can decide if a string is in ATM, then we can solve the Acceptance Problem (as defined on the previous slide). Is ATM Turing-recognizable?

Turing-Recognizable A language L is “Turing-recognizable” if there exists a TM M such that for all strings w: If w  L eventually M enters qaccept If w  L either M enters qreject or M never terminates

Universal Turing Machine Recognizing ATM w
Run a UTM on <M, w> to simulate running M on w. If the UTM accepts, <M, w> is in ATM. M Universal Turing Machine Output Tape for running TM-M starting on tape w w

Recognizability of ATM
Recognizable Languages Decidable Languages Regular Languages CFLs finite Languages Deterministic CFLs ATM Is it inside the Decidable circle?

Undecidability of ATM Proof-by-contradiction. We will show how to construct a TM for which it is impossible to decide ATM. Assume there exists some TM H that decides ATM. Define D (<M>) = Construct a TM that: Outputs the opposite of the result of simulating H on input <M, <M>> If M accepts its own description <M>, D(<M>) rejects. If M rejects its own description <M>, D(<M>) accepts.

Assume there exists some TM H that decides ATM. Define D (<M>) = Construct a TM that: Outputs the opposite of the result of simulating H on input <M, <M>> If M accepts its own description <M>, D(<M>) rejects. If M rejects its own description <M>, D(<M>) accepts. What happens if we run D on its own description, <D>? If D accepts its own description <D>, D(<D>) rejects. If D rejects its own description <D>, D(<D>) accepts. substituting D for M…