<<

Outline

• many-one reductions CS21 • undecidable problems Decidability and Tractability – computation histories – surprising contrasts between Lecture 13 decidable/undecidable • Rice’s Theorem February 3, 2021

February 3, 2021 CS21 Lecture 13 1 February 3, 2021 CS21 Lecture 13 2

Definition of reduction Definition of reduction

• Can you reduce co-HALT to HALT? • More refined notion of reduction: – “many-one” reduction (commonly) • We know that HALT is RE – “mapping” reduction (book)

• Does this show that co-HALT is RE? A f B yes yes – recall, we showed co-HALT is not RE reduction from f language A to no no • our current notion of reduction cannot language B distinguish complements

February 3, 2021 CS21 Lecture 13 3 February 3, 2021 CS21 Lecture 13 4

Definition of reduction Definition of reduction

A f B yes yes • Notation: “A many-one reduces to B” is written f no no A ≤m B – “yes maps to yes and no maps to no” means: • function f should be computable w ∈ A maps to f(w) ∈ B & w ∉ A maps to f(w) ∉ B Definition: f : Σ*→ Σ* is computable if there

exists a TM Mf such that on every w ∈ Σ* • B is at least as “hard” as A Mf halts on w with f(w) written on its tape. – more accurate: B at least as “expressive” as A

February 3, 2021 CS21 Lecture 13 5 February 3, 2021 CS21 Lecture 13 6

1 Using reductions Using reductions

Definition: A ≤m B if there is a computable • Main use: given language NEW, prove it is function f such that for all w undecidable by showing OLD ≤m NEW, w ∈ A ⇔ f(w) ∈ B where OLD known to be undecidable – proof by contradiction Theorem: if A ≤m B and B is decidable then A is decidable – if NEW decidable, then OLD decidable Proof: – OLD undecidable. Contradiction. – decider for A: on input w, compute f(w), run • common to reduce in wrong direction. decider for B, do whatever it does. • review this argument to check yourself.

February 3, 2021 CS21 Lecture 13 7 February 3, 2021 CS21 Lecture 13 8

Using reductions Many-one reduction example

Theorem: if A ≤m B and B is RE then A is • Showed ETM undecidable. Consider: RE co-ETM = { : (M) ≠ Ø} Proof: – TM for recognizing A: on input w, compute f • f() = f(w), run TM that recognizes B, do whatever it yes yes where M’ is TM that does. • on input x, if x ≠ w, f then reject no no • Main use: given language NEW, prove it is • else simulate M on x, not RE by showing OLD ≤m NEW, where and accept if M does OLD known to be not RE. ATM co-ETM • f clearly computable

February 3, 2021 CS21 Lecture 13 9 February 3, 2021 CS21 Lecture 13 10

Many-one reduction example Undecidable problems

f • f() = yes yes where M’ is TM that Theorem: The language • on input x, if x ≠ w, REGULAR = {: M is a TM and L(M) is f then reject no no • else simulate M on x, regular} and accept if M does is undecidable. ATM co-ETM • yes maps to yes? • f clearly computable Proof: – if ∈ ATM then f(M, w) ∈ co-ETM • no maps to no? – reduce from ATM (i.e. show ATM ≤m REGULAR) – what should f() produce? – if ∉ ATM then f(M, w) ∉ co-ETM

February 3, 2021 CS21 Lecture 13 11 February 3, 2021 CS21 Lecture 13 12

2 Undecidable problems Dec. and undec. problems

Proof: • the boundary between decidability and – f() = described below undecidability is often quite delicate – seemingly related problems on input x: • is f computable? – one decidable • if x has form 0n1n, accept • YES maps to YES? – other undecidable • else simulate M on w ∈ ATM ⇒ and accept x if M accepts f(M, w) ∈ REGULAR • NO maps to NO? • We will see two examples of this phenomenon next. ∉ ATM ⇒ f(M, w) ∉ REGULAR February 3, 2021 CS21 Lecture 13 13 February 3, 2021 CS21 Lecture 13 14

Computation histories Linear Bounded Automata

• Recall configuration of a TM: string uqv LBA definition: TM that is prohibited from with u,v ∈ Γ*, q ∈ Q moving head off right side of input. • The sequence of configurations M goes – machine prevents such a move, just like a TM through on input w is a computation prevents a move off left of tape history of M on input w • How many possible configurations for a – may be accepting, or rejecting LBA M on input w with |w| = n, m states, – reserve the term for halting computations and p = |Γ| ? – nondeterministic machines may have several n computation histories for a given input. – counting gives: mnp

February 3, 2021 CS21 Lecture 13 15 February 3, 2021 CS21 Lecture 13 16

Dec. and undec. problems Dec. and undec. problems

• two problems we have seen with respect Theorem: ALBA is decidable. to TMs, now regarding LBAs: Proof: – LBA acceptance: – input where M is a LBA – key: only mnpn configurations ALBA = { : LBA M accepts input w} – LBA emptiness: – if M hasn’t halted after this many steps, it must be looping forever. E = { : LBA M has L(M) = Ø} LBA – simulate M for mnpn steps • Both decidable? both undecidable? one – if it halts, accept or reject accordingly, decidable? – else reject since it must be looping

February 3, 2021 CS21 Lecture 13 17 February 3, 2021 CS21 Lecture 13 18

3 Dec. and undec. problems Dec. and undec. problems Proof: Theorem: E is undecidable. LBA – f() = described below

on input x, check if x has form • is B an LBA? Proof: • is f computable? #C1#C2#C3#...#Ck# – reduce from co-ATM (i.e. show co-ATM ≤m ELBA) • check that C is the start • YES maps to YES? – what should f() produce? 1 configuration for M on input w ∈ co-ATM ⇒ – Idea: f(M, w) ∈ ELBA • check that Ci ⇒ Ci+1 • produce LBA B that accepts exactly the accepting • NO maps to NO? computation histories of M on input w • check that Ck is an accepting configuration for M ∉ co-ATM ⇒ f(M, w) ∉ ELBA February 3, 2021 CS21 Lecture 13 19 February 3, 2021 CS21 Lecture 13 20

Dec. and undec. problems

• two problems regarding Context-Free Grammars: – does a CFG generate all strings:

ALLCFG = { : G is a CFG and L(G) = Σ*} – CFG emptiness: ECFG = { : G is a CFG and L(G) = Ø}

• Both decidable? both undecidable? one decidable?

February 3, 2021 CS21 Lecture 13 21

4