Turing Machines Part One

Similar documents
Turing Machines Part One

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1

This lecture covers Chapter 8 of HMU: Properties of CFLs

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51

5.1 Definitions and Examples 5.2 Deterministic Pushdown Automata

Turing Machines Part One

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

Some Theory of Computation Exercises Week 1

CS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa

Non Deterministic Automata. Formal Languages and Automata - Yonsei CS 1

CSCI FOUNDATIONS OF COMPUTER SCIENCE

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

1.4 Nonregular Languages

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model?

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

CS 275 Automata and Formal Language Theory

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

Nondeterminism and Nodeterministic Automata

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

Finite Automata-cont d

Theory of Computation Regular Languages

Chapter 2 Finite Automata

More on automata. Michael George. March 24 April 7, 2014

Non-Deterministic Finite Automata

First Midterm Examination

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

Lecture 6 Regular Grammars

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4

NFAs continued, Closure Properties of Regular Languages

First Midterm Examination

CS375: Logic and Theory of Computing

1.3 Regular Expressions

Deterministic Finite Automata

CMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!)

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

1 From NFA to regular expression

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:

Regular expressions, Finite Automata, transition graphs are all the same!!

State Minimization for DFAs

CS S-12 Turing Machine Modifications 1. When we added a stack to NFA to get a PDA, we increased computational power

Part 5 out of 5. Automata & languages. A primer on the Theory of Computation. Last week was all about. a superset of Regular Languages

Lecture 09: Myhill-Nerode Theorem

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.

Homework 3 Solutions

CS 311 Homework 3 due 16:30, Thursday, 14 th October 2010

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-*

CSCI 340: Computational Models. Transition Graphs. Department of Computer Science

Lexical Analysis Finite Automate

Deterministic Finite-State Automata

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

CS5371 Theory of Computation. Lecture 20: Complexity V (Polynomial-Time Reducibility)

Recursively Enumerable and Recursive. Languages

Nondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA

Lecture 08: Feb. 08, 2019

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)

Minimal DFA. minimal DFA for L starting from any other

Languages & Automata

CSC 473 Automata, Grammars & Languages 11/9/10

Convert the NFA into DFA

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1

Homework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama

Non-deterministic Finite Automata

Formal languages, automata, and theory of computation

Automata and Languages

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2014

For convenience, we rewrite m2 s m2 = m m m ; where m is repeted m times. Since xyz = m m m nd jxyj»m, we hve tht the string y is substring of the fir

CISC 4090 Theory of Computation

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

Let's start with an example:

CHAPTER 1 Regular Languages. Contents

1 Structural induction, finite automata, regular expressions

CMSC 330: Organization of Programming Languages

a b b a pop push read unread

Name Ima Sample ASU ID

Formal Language and Automata Theory (CS21004)

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

CS 330 Formal Methods and Models

NFAs continued, Closure Properties of Regular Languages

Designing finite automata II

1 Structural induction

Non-deterministic Finite Automata

In-depth introduction to main models, concepts of theory of computation:

Worked out examples Finite Automata

GNFA GNFA GNFA GNFA GNFA

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2016

1 Nondeterministic Finite Automata

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2

Fundamentals of Computer Science

Regular Language. Nonregular Languages The Pumping Lemma. The pumping lemma. Regular Language. The pumping lemma. Infinitely long words 3/17/15

Finite Automata Part Three

CS 330 Formal Methods and Models

CS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions

Talen en Automaten Test 1, Mon 7 th Dec, h45 17h30

Lexical Analysis Part III

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

Transcription:

Turing Mchines Prt One

Wht problems cn we solve with computer?

Regulr Lnguges CFLs Lnguges recognizble by ny fesible computing mchine All Lnguges

Tht sme drwing, to scle. All Lnguges

The Problem Finite utomt ccept precely regulr lnguges. We my need unbounded memory to recognize context-free lnguges. e.g. { n b n n N } requires unbounded counting. How do we build n utomton with finitely mny sttes but unbounded memory?

A Brief Htory Lesson

Fin de siècle optimm

<hem> Technology hs solved ll of mnkind s problems! No more wrs or sd ever!

