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

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

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

Theory of Computation (I) Yijia Chen Fudan University

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

COM364 Automata Theory Lecture Note 2 - Nondeterminism

Automata and Languages

CS 455/555: Finite automata

Theory of Computation Lecture 1. Dr. Nahla Belal

CS 154. Finite Automata, Nondeterminism, Regular Expressions

Nondeterministic Finite Automata

Equivalence of DFAs and NFAs

Theory of Computation

3515ICT: Theory of Computation. Regular languages

Automata and Formal Languages - CM0081 Non-Deterministic Finite Automata

Lecture 3: Nondeterministic Finite Automata

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,

Finite Automata and Regular languages

Inf2A: Converting from NFAs to DFAs and Closure Properties

Formal Models in NLP

INF Introduction and Regular Languages. Daniel Lupp. 18th January University of Oslo. Department of Informatics. Universitetet i Oslo

CS 154 Introduction to Automata and Complexity Theory

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

UNIT-II. NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: SIGNIFICANCE. Use of ε-transitions. s t a r t. ε r. e g u l a r

Chapter Five: Nondeterministic Finite Automata

CS 154, Lecture 3: DFA NFA, Regular Expressions

Intro to Theory of Computation

Nondeterministic Finite Automata

Non-deterministic Finite Automata (NFAs)

Computational Models Lecture 2 1

Sri vidya college of engineering and technology

Lecture 4 Nondeterministic Finite Accepters

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism

CSE 105 THEORY OF COMPUTATION

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CSE 105 Theory of Computation Professor Jeanne Ferrante

Peter Wood. Department of Computer Science and Information Systems Birkbeck, University of London Automata and Formal Languages

Deterministic Finite Automata. Non deterministic finite automata. Non-Deterministic Finite Automata (NFA) Non-Deterministic Finite Automata (NFA)

Regular Expressions. Definitions Equivalence to Finite Automata

Closure under the Regular Operations

Theory of Computation (II) Yijia Chen Fudan University

Computational Models Lecture 2 1

Automata and Formal Languages - CM0081 Finite Automata and Regular Expressions

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

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Nondeterminism and Epsilon Transitions

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT.

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

Languages. Non deterministic finite automata with ε transitions. First there was the DFA. Finite Automata. Non-Deterministic Finite Automata (NFA)

Outline. Nondetermistic Finite Automata. Transition diagrams. A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F)

Nondeterministic finite automata

Nondeterministic Finite Automata. Nondeterminism Subset Construction

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

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

Theory of Languages and Automata

CPS 220 Theory of Computation REGULAR LANGUAGES

Lecture 1: Finite State Automaton

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Finite Automata Part Two

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

Computational Models - Lecture 1 1

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) September,

Closure under the Regular Operations

CSE443 Compilers. Dr. Carl Alphonce 343 Davis Hall

Fooling Sets and. Lecture 5

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata

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

Computational Models - Lecture 4

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CSC173 Workshop: 13 Sept. Notes

Final exam study sheet for CS3719 Turing machines and decidability.

What we have done so far

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

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

Lecture 17: Language Recognition

Computational Models: Class 3

Course 4 Finite Automata/Finite State Machines

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

Theory of computation: initial remarks (Chapter 11)

Computational Models Lecture 5

Recitation 2 - Non Deterministic Finite Automata (NFA) and Regular OctoberExpressions

DM17. Beregnelighed. Jacob Aae Mikkelsen

Constructions on Finite Automata

CSC236 Week 11. Larry Zhang

CSE 105 THEORY OF COMPUTATION

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

CS243, Logic and Computation Nondeterministic finite automata

Uses of finite automata

Computational Models #1

Chapter 6: NFA Applications

Constructions on Finite Automata

CPSC 421: Tutorial #1

Finite Automata. Seungjin Choi

CONCATENATION AND KLEENE STAR ON DETERMINISTIC FINITE AUTOMATA

Computational Models - Lecture 3 1

CSE 105 THEORY OF COMPUTATION

CS 581: Introduction to the Theory of Computation! Lecture 1!

Concatenation. The concatenation of two languages L 1 and L 2

CMSC 330: Organization of Programming Languages

Further discussion of Turing machines

Closure Properties of Regular Languages

Transcription:

Introduction to the Theory of Computation Automata 1VO + 1PS Lecturer: Dr. Ana Sokolova http://cs.uni-salzburg.at/~anas/

Setup and Dates Lectures and Instructions 23.10. 3.11. 17.11. 24.11. 1.12. 11.12. 18.12. Books Introduction to the Theory of Computation by M. Sipser Introduction to Automata Theory, Languages, and Computation by J. E. Hopcroft, R. Motwani, and J.D. Ullman

Setup and Dates Lectures and Instructions 23.10. 3.11. 17.11. 24.11. 1.12. 11.12. 18.12. Books automata Introduction to the Theory of Computation by M. Sipser Introduction to Automata Theory, Languages, and Computation by J. E. Hopcroft, R. Motwani, and J.D. Ullman

Setup and Dates Lectures and Instructions 23.10. 3.11. 17.11. 24.11. 1.12. 11.12. 18.12. Books automata grammars Introduction to the Theory of Computation by M. Sipser Introduction to Automata Theory, Languages, and Computation by J. E. Hopcroft, R. Motwani, and J.D. Ullman

Setup and Dates Lectures and Instructions 23.10. 3.11. 17.11. 24.11. 1.12. 11.12. 18.12. Books automata grammars pushdown automata Introduction to the Theory of Computation by M. Sipser Introduction to Automata Theory, Languages, and Computation by J. E. Hopcroft, R. Motwani, and J.D. Ullman

Setup and Dates Lectures and Instructions 23.10. 3.11. 17.11. 24.11. 1.12. 11.12. 18.12. Books automata grammars pushdown automata Turing machines Introduction to the Theory of Computation by M. Sipser Introduction to Automata Theory, Languages, and Computation by J. E. Hopcroft, R. Motwani, and J.D. Ullman

Setup and Dates Lectures and Instructions 23.10. 3.11. 17.11. 24.11. 1.12. 11.12. 18.12. Books automata grammars pushdown automata Turing machines Introduction to the Theory of Computation by M. Sipser Introduction to Automata Theory, Languages, and Computation by J. E. Hopcroft, R. Motwani, and J.D. Ullman computability

The Rules... Instructions Starting in 2 weeks Instruction exercises on the web http://cs.uni-salzburg.at/~anas/ana_sokolova/ Automata2015.html after class To be solved by you, the students, (in groups of at most 3 people) and handed in as homework at the next meeting. In class I will present a sample solution and you, the students, will be asked to present solutions/discuss the exercises

The Rules... Instructions One randomly chosen exercise will be graded each week The graded exercise will be returned at the next meeting. Grade based on (1) exam (2) the grades of the corrected exercise and (3) activity in class (ability to present solutions) All information about the course / rules / exams / grading is / will be on the course webpage

The Rules... Grading Written exam on December 18, 10 am - 12:30 pm Grade based on the number of points on the written exam (80%), homework grades, and activity in class (20%) For better grade oral exam after the written one upon appointment 55% of the maximal points are needed to pass.

Finite Automata

Alphabets and Languages Alphabet and words if y is not free in P and Q

Alphabets and Languages - alphabet (finite set) n = {a1a2..an ai } is the set of words of length n * = {w n N. a1, a2,.., an. w = a1a2..an} is the set of all words over Alphabet and words if y is not free in P and Q

Alphabets and Languages 0 = {ℇ} contains only the empty word - alphabet (finite set) n = {a1a2..an ai } is the set of words of length n * = {w n N. a1, a2,.., an. w = a1a2..an} is the set of all words over Alphabet and words if y is not free in P and Q

Alphabets and Languages 0 = {ℇ} contains only the empty word - alphabet (finite set) n = {a1a2..an ai } is the set of words of length n * = {w n N. a1, a2,.., an. w = a1a2..an} is the set of all words over Alphabet and words A language L over is a subset L * if y is not free in P and Q

Deterministic Automata (DFA) Informal example = {0,1} M1: 1 0 0 q0 q1 1 if y is not free in P and Q

Deterministic Automata (DFA) alphabet Informal example = {0,1} M1: 1 0 0 q0 q1 1 if y is not free in P and Q

Deterministic Automata (DFA) alphabet Informal example = {0,1} M1: 1 0 0 q0, q1 are states q0 q1 1 if y is not free in P and Q

Deterministic Automata (DFA) alphabet Informal example = {0,1} M1: 1 0 0 q0, q1 are states q0 q1 q0 is initial 1 if y is not free in P and Q

Deterministic Automata (DFA) alphabet Informal example = {0,1} M1: 1 0 0 q0, q1 are states q0 q1 q0 is initial 1 q1 is final if y is not free in P and Q

Deterministic Automata (DFA) alphabet Informal example = {0,1} M1: 1 0 0 q0, q1 are states q0 is initial q0 1 q1 q1 is final if y is not free in P and Q transitions, labelled by alphabet symbols

Deterministic Automata (DFA) alphabet Informal example = {0,1} M1: 1 0 0 q0, q1 are states q0 is initial q0 1 q1 q1 is final if y is not free in P and Q transitions, labelled by alphabet symbols Accepts the language L(M1) = {w * w ends with a 0} = * 0

Deterministic Automata (DFA) alphabet Informal example = {0,1} M1: 1 0 0 q0, q1 are states q0 is initial q0 1 q1 q1 is final if y is not free in P and Q transitions, labelled by alphabet symbols Accepts the language L(M1) = {w * w ends with a 0} = * 0 regular language

Deterministic Automata (DFA) alphabet Informal example = {0,1} M1: 1 0 0 q0, q1 are states q0 is initial q0 1 q1 q1 is final if y is not free in P and Q transitions, labelled by alphabet symbols Accepts the language L(M1) = {w * w ends with a 0} = * 0 regular language regular expression

DFA Definition A deterministic finite automaton M is a tuple M = (Q,, δ, q0, F) where Q is a finite set of states is a finite alphabet δ: Q x Q is the transition function q0 is the initial state, q0 Q if y is not free in P and Q F is a set of final states, F Q

DFA Definition A deterministic finite automaton M is a tuple M = (Q,, δ, q0, F) where Q is a finite set of states is a finite alphabet δ: Q x Q is the transition function q0 is the initial state, q0 Q if y is not free in P and Q F is a set of final states, F Q In the example M

DFA Definition A deterministic finite automaton M is a tuple M = (Q,, δ, q0, F) where Q is a finite set of states is a finite alphabet δ: Q x Q is the transition function q0 is the initial state, q0 Q if y is not free in P and Q F is a set of final states, F Q In the example M M1 = (Q,, δ, q0, F) for

DFA Definition A deterministic finite automaton M is a tuple M = (Q,, δ, q0, F) where Q is a finite set of states is a finite alphabet δ: Q x Q is the transition function q0 is the initial state, q0 Q if y is not free in P and Q F is a set of final states, F Q In the example M M1 = (Q,, δ, q0, F) for Q = {q0, q1}

DFA Definition A deterministic finite automaton M is a tuple M = (Q,, δ, q0, F) where Q is a finite set of states is a finite alphabet δ: Q x Q is the transition function q0 is the initial state, q0 Q if y is not free in P and Q F is a set of final states, F Q In the example M M1 = (Q,, δ, q0, F) for Q = {q0, q1} = {0, 1}

DFA Definition A deterministic finite automaton M is a tuple M = (Q,, δ, q0, F) where Q is a finite set of states is a finite alphabet δ: Q x Q is the transition function q0 is the initial state, q0 Q if y is not free in P and Q F is a set of final states, F Q In the example M M1 = (Q,, δ, q0, F) for Q = {q0, q1} = {0, 1} F = {q1}

DFA Definition A deterministic finite automaton M is a tuple M = (Q,, δ, q0, F) where Q is a finite set of states is a finite alphabet δ: Q x Q is the transition function q0 is the initial state, q0 Q if y is not free in P and Q F is a set of final states, F Q In the example M M1 = (Q,, δ, q0, F) for Q = {q0, q1} = {0, 1} F = {q1} δ(q0, 0) = q1,δ(q0, 1) = q0 δ(q1, 0) = q1, δ(q1, 1) = q0

DFA The extended transition function if y is not free in P and Q

DFA The extended transition function Given M = (Q,, δ, q0, F) we can extend δ: Q x Q to δ * : Q x * Q inductively, by: δ * (q, ε) = q and δ * (q,wa) = δ(δ * (q,w), a) if y is not free in P and Q

DFA The extended transition function Given M = (Q,, δ, q0, F) we can extend δ: Q x Q to δ * : Q x * Q In M1, δ * (q0,110010) = q1 inductively, by: if y is not free in P and Q δ * (q, ε) = q and δ * (q,wa) = δ(δ * (q,w), a)

DFA The extended transition function Given M = (Q,, δ, q0, F) we can extend δ: Q x Q to δ * : Q x * Q In M1, δ * (q0,110010) = q1 inductively, by: if y is not free in P and Q δ * (q, ε) = q and δ * (q,wa) = δ(δ * (q,w), a) Definition The language recognised / accepted by a deterministic finite automaton M = (Q,, δ, q0, F) is L(M) = {w * δ * (q0,w) F}

DFA The extended transition function Given M = (Q,, δ, q0, F) we can extend δ: Q x Q to δ * : Q x * Q In M1, δ * (q0,110010) = q1 inductively, by: if y is not free in P and Q δ * (q, ε) = q and δ * (q,wa) = δ(δ * (q,w), a) Definition The language recognised / accepted by a deterministic finite automaton M = (Q,, δ, q0, F) is L(M) = {w * δ * (q0,w) F} L(M1) = {w0 w {0,1} * }

Regular languages and operations Definition Let be an alphabet. A language L over (L * ) is regular iff it is recognised by a DFA.

Definition Regular languages and operations Let be an alphabet. A language L over (L * ) is regular iff it is recognised by a DFA. L(M1) = {w0 w {0,1} * } is regular

Definition Regular languages and operations Let be an alphabet. A language L over (L * ) is regular iff it is recognised by a DFA. L(M1) = {w0 w {0,1} * } is regular Regular operations

Definition Regular languages and operations Let be an alphabet. A language L over (L * ) is regular iff it is recognised by a DFA. L(M1) = {w0 w {0,1} * } is regular Regular operations Let L, L1, L2 be languages over. Then L1 L2, L1 L2, and L * are languages, where L1 L2 = {w1 w2 w1 L1,w2 L2} L * = {w n N. w1, w2,.., wn L. w = w1w2..wn}

Definition Regular languages and operations Let be an alphabet. A language L over (L * ) is regular iff it is recognised by a DFA. L(M1) = {w0 w {0,1} * } is regular Regular operations Let L, L1, L2 be languages over. Then L1 L2, L1 L2, and L * are languages, where L1 L2 = {w1 w2 w1 L1,w2 L2} L * = {w n N. w1, w2,.., wn L. w = w1w2..wn} ℇ L * always

Definition Regular expressions

finite representation of infinite languages Regular expressions Definition

finite representation of infinite languages Regular expressions Definition Let be an alphabet. The following are regular expressions 1. a for a 2. ε 3. 4. (R1 R2) for R1, R2 regular expressions 5. (R1 R2) for R1, R2 regular expressions 6. (R1) * for R1 regular expression

Regular expressions inductive finite representation of infinite languages Definition Let be an alphabet. The following are regular expressions 1. a for a 2. ε 3. 4. (R1 R2) for R1, R2 regular expressions 5. (R1 R2) for R1, R2 regular expressions 6. (R1) * for R1 regular expression

finite representation of infinite languages Regular expressions Definition inductive example: (ab a) * Let be an alphabet. The following are regular expressions 1. a for a 2. ε 3. 4. (R1 R2) for R1, R2 regular expressions 5. (R1 R2) for R1, R2 regular expressions 6. (R1) * for R1 regular expression

finite representation of infinite languages Regular expressions Definition inductive example: (ab a) * Let be an alphabet. The following are regular expressions 1. a for a corresponding languages L(a) = {a} 2. ε L(ε) = {ε} 3. L( ) = 4. (R1 R2) for R1, R2 regular expressions L(R1 R2) = L(R1) L(R2) 5. (R1 R2) for R1, R2 regular expressions L(R1 R2) = L(R1) L(R2) 6. (R1) * for R1 regular expression L(R1 * ) = L(R1) *

Equivalence of regular expressions and regular languages if y is not free in P and Q

Equivalence of regular expressions and regular languages Theorem (Kleene) A language is regular (i.e., recognised by a finite automaton) iff it is the language of a regular expression. if y is not free in P and Q

Equivalence of regular expressions and regular languages Theorem (Kleene) A language is regular (i.e., recognised by a finite automaton) iff it is the language of a regular expression. Proof easy, via the closure if y is not free in P and Q properties discussed next, not so easy, we ll skip it for now

Closure under regular operations

Closure under regular operations Theorem C1 The class of regular languages is closed under union

Closure under regular operations also under intersection Theorem C1 The class of regular languages is closed under union

Closure under regular operations also under intersection Theorem C1 The class of regular languages is closed under union Theorem C2 The class of regular languages is closed under complement

Closure under regular operations also under intersection Theorem C1 The class of regular languages is closed under union Theorem C2 The class of regular languages is closed under complement Theorem C3 The class of regular languages is closed under concatenation

Closure under regular operations also under intersection Theorem C1 The class of regular languages is closed under union Theorem C2 The class of regular languages is closed under complement Theorem C3 The class of regular languages is closed under concatenation Theorem C4 The class of regular languages is closed under Kleene star

Closure under regular operations also under intersection Theorem C1 The class of regular languages is closed under union We can already prove these Theorem C2 The class of regular languages is closed under complement Theorem C3 The class of regular languages is closed under concatenation Theorem C4 The class of regular languages is closed under Kleene star

Closure under regular operations also under intersection Theorem C1 The class of regular languages is closed under union We can already prove these Theorem C2 The class of regular languages is closed under complement Theorem C3 The class of regular languages is closed under concatenation But not yet these two Theorem C4 The class of regular languages is closed under Kleene star

Nondeterministic Automata (NFA) Informal example = {0,1} M2: 0,1 q0 1 q1 0,ε q2 1 q3 0,1

Nondeterministic Automata (NFA) Informal example = {0,1} M2: 0,1 q0 1 q1 0,ε q2 1 q3 0,1 sources of nondeterminism

Nondeterministic Automata (NFA) Informal example = {0,1} M2: 0,1 q0 1 q1 0,ε q2 1 q3 0,1 sources of nondeterminism

Nondeterministic Automata (NFA) Informal example = {0,1} M2: 0,1 q0 1 q1 0,ε q2 1 q3 0,1 sources of nondeterminism

Nondeterministic Automata (NFA) no 1 transition Informal example = {0,1} M2: 0,1 q0 1 q1 0,ε q2 1 q3 0,1 sources of nondeterminism

Nondeterministic Automata (NFA) no 1 transition Informal example no 0 transition = {0,1} M2: 0,1 q0 1 q1 0,ε q2 1 q3 0,1 sources of nondeterminism

Nondeterministic Automata (NFA) no 1 transition Informal example no 0 transition = {0,1} M2: 0,1 q0 1 q1 0,ε q2 1 q3 0,1 sources of nondeterminism Accepts a word iff there exists an accepting run

NFA Definition A nondeterministic automaton M is a tuple M = (Q,, δ, q0, F) where Q is a finite set of states is a finite alphabet δ: Q x ε P(Q) is the transition function q0 is the initial state, q0 Q F is a set of final states, F Q if y is not free in P and Q

NFA Definition A nondeterministic automaton M is a tuple M = (Q,, δ, q0, F) where Q is a finite set of states is a finite alphabet ε = {ε} δ: Q x ε P(Q) is the transition function q0 is the initial state, q0 Q if y is not free in P and Q F is a set of final states, F Q

NFA Definition A nondeterministic automaton M is a tuple M = (Q,, δ, q0, F) where Q is a finite set of states is a finite alphabet ε = {ε} δ: Q x ε P(Q) is the transition function q0 is the initial state, q0 Q if y is not free in P and Q F is a set of final states, F Q In the example M

NFA Definition A nondeterministic automaton M is a tuple M = (Q,, δ, q0, F) where Q is a finite set of states is a finite alphabet ε = {ε} δ: Q x ε P(Q) is the transition function q0 is the initial state, q0 Q if y is not free in P and Q F is a set of final states, F Q In the example M M2 = (Q,, δ, q0, F) for

NFA Definition A nondeterministic automaton M is a tuple M = (Q,, δ, q0, F) where Q is a finite set of states is a finite alphabet ε = {ε} δ: Q x ε P(Q) is the transition function q0 is the initial state, q0 Q if y is not free in P and Q F is a set of final states, F Q In the example M M2 = (Q,, δ, q0, F) for Q = {q0, q1, q2, q3}

NFA Definition A nondeterministic automaton M is a tuple M = (Q,, δ, q0, F) where Q is a finite set of states is a finite alphabet ε = {ε} δ: Q x ε P(Q) is the transition function q0 is the initial state, q0 Q if y is not free in P and Q F is a set of final states, F Q In the example M M2 = (Q,, δ, q0, F) for Q = {q0, q1, q2, q3} = {0, 1}

NFA Definition A nondeterministic automaton M is a tuple M = (Q,, δ, q0, F) where Q is a finite set of states is a finite alphabet ε = {ε} δ: Q x ε P(Q) is the transition function q0 is the initial state, q0 Q if y is not free in P and Q F is a set of final states, F Q In the example M M2 = (Q,, δ, q0, F) for Q = {q0, q1, q2, q3} = {0, 1} F = {q3}

NFA Definition A nondeterministic automaton M is a tuple M = (Q,, δ, q0, F) where Q is a finite set of states is a finite alphabet ε = {ε} δ: Q x ε P(Q) is the transition function q0 is the initial state, q0 Q if y is not free in P and Q F is a set of final states, F Q In the example M Q = {q0, q1, q2, q3} = {0, 1} F = {q3} M2 = (Q,, δ, q0, F) for δ(q0, 0) = {q0} δ(q0, 1) = {q0,q1} δ(q0, ε) =..