Evan Martin (evan) wrote in evan_tech,
Evan Martin
evan
evan_tech

solving knowledge puzzles

Someone on a mailing list at work forwarded one of those logic puzzles that involve information being revealed by not knowing. Briefly: two numbers in [2,100] are chosen; A is told their product, B is told their sum; A says they don't know the numbers, B says they knew that fact and they also don't know the numbers; and with that knowledge A now knows the numbers.

It turns out that McCarthy wrote a paper: Formalization of two Puzzles Involving Knowledge on solving these puzzles in code.

And based on that, here's a Haskell solution to the problem that is quite nice -- ~20 lines of rather straightforward code. (On the other hand, I imagine that this is the sort of thing a logic programming language is more appropriate for.)
Tags: go read, haskell
Subscribe

  • dremel

    They published a paper on Dremel, my favorite previously-unpublished tool from the Google toolchest. Greg Linden discusses it: "[...] it is capable…

  • google ime

    Japanophiles might be interested to learn that Google released a Japanese IME. IME is the sort of NLP problem that Google is nearly uniquely…

  • ghc llvm

    I read this thesis on an LLVM backend for GHC, primarily because I was curious to learn more about GHC internals. The thesis serves well as an…

  • Post a new comment

    Error

    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 11 comments

  • dremel

    They published a paper on Dremel, my favorite previously-unpublished tool from the Google toolchest. Greg Linden discusses it: "[...] it is capable…

  • google ime

    Japanophiles might be interested to learn that Google released a Japanese IME. IME is the sort of NLP problem that Google is nearly uniquely…

  • ghc llvm

    I read this thesis on an LLVM backend for GHC, primarily because I was curious to learn more about GHC internals. The thesis serves well as an…