3
$\begingroup$

I have been given the following problem and was wondering if my solution is correct (taken from the textbook exercise in the book Introduction to the Theory of Computation by Martin Sipser): Given $$\text{INFINITE}_{\text{PDA}} =\{\langle M\rangle \mid M\text{ is a PDA }\text{and L(M) is infinite}\}$$

Prove that $\text{INFINITE}_{\text{PDA}}$ is decidable.

The following is my solution:

On input <M>:
1. Repeat until there are transitions:
   a. Mark current state and delete the transition that moved you to the state
   b. If an already marked state is reached, accept
2. If no other transition exists, reject

Can this be considered a valid solution? I think the fact that we are checking if a cycle exists in the PDA is sufficient to prove that the language is infinite am I correct? I believe there could be a PDA that has a loop in a non-accepting branch of the computation and my algorithm would still say it has an infinite language which is wrong, am I correct?

$\endgroup$
2
  • 1
    $\begingroup$ We discourage "please check whether my answer is correct" questions, as only "yes/no" answers are possible, which won't help you or future visitors. See here and here. Can you edit your post to ask about a specific conceptual issue you're uncertain about? As a rule of thumb, a good conceptual question should be useful even to someone who isn't looking at the problem you happen to be working on. If you just need someone to check your work, you might seek out a friend, classmate, or teacher. $\endgroup$
    – D.W.
    Commented Apr 8, 2022 at 17:05
  • $\begingroup$ @D.W. I am asking here because nobody else replies and it could be helpful to other students in the future who appear to have the same question, I agree with you that in this case the answer could be a yes/no, but I disagree with the fact that it won't help me, I am studying hard for an exam and having these type of replies would help me find out if I am prepared or not (and fix my solutions), I also believe that these type of questions are useful to other students who find themselves having to solve the same problem, I will try to edit the question in a better way! $\endgroup$
    – Stecco
    Commented Apr 8, 2022 at 19:33

1 Answer 1

1
$\begingroup$

I'm not sure whether I understood your solution right. Here is my suggestion:

For code of M:

1- Find all paths from start state to an accept state which every state occurs only once.

2- Check whether in states that occurs in paths, There are states that are connected together with a path which doesn't appear in the main path from start state to accept state?

If there are, accept. OTHERWISE, reject.

With this algorithm, If the language is infinite, Then there are definitely states and strings that transition function allows a loop with them. If it doesn't, Since M has finite number of states, There are only finitely many strings which are accepted by M.

Also since we just look for paths from start state to accept stats that each state appears at most once, We won't have any loop in performance of this algorithm. Because there are only finite paths that satisfy this requirement.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.