DM17. Beregnelighed. Jacob Aae Mikkelsen

Similar documents
THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Final exam study sheet for CS3719 Turing machines and decidability.

SCHEME FOR INTERNAL ASSESSMENT TEST 3

CPSC 421: Tutorial #1

Functions on languages:

Context-Free and Noncontext-Free Languages

Foundations of Informatics: a Bridging Course

V Honors Theory of Computation

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs

Computational Models - Lecture 4

Decidability (What, stuff is unsolvable?)

The View Over The Horizon

Theory of Computation

HKN CS/ECE 374 Midterm 1 Review. Nathan Bleier and Mahir Morshed

} Some languages are Turing-decidable A Turing Machine will halt on all inputs (either accepting or rejecting). No infinite loops.

DD2371 Automata Theory

MA/CSSE 474 Theory of Computation

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Theory of Computation (IX) Yijia Chen Fudan University

3130CIT Theory of Computation

CSE 105 THEORY OF COMPUTATION

Pushdown Automata. We have seen examples of context-free languages that are not regular, and hence can not be recognized by finite automata.

Lecture 17: Language Recognition

Finite Automata and Regular languages

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

Undecidable Problems and Reducibility

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is,

Part I: Definitions and Properties

The Pumping Lemma. for all n 0, u 1 v n u 2 L (i.e. u 1 u 2 L, u 1 vu 2 L [but we knew that anyway], u 1 vvu 2 L, u 1 vvvu 2 L, etc.

Computability and Complexity

CS21 Decidability and Tractability

ACS2: Decidability Decidability

Computation Histories

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES

Great Theoretical Ideas in Computer Science. Lecture 4: Deterministic Finite Automaton (DFA), Part 2

Theory of Computation Turing Machine and Pushdown Automata

Homework Assignment 6 Answers

CSE 105 THEORY OF COMPUTATION

Nondeterministic Finite Automata

THEORY OF COMPUTATION

Properties of Context-Free Languages. Closure Properties Decision Properties

CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1)

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 16 : Turing Machines

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

Context-Free Languages (Pre Lecture)

CISC4090: Theory of Computation

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam

Theory of Computation (IV) Yijia Chen Fudan University

Büchi Automata and their closure properties. - Ajith S and Ankit Kumar

What languages are Turing-decidable? What languages are not Turing-decidable? Is there a language that isn t even Turingrecognizable?

Pumping Lemma for CFLs

CSE 105 THEORY OF COMPUTATION

Lecture 3: Nondeterministic Finite Automata

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS

Theory of Computation p.1/?? Theory of Computation p.2/?? Unknown: Implicitly a Boolean variable: true if a word is

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 10 : Context-Free Grammars

Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite

1 Showing Recognizability

CS 455/555: Finite automata

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen

NPDA, CFG equivalence

Theory of Computation (II) Yijia Chen Fudan University

CSCE 551 Final Exam, Spring 2004 Answer Key

Decidability (intro.)

Pushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CS243, Logic and Computation Nondeterministic finite automata

CSE 105 THEORY OF COMPUTATION

Languages, regular languages, finite automata

Homework 8. a b b a b a b. two-way, read/write

Computability and Complexity

We define the multi-step transition function T : S Σ S as follows. 1. For any s S, T (s,λ) = s. 2. For any s S, x Σ and a Σ,

CSCE 551: Chin-Tser Huang. University of South Carolina

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

What we have done so far

CS 154 Introduction to Automata and Complexity Theory

Introduction to Languages and Computation

Computational Models - Lecture 4 1

Ogden s Lemma for CFLs

Decidability: Church-Turing Thesis

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

Non-emptiness Testing for TMs

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 5 : DFA minimization

TURING MAHINES

Introduction to Theory of Computing

Closure under the Regular Operations

Before We Start. The Pumping Lemma. Languages. Context Free Languages. Plan for today. Now our picture looks like. Any questions?

Computational Models: Class 3

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2016, face-to-face day section Prof. Marvin K. Nakayama

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 8 Nancy Lynch

6.8 The Post Correspondence Problem

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

PUSHDOWN AUTOMATA (PDA)

CP405 Theory of Computation

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism,

Transcription:

DM17 Beregnelighed Jacob Aae Mikkelsen January 12, 2007

CONTENTS Contents 1 Introduction 2 1.1 Operations with languages...................... 2 2 Finite Automata 3 2.1 Regular expressions/languages.................... 3 2.2 DFA - Deterministic Finite Automaton............... 3 2.3 NDFA - Nondeterministic Finite Automaton............ 3 2.4 Pumping Lemma for regular languages............... 4 2.5 Myhill & Nerode........................... 4 3 Context-free Languages 6 3.1 Context Free Grammar........................ 6 3.2 Chomsky Normal Form........................ 6 3.3 Pushdown Automata......................... 7 3.4 Pumping Lemma for context free languages............ 7 4 Turing Machines 9 4.1 Turing Machines........................... 9 4.2 Relationship among classes og languages.............. 10 4.3 Grammars............................... 10 5 Undecidability 12 5.1 The Halting Problem......................... 12 5.2 Unsolvale problems about grammars................ 12 5.3 Rice s Theorem............................ 13 Kokken January 12, 2007 1

1. Introduction 1 Introduction 1.1 Operations with languages Complement L := Σ \ L = {w Σ w / L} Union A B = {x x A or x B} Intersection A B = {x x A and x B} Concatenation A B = {xy x A and y B} Kleene-star A = {x 1 x 2...Xk k 0 and each x i A} Definition: Countable A set A is countable if either it is finite or it has the same size as N R is uncountable. Kokken January 12, 2007 2

2. Finite Automata 2 Finite Automata 2.1 Regular expressions/languages Remark: The expression ǫ represents the language containing a single string - namely, the empty string - whereas represents the language that doesn t contain any strings Definition: Regular Language A language L for which there is a regular expression x so that L(x) = L. Or: A language is called a regular language if some finite automaton recognizes it. The class of regular languages is closed under the union operation. In other words, if A 1 and A 2 are regular languages, so is A 1 A 1 The class of regular languages is closed under the concatenation operation. In other words, if A 1 and A 2 are regular languages, so is A 1 A 1 The class of regular languages is closed under the Kleene-star operation. The class of regular languages are closed under the complementation and intersection operation. 2.2 DFA - Deterministic Finite Automaton A DFA M consists of 5 elements: Σ Finite alphabet K Finite set of states s K Starting state F K Set of final states δ : K Σ K Transition function of M 2.3 NDFA - Nondeterministic Finite Automaton A DFA M has 5 elements, where Σ, K, s, F as a DFA, and: is a subset of K (Σ {e}) K) Kokken January 12, 2007 3

2.4 Pumping Lemma for regular languages Every nondeterministic finite automaton has an equivalent deterministic finite automaton 2.4 Pumping Lemma for regular languages The Pumping Lemma for regular languages If A is a regular language, then there is a number p (the pumping length) where, if s is any string in A of length at least p, then s may be divided into three pieces, s = xyz, satisfying the following conditions: 1. for each i 0 xy i z A 2. y > 0 3. xy p Remark: If L(M) is finite, it only contains words of length < n (n = number of states of M) 2.5 Myhill & Nerode Definition: Equivalent with respect to L Let L Σ be a language, and let x, y Σ. We say that x and y are equivalent with respect to L, denoted x L y, if for all z Σ, the following is true: xz L if and only if yz L. Notice L is an equivalence relation. Definition: Equivalent with respect to M Let M = (K, Σ, δ, s, F) be a deterministic finite automaton. We say that two strings x, y Σ are equivalent with respect to M, denoted x M y, if, intuitively, they both drive M from s to the same state. Formally, x M y if there is a state q such that (s, x) M (q, e) and (s, y) M (q, e).again, x M y is an equivalence relation. Its equivalence classes can be reachable from s and therefore have at least one string in the corresponding equivalence class. We denote the equivalence class corresponding to state q of M as E q For any deterministic finite automaton M = (K, Σ, δ, s, F) and any strings x, y Σ, if x M y, then L(M) The Myhill-Nerode Theorem Let L Σ be a regular language. Then there is a deterministic finite automaton Kokken January 12, 2007 4

2.5 Myhill & Nerode with precisely as many states as there are equivalence classes in L that accepts L. Corollary: A language L is regular if and only if L has finitely many equivalence classes. Kokken January 12, 2007 5

3. Context-free Languages 3 Context-free Languages Grammars: Methodology to generate words in a language 3.1 Context Free Grammar Definition: Context free grammar G is context-free iff R V Σ V (i.e. we replace all the time one non-terminal) a language L Σ is context-free iff there is a context free grammar G, s.t. L(G) = L G is a regular grammer (right-linear grammer) if R V Σ Σ (V Σ) Σ (i.e. rules have the form A wb, w Σ ora w, w Σ ) Remark: The generation process is not deterministic, it is unclear which rule to apply next if there are several possible ones. (A deterministic version might be less powerfull). 3.2 Chomsky Normal Form Definition: Chomsky normal form A context-free grammar is in Chomsky normal form if every rule is on the form A BC A a where a is any is any terminal and A, B and C are any variables - except that B and C may not be the start variable. In adition we permit the rule S ǫ, where S is the start variable. Any context free language is generated by a context-free grammar in Chomsky normal form. The context-free languages are closed under union, concatenation, and Kleene star. Corollary: Kokken January 12, 2007 6

3.3 Pushdown Automata Given 2 context free languages L 1 and L 2, their intersection is not necessarily again context free. (Context free languages are not closed under intersection). Given L Σ context free, then L := Σ \ L is not necessarily cfr The intersection of a context free grammar with a regular language is again context free 3.3 Pushdown Automata Definition: Push-down automaton A push-down automaton PDA is a 6-tuple (Q, Σ, Γ, δ, q 0, F) Q is the set of states Σ is the finite input alphabet Γ is the stack alphabet δ : Q Σ ǫ Γ ǫ P(Q Γ ǫ ) Transition function q o Q Starting state F Q is the set of accept states A language is context free if and only if some pushdown automaton recognizes it. Corollary: Every regular language is context free 3.4 Pumping Lemma for context free languages Pumping Lemma for context free languages If A is a context free language, then there is a number p (the punping length) where, if s is any string in A of length at least p, then s may be divided into five pieces, s = uvxyz, satisfying the following conditions: 1. for each i 0 uv i xy i z A 2. vy > 0 3. vxy p Kokken January 12, 2007 7

