CS Automata, Computability and Formal Languages

Similar documents
Chapter 4. Regular Expressions. 4.1 Some Definitions

CSE 105 Homework 1 Due: Monday October 9, Instructions. should be on each page of the submission.

In English, there are at least three different types of entities: letters, words, sentences.

FABER Formal Languages, Automata. Lecture 2. Mälardalen University

Harvard CS121 and CSCI E-121 Lecture 2: Mathematical Preliminaries

Author: Vivek Kulkarni ( )

CS 133 : Automata Theory and Computability

CSCI 340: Computational Models. Regular Expressions. Department of Computer Science

Automata Theory and Formal Grammars: Lecture 1

Mathematical Preliminaries. Sipser pages 1-28

CS6902 Theory of Computation and Algorithms

Theory of Computer Science

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I

A Universal Turing Machine

Lecture 1 09/08/2017

COSE212: Programming Languages. Lecture 1 Inductive Definitions (1)

Nondeterministic Finite Automata and Regular Expressions

Formal Languages, Automata and Models of Computation

What is this course about?

Computational Theory

C1.1 Introduction. Theory of Computer Science. Theory of Computer Science. C1.1 Introduction. C1.2 Alphabets and Formal Languages. C1.

Theory of Computation

CS 455/555: Mathematical preliminaries

CSE 105 THEORY OF COMPUTATION

6.8 The Post Correspondence Problem

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Theory of Computation

CMSC 330: Organization of Programming Languages. Regular Expressions and Finite Automata

CMSC 330: Organization of Programming Languages

COSE212: Programming Languages. Lecture 1 Inductive Definitions (1)

Theoretical Computer Science

Topics in Timed Automata

Harvard CS 121 and CSCI E-207 Lecture 4: NFAs vs. DFAs, Closure Properties

Theory of Computation (Classroom Practice Booklet Solutions)

Recap from Last Time

Formal Languages and Automata

MA/CSSE 474 Theory of Computation

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CS 121, Section 2. Week of September 16, 2013

CS311 Computational Structures Regular Languages and Regular Expressions. Lecture 4. Andrew P. Black Andrew Tolmach

CS 154. Finite Automata vs Regular Expressions, Non-Regular Languages

The Binomial Theorem.

Sri vidya college of engineering and technology

CSE 105 THEORY OF COMPUTATION

Automata Theory CS F-08 Context-Free Grammars

{a, b, c} {a, b} {a, c} {b, c} {a}

Introduction to Automata

TAFL 1 (ECS-403) Unit- III. 3.1 Definition of CFG (Context Free Grammar) and problems. 3.2 Derivation. 3.3 Ambiguity in Grammar

More Properties of Regular Languages

Finite Automata and Regular languages

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

CS 455/555: Finite automata

Automata: a short introduction

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

Set Theory. CSE 215, Foundations of Computer Science Stony Brook University

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

The assignment is not difficult, but quite labour consuming. Do not wait until the very last day.

A canonical semi-deterministic transducer

Chapter 1. Introduction

Section 14.1 Computability then else

FLAC Context-Free Grammars

Context Free Languages. Automata Theory and Formal Grammars: Lecture 6. Languages That Are Not Regular. Non-Regular Languages

Finite Automata and Regular Languages

1. (a) Explain the procedure to convert Context Free Grammar to Push Down Automata.

Section 1 (closed-book) Total points 30

1 Alphabets and Languages

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

The Pumping Lemma and Closure Properties

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

Regular Languages. Problem Characterize those Languages recognized by Finite Automata.

Chapter 3. Regular grammars

Theory of Computation Lecture 1. Dr. Nahla Belal

CSE 105 THEORY OF COMPUTATION

MA/CSSE 474 Theory of Computation

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2017

Decision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012

Finite Automata Part Two

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

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

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CS 154 Introduction to Automata and Complexity Theory

3515ICT: Theory of Computation. Regular languages

CMSC 330: Organization of Programming Languages

CS 154, Lecture 3: DFA NFA, Regular Expressions

Before we show how languages can be proven not regular, first, how would we show a language is regular?

Pushdown Automata. Reading: Chapter 6

CSci 311, Models of Computation Chapter 4 Properties of Regular Languages

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

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

CMSC 330: Organization of Programming Languages. Theory of Regular Expressions Finite Automata

What Is a Language? Grammars, Languages, and Machines. Strings: the Building Blocks of Languages

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Closure Properties of Regular Languages

On Parsing Expression Grammars A recognition-based system for deterministic languages

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

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

CSE 105 Theory of Computation Professor Jeanne Ferrante

Sets are one of the basic building blocks for the types of objects considered in discrete mathematics.

Transcription:

Automata, Computability and Formal Languages Luc Longpré faculty.utep.edu/longpre 1 - Pg 1

