CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Turing Machines.

Slides:



Advertisements
Similar presentations
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Pages COMPUTABILITY THEORY.
Advertisements

1 CSC3130 Formal Languages and Automata Theory Tutorial 9 Undecidable Problem KN Hung SHB 1026.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Variants.
CS21 Decidability and Tractability
Introduction to Computability Theory
CS5371 Theory of Computation Lecture 11: Computability Theory II (TM Variants, Church-Turing Thesis)
CS 310 – Fall 2006 Pacific University CS310 Turing Machines Section 3.1 November 6, 2006.
Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Fall 2008.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Nondeterminism.
CS5371 Theory of Computation Lecture 10: Computability Theory I (Turing Machine)
CS5371 Theory of Computation Lecture 8: Automata Theory VI (PDA, PDA = CFG)
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Context-Free Languages Regular Languages Violates Pumping Lemma For RLs Violates Pumping Lemma For CFLs Described by CFG, PDA 0n1n0n1n 0n1n2n0n1n2n Described.
Cs3102: Theory of Computation Class 18: Proving Undecidability Spring 2010 University of Virginia David Evans.
CSCI 2670 Introduction to Theory of Computing September 28, 2005.
 Computability Theory Turing Machines Professor MSc. Ivan A. Escobar
1 Unit 1: Automata Theory and Formal Languages Readings 1, 2.2, 2.3.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Efficient.
1 CO Games Development 2 Week 21 Turing Machines & Computability Gareth Bellaby.
Introduction to CS Theory Lecture 15 –Turing Machines Piotr Faliszewski
Lecture 1 Computation and Languages CS311 Fall 2012.
CSCI 3130: Formal languages and automata theory Andrej Bogdanov The Chinese University of Hong Kong Turing.
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Part 1 – Pages COMPUTABILITY THEORY.
CSE 311 Foundations of Computing I Lecture 26 Computability: Turing machines, Undecidability of the Halting Problem Spring
CSCI 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Variants.
CSE 311 Foundations of Computing I Lecture 29 Computability: Turing machines, Undecidability of the Halting Problem Autumn 2012 CSE 3111.
Computer Science 101 Theory of Computing. Computer Science is... The study of algorithms, with respect to –their formal properties –their linguistic realizations.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Turing Machines.
Complexity & Computability. Limitations of computer science  Major reasons useful calculations cannot be done:  execution time of program is too long.
Computation Motivating questions: What does “computation” mean? What are the similarities and differences between computation in computers and in natural.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich
Capabilities of computing systems Numeric and symbolic Computations A look at Computability theory Turing Machines.
CSCI 3130: Formal languages and automata theory Andrej Bogdanov The Chinese University of Hong Kong Undecidable.
CSCI 2670 Introduction to Theory of Computing October 13, 2005.
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
Lecture 16b Turing Machines Topics: Closure Properties of Context Free Languages Cocke-Younger-Kasimi Parsing Algorithm June 23, 2015 CSCE 355 Foundations.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples,
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Undecidable.
1 Introduction to Turing Machines
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2007.
Umans Complexity Theory Lectures Lecture 1b: Turing Machines & Halting Problem.
CSCI 3130: Formal languages and automata theory Andrej Bogdanov The Chinese University of Hong Kong Decidable.
The Church-Turing Thesis Chapter Are We Done? FSM  PDA  Turing machine Is this the end of the line? There are still problems we cannot solve:
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY * Read chapter 4 of the book for next time * Lecture9x.ppt.
MA/CSSE 474 Theory of Computation Universal Turing Machine Church-Turing Thesis (Winter 2016, these slides were also used for Day 33)
CS 154 Formal Languages and Computability April 5 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
Fall 2014 Lecture 29: Turing machines and more decidability CSE 311: Foundations of Computing.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Undecidable.
MA/CSSE 474 Theory of Computation Universal Turing Machine Church-Turing Thesis Delayed due dates for HWs See updated schedule page. No class meeting.
Fall 2013 Lecture 27: Turing machines and decidability CSE 311: Foundations of Computing.
Busch Complexity Lectures: Turing Machines
CSE 311 Foundations of Computing I
Turing Machines.
Polynomial time The Chinese University of Hong Kong Fall 2010
Undecidable problems for CFGs
Undecidable problems for CFGs
CSE 105 theory of computation
CS154, Lecture 10: Rice’s Theorem, Oracle Machines
فصل سوم The Church-Turing Thesis
Turing Machines (11.5) Based on slides by Costas Busch from the course
CS154, Lecture 10: Rice’s Theorem, Oracle Machines
Theory of Computation Turing Machines.
Efficient computation
Decidable and undecidable languages
Variants of Turing Machines
CSE 105 theory of computation
CO Games Development 2 Week 21 Turing Machines & Computability
CSE 105 theory of computation
Presentation transcript:

CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Turing Machines Fall 2009

What is a computer? A computer is a machine that manipulates data according to a list of instructions. computer input data instructions (program) output data

