# Copyright (c) 2009 Tim Freeman # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # # (This is the standard MIT License, copied from # http://www.opensource.org/licenses/mit-license.php on 24 Apr 2007.) from turing_tape import turing_tape from interleave import interleave_as from compile_and_run import compile_and_run import compile # The format is defined so that if we feed it abcd(binary) then the # correct output is 0abcd(octal). This is a pun, not a coincidence. # 0456 interpreted as 10 bits = 0b0100101110. assert compile_and_run(absyn=interleave_as, inputsize=10, inputtape=0456, steps=1000) == turing_tape(length=30, bits=0100101110) interleave_prog = compile.turing_compile(interleave_as).program # We won't be using blind search to guess any Turing machine programs # that explain videos, since this simple program is more than 1E138. # Figure 1e12 neurons per human, 1e2 cycles per second per neuron, 1e6 # seconds per year, so we have 1e20 cycles per man year, so the number # below is 1e118 man years. Figure 1e10 people; then you have 1e108 # years of thought of the present population of humans. Our starting # number is so big that if you divide it by other known-big numbers, # it's still big, and this is just for a Turing machine program that # does a simple computation. assert pow(10,138) < interleave_prog