dfa to regular expressions - oscar main pageoscar.iitb.ac.in/oscarpp/computer...
TRANSCRIPT
![Page 1: DFA TO REGULAR EXPRESSIONS - OSCAR Main Pageoscar.iitb.ac.in/OSCARPP/Computer Science/UploadedStoryboards... · The aim of this animation is to clarify the concepts of DFA to Regular](https://reader031.vdocument.in/reader031/viewer/2022030506/5ab5583f7f8b9ab47e8cc2ff/html5/thumbnails/1.jpg)
S bj t C t S iSubject :- Computer ScienceCourse Name :- Theory Of Computation
DFADFA TO
REGULAR EXPRESSIONS
Report Submitted by:-Ajay Singh MeenaAjay Singh Meena
![Page 2: DFA TO REGULAR EXPRESSIONS - OSCAR Main Pageoscar.iitb.ac.in/OSCARPP/Computer Science/UploadedStoryboards... · The aim of this animation is to clarify the concepts of DFA to Regular](https://reader031.vdocument.in/reader031/viewer/2022030506/5ab5583f7f8b9ab47e8cc2ff/html5/thumbnails/2.jpg)
DFA
BASIC DEFINITIONSDFA:-
A finite state machine where for each pair of state and input symbol there is one and only one transition to a next state. DFAs recognize the set of regular languages and
Regular Expressions:-Regular expressions consist of constants and operators that denote sets of
no other languages.
Regular expressions consist of constants and operators that denote sets of strings and operations over these sets, respectively. A regular expression represents a "pattern" strings that match the pattern are in the language, strings that do not match the pattern are not in the languagethe pattern are not in the language.
All strings containing exactly one “1” on = {0 1} *All strings containing exactly one 1 on {0, 1} . 0
1
0Regular Expressions for this l i
Starting St t 1 language over is :-
0* 1 0* State
Non-Final State Final State
![Page 3: DFA TO REGULAR EXPRESSIONS - OSCAR Main Pageoscar.iitb.ac.in/OSCARPP/Computer Science/UploadedStoryboards... · The aim of this animation is to clarify the concepts of DFA to Regular](https://reader031.vdocument.in/reader031/viewer/2022030506/5ab5583f7f8b9ab47e8cc2ff/html5/thumbnails/3.jpg)
AIM & PROCEDUREAIM & PROCEDUREThe aim of this animation is to clarify the concepts of DFA to Regular Expressions by illustrating some examples.
In this animation we will explain this topic by first giving its brief introduction through its definition and then some notations of Automata Theory.In this animation we will have two examples for explaining this topic .In the first example we will play with less number of states simply di l i i l f th t t d li ti th d thdisplaying circles for the states and lines connecting them and then according to the algorithm we will convert that DFA into regular expression.In the second example we will handle with more number of states. And do the required animation like first example.The animation will show the construction of a simple states reducing diagrams and change in their transaction and strings over the transactiondiagrams and change in their transaction and strings over the transaction happening . And Finally we will get our Regular Expression for the given DFA.
![Page 4: DFA TO REGULAR EXPRESSIONS - OSCAR Main Pageoscar.iitb.ac.in/OSCARPP/Computer Science/UploadedStoryboards... · The aim of this animation is to clarify the concepts of DFA to Regular](https://reader031.vdocument.in/reader031/viewer/2022030506/5ab5583f7f8b9ab47e8cc2ff/html5/thumbnails/4.jpg)
P bl St t tProblem StatementInput:- A figure with given number of non-final states and final states.
Output:- A regular expression for the given DFA.p g p g
Regular ExpressionRegular Expression containing combinations of some finite symbols over .over .
![Page 5: DFA TO REGULAR EXPRESSIONS - OSCAR Main Pageoscar.iitb.ac.in/OSCARPP/Computer Science/UploadedStoryboards... · The aim of this animation is to clarify the concepts of DFA to Regular](https://reader031.vdocument.in/reader031/viewer/2022030506/5ab5583f7f8b9ab47e8cc2ff/html5/thumbnails/5.jpg)
P bl 1Problem 1:-Input :-Language over ={0,1}* ,such that every string is a multiple of 3 in
binary.Output: A Regular Expression representing the above DFAOutput:- A Regular Expression representing the above DFA.
Solution:-DFA representing the above problem:-
1 Wh 0 1 2 i i l
10 2
1
0
10
Where 0,1,2 in circles represents the remainders.
1 0
Step 1:- Add a new initial state (S) and a new final state (F) with - transition:-
110New-Starting
1 20
0
S 0State
F1 0
New-Final State
![Page 6: DFA TO REGULAR EXPRESSIONS - OSCAR Main Pageoscar.iitb.ac.in/OSCARPP/Computer Science/UploadedStoryboards... · The aim of this animation is to clarify the concepts of DFA to Regular](https://reader031.vdocument.in/reader031/viewer/2022030506/5ab5583f7f8b9ab47e8cc2ff/html5/thumbnails/6.jpg)
Step 2: Remove the circle with remainder 2Step 2:- Remove the circle with remainder 2.
10 Now circles with 0,1
d ’t t1S 0
1
0 1* 0doesn’t represent remainders here.
F1
Final Step:- After Removing all the circles with 0, 1.
(0 + 1(0 1* 0)1)*S F
(0 + 1(0 1 0)1)
Final StateStarting State
So, the final Regular Expression for the above DFA is :-* *(0 + 1(0 1* 0)1)*
![Page 7: DFA TO REGULAR EXPRESSIONS - OSCAR Main Pageoscar.iitb.ac.in/OSCARPP/Computer Science/UploadedStoryboards... · The aim of this animation is to clarify the concepts of DFA to Regular](https://reader031.vdocument.in/reader031/viewer/2022030506/5ab5583f7f8b9ab47e8cc2ff/html5/thumbnails/7.jpg)
Problem 2:-Input :-Language over ={a,b}* ,such that every string starts and ends with
the same symbol.yOutput:- A Regular Expression representing the above DFA.
Solution:-Solution:
DFA representing the above problem:-
b
q1 q3aa
b
q2 4Starting
b
ba
a aq0
q2 q4State bb
![Page 8: DFA TO REGULAR EXPRESSIONS - OSCAR Main Pageoscar.iitb.ac.in/OSCARPP/Computer Science/UploadedStoryboards... · The aim of this animation is to clarify the concepts of DFA to Regular](https://reader031.vdocument.in/reader031/viewer/2022030506/5ab5583f7f8b9ab47e8cc2ff/html5/thumbnails/8.jpg)
Step 1:- Add a new initial state (S) and a new final state (F) with - transition:-
ab
q3aa
b
b
aSq1
Fq0
q4Starting State
b
ba a
S
q2
Fq0
Stateb
Step 2:- Remove the circle named as q3 and q4.
a q1 (a + bb* a) *q0
Starting b
bS
q2
q
F
( )
(b + aa* b) *gState b q2 (b aa b)
![Page 9: DFA TO REGULAR EXPRESSIONS - OSCAR Main Pageoscar.iitb.ac.in/OSCARPP/Computer Science/UploadedStoryboards... · The aim of this animation is to clarify the concepts of DFA to Regular](https://reader031.vdocument.in/reader031/viewer/2022030506/5ab5583f7f8b9ab47e8cc2ff/html5/thumbnails/9.jpg)
a * *
Step 3:- Remove the circle named as q0.
SSt ti
a
b
q1
F
(a + bb* a) *
* *Starting State b q2 (b + aa* b) *
Final Step:- After Removing all the circles named as q1 ,q2.
* * * *S F
[ + a(a + bb* a)* + b(b + aa* b)* ]
So, the final Regular Expression for the above DFA is :-* * * *[ + a(a + bb* a)* + b(b + aa* b)* ]
![Page 10: DFA TO REGULAR EXPRESSIONS - OSCAR Main Pageoscar.iitb.ac.in/OSCARPP/Computer Science/UploadedStoryboards... · The aim of this animation is to clarify the concepts of DFA to Regular](https://reader031.vdocument.in/reader031/viewer/2022030506/5ab5583f7f8b9ab47e8cc2ff/html5/thumbnails/10.jpg)
F th I t ti itFurther Interactivity
We will arrange more and more questions for the user by which he or shecan do some questions based on this topic.For this animation user input is very-very hard so I am avoiding it.For this animation user input is very very hard so I am avoiding it.We will show the formation of reduced diagrams/figure according to the algorithm in the animation.We will show how the algorithm works in the animation part and how theWe will show how the algorithm works in the animation part and how theno of states changes when they are removed or added in the animation.
![Page 11: DFA TO REGULAR EXPRESSIONS - OSCAR Main Pageoscar.iitb.ac.in/OSCARPP/Computer Science/UploadedStoryboards... · The aim of this animation is to clarify the concepts of DFA to Regular](https://reader031.vdocument.in/reader031/viewer/2022030506/5ab5583f7f8b9ab47e8cc2ff/html5/thumbnails/11.jpg)
Review QuestionsReview QuestionsOutput is the ____________ DFA listed as a regular expressions.(ans:- minimal)
A DFA represents a finite state machine that recognizes a _______________.(ans:- Regular Expression)
What is the regular expression for the given DFA of language containing even number of “a”:- ba
b
q1q0
b
________________. -----------------------------------------[ans :- (b + ab*a) * ]Regular Expression for this DFA is :-
a
bg p bq0 q2q1
a
b
________________.-----------------------------[ans:- (a(bb) *)]
b
![Page 12: DFA TO REGULAR EXPRESSIONS - OSCAR Main Pageoscar.iitb.ac.in/OSCARPP/Computer Science/UploadedStoryboards... · The aim of this animation is to clarify the concepts of DFA to Regular](https://reader031.vdocument.in/reader031/viewer/2022030506/5ab5583f7f8b9ab47e8cc2ff/html5/thumbnails/12.jpg)
Further Reading Linkshttp://www.cs.geneseo.edu/~baldwin/csci342/fall2006/0919dfa2re.htmlhttp://www.cs.geneseo.edu/ baldwin/csci342/fall2006/0919dfa2re.htmlhttp://www.cs.uiuc.edu/class/fa05/cs475/Lectures/new/lec05.pdfhttp://www.mec.ac.in/resources/notes/notes/automata/Transforming%20FSA%20into%20RE.htmhttp://en.wikipedia.org/wiki/Deterministic_finite‐state_machinehttp://en wikipedia org/wiki/Regular expressions http://en.wikipedia.org/wiki/Regular_expressions
![Page 13: DFA TO REGULAR EXPRESSIONS - OSCAR Main Pageoscar.iitb.ac.in/OSCARPP/Computer Science/UploadedStoryboards... · The aim of this animation is to clarify the concepts of DFA to Regular](https://reader031.vdocument.in/reader031/viewer/2022030506/5ab5583f7f8b9ab47e8cc2ff/html5/thumbnails/13.jpg)
CREDITS