Are DFAs and PDAs computers? 0,  / a #,  / , Z 0 /  1, a /  0 1 0, 1 A computer is a machine that manipulates data according to a list of instructions. yesno!

A short history of computing devices Leibniz calculator (1670s) slide rule (1600s) abacus (Babylon 500BC, China 1300) Babbage’s mechanical engine (1820s)

A brief history of computing devices Z3 (Germany, 1941)ENIAC (Pennsylvania, 1945) PC (1980) MacBook Air (2008)

Which of these are “real” computers? not programmable programmable

Computation is universal In principle, all these computers have the same problem-solving ability C++javapythonLISP

The Turing Machine C++javapythonLISP Turing Machine

The Turing Machine The Turing Machine is an abstract automaton that is meant to model any physically realizable computer –Using any technology (mechanical, electrical, nano, bio) –Under any physical laws (gravity, quantum, E&M) –At any scale (human, quantum, cosmological) How come there is one model that can capture all these vastly different settings? Why do we need an abstract model of a computer?

Computation and mathematical proofs Prove that... √ 2 is irrational. The equation x n + y n = z n, n ≥ 2 has no integer solutions. G = (L, R) has a perfect matching iff |  (S)| ≥ |S| for every L ⊆ S. The language 0 n 1 n is not regular. Math is hard, let’s go shopping! (Archimedes’ Theorem) (Fermat-Wiles Theorem) (Hall’s Theorem)

Hilbert’s list of 23 problems Leading mathematician in the 1900s At the 1900 International Congress of Mathematicians, proposed a list of 23 problems for the 20 th century Hilbert’s 10 th problem: David Hilbert ( ) Find a method for telling if an equation like xyz – 3xy + 6xz + 2 = 0 has integer solutions

Automated theorem-proving computer input data instructions output √ 2 is irrational. The equation x n + y n = z n, n ≥ 2 has no integer solutions. G = (L, R) has a perfect matching iff |  (S)| ≥ |S| for every L ⊆ S. The language 0 n 1 n is not regular. check if they are true! xyz – 3xy + 6xz + 2 = 0 has integer solutions. true / false

Automated theorem proving How could automated theorem proving work? Let’s look at a typical proof: √ 2 is irrational. Assume not. Then √ 2 = m/n. Then m 2 = 2n 2 But m 2 has an even number of prime factors and 2n 2 has an odd number of prime factors. Contradiction. Theorem: Proof:

First idea of automated theorem proving Checking that a proof is correct is much easier than coming up with the proof ➀ Proof:... if we write out the proof in sufficient detail √ 2 = m/n both sides ×n ( √ 2)n = m square ( √ 2) 2 n 2 = m 2 def of sqrt 2n 2 = m 2

First idea of automated theorem proving Checking that a proof is correct is much easier than coming up with the proof –In principle this is uncontroversial –In practice, it is harder (but still possible) to do ➀ A proof, if written out in sufficient detail, can be checked mechanically

Second idea of automated theorem proving To find if statement is true, why don’t we try all possible proofs After all, a proof is just a sequence of symbols (over alphabet {0, 1, 2, m, n, √, 2, etc.} ) If statement is true, it has a proof of finite length, say k To find it, let’s just try all possible proofs of length 1, 2, up to k ➁ √ 2 = m/n ( √ 2)n = m ( √ 2) 2 n 2 = m 2 2n 2 = m 2...

Königsberg, 1930 David Hilbert ( ) Kurt Gödel ( ) September 8: Hilbert gives a famous lecture “Logic and the understanding of nature”

Königsberg, 1930 David Hilbert ( ) Kurt Gödel ( ) John von Neumann ( ) I reached the conclusion that in any reasonable formal system in which provability in it can be expressed as a property of certain sentences, there must be propositions which are undecidable in it. It is all over!

What did Gödel say? To find if statement is true, why don’t we try all possible proofs After all, a proof is just a sequence of symbols (over alphabet {0, 1, 2, m, n, √, 2, etc.} ) If statement is true, it has a proof of finite length, say k To find it, let’s just try all possible proofs of length 1, 2, up to k ➁ NO!

Gödel’s incompleteness theorem Some mathematical statements are true but not provable. What are they?

Example of incompleteness Recall Hilbert’s 10 th problem: Matyashievich showed in 1970 that there exists a polynomial p such that Find a method for telling if an equation like xyz – 3xy + 6xz + 2 = 0 has integer solutions p(x 1,..., x k ) = 0 has no integer solutions, but this cannot be proved

Another example of incompleteness Recall ambiguous context free grammars We did exercises of the type “Show that G is ambiguous” However there exists a CFG G such that G is unambiguous, but this cannot be proved

Gödel’s incompleteness theorem Some mathematical statements are true but not provable. What does this have to do with computer science?

The father of modern computer science Invented the Turing Test to tell humans and computers apart Broke German encryption codes during World War II The Turing Award is the “Nobel prize of Computer Science” Alan Turing ( ) “On Computable Numbers, with an Application to the Entscheidungsproblem” 1936:

