When constructing deterministic pushdown automata, can every state be a final state?
I'm having trouble, specifically, with constructing a DPDA that accepts the following language:
L = { 0n 1m | n ≥ m }
My approach is to make the initial state a final state that can push 0's to the stack for input 0's then transition to another final state that can pop 0's from the stack for input 1's. I believe this solution is correct, but it seems unusual for every state to be a final state, and I want to verify that my approach is valid.
Is this the correct approach? Can I have both states as final states? Here is the exact transition function δ for my DPDA.
δ(q0, 0, Z0) = { (q0, 0 Z0) }
δ(q0, 0, 0) = { (q0, 0 0) }
δ(q0, 1, 0) = { (q1, ε) }
δ(q1, 1, 0) = { (q1, ε) }
Of course, every state can be final in a deterministic pushdown automaton. Your approach seems correct to me. Depending on your definition on determinism it might be necessary to also add a transition that deals with the case where you read a 0 in state q_1 in order to have a total transition function (but this depends on what deterministic in your context is defined to be.)