Regular Languages, Regular Operations, Closure

Slides:



Advertisements
Similar presentations
CS2303-THEORY OF COMPUTATION Closure Properties of Regular Languages
Advertisements

Regular operations Sipser 1.1 (pages 44 – 47). CS 311 Fall Building languages If L is a language, then its complement is L’ = {w | w ∉ L} Let A.
Properties of Regular Languages
YES-NO machines Finite State Automata as language recognizers.
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
Finite Automata Great Theoretical Ideas In Computer Science Anupam Gupta Danny Sleator CS Fall 2010 Lecture 20Oct 28, 2010Carnegie Mellon University.
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)
CS 310 – Fall 2006 Pacific University CS310 Finite Automata Sections:1.1 page 44 September 8, 2006.
1 Module 19 LNFA subset of LFSA –Theorem 4.1 on page 131 of Martin textbook –Compare with set closure proofs Main idea –A state in FSA represents a set.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Regular.
Fall 2005 CSE 467/567 1 Formal languages regular expressions regular languages finite state machines.
Fall 2006Costas Busch - RPI1 Properties of Regular Languages.
FSA Lecture 1 Finite State Machines. Creating a Automaton  Given a language L over an alphabet , design a deterministic finite automaton (DFA) M such.
CS 3240 – Chuck Allison.  A model of computation  A very simple, manual computer (we draw pictures!)  Our machines: automata  1) Finite automata (“finite-state.
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.
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
Recap Lecture-2 Kleene Star Closure, Plus operation, recursive definition of languages, INTEGER, EVEN, factorial, PALINDROME, {anbn}, languages of strings.
MYHILL NERODE THEOREM By Anusha Tilkam. Myhill Nerode Theorem: The following three statements are equivalent 1.The set L є ∑* is accepted by a FSA 2.L.
1 Chapter 1 Introduction to the Theory of Computation.
Module 2 How to design Computer Language Huma Ayub Software Construction Lecture 8.
L ECTURE 3 Chapter 4 Regular Expressions. I MPORTANT T ERMS Regular Expressions Regular Languages Finite Representations.
Regular Grammars Chapter 7. Regular Grammars A regular grammar G is a quadruple (V, , R, S), where: ● V is the rule alphabet, which contains nonterminals.
Computability Review homework. Regular Operations. Nondeterministic machines. NFSM = FSM Homework: By hand, build FSM version of specific NFSM. Try 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.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
CS 3813: Introduction to Formal Languages and Automata
CS 203: Introduction to Formal Languages and Automata
Lecture # 4.
Mathematical Foundations of Computer Science Chapter 3: Regular Languages and Regular Grammars.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
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:
1 Closure E.g., we understand number systems partly by understanding closure properties: Naturals are closed under +, , but not -, . Integers are closed.
Theory of Computation Lecture #
Lecture # 2.
CSE 105 theory of computation
Properties of Context-Free Languages
Closure Properties of Regular Languages
Properties of Regular Languages
Context-Free Languages
REGULAR LANGUAGES AND REGULAR GRAMMARS
Regular Grammars.
CSE322 PROPERTIES OF REGULAR LANGUAGES
Properties of Regular Languages
Chapter 7 Regular Grammars
CS 154, Lecture 3: DFANFA, Regular Expressions.
COSC 3340: Introduction to Theory of Computation
Recap lecture 29 Example of prefixes of a language, Theorem: pref(Q in R) is regular, proof, example, Decidablity, deciding whether two languages are equivalent.
NFAs and Transition Graphs
Properties of Regular Languages
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
Closure Properties of Regular Languages
Properties of Context-Free languages
MA/CSSE 474 Theory of Computation Minimizing DFSMs.
Subject Name: Finite Automata & Formal Languages Subject Code 10CS56.
Recap Lecture-2 Kleene Star Closure, Plus operation, recursive definition of languages, INTEGER, EVEN, factorial, PALINDROME, {anbn}, languages of strings.
Convert to a DFA: Start state: Final States: State Symbol Read- Q E(Q)
Chapter 1 Introduction to the Theory of Computation
CSE 105 theory of computation
CSCI 2670 Introduction to Theory of Computing
CSE 105 theory of computation
Post’s Correspondence Problem
Turing -Recognizable vs. -Decidable
Recap Lecture-2 Kleene Star Closure, Plus operation, recursive definition of languages, INTEGER, EVEN, factorial, PALINDROME, {anbn}, languages of strings.
Recap Lecture 3 RE, Recursive definition of RE, defining languages by RE, { x}*, { x}+, {a+b}*, Language of strings having exactly one aa, Language of.
CSCI 2670 Introduction to Theory of Computing
Finite Automata Part Three
CSE 105 theory of computation
CSE 105 theory of computation
Presentation transcript:

Regular Languages, Regular Operations, Closure

Regular Languages We say that a language L is regular iff there is a DFA that accepts L. The regular languages is the set of languages that dfas accept.

Regular Operations The regular operations are the following: Union (U) Concatenation (o) Star (*)

Regular Operations L1 U L2 = {x|x L1 or x L2} L1o L2 = {xy|x L1 and y L2} Lk = L o L o … o L, k times , L0 = {ε} L* = Lk for any k ≥ 0 L+ = Lk for any k > 0

Regular Operations Examples L1 = {a, b}, L2 = {b, c} L1 U L2= {a, b, c} L1 o L2 = {ab, ac, bb, bc} L1 2 = {aa, ab, ba, bb} L1* = {ε, a, b, aa, ab, ba, bb, aaa, aab, aba, abb, baa, bab, bba, bbb, aaaa, aaab, aaba, …} Σ* is the set of all possible strings of an alphabet Σ.

Closure To show that a set is closed under an operation we should prove that, if we apply the operation on members of the set then the result belongs in the set. Example: The set of natural numbers N is closed under +, because if we add any two numbers in N the result is still in N. However, N is not closed under -, since 3-5 = -2 which is not in N. Question: Is Z closed under -? What about / ?

Regular Languages are closed under union. We should prove that if L1 and L2 are regular then L = L1 L2 is also regular. Since L1 and L2 are regular there exist DFAs M1 and M2 that accept them. It suffices to show that there exist a DFA M that accepts L. We construct a DFA that accepts L.

Proof idea I want to construct a DFA M that will simulate both M1 and M2 running in parallel. This machine should keep track of what happened to either machine after following a symbol a of the alphabet.

Proof idea Start from q01 in M1 and q02 in M2. After following a symbol a the first machine will be in state q1 and the second in q2. q01 a q1 q02 a q2

Proof idea I want the new machine to remember both states that can be reached after following a. Thus I am going to create a new state containing a pair of both states . q01 a q1 q01 q02 q1 q2 q02 a q2

Proof idea Starting from (q01, q02) after following a, M will be in state (q1, q2). q01 a q1 q01 q02 a q1 q2 q02 a q2

Proof idea Now it is left to find which of these pairs of states will be the accepting ones. I want to construct a DFA M that accepts the union L1 U L2, that is all the strings which are accepted by either of the DFAs M1, M2.

Proof idea Machine M1 accepts a string s if after consuming s it is in an accepting state qF1. q01 qF1 abb s= abb

Proof idea Thus any pair (qF1,q2) that contains qF1 should be an accepting state in M. q01 qF1 abb q01 q02 abb qF1 q2 abb q02 q2 s= abb

Proof idea Same for M2. If qF2 is an accepting state, any state (q1, qF2) should be an accepting state of M. q01 q1 aba q01 q02 aba q1 qF2 aba q02 qF2 s= aba

A DFA that accepts L1 U L2 Assume that M1 = {Q1, Σ ,δ1 ,q01 ,F1} and Then M = {Q, Σ, δ, q0, F}, where Q = Q1 x Q2 δ((q1,q2), a) = (δ1(q1, a), δ2(q2, a)) q0 = (q01, q02) F = (Q1 x F2) (F1 x Q2)

Example Construct a DFA that accepts the language L = L1 U L2, where : L1 = {s|s contains an odd number of 1} and L2 = {s|s contains an even number of 0}.

Example L1 = {s|s contains an odd number of 1} 1 q01 q11 1

Example L2 = {s|s contains an even number of 0} 1 q00 q10 1

Example L = L1 U L2 1 q00 q11 q01 q11 1 1 1 q00 q01 q10q11 1 1 q00 q10 q00 q11 q01 q11 1 1 1 q00 q01 q10q11 1 1 q00 q10 q10q01 1 1

Question What if I would like to construct a DFA that accepts the intersection of two regular languages? (in other words show that the regular languages are closed under the intersection).