Turing’s angle on incompleteness computer input data instructions output check if true! true / false mathematical statement Gödel’s theorem says that a computer cannot determine the truth of mathematical statements But there are many other things!

Computer program analysis public static void main(String args[]) { System.out.println("Hello World!"); } What does this program do? How about this one? public static void main(String args[]) { int i = 0; for (j = 1; j < 10; j++) { i += j; if (i == 28) { System.out.println("Hello World!"); }

Computers cannot analyze programs! computer input data instructions output does it print Hello, world! java program The essence of Gödel’s theorem is that computers cannot analyze computer programs

How do you argue things like that? To argue what computers cannot do, we need to have a precise definition of what a computer is. “On Computable Numbers, with an Application to the Entscheidungsproblem” 1936: Section 1. Computing Machines

Turing Machines state control … A Turing Machine is a finite automaton with a two-way access to an infinite tape Initially, the first few cells contain the input, and the other cells are blank infinite tape 010 input

Turing Machines state control … At each point in the computation, the machine sees its current state and the symbol at the head It can replace the symbol on the tape, change state, and move the head left or right 01a0 head

How Turing Machines operate … 01a0 q1q1 q2q2 a/bL Replace a with b, and move head left current state … 01b0 q1q1 q2q2 a/bL current state

Formal Definition A Turing Machine is (Q, , , , q 0, q acc, q rej ) : –Q is a finite set of states; –  is the input alphabet; –  is the tape alphabet (    ) including the blank symbol ☐ –q 0 in Q is the initial state; –q acc, q rej in Q are the accepting and rejecting state; –  is the transition function  : (Q – {q acc, q rej })   → Q   {L, R}

Operation of Turing Machines Differences from pushdown automata –TM can access arbitrary entries in memory –Transitions in TM are deterministic –TM uses same tape for input and memory … 001 ☐ q0q0 ☐☐☐ Initially, tape contains input followed by blanks

Programming Turing Machines L 1 = {w$w: w ∈ { a, b }*} Strategy: Read and remember the first symbol Cross it off ( x ) Read the first symbol past $ If they don’t match, reject abbaa$abbaa xbbaa$abbaa If they do, cross it off xbbaa$xbbaa

Programming Turing Machines L 1 = {w$w: w ∈ { a, b }*} Strategy: Look for the first uncrossed symbol Cross it off ( x ) Read the first uncrossed symbol past $ xbbaa$xbbaa xxbaa$xbbaa If they match, cross it off, else reject xxbaa$xxbaa At the end, there should be only x s and $ s xxxxx$xxxxx If not, reject

Programming Turing Machines L 1 = {w$w: w ∈ { a, b }*} Description of Turing Machine: Until you reach $ Read and remember entry Move right past $ and past all x s If this entry is different, reject Otherwise Move left past $ and to right of first x If you see only x s followed by ☐, accept xbbaa$xbbaa xxbaa$xxbaa Write x xxbaa$xbbaa Write x xxbaa$xxbaa

Programming Turing Machines L 1 = {w$w: w ∈ {a, b}*} q0q0 q a1 q a2 q2q2 q b1 q b2 q3q3 q rej q1q1 q acc a/xR $/$R b/xL b/xR a/xL a/aR b/bR a/aR b/bR x/xR a/aL b/bL x/xL ☐/☐R☐/☐R $/$R a/aL b/bL x/xR everything else

Programming Turing Machines read a accept write x move right blank

Programming Turing Machines L 2 = { $a i b j c k : i  j = k and i, j, k > 0 } Strategy: Scan input from left to right to check it looks like $aa * bb * cc * Move left until you see first a Until all a s have been crossed off ( x ) For every b you see, cross off one of the c s ( z ) Cross off one a ( x ) If there are any uncrossed c s left, reject If there are no c s left, reject Otherwise, accept

Programming Turing Machines L 2 = { $a i b j c k : i  j = k and i, j, k > 0 } Implementation detail: For every b you see, cross off one of the c s ( z ): Until all b s have been crossed off ( y ) Replace current b by y Move right until you see first c Cross off c ( z ) Move left until first b Restore the b s: Replace all y s by b s

Programming tools move left until you see a move left until you pass all z s

Looping behavior Something strange can happen in a Turing Machine: Inputs can be divided into three types q0q0 q acc q rej  = {0, 1} input:  ☐/☐R☐/☐R 0/0R 1/1R This machine never halts q acc q rej accept rejectloop forever

The Church-Turing Thesis Turing Machine quantum computing DNA computing cosmic computing

The Church-Turing Thesis “On Computable Numbers, with an Application to the Entscheidungsproblem” 1936: Section 9. The extent of the computable numbers All arguments [for the CT Thesis] which can be given are bound to be, fundamentally, appeals to intuition, and for this reason rather unsatisfactory mathematically. The arguments which I shall use are of three kinds: 1. A direct appeal to intuition 2. A proof of the equivalence of two definitions (In case the new definition has greater intuitive appeal) 3. Giving examples of large classes of numbers which are computable.