Theoretical Foundations of Computer Science -...
-
Upload
nguyencong -
Category
Documents
-
view
229 -
download
1
Transcript of Theoretical Foundations of Computer Science -...
![Page 1: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/1.jpg)
Theoretical Foundations ofComputer Science
August 9, 2017
![Page 2: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/2.jpg)
“Computer Science is no more about computersthan astronomy is about telescopes.”
Motivational Quote of the Day
- Edsger Dijkstra
- Michael Fellows
![Page 3: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/3.jpg)
PART 1:What is (theoretical) computer science?
How was it born?
PART 2:Uncomputable problems
![Page 4: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/4.jpg)
PART 1:What is computer science?
How was it born?
![Page 5: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/5.jpg)
What is computer science?
“Writing (Python) programs that do certain tasks.”
Is it:
What is theoretical computer science?
![Page 6: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/6.jpg)
What is computer science?
Is it branch of:
- science?- engineering?- math?- philosophy?- sports?
![Page 7: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/7.jpg)
Physics
Theoretical physics
Experimental physics
Applications/Engineering
- come up with mathematical models
- derive the logical consequences
- test mathematical models with experiments
- make observations about the universe
Nature’s language is mathematics
![Page 8: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/8.jpg)
The role of theoretical physics
ObservedPhenomenon
MathematicalModel
ExploreConsequences
TestConsequences
Real World Abstract World
Applications
![Page 9: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/9.jpg)
Theoretical Physics
- science?- engineering?- math?- philosophy?- sports?
![Page 10: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/10.jpg)
Computer Science
The science that studies computation.
Computation: manipulation of information/data.
Algorithm: rigorous description of how the data is manipulated.
Input Output“Computer”
![Page 11: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/11.jpg)
Computer Science
The science that studies computation.
Computation: manipulation of information/data.
Input OutputCalculator
Algorithm: rigorous description of how the data is manipulated.
![Page 12: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/12.jpg)
Computer Science
The science that studies computation.
Computation: manipulation of information/data.
Input OutputLaptop
Algorithm: rigorous description of how the data is manipulated.
![Page 13: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/13.jpg)
Computer Science
The science that studies computation.
Computation: manipulation of information/data.
Input OutputHuman
Algorithm: rigorous description of how the data is manipulated.
![Page 14: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/14.jpg)
Computer Science
The science that studies computation.
Computation: manipulation of information/data.
Input OutputEvolution
Algorithm: rigorous description of how the data is manipulated.
![Page 15: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/15.jpg)
The computational lens
Computational biology
Computational physics
Computational chemistry
Computational neuroscience
Computational economics
…
Computational finance
Computational linguistics
Computational statistics
![Page 16: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/16.jpg)
The role of theoretical computer science
Build a mathematical model for computation.
Explore the logical consequences.Gain insight about computation.
Look for interesting applications.
CMU undergrad CMU Prof. OK, we don’t haveeverybody
http://youtu.be/pTeZP-XfuKI
https://goo.gl/gGkpMv
http://youtu.be/J4TkHuTmHsg
![Page 17: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/17.jpg)
The role of theoretical computer science
Computation MathematicalModel
ExploreConsequences
Real World Abstract World
Applications
Only done recently
![Page 18: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/18.jpg)
Simple examples of computation
Doing computation by following a simple algorithm.
![Page 19: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/19.jpg)
Simple examples of computation
Euclid’s algorithm (~ 300BC):
def gcd(a, b):
while (b != 0):
t = bb = a % ba = t
return a
We have been using algorithms for thousands of years.
![Page 20: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/20.jpg)
Formalizing computation
We have been using algorithms for thousands of years.
Algorithm/Computation was only formalized in the 20th century!
Someone had to ask the right question.
![Page 21: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/21.jpg)
David Hilbert, 1900
The Problems of Mathematics“Who among us would not be happy to lift the veil behind which is hidden the future; to gaze at the coming developments of our science and at the secrets of its development in the centuries to come? What will be the ends toward which the spirit of future generations of mathematicians will tend? What methods, what new facts will the new century reveal in the vast and rich field of mathematical thought?”
![Page 22: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/22.jpg)
2 of Hilbert’s Problems
Is there a finitary procedure to determine if a given multivariate polynomial with integral coefficients has an integral solution?
Entscheidungsproblem (1928)Is there a finitary procedure to determine the validity of a given logical expression?
(Mechanization of mathematics)
¬9x, y, z, n 2 N : (n � 3) ^ (xn + y
n = z
n)e.g.
Hilbert’s 10th problem (1900)
e.g. 5x2yz
3 + 2xy + y � 99xyz4 = 0
![Page 23: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/23.jpg)
2 of Hilbert’s Problems
Fortunately, the answer turned out to be NO.
![Page 24: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/24.jpg)
2 of Hilbert’s Problems
Meanwhile… in New Jersey… a certain British grad student,unaware of all these debates…
Gödel (1934):Discusses some ideas for mathematical definitions of computation. But not confident what is a good definition.
Church (1936):Invents lambda calculus. Claims it should be the definition of an “algorithm”.
Gödel, Post (1936):Arguments that Church’s claim is not justified.
![Page 25: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/25.jpg)
2 of Hilbert’s Problems
Alan Turing (1936, age 22):Describes a new model for computation,now known as the Turing Machine.™
Gödel, Kleene, and even Church:“Umm. Yeah. He nailed it. Game over. “Algorithm” defined.”
Turing (1937):TMs lambda calculus
![Page 26: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/26.jpg)
Formalization of computation: Turing Machine
Turing Machine:
![Page 27: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/27.jpg)
Church-Turing Thesis
Church-Turing Thesis:The intuitive notion of “computable” is captured by functions computable by a Turing Machine.
Any computational problem that can be solved by a physical device, can be solved by a Turing Machine.
(Physical) Church-Turing Thesis
Real World Abstract WorldChurch-Turing Thesis
![Page 28: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/28.jpg)
Back to 2 of Hilbert’s Problems
Is there an algorithm (a TM) to determine if a given multivariate polynomial with integral coefficients has an integral solution?
Entscheidungsproblem (1928)Is there an algorithm (a TM) to determine the validity of a given logical expression?
(Mechanization of mathematics)
¬9x, y, z, n 2 N : (n � 3) ^ (xn + y
n = z
n)e.g.
Hilbert’s 10th problem (1900)
e.g. 5x2yz
3 + 2xy + y � 99xyz4 = 0
![Page 29: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/29.jpg)
Back to 2 of Hilbert’s Problems
Entscheidungsproblem (1928)
Hilbert’s 10th problem (1900)
There is no algorithm to solve this problem.
Matiyasevich-Robinson-Davis-Putnam (1970):
There is no algorithm to solve this problem.Turing (1936):
![Page 30: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/30.jpg)
Computer Science
- science?- engineering?- math?- philosophy?- sports?
![Page 31: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/31.jpg)
2 Main Questions in TCS
Computability of a problem:
Is there an algorithm to solve it?
Complexity of a problem:
Is there an efficient algorithm to solve it?
- time- space (memory)- randomness- quantum resources
![Page 32: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/32.jpg)
Computational Complexity
Complexity of a problem:
Is there an efficient algorithm to solve it?
- time- space (memory)- randomness- quantum resources
2 camps:- trying to come up with efficient algorithms (algorithm designers)
- trying to show no efficient algorithm exists (complexity theorists)
![Page 33: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/33.jpg)
Computational Complexity
2 camps:- trying to come up with efficient algorithms (algorithm designers)
- trying to show no efficient algorithm exists (complexity theorists)
multiplying two integers
sorting a listprotein structure prediction
computing Nash Equilibria of gamessimulation of quantum systems
factoring integers
![Page 34: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/34.jpg)
PART 2:Uncomputable problems
![Page 35: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/35.jpg)
Working as a TA for 15-112
We need to write an autograder for
isPrime
isPrime
the correct programstudent submission
isPrime
Do they return True on exactly the same inputs?
![Page 36: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/36.jpg)
Working as a TA for 15-112
We need to write an autograder for
isPrime
returns True on exactly same inputs?
Trueor
False
Kosbie’sversion
Studentsubmission
![Page 37: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/37.jpg)
Working as a TA for 15-112
Write an “autograder”that checks if a given programgoes into an infinite loop.
A “simpler” problem
![Page 38: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/38.jpg)
Working as a TA for 15-112
HaltingProgram
x
Trueor
False
Output: True if the program halts for the given input. False otherwise.
Halting ProblemInputs: A Python program source code. An input to the program. x
Theorem: The halting problem is uncomputable.
![Page 39: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/39.jpg)
“Proof”Assume, for the sake of contradiction, such a program exists:
def halt(program, inputToProgram): # program and inputToProgram are both strings
haltTrue
or
False
program
inputToProgram
![Page 40: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/40.jpg)
“Proof”
def halt(program, inputToProgram): # program and inputToProgram are both strings def turing(program): if (halt(program, program)): while True: pass # i.e. do nothing return False
Assume, for the sake of contradiction, such a program exists:
![Page 41: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/41.jpg)
“Proof”
Halt Loopforever
yesno
input
(input, input)
Does ithalt?
(viewed as the source code of a program)turing
![Page 42: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/42.jpg)
“Proof”
def halt(program, inputToProgram): # program and inputToProgram are both strings def turing(program): if (halt(program, program)): while True: pass # i.e. do nothing return False
What happens when you call turing(turing) ?
Assume, for the sake of contradiction, such a program exists:
![Page 43: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/43.jpg)
“Proof”
Halt Loopforever
yesno
(input, input)
Does ithalt?
![Page 44: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/44.jpg)
“Proof”
def halt(program, inputToProgram): # program and inputToProgram are both strings def turing(program): if (halt(program, program)): while True: pass # i.e. do nothing return False
What happens when you call turing(turing) ?if halt(turing, turing) is True
if halt(turing, turing) is False
----> turing(turing) doesn’t halt
----> turing(turing) halts
Assume, for the sake of contradiction, such a program exists:
![Page 45: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/45.jpg)
“Proof”
def halt(program, inputToProgram): # program and inputToProgram are both strings def turing(program): if (halt(program, program)): while True: pass # i.e. do nothing return False
Assume, for the sake of contradiction, such a program exists:
if halt(turing, turing) is True
if halt(turing, turing) is False
----> turing(turing) doesn’t halt
----> turing(turing) halts
What happens when you call turing(turing) ?
![Page 46: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/46.jpg)
So what?
- Consider the following program:def fermat(): t = 3 while (True): for n in range(3, t+1): for x in range(1, t+1): for y in range(1, t+1): for z in range(1, t+1): if (x**n + y**n == z**n): return (x, y, z, n) t += 1
Question: Does this program halt?
- No guaranteed autograder program.
![Page 47: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/47.jpg)
So what?
numberToTest := 2;flag := 1;while flag = 1 do flag := 0; numberToTest := numberToTest + 2; for p from 2 to numberToTest do if isPrime(p) and isPrime(numberToTest−p) then flag := 1; break; #exits the for loop end if end forend do
Question: Does this program halt?
- Consider the following program (written in MAPLE):
GoldbachConjecture
![Page 48: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/48.jpg)
So what?
- Reductions to other problems imply that those problems are uncomputable as well.
Is there an algorithm to determine if a given multivariate polynomial with integral coefficients has an integral solution?
Hilbert’s 10th Problem
Entscheidungsproblem Is there an algorithm to determine the validity of a given logical expression?
¬9x, y, z, n 2 N : (n � 3) ^ (xn + y
n = z
n)e.g.
![Page 49: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/49.jpg)
So what?
Input: A finite collection of “dominoes” having strings written on each half.
Output: True if it is possible to match the strings.
abccabcc
abccabcc
Uncomputable!Proved in 1946 by Post.
![Page 50: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/50.jpg)
So what?
Input: A finite collection of “Wang Tiles” (squares) with colors on the edges.
Output: True if it is possible to make an infinite grid from copies of the given squares, where touching sides must color-match.
Uncomputable!Proved in 1966 by Berger.
![Page 51: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/51.jpg)
So what?
Input: Two 21x21 matrices of integers and .A B
Output: True iff it is possible to multiply and together (multiple times in any order) to get to the 0 matrix.
A B
Uncomputable!Proved in 2007 by Halava, Harju, Hirvensalo.
![Page 52: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/52.jpg)
So what?
Different laws of physics ----->
Different computational devices ----->
Every problem computable (???)
Can you come up with sensible laws of physicssuch that the Halting Problem becomes computable?
![Page 53: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/53.jpg)
That was about the basic question on whetherevery problem is computable.
![Page 54: Theoretical Foundations of Computer Science - cs.cmu.eduaada/courses/SAMS17/slides/C/intro-tcs.pdf · Theoretical Foundations of Computer Science August 9, 2017 “Computer Science](https://reader033.fdocuments.net/reader033/viewer/2022051407/5ae1ef7c7f8b9a495c8b75e9/html5/thumbnails/54.jpg)
Some other interesting questions in TCS
P vs NP
If a problem has a space-efficient solutiondoes it also have a time-efficient solution?
Time vs Space
Can every randomized algorithm be derandomized efficiently?
Power of randomness
Can we use quantum properties of matter to build faster computers?
Power of quantum information