Proving more specific problems are not recursive - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

Proving more specific problems are not recursive

Description:

Use subroutine theme to show that if one problem is unsolvable, so is a ... L1 bm L2. Construct P1 from P2. Similarities with closure property constructions ... – PowerPoint PPT presentation

Number of Views:24
Avg rating:3.0/5.0
Slides: 28
Provided by: erict9
Learn more at: http://www.cse.msu.edu
Category:

less

Transcript and Presenter's Notes

Title: Proving more specific problems are not recursive


1
Lecture 10
  • Proving more specific problems are not recursive
  • Reduction technique
  • Use subroutine theme to show that if one problem
    is unsolvable, so is a second problem
  • Need to clearly differentiate between
  • use of program as a subroutine and
  • a program being an input to another program

2
Question 1
  • What can we conclude from the following scenario?
  • We prove/know language L2 is recursive
  • We show that we can construct a program P1 which
    decides L1 using any program P2 which decides
    language L2 as a subroutine.
  • We conclude that
  • Does this occur in real-life programming?

3
Question 2
  • What can we conclude from the following scenario?
  • We prove/know language L1 is not recursive
  • We show that we can construct a program P1 which
    decides L1 using any program P2 which decides
    language L2 as a subroutine.
  • We conclude that

4
Rephrasing key step
  • We show that we can construct a program P1 which
    decides L1 using any program P2 which decides
    language L2 as a subroutine.
  • This can be rephrased in the following 2 ways
  • If L2 is recursive, then L1 is recursive
  • Scenario in question 1
  • If L1 is not recursive, then L2 is not recursive
  • Scenario in question 2

5
Illustration of If L1 is not recursive, then L2
is not recursive
Set of all languages
REC
6
What we will typically do
Set of all languages
REC
If L1 is not recursive, then L2 is not recursive
7
Proving If L2 is recursive, then L1 is
recursive
  • Assume L2 is recursive
  • Let P2 be a program which decides L2
  • Construct a program P1 which decides L1 using P2
    subroutine theme
  • We have no idea how P2 decides L2
  • We still treat P2 as a black box
  • L1 and L2 are now SPECIFIC languages
  • Thus, we can use properties of L1 and L2 in this
    construction
  • Argue P1 decides L1

8
Constructing P1 from P2
  • Many ways to construct P1 from P2
  • We focus on one method
  • Construct a program P3 which computes a function
    f which we call a many-one reduction
  • P3 (or f) transforms inputs to problem L1 into
    inputs to problem L2 so that
  • yes inputs map to yes inputs
  • no inputs map to no inputs

9
Construction Overview
  • Properties of the construction
  • Input string x is transformed into a new string
    P3(x)
  • x is an input to program P1 (problem L1)
  • P3(x) is an input to program P2 (problem L2)
  • We must give actual program P3
  • P3 will use specific knowledge about L1 and L2
  • We use P2 as a black box routine

10
Many-one Reductions in Detail
  • Properties of f and program P3

11
Properties of P3 (f)
  • P3 must compute a many-one reduction function
    fS --gt S
  • For all x in S, P3(x) must be defined
  • That is P3 must halt with some output P3(x)
  • For all x in S, (x in L1) iff (P3(x) in L2)
  • (x in L1) --gt (P3(x) in L2)
  • Not (x in L1) --gt Not (P3(x) in L2)

12
Yes-gtYes and No-gtNo
L1
L1
S
L2
L2
S
13
Many-one Reduction
  • If there is such a many-one reduction function f
    (and the corresponding program P3), we say that
    L1 many-one reduces to L2
  • Notation
  • L1 bm L2
  • b denotes L1 is no harder than L2

14
Example
  • L1 is even length strings over 0,1
  • L2 is odd length strings over 0,1
  • Tasks
  • Give a reduction function f which shows that L1bm
    L2
  • Give a corresponding program P3 which computes f

15
Example 2
  • L1 is 0,1
  • L2 is 0
  • Tasks
  • Give a reduction function f which shows that L1bm
    L2
  • Give a corresponding program P3 which computes f

16
Constructing an example P3
17
Example
  • L1 is H
  • Input
  • Program P
  • input y to program P
  • Yes/No Question
  • Does P halt on y?
  • L2
  • Input
  • Program P
  • Yes/No question
  • Does L(P) the set of even length strings?

18
Construction overview again
19
Keep this in mind
  • Programs which are PART of program P1 and thus
    executed when P1 executes
  • Program P3, an actual program we construct
  • Program P2, an assumed program which solves
    problem L2
  • Programs which are INPUTS/OUTPUTS of programs P1,
    P2, and P3 and which are not executed when P1
    executes
  • Programs P, P, and P

20
Analysis of L2
  • L2
  • Input
  • Program P
  • Yes/No question
  • Does L(P) the set of even length strings?
  • Program P2
  • Solves L2
  • We dont know how
  • Consider a program P such that L(P)
  • P2 rejects program P as input
  • Consider the following program P
  • If input z has even length then yes else no
  • L(P) set of even length strings
  • P2 accepts program P as input

21
Specifying P3
x
P3(x)
Yes/No
P2
P3
P1
  • Remember, we are solving H (L1), not L2
  • Input x to P3 is an input to H
  • Program P
  • Input string y to program P
  • Output P3(x) of P3 is an input to problem L2
  • Program P
  • Specification for P3
  • P P3(x) P3(P,y)
  • L(P) L(P) set of even length strings iff
    P halts on y

22
How does P3 work?
P,y
P
Yes/No
P2
P3
P1
  • Key
  • P3 creates P by modifying program P to run y
    to test if P halts on y
  • P3 then appends a program P where P has the
    right property
  • Example

Input to P3 Program P Variables Integer array
A10 Integer max,i Instructions read input
string into array A max A0 for
(i1ilt10i) IF Ai gt max THEN max
Ai return max Input y 01532758210
If input z has even length THEN yes ELSE no
23
Program P
P,y
P
Yes/No
P2
P3
P1
  • Specification for program P
  • L(P) even length strings if and only if P
    halts on y
  • In actuality
  • If P halts on y, L(P) L(P) set of even
    length strings
  • If P does not halt on y, P will loop on all
    strings
  • Thus L(P)

24
Key Step
  • If P loops on y, L(P)
  • P begins by running P on y
  • Suppose P does NOT halt on y
  • P never even looks at input z it just loops
  • Typically, L(P) means P is a no input
    to problem L2
  • If P halts on y, L(P) L(P)
  • Note, P could be ANY program we want
  • CHOOSE P such that P is a yes input to
    problem L2
  • or if L(P) means P is a yes input to
    problem L2, then choose P such that P is a no
    input to problem L2

25
P3 illustrated
P,y
P
Yes/No
P2
P3
P1
Program P Variables Integer array A10 Integer
max,i Instructions read input string into array
A max A0 for (i1ilt10i) IF Ai gt max
THEN max Ai return max Input
y 01532758210
26
P3 in more detail
P,y
P
Yes/No
P2
P3
P1
  • Pseudocode for P3
  • Make P a procedure of P
  • Make the first line of the main procedure for
    P a call to P with y as the input
  • P(y)
  • Ignore what P returns only interested if P
    halts on y
  • Make P a procedure of P
  • Make the second line of the main procedure for
    P a call to P with the input z to P as
    the input
  • P(z)
  • Note P will return what P(z) returns

27
Summary
  • Many-one Reductions
  • L1 bm L2
  • Construct P1 from P2
  • Similarities with closure property constructions
  • Use P2 as a subroutine
  • Differences with closure property constructions
  • Use specific properties of L1 and L2
  • P3 is inside P1 and it maps inputs of L1 to
    inputs of L2
  • Often have programs as inputs and outputs
Write a Comment
User Comments (0)
About PowerShow.com