Settings

Theme

When Is Cheryl's Birthday?

nbviewer.ipython.org

240 points by jonp 11 years ago · 135 comments

Reader

gkoberger 11 years ago

Maybe I'm missing something, but the "hard" part of this problem is figuring on the trick. Once you know that, it becomes relatively easy – and you can't use a program to figure out the trick.

  • jrpt 11 years ago

    The problem isn't difficult without programming. It's the programming that's elegant because it's an interesting way to solve the program, by expressing their statements as functions and using the know and tell functions. It's actually really great how the logic was translated in code, almost like a direct translation from English to Python. Now that I know how to write the program, if the puzzle were to get rapidly more complex, say with 20 different statements of moderate complexity, I feel confident I could solve it with a program whereas I might struggle with pencil and paper.

  • logicallee 11 years ago

    I don't know, can code like this reason about knowledge-about-knowledge in general?

    For example, can a version of the code be used to solve the 'hardest puzzle' -

    https://xkcd.com/blue_eyes.html

    (solution: https://xkcd.com/solution.html) ?

    • malisper 11 years ago

      It can.

      If you know someone else doesn't know, that just gives you more knowledge you yourself can use.

      For the "hardest puzzle", on each day everyone learns that no one was able to figure out the solution the day before. Because of this, a person knows that for a possible number of blue-eyed people to be valid, a person who sees one less blue eyed person than that, must have been unable to figure it out on the previous day.

      An Arc/Common Lisp solution I just wrote up: https://gist.github.com/malisper/80625bcda75c66780f81

    • vacri 11 years ago

      I find the problems with puzzles like these is not the rules, but the ridiculously contrived situations. Why do these entities that function like inert logic gates have to be human? It means that the question has to have silly rule placed on silly rule in order to keep the contrived situation afloat. It means I end up thinking of ways for the mute, inert people to free themselves from the island (who is feeding them? Are there trees to build a raft? etc), rather than 'play by the rules'.

      • anon4 11 years ago

        Sentient immortal mute beings of pure logic that do not possess the capability of traversing the ocean are people too!

        I get your point. Still, it's hard to define the puzzle in terms of not-people. Maybe you could call them intelligent robots -- people might find it easier to picture mute robots with hats.

    • brownbat 11 years ago

      Not to be confused with the "Hardest Logic Puzzle Ever," about identifying a truth telling god, a lying god, and a random oracle, none of whom even speak your language.

      http://en.wikipedia.org/wiki/The_Hardest_Logic_Puzzle_Ever

  • userbinator 11 years ago

    The "hard" part of any programming problem is to figure out what the program has to do. The machine can't tell you the correct answer without you giving it the correct instructions.

  • baddox 11 years ago

    Which part is the trick? It all seems very straightforward to me.

    • codeulike 11 years ago

      Its understanding what the question actually means when it says things like 'Bernard: At first I don't know when Cheryl's birthday is, but I know now.' ... this is actually a cryptic coding of the rules of the puzzle.

      If you properly understand those rules and convert them to code (as in the OP) then searching the possible answers for a match is trivial.

      • userbinator 11 years ago

        I think one of the things that trips people up with puzzles like this (including the one mentioned in https://news.ycombinator.com/item?id=9437483 ) is that knowledge of lack of information is itself information, a point that isn't used very often; if someone tells you they don't know something, you are likely to see it as simply a lack of knowledge, and not as a piece of information that could be combined with the information you have. It somewhat reminds me of that quote about "known knowns" and "known unknowns"...

        • jfroma 11 years ago

          Well put! and for me that's the trick in this puzzle, once you understand that everything else is trivial.

      • cynicalkane 11 years ago

        It's Singapore English. Instead of using tenses, you put a phrase expressing time at the beginning of a clause, a feature borrowed from Chinese. "At first" sets the time and topic of the following clause. Having spent some time in Singapore and HK, I found the Chinese-flavored English to be immediately clear. Actually, if you just guess to substitute the correct verb tense (don't -> didn't), it seems clear to me in ordinary English as well, and I'm not sure where the confusion lies.

        The Singaporean government doesn't think Singapore English is a valid thing and wants everyone to learn "good" English. The Singaporean upper class is, as usual, on the government's side, and will complain about the poor English education in their country. That's fine for them, but please be aware that when you say "this is bad English" you are making a cultural and class-based judgment. What you really mean is the math question uses a way of expressing time that is familiar to them but not familiar to you.

      • MrBuddyCasino 11 years ago

        Exactly. Only after reading the paraphrased version did it become clear to me, but then I'm not a native speaker.

      • baddox 11 years ago

        Why do you say that is cryptic? I can't think of a clearer or plainer way to express that fact.

        • mseebach 11 years ago

          For outsiders, there are two elements to the puzzle: the encoding of the logic problem and the logic problem itself.

          People might very well be able to solve even fairly complex logic problems without having been exposed to this tradition of encoding such problems.

          The problem is stated as three persons having an odd, but casual conversation. To outsider that's all they're doing and to those the problem is impenetrable. Insiders, however, immediately recognise the informal protocol of logic quizzes that this is not a random casual conversation, it is carefully written to encode just enough information to be solvable as a logic problem. These insiders know to carefully extract (decode) this information. Only then do they solve the logic problem.

          The "dishonesty" of the problem, which is confusing to people expecting the problem to be stated honestly, is that the conversation in the problem is entirely contrived, there is no way is would ever happened as part of a real world exchange about birthdays. This is fine for the intendeded reader, school kids trained in this protocol, but in "going viral" it went to a lot of unintended recipients.

          • codeulike 11 years ago

            Yep, exactly.

          • s_kilk 11 years ago

            This is exactly why I find these kinds of puzzles infuriating. It always hinges on some contrived, bullshit "trick" which has nothing to do with solving real problems.

            • Nursie 11 years ago

              It's really not a trick. You simply take all the knowledge you are given and (this is important) don't make any additional assumptions or guesses or even really think of the participants as human, and.solve it like a math problem.

              • TillE 11 years ago

                Yeah. I'm completely unable to do any of the stereotypical interview question puzzles which hinge on an "outside the box" trick, but I had no trouble recognizing this as a straightforward problem that you just work through.

        • jmilloy 11 years ago

          I think if you were actually tasked with finding a plainer way to express the fact, you would have no trouble.

          When Albert says I don't know when Cheryl's birthday is, but I know that Bernard does not know too, consider There are no unique days in the month I was told.

          Informally, note the difference of order. If Albert said "I was told the Birthday is in July", that would be, say, first order. The plain version I provide is a logical statement about the months and dates, a second order statement. But the cryptic version is a statement about what (second-order) statements Bernard can make, so third order. Hence, cryptic.

        • codeulike 11 years ago

          Trust me, its cryptic to most people, and that's why this puzzle has gone viral round the world in an omg-singapore-schoolkids-can-do-this-insane-puzzle kind of way.

          • baddox 11 years ago

            Why do you suspect the crypticness of the puzzle's language is the problem, rather than the fact that a large portion of people haven't studied basic logic and are thus unable to complete basic logic puzzles?

            • fr0styMatt2 11 years ago

              It's not just a basic logic problem - it's a language translation into a logic problem problem. You have to 'get' that is what you're dealing with.

              Incidentally, I get a similar feeling from these puzzles that I get from code questions or examples where every variable or function is named 'a' or 'b' or 'foo' or 'bar'.

              (aaand I just had a mini-epiphany of sorts that when I see those types of programming puzzles I should probably write them out and substitute the variable names as I go....)

              • andrewprock 11 years ago

                Actually, it's the opposite. It's a translation of a pure logic puzzle into natural language.

            • codeulike 11 years ago

              Firstly, someone reading the puzzle needs to grok that some of the day-numbers are unique across the months (e.g 18) and some are not (14). Then they need to grasp the basic dynamic on the situation, e.g. that if Cheryl's birthday had been May 19 then Bernard would have known straight away.

              If you dont initially grasp the above then Albert's initial declaration "I don't know when Cheryl's birthday is" just seems to be a redundant statement that doesn't offer any information. And thats just the first hurdle of the puzzle.

              A lot of people hate maths-questions-stated-as-stories, even simple ones ("There are several chickens and rabbits in a cage (with no other types of animals). There are 72 heads and 200 feet inside the cage. How many chickens are there, and how many rabbits?" etc etc) so to people like that, this Cheryl-birthday problem initialy presents as hopelessly cryptic.

        • gurkendoktor 11 years ago

          Not a native speaker, but just the fact that the first half of the sentence is written in the present tense made my brain stumble.

          Which is probably intended, as otherwise I would have thought he meant to say "before Cheryl had told me, I didn't know".

          • stephen_g 11 years ago

            Interesting. As a native English speaker, I didn't even consider "before Cheryl had told me, I did not know" as a possible interpretation, just from the way the conversation flows but also because it goes without saying and wouldn't add anything.

            In the context of Albert's statement though, it couldn't mean that - Albert's statement is saying that Bernard does not have enough information to determine the date just based on what Cheryl told him, so in saying "at first I did not know, but now I know", the only difference between "at first" and "now" is Albert speaking.

            So Bernard's comment could only mean, "Based on what Cheryl told me, I did not know what the birthday was, but given the extra information I have as a result of Albert's statement, now I know"

        • stbtrax 11 years ago

          For me the confusing part was when Albert knew that Bernard didn't know. I initially thought that he inferred this from Bernard telling him.

    • hyt7u 11 years ago

      It took me a bit to figure out that the third statement was meant to be Albert expressing his confidence that Bernard didn't know the answer and not Albert inducing from Bernard's silence that Bernard didn't know the answer. The latter implies something like the Python code below, which will end up giving August 17th as an answer instead:

        def statement3(date):
          possible_dates = tell(Month(date))
          return (not know(possible_dates)
            and not know(filter(lambda x : not know(x), 
              [tell(Day(d)) for d in possible_dates])))
    • DustinCalim 11 years ago

      The trick is to take it at face value and not question how they know, but what the answer has to be assuming they do know.

      • baddox 11 years ago

        Assuming that the problem is posed and understood as an artificial puzzle (rather than a real scenario with real people), what reason would there be to question how they know? Of course you're supposed to assume they know. It's a puzzle, and someone is telling you precisely what you're to assume.

        • andrewprock 11 years ago

          On the contrary, there are many unspoken things one must assume to solve this puzzle "correctly"; that Albert and Bernard are rational, honest, cooperating, and have a certain penchant for communicating novel inferences they make instead of just blurting out "we don't know" out of boredom, laziness, or frustration.

          • baddox 11 years ago

            To me, all those things are very readily inferred from the fact that the problem is being posed as a logic puzzle.

            • andrewprock 11 years ago

              Logic puzzles where one must assume so much are not about pure logic. They are "logic" puzzles. If you aren't made aware of the assumptions that were made in building the puzzle, the solution you arrive at may not match the "logical" one.

              Because of this, solutions are often not logical.

              • baddox 11 years ago

                Is it really such a big leap to assume that fictional people in a logic puzzle or riddle are telling the truth? I don't think so. To me, it's very clear that the names of the people are chosen arbitrarily (with first letters corresponding to the first letters of the alphabet) and that the things they are saying are simply a way to convey the logical constraints to the reader. It's very obvious to me that the fictional people, their names, and the fact that they are speaking aren't actually relevant to the logic puzzle.

ghurtado 11 years ago

I thought this was a great puzzle when I first saw it. IMHO, it is more satisfying to "think through it" without paper and pencil, since it is relatively simple to resolve.

The Python solution proposed is really great, in that it captures both the expressive and functional spirit of the language.

  • ternaryoperator 11 years ago

    >since it is relatively simple to solve

    You are overestimating how simple it is.There are more than 1200 comments on the solution on the NYTimes[1] almost all of them arguing that other dates are correct.

    [1] http://www.nytimes.com/2015/04/15/science/answer-to-the-sing...

    • baddox 11 years ago

      It's very simple in the context of logic puzzles. Similarly, the melody of "Ode to Joy" is very simple to play on the piano. That's not to say that there aren't at least 1,200 people unable to play it on the piano. But it is one of the simplest recognizable melodies to play on the piano, and is likely playable by the vast majority of people with a few months of piano lessons.

      • chongli 11 years ago

        The hard part is not the logic, it's actually figuring out that this is a logic puzzle that needs to be solved by deduction and not a bunch of nonsense with terrible grammar. To borrow your Ode To Joy example, it's like trying to learn to play the piece after the sheet music had been torn and tattered, burned and stained with coffee. Sure, the music is simple once you get past all of the garbage in your way.

        The original version of the puzzle (in the Singapore Math Olympiad) presented the dates in a sparse table format. This little bit of symbolic communication makes it much clearer that the answerer is supposed to cross off the dates by a process of deduction, making the puzzle simple to solve.

        • baddox 11 years ago

          > The hard part is not the logic, it's actually figuring out that this is a logic puzzle that needs to be solved by deduction and not a bunch of nonsense with terrible grammar.

          I am seeing this claim a lot, but I do not understand it. Why would readers assume that a riddle is a bunch of nonsense, rather than something with an objective answer?

          > To borrow your Ode To Joy example, it's like trying to learn to play the piece after the sheet music had been torn and tattered, burned and stained with coffee.

          I don't see the analogy, because I had no trouble understanding the wording of the puzzle. I thought it was extremely clear and precise. To use your analogy, I feel like I'm looking at a pristine professionally-notated piece of sheet music while everyone else is saying it's torn and tattered.

          • chongli 11 years ago

            I am seeing this claim a lot, but I do not understand it. Why would readers assume that a riddle is a bunch of nonsense, rather than something with an objective answer?

            Different people carry different assumptions with them throughout their lives. Not everybody approaches a logic puzzle with the mental preparation of solving logic puzzles. They aren't looking to analyze the statements and they don't carry the assumption that the statements carry just enough information to solve it. Instead, they might expect some trick or play on words to give a "stupid" answer.

            because I had no trouble understanding the wording of the puzzle

            But you do have trouble understanding that other people might be different from you; with different experiences, assumptions, etc.

            • andrewprock 11 years ago

              "But you do have trouble understanding that other people might be different from you; with different experiences, assumptions, etc."

              In essence, this is the true test of the puzzle; not whether you can solve the intended puzzle, but whether or not you can muster sufficient social and analytical empathy to work with others when your assumptions turn out to be incongruent with the intended assumptions.

          • sukilot 11 years ago

            If you learned to play piano in a different notation, Western clef note sheet music would be cryptic. Not everyone has learned the same language of expressing precise concepts.

            • baddox 11 years ago

              If someone is a non-native and less than fluent English speaker being presented with this problem in English, then I think your analogy holds. If they are fluent English speakers, however, then I think the inability to translate simple English statements into logical constraints is a failure to solve the logic puzzle itself, not a different type of failure indicating that the problem description is "cryptic" or confusing.

        • sukilot 11 years ago

          Please don't confuse a different country's dialect of English with "terrible grammar"

          • apricot 11 years ago

            Is "Yesterday I eat noodles" considered grammatically correct English in Singapore?

    • x0054 11 years ago

      I have to admit, it took me more than 5 minutes to figure this one out, so if this was a test problem, I probably failed. Maybe I am not as smart as I think, but it's probably not as simple as people, including other comments to this post, make it out to be. The trick to the problem is pretty obvious right away, but what tripped me is improper perspective. Reading the comments on NY Times, I think this is the same thing that trips up most people as well.

      After eliminating May and June because they have unique days, which is obvious, I got stuck trying to figure out how Albert would be able to figure out the date after knowing that Bernard now knows the date. So I got stuck on July 16, Aug. 15 and Aug. 17 for a while, because I could not figure out how Albert would know the date if he was told August as the month. It took me a few minutes (ok, like 5 or so, more then I care to admit to my self I suppose :) ) to figure out that my job wasn't to figure out how Albert new, but rather to figure out what the answer was IF Albert now knew the answer.

      From that it's pretty easy, but it's the perspective that trips most people up.

      • vacri 11 years ago

        It wouldn't have taken you so long if you had've just been doing logic in a classroom. This isn't a puzzle that was sprung on the students by surprise; it was part of their course.

      • lifeisstillgood 11 years ago

        Trust me that is a very eloquent and perceptive explanation of your own failings, and how that applies to others experience. Whatever time limit was arbitrarily set for the "test" you pass the more important test with flying colours.

    • InclinedPlane 11 years ago

      It is a simple logic problem, simpler than the vast majority of logic puzzles. The fact that an enormous number of people in the developed world have poor logical reasoning skills is an entirely separate issue.

    • tiler 11 years ago

      There are some great examples among the comments of people vehemently defending their provably false beliefs.

    • DannoHung 11 years ago

      This reminds me of the Blue/Brown eyed villager puzzle.

      The trick is in figuring out what additional information is actually being added by whatever subsequent statements are being made.

      It's weird. I usually have a lot of trouble with mathematical word puzzles. Particularly probability. But logic puzzles almost always seem to be pretty easy for me.

      Now if you want a really fucking hard one, try your hand at this: http://en.wikipedia.org/wiki/The_Hardest_Logic_Puzzle_Ever

    • Jach 11 years ago

      It's relatively simple, if you're the kind of person who grasps that 1+1*0 is not 0 under most parsers and under the order of operations implied by e.g. the vector space axioms...

      • pdpi 11 years ago

        > under the order of operations implied by e.g. the vector space axioms

        What, exactly, about vector spaces implies an order of operations?

        • Jach 11 years ago

          See for reference: http://www.math.ucla.edu/~tao/resource/general/121.1.00s/vec... Addition is only defined on two elements of the space, multiplication is only defined for multiplying an element by a real number, which results in an element. These satisfy the unambiguous distributive axiom, real * (el_1 + el_2) = real * el_1 + real * el_2. Since addition only applies to elements, real * el_1 and real * el_2 must be computed into elements first before the sum. While this doesn't strictly, logically imply the same for real * real + real * real, it's at least suggestive (hence the e.g.) and you can turn to the Peano Arithmetic axioms and definitions of addition and multiplication and do the same thing for natural numbers. Or you can just say the ordering implied by assuming PEMDAS, but just saying that alone is boring and doesn't really expose the elegance in notation/algebraic transformation gained from such a convention.

          (For those who don't get the reference, every so often some variant of "a + b * 0 + c = ?" will show up in the public's attention and receive very emotional arguments about how it must be 0, or must be a+c, or must be c, or it must be ambiguous and therefore undefined. Similarly to the logic puzzle programmers can just point to the problem expressed in Python for the correct answer...)

    • cam_l 11 years ago

      This comment is, in itself, a description of the issue it raises. Simple is an ambiguous term, and you are using it to describe a different aspect of the problem to the parent (you are both right).

    • nazri1 11 years ago

      Bike shedding, layman version.

vessenes 11 years ago

This is just beautifully expressive python. I wouldn't think of using it this way: writing

  return (not know(possible_dates)
          and all(not know(tell(Day(d)))
                    for d in possible_dates))
feels almost zen to me; or at least like Mr. Norvig likes himself some lisp at times.
ibejoeb 11 years ago

Here's my quick solution in modern SQL. This is more expensive than it needs to be, but doing it this way lets you see the truth table by commenting out the final predicate.

fiddle: http://sqlfiddle.com/#!15/0c419/160/0

gist: https://gist.github.com/ibejoeb/df57cb34bbe609293d6e

zhte415 11 years ago

The problem with this problem, the way it was originally put, was the utterly confusing English masked into a logic problem.

Write your specifications clearly, and then it does not become an internationally shared 'problem' to solve.

[I work with insanely documented specifications just like this, year after year. Not putting a problem clearly is not something to aspire to.]

  • baddox 11 years ago

    Why do you think that confusion over the English description is more to blame than the difficulties many people face with logic puzzles?

    • chongli 11 years ago

      A lot of people reading it probably didn't even realize that it is a logic puzzle. To those, it may be some kind of obscure riddle with terrible grammar.

      Heck, it's not even clear that Albert and Bernard are communicating with one another and not merely with the answerer. If you assume they do not communicate at all then the puzzle becomes impossible.

      • baddox 11 years ago

        > A lot of people reading it probably didn't even realize that it is a logic puzzle. To those, it may be some kind of obscure riddle with terrible grammar.

        I'm not clear on what the difference between a riddle and a logic puzzle would be in this context.

        > If you assume they do not communicate at all then the puzzle becomes impossible.

        Why would someone make an assumption that renders the puzzle impossible? I suppose the questioner could just be a troll or something.

    • zhte415 11 years ago

      I do not make a comparison to 'difficulties many people face with logic problems' and did not make an assertion that many people face difficulties with logic puzzles.

      Getting back to the article: the problem is worded so badly it should be sent back to the author to more coherently express what they think. Specifications, etc...

      • sukilot 11 years ago

        Or you could learn Singapore English and not demand that everyone translate their work into your dialect.

      • baddox 11 years ago

        I simply disagree that the problem is worded badly. I thought it was extremely precise and clear.

  • stephen_g 11 years ago

    It's a puzzle - it's supposed to be tricky.

    I don't really think it's especially obfuscated though. You just have to think about why people are saying what they say, which is a fairly useful thing to be able to do...

tomp 11 years ago

For the more mathematically minded readers, here's a harder version of the problem:

http://jdh.hamkins.org/transfinite-epistemic-logic-puzzle-ch...

xarien 11 years ago

I'd have gone a different way since my setup and approach was a bit different (I took a more visual approach). While this solution is elegant, it's also incredibly hard to do in the real world as it requires far too much knowledge to properly assign the "correct" definitions. It's no different than having a perfect health heuristic land on your lap.

When I did this a while back, my approach was to construct a 5x4 matrix with blanks (5 unique dates x 4 unique months). This allowed the clues to cross off entire rows and or columns until only 1 pair stood standing. Personally, I find the construction of the solution much more interesting than the problem itself given how many people participated.

picardo 11 years ago

I'd be interested in seeing a solution in Prolog.

zaroth 11 years ago

My own contribution from last week:

https://news.ycombinator.com/item?id=9398638

http://opine.me/discovering-a-new-fizzbuzz/

john_butts 11 years ago

1. HN comment about some aspect of fizzbuzz or whatever. Not how to solve fizzbuzz or whatever; rather, some insight into how people solve problems, which is the interesting part of the question. 2. Two dozen oblivious nerds tell u how to do it in 20 characters of perl

Fando 11 years ago

Maybe someone already mentioned this, but this problem is a simplified formulation of a famous number thoery riddle called 'The Sum and Product Riddle' which is even more baffling. Here it is http://blog.computationalcomplexity.org/2007/01/sum-and-prod...

janhaak 11 years ago

This is quite disturbing for me. My Aunt's name is Cheryl. Her husband, Bernard. Guess his brother's name!

_asummers 11 years ago

Where can I find more puzzles of this flavor? This generated some fun discussion on my Facebook wall.

mattbeckman 11 years ago

Friend of mine wrote a Scala solution: http://www.agileatwork.com/scala-solution-to-cheryls-birthda...

Nursie 11 years ago

If you're puzzling over this you've done it wrong.

There is no inference from silence. There is no humanity in such a question, there is simply the information you're given and the application of logic to narrow down the answers. The Singaporean kids that took the exam knew this and anyone that's ever taken a maths or logic exam should know this.

You don't guess what might have happened from human behaviour because you don't know, you don't look for a 'trick' to give away the answer, you simply use the data in the question to narrow down the possibilities until you can arrive at an answer.

The moment you think "but what if this action could have taken place because if he knew he would have said" you have failed.

And you probably suck at debugging.

kyberias 11 years ago

Couldn't resist. This is the solution ported to C#:

https://github.com/kyberias/cherylsharp

haddr 11 years ago

still looking for solution using RDF/OWL logical reasoning...

the python solution is neat, but i have a feeling that there are tools that are more native to these kind of problems than general purpose programming language.

  • esfandia 11 years ago

    Epistemic logic would probably be the appropriate tool; at least that's what I thought when I first saw the problem. Epistemic logic is the logic of knowledge and belief: you use a modal operator to express the knowledge of an agent about a certain statement. The statement could be expressed in propositional or first-order logic depending on the expressiveness required (but of course there is a complexity trade-off).

    Translating roughly from the problem statement (x being the variable holding Cheryl's birthday):

    Not(Know_Albert(x)) and Know_Albert(Not(Know_Bernard(x) etc.

    Semantically, the possible birthdays correspond to the possible worlds. A reasoner would be able to solve this by process of elimination, somewhat similarly to a constraint-solver.

    Resources:

    Wikipedia entry on Epistemic Logic: http://en.wikipedia.org/wiki/Epistemic_modal_logic

    Fagin, Ronald; Halpern, Joseph; Moses, Yoram; Vardi, Moshe (2003). Reasoning about Knowledge: http://www.amazon.com/Reasoning-About-Knowledge-Ronald-Fagin...

    I haven't read the entire book, but the first couple of chapters give you an idea and some great examples not too different from this puzzle.

frik 11 years ago

Could one use Julia instead of Python?

"iPython" already supports Haskell and Julia kernels too. A iPython Javascript kernel would also make sense given its popularity and its functional inspired syntax.

  • frik 11 years ago

    A downvoter confused "iPython", its a "notebook" based (think Mathematica notebook) command shell for interactive computing in multiple programming languages. They already renamed it to "Jupyter" as "iPython" was very confusing name.

andrewprock 11 years ago

Unfortunately, there are a number of rather curious, and culturally specific, assumptions one must make about the problem.

The real puzzles are:

1. "Why did Albert speak first?"

2. "Why did he speak in such cryptic language?"

  • stephen_g 11 years ago

    Maybe I'm missing something, but we know exactly what Bernard would have said first from statement 2.

    He says, "At first I didn't know", so all he could have said if he had spoken first would have been "I don't know when the birthday is". Then Albert would have said, "I don't know when the birthday is, and I knew that Bernard couldn't have".

    So the problem is unchanged regardless of who speaks first.

    It also doesn't seem that cryptic to me... It doesn't take that much reading between the lines to understand the statement "at first I didn't know, but I know now" to mean "the information that Albert just provided gives me enough information to determine the birthday"...

    • andrewprock 11 years ago

      IIRC, if Bernard speaks first, then the correct answer is August 17.

      • stephen_g 11 years ago

        That doesn't make any sense to me. Can you post exactly the sequence of statements if Bernard speaks first?

        Simply reordering the questions does not make sense, so I can't see it happening any way other than what I posted, which shows that it wouldn't change anything.

        • andrewprock 11 years ago

          It really depends on who says what, but here a version of the problem where Bernard speaks first:

          Bernard: I don't know when Cheryl's birthday is.

          Albert: I don't know when Cheryl's birthday is.

          Bernard: I know when Cheryl's birthday is now.

          Albert: Then I also know when Cheryl's birthday is.

          • stephen_g 11 years ago

            That breaks the whole problem because you've removed the part where Albert says something that gives Bernard the information he needs to work out the date.

            I don't think it's really a good critique of a logic problem to say, "but if you remove this extremely important part, it doesn't work anymore"!

            The conversation would need to be:

            Bernard: I don't know when Cheryl's birthday is

            Albert: I don't know when Cheryl's birthday is, and I knew that Bernard didn't know.

            Bernard: Then I know when Cheryl's birthday is now.

            Albert: Then I also know when Cheryl's birthday is.

            Then it works. You only have to assume that the parties are logical and tell the truth.

            • andrewprock 11 years ago

              You have to make quite a few more assumptions as well. If they were logical and told the truth, the conversation would be more like:

              Bernard: Cheryl told me it's the 17th.

              Albert: Cheryl told me it's in August.

  • anigbrowl 11 years ago

    These are actually valid questions and you shouldn't be downvoted. The standard interpretation of the problem is highly questionable; Albert's initial remark is not actually dispositive to Bernhard, because if Bernhard had the 19 May date he would know the correct answer immediately without needing Albert to say anything.

    The suggestion that Albert's first statement necessarily eliminates all dates in May is false, and the answer is indeterminable, as can be readily verified with a Venn diagram. It took me some time to spot the flaw in the problem construction; I initially found the official solution persuasive, but when you think more carefully about it you realize it's actually wholly illogical.

    • stephen_g 11 years ago

      Your objection doesn't make sense. The fact that Albert can make the statement relies on the fact that he was given a month that rules out Bernard being given a unique date, such as the 19th, otherwise Albert would have to say, "I don't know when the birthday is but perhaps Bernard does" and the problem would be different.

      Albert knows the month, and his statement, which translates directly to "given the month I know, it is not possible for Albert to independently determine the date" certainly does rule out the two months.

    • thuffy 11 years ago

      Solved this without even a pencil and paper, just in my head, in under 60 seconds while being distracted by another person in the room asking me what to have for breakfast. There is only one possible answer as the others pointed out; you are definitely wrong that the answer is indeterminable.

      The whole ruckus surrounding this problem seems to be more a reflection of the sad state of the intelligence in our population, rather than anything to do with Asia.

    • kleer001 11 years ago

      Along the lines of the "Bob uses cigarette butts to make new cigarettes. Bob needs 5 cigarette butts to make one new cig. If Bob starts with 25 butts how many cigs can he make?"

    • Nursie 11 years ago

      If we take silence as indicative of lack of knowledge, then nobody needs to speak.

        Bernard: Silence (he doesn't know the answer)
        Albert: Silence (he doesn't either)
        Bernard: I know it!
      
      Interestingly it then becomes relevant who was silent first.

      Basically it's nonsense.

      • sukilot 11 years ago

        If you assume Albert and Bernard are identical computers running identical programs, then it isn't nonsense. And that's not just a gimmick , timing analysis is how some side-channel attacks work in crypto.

        • Nursie 11 years ago

          Of course it's nonsense.

          If we can deduce the answer from silence then there's no need for any of the information given in the question, it's not a logic puzzle it's bullshit.

          I don't assume Albert and Bernard are anything, if you've made assumptions beyond what's stated in the question then you've done it wrong.

          And yes, I understand timing oracles.

        • anigbrowl 11 years ago

          Thank you.

    • logicallee 11 years ago

      can you make your whole comment more explicit, I don't follow your objection.

      • andrewprock 11 years ago

        Let's consider the question:

        1. "Why did Albert speak first?"

        Before we answer this, we need to develop a set of assumptions to operate under. Given the synthetic nature of the problem, we might assume that both Albert and Bernard are of equal ability, and able to make logical inferences based on reasonable assumptions. We'll also assume that both Albert and Bernard are only going to announce the binary state of each others certainty of the answer. Lastly, we'll assume that whoever can deduce the binary state of certainty first, will speak first.

        These assumptions, while a bit presumptuous, seem on the surface to adhere to the spirit of the puzzle.

        Given those assumptions, what does it mean when Albert speaks first? It means that he's figured out the binary state of certainty before Bernard. How could that be?

        If Bernard has the dates 18 or 19, then he knows that he knows, and he also knows that Albert does not know. If Bernard has any other date, he'll know that they both don't know. How does Bernard make this determination? He checks if his date is repeated anywhere.

        Compare that to the logic that Albert must perform to rule out Bernard's certainty. He must check that all of the dates in his month are in fact repeated.

        If they both perform these mental operations at the same speed, then Bernard should speak first in the case where he knows a unique date. The only reason why Bernard might not speak first is that he must also reason through whether or not Albert might know the date at this point. If Bernard holds an unrepeated date, the complexity of reasoning through Alberts situation boils down to considering only one month. But if Bernard holds a repeated date, he must consider Albert's situation for two months.

        So, there exists a time past which Albert must know that Bernard is considering the more difficult situation, and thus he can infer that Bernard does not know.

        If one assumes precise knowledge of the timing of logical operations, one can make even stronger inferences. To the point of even solving the entire problem without anyone every saying anything, for specific birthdays.

        I will be the first to admit that this line of reasoning may require certain assumptions which are strained. Thus the question may still remain:

        1. "Why did Albert speak first?"

        Does anyone have a different set of logical assumptions which leads to Albert speaking first?

        ----

        What this exposes really, is the more subtle assumption that the "correct" solution makes:

        "There is only one way to make inferences in this puzzle."

        The truth of that statement depends very much on the assumptions one makes about the puzzle. Most problematic is that most assumptions which makes that true, make it impossible for Albert to be the first speaker.

        It's a kind of logical paradox brought on by the fact that synthetic logic problems do not map very well to real world situations.

        • stephen_g 11 years ago

          > Lastly, we'll assume that whoever can deduce the binary state of certainty first, will speak first.

          The speed at which they come to their conclusions, and who speaks first is meaningless. I think perhaps if you are taking them into account then you are trying to come up with a completely different problem, or intentionally being disingenuous.

          Given the context (that this is a question on a high school test), it is safe to assume that Albert and Bernard are only drawing logical conclusions from the information Cheryl provides and what each other say.

          Given that the problem works with no problems under these assumptions, and that there is enough information to re-word it with Bernard speaking first that does not change the answer, it seems pointless to try and look for timing attacks or other outlandish ways to change the answer...

          • andrewprock 11 years ago

            "The speed at which they come to their conclusions, and who speaks first is meaningless."

            That's your own assumption. And that's a perfectly fine assumption to make, but not a universally chosen one.

        • logicallee 11 years ago

          Albert speaks first because he's Albert! They're obviously just going alphabetically.

          Maybe my other comment was right and they should have been called Alice, Bob, and Carol.

          The way I read the question, it's as though a moderator said: "Albert, tell me what's on your mind." "Bernard?" "Albert?"

          I will add that #4 should certainly be in the past tense ("at first I didn't know") because this way Albert and Bernard are in on the fact that they're part of a logical puzzle!! They should not know that they are characters in a puzzle.

          This is how I read the puzzle:

          Moderator to Albert: tell the reader what you know.

          Albert: I don't know when Cheryl's birthday is, but I know that Bernard does not know too.

          Moderator to Bernard: And you, Bernard?

          Bernard: At first in this puzzle I don't know when Cheryl's birthday is (before Albert spoke), but now that you have asked Albert, and I've heard his response, I've figured it out.

          Moderator to Albert: And any thoughts from you, now that Bernard has figured it out?

          Albert: Yes. Given the information Bernard has now stated, I would say I also know Cheryl's birthday now.

          • andrewprock 11 years ago

            I believe assuming they are "just going alphabetically" and/or that there is some sort of implicit moderator managing the conversation qualify as non-obvious assumptions.

            • Nursie 11 years ago

              Assume nothing, simply take what's stated. This happened and then this and then this.

              If you can't piece everything together then... well you're not suited to logical analysis.

              • anigbrowl 11 years ago

                The vociferous objections on this sub-thread are rather amusing. It seems several people missed the bit where I said I was OK with the official solution at first, but kept being bothered about the problem construction. I doubt Andrew has any problem articulating the default 'correct' solution either. I was thinking about the problem construction anyway because I was annoyed that the problem as stated in Singapore includes several glaring errors of English grammar which were an annoying distraction, eg' I know that Bernhard does not know too' rather than '...does not know either.' English is an official language in Singapore so I was surprised that such obvious errors would be allowed to creep into a logic problem; it's akin to muddying up a mathematical equation with '-(-x)'.

                That started me thinking outside the confines of the problem and about the implicit assumptions that were in the problem statement itself. The 'inability to piece everything together' is entirely imaginary on your part.

              • andrewprock 11 years ago

                On the contrary, logical analysis is generally not well suited to the understanding of human behavior.

                • Nursie 11 years ago

                  If you think this is a question about human behaviour then you've gone very wrong indeed.

                  • andrewprock 11 years ago

                    Given that this question is about humans, and discusses their behavior, it's clear you are making some assumptions about the structure of the question which are not present in the question.

                    That's certainly a reasonable thing to do.

                    What's not reasonable is to assume that the assumptions you make are going to match the assumptions of others. Likewise, when make assumptions there is a chance that the assumptions you make are incorrect.

                    That may or may not be the case here.

                    But the fact remains, you need to make some very strong assumptions for what you have said to be true.

                    • Nursie 11 years ago

                      Nope, I'm not making assumptions, I'm using the data presented.

                      >> Given that this question is about humans

                      Please note that nowhere in the questions does it say the participants are human. This is one of your many assumptions.

                      • andrewprock 11 years ago

                        You are correct, that the participants are people, with birthdays, and capable of speaking, is an assumption. You appear to be taking issue with that assumption. I suppose that is your prerogative, but it probably leaves you in the vanishing minority.

        • Nursie 11 years ago

          >> Let's consider the question: 1. "Why did Albert speak first?"

          If you're even thinking about this then you have failed the question, it's a puzzle that asks you to derive a correct answer from the data provided, not from your conjectures about human behaviour.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection