CS21 Decidability and Tractability

Slides:



Advertisements
Similar presentations
CSC 361NFA vs. DFA1. CSC 361NFA vs. DFA2 NFAs vs. DFAs NFAs can be constructed from DFAs using transitions: Called NFA- Suppose M 1 accepts L 1, M 2 accepts.
Advertisements

Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
8/27/2009 Sofya Raskhodnikova Intro to Theory of Computation L ECTURE 2 Theory of Computation Finite Automata Operations on languages Nondeterminism L2.1.
January 7, 2015CS21 Lecture 21 CS21 Decidability and Tractability Lecture 2 January 7, 2015.
January 5, 2015CS21 Lecture 11 CS21 Decidability and Tractability Lecture 1 January 5, 2015.
CS21 Decidability and Tractability
Regular operations Sipser 1.2 (pages 47-63). First… a sample proof Latex files on ella.
Introduction to Computability Theory
NFAs Sipser 1.2 (pages 47–54). CS 311 Fall Recall… Last time we showed that the class of regular languages is closed under: –Complement –Union.
NFAs and DFAs Sipser 1.2 (pages 47-63). Last time…
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
NFAs Sipser 1.2 (pages 47–54). CS 311 Mount Holyoke College 2 Recall… Last time we showed that the class of regular languages is closed under: –Complement.
Introduction to Computability Theory
Regular operations Sipser 1.2 (pages 47-63). First… a sample proof
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
CS5371 Theory of Computation
Finite Automata Finite-state machine with no output. FA consists of States, Transitions between states FA is a 5-tuple Example! A string x is recognized.
Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 1 Regular Languages Contents Finite Automata (FA or DFA) definitions, examples,
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Nondeterminism.
Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
1 Non-Deterministic Finite Automata. 2 Alphabet = Nondeterministic Finite Automaton (NFA)
Nondeterminism (Deterministic) FA required for every state q and every symbol  of the alphabet to have exactly one arrow out of q labeled . What happens.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
REGULAR LANGUAGES.
Theory of Languages and Automata
Theory of Computation, Feodor F. Dragan, Kent State University 1 Regular expressions: definition An algebraic equivalent to finite automata. We can build.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
CHAPTER 1 Regular Languages
January 9, 2015CS21 Lecture 31 CS21 Decidability and Tractability Lecture 3 January 9, 2015.
Formal Definition of Computation Let M = (Q, ∑, δ, q 0, F) be a finite automaton and let w = w 1 w w n be a string where each wi is a member of the.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
Chapter 3 Regular Expressions, Nondeterminism, and Kleene’s Theorem Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 1 Regular Languages Some slides are in courtesy.
Lecture Notes 
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
1 Chapter 2 Finite Automata (part a) Hokkaido, Japan.
Theory of Computation Automata Theory Dr. Ayman Srour.
Theory of Computation Automata Theory Dr. Ayman Srour.
Nondeterminism The Chinese University of Hong Kong Fall 2011
Foundations of Computing Science
Non Deterministic Automata
CSE 105 theory of computation
Nondeterministic Finite Automata
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Lecture3 DFA vs. NFA, properties of RL
CS 154, Lecture 3: DFANFA, Regular Expressions.
COSC 3340: Introduction to Theory of Computation
Non-Deterministic Finite Automata
CSE322 Definition and description of finite Automata
Nondeterministic Finite Automata
Non Deterministic Automata
CSE 2001: Introduction to Theory of Computation Fall 2009
Chapter Five: Nondeterministic Finite Automata
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
CS21 Decidability and Tractability
CSE 105 theory of computation
CS21 Decidability and Tractability
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Chapter 1 Regular Language
Finite-State Machines with No Output
CSCI 2670 Introduction to Theory of Computing
CSE 105 theory of computation
CHAPTER 1 Regular Languages
Nondeterminism The Chinese University of Hong Kong Fall 2010
CSE 105 theory of computation
Presentation transcript:

CS21 Decidability and Tractability Lecture 2 January 9, 2019 January 9, 2019 CS21 Lecture 2

Outline Finite Automata Nondeterministic Finite Automata Closure under regular operations NFA, FA equivalence January 5, 2018 CS21 Lecture 2

Finite Automata simple model of computation reads input from left to right, one symbol at a time maintains state: information about what seen so far (“memory”) finite automaton has finite # of states: cannot remember more things for longer inputs 2 ways to describe: by diagram, or formally January 5, 2018 CS21 Lecture 2

FA diagrams (single) start state alphabet Σ = {0,1} 0,1 1 states (several) accept states transition for each symbol 0,1 read input one symbol at a time; follow arrows; accept if end in accept state January 5, 2018 CS21 Lecture 2

L = {x : x∈ 0,1 ∗ , x has even # of 1s} Example FA 1 even odd 1 What language does this FA recognize? L = {x : x∈ 0,1 ∗ , x has even # of 1s} illustrates fundamental feature/limitation of FA: “tiny” memory in this example only “remembers” 1 bit of info. January 9, 2019 CS21 Lecture 2

Example FA Σ = {A,B,C} {Q,N,D} “35 cents” B B A 5 10 15 rej C A C C C Try: AC CBCC AA BBBBBBB CCBC A,C A,B,C A A B B B 20 25 30 35 C A C “35 cents” January 9, 2019 CS21 Lecture 2

FA formal definition A finite automaton is a 5-tuple (Q, Σ, δ, q0, F) Q is a finite set called the states Σ is a finite set called the alphabet δ:Q x Σ → Q is a function called the transition function q0 is an element of Q called the start state F is a subset of Q called the accept states January 9, 2019 CS21 Lecture 2

FA formal definition Specification of this FA in formal terms: 1 even odd 1 Specification of this FA in formal terms: Q = {even, odd} Σ = {0,1} q0 = even F = {even} function δ: δ(even, 0) = even δ(even, 1) = odd δ(odd, 0) = odd δ(odd, 1) = even January 9, 2019 CS21 Lecture 2

Formal description of FA operation finite automaton M = (Q, Σ, δ, q0, F) accepts a string w = w1w2w3…wn ∈ Σ* if ∃ sequence r0,r1,r2,…,rn of states for which r0 = q0 δ(ri, wi+1) = ri+1 for i = 0,1,2, …, n-1 rn ∈ F January 9, 2019 CS21 Lecture 2

What now? We have a model of computation (Maybe this is it. Maybe everything we can do with real computers we can do with FA…) try to characterize the languages FAs can recognize investigate closure under certain operations show that some languages not of this type January 9, 2019 CS21 Lecture 2

Characterizing FA languages We will show that the set of languages recognized by FA is closed under: union “C = (A ∪ B)” concatenation “C = (A ∘ B)” star “ C = A* ” Meaning: if A and B are languages recognized by a FA, then C is a language recognized by a FA January 9, 2019 CS21 Lecture 2

Characterizing FA languages union “C = (A ∪ B)” (A ∪ B) = {x : x ∈ A or x ∈ B or both} concatenation “C = (A ∘ B)” (A ∘ B) = {xy : x ∈ A and y ∈ B} star “ C = A* ” (note: ε always in A*) A* = {x1x2x3…xk: k ≥ 0 and each xi ∈ A} January 9, 2019 CS21 Lecture 2

Concatenation attempt (A ∘ B) = {xy : x ∈ A and y ∈ B} A B What label do we put on the new transitions? January 9, 2019 CS21 Lecture 2

Concatenation attempt ε 1 1 = A B 1 1 Need it to happen “for free”: label with ε (?) allows construct with multiple transitions with the same label (!?) January 9, 2019 CS21 Lecture 2

Nondeterministic FA We will make life easier by describing an additional feature (nondeterminism) that helps us to “program” FAs We will prove that FAs with this new feature can be simulated by ordinary FA same spirit as programming constructs like procedures The concept of nondeterminism has a significant role in TCS and this course. January 9, 2019 CS21 Lecture 2

NFA diagrams At each step, several choices for next state (single) start state states transitions: may have several with a given label (or none) may be labeled with ε (several) accept states At each step, several choices for next state January 9, 2019 CS21 Lecture 2

NFA operation Example of NFA operation: alphabet Σ = {0,1} input: 1 0,ε 1 0,1 0,1 input: 1 not accepted January 9, 2019 CS21 Lecture 2

NFA operation Example of NFA operation: alphabet Σ = {0,1} input: 1 1 0,ε 1 0,1 0,1 input: 1 1 accepted January 9, 2019 CS21 Lecture 2

NFA operation One way to think of NFA operation: string x = x1x2x3…xn accepted if and only if there exists a way of inserting ε’s into x x1εεx2 x3…εxn so that there exists a path of transitions from the start state to an accept state January 9, 2019 CS21 Lecture 2

NFA formal definition A nondeterministic FA is a 5-tuple “powerset of Q”: the set of all subsets of Q transitions labeled with alphabet symbols or ε A nondeterministic FA is a 5-tuple (Q, Σ, δ, q0, F) Q is a finite set called the states Σ is a finite set called the alphabet δ:Q x (Σ ∪ {ε}) → P(Q) is a function called the transition function q0 is an element of Q called the start state F is a subset of Q called the accept states January 9, 2019 CS21 Lecture 2

NFA formal definition Specification of this NFA in formal terms: 1 0,ε 1 s1 s2 s3 s4 0,1 0,1 Specification of this NFA in formal terms: Q = {s1, s2, s3, s4} Σ = {0,1} q0 = s1 F = {s4} δ(s1, 0) = {s1} δ(s1, 1) = {s1, s2} δ(s1, ε) = { } δ(s2, 0) = {s3} δ(s2, 1) = { } δ(s2, ε) = {s3} δ(s3, 0) = { } δ(s3, 1) = {s4} δ(s3, ε) = { } δ(s4, 0) = {s4} δ(s4, 1) = {s4} δ(s4, ε) = { } January 9, 2019 CS21 Lecture 2

Formal description of NFA operation NFA M = (Q, Σ, δ, q0, F) accepts a string w = w1w2w3…wn ∈ Σ ∗ if w can be written (by inserting ε’s) as: y = y1y2y3…ym ∈ (Σ ∪ {ε})* and ∃ sequence r0,r1,…,rm of states for which r0 = q0 ri+1 ∈ δ(ri, yi+1) for i = 0,1,2, …, m-1 rm ∈ F January 9, 2019 CS21 Lecture 2

Closures Recall: want to show the set of languages recognized by NFA is closed under: union “C = (A ∪ B)” concatenation “C = (A ∘ B)” star “ C = A* ” January 9, 2019 CS21 Lecture 2

C = (A ∪ B) = {x : x ∈ A or x ∈ B} Closure under union C = (A ∪ B) = {x : x ∈ A or x ∈ B} ε A A ε B C B January 9, 2019 CS21 Lecture 2

Closure under concatenation C = (A ∘ B) = {xy : x ∈ A and y ∈ B} A B ε ε A B C January 9, 2019 CS21 Lecture 2

C = A* = {x1x2x3…xk: k ≥ 0 and each xi ∈ A} Closure under star C = A* = {x1x2x3…xk: k ≥ 0 and each xi ∈ A} C ε A ε ε A January 9, 2019 CS21 Lecture 2

(usually one is easy, the other more difficult) NFA, FA equivalence Theorem: a language L is recognized by a FA if and only if L is recognized by a NFA. Must prove two directions: (⇒) L is recognized by a FA implies L is recognized by a NFA. (⇐) L is recognized by a NFA implies L is recognized by a FA. (usually one is easy, the other more difficult) January 9, 2019 CS21 Lecture 2

NFA, FA equivalence (⇒) L is recognized by a FA implies L is recognized by a NFA Proof: a finite automaton is a nondeterministic finite automaton that happens to have no ε-transitions, and for which each state has exactly one outgoing transition for each symbol. January 9, 2019 CS21 Lecture 2

NFA, FA equivalence (⇐) L is recognized by a NFA implies L is recognized by a FA. Proof: we will build a FA that simulates the NFA (and thus recognizes the same language). alphabet will be the same what are the states of the FA? January 9, 2019 CS21 Lecture 2

NFA, FA equivalence given NFA M = (Q, Σ, δ, q0, F) 1 0,ε 1 0,1 0,1 given NFA M = (Q, Σ, δ, q0, F) construct FA M’ = (Q’, Σ’, δ’, q0’, F’) same alphabet: Σ’ = Σ states are subsets of M’s states: Q’ = P (Q) if we are in state R ∈ Q’ and we read symbol a ∈ Σ’, what is the new state? January 9, 2019 CS21 Lecture 2

NFA, FA equivalence given NFA M = (Q, Σ, δ, q0, F) 1 0,ε 1 0,1 0,1 given NFA M = (Q, Σ, δ, q0, F) construct FA M’ = (Q’, Σ’, δ’, q0’, F’) Helpful def’n: E(S) = {q ∈ Q : q reachable from S by traveling along 0 or more ε-transitions} new transition fn: δ’(R, a) = ∪ 𝑟∈𝑅 E(δ(r, a)) = “all nodes reachable from R by following an a-transition, and then 0 or more ε-transitions” January 9, 2019 CS21 Lecture 2