A new Computation System DFAs, NFs, Λ-NFAs all describe a language in an operational manner. They describe a machine that one can execute in order to recognize.

Slides:



Advertisements
Similar presentations
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
Advertisements

1 Introduction to Computability Theory Lecture4: Regular Expressions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
Lexical Analysis III Recognizing Tokens Lecture 4 CS 4318/5331 Apan Qasem Texas State University Spring 2015.
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.
Fall 2006Costas Busch - RPI1 Regular Expressions.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Regular.
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.
1 NFAs accept the Regular Languages. 2 Equivalence of Machines Definition: Machine is equivalent to machine if.
1 Regular Expressions/Languages Regular languages –Inductive definitions –Regular expressions syntax semantics Not covered in lecture.
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.
Scanner Front End The purpose of the front end is to deal with the input language Perform a membership test: code  source language? Is the.
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
Theory of computing, part 1. Von Neumann Turing machine Finite state machines NP complete problems -maximum clique -travelling salesman problem -colour.
Regular Expressions. Notation to specify a language –Declarative –Sort of like a programming language. Fundamental in some languages like perl and applications.
Theory of Computation, Feodor F. Dragan, Kent State University 1 Regular expressions: definition An algebraic equivalent to finite automata. We can build.
Context-free Grammars Example : S   Shortened notation : S  aSaS   | aSa | bSb S  bSb Which strings can be generated from S ? [Section 6.1]
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
XML Data Management 10. Deterministic DTDs and Schemas Werner Nutt.
1 Module 14 Regular languages –Inductive definitions –Regular expressions syntax semantics.
Regular Expressions Hopcroft, Motawi, Ullman, Chap 3.
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.
Regular Expressions and Languages A regular expression is a notation to represent languages, i.e. a set of strings, where the set is either finite or contains.
Lesson No.6 Naveen Z Quazilbash. Overview Attendance and lesson plan sharing Assignments Quiz (10 mins.). Some basic ideas about this course Regular Expressions.
CHAPTER 1 Regular Languages
January 9, 2015CS21 Lecture 31 CS21 Decidability and Tractability Lecture 3 January 9, 2015.
CMSC 330: Organization of Programming Languages Theory of Regular Expressions Finite Automata.
1 Regular Expressions Reading: Chapter 3. 2 Regular Expressions vs. Finite Automata Offers a declarative way to express the pattern of any string we want.
CS355 - Theory of Computation Regular Expressions.
Regular Expressions Costas Busch - LSU.
Recursive Definations Regular Expressions Ch # 4 by Cohen
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
Regular Languages ภาษาปกติ. Jaruloj Chongstitvatana Outline Regular expressions Regular languages Equivalence between languages accepted by.
UNIT - I Formal Language and Regular Expressions: Languages Definition regular expressions Regular sets identity rules. Finite Automata: DFA NFA NFA with.
Finite Automata & Regular Languages Sipser, Chapter 1.
1 Section 11.1 Regular Languages Problem: Suppose the input strings to a program must be strings over the alphabet {a, b} that contain exactly one substring.
1 Chapter Regular Languages. 2 Section 11.1 Regular Languages Problem: Suppose the input strings to a program must be strings over the alphabet.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Regular Expressions CS 130: Theory of Computation HMU textbook, Chapter 3.
1 Chapter 3 Regular Languages.  2 3.1: Regular Expressions (1)   Regular Expression (RE):   E is a regular expression over  if E is one of:
 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.
1 Introduction to the Theory of Computation Regular Expressions.
1 Some Properties of Regular Languages. 2 Properties Concatenation:Star: Union: Are regular Languages For regular languages and.
CSCI 2670 Introduction to Theory of Computing September 11, 2007.
What do we know? DFA = NFA =  -NFA We have seen algorithms to transform DFA to NFA (trival) NFA to  NFA (trivial) NFA to DFA (subset construction)
Theory of Computation Automata Theory Dr. Ayman Srour.
Deterministic Finite-State Machine (or Deterministic Finite Automaton) A DFA is a 5-tuple, (S, Σ, T, s, A), consisting of: S: a finite set of states Σ:
Cpt S 317: Spring 2009 Reading: Chapter 3
3. Regular Expressions and Languages
Closure Properties of Regular Languages
Formal Language & Automata Theory
Regular Expressions.
CSE 105 theory of computation
Formal Language & Automata Theory
Closure Properties of Regular Languages
Lecture 10 Closure Properties of Regular Languages
Single Final State for NFA
CS 154, Lecture 3: DFANFA, Regular Expressions.
Definitions Equivalence to Finite Automata
Definitions Equivalence to Finite Automata
Regular Expressions.
Context Free Expressions
Closure Properties of Regular Languages
Closure Properties of Regular Languages
CS21 Decidability and Tractability
Definitions Equivalence to Finite Automata
NFAs accept the Regular Languages
Presentation transcript:

A new Computation System DFAs, NFs, Λ-NFAs all describe a language in an operational manner. They describe a machine that one can execute in order to recognize a string. An alternate method of describing a set of strings is to describe the properties it should have. Regular-Expressions are based upon the closure properties we have studied.

Regular Expressions Fix an alphabet . We define now regular expressions and how each of them specifies a language. Definition. The set of regular expressions (with respect to  ) is defined inductively by the following rules: 1.The symbols  and  are regular expressions 2.Every symbol  is a regular expression 3. If E and F are regular expressions, then (E * ), (EF) and (E+F) are regular expressions. Note how the closure properties are used here Juxtaposition of two RE uses an implicit  or concatenation

Computation system as Data We have made a big point that computation systems are just data, regular expressions are no exception. We can represent them as data. Here we use Haskell as an example. data RegExp a = Lambda | Empty | One a | Union (RegExp a) (RegExp a) | Cat (RegExp a) (RegExp a) | Star (RegExp a) How would you represent regular expressions in your favorite language.

Regular Expressions as Languages Definition. For every regular expression E, there is an associated language L(E), defined inductively as follows: 1.L(  )=  and L(  )={  } 2.L(a)={‘a’} 3.Inductive cases 1.L(E * ) = (L(E)) * 2.L(EF) = L(E) L(F) 3.L(E+F) = L(E)  L(F) Definition. A language is regular if it is of the form L(E) for some regular expression E. Recall x* = Λ  x  x  x  x  x  x … recall implicit use of dot L(E)  L(F)

Equivalence 1.We say that regular expressions E and F are equivalent iff L(E)=L(F). 2.We treat equivalent expressions as equal (just as we do with arithmetic expressions; (e.g., 5+7 = 7+5). 3.Equivalences (E+F)+G = E+(F+G) and (EF)G=E(FG) allow us to omit many parentheses when writing regular expressions. 4.Even more parentheses can be omitted when we declare the precedence ordering of the three operators : 1. star (binds tightest) 2. concatenation 3. union (binds least of all)

RE’s over {0,1} Fill in the blank E 1 = 0+11 then L(E 1 )=_____ E 2 =( ) * then L(E 2 )=____ E 3 =0 * +1 * then L(E 3 )=_____ E 4 =(00 * +11 * ) * then L(E 4 )=_____ E 5 =(1+ Λ )(01) * (0+  ) then L(E 5 )=_____

Computing a language We can compute a language by using the definition of the meaning of a regular expression L(a+b.c*) = L(a) U L(bc*) L(a+b.c*) = L(a) U (L(b).L(c*)) L(a+b.c*) = {a} U ({b}. {c}*) L(a+b.c*) = {a} U ({b}.{ ,c,cc,ccc,…, c n }) L(a+b.c*) = {a} U ({b,bc,bcc,bccc,…, bc n }) L(a+b.c*) = {a,b,bc,bcc,bccc,…, bc n })

Laws about Regular expressiosn The regular expressions form an algebra There are many laws (just as there are laws about arithmetic (5+2)=(2+5)

Laws about + 1.R + T = T + R 2.R +  =  R = R 3.R + R = R 4.R + (S + T) = (R + S) + T

Laws about. 1.R.  =  R =  2.R.  = .R = R 3.(R.S).T = R.(S.T) With Implicit. 1.R  =  R =  2.R  =  R = R 3.(RS)T = R(ST)

Distributive Properties 1.R(S + T) = RS + RT 2.(S + T)R = SR + TR

Closure Properties *  2.R* = R*R* = (R*)* = R + R* 3.R* =  + R* = (  + R)* = (  +R)R* =  + RR* 4.R* = (  R k )* for all k >= 1 5.R* =  + R +… + R (k-1) + R k R* for all k >= 1 6.RR* = R*R 7.R(SR)* = (RS)*R 8.(R*S)* =  + (R + S)*S 9.(RS*)* =  + R(R + S)*

Next time We will study how to make recognizers from regular expressions We will prove that RE and DFAs describe the same class of languages.