Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Deterministic PDAs
Deepak DSouza
Department of Computer Science and Automation
Indian Institute of Science, Bangalore.
21 October 2011
Deterministic PDAs Closure properties of DCFLs Complementing DPDAs
Outline
1
Deterministic PDAs
2
Closure properties of DCFLs
3
Complementing DPDAs
Deterministic PDAs Closure properties of DCFLs Complementing DPDAs
Deterministic PDAs
a a b a b a a b
X
X
Y
X
q
b a
A PDA with restrictions that:
At most one move possible in any conguration.
For any state p, a A, and X : at most one move of the
form (p, a, X) (q, ) or (p, , X) (q, ).
Effectively, a DPDA must see the current state, and top of
stack, and decide whether to make an -move or read input
and move.
Accepts by nal state.
We need a right-end marker for the input.
Deterministic PDAs Closure properties of DCFLs Complementing DPDAs
Example DPDA
Example DPDA for {a
n
b
n
| n 0}
(s, a, ) (p, A)
(p, a, A) (p, AA)
(p, b, A) (q, )
(q, b, A) (q, )
(q, , ) (t , )
(s, , ) (t , ).
Deterministic PDAs Closure properties of DCFLs Complementing DPDAs
Closure Properties of DCFLs
DCFL
CFL
All languages over A
Regular
a
n
b
n
a
n
b
n
c
n
a
n
b
n
c
n
Closed?
Complementation
Union X
Intersection X
Deterministic PDAs Closure properties of DCFLs Complementing DPDAs
Closure Properties of DCFLs
DCFL
CFL
All languages over A
Regular
a
n
b
n
a
n
b
n
c
n
a
n
b
n
c
n
Closed?
Complementation
Union
X
Intersection X
Deterministic PDAs Closure properties of DCFLs Complementing DPDAs
Closure Properties of DCFLs
DCFL
CFL
All languages over A
Regular
a
n
b
n
a
n
b
n
c
n
a
n
b
n
c
n
Closed?
Complementation
Union X
Intersection
X
Deterministic PDAs Closure properties of DCFLs Complementing DPDAs
Closure Properties of DCFLs
DCFL
CFL
All languages over A
Regular
a
n
b
n
a
n
b
n
c
n
a
n
b
n
c
n
Closed?
Complementation
Union X
Intersection X
Deterministic PDAs Closure properties of DCFLs Complementing DPDAs
DCFLs are closed under complementation
Theorem (Closure under complementation)
The class of languages denable by Deterministic Pushdown
Automata (i.e. DCFLs) is closed under complementation.
Deterministic PDAs Closure properties of DCFLs Complementing DPDAs
Problem with complementing a DPDA
Try ipping nal and non-nal states: Problems?
which
Does not get stuck due to no transition or stack empty.
Has only sink nal states.
Deterministic PDAs Closure properties of DCFLs Complementing DPDAs
Construction - Step 1
Dene M
= (Q Q
{s
1
, r, r
}, A, {}, s
1
,
, , F
) where
Q
= {q
| q Q} and F
= {f
| f F}.
, , ) (r
, ) (p
)
(p, , X) (q
, ) if (p, , X) (q, ) .
(p
, , X) (q
, ) if (p, , X) (q, ) .
(r, a, X) (r, X)
(r, , X) (r
, X)
(r
, , X) (r
, X)
(f
, , X) (f
.
Deterministic PDAs Closure properties of DCFLs Complementing DPDAs
After Step 1
DPDA M
, X) If p Q
.
Deterministic PDAs Closure properties of DCFLs Complementing DPDAs
Correctness
Argue that:
Deleting a spurious transition (starting from a non-F
-nal
state) does not change the language of M
.
All innite loops use a spurious transition.
Look at graph of stack height along innite loop, and argue that
there are innitely many future minimas.
Further look at transitions applied at these points and observe
that one must repeat.
Thus replacing spurious transitions as described earlier will
remove the remaining undesirable loops from M
s behaviours.
Deterministic PDAs Closure properties of DCFLs Complementing DPDAs
Complementing
Resulting M
.).
Now make r