Question: Part 1 : F ( P ) I ( | P ( I ) | = = | I | * 2 n , n
Part :
FPIPIIn n That is P is a positive instance of F if is there is some string I such that the length of the output from the PI call is a power of two times the length of the input, excluding
Prove that F is undecidable by modifying the template to show that yesOnString T F updated to define yesViaPow with two parameters instead of :
ReduceYesToPowLenpy
This lab requires you to complete two functions,
yesViaPowprogStringinString and alterYesToPow These functions
will not be run, they are thought experiments to help us reason about
decidability and recognizability. To save time and trouble, both are included in the same file, even though the call to powlen expects alterYesToPowpy to be in a separate file from yesViaPowpy
import utils; from utils import rf
from universal import universal
def yesViaPowprogStringinString:
# add code needed to show that yesOnString reduces to
# powlen. That is to show that this function, yesViaPow could
# decide yesOnString if powLen could decide if there was some
# input to a Python function such that the length of the output
# was a power of two times the length of the input.
# If needed, add second parameter to the powLen call.
result powLenrfalterYesToPowpy
# Add any other code needed for the reduction, and return
# the right thing.
# return something # CHANGE THIS
def alterYesToPowinString
# Add code needed for the reduction
# Somewhere in this function you'll need a call to universal
# val universalaProgramaString CHANGE universal args
# Finally, modify the template below such that altersYesToPow
# will be a positive instane of powLen iff progStringinString
# is a positive instance of yesOnString, where progString &
# inString are the arguments to yesViaPow
#
# if a certain condition:
# return something meaningful to powLen
# else:
# return something with the opposite meaning
# to powLen
To understand F suppose that P were a function that decided if P was a positive or negative instance of F and consider these two functions:
def gAlphabetinString: return 'CAGT
def pivotEpsiloninString:
if inString : return 'CAGT'
else: return
Then rfgAlphabetpy 'yes', because if leninString is or the output length is or times the length of the input.
And rfpivotEpsilonpyno because the output of pivotEpsilon is never a power of two times the input length.
Part :
Recall the definition of F:
FPIPIIn n That is P is a positive instance of F if is there is some string I such that the length of the output from the PI call is a power of two times the length of the input, excluding
La asked you to prove that F was undecidable. For this lab, answer these questions and explain your thinking.
a Is F recognizable?
b How would you define F the complement of F without reference to F That is under what conditions would F return 'yes'no
c Is F recognizable?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
