πŸ§‘πŸΎβ€πŸ’» 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!

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)

πŸš₯ 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. 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[Evidence 1] --> h1[Hypothesis A] ev2[Evidence 2] --> h1 ev3[Evidence 3] --> h1 ev1 --> h2[Hypothesis B] ev2 --> h2 ev3 -.-> h2 h1 --> be[Best Explanation] h2 -.- be style h2 stroke-dasharray: 5 5 style ev3 stroke-dasharray: 5 5

In Sherlock Holmes: Consulting Detective, we think like detectives. Each case presents us with mysterious evidence that needs explaining. 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 a woman was found dead in her apartment
And her jewelry was untouched
And there were no signs of forced entry
Then the killer likely knew the victim (but we can’t be certain)

Each lead we follow adds new evidence. A witness statement might support our theory, contradict it, or suggest a completely different explanation. We must:

  • Keep track of all evidence
  • Form multiple possible theories
  • Test each theory against all the evidence
  • Choose the explanation that best fits everything we know
  • Be ready to revise our theory when new evidence appears

It’s quite a lot like problem solving we’ve done before, isn’t it? Now go solve a case:

πŸ—ΊοΈ 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”