INHERENT LIMITATIONS OF COMPUTER PROGAMS - PowerPoint PPT Presentation

1 / 30
About This Presentation
Title:

INHERENT LIMITATIONS OF COMPUTER PROGAMS

Description:

Regular languages are closed under reverse. Assume L is a regular language and M recognizes L ... MR as M with the arrows reversed. MR IS NOT ALWAYS A DFA! It ... – PowerPoint PPT presentation

Number of Views:42
Avg rating:3.0/5.0
Slides: 31
Provided by: nickh4
Category:

less

Transcript and Presenter's Notes

Title: INHERENT LIMITATIONS OF COMPUTER PROGAMS


1
CSci 4011
INHERENT LIMITATIONS OF COMPUTER PROGAMS
2
M (Q, S, ?, q0, F) where
Q q0, q1, q2, q3
S 0,1
? Q ? S ? Q transition function
q0 ? Q is start state
F q1, q2 ? Q accept states





3
The Language of M, L(M), is the set of strings
that M accepts
A language is regular if it is recognized by a
deterministic finite automaton
L w w contains 001 is regular
L w w has an even number of 1s is regular
4
Many interesting programs accept regular languages
  • NETWORK PROTOCOLS
  • COMPILERS
  • SUBSTRING GENETIC TESTING
  • BACKWARDS ARITHMETIC

5
THE REGULAR OPERATIONS
Negation ?A w w ? A
Union A ? B w w ? A or w ? B
Intersection A ? B w w ? A and w ? B
Reverse AR w1 wk wk w1 ? A
Concatenation A ? B vw v ? A and w ? B
Star A w1 wk k 0 and each wi ? A
6
  • THEOREM The Regular Languages are closed under
    the regular operations.

If A and B are regular, applying any regular
operation yields a regular language.
7
THE REGULAR OPERATIONS
Negation ?A w w ? A
Union A ? B w w ? A or w ? B
Intersection A ? B w w ? A and w ? B
8
UNION THEOREM
Given two languages, L1 and L2, define the union
of L1 and L2 as L1 ? L2 w w ? L1 or w ? L2

Theorem The union of two regular languages is
also a regular language
9
Theorem The union of two regular languages is
also a regular language
Proof Let M1 (Q1, S, ?1, q0, F1) be finite
automaton for L1 and M2 (Q2, S, ?2, q0, F2)
be finite automaton for L2
1
2
We want to construct a finite automaton M (Q,
S, ?, q0, F) that recognizes L L1 ? L2
10
Theorem The union of two regular languages is
also a regular language
M1
M2
M ?
11
Idea Run both M1 and M2 at the same time!
F (q1, q2) q1 ? F1 or q2 ? F2
?( (q1,q2), ?) (?1(q1, ?), ?2(q2, ?))
12
Theorem The union of two regular languages is
also a regular language
13
1
q0,p0
q1,p0
1
0
0
0
0
1
q0,p1
q1,p1
1
14
THE REGULAR OPERATIONS
Negation ?A w w ? A
Union A ? B w w ? A or w ? B
Intersection A ? B w w ? A and w ? B
Reverse AR w1 wk wk w1 ? A
15
REVERSE CLOSURE
Regular languages are closed under reverse
Assume L is a regular language and M recognizes L
We build MR that accepts LR
If M accepts w then w describes a directed path
in M from start to an accept state
Define MR as M with the arrows reversed
16
MR IS NOT ALWAYS A DFA!
It may have many start states
Some states may have too many outgoing edges, or
none
17
0,1
1
0
0
0
1
1
18
NON-DETERMINISM
0,1
1
0
0
0
1
1
What happens with 100?
We will say that the machine accepts if there is
a way to make it reach an accept state
19
Deterministic Computation
Non-Deterministic Computation
reject
accept or reject
accept
20
0,1
0,1
0,e
0
21
1
1
0,1
e
0
0
22
1
0
0
L(M)1,00
23
A non-deterministic finite automaton is a 5-tuple
N (Q, S, ?, Q0, F)
Q is the set of states
S is the alphabet
? Q ? Se ? P(Q) is the transition function
Q0 ? Q is the set of start states
F ? Q is the set of accept states
P(Q) is the set of subsets of Q and Se S ? e
24
1
q4
q2
0
N (Q, S, ?, Q0, F)
q3
Q q1, q2, q3, q4
0
S 0,1
q1
Q0 q1, q2
F q4 ? Q
?(q2,1)
q4
?(q3,1)
?
25
0,1
0,1
0,e
0
q1
q3
q2
N (Q, S, ?, Q0, F)
Q q1, q2, q3
?(q1,0)
q1, q2
S 0,1
?(q1,e)
q2
Q0 q1
F q3 ? Q
?(q2,1)
?
26
MULTIPLE START STATES
We allow multiple start states for NFAs, and
Sipser allows only one
Can easily convert NFA with many start states
into one with a single start state
e
e
e
27
UNION THEOREM FOR NFAs
0
0
1
0
1
28
NFAs ARE SIMPLER THAN DFAs
An NFA that recognizes the language 1
1
A DFA that recognizes the language 1
0,1
0
1
0,1
29
Theorem Every NFA has an equivalent DFA
Corollary A language is regular iff it is
recognized by an NFA
Corollary L is regular iff LR is regular
30
THE REGULAR OPERATIONS
Negation ?A w w ? A
Union A ? B w w ? A or w ? B
Intersection A ? B w w ? A and w ? B
Reverse AR w1 wk wk w1 ? A
Concatenation A ? B vw v ? A and w ? B
Star A w1 wk k 0 and each wi ? A
Write a Comment
User Comments (0)
About PowerShow.com