http://discrete.openmathbooks.org/dmoi3/sec_intro-statements.html
I want to go through this page, which is about Mathematical
Statements. It looks like introductory logic things to me.
It starts with a logic puzzle. I thought it would be good practice for
me to write out my solution to the puzzle.
> While walking through a fictional forest, you encounter three trolls guarding a bridge. Each is either a *knight*, who always tells the truth, or a *knave*, who always lies. The trolls will not let you pass until you correctly identify each as either a knight or a knave. Each troll makes a single statement:
>
> Troll 1: If I am a knave, then there are exactly two knights here.
> Troll 2: Troll 1 is lying.
> Troll 3: Either we are all knaves or at least one of us is a knight.
>
> Which troll is which?
The first thing I noticed is what Troll 3 said. It’s always true. So
Troll 3 is a knight.
Then I looked at what Troll 1 said. It’s either true or false. Since
it’s an if/then statement, it’s probably easier to check the case in
which it’s false. That’s because there’s only one case when it’s
false: the “if” part is true and the “then” part is false.
This is what happens if we assume Troll 1 is a knave and is lying: “I
[Troll 1] am a knave” is true and “there are exactly two knights here”
is false. “I am a knave” being true is fine because that’s what we
assumed. “there are exactly two knights here” being false leads to
this: Troll 3 is a knight and Troll 1 is a knave, so Troll 2 can’t be
a knight because then “there are exactly two knights here” would be
true. So Troll 2 is a knave and is lying. But Troll 2 says that Troll
1 is lying, so that’s the truth, not a lie. The stuff in this
paragraph leads to a contradiction so the assumption that Troll 1 is a
knave must be wrong.
So Troll 1 is a knight and is telling the truth. Then Troll 2 must be
a knave because “Troll 1 is lying” is false.
So we have Troll 1 knight, Troll 2 knave, Troll 3 knight.
I went back and checked all 3 statements to make sure they are
consistent with this and they are.