Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Modify the yesOnStringViaMod - template.py . A positive instance of the decision procedure Mod 2 InMod 3 Out ( P ) I ( P (

Modify the yesOnStringViaMod-template.py.
A positive instance of the decision procedure Mod2InMod3Out(P)I(P(I)= I', such that |I'|%3=(|I|%2)+1). That is, the length of P's output mod 3 equals the length of
its input mod 2, plus 1. Consider these examples:
def (inString): return inString
def (inString):
if len(inString)%2=0: return 'C'
else: return 'CGT'
is a negative instance of Mod2InMod3Out, because if instring =='GT', len('GT')%2+1==1!= len('GT')%3==2.
is also a negative instance of Mod2InMod3Out, although it does handle even length input correctly. However, if instring =='A', len('A')%2+1==2!= len('CGT')%3==0. Show that Mod2InMod3Out(P) is undecidable by modifying yesOnStringViaMod-template.py (included HW materials) to implement YesOnString(P,I)=T Mod2InMod3Out(P). In the multi-line comment at the end of the file, argue that you have shown that Mod2InMod3Out(P) is undecidable.
yesOnStringViaMod-template.py:
# "Oracle" function -- assume exists to show contradiction
#
import Mod2InMod30ut
import utils
from utils import rf
from universal import universal
# Complete for the final exam by filling in the ellipses
def alterYesToMod(inString):
...
result = universal (progString, newInString)
# Complete for the final exam by filling in the ellipses. For the
# call to mod2InMod30ut, supply a 2nd argument if needed.
def yesViaMod(progString, inString):
...
result =mod2 InMod30ut '
alterYesToMod.py'{:?'),dots
...
,'
Mod2InMod30ut is undecidable because...
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions