简体   繁体   中英

Context free and regular language with push-down automata and infinite elements

I was doing my HW assignment for my theory class and came across a problem that I don't really even know where to begin. We are covering the section of Push-Down automata.

"Let L1 be a context-free language and L2 be regular. Show that there exists an algorithm to determine whether or not L1 and L2 have an infinite number of common elements."

I am not sure how to go about solving this. I cannot get my mind to grasp the idea. I do know that regular languages do not allow ambiguity and am wondering if that is something that will need to be considered for this problem. Also with it being in the "Push-Down Automata" section I am assuming it may require creating a npda or pda. Can anyone at least steer me in the right direction. Not asking for HW solving, but for HW help!

  1. Given a PDA A1 for L1 and a DFA A2 for L2, construct A3 which recognizes the intersection of L1 and L2 using the Cartesian Product Machine construction as you would between two DFAs. The formal construction is a bit messy but basically you have new states that track combinations of old ones and add transitions/stack changes as needed.

  2. Construct a CFG G3 from A3 using a standard construction. Again, the proof is messy and you end up with messy grammars but this too can be done.

  3. Remove useless variables, empty and unit productions from G3. If you are used to Chomsky Normal Form (CNF) this is basically a similar sort of process.

  4. Create a dependency graph of nonterminals. If there is a loop in your dependency graph, the language of G3 is infinite.

  5. Since G3 is a grammar for the words in common between L1 and L2, G3 produces infinitely many words iff L1 and L2 have infinitely many words in common.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM