これは複雑な理論から簡単な問題です。マッピングリダクション機能とは
#Consider the language E over the binary alphabet
#consisting of strings representing even non-negative
#integers (with leading zeros allowed).
#I.e. E = {x | x[-1] == '0'}.
#
#Reduce E to the language {'Even'} by implementing
#the function R
def R(x):
#Code
def main():
#test cases
assert(R('10010') in ['Even'])
assert(R('110011') not in ['Even'])
if __name__ == '__main__':
main()
デフマッピング削減によると:
「言語Aが計算可能関数fがある場合≤ヘクトパスカル、 を書かれた、言語Bに還元可能マッピングです:Σ* - →Σ*、すべてのワットのために、 w∈A⇐⇒f(w)∈B 関数fはAからBへの縮小と呼ばれます。
計算可能なマッピング関数はf(n)= 2n(またはPythonではx < <)ですが、そのようなアサーションはすべてのR(x)が{'Even' } ...?
これは宿題による簡単な問題です。 – MisterMiyagi