Decidability 12-0 Decidable Problems Interesting problems - - PDF document

decidability
SMART_READER_LITE
LIVE PREVIEW

Decidability 12-0 Decidable Problems Interesting problems - - PDF document

Griffith University 3130CIT Theory of Computation (Based on slides by Harald Sndergaard of The University of Melbourne) Decidability 12-0 Decidable Problems Interesting problems regarding regular languages are


slide-1
SLIDE 1

✬ ✫ ✩ ✪ Griffith University 3130CIT Theory of Computation (Based on slides by Harald Søndergaard of The University of Melbourne)

Decidability

12-0

slide-2
SLIDE 2

✬ ✫ ✩ ✪

Decidable Problems

Interesting problems regarding regular languages are generally decidable. We can phrase these problems as language decidability problems. For example, the acceptance problem for DFAs is whether, given a DFA D and a string w, D accepts input w. Since we can encode the DFA as a string, the acceptance problem can be seen as testing for membership of the language ADF A = {D, w | D is a DFA that accepts w}

12-1

slide-3
SLIDE 3

✬ ✫ ✩ ✪

DFA Acceptance Is Decidable

Theorem: ADFA is a decidable language. Proof sketch: The crucial point is that it is possible for a Turing machine M to simulate a DFA D. M finds on its tape, say

1...n

  • Q

## ab...z

  • Σ

## 1a2#...#nbn

  • δ

## 1

  • q0

## 3 7

  • F

## baa...

  • w

$

First M checks that the first five components represent a valid DFA, and if not, rejects. Then M simulates the moves of D, keeping track

  • f D’s state and the current position in w, by

writing these details on its tape, after $. When the last symbol in w has been processed, M accepts if D is in a state in F, and rejects

  • therwise.

12-2

slide-4
SLIDE 4

✬ ✫ ✩ ✪

TMs as Interpreters

We did not show the details of how a Turing machine goes about simulating a DFA D. Many low-level programming steps are involved. However, it should be clear that it is possible for a Turing machine to mimic DFA behaviour this way. The description of D is nothing but a “program” and the claim is that a Turing machine can act as an interpreter for this language. Turing machines themselves can be encoded as strings, and then a Turing machine can interpret Turing machines. This is no more strange than the fact that we can write an interpreter for Haskell, say, in Haskell.

12-3

slide-5
SLIDE 5

✬ ✫ ✩ ✪

NFA Acceptance Is Decidable

Theorem: ANFA = {N, w | N is a NFA that accepts w} is a decidable language. Proof sketch: The procedure we gave for translating an NFA to an equivalent DFA was mechanistic and terminating, so a halting Turing machine can do that job. Having written the encoding of the DFA on its tape, the Turing machine can then “run” the machine M from the previous proof.

12-4

slide-6
SLIDE 6

✬ ✫ ✩ ✪

DFA Emptiness Is Decidable

Theorem: EDFA = {D | D is a DFA and L(D) = ∅} is decidable. Proof sketch: We can design a Turing machine which takes D = (Q, Σ, δ, q0, F) as input and performs a reachability analysis:

  • 1. Set reachable = {q0}, D’s start state.
  • 2. Set new =

{q | δ(m, x) = q, m ∈ reachable} \ reachable

  • 3. If new = ∅, set reachable = reachable ∪ new

and go to step 2.

  • 4. If reachable ∩ F = ∅, accept, otherwise reject.

12-5

slide-7
SLIDE 7

✬ ✫ ✩ ✪

DFA Equivalence Is Decidable

Theorem: EQDFA = {A, B | A and B are DFAs and L(A) = L(B)} is decidable. Proof sketch: We previously saw how it is possible to construct, from DFAs A and B, DFAs for A ∩ B, A ∪ B, and A. These procedures are mechanistic and finite—a halting Turing machine M can perform them. Hence from A and B, M can produce a DFA C to recognise L(C) =

  • L(A) ∩ L(B)
  • L(A) ∩ L(B)
  • Note that L(C) = ∅ iff L(A) = L(B).

So all M then need to do is to simulate the constructed DFA C and accept iff C accepts.

12-6

slide-8
SLIDE 8

✬ ✫ ✩ ✪

Generation by CFGs Is Decidable

Theorem: ACFG = {G, w | G is a CFG that generates w} is decidable. Proof: We can put a bound on the number of derivation steps needed to derive any w ∈ L(G). First convert G to an equivalent grammar G′ in Chomsky Normal Form. So every rule is of form A → B C or A → a. Let |w| = n. To derive w we would need to use a rule of the first form n − 1 times, and a rule of the second form n times. So any derivation of w has exactly 2n − 1 steps. A Turing machine can therefore take G and w, generate G′, and list all derivations of length 2n − 1. It accepts iff any of these generate w.

12-7

slide-9
SLIDE 9

✬ ✫ ✩ ✪

CFG Emptiness Is Decidable

Theorem: ECFG = {G | G is a CFG and L(G) = ∅} is decidable. Proof: We can design a Turing machine which takes G = (V, Σ, R, S) as input and performs a “producer” analysis:

  • 1. Set producers = Σ, all of G’s terminals.
  • 2. Set new =

   A

  • A → U1 · · · Un ∈ R,

{U1, . . . , Un} ⊆ producers   \producers

  • 3. If new = ∅, set producers = producers ∪ new

and go to step 2.

  • 4. If S ∈ producers, reject, otherwise accept.

12-8

slide-10
SLIDE 10

✬ ✫ ✩ ✪

Every CFL Is Decidable

Two slides back we saw that it is decidable whether a CFG G generates a string w. The deciding Turing machine, S, thus took G, w as input. Now we’re saying that any particular CFL L0 is decidable: Theorem: Every context-free language L0 is decidable. Proof: This amounts to saying that we can specialise (or partially evaluate) S. If L0 has a grammar G0, the decider for L0 simply takes input w and runs S on G0, w.

12-9

slide-11
SLIDE 11

✬ ✫ ✩ ✪

Every CFL Is Decidable (cont.)

What we have shown by now: Turing recognisable Regular (r.e.) Decidable Context-free Are there r.e. languages that are not decidable?

12-10

slide-12
SLIDE 12

✬ ✫ ✩ ✪

An Undecidable Language

We now show that it is undecidable whether a Turing machine accepts a given input string. That is, ATM = {M, w | M is a TM and M accepts w} is undecidable. The main difference from the case of ACFG, for example, is that a Turing machine may fail to halt. (The problem we are up against is really a variant

  • f the halting problem for Turing machines.)

12-11

slide-13
SLIDE 13

✬ ✫ ✩ ✪

TM Acceptance Is Undecidable

Theorem: ATM = {M, w | M is a TM and M accepts w} is undecidable. Proof: Assume (for contradiction) that ATM is decidable, decided by H: HM, w =    accept if M accepts w reject if M does not accept w Using H we can construct a Turing machine D which decides whether a given machine M accepts its own encoding M:

  • 1. Input is M, where M is some Turing

machine.

  • 2. Run H on M, M.
  • 3. If H accepts, reject. If H rejects, accept.

12-12

slide-14
SLIDE 14

✬ ✫ ✩ ✪

TM Acceptance (cont.)

In summary: DM =    accept if M does not accept M reject if M accepts M But no machine can satisfy that specification! We obtain an absurdity when we investigate D’s behaviour on its own encoding: DD =    accept if D does not accept D reject if D accepts D Hence neither D nor H can exist. Sipser shows very nicely how this proof is really just another use of diagonalisation.

12-13

slide-15
SLIDE 15

✬ ✫ ✩ ✪

A Universal Turing Machine

Note that ATM = {M, w | M is a TM and M accepts w} is Turing recognisable. The reason is that it is possible to construct a universal Turing machine U which is able to simulate any Turing machine. On input M, w, U simulates M on input w. If M enters its accept state, U accepts. If M enters its reject state, U rejects. If M never halts, neither does U.

12-14

slide-16
SLIDE 16

✬ ✫ ✩ ✪

Some Languages Are Not Even R.E.

Recall that a set is countable if it is finite or in a

  • ne-to-one correspondence with N.

For a finite (non-empty) alphabet Σ, Σ∗ is

  • countable. We can enumerate first all strings of

length 0, then those of length 1, and so on. Also recall how we used diagonalisation to show that there are sets, such as R, that are not countable. A similar argument shows that the set B of all infinite binary sequences is uncountable.

12-15

slide-17
SLIDE 17

✬ ✫ ✩ ✪

A Diagonalisation Argument

Assume B is countable. Then we can enumerate B: Element b1 1 1 1 1 . . . b2 1 1 1 1 1 . . . b3 1 1 1 1 1 . . . b4 1 1 . . . . . . However, the infinite sequence which has i’th bit =    if the ith bit of bi is 1 1 if the ith bit of bi is 0 cannot be any of bi. Hence B is uncountable.

12-16

slide-18
SLIDE 18

✬ ✫ ✩ ✪

Too Many Languages

But then the set of all languages over Σ is also uncountable. Namely, there is a one-to-one correspondence with B. Let an enumeration of Σ∗ yield s1, s2, s3, . . . For each language A over Σ, there is a unique characteristic sequence χA, whose ith bit is 1 if si ∈ A and 0 otherwise: Σ∗ : { ǫ, 0, 1, 00, 01, 10, 11, 000, 001, . . .} A : { 0, 00, 01, 000, . . .} χA : 1 1 1 1 . . . Hence we cannot put the set of all languages into a one-to-one correspondence with the set of all Turing machines.

12-17

slide-19
SLIDE 19

✬ ✫ ✩ ✪

Closure Properties

The set of Turing-recognisable languages is closed under the regular operations, and intersection. The set of decidable languages are closed under the same operations, and also under complement. Theorem: A language L is decidable iff both L and L are Turing-recognisable. Proof: If L is decidable, clearly L and also L are recognisable. Assume both L and L are recognisable. That is, there are recognisers M1 and M2 for L and L, respectively. A Turing machine M can then take input w and run M1 and M2 on w in parallel. If M1 accepts, so does M. If M2 accepts, M rejects. Note that at least one of M1 and M2 is guaranteed to accept. Hence M decides L.

12-18

slide-20
SLIDE 20

✬ ✫ ✩ ✪

A Non-R.E. Language

This gives us an example of a language which is not Turing-recognisable: ATM . Namely, we know that ATM is recognisable. If ATM was also Turing-recognisable, ATM would be decidable. But we have shown that it isn’t.

12-19