๐Ÿง‘๐Ÿพโ€๐Ÿ’ป prep

Mental models for logical reasoning

๐Ÿง  Introduction

Welcome to Logic. For this module, we will get out of VSCode and build mental models we can use anywhere to reason more effectively.

You will need

๐Ÿ““ Notebook and pen
๐Ÿง  Your wonderful brain
๐Ÿ” And you will still need the curriculum and Google, that’s not banned, don’t worry.

Learning by teaching

In this prep you will build a series of mental models necessary for logical reasoning. You likely already know some of these pieces. We will start to build each model by playing a game. Pay attention, because…

In class this week you will be teaching something. You will be explaining one of these mental models. You will not use a computer to explain this, but something else. This could be a drawing, a game, a conversation, or anything you like that will help you communicate the concept, except a computer!

You should make sure you understand all these models, but choose just one to teach in class.

Mental models

  1. Deduction: Reasoning from general rules to a specific conclusion that is definitely true
  2. Induction: Reasoning from specific examples to form general patterns that are probably true
  3. Abduction: Reasoning to the best explanation for all the evidence we observe
  4. Falsification: Testing a theory by trying to prove it wrong
  5. Problem Domain: Identifying the bounded space that contains all possible solutions to a problem
  6. Bisection: Reasoning by reducing a problem space to the smallest possible size
  7. Binary Logic: Reasoning with only two possible states (true or false)

Your task

Your core prep for this sprint is to learn about all of these mental models. You will do this by reading, and by playing games that use them.

You will need to prepare to teach other people about one of these mental models. Make sure to coordinate on Slack so that people are teaching different mental models.

๐Ÿšฅ Deduction

Learning Objectives

Deduction is reasoning from general rules to a specific conclusion that is definitely true

flowchart LR d1[Rule 1: If A then B] d2[Rule 2: We have A] d1 --> dc[Therefore we must have B] d2 --> dc

In Murdle, we use deduction to solve murders. Given general rules about the crime scene and specific clues, we can deduce ๐Ÿงถ ๐Ÿงถ deduce Use rules you know are true to prove something specific must also be true. who the murderer must be.

Given the body was found in the kitchen
And only Miss Saffron had been in the kitchen
Then Miss Saffron must be the murderer

This is deduction: starting with general rules and arriving at a specific conclusion that must be true. Unlike guessing or inferring patterns, deduction gives us certainty. If our premises are true, our conclusion must be true.

In Murdle, every puzzle can be solved through pure deduction. There’s no need to guess. The clues and rules will lead you to a single possible murderer.

Go play Murdle.

๐Ÿฑ Induction

Learning Objectives

Induction is reasoning from specific examples to form general patterns that are probably true

flowchart TD sp1[Specific Example 1] --> gp[General Pattern] sp2[Specific Example 2] --> gp sp3[Specific Example 3] --> gp gp --> pc[Probable Conclusion]

In Sushi Go, we use induction to build winning strategies. By observing specific outcomes across multiple hands, we form general theories about what works. For example:

Given collecting 3 tempura scored 10 points
And collecting 2 tempura scored 5 points
And collecting 1 tempura scored 0 points
Then tempura probably works best in pairs

Unlike deduction which gives certainty, induction helps us form educated guesses about patterns. The more examples we see, the more confident we can be in our general conclusions - but we can never be 100% certain.

In Sushi Go, every game teaches us something new about card combinations, timing, and player behavior. Through repeated play, we inductively learn strategies like:

  • Watching what others collect helps predict what cards will come around
  • Early puddings often pay off in the final round
  • Chopsticks are most valuable when saved for high-scoring combinations

Play a few rounds of Sushi Go and practice inductive reasoning. Don’t spend a long time reading the rules, just play through a few rounds to get the idea. Try to:

  1. Notice specific scoring patterns
  2. Look for recurring situations
  3. Form general theories about good strategies

๐Ÿ”Ž Abduction

Learning Objectives

Abduction is reasoning to the best explanation for all the evidence we observe

flowchart TD ev1[๐ŸŸจ Yellow S] --> h1[Hypothesis LAPSE] ev2[๐ŸŸจ Yellow A] --> h1 ev3[๐ŸŸฉ Green E] --> h1 ev1 --> h2[Hypothesis SHAME] ev3 --> h2 h1 --> be[Best Word] style h2 stroke-dasharray: 5 5

Unlike deduction which proves only what must be true, or induction which only finds patterns that are probably true, abduction seeks the most complete explanation.

Given we guessed STARE
And we got ๐ŸŸจโฌœ๐ŸŸจโฌœ๐ŸŸฉ
Then LAPSE might be the answer (but we can’t be certain)

In Wordle, we think like word detectives. We have an initial constraint: it must be an English word of five letters.

We have five attempts. Each guess we make gives us some feedback and allows us to eliminate some hypotheses, or guesses. A yellow square might support our theory about which letters are in the word, contradict it, or suggest a completely different explanation. We must:

  • Keep track of all feedback squares
  • Form multiple possible word theories
  • Test each word against all the evidence
  • Choose the word that best fits everything we know
  • Make a guess even though we can’t know for sure whether we’re right
  • Revise our guess when new evidence appears

It’s quite a lot like problem solving we’ve done before, isn’t it? This process of seeking the best explanation mirrors how we approach complex problems in many fields:

๐Ÿง‘๐Ÿฝโ€โš•๏ธ Doctors diagnosing illnesses from symptoms
๐Ÿ•ต๐Ÿฟ Detectives solving cases from clues
๐Ÿง‘๐Ÿฟโ€๐Ÿ”ฌ Scientists developing theories from observations
๐Ÿง‘๐Ÿปโ€๐Ÿ”ง Engineers troubleshooting system failures

We need a strategy, but experience also matters. In Wordle, the more English words we know, and the more we know about words, the better our guesses. In engineering, the more we know about building software, the faster we can find our problems.

Now go solve today’s puzzle:

๐Ÿ—บ๏ธ The Problem Domain

Learning Objectives

The problem domain is a bounded space that contains all possible solutions to a problem. Everything outside the problem domain is impossible or irrelevant.

stateDiagram-v2 state "Everything Possible" as EP { state "Numbers" as N { state "1-100" as H { state "Even Numbers" as E } } }
Each constraint reduces our problem space

Given no constraints
Then… the answer could be anything in the universe!
When we add “must be a number”
Then we constrain to the domain of numbers

Before we can solve a problem, we need to understand what’s possible. In Twenty Questions we start with everything in the universe, then ask questions to reduce our problem space. We might start with “Is it alive?” to constrain our domain to animals, then “Is it a mammal?” to reduce further.

โŒ Falsification

Learning Objectives

Falsification is an efficient reduction strategy. It means making predictions that eliminate possibilities, rather than gathering evidence that supports them

stateDiagram-v2 state "All Possibilities" as AP { state "Theory Space" as T1 { state "Remaining" as T2 { state "Survivors" as T3 } } }

Given many possible rules
Make a prediction that could eliminate some
When the prediction fails
Then we can discard those possibilities

This is a subtle distinction: dis confirmation is the mental model we must build here. In 20 Questions we discovered our problem space by confirming and disconfirming our guesses. In Zendo, we will try to discover the rule governing pyramid patterns not by confirming our guesses, but by eliminating what’s impossible

Here’s a classic example:

flowchart TD T["๐Ÿฆข Theory: All Swans Are White"] O["Observe Next Swan"] D{"What Color?"} W["Theory Holds..."] F["Theory Falsified!"] T --> O O --> D D -->|โฌœ White| W D -->|โฌ› Black| F W -->|"Keep testing"| O

Popper explains that each additional white swan appears to confirm our wrong idea that all swans are white. A single black swan disproves it, and ends the loop. This strategy shows us that:

  1. Only gathering confirming evidence leaves too many possibilities, or too large a problem domain
  2. However, each failed prediction narrows our search space by discarding possibilities
  3. We learn more from being wrong than being right

It is more efficient to find a way to disprove your hypothesis or falsify your proposition, if you can. This is because you only need to disprove something once to discard it, but you may apparently verify a hypothesis many times in many different ways and still be wrong.

Now, practice eliminating possibilities in Zendo. For this game you need a group, so post in Slack to find others to play with.

โœ‚๏ธ Bisection

Learning Objectives

In bisection, we start with a large problem space and cut it in half with each guess.

bisection.svg

In software development, bisection helps us find exactly when a change occurred. For example:

Given our code worked last week but not today
When we test the middle version and it works
Then the problem must be in the newer half

With each test, we:

  1. Select the middle version
  2. Test if it works
  3. Eliminate half the versions
  4. Repeat until we find the exact change

This binary search technique is remarkably efficient. Even with thousands of versions, we’ll find the problematic change in just a few tests. Git and other version control systems include built-in bisect tools for this purpose.

๐ŸŽญ Boolean Logic

Learning Objectives

Boolean logic uses only true or false to reason about the world.

In the real world, we use logic to make decisions all the time. For example: if it’s raining and you don’t have an umbrella, you will get wet. This can be represented as a truth table:

Is RainingHas UmbrellaIs Wet
FFF
FTF
TFT
TTF

Truth tables show all possible combinations and all possible outcomes.

Given A is true (1)
And B is true (1)
Then A AND B is true (1)

In computers, we use binary logic to derive conclusions from data. Each bit can represent a logical state: true ๐Ÿงถ ๐Ÿงถ true Represented as 1 in binary or false ๐Ÿงถ ๐Ÿงถ false Represented as 0 in binary .

RainingUmbrellaWet
000
010
101
110

This is fundamental to how computers work. Every operation a computer performs, from simple addition to complex decision-making, ultimately comes down to chains of basic logical operations on 1s and 0s.

Try building some truth tables yourself in your notebook. Here are some examples to get you started:

  • “You can get a loyalty reward if you have the app AND have made 10 purchases”
  • “The alarm will sound if the door is open OR motion is detected, UNLESS the system is disabled”
  • “Trainees pass the course if they complete coursework AND attend class AND complete their steps”

๐Ÿ€ 1000 Bottles of Wine

Now we’re going to solve a puzzle together. We’re going to think through a few different ways to approach it. This is a well-known puzzle and it’s certainly possible to google the answer. However, we’d suggest: don’t do that - you would steal from yourself the opportunity of learning this important idea.

๐Ÿ•น๏ธA long awaited party

The King has stocked his wine cellar with one thousand bottles of wine for his birthday party tomorrow. However, the King’s evil brother, the Duke, has poisoned one of the bottles! The poison is lethal and will kill anyone who takes even one sip within one hour. You, the Butler, must find the poisoned bottle and save the party! But how?

Conditions:

๐Ÿพ You have 1000 wine bottles, one of which is poisoned.
๐Ÿ€ You have 500 rats you can use to test the wine.
โŒ› The poison is lethal and will kill within 1 hour.

In your notebook, write down your solution to this problem. Here are the constraints again:

๐Ÿพ You have 1000 wine bottles, one of which is poisoned.
๐Ÿ€ You have 500 rats you can use to test the wine.
โณ The poison is lethal and will kill within 1 hour.

๐Ÿพ ๐Ÿพ ๐Ÿ€

One way to think of this is to reduce this problem to its simplest case. If you have 2 bottles and 1 rat, you can test the wine by giving the rat a sip from one bottle. Wait one hour. If the rat is alive, the bottle is safe. If the rat is dead, the bottle is poisoned.

With 500 rats, it’s similar, but not the same. Divide the 1000 bottles into 500 groups of 2. In round 1, give each rat a sip from one bottle in each group. Wait one hour. If the rat is alive, the bottle is safe. If the rat is dead, you found the poisoned bottle. If all rats are alive, the poisoned bottle is in the 500 bottles that were not tested. You still have 500 rats, so you can have each rat test the other bottle in their group.

This solution will take a maximum of 2 hours.

New condition

You now have just 10 rats to test the wine.

In your notebook, write down your solution to this problem. Here are the constraints again:

๐Ÿพ You have 1000 wine bottles, one of which is poisoned.
๐Ÿ€ You have 10 rats you can use to test the wine.
โณ The poison is lethal and will kill within 1 hour.

With just 10 rats, we need a way to make our solution more efficient. We can break our problem into 10 smaller problems. Think of it as a search pattern, narrowing down our suspects with each round of testing.

Round 1: Let’s divide our 1000 bottles into 10 groups of 100. Each rat tests one group : a sip from every bottle in its group of 100. An hour later, with one dead rat, we have narrowed our search to 100 bottles. We’ve saved 900 bottles of wine and we still have 9 rats to help us.

Round 2 Let’s do it again: take our suspicious 100 bottles and create ten groups of ten. Our nine rats each drink from one whole group (and one group goes un-drunk). Our doomed rat perishes again, and after another hour, we’ve found the right group of ten. We now have 8 rats.

Round 3 Now we’re down to just 10 bottles. Eight rats test a bottle each, leaving two untested. If a rat dies, we’ve found the poisoned bottle. If not, we have two bottles left for the last round.

Round 4: Base case We can use just one rat to test one bottle. If we have a dead rat, it’s the poisoned bottle. If not, the last untasted bottle is the culprit.

Through careful division and patience, we’ve turned an overwhelming search into a manageable investigation. Four hours, and we’ll have our answer.

New condition

The birthday party is now in 1 hour, so you only have time for one test!

Think about how you can use some of the thinking tools you just learned to solve this problem.

You will need boolean logic, deduction, and binary at least. Here are the constraints again:

๐Ÿพ You have 1000 wine bottles, one of which is poisoned.
๐Ÿ€ You have 10 rats you can use to test the wine.
โณ The poison is lethal and will kill within 1 hour. โŒ› You only have 1 hour so can only do 1 round of testing.

If we only have one hour, we can only do a single round of testing! Our strategy of narrowing down can’t work. We’re going to have to think about what we have learned about binary to solve this problem.

I really advise that you write this out yourself in binary as you follow the solution through.

Let’s reduce our case. Let’s say we have 3 bottles and 2 rats.

We’re going to number the bottles in binary. Each rat will test a different bit of the binary number. Rat 1 will test the 1s place, Rat 2 the 2s place.

DecimalBinaryRat 1Rat 2
1001x
2010x
3011xx

If only rat 1 dies, we know the poison is in the 1s place. It’s bottle 1. If only rat 2 dies, the poison is in the 2s place: bottle 2 is poisoned. If both die, bottle 3 is our culprit.

To be clear: instead of testing bottles one by one, we will have the rats sip from multiple bottles at once, just as with our progressive elimination search. But in this test, each rat’s survival or death becomes a piece of information that we can combine to locate the poisoned bottle.

Take a moment to check this out for yourself with 8 bottles and 3 rats.

DecimalBinaryRat 1Rat 2Rat 3
1001
2010
3011
4100
5101
6110
7111
8100

Now, what about 16 bottles? How many rats do you need?

We can also frame this as: how many rats do we need for n bottles? With 1000 bottles, do you definitely need 10 rats? How would you prove that?

๐Ÿ€ Binary Information Theory

At its heart, our rat puzzle demonstrates how binary data encoding works. Each rat represents one binary digit (a bit). They either live (1) or die (0). With 10 rats, we have 10 bits of information.

๐Ÿงฎ The Power of Binary

  • 1 bit can represent 2^1 = 2 possibilities (0 or 1)
  • 2 bits can represent 2^2 = 4 possibilities (00, 01, 10, 11)
  • 3 bits โ†’ 2^3 = 8 possibilities
  • 10 bits โ†’ 2^10 = 1024 possibilities!

๐ŸŽฏ Key Insight

This is why 10 rats are enough for 1000 bottles. Each possible combination of rat survival/death can uniquely identify one bottle number. We’re seeing the same principle that allows computers to encode vast amounts of information using just 1s and 0s.

๐Ÿ€ Memory Locations

Just like how computers use binary addressing to locate specific memory locations, we’re using our “rat bits” to encode the location (bottle number) of our poison. Each bit helps narrow down the possibilities until we have a unique address.