You are on page 1of 1

Expert Q&A

Find solutions to your homework

Question

(0)

1. Is the following language decidable or not? If


you deem it decidable, you need to give an
algorithm and analyse its running time. If not
decidable, you need to prove it.

2. Is the following language decidable or not? If


you deem it decidable, you need to give an
algorithm and analyse its running time. If not
decidable, you need to prove it.

3. Is the following language decidable or not? If


you deem it decidable, you need to give an
algorithm and analyse its running time. If not
decidable, you need to prove it.

4. You work at an IT company, and your boss asks


you to write a program that takes a Java program
and checks if it terminates in time 2n for inputs of
length n. We know that Java programs are as
powerful as Turing machines, so we can replace
Java programs with Turing machines without loss
of generality.

a. Formulate the above problem as a language


involving Turing machines M.

b. Does Rice's theorem apply to this language?


Brie.y explain your reasoning.

c. Prove that this languages is undecidable (so you


can tell your boss that this task is in general not
feasible).

5. You are asked to check the work.ow chart of a


company. This work.ow chart has been used for
many years so it is large and problematic from
time to time. Indeed, you spotted a few cycles in
the chart, which are not desirable, because a
cycle means that this chain of steps goes back to
where it starts.

You note that this work.ow chart can be


modelled as a directed graph G=(V, E): the
vertices in V are the speci$c tasks, and the arcs in
E represent the transition from one task to the
next.

You wish to eliminate these cycles without


changing the overall chart too much. As a $rst
step, you want to identify a set S of no more than
k arcs, such that each cycle has at least one arc in
this set.

a. Formulate the above problem as a language L


involving (G, k) where G is a directed graph and k
is a number.

b. Prove that L is in NP.

c. Prove that L is NP-hard.

6. You are going to review the notion of zero-


knowledge protocol with a concrete example.

a. First, we review the graph isomorphism


problem. Please give the de$nition of this
problem. Then give an example of two graphs,
with the same numbers of vertices and edges,
that are not isomorphic, and explain why they are
not isomorphic.

b. Second, please describe the set-up of the


protocol, namely what is known at the beginning
of this protocol.

c. Third, please describe the 3-step protocol.

d. Fourth, please prove the three properties of this


protocol, namely completeness, soundness, and
zero-knowledge.

Show transcribed data

Expert Answer
This solution was written by a subject matter expert. It's
designed to help students like you learn core concepts.

Step-by-step

1st step All steps Answer only

Step 1/6

Step 1 :
1) Is the following language decidable or not? If
you deem it decidable, you need to give an
algorithm and analyse its running time. If not
decidable, you need to prove it.
L={(G,D)∣∣G is a CFG,D is a DFA, and L(G)∩L(D)=∅∅}

Answer :
The language L={(G,D)∣G is a CFG,D is a DFA, and
L(G)∩L(D)=∅} is decidable.
Here's an algorithm to decide this language:

1. Convert the CFG G to Chomsky Normal


Form (CNF):
Eliminate ε-productions.
Eliminate unit productions.
Eliminate useless symbols.
Convert the remaining productions to
CNF.
2. Enumerate all strings of length up to n,
where n is the pumping length of D.
Use breadth-$rst search or any other
method to generate strings in
lexicographic order.
3. For each string w generated in step 2, check
if w∈ L(G) and w∈ L(D).
To check if w∈L(G), use the CYK
algorithm or any other algorithm for
membership in a context-free
language.
To check if w∈L(D), use the DFA D.
4. If w∈ L(G)∩L(D) for any w, reject; otherwise,
accept.

Explanation:
This algorithm will decide whether
L(G)∩L(D)=∅. Now, let's analyze the
running time:

The conversion of the CFG to CNF


can be done in polynomial time with
respect to the size of the CFG.
Enumerating strings up to length n
can be done in exponential time, but
since n is $xed (the pumping length
of D), this is effectively polynomial.
Checking membership in L(G) using
CYK or any other algorithm for
context-free languages is polynomial
in the size of the string and the size of
the CNF.
Checking membership in L(D) using
the DFA D is polynomial in the length
of the string.

Step 2/6

2. Is the following language decidable or not? If


you deem it decidable, you need to give an
algorithm and analyse its running time. If not
decidable, you need to prove it.
L = { F | F is a boolean formula and F evaluates to
true on every assignment }

Answer :
The language L={F∣F is a boolean formula and F
evaluates to true on every assignment} is
undecidable. This is a consequence of the famous
Halting Problem being reducible to the problem
of determining whether a boolean formula is
universally true.

