MidtermI Review
MidtermI Review
1
Test Details
In class, Wednesday, Feb. 25, 2015
3:10pm-4pm
Comprehensive
2
Syllabus
Formal proofs
Finite Automata
NFA, DFA, -NFA
Regular expressions
Regular languages & properties
Pumping lemma for regular languages
3
Finite Automata
Deterministic Finite Automata (DFA)
The machine can exist in only one state at any
given time
Non-deterministic Finite Automata (NFA)
The machine can exist in multiple states at the
same time
4
Deterministic Finite Automata
A DFA is defined by the 5-tuple:
{Q, ∑ , q0,F, δ }
Two ways to define:
State-diagram (preferred)
State-transition table
5
Non-deterministic Finite
Automata
A NFA is defined by the 5-tuple:
{Q, ∑ , q0,F, δ }
Two ways to represent:
State-diagram (preferred)
State-transition table
6
NFA to DFA conversion
Checklist for NFA to DFA conversion
Two approaches:
Enumerate all possible subsets, or
Use lazy construction strategy (to save time)
Introduce subset states only as needed
In your solutions, use the lazy construction procedure by
default unless specified otherwise.
Any subset containing an accepting state is also
accepting in the DFA
Have you made a special entry for Φ, the empty
subset?
This will correspond to the dead/error state
7
-NFA to DFA conversion
Checklist for -NFA to DFA conversion
First take ECLOSE(start state)
New start state = ECLOSE(start state)
Remember: ECLOSE(q) include q
Then convert to DFA:
Use lazy construction strategy for introducing subset states only as
needed (same as NFA to DFA), but …
Only difference : take ECLOSE after transitions and also include those
states in the subset corresponding to your destination state.
E.g., if q_i goes to {q_j, q_k}, then your subset must be: ECLOSE(q_j) U ECLOSE(q_k)
Again, check for a special entry for Φ if needed
8
Regular Expressions
A way to express accepting patterns
Operators for Reg. Exp.
(E), L(E+F), L(EF), L(E*)..
Reg. Language Reg. Exp. (checklist):
Capture all cases of valid input strings
Express each case by a reg. exp.
Combine all of them using the + operator
Pay attention to operator precedence
Try to reuse previously built regular expressions
wherever possible
9
Regular Expressions…
DFA to Regular expression
Enumerate all paths from start to every final state
Generate regular expression for each segment, and
concatenate
Combine the reg. exp. for all each path using the + operator
Reg. Expression to -NFA conversion
Inside-to-outside construction
Start making states for every atomic unit of RE
Combine using: concatenation, + and * operators as
appropriate
For connecting adjacent parts, use -transitions
Remember to note down final states
10
Regular Expressions…
Algebraic laws
Commutative
Associative
Distributive
Identity
Annihiliator
Idempotent
Involving Kleene closures (* operator)
11
English description of lang.
Finite automata english description
Regular expression english description
position, etc.
15