1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lora16 [44]
3 years ago
5

) Consider the ambiguous CFG problem: given a context free grammar, does there exist a string that can be generated by two diffe

rent parse trees. Show that this problem is undecidable by reducing the post correspondence problem to it. The post correspondence problem is the following: given two sequences of strings a1, ..., an and b1, ..., bn, is there a sequence of indices i1, ..., im (with possibly repeats, and whose total length may be much bigger than n) such that ai1 ai2 ...aim = bi1 bi2 ...bim?
Computers and Technology
1 answer:
vodomira [7]3 years ago
4 0

Answer:

See explaination

Explanation:

The post correspondence problem is: Given a_1, \ldots, a_n and b_1, \ldots, b_n , is there a sequence of indices 11. ..., im such that a_{i_1}\ldots a_{i_m} = b_{i_1}\ldots b_{i_m} .

To reduce from the PCP to the ambiguous CFG problem, do the following. Add some more symbols c_1, \ldots, c_n and define the following languages:

L_{A} = \{a_{i_1}\ldots a_{i_k}c_{i_k}\ldots c_{i_1} \mid k \geq 1\}

L_{B} = \{b_{i_1}\ldots b_{i_k}c_{i_k}\ldots c_{i_1} \mid k \geq 1\}

L_{AB} = L_A \cup L_B .

Define the following grammar for the language L_{AB} :

S \to S_{A} \mid S_{B}

S_A \to a_iS_Ac_i \mid a_ic_i, 1 \leq i \leq n

S_B \to b_iS_Bc_i \mid b_ic_i, 1 \leq i \leq n

It is easy to see that the given grammar generates the langauge L_{AB} . The reduction outputs the grammar thus constructed.

To see why this is a valid reduction, let there be a solution to the post correspondence problem, i.e. 11. ..., im such that a_{i_1}\ldots a_{i_m} = b_{i_1}\ldots b_{i_m} . Then the string a_{i_1}\ldots a_{i_m}c_{i_m}\ldots c_{i_1} = b_{i_1}\ldots b_{i_m}c_{i_m}\ldots c_{i_1} has two difference derivations in the given grammar, one using S_A and the other using S_B .

Conversely, let a string generated by the given grammar have two different derivations. Note that S_A and S_B can only generate one derivation tree for any string, hence the only way for two different derivations to happen is for one of them to go to S_A and the other to S_B .

Let the string for which ambiguity appears be of the form a_{i_1}\ldots a_{i_m}c_{i_m}\ldots c_{i_1} . Then the other derivation must produce a string of the form b_{i_1}\ldots b_{i_m}c_{i_m}\ldots c_{i_1} , this is because both derivations must produce the same string for ambiguity to occur, hence the part which uses c_i must be the same. Note that this further implies that a_{i_1}\ldots a_{i_m} = b_{i_1}\ldots b_{i_m} , which is equivalent to saying that the post correspondence problem has a solution.

Hence the reduction works as expected. This proves that the ambiguous CFG problem is undecidable, otherwise post correspondence problem would be decidable, which is a contradiction.

You might be interested in
Code Problem 2 in Python 2.
nlexa [21]

I've included my code in a picture. I hope this helps!

3 0
3 years ago
Whatisthebestlocationapp for my androidphonebesidesgoogle maps?
Cerrena [4.2K]
Not sure whether this question is requires a specific answer but I would say Waze.
3 0
4 years ago
A _________ provides multiple ports for connecting nodes and is aware of the exact address or identity of all the nodes attached
Novosadov [1.4K]
The word you are looking for is "hub".
5 0
3 years ago
Read 2 more answers
Match the job titles to the tasks
bija089 [108]

creates storyboards based on clients’ needs- Animator


assesses proposals for airplane designs to determine if they meet standards- Aeronautical engineer


uses special equipment and techniques to capture images- Commercial Photographer


creates software code, graphics, and multimedia elements for websites- Webpage designer

5 0
3 years ago
Read 2 more answers
Which process refers to starting up a computer?<br> is the process of starting a computer.
Dennis_Churaev [7]

Answer: Boot Up or booting

Explanation:

6 0
4 years ago
Read 2 more answers
Other questions:
  • An enterprise DBMS is automatically capable of serving as a mobile DBMS. There are no special issues raised by mobility. True Fa
    11·1 answer
  • A USB is used for _________.[ pick the best answer that makes sense]
    14·2 answers
  • CHEMISTRY. metal+water》base+...............​
    12·1 answer
  • What is the primary difference between the windows server 2012 r2 server manager and previous versions (before windows server 20
    11·1 answer
  • the penalties for ignoring the requirements for protecting classified information when using social networking services are ____
    12·1 answer
  • What type of photography is represented by a photograph of a dog on a beach ?
    11·1 answer
  • Websites not only give us information, but they also inspire designers in their layouts, illustrations, images, typefaces, and c
    6·1 answer
  • What is one of the benefits of using a library in a program?
    5·1 answer
  • How have these advances in-home technology changed the role of technicians in our society?
    10·1 answer
  • Benchmark test compare similar systems performing in which tasks
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!