give some concept of regular expression and dfa differnce

© All Rights Reserved

19 views

give some concept of regular expression and dfa differnce

© All Rights Reserved

- Pandas Cheat Sheet
- Advanced Regex Tutorial—Regex Syntax
- Regex Quick Syntax Reference - Zsolt Nagy
- csci3255 HW 3
- 214 Midterm a Solution
- Appendix-E Walsh Function Modulation
- Regular Expressions
- Symantec_DLP_12.0_Admin_Guide.pdf
- HowtoCodeTrace.doc
- 3.Finite Automata
- moshell commands.doc
- An Efficient TCAM-Based Implementation of Multipattern Matching Using Covered State Encoding
- _tmp_.Log_ in Python - Stack Overflow
- Making the Most of SystemVerilog+UVM.pdf
- Python for Economists
- 06-UsingStandardCheckpoints
- 5624_Softskill - NLP
- 1. Introduction
- Selenium Commands
- Regular Expression

You are on page 1of 36

DFAs

Regular Expression

Examples

Exercise 1

= {10, 11}, * = ?

Answer

1111, }

Exercises 2

and L2 be sets of strings from *. L1L2 is the

set {xy | x is in L1, and y is in L2}

L1 = {10, 1}, L2 = {011, 11}, L1L2 = ?

Answer

Exercises 3

Write RE for

All strings of 0s and 1s

All strings of 0s and 1s with at least 2

consecutive 0s

All strings of 0s and 1s beginning with 1 and not

having two consecutive 0s

Answer

(0|1)*

All strings of 0s and 1s

(0|1)*00(0|1)*

All strings of 0s and 1s with at least 2

consecutive 0s

(1+10)*

All strings of 0s and 1s beginning with 1

and not having two consecutive 0s

More Exercises

1) (0|1)*011

2) 0*1*2*

3) 00*11*22*

1) (0|1)*011

Answer: all strings of 0s and 1s ending in 011

2) 0*1*2*

Answer: any number of 0s followed by

any number of 1s followed by any number

of 2s

3) 00*11*22*

Answer: strings in 0*1*2 with at least one of

each symbol

programmer's tool.

Built in to Java, Perl, Unix, Python, . . . .

Begin in start state.

Read first input symbol.

Move to new state, depending on current

state and input symbol.

Repeat until last input symbol read.

Accept or reject string depending on label of

last state.

DFA

DFA. Machine to recognize whether a given

string is in a given set.

Duality: for any DFA, there exists a regular

expression to describe the same set of

strings; for any regular expression, there

exists a DFA that recognizes the same set.

Duality Example

Duality

match regular expression patterns, (i) build

DFA and (ii) simulate DFA on input string.

Fundamental Questions

any RE?

Set of all bit strings with equal number of 0s

and 1s.

Set of all decimal strings that represent

prime numbers.

Many more. . . .

Problem 1

language denoted by regular expression ab*a

Solution

ab*a:

Problem 2

a

b

q0

b

q2

q3

Solution

a(a|b)*a

b

q0

b

q2

q3

replaces the edges with regular expressions

that includes the behavior of the eliminated

states.

Eventually we get down to the situation with

just a start and final node, and this is easy to

express as a RE

State Elimination

to be eliminated.

The labels on all edges are regular expressions.

To remove s, we must make labels from each qi to p1 up to pm

that include the paths we could have made through s.

moving to accepting states, apply the state

elimination process to produce an equivalent

automaton with regular expression labels on

the edges.

The result will be a one or two state

automaton with a start state and accepting

state.

automaton that looks like the following:

must also perform a state elimination from the

original automaton that gets rid of every state but the

start state. This leaves the following:

repeat the above steps for each accepting

states to get n different regular expressions,

R1, R2, Rn.

For each repeat we turn any other accepting

state to non-accepting.

The desired regular expression for the

automaton is then the union of each of the n

regular expressions: R1 U R2 U RN

DFA->RE Example

Eliminate State 1:

Answer: (0+10)*11(0+1)*