Slides : version 3.1 version 1 A. Tapp version 2 P. McKenzie, L. Longpré version 2.1 D. Gehl version 2.2 M. Csűrös, A. Tapp version 3 P. McKenzie, L. Longpré version 3.1 L. Longpré 1 - Pg 2

1. Introduction and preliminaries : (mostly) Textbook, chapter 0. 2. Regular Languages : (Textbook chapter 1) 3. Context-free Languages : (Textbook chapter 2) 4. Turing machines : Textbook, chapter 3. (Fundamental compute power) 5. Undecidability (Ultimate limit to computing) and reductions : Textbook chapter 4 and 5. 6. Time complexity : P and NP (Textbook chapter 7) 1 - Pg 3

1.1 Review : proof techniques 1 - Pg 4

Technique : by contradiction If the negation of a statement implies a contradiction, then the statement is true. Theorem (Sipser 0.14) : 2 is irrational. Proof : 1 - Pg 5

Leading to a contradiction, suppose that a, b N such that 2 = a where GCD(a, b) = 1. b Clearly a 2 = 2 = a2 2b 2 = a 2 b b 2 so a = 2k (i.e. a 2 even implies a even). Also, 2b 2 = (2k) 2 2b 2 = 4k 2 b 2 = 2k 2 so b = 2l (i.e. b 2 even implies b even). But we now have that 2 divides a and b. Contradiction! (GCD(a, b) = 1) We conclude that 2 a, for all a, b N. b Q.E.D. 1 - Pg 6

Let P be a predicate, i.e. P is a function N {0} {true, false}. NB : the following are equivalent for us : P (197) = true P (197) is true or just P (197). 1 - Pg 7

Technique : mathematical induction If then P (n 0 ), P (n 0 + 1),..., P (n 0 + x) are all true and separately for each n > n 0 + x, [P (n 0 ),..., P (n 2), P (n 1)] imply P (n) true P (i) is true for all i n 0. 1 - Pg 8

Technique : If A B and B A then A = B. Proposition : A B = A B. Proof : 1 - Pg 9

A B A B : If x A B then x A B then x A and x B then x A and x B hence x A B. A B A B : If x A B then x A and x B and x A and x B so x A B hence x A B. Q.E.D. 1 - Pg 10

Technique : Pigeonhole Principle If we place n + 1 objects in n boxes, there will be at least one box with more than one object. 1 - Pg 11

Problem : Can we position 13 players on a field of size 12m 12m such that players are at a distance of more than 5m from each other? 1 - Pg 12

Leading to a contradiction, suppose 13 players are positioned. 12 12 = 144 squares 13 π2.5 2 = 255.26 occupied by 13 players 144 < 255.26... contradiction?! Yes but... (12 + 2.5 + 2.5)(12 + 2.5 + 2.5) = 289 289 > 255.26 We need to find something else! 1 - Pg 13

Divide the field in rectangles of 3m 4m. There are 12 such rectangles. Two players must be in the same rectangle (pigeonhole principle!). The diagonal of a rectangle is : 32 + 4 2 = 5 meters. So there must be two players at a distance of 5m or less! Q.E.D. 1 - Pg 14

Technique : diagonalisation intro Paradox, hairy version : A woman cuts the hair of precisely all women in her village that don t cut their own hair. Who cuts the hair of this woman? Paradox, internet version : Consider the set W of all web pages having a link toward themselves. Can we build a web page with a link to all web pages of W and at no other web pages? 1 - Pg 15

Diagonalisation Let R be a binary relation on A. Example : A = {a, b, c, d} R a b c d a x x b x x c x d x x 1 - Pg 16

a A, define Example : R a = {b b A and (a, b) R} R a b c d a x x b x x c x d x x R a = {b, d} R b = {b, c} R c = {c} R d = {a, b} Then ( a A) R a D = {b b A and (b, b) / R} The D in this example is {a, d}. 1 - Pg 17

Haircut theorem. There is no village where one of the woman from this village cuts the hair of exactly all women of this village that don t cut their own hair. Proof. Leading to a contradiction, suppose such a village exists. Let F be the set of women from this village. 1 - Pg 18

Let R F F be the relation (a, b) R iff a cuts the hair of b. Let f be the woman that cuts the hair of all women in the village that don t cut their own hair. So we have that R f (=by definition the set of women that get their hair cut by f) is {b b F and (b, b) / R}. This is a contradiction since R f would be the diagonal set D for this relation R. So such a village cannot exist. Q.E.D. 1 - Pg 19

1.2 Langages (Textbook, pages 13-14) 1 - Pg 20

Définition : An alphabet is a finite set of symbols. Ex : Σ 1 = {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z} Σ 2 = {a, b} Σ 3 = {0, 1} Σ 4 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Σ 5 = {,,, } Σ 6 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, +,,, /, (, )} Σ 7 = ASCII = {Adenine, Cytosine, Guanine, Thymine} Σ ADN 1 - Pg 21

Definition : A string over an alphabet is a finite sequence of symbols from the alphabet. Definition : ε denotes the empty string. Definition : Σ is the set of all strings that over an alphabet Σ. Definition : Σ ε = Σ {ε}. Note : ε Σ. 1 - Pg 22

Examples : Σ 2 = {a, b} Σ 2 = {ε, a, b, aa, ab, ba, bb, aaa, aab, } Σ 3 = {0, 1} Σ 3 = {ε, 0, 1, 00, 01, 10, 11, 000, 001, 010, } Σ 6 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, +,,, /, (, )} Σ 6 (25 + 50) 56 Σ 6 (()25 + + + 6 1 - Pg 23

Definition : Let w = w 1 w 2... w k Σ then Ex : hello = 5 w = k. Definition : Let w = w 1 w 2... w k Σ and a Σ then w a = #{w i w i = a}. Ex : yabadabadoo a = 4 yabadabadoo b = 2 1 - Pg 24

Definition : Let x = x 1 x 2... x k Σ and y = y 1 y 2... y l Σ then is the concatenation of x and y. Note : w ε = w. Ex : x y = x 1 x 2... x k y 1 y 2... y l hel lo = hello hi ε = hi 1 - Pg 25

Definition : Let < Σ be a total order on alphabet Σ, The lexicographic order of strings over Σ is defined as follows : w < w w < Σ w w = w w = x a y w = x b z w < Σ w a < Σ b Ex : Σ = {0, 1} Σ = {ε, 0, 1, 00, 01, 10, 11, 000, 001, 010, 011, 100, 101, 110, 111, 0000, 0001,...} 1 - Pg 26

Definition : Let L Σ, we say that L is a language on alphabet Σ. Definition : We write {} or for the empty language, i.e. the language that has no string in it. Note : ε. 1 - Pg 27

Ex : Various languages (Σ = {a, b}) L 1 = {a, abba, abbb, b} L 2 = {w w = 2k, k N} = {ε, aa, ab, ba, bb, aaaa, aaab, aaba, aabb,...} L 3 = {w w = aw, w Σ } = {a, aa, ab, aaa, aab, aba, abb, aaaa,...} L 4 = {w w a = w b } = {ε, ab, ba, aabb, abab, abba, baab, baba,...} L 5 = {w w a w b P rime} = {aaab,..., aabbabaaaaa,...} 1 - Pg 28

Ex : Various languages (Σ = ASCII) L 6 = {w PROG(w) returns true where PROG(w) is a java program with w for code} L 7 = {w w compiles without errors in C } L 8 = {w w is a C++ program that writes Hello world! } 1 - Pg 29

Definition : Union A B = {w w A or w B} Ex : Let Σ = {a, b} and L 1 = {ε, a, aa} and L 2 = {a, bb}. L 1 L2 = {ε, a, aa, bb} Definition : Intersection A B = {w w A and w B} Ex : L 1 L2 = {a} Ex : L 1 = 1 - Pg 30

Definition : Complement A = {w w A}. More precisely, let U be the universal set, then A = {w w U et w A}. Ex : Let Σ = {a, b} and L 1 = {ε, a, aa} L 1 = {b, ab, ba, bb, aaa, aab, aba, baa, bba,...} 1 - Pg 31

Definition : Cartesian Product A B = {(x, y) x A and y B} Ex : Let Σ = {a, b} and L 1 = {ε, a, aa} and L 2 = {a, bb}. L 1 L 2 = {(ε, a), (ε, bb), (a, a), (a, bb), (aa, a), (aa, bb)} Note : A B = A B. Note : A =. 1 - Pg 32

Definition : Power set P(A) = 2 A = {B B A} Ex : P(L 1 ) = {, {ε}, {a}, {aa}, {ε, a}, {ε, aa}, {a, aa}, {ε, a, aa}} Note : P(A) = 2 A. 1 - Pg 33

Définition : Concatenation Let L 1 and L 2 be two languages over alphabet Σ. Then L 1 L 2 = {x y x L 1 et y L 2 } the concatenation of languages L 1 et L 2. Ex : Let Σ = {a, b} and L 1 = {ε, a, aa} and L 2 = {a, bb}. L 1 L 2 = {a, bb, aa, abb, aaa, aabb} Note : A B A B. Note : A =. 1 - Pg 34

Definition : Kleene star Let L be a language on alphabet Σ then L = {w = x 1 x 2 x k k 0 and x i L } is the Kleene star closure of L. Ex : L 2 = {ε, a, bb, aa, abb, bba, bbbb, aaa, aabb,...} Note : = {ε} = {ε} for every other language L, L = 1 - Pg 35