Professional Documents
Culture Documents
ToA - Lecture 05 06 - Regular Expressions Finite Automata
ToA - Lecture 05 06 - Regular Expressions Finite Automata
ToA - Lecture 05 06 - Regular Expressions Finite Automata
• Associative:
• Identity:
• Annihilator:
Algebraic Laws of Regular Expressions
• Distributive
• Idempotent
0 0,1
1 1
A B C
Start 0
Alternative Representation – Transition Table
• Columns = Input Symbols
• Arrow for Start States
• Final States Starred
• Rows = States
0 1
*A A B
*B A C
C C C
Extended Transition Function
• We describe the effect of a string of inputs on a DFA by extending to a state and a string
• Induction on length of string
• Basis:
• Induction:
• is a string; is an input symbol.
• Convention:
• w, x, y are strings.
• a, b, c are single symbols.
• Extended is computed for state and inputs by following a path in the transition graph,
starting at and selecting the arcs with labels in turn.
Extended Transition Function
0 1
*A A B
*B A C
C C C
Delta-Hat
• Some people denote the extended with a “hat” to distinguish it from itself.
• Not needed, because both agree when the string is a single symbol.
DFA Example – Substring
• Build a DFA for the following language:
• L = is a binary string that contains as a substring
• Steps for building a DFA to recognize :
•
• Decide on the states:
• Designate start state and final/accepting state(s)
• : Decide on the transitions
DFA Example – Substring
• Start State =
• F=
0 1
• Regular Expression:
*
DFA Example – Clamping Logic
• Clamping Logic
• A clamping circuit waits for a ”” input and turns on forever. However, to avoid clamping on spurious
noise, we’ll design a DFA that waits for two consecutive in a row before clamping on.
• L = is a bit string which contains as a substring
• State Design:
• : start state (initially off), also means that the most recent input was not
• : has never seen but the most recent input was
• : has seen at least once
DFA Example – Even and
• Build a DFA for the following language:
• L = is a binary string that has even number of and even number of
Extension of transitions () to paths ()
• = destination state from state on input string
• Work out last example using the input sequence w=10010, a=1:
Language of a DFA
• A DFA accepts string if there is a path from to an accepting (or final) state that is labeled by
• in and is balanced