SheafificationOfG / BoolosBrewery

You are hanging out with Alice, Bob, and Charlie at Boolos' Brewery...
36 stars 23 forks source link

Optimisation for bryker's 6 question solution #14

Closed Rrst1 closed 1 month ago

Rrst1 commented 1 month ago

Small optimisation for bryker's excellent 6 question solution.

When asking the first question to all four people, we will always get one of each response and a single duplicate response from the engineer. Knowing this, if we get a duplicate response in the first three questions, we can save a question by not asking the fourth and simply adding the unused response, bringing the average number of questions down.

Note: Seeing as this is a minor tweak to bryker's solution, it should still register as his solution on the hi-scores, not mine (might require a manual adjustment)

github-actions[bot] commented 1 month ago
Difficulty Score Comments
hard 5.5 Question limit: 6
undarr commented 1 month ago

I would like to ask specifically about the first question. I understand how the maths, phys and phil give different answer on a fixed question. However, the last part of the question - "You are phys", is not fixed, since "You" refers to a different person each time. In this case, can we really guarantee the maths and the phys giving different answers? Thanks

Rrst1 commented 1 month ago

I would like to ask specifically about the first question. I understand how the maths, phys and phil give different answer on a fixed question. However, the last part of the question - "You are phys", is not fixed, since "You" refers to a different person each time. In this case, can we really guarantee the maths and the phys giving different answers? Thanks

I'll start by saying that the first question is the really clever insight that allowed bryker to solve this in 6 questions, and whilst I mostly understand it, I wouldn't have come up with it, and bryker should be your go-to for a full explanation.

The question:

            "((Foo is true) and (Bar is false)) xor " + \
            "((Bar is true) and (Baz is false)) xor " + \
            "((Baz is true) and (Foo is false)) xor " + \
            "(You study Phys)"

Note that first three lines that are xor'd together are mutually exclusive, so only one can be true if any, but also that they are not all the combinations of Foo, Bar and Baz (specifically, half of the total number of combinations but none of the opposites of those combinations are represented (eg Foo = true and Baz = false is not present). I'm sure there's a mathematically concise way to express this concept but I don't know what it is).

As such, only one of the three will only be true for ONE of either the Mathematician (M) or Physicist (P), since M and P choose the same words but with opposite assignments. When considering the xor, this will mean that those three statements will evaluate to 1 for either M or P and 0 for the other.

When this opposite state is then xor'd with the final line, which again is opposite for M and P (0 for M, 1 for P), you guarantee the same result for both M and P (you will either be xoring 1⊕0 for M and 0⊕1 for P or 0⊕0 for M and 1⊕1 for P, which will give you the same answer for both). Since M and P use different words for the same truth value, and they are always answering the first question with the same truth value, they will always use different words.

I hope that makes sense! Let me know if anything is unclear. And if any mathematicians/logicians want to formalise this explanation please do so - I'd love to see it.

undarr commented 1 month ago

I would like to ask specifically about the first question. I understand how the maths, phys and phil give different answer on a fixed question. However, the last part of the question - "You are phys", is not fixed, since "You" refers to a different person each time. In this case, can we really guarantee the maths and the phys giving different answers? Thanks

I'll start by saying that the first question is the really clever insight that allowed bryker to solve this in 6 questions, and whilst I mostly understand it, I wouldn't have come up with it, and bryker should be your go-to for a full explanation.

The question:

            "((Foo is true) and (Bar is false)) xor " + \
            "((Bar is true) and (Baz is false)) xor " + \
            "((Baz is true) and (Foo is false)) xor " + \
            "(You study Phys)"

Note that first three lines that are xor'd together are mutually exclusive, so only one can be true if any, but also that they are not all the combinations of Foo, Bar and Baz (specifically, half of the total number of combinations but none of the opposites of those combinations are represented (eg Foo = true and Baz = false is not present). I'm sure there's a mathematically concise way to express this concept but I don't know what it is).

As such, only one of the three will only be true for ONE of either the Mathematician (M) or Physicist (P), since M and P choose the same words but with opposite assignments. When considering the xor, this will mean that those three statements will evaluate to 1 for either M or P and 0 for the other.

When this opposite state is then xor'd with the final line, which again is opposite for M and P (0 for M, 1 for P), you guarantee the same result for both M and P (you will either be xoring 1⊕0 for M and 0⊕1 for P or 0⊕0 for M and 1⊕1 for P, which will give you the same answer for both). Since M and P use different words for the same truth value, and they are always answering the first question with the same truth value, they will always use different words.

I hope that makes sense! Let me know if anything is unclear. And if any mathematicians/logicians want to formalise this explanation please do so - I'd love to see it.

Ah I see, I understand now, I thought of the question as "The phys is always lying" thus if ((Foo is true) and (Bar is false)) for the mathematician, the statement ((Foo is true) and (Bar is false)) would also be true for the Phys.

I also got along to 6 questions except that I couldn't determine the maths and phys, this is a very good strategy that determines all characters without knowing which words "yes" and "no" correspond to, very cool! And I'm also pretty sure 6 is optimal.

GSheaf commented 1 month ago

Very nice! As requested, I will credit bryker (as well as you) after the scoreboard is updated.