INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.

Slides:



Advertisements
Similar presentations
NFAs and DFAs Sipser 1.2 (pages 47-63).
Advertisements

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.
Complexity and Computability Theory I Lecture #4 Rina Zviel-Girshin Leah Epstein Winter
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
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.
Finite Automata Great Theoretical Ideas In Computer Science Anupam Gupta Danny Sleator CS Fall 2010 Lecture 20Oct 28, 2010Carnegie Mellon University.
NFAs and DFAs Sipser 1.2 (pages 47-63). Last time…
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata 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
1 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY (For next time: Read Chapter 1.3 of the book)
Finite Automata and Non Determinism
CS 310 – Fall 2006 Pacific University CS310 Finite Automata Sections:1.1 page 44 September 8, 2006.
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.
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.
Introduction to the Theory of Computation John Paxton Montana State University Summer 2003.
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.
Fall 2006Costas Busch - RPI1 Properties of Regular Languages.
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)
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 Regular Languages Finite Automata eg. Supermarket automatic door: exit or entrance.
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.
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.
Great Theoretical Ideas in Computer Science.
NFA Closure Properties Sipser pages pages NFAs also have closure properties We have given constructions for showing that DFAs are closed under.
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
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.
Athasit Surarerks THEORY OF COMPUTATION 07 NON-DETERMINISTIC FINITE AUTOMATA 1.
4b 4b Lexical analysis Finite Automata. Finite Automata (FA) FA also called Finite State Machine (FSM) –Abstract model of a computing entity. –Decides.
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.
CHAPTER 1 Regular Languages
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
Deterministic Finite Automata COMPSCI 102 Lecture 2.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 1 Regular Languages Some slides are in courtesy.
Great Theoretical Ideas in Computer Science for Some.
CS 154 Formal Languages and Computability February 9 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron.
Finite Automata Great Theoretical Ideas In Computer Science Victor Adamchik Danny Sleator CS Spring 2010 Lecture 20Mar 30, 2010Carnegie Mellon.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
CSCI 2670 Introduction to Theory of Computing September 11, 2007.
Regular Languages Chapter 1 Giorgi Japaridze Theory of Computability.
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.
Foundations of Computing Science
Properties of Regular Languages
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Lecture3 DFA vs. NFA, properties of RL
Non-Deterministic Finite Automata
CS 154, Lecture 3: DFANFA, Regular Expressions.
CSE 2001: Introduction to Theory of Computation Fall 2009
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
CSCI 2670 Introduction to Theory of Computing
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Chapter 1 Regular Language
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
Presentation transcript:

INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011

Q = {q 0, q 1, q 2, q 3 } Σ = {0,1}  : Q  Σ → Q transition function * q 0  Q is start state F = {q 1, q 2 }  Q accept states M = (Q, Σ, , q 0, F) where  01 q0q0 q0q0 q1q1 q1q1 q2q2 q2q2 q2q2 q3q3 q2q2 q3q3 q0q0 q2q2 * q2q2 0 0, q0q0 q1q1 q3q3 M

A language is regular if it is recognized by a deterministic finite automaton L = { w | w contains 001} is regular L = { w | w has an even number of 1s} is regular The Language of M, L(M), is the set of strings that M accepts

Many interesting programs accept regular languages NETWORK PROTOCOLS COMPILERS SUBSTRING GENETIC TESTING BACKWARDS ARITHMETIC

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 }

THEOREM: The Regular Languages are closed under the regular operations. If A and B are regular, applying any regular operation yields a regular language.

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 }

UNION THEOREM Given two languages, L 1 and L 2, define the union of L 1 and L 2 as L 1  L 2 = { w | w  L 1 or w  L 2 } Theorem: The union of two regular languages is also a regular language

Proof: Let M 1 = (Q 1, Σ,  1, q 0, F 1 ) be finite automaton for L 1 and M 2 = (Q 2, Σ,  2, q 0, F 2 ) be finite automaton for L 2 We want to construct a finite automaton M = (Q, Σ, , q 0, F) that recognizes L = L 1  L 2 1 2

Theorem: The union of two regular languages is also a regular language q0q0 q1q p0p0 p1p M1M1 M2M2 M = ?

Idea: Run both M 1 and M 2 at the same time! Q = pairs of states, one from M 1 and one from M 2 = { (q 1, q 2 ) | q 1  Q 1 and q 2  Q 2 } = Q 1  Q 2 q 0 = (q 0, q 0 ) 1 2 F = { (q 1, q 2 ) | q 1  F 1 or q 2  F 2 }  ( (q 1,q 2 ),  ) = (  1 (q 1,  ),  2 (q 2,  ))

Theorem: The union of two regular languages is also a regular language q0q0 q1q p0p0 p1p

q 0,p 0 q 1,p q 0,p 1 q 1,p Intersection: F = {(q 1,q 2 ) | q 1 ∈ F 1 and q 2 ∈ F 2. }

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 }

REVERSE CLOSURE Regular languages are closed under reverse Assume L is a regular language and M recognizes L We build M R that accepts L R If M accepts w then w describes a directed path in M from start to an accept state Define M R as M with the arrows reversed

M R IS NOT ALWAYS A DFA! It may have many start states Some states may have too many outgoing edges, or none

,1 0

NON -DETERMINISM ,1 0 What happens with 100? We will say that the machine accepts if there is a way to make it reach an accept state

Deterministic Computation Non-Deterministic Computation accept or rejectaccept reject

0,1 0,ε0 0,1

1 ε0 1 0

1 0 0 L(M)={1,00}

Q is the set of states Σ is the alphabet  : Q  Σ ε → P(Q) is the transition function Q 0  Q is the set of start states F  Q is the set of accept states A non-deterministic finite automaton is a 5-tuple N = (Q, Σ, , Q 0, F) P(Q) is the set of subsets of Q and Σ ε = Σ  {ε}

1 0 0  (q 3,1) = q1q1 q2q2 q3q3 q4q4 N = (Q, Σ, , Q 0, F) Q = {q 1, q 2, q 3, q 4 } Σ = {0,1} Q 0 = {q 1, q 2 } F = {q 4 }  Q  (q 2,1) = {q 4 } 

 (q 1,ε)= N = (Q, Σ, , Q 0, F) Q = {q 1, q 2, q 3 } Σ = {0,1} Q 0 = {q 1 } F = {q 3 }  Q  (q 1,0) = {q 1, q 2 } {q 2 } 0,1 0,ε0 0,1 q1q1 q2q2 q3q3  (q 2,1) = 

MULTIPLE START STATES We allow multiple start states for NFAs, and Sipser allows only one Can easily convert NFA with many start states into one with a single start state: ε ε ε

UNION THEOREM FOR NFAs

NFAs ARE SIMPLER THAN DFAs An NFA that recognizes the language {1}: 1 10,1 0 A DFA that recognizes the language {1}:

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

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 }