Here's a brief sketch of the proof:

1. Assume, for the sake of contradiction, that


there exists an algorithm A that decides
whether a given boolean formula F is
universally true.
2. Construct a new algorithm B that takes as
input a description of a Turing machine M
and an input x and does the following:
Construct a boolean formula FM,x that
is true if and only if M halts on input x.
Use the assumed algorithm A to
determine whether FM,x is universally
true.
3. Now, if M halts on input x, then FM,x is true
for all assignments, and if M doesn't halt on
input x, then FM,x is false for all
assignments.
4. Therefore, B decides the Halting Problem: it
correctly determines whether M halts on
input x.
5. However, it's a well-known result (by Turing)
that the Halting Problem is undecidable.
This is a contradiction, and hence our
assumption that there exists an algorithm A
for L must be false.

Therefore, the language L is undecidable.

Step 3/6

3. Is the following language decidable or not? If


you deem it decidable, you need to give an
algorithm and analyse its running time. If not
decidable, you need to prove it.
L = { M | M is a Turing machine and L(M) ∈
TIME(2n)}

Answer :
The language L={M∣M is a Turing machine and
L(M)∈TIME(2n)} is undecidable. Here's a proof
sketch:

1. Suppose, for the sake of contradiction, that


there exists a decider D for this language.
2. We can use D to solve the Halting Problem,
which is known to be undecidable.
3. Given a Turing machine M and an input w
for the Halting Problem, we can construct a
new Turing machine N that simulates M on
input w for 2n steps (where n is the length of
the input).
4. If M halts on w, then N will accept after 2n
steps. If M doesn't halt on w, N will never
halt.
5. Now, L(N)∈TIME(2n) if and only if M halts on
w. Therefore, we can use D to decide the
Halting Problem.
6. This is a contradiction because the Halting
Problem is undecidable.

Therefore, the assumption that there exists a


decider for L must be false, implying that L is
undecidable.

Explanation:
This proof follows a common technique in
showing undecidability by reducing a
known undecidable problem (Halting
Problem in this case) to the given problem.

Step 4/6

4a)
Ans:
The problem can be formulated as the following
language involving Turing machines:
L={M∣for every input of length n, the computation
of M halts within 2n steps}

4b)
Ans:
=>Rice's theorem states that all non-trivial
properties of the language recognized by a Turing
machine are undecidable. A non-trivial property is
one that is true for some Turing machines and
false for others, and it must not be true for all
Turing machines or false for all Turing machines.

=> In this case, the property "halting within 2n


steps for every input of length n" is non-trivial
because it is true for some Turing machines (those
that satisfy the property) and false for others
(those that do not). Therefore, Rice's theorem
applies.

4c)
Ans:
=>To prove that the language is undecidable, we
can use a reduction from the Halting Problem:

1. Suppose we have a decider D for the


language L.
2. Given a Turing machine M and an input w
for the Halting Problem, construct a new
Turing machine N that behaves as follows:
If the input is of the form ⟨M,w⟩, then
N simulates M on w for 2n steps.
If M halts on w within 2n steps, N
accepts.
If M does not halt on w within 2n
steps, N enters an in$nite loop.
3. Now, L(N) is in the language L if and only if
M halts on w. This is because, in the case of
halting, L(N) is in L (completes computation
within 2n steps for all inputs of length n),
and in the case of non-halting, L(N) is not in
L (does not complete computation within 2n
steps for some inputs of length n).
4. We have effectively reduced the Halting
Problem to the problem of deciding
membership in L, implying that L is
undecidable.

Explanation:
Therefore, it is not feasible to write a
program that can determine if a given
Turing machine halts within 2n steps for all
inputs of length n.

Step 5/6

5a)
Ans:
The problem can be formulated as the following
language involving directed graphs and a
number:
L={(G,k)∣there exists a set of at most k arcs such
that each cycle in G has at least one arc in this set}
5b)
Ans:
=>To show that L is in NP, we need to
demonstrate that given a proposed solution (a set
of at most k arcs), we can verify in polynomial time
whether it satis$es the condition (each cycle has
at least one arc in the set).

=>To do this, we can iterate through each cycle in


the directed graph G and check if it contains at
least one arc from the proposed set. This can be
done in polynomial time since the number of
cycles is bounded by the size of the graph, and
the length of each cycle is also bounded.
5c)
Ans:
=>To prove that L is NP-hard, we can reduce the
Hamiltonian Cycle problem to L.

=>The Hamiltonian Cycle problem is known to be


NP-complete. Given a graph H, we want to
determine if there is a simple cycle that visits
every vertex exactly once. We will construct a
polynomial-time reduction from Hamiltonian
Cycle to L:

1. Given an instance H of Hamiltonian Cycle,


create a directed graph G by replacing each
edge in H with two directed arcs (one in
each direction).
2. Set k=∣V∣−1, where V is the set of vertices in
G.
3. Claim: H has a Hamiltonian cycle if and only
if (G,k) is a positive instance of L.
If H has a Hamiltonian cycle, we can
choose the arcs corresponding to the
edges in the cycle as the set S. Each
cycle in G will have at least one arc
from this set.
If (G,k) is a positive instance of L, then
the set S must contain at least one arc
from each cycle in G. Since each edge
in H corresponds to two arcs in G,
choosing one arc from each cycle
corresponds to selecting edges that
form a Hamiltonian cycle in H.

5d)
Ans:
=>Reduction can be done in polynomial time, and
it establishes a polynomial-time many-one
reduction from Hamiltonian Cycle to L.

Explanation:
Therefore, L is NP-hard, and since it is also
in NP (as shown in part b), it is NP-
complete.

Step 6/6

6a)
Ans:
Graph Isomorphism Problem:

De!nition: Given two graphs G1 and G2,


determine whether there exists a bijective
function f:V(G1)→V(G2) such that for every
edge (u,v) in G1, there is a corresponding
edge (f(u),f(v)) in G2, and vice versa.
Example: Consider the graphs G1 and G2
below:
luaCopy code
G1: 1-- 2 G2: A -- B | | | | 3--
4 C -- D
These graphs have the same number of
vertices (4) and edges (4), but they are not
isomorphic. There is no bijection between
their vertices such that the edges are
preserved.

6b)
Ans:
Protocol Set-up:

At the beginning of the zero-knowledge


protocol for graph isomorphism, the prover
(Peggy) and the veri$er (Victor) know:
1. The graphs G1 and G2 that Peggy
claims are isomorphic.
2. The isomorphism f:V(G1)→V(G2) if it
exists.

6c)
Ans:
3-Step Zero-Knowledge Protocol:

1. Commitment (Peggy to Victor):


Peggy commits to a random
permutation of the vertices of G1 and
sends the permutation to Victor
without revealing it.
2. Challenge (Victor to Peggy):
Victor chooses a random bit b and
sends it to Peggy.
3. Response (Peggy to Victor):
If b=0, Peggy sends the original
permutation of the vertices of G1.
If b=1, Peggy sends the permutation
after applying the isomorphism f.

6d)
Ans :
Properties of the Protocol:

Completeness: If G1 and G2 are isomorphic,


then Peggy can convince Victor with high
probability by sending the permutation after
applying the isomorphism.
Soundness: If G1 and G2 are not isomorphic,
then for any permutation Peggy sends,
Victor has an equal chance of receiving a
correct permutation whether b=0 or b=1.
Zero-Knowledge: An efficient simulator
exists that, given G1 and G2, can simulate
the messages that Victor would receive in
the protocol without knowing the
isomorphism f. This demonstrates that no
information about the isomorphism is leaked
during the protocol.

Final answer

This is the $nite automata language, for each


question considering the grammar i have
provided the answers.

Was this answer helpful?

2 0

Post a question
Your toughest questions, solved step-by-step.

For example: What is E = mc^2?

6 days left to ask 20 more questions

Continue to post

Questions viewed by other


students
Q: 1. Is the following language decidable or not? If
you deem it decidable, you need to give an
algorithm and analyse its running time. If not
decidable, you need to prove it.2. Is the following
language decidable or not? If you deem it
decidable, you need to give an algorithm and
analyse its running time. If not decidable, you
need to prove it. 3. Is the following language
decidable or not? If you deem it decidable, you
need to give an algorithm an...

A: See answer 100% (2 ratings)

Q: Use the Myhill-Nerode theorem to prove that the


followinglanguage is not regular. (5 pts)𝐿=
{𝑤𝑤∣𝑤∈{0,1}∗}

A: See answer 100% (3 ratings)

Show more

My Textbook Solutions

Add textbook

Academic Integrity / Feedback / Help Center /


Manage Subscription

Cookie Notice Your Privacy Choices

Do Not Sell My Info General Policies

Privacy Policy (New) Honor Code IP Rights

© 2003-2023 Chegg Inc. All rights reserved.

You might also like