Lesson 1.4 — IF

The Word

IF sets up a promise. It connects two parts and says: if the FIRST part happens, then the SECOND part must follow.

"IF you eat your vegetables, THEN you get dessert."

This is a promise from your parents. The whole promise is true or false even if parts of the promise are true or false. IF is logic that you use everyday!

When can you call them on it? Only when the first part happens (you ate the veggies) AND the second part doesn't (no dessert). Every other combination leaves the promise intact.

The Truth Test

The widget below has two modes. Start with Just IF (one-way) — that's the basic promise we just described. Then try IFF (both ways) — that's the stronger version where each side guarantees the other.

Which kind of promise?
"IF I eat my veggies, THEN I get dessert" (one-way promise — veggies guarantee dessert)
I eat my veggies
I get dessert
I eat veggies I get dessert IF veggies THEN dessert
True True True
True False False
False True True
False False True
IF is a one-way promise: veggies guarantee dessert. Dessert alone doesn't tell you anything about veggies.
Pick a value for each claim above to see the explanation.

The Weird Rows

In Just IF mode, look at the last two rows. When you didn't eat veggies, the promise stays TRUE no matter what — because the promise was never triggered. Mathematicians call this vacuously true. The promise can't be broken if its condition never happened.

That feels weird. But it's the only consistent rule. If no-veggies-no-dessert broke the promise, then EVERY unconditional thing in your life would be breaking promises constantly.

IFF: When the Promise Goes Both Ways

Most of the time, when a parent says "if you eat veggies, you get dessert," they actually mean only if you eat veggies. No veggies = no dessert. That's a stronger claim.

This stronger version is called IFF — "if and only if." And it's built from pieces you already know:

(X IFF Y) is just (IF X THEN Y) AND (IF Y THEN X)

It's the original IF promise PLUS the reverse promise, joined by AND. Two IFs and an AND. That's all IFF is — semantic sugar over things you already have.

Switch the widget above to IFF (both ways) and try this: set veggies = FALSE and dessert = TRUE. In Just IF mode, that's TRUE (vacuous — promise not triggered). In IFF mode, it's FALSE (because the reverse promise IS triggered — dessert without veggies breaks the IFF). That's the entire difference between IF and IFF, made visible in one row.

IFF isn't AND. They tell you different things.

Both report TRUE when both inputs are TRUE. They share that row. But knowing the operator is TRUE tells you different things about the inputs.

"P AND Q is TRUE" means: P is TRUE, and Q is TRUE. Each side is pinned to a specific value.

"P IFF Q is TRUE" means: P and Q have the SAME value. They could both be TRUE, or both FALSE — you don't know which. The match is pinned; the values aren't.

So with IFF, if you ever find out one side, you instantly know the other — they move together. With AND, there's nothing left to find out. Both sides are already TRUE.

AND tells you everything. IFF only tells you the two sides match.

A Real Example

"IF it is raining, THEN the street is wet."

This is just IF. Raining guarantees wet street, but wet street doesn't guarantee rain (could be a sprinkler).

"Two whole numbers are equal IFF their difference is zero."

This is IFF. Equal numbers → difference is zero, AND difference zero → numbers are equal. Both directions hold.

Tricky Bits

IF doesn't mean CAUSE. "IF a coin shows heads, THEN it doesn't show tails." The heads doesn't CAUSE the not-tails — they're the same event. IF in logic is about TRUTH RELATIONSHIPS, not causes.

English "if" is often "IFF" in disguise. "You can stay up late if you finish your homework" — most parents mean ONLY IF. When you hear "if" in real life, ask yourself whether the speaker means one-way or two-way.

Recap

Disclosure: This page was generated by Claude (Anthropic) under Bill's direction. Bill provided the curriculum design and the pedagogical thread; Claude wrote the prose and built the interactive widget.