INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.

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.
Deterministic Finite Automata (DFA)
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
Introduction to Computability Theory
Finite Automata Great Theoretical Ideas In Computer Science Anupam Gupta Danny Sleator CS Fall 2010 Lecture 20Oct 28, 2010Carnegie Mellon University.
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata Prof. Amos Israeli.
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
1 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY (For next time: Read Chapter 1.3 of the book)
Costas Busch - RPI1 Single Final State for NFAs. Costas Busch - RPI2 Any NFA can be converted to an equivalent NFA with a single final state.
Finite Automata and Non Determinism
CS5371 Theory of Computation
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
CS 310 – Fall 2006 Pacific University CS310 Converting NFA to DFA Sections:1.2 Page 54 September 15, 2006.
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata (cont.) Prof. Amos Israeli.
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.
Fall 2004COMP 3351 Single Final State for NFA. Fall 2004COMP 3352 Any NFA can be converted to an equivalent NFA with a single final state.
1 Single Final State for NFAs and DFAs. 2 Observation Any Finite Automaton (NFA or DFA) can be converted to an equivalent NFA with a single final state.
Lecture 7 Sept 22, 2011 Goals: closure properties regular expressions.
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.
Fall 2006Costas Busch - RPI1 Non-Deterministic Finite Automata.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
FSA Lecture 1 Finite State Machines. Creating a Automaton  Given a language L over an alphabet , design a deterministic finite automaton (DFA) M such.
1 Non-Deterministic Automata Regular Expressions.
1 Regular Languages Finite Automata eg. Supermarket automatic door: exit or entrance.
Costas Busch - LSU1 Non-Deterministic Finite Automata.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
1 A Single Final State for Finite Accepters. 2 Observation Any Finite Accepter (NFA or DFA) can be converted to an equivalent NFA with a single final.
Fall 2004COMP 3351 Regular Expressions. Fall 2004COMP 3352 Regular Expressions Regular expressions describe regular languages Example: describes the language.
Great Theoretical Ideas in Computer Science.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
Regular Expressions (RE) Empty set Φ A RE denotes the empty set Empty string λ A RE denotes the set {λ} Symbol a A RE denotes the set {a} Alternation M.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
REGULAR LANGUAGES.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong NFA to DFA.
Great Theoretical Ideas in Computer Science.
CSCI 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Text search.
CSCI 2670 Introduction to Theory of Computing August 26, 2004.
CSCI 2670 Introduction to Theory of Computing August 25, 2005.
CSCI 2670 Introduction to Theory of Computing September 1, 2005.
Lecture 5 Sept 06, 2012 Regular expressions – examples Converting DFA to regular expression. (same works for NFA to r.e. conversion.) Converting R.E. to.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
UNIT - I Formal Language and Regular Expressions: Languages Definition regular expressions Regular sets identity rules. Finite Automata: DFA NFA NFA with.
Finite Automata Great Theoretical Ideas In Computer Science Victor Adamchik Danny Sleator CS Spring 2010 Lecture 20Mar 30, 2010Carnegie Mellon.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
 2004 SDU Lecture4 Regular Expressions.  2004 SDU 2 Regular expressions A third way to view regular languages. Say that R is a regular expression if.
Complexity and Computability Theory I Lecture #5 Rina Zviel-Girshin Leah Epstein Winter
Finite Automata A simple model of computation. 2 Finite Automata2 Outline Deterministic finite automata (DFA) –How a DFA works.
P Symbol Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
Foundations of Computing Science
Non Deterministic Automata
Properties of Regular Languages
CSE 105 theory of computation
Finite Automata & Regular Languages
Single Final State for NFA
Intro to Theory of Computation
Non-Deterministic Finite Automata
CS 154, Lecture 3: DFANFA, Regular Expressions.
COSC 3340: Introduction to Theory of Computation
Non-Deterministic Finite Automata
Non Deterministic Automata
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
Chapter 1 Regular Language
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
Intro to Theory of Computation
Presentation transcript:

INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011

THE REGULAR OPERATIONS Union: A  B = { w | w  A or w  B } Intersection: A  B = { w | w  A and w  B } Negation:  A = { w | w  A } Reverse: A R = { w 1 …w k | w k …w 1  A } Concatenation: A  B = { vw | v  A and w  B } Star: A* = { w 1 …w k | k ≥ 0 and each w i  A }

,1 0

NON -DETERMINISM ,1 0 An NFA accepts if there is a series of choices that take it to an accept state

Deterministic Computation Non-Deterministic Computation accept or rejectaccept reject

Theorem: Every NFA has an equivalent DFA Corollary: A language is regular iff it is recognized by an NFA

FROM NFA TO DFA Input: N = (Q, Σ, , Q 0, F) Output: M = (Q, Σ, , q 0, F) accept reject To learn if NFA accepts, we could do the computation in parallel, maintaining the set of states where all threads are Q = (Q) Idea:

 (R,  ) =  ε(  (r,  ) ) Q = (Q)  : Q  Σ → Q  (R,  ) =  ε(  (r,  ) ) rRrR q 0 = ε(Q 0 ) F = { R  Q | f  R for some f  F } FROM NFA TO DFA Input: N = (Q, Σ, , Q 0, F) Output: M = (Q, Σ, , q 0, F)  (R,  ) =  ε(  (r,  ) )

EXAMPLES: NFA TO DFA 1 0,1 ε a b 1

REGULAR LANGUAGES CLOSED UNDER CONCATENATION Given DFAs M 1 and M 2, construct NFA by connecting all accept states in M 1 to start states in M 2 ε ε L(M 1 )=A L(M 2 )=B

REGULAR LANGUAGES ARE CLOSED UNDER REGULAR OPERATIONS Union: A  B = { w | w  A or w  B } Intersection: A  B = { w | w  A and w  B } Negation:  A = { w | w  A } Reverse: A R = { w 1 …w k | w k …w 1  A } Concatenation: A  B = { vw | v  A and w  B } Star: A* = { w 1 …w k | k ≥ 0 and each w i  A }

REGULAR LANGUAGES CLOSED UNDER STAR Let L be a regular language and M be a DFA for L We construct an NFA N that recognizes L* 0 0, ε ε ε

Formally: Input: M = (Q, Σ, , q 1, F) Output: N = (Q, Σ, , {q 0 }, F) Q = Q  {q 0 } F = F  {q 0 }  (q,a) = {  (q,a)} {q1}{q1} {q1}{q1}  if q  Q and a ≠ ε if q  F and a = ε if q = q 0 and a = ε if q = q 0 and a ≠ ε  else

L(N) = L* Assume w = w 1 …w k is in L*, where w 1,…,w k  L We show N accepts w by induction on k Base Cases: k = 0 k = 1 Inductive Step: Assume N accepts all strings v = v 1 …v k  L*, and let u = u 1 …u k u k+1  L* Since N accepts u 1 …u k and M accepts u k+1, N must accept u

Assume w is accepted by N, we show w  L* If w = ε, then w  L* If w ≠ ε accept ε ε

REGULAR LANGUAGES ARE CLOSED UNDER REGULAR OPERATIONS Union: A  B = { w | w  A or w  B } Intersection: A  B = { w | w  A and w  B } Negation:  A = { w | w  A } Reverse: A R = { w 1 …w k | w k …w 1  A } Concatenation: A  B = { vw | v  A and w  B } Star: A* = { w 1 …w k | k ≥ 0 and each w i  A }

REGULAR EXPRESSIONS

 is a regular expression representing {  } ε is a regular expression representing {ε}  is a regular expression representing  If R 1 and R 2 are regular expressions representing L 1 and L 2 then: (R 1 R 2 ) represents L 1  L 2 (R 1  R 2 ) represents L 1  L 2 (R 1 )* represents L 1 *

PRECEDENCE *  

R2R2 R1*R1*( EXAMPLE R 1 *R 2  R 3 = ())  R3R3

{ w | w has exactly a single 1 } 0*10*

{ w | w has length ≥ 3 and its 3rd symbol is 0 } 000(0  1)*  010(0  1)*  100(0  1)*  110(0  1)*

{ w | every odd position of w is a 1 }