Propositional Logic
Propositional logic builds complex claims from simple true-or-false pieces with and, or, not, and implies, then derives conclusions mechanically.
Why Does This Exist?
Code is logic made executable: if deployed and not monitored: alert() decides by combining true-or-false pieces. Specifications, contracts, and correctness arguments all rest on saying exactly what follows from what. Propositional logic is the shared language for that: a small set of connectives with exact meanings, so "or" never wobbles between inclusive and exclusive and "if" never blurs into "if and only if."
Its ML footprint is everywhere conditions appear: data validation rules, guardrail policies, early-stopping criteria, and the preconditions inside every correctness proof. This page teaches the connectives and the two inferences that never fail. Tables of all combinations are in truth tables; the overview is sets, logic and proofs.
The one idea you need first
A proposition is a sentence with a definite truth value, true or false: "the model is deployed" qualifies, "deploy soon" does not. Lowercase letters , , stand for propositions. Connectives build compound propositions whose truth depends only on their parts.
Think of It Like This
Lego bricks with studs that enforce fit
Each proposition is a brick stamped true or false. Connectives are connector pieces with fixed shapes: AND outputs true only when both studs are true, OR when at least one is, NOT flips its brick, and IMPLIES promises that a true left brick forces a true right one. Snap them together and the whole assembly's stamp is forced, no judgment involved.
The power is the enforcement: anyone assembling the same bricks gets the same stamp. The analogy stops at meaning: bricks ignore what says about the world, so garbage premises still assemble into validly derived garbage. Validity preserves truth; it cannot create it.
How It Actually Works
The four connectives, with and as propositions ( not, and, or, implies):
- : true exactly when is false. Flips the value.
- : true only when both are true. Strict gate.
- : true when at least one is true. Inclusive, unlike everyday "either."
- : false only when is true and false; true in all three other cases. A promise broken only by kept premise plus failed conclusion.
Two inference patterns are always valid. Modus ponens: from and , conclude . Modus tollens: from and , conclude . The trap: from and , nothing follows about (affirming the consequent). Monitoring may run for other reasons; deployment is not proven.
Worked example
Let be "the model is deployed" and be "monitoring is on," with the policy :
- Observe true. By modus ponens, is true: monitoring must be on. Derived, not checked.
- Observe (monitoring off). By modus tollens, : the model is not deployed. Contrapositive in action.
- Observe true. Conclude nothing about : staging also runs monitoring. Affirming the consequent would wrongly "prove" deployment.
Three observations, three different verdicts, all mechanical. Write the policy once and the inferences run themselves.
Watch Out For
Reading implies as if-and-only-if
"If deployed then monitored" gets misremembered as "deployed exactly when monitored," adding a reverse promise nobody made. Alerts then fire on staging (monitored, not deployed) as if policy broke.
Treat as one-directional until an explicit "if and only if" appears. If both directions hold, write both arrows; never smuggle the converse.
Affirming the consequent in evaluations
"Good models score above 0.9; this scores 0.92, so it is good" affirms the consequent: high score was necessary, not sufficient. A leaked or gamed metric satisfies while (genuinely good) is false.
Check the direction before celebrating: does the metric follow from goodness, or does goodness follow from the metric? Only the second licenses the conclusion.
The Quick Version
- Propositions are true-or-false sentences; connectives combine them exactly.
- AND needs both, OR needs at least one, NOT flips, IMPLIES breaks only on true-premise plus false-conclusion.
- Modus ponens (, gives ) and modus tollens ( gives ) never fail.
- From alone nothing follows about .
- Deployed plus deployed-implies-monitored derives monitoring mechanically.
- Never upgrade a one-way rule into an if-and-only-if silently.