Second Example

even number of 1s

Eliminate state 2:

would die

Combine from previous slide to get 0* | 0*10*1(0|10*1)*

RE -> Automata

an NFA

Beyond the scope of this course

Questions

- Pandas Cheat SheetUploaded byngyncloud
- Advanced Regex Tutorial—Regex SyntaxUploaded byharisaryono
- Regex Quick Syntax Reference - Zsolt NagyUploaded byL
- csci3255 HW 3Uploaded byDK Hassan
- 214 Midterm a SolutionUploaded byabdal113
- Appendix-E Walsh Function ModulationUploaded byRobert Lavender
- Regular ExpressionsUploaded byvcgundi
- Symantec_DLP_12.0_Admin_Guide.pdfUploaded byAnonymous HnSITRrG
- HowtoCodeTrace.docUploaded byJessica Jimenez
- 3.Finite AutomataUploaded bytejshahi1
- moshell commands.docUploaded by3GSERO
- An Efficient TCAM-Based Implementation of Multipattern Matching Using Covered State EncodingUploaded byersathis
- _tmp_.Log_ in Python - Stack OverflowUploaded byRati Shankar
- Making the Most of SystemVerilog+UVM.pdfUploaded byradhakodirekka8732
- Python for EconomistsUploaded byquoro
- 06-UsingStandardCheckpointsUploaded byaustinfru
- 5624_Softskill - NLPUploaded byranny
- 1. IntroductionUploaded byShyam Verma
- Selenium CommandsUploaded bysreenu_pes
- Regular ExpressionUploaded byIke Cyril
- Py Regex SampleUploaded byabbey
- NFA to DFAUploaded byNisha Vasudev R
- AutomataUploaded bychaliterrefe
- sed-manUploaded byFetra Manoela Raneria
- prob 7Uploaded byAli Saborian
- KeypadUploaded byBinhu Lee
- Signal procesamientoUploaded byDamian Primo
- K Mean ClusteringUploaded byCualQuiera
- Advantages of OOPUploaded byUneeb Khan
- GA-FCAUploaded byRohit Deshmukh

- 2-FAUploaded byYeshvanthYesh
- Implementing a DFA (Deterministic Finite Automata) in C++Uploaded byRizul
- Handout 17.docxUploaded bymano
- Hopcroft SolUploaded byManjeet Singh
- handout-04Uploaded byamos4354
- 15955_The Theory of AutomataUploaded byAbhinav Kumar
- A2B91E13d01Uploaded bySourav Roy
- 2-FA.pptUploaded byranga231980
- Tutorial 1Uploaded bySaimo Mghase
- Lexical Analysis SampleUploaded byGaurav Mishra
- 3.Finite AutomataUploaded bytejshahi1
- DFA-regularlanguages.pdfUploaded byshobhit
- 1-4-RegularLanguagesPropertiesUploaded byAlex Solomon A
- solution for tocUploaded byjhonson jorge
- DFA Minimization2Uploaded byAna-Maria Stoica
- e-NFA to DFAUploaded byAyush Sekhari
- discrete mathematicsUploaded byNehru Veerabatheran
- Cs2303 Toc ModelUploaded byrishikarthick
- Solutions for Theory of ComputationUploaded byVishnu S. M. Yarlagadda
- Compiler Design-RavirajUploaded byRavi Raj
- Regular Grammar, Regular Languages and Properties of Regular LanguagesUploaded byJhayr Pascua
- 4-nfaUploaded byAtif Rehman
- PET-3-QP -TOCUploaded byOA CSE
- 2DFAUploaded byAmol Wakankar
- Nfa to dfaUploaded bywafa111222
- 237 Set 2 SolutionUploaded byqw11111
- disha_publication_computer_concept_notes_with_exercises_theory_of_computation.pdfUploaded byAyush Sharma
- FSAUploaded bysumesh215
- Regular Epression to DFAUploaded byAnkit Sharma
- From RE to NFA and Vise VersaUploaded byMahmoud Nawwar