Hilbert s Vion 1900: Interntionl Congress of Mmticins meeting in Pr Proposes 23 unsolved problems s gend for coming yers An importnt me not simply proving more orems, but chieving utomtion of oremproving, even orem genertion. Humnity lives in leure while ll Truth flows effortlessly into our hnds on ticker tpe! No one shll expel us from Prde tht Cntor hs creted! -Dvid Hilbert

Hi re, Relity! Hilbert s gend both spectculr success nd spectculr filure Inspires some of most impctful oreticl work in mmticl htory, humn htory Brings us heroes like Aln Turing nd Kurt Gödel! These incredible results const of utterly demolhing ll pillrs of h vion of utomted knowledge cretion, within just few yers No one shll expel us from Prde tht Cntor hs creted! -Dvid Hilbert

Wht Turing Dcovered

A Simple Turing Mchine q cc, R, R strt, R, R Th Th Turing Turing mchine s mchine s finite finite stte stte control. control. It It sues sues commnds commnds tht tht drive drive opertion opertion of of mchine. mchine.

A Simple Turing Mchine q cc, R, R strt, R, R Th Th TM s TM s infinite infinite tpe. tpe. Ech Ech tpe tpe cell cell holds holds tpe tpe symbol. symbol. Initilly, Initilly, ll ll (infinitely (infinitely mny) mny) tpe tpe symbols symbols re re blnk. blnk.

A Simple Turing Mchine q cc, R, R strt The The mchine mchine strted strted with with input input string string written written somewhere somewhere on on tpe. tpe. The The tpe tpe hed hed initilly initilly points points to to first first symbol symbol of of input input string. string., R, R

A Simple Turing Mchine q cc, R, R strt Like Like DFAs DFAs nd nd NFAs, NFAs, TMs TMs begin begin execution execution in in ir ir strt strt stte. stte., R, R

A Simple Turing Mchine q cc, R, R strt At At ech ech step, step, TM TM only only looks looks t t symbol symbol immeditely immeditely under under tpe tpe hed. hed., R, R

A Simple Turing Mchine q cc, R, R strt These These two two trnsitions trnsitions originte originte t t current current stte. stte. We re We re going going to to choose choose one one of of m m to to follow. follow., R, R

A Simple Turing Mchine q cc, R, R strt, R, R Ech Ech trnsition trnsition hs hs form form red red write, write, dir dir nd nd mens mens if if symbol symbol red red under under tpe tpe hed, hed, q replce rej replce it it with with write write nd nd move move tpe tpe hed hed in in direction direction dir dir (L (L or or R). R). The The symbol symbol denotes denotes blnk blnk cell. cell.

A Simple Turing Mchine q cc, R, R strt, R, R Ech Ech trnsition trnsition hs hs form form red red write, write, dir dir nd nd mens mens if if symbol symbol red red under under tpe tpe hed, hed, q replce rej replce it it with with write write nd nd move move tpe tpe hed hed in in direction direction dir dir (L (L or or R). R). The The symbol symbol denotes denotes blnk blnk cell. cell.

A Simple Turing Mchine q cc, R, R strt, R, R Ech Ech trnsition trnsition hs hs form form red red write, write, dir dir nd nd mens mens if if symbol symbol red red under under tpe tpe hed, hed, q replce rej replce it it with with write write nd nd move move tpe tpe hed hed in in direction direction dir dir (L (L or or R). R). The The symbol symbol denotes denotes blnk blnk cell. cell.

A Simple Turing Mchine q cc, R, R strt, R, R Ech Ech trnsition trnsition hs hs form form red red write, write, dir dir nd nd mens mens if if symbol symbol red red under under tpe tpe hed, hed, q replce rej replce it it with with write write nd nd move move tpe tpe hed hed in in direction direction dir dir (L (L or or R). R). The The symbol symbol denotes denotes blnk blnk cell. cell.

A Simple Turing Mchine q cc, R, R strt, R, R Ech Ech trnsition trnsition hs hs form form red red write, write, dir dir nd nd mens mens if if symbol symbol red red under under tpe tpe hed, hed, q replce rej replce it it with with write write nd nd move move tpe tpe hed hed in in direction direction dir dir (L (L or or R). R). The The symbol symbol denotes denotes blnk blnk cell. cell.

A Simple Turing Mchine q cc, R, R strt, R, R

A Simple Turing Mchine q cc, R, R strt, R, R

A Simple Turing Mchine q cc, R, R strt, R, R

A Simple Turing Mchine q cc, R, R strt, R, R

A Simple Turing Mchine q cc, R, R strt, R, R

A Simple Turing Mchine q cc, R, R strt, R, R

A Simple Turing Mchine q cc, R, R strt, R, R

A Simple Turing Mchine q cc, R, R strt, R, R

A Simple Turing Mchine q cc, R, R strt, R, R

A Simple Turing Mchine q cc, R, R strt, R, R

A Simple Turing Mchine q cc, R, R strt, R, R

A Simple Turing Mchine q cc, R, R strt Unlike Unlike DFA DFA or or NFA, NFA, TM TM doesn t doesn t stop stop fter fter reding reding ll ll input input chrcters. chrcters. We We keep keep running running until until mchine mchine explicitly explicitly sys sys to to stop. stop., R, R

A Simple Turing Mchine q cc, R, R strt, R, R

A Simple Turing Mchine q cc, R, R strt Th Th specil specil stte stte n n ccepting ccepting stte. stte. When When TM TM enters enters n n ccepting ccepting stte, stte, it it immeditely immeditely stops stops running running nd nd ccepts ccepts whtever whtever originl originl input input string string ws ws (in (in th th cse, cse, ). )., R, R

A Simple Turing Mchine q cc, R, R strt Th Th specil specil stte stte n n ccepting ccepting stte. stte. When When TM TM enters enters n n ccepting ccepting stte, stte, it it immeditely immeditely stops stops running running nd nd ccepts ccepts whtever whtever originl originl input input string string ws ws (in (in th th cse, cse, ). )., R, R

A Simple Turing Mchine q cc, R, R strt, R, R

A Simple Turing Mchine q cc, R, R strt, R, R

A Simple Turing Mchine q cc, R, R strt, R, R

A Simple Turing Mchine q cc, R, R strt, R, R

A Simple Turing Mchine q cc, R, R strt, R, R

A Simple Turing Mchine q cc, R, R strt, R, R

A Simple Turing Mchine q cc, R, R strt Th Th specil specil stte stte rejecting rejecting stte. stte. When When TM TM enters enters rejecting rejecting stte, stte, it it immeditely immeditely stops stops running running nd nd rejects rejects whtever whtever originl originl input input string string ws ws (in (in th th cse, cse, ). )., R, R

A Simple Turing Mchine q cc, R, R strt Th Th specil specil stte stte rejecting rejecting stte. stte. When When TM TM enters enters rejecting rejecting stte, stte, it it immeditely immeditely stops stops running running nd nd rejects rejects whtever whtever originl originl input input string string ws ws (in (in th th cse, cse, ). )., R, R

A Simple Turing Mchine q cc, R, R strt If If TM TM strted strted on on empty empty string string ε, ε, entire entire tpe tpe blnk blnk nd nd tpe tpe hed hed positioned positioned t t some some rbitrry rbitrry loction loction on on tpe. tpe., R, R

A Simple Turing Mchine q cc, R, R strt If If TM TM strted strted on on empty empty string string ε, ε, entire entire tpe tpe blnk blnk nd nd tpe tpe hed hed positioned positioned t t some some rbitrry rbitrry loction loction on on tpe. tpe., R, R

A Simple Turing Mchine q cc, R, R strt If If TM TM strted strted on on empty empty string string ε, ε, entire entire tpe tpe blnk blnk nd nd tpe tpe hed hed positioned positioned t t some some rbitrry rbitrry loction loction on on tpe. tpe., R, R

The Turing Mchine A Turing mchine consts of three prts: A finite-stte control tht sues commnds, n infinite tpe for input nd scrtch spce, nd tpe hed tht cn red nd write single tpe cell. At ech step, Turing mchine writes symbol to tpe cell under tpe hed, [Q: wht if you don t wnt to write?] chnges stte, nd moves tpe hed to left or to right.

