Deciding Properties of FAs and CFGs

Context: FIT2014_MOC · the positive side of Decidability and Decision Problems — concrete deciders for questions about automata and grammars, all built from one idea: mark, then propagate to a fixpoint

Quick Revision

  • 🎯 Objective: given or , decide a property of / seed a mark set, close it under one rule, read the verdict off the Start symbol/state.
  • ⚠️ Key Constraint: the Accept polarity is inverted. These machines decide “is the language EMPTY?”, so Accept fires when the target is not reached. Writing “if a final state is marked, Accept” reverses the whole answer.

📝 The catalogue of decidable problems

InputQuestionDecider given in lecture?
a Finite AutomatonDoes it define the empty language?✅ marking (below)
two Regular ExpressionsDo they define the same language?✅ via symmetric difference
a Context Free GrammarDoes it define the empty language?✅ marking (below)
a Finite AutomatonDoes it define an infinite language?❌ stated decidable only
a Context Free GrammarDoes it generate an infinite language?❌ stated decidable only
a CFG and a string Can be generated?❌ — but this is CYK Algorithm via Chomsky Normal Form
  • Everything here is a property of the language, not of the syntax ➔ two different FAs with the same language must get the same verdict, which is why the decider must run a construction rather than pattern-match the input string.

🔎 FA-Empty — reachability marking

  1. Mark the Start State of .
  2. Repeat until no new state gets marked: mark any state with a transition coming into it from an already-marked state.
  3. If no Final State is marked, Accept; otherwise Reject.

Trace with states (Start), , , (Final); transitions , , , :

RoundRule firedNewly markedMarked set
0seed the Start State
1, source marked
2, source marked
3 adds nothing — fixpoint

Verdict: Final State unmarked ⟹ Accept (state is unreachable, so no accepting path exists).

🔁 RegExpEquiv — reduce equality to emptiness

  1. Construct a FA defining the symmetric difference .
  2. Run the FA-Empty decider on .
  3. If accepts , Accept; else Reject.

🌱 CFG-Empty — generativity marking

  1. Mark all terminal symbols.
  2. Repeat until no new symbol gets marked: mark any nonterminal having a production whose right-hand side is entirely marked.
  3. If the Start Symbol is not marked, Accept; else Reject.

Trace; ; ; :

RoundRule firedNewly markedMarked set
0seed all terminals
1 and have fully marked RHS
2 now fully marked
3 now fully marked

Verdict: Start Symbol is marked ⟹ Reject. (Delete and the chain stalls at round 1: , then , then stay unmarked and the machine Accepts.)

  • A marked symbol means “derives some terminal word” ➔ marking is bottom-up generativity, the exact opposite direction from FA-Empty’s top-down reachability. Same fixpoint skeleton, mirrored orientation.

🧮 Proof Blueprint — why a marking algorithm decides

Theorem. FA-Empty and CFG-Empty are decidable.

Strategy ➔ show the marking loop (i) terminates and (ii) computes exactly the intended set; then the verdict test is a single lookup.

⚠️ Common Mistakes

  • 💡 Inverted Accept ➔ both algorithms Accept when the target is unmarked, because the language being decided is the set of empty-language machines. Quote the language definition before writing the last step.
  • 💡 Marking the wrong direction in CFG-Empty ➔ it seeds terminals and grows upward to ; seeding and expanding downward computes reachability of symbols, a different (also useful) set that answers a different question.
  • 💡 "" is not ” has no Final State” ➔ an FA can have Final States that no path reaches; the whole point of step 2 is to test reachability, not presence.
  • 💡 Don’t “just compare the two regexes” is a property of the languages; and are textually unlike and equal. Only the construction settles it.

🧠 Active Recall