E is our decider for EQ CFG

advertisement
presents
Reducibility
with Dr. Bunsen Honeydew
Hello, I’m Dr. Bunsen Honeydew. Today
we’re going to talk about Reducibility.
We’ve been having some…issues here
around the studio.
Beaker started experimenting with Turing
Machines and…well, he found about
about the Halting Problem the hard way.
He’s still looping.
Now, on to our lesson
Suppose we have a context-free
grammar, EQCFG which we want to prove
is undecidable. We use reducability!
Determining that EQCFG is undecidable is
easy when we remember Corollary 5.23,
which some incredibly smart person
figured out for us. . .
Corollary 5.23 says:
If A ≤m B and A is undecidable, then B
is undecidable
That means that if you have something
that is undecidable, you can reduce it to a
second object to prove that it is
undecidable as well.
So let’s use this corollary to prove that
EQCFG is undecidable. Do we know of
anything that is already undecidable?
We already know that ALLCFG is
undecidable!
Indeed. So if ALLCFG is undecidable, we
should follow Corolary 5.23 and reduce it
to EQCFG show that EQCFG is also
undecidable
Let’s go to the chalkboard. . .
Goal: reduce ALLCFG to EQCFG to show that EQCFG is undecidable
Set up our contradiction proof
First, let’s just assume that EQCFG is actually decidable.
Then we’re going to create a decider for it named E.
Now, let’s make a decider which will decide ALLCFG an we’ll call
it A. A does something special though. A is going to use
E like a subroutine, giving it the ability to decide EQCFG
as well as ALLCFG
Since A is our decider,
if ALLCFG is decidable, A will accept
else reject
So now that we have our deciders, let’s build our machine!
For our decider A, we need to define certain actions for certain inputs, just like if
we were writing code for A . . .
Now, for the input, let’s use an arbitrary name, G1. Now, ALLCFG is defined as:
ALLCFG = {<G1> | G1 is a CFG and L(G1)= Σ*} so G1 is a Context Free Grammar
with the language Σ*. So write our definition for A as follows:
A: “on input <G1>
(a CFG with the language defined above)
1. Change <G1> into <G2,G3>
2. Return E(<G2>,<G3>)
(E is our decider for EQCFG )
You’ll notice that in number 1, we say we’re going to CHANGE G1.
Why?
This is part of Reducing something. We have input which is of ALLCFG. If we can
change that input to be like EQCFG, then it means that ALLCFG and EQCFG are the
same and therefore, both undecidable. Right?
So let’s skip ahead and look at what our final output will look like:
What will the change need to satisfy?? (This is part of phase 3)
• <G1> ∈ ALLCFG => <G2, G3> ∈ EQCFG
•This means that some G1, which is a member of ALLCFG will need
to change into G2,G3, which are members of EQCFG
• <G1> ∉ ALLCFG => <G2, G3> ∉ EQCFG
•This means that some G1, which is not a member of ALLCFG will
need to change into G2,G3, which are not members of EQCFG
Now that we have a little preview of our goal, let’s skip ahead and look at the
second step of our reduction proof:
Now let’s actually change G1, like we were just talking about
“On input <G1>
1. Let some G2 = G1 (so we now have a CFG G2 which is
exactly the same as G1
2. Build G3 with L(G3) = Σ* (so the language is Σ*)
Output <G2, G3>”
Now that we have effectively changed, G1 into G2,G3. Now let’s see if it met
our goals that we just talked about.
<G1> ∈ ALLCFG and the language of G1 is as follows: L(G1) = Σ*
We created G2 as a copy of G1 so L(G2) is like L(G1) and = Σ*
When we created G3, we defined its language as Σ*; therefore, L(G3)
also = Σ*
Let’s review that EQ = { <G2,G3>|G2 and G3 are CFGs and L(G2) = L(G3) }
Are the languages of G2 and G3 the same?
YES!
Therefore, we can conclude that:
<G2, G3> ∈ EQCFG because L(G2) = L(G3)
That proves that the languages are the same, but can we show the reverse?
<G1> ∉ ALLCFG then L(G1) ≠ Σ* (common sense if we look at the definition)
So L(G2) – and remember that G2 is a copy of G1 – L(G2) ≠ Σ*
Therefore, L(G2) ≠ L(G3) = Σ* (we defined the language of G3 as being Σ*!)
So we can conclude that
<G2, G3> ∉ EQCFG
So back to our decider. Does A accept?
Heavens no. The contradiction lies in the
undecidability of ALLCFG, not EQCFG
Download