Input nd Tpe Alphbets A Turing mchine hs two lphbets: An input lphbet Σ. All input strings re written in input lphbet. A tpe lphbet Γ, where Σ Γ. The tpe lphbet contins ll symbols tht cn be written onto tpe. The tpe lphbet Γ cn contin ny number of symbols, but lwys contins t lest one blnk symbol, denoted. You re gurnteed Σ. At strtup, Turing mchine begins with n infinite tpe of symbols with input written t some loction. The tpe hed positioned t strt of input.

Accepting nd Rejecting Sttes Unlike DFAs, Turing mchines do not stop processing input when y finh reding it. Turing mchines decide when (nd if!) y will ccept or reject ir input. Turing mchines cn enter infinite loops nd never ccept or reject; more on tht lter...

Determinm Turing mchines re determintic: for every combintion of (non-ccepting, non-rejecting) stte q nd tpe symbol Γ, re must be exctly one trnsition defined for tht combintion of q nd. Any trnsitions tht re msing implicitly go stright to rejecting stte. We ll use th lter to simplify our designs. q cc, R, R strt, R, R

Determinm Turing mchines re determintic: for every combintion of (non-ccepting, non-rejecting) stte q nd tpe symbol Γ, re must be exctly one trnsition defined for tht combintion of q nd. Any trnsitions tht re msing implicitly go stright to rejecting stte. We ll use th lter to simplify our designs. q cc strt, R, R, R Th Th mchine mchine exctly exctly sme sme s s previous previous one. one.

strt b, R b, R, L q cc, L b b, L, L Run Run TM TM shown shown bove bove on on input input string string bb. bb. Wht Wht will will tpe tpe look look like like when when TM TM finhes finhes running? running? A. b b B. b C. b b D. b E. None of se, or two or more of se. Answer Answer t t PollEv.com/cs103 PollEv.com/cs103 or or text text CS103 CS103 to to 22333 22333 once once to to join, join, n n A, A, B, B, C, C, D, D, or or E. E.

strt b, R b, R, L q cc, L b b, L, L b b

strt b, R b, R, L q cc, L b b, L, L b

strt b, R b, R, L q cc, L b b, L, L

strt b, R b, R, L q cc, L b b, L, L b

strt b, R b, R, L q cc, L b b, L, L b

strt b, R b, R, L q cc, L b b, L, L b

strt b, R b, R, L q cc, L b b, L, L b

strt b, R b, R, L q cc, L b b, L, L If If M Turing Turing mchine mchine with with input input lphbet lphbet Σ, Σ, n n lnguge lnguge of of M, M, denoted denoted L(M), L(M), set set L(M) L(M) = { { w Σ* Σ* M ccepts ccepts w } } Let Let M be be bove bove TM, TM, nd nd ssume ssume its its input input lphbet lphbet {, {, b}. b}. Wht Wht L (( M)? M)? A. A. { w {, {, b}* b}* w ends ends in in } B. B. { w {, {, b}* b}* w ends ends in in b } C. C. Ø D. D. None None of of se, se, or or two two or or more more of of se. se. Answer Answer t t PollEv.com/cs103 PollEv.com/cs103 or or text text CS103 CS103 to to 22333 22333 once once to to join, join, n n A, A, B, B, C, C, or or D. D.

strt b, R b, R, L q cc, L b b, L, L b

strt b, R b, R, L q cc, L b b, L, L b b

strt b, R b, R, L q cc, L b b, L, L b b b

strt b, R b, R, L q cc, L b b, L, L b b

strt b, R b, R, L q cc, L b b, L, L b b

strt b, R b, R, L q cc, L b b, L, L b b

strt b, R b, R, L q cc, L b b, L, L b b

strt b, R b, R, L q cc, L b b, L, L b b Although Although tpe tpe ends ends with with bb bb written written on on it, it, originl originl input input string string ws ws b. b. Th Th shows shows tht tht TM TM ccepts ccepts b, b, not not bb. bb. So So L ( M) ( M) = { { w {, {, b}* b}* w ends ends in in b } }