Review: What is a computational problem - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Review: What is a computational problem

Description:

The input is a finite string of characters from some agreed upon alphabet S. ... e S0 is the empty string (length 0) ... leaving a state for the same symbol, ... – PowerPoint PPT presentation

Number of Views:19
Avg rating:3.0/5.0
Slides: 13
Provided by: compu62
Category:

less

Transcript and Presenter's Notes

Title: Review: What is a computational problem


1
Review What is a computational problem? The
input is a finite string of characters from some
agreed upon alphabet S. S the set of
finite strings composed of characters in S.
Sk the set of strings of length k. e Î S0
is the empty string (length 0). A language or
computational problem L is a subset of S. w Î
S means ww1, w2, , wn, where wi Î S, for
all i. For any machine M, we write L(M) for the
language accepted by M, i.e., the set of strings
w Î S such that if M starts in state q0 and r
is the state M is in after reading wn, then r Î F.
2
So far Finite Automata Deterministic Finite
Automata (DFA)
  • Now, Non-deterministic Finite Automata (NFA)
  • Multiple arrows leaving a state for the same
    symbol,
  • No arrows leaving a state for a given symbol,
  • Arrows labeled with ? leaving a state.

Example
1
0, 1
1
a4
q0
q1
q2
q3
0, 1
This accepts w w w1, w2,,wn-3, 1, wn-1,
1. Q Why?
3
Look at leaves. A4 (accept state) is in there,
so we accept the string.
What about ? arrows? Change states before
receiving new input (causes a
split on tree).
4
Defn A non-deterministic finite automaton
  • Q is a finite set called the states,
  • ? is a finite set called the alphabet,
  • q0 is the start state,
  • F ? Q is the set of accept states (or final
    states).
  • ? Q x (? ? ?) ? 2Q
  • (We also write Se for ? ? ? and
    P(Q) 2Q. )
  • Note It's possible to make a transition with out
    reading
  • any input. Also, you can go to more than
    one state.

5
  • What does it formally mean for an NFA to accept a
    string?
  • Defn An NFA accepts w over ? if we can
    rewrite
  • w y1 y2 ym where each yi ? ?? .
  • and we can find a sequence of states r0, ri, rm
  • So that
  • r0 q0
  • rm ? F
  • rii ? ? (ri, yi1)

6
Every DFA is an NFA. Well see the reverse is
true too.
Thm For every NFA M, ? a DFA D s.t. L(M)
L (D). Defn ? - closure of ? For r
? Q, let ?(?) p ? Q ? a sequence of ?
transitions from state r to p.
e
1, e
0, 1
a4
q0
q1
q2
q3
0
Ex ?(q1) q1 ?(q2) q2,
q3 For R ? Q, ?(R) ? ?(r), r ? R.
7
  • Thm For every NFA M, ? a DFA D s.t. L(D)
    L(M)
  • Pf (sketch) Let M (Q, ?, q0, F, ?) be any
    NFA. We will
  • construct a DFA D where D (Q, ?, q0,
    F, ?)
  • Let Q 2Q,
  • For R ? Q, (i.e., R ? Q) and a ? ???,
    let
  • ? (R,a) p ? q ? Q, r ? R s.t. q
    ? ? (r,a) and p ? ? (q),
  • q0 ?(q0), where q0 is the start state of
    M,
  • F S ? Q S ? F ? ?.

(Think about why this construction works!)
x
8
Thm Regular languages are closed under
union. Pf Let A and B be any two DFAs. We
will construct an NFA C s.t. L(C) L(A) ?
L(B).
A
B
A
e
A ? B
e
(NFA)
B
9
More formally, given MA (Q, ?, ?, q0, F),
MB (Q, ?, ?, q0, F) (DFAs),
construct NFA MC (Q?, ?, ??, q0?, F?)
Q? Q ? Q ? q0?, F?
F ? F, ?? (q, ?) ? (q, ?) if q
? Q ? (q, ?) if q ? Q
q0, q0 if q q0?, and s ?.
If w ? CL(MC), then we reached a final state p
in F? starting with an ? transition to q0 or
q0. In the first case w ? A in the second w
? B. Therefore C ? A ? B. Conversely, if w ?
A, then starting with an ? transition to q0 leads
to a final state in F ? F?, and if w ? B,
starting with an ? transition to q0 leads to a
state in F ? F?. So A ? B ? C.
x
10
Thm Regular languages are closed under
concatonation. Pf
A
B
?
A B
?
A
B
11
Concatonation We have MA (QA, ?A, q0A, FA, ?
) MB (QB, ?B, q0B, FB, ? ) Construct M
(Q, ?, q0, F, ? ) (This is an NFA) Q
QA ? QB (Disjoint Union) q0
q0A F FB ? (q, a) dA (q,a) if q ? QA
\ FA dB (q,a) if q ? QB
dA (q,a) if q ? FA and a ? FA ? ? dA
(q,a) q, q0B if a ? and q ? FA L(M)
L(MA) L(MB) A B.
x
12
Thm If A is regular, A is regular.
Pf (sketch)
?
?
A
?
Write a Comment
User Comments (0)
About PowerShow.com