Deterministic pushdown automaton
   HOME

TheInfoList



OR:

In
automata theory Automata theory is the study of abstract machines and automata, as well as the computational problems that can be solved using them. It is a theory in theoretical computer science. The word ''automata'' comes from the Greek word αὐτόματο ...
, a deterministic pushdown automaton (DPDA or DPA) is a variation of the
pushdown automaton In the theory of computation, a branch of theoretical computer science, a pushdown automaton (PDA) is a type of automaton that employs a stack. Pushdown automata are used in theories about what can be computed by machines. They are more capab ...
. The class of deterministic pushdown automata accepts the deterministic context-free languages, a proper subset of
context-free language In formal language theory, a context-free language (CFL) is a language generated by a context-free grammar (CFG). Context-free languages have many applications in programming languages, in particular, most arithmetic expressions are generated by ...
s. Machine transitions are based on the current state and input symbol, and also the current topmost symbol of the stack. Symbols lower in the stack are not visible and have no immediate effect. Machine actions include pushing, popping, or replacing the stack top. A deterministic pushdown automaton has at most one legal transition for the same combination of input symbol, state, and top stack symbol. This is where it differs from the nondeterministic pushdown automaton.


Formal definition

A (not necessarily deterministic) PDA M can be defined as a 7-tuple: :M=(Q\,, \Sigma\,, \Gamma\,, q_0\,, Z_0\,, A\,, \delta\,) where *Q\, is a finite set of states *\Sigma\, is a finite set of input symbols *\Gamma\, is a finite set of stack symbols *q_0\,\in Q\, is the start state *Z_0\,\in\Gamma\, is the starting stack symbol *A\,\subseteq Q\,, where A is the set of accepting, or final, states *\delta\, is a transition function, where :\delta\colon(Q\, \times ( \Sigma\, \cup \left \ ) \times \Gamma\,) \longrightarrow \mathcal(Q \times \Gamma ^) : where * is the
Kleene star In mathematical logic and computer science, the Kleene star (or Kleene operator or Kleene closure) is a unary operation, either on sets of strings or on sets of symbols or characters. In mathematics, it is more commonly known as the free monoid ...
, meaning that \Gamma^ is "the set of all finite strings (including the
empty string In formal language theory, the empty string, or empty word, is the unique string of length zero. Formal theory Formally, a string is a finite, ordered sequence of characters such as letters, digits or spaces. The empty string is the special c ...
\varepsilon) of elements of \Gamma", \varepsilon denotes the
empty string In formal language theory, the empty string, or empty word, is the unique string of length zero. Formal theory Formally, a string is a finite, ordered sequence of characters such as letters, digits or spaces. The empty string is the special c ...
, and \mathcal(X) is the
power set In mathematics, the power set (or powerset) of a set is the set of all subsets of , including the empty set and itself. In axiomatic set theory (as developed, for example, in the ZFC axioms), the existence of the power set of any set is post ...
of a set X. ''M'' is ''deterministic'' if it satisfies both the following conditions: * For any q \in Q, a \in \Sigma \cup \left \, x \in \Gamma, the set \delta(q,a,x)\, has at most one element. *For any q \in Q, x \in \Gamma, if \delta(q, \varepsilon, x) \not= \emptyset\,, then \delta\left( q,a,x \right) = \emptyset for every a \in \Sigma. There are two possible acceptance criteria: acceptance by ''empty stack'' and acceptance by ''final state''. The two are not equivalent for the deterministic pushdown automaton (although they are for the non-deterministic pushdown automaton). The languages accepted by ''empty stack'' are those languages that are accepted by ''final state'' and are prefix-free: no word in the language is the prefix of another word in the language. The usual acceptance criterion is ''final state'', and it is this acceptance criterion which is used to define the deterministic context-free languages.


Languages recognized

If L(A) is a language accepted by a PDA A, it can also be accepted by a DPDA if and only if there is a single computation from the initial configuration until an accepting one for all strings belonging to L(A). If L(A) can be accepted by a PDA it is a context free language and if it can be accepted by a DPDA it is a deterministic context-free language (DCFL). Not all context-free languages are deterministic. This makes the DPDA a strictly weaker device than the PDA. For example, the language ''L''p of even-length
palindrome A palindrome is a word, number, phrase, or other sequence of symbols that reads the same backwards as forwards, such as the words ''madam'' or ''racecar'', the date and time ''11/11/11 11:11,'' and the sentence: "A man, a plan, a canal – Pana ...
s on the alphabet of 0 and 1 has the context-free grammar S → 0S0 , 1S1 , ε. If a DPDA for this language exists, and it sees a string 0''n'', it must use its stack to memorize the length ''n'', in order to be able to distinguish its possible continuations and Hence, after reading comparing the post-"11" length to the pre-"11" length will make the stack empty again. For this reason, the strings and cannot be distinguished. Restricting the DPDA to a single state reduces the class of languages accepted to the LL(1) languages, which is a proper subclass of the DCFL. In the case of a PDA, this restriction has no effect on the class of languages accepted.


Properties


Closure

Closure properties of deterministic context-free languages (accepted by deterministic PDA by final state) are drastically different from the context-free languages. As an example they are (effectively) closed under complementation, but not closed under union. To prove that the complement of a language accepted by a deterministic PDA is also accepted by a deterministic PDA is tricky. In principle one has to avoid infinite computations. As a consequence of the complementation it is decidable whether a deterministic PDA accepts all words over its input alphabet, by testing its complement for emptiness. This is not possible for context-free grammars (hence not for general PDA).


Equivalence problem

Géraud Sénizergues (1997) proved that the equivalence problem for deterministic PDA (i.e. given two deterministic PDA A and B, is L(A)=L(B)?) is decidable, a proof that earned him the 2002
Gödel Prize The Gödel Prize is an annual prize for outstanding papers in the area of theoretical computer science, given jointly by the European Association for Theoretical Computer Science (EATCS) and the Association for Computing Machinery Special Interes ...
. For nondeterministic PDA, equivalence is undecidable.


Notes


Further reading

* {{Formal languages and grammars Automata (computation) Models of computation Formal languages