3.4 Pumping Lemma for context free languages Remark: Usually the pumping lemma is used to prove a language NOT to be context free. In these applications we therefore do not need to have to construct CNF The context-free languages are not closed under intersection or complementation. Kokken January 12, 2007 8

4. Turing Machines 4 Turing Machines 4.1 Turing Machines Definition: Turing Machine A turing machine is a 5-tuple M = (K, Σ, δ, s, F) K Finite set of states Σ Finite alphabet, w.o.l.g. Σ contains two symbols (left-end) and (blank), and L, R, N / Σ s K Starting state F K Set of final states δ : (K F) Σ K Σ {L, R, N} Transition function of M If M reaches a q F it stops. If M stops, it is said to accept w L(M) = {w M accepts w} is the language accepted by M If F consists of two distinguished halting states {y, n}. The machine can halt in an accepting state {y} or an rejecting state {n}. We say that M accepts an input w if it yields an accepting configuration, and rejects if it yields an rejecting configuration. Definition: Decides A TM M decides a language L Σ 0 if for any string w Σ 0 the following is true: If w L then M acccepts w, and if w / L then M rejects w Definition: Recursive language We call a language L recursive if there is a Turing machine that decides it. Definition: Turing Decidable A language is called Turing decidable or simply decidable if some Turing Machine decides it. Also called recursive language Definition: Semidecides A TM M semidecides a language L Σ 0 if for any string w Σ 0 the following is true: w L if and only if M halts on input w Kokken January 12, 2007 9

4.2 Relationship among classes og languages Definition: Recursively enumerable A language L is recursively enumerable if and only if there is a Turing machine M that semidecides L. Definition: Turing Acceptable A language L is Turing acceptable iff: TMM so that L(M) = L Definition: Turing Computable A function f is Turing computable iff: TMM so that f M f Definition: Turing Recognizable A language is called Turing recognizable if some Turing Machine recognizes it. Also called recursively enumerable language Every context free language is decidable Definition: co-turing recognizable A language is co-turing recognizable if it is the complement of a Turing-recognizable language A language is decidable iff it is Turing recognizable and co-turing recognizable. If a language is recursive, then it is recursively enumerable. If L is a recursive language, then its complement L is also. 4.2 Relationship among classes og languages The relationship among classes of languages Turing-recognizable decidable context-free regular 4.3 Grammars A language is generated by a grammar if and only if it is recursively enumerable. Kokken January 12, 2007 10

4.3 Grammars Kokken January 12, 2007 11

5. Undecidability 5 Undecidability 5.1 The Halting Problem The language H is not recursive; therefore, the class of recursive languages is a strict subset of the class of recursively enuerable languages. The class of recursively enuerable languages is not closed under complement. Definition: Reduction from L 1 to L 2 Let L 1 and L 2 Σ be languages. A Reduction from L 1 to L 2 is a recursive function τ : Σ Σ such that x L 1 if and only if τ(x) L 2. If L 1 is not recursive, and there is a reduction from L 1 to L 2, then L 2 is also not recursive. The following problems about Turing machines are undecidable: 1. Given a Turing Machine M and an input string w, does M halt on input w? 2. Given a Turing Machine M, does M halt on the empty tape. 3. Given a Turing Machine M, is there any string at all on which M halts? 4. Given two Turing machines M 1 and M 2, do they halt on the same input strings? 5. Given a Turing machine M, is the language that M semidecides regular? Is it context free? Is it recursive? 6. Furthermore, there is a certain fixed machine M, for which the following problem is undecidable: Given w, does M halt on W? 5.2 Unsolvale problems about grammars The following problems about Grammars are undecidable: 1. For a given grammar G and a string w, to determine whether w L(G) 2. For a given grammar G, to determine whether ǫ L(G) Kokken January 12, 2007 12

5.3 Rice s Theorem 3. For two given grammars G 1 and G 2, to determine whether L(G 1 ) = L(G 2 ) 4. For an arbitrary grammar G, to determine whether L(G) = 5. Furthermore, there is a certain fixed grammar G 0, such that it is undecidable to determine whether any given string w is in L(G 0 ) Each of the following problems is undecidable: 1. Given context free grammar G is L(G) = Σ 2. Given two context free grammars G 1 and G 2, is L(G 1 ) = L(G 2 ) 3. Given two pushdown automata M 1 and M 2, do they accept precisely the same language 4. Given a pushdown automaton M, find an equivalent pushdown automaton with as few states as possible. A language is recursive if and only if both it and its complement are recursively enumerable. 5.3 Rice s Theorem Rice s Theorem Suppose that C is a proper, nonempty subset of the class of alll recursively enumerable languages. Then the following prolem is undecidable: Given a Turing machine M, is L(M) C Kokken January 12, 2007 13