February, 2013
This web page implements some of the various formal systems in Raymond Smullyan's neglected classic, The Lady or The Tiger. Lots of web pages exist explaining the titular "Lady or Tiger" problems in the book, but few have bothered to emulate the Monte Carlo Lock, or any of McCulloch's "logic machines".
A Curious Number Machine |
This JavaScript program emulates McCulloch's Machine as Smullyan describes in Chapter 9, A Curious Number Machine
The associate of any number X is X2X. Smullyan uses "number" to mean "string of symbols", where a symbol is one of '1', '2', '3'... '9'. This emulated machine is a bit more forgiving of improper inputs than the machine Smullyan describes, as it will allow '0' (zero) and any single US ASCII letter as a symbol. |
Craig's Law |
This JavaScript program emulates McCulloch's Machine with two additional rules of behavior, as in Chapter 10, Craig's Law
The repeat of a number is the number (which is a string) concatenated with itself: the repeat of 789 is 789789. |
Scratch space exists to help you check your answers. Suppose you want to solve chapter 10, problem 9, a number that produces the associate of its own repeat. In the "Craig's Law" input field, you enter your candidate. Click "Input to scratch" in the "Craig's Law" box, then click "repeat" and "assoc" buttons in the "Scratch Space" box to see the associate of the repeat of your candidate number.
The "Scratch Space" tool can also work the other way: use its buttons to build up a number, then draw that number into an "Input" field before computing what your number produces.
McCulloch's New MachineSmullyan describes McCulloch's New Machine in Chapter 13, The Key
|
Monte Carlo LockMartin Farkus notes on the lock
My emulator does not implement Property Sp - it gives no indication of whether the input combination unlocks or jams the lock or is neutral. The Monte Carlo Lock must be an intricate piece of machinery indeed, if it actually does all of Property Sp. |
||||||||
Marnix Klooster's Mysterious Monte Carlo LockMarnix Klooster wrote a very nice derivation of a combination that unlocks the Monte Carlo lock. His notation is a bit different, so I include a version of the Monte Carlo lock emulator in Klooster's notation. Klooster uses [3x] = y2y to mean the same thing that Smullyan means when he writes "if x produces y, 3x produces the associate of y".
More classes of combinations that unlock the lock. |
Programming NotesImplementationI implemented each of the machines or "locks" as a pretty simple JavaScript program. They all run in your browser, locally. Because the only acceptable numbers have a quote character or digit in them ('2' or 'Q'), the recursion terminates readily. Either the recursion encounters a quote, or it encounters a digit that has no rule (not a '2', '3', '4', '5' or '6'). Initially, I found Smullyan's terminology a bit confusing. He phrased the recursion rules as "If X produces Y, then MX produces something". Once I realized that you recurse on the remaining characters in the string until you get to a quote character, I found it simple to write the JavaScript implementations. Somewhat theoretical considerationsThe logical machines and locks comprise simple, recursive programs, with a stop condition on a quoted sub-string. All operations (repeat, reverse, associate) happens on the way back "up" the recursion. Does this mean that a Simple Recursive Function (in the mathematical logic sense) could compute the output of the various "locks" or "machines" on this page? Mathoverflow features a technical explanation of solutions to the Monte Carlo Lock. |
I renounce all rights - do with this as you will.