DM 01 Logic and propositions
DM 00 Course Map | Next: DM 02 Predicates and Quantifiers
Propositional logic gives exact meanings to “not”, “and”, “or” and “if-then”, so that the truth of a compound statement can be computed from the truth of its parts.
Propositions
A proposition is a statement that is either true or false, never both.
- “7 is prime.” Proposition (true).
- ”.” Proposition (false).
- “Close the door.” Not a proposition (a command).
- ”.” Not a proposition until is given a value (DM 02 Predicates and Quantifiers).
We name propositions with letters and build larger ones with connectives.
The basic connectives
| Name | Symbol | Read as | True when |
|---|---|---|---|
| negation | not | is false | |
| conjunction | and | both are true | |
| disjunction | or | at least one is true | |
| exclusive or | xor | exactly one is true |
A truth table lists the value of a compound statement for every combination of inputs. With variables there are rows.
| T | T | T | T | F |
| T | F | F | T | T |
| F | T | F | T | T |
| F | F | F | F | F |
Mathematical “or” is inclusive: is true when both are. English “or” is often exclusive (“tea or coffee?”). When in doubt, the mathematical default is inclusive.
Implication
reads “if then ”. is the hypothesis, the conclusion.
| T | T | T |
| T | F | F |
| F | T | T |
| F | F | T |
It is false in exactly one case: the hypothesis holds and the conclusion fails.
Why is it true when is false? Think of a promise: “If it rains, I will bring an umbrella.” The only way I break it is if it rains and I bring none. If it does not rain, I have kept my word whatever I carry. An implication makes a claim only about the cases where the hypothesis holds; elsewhere it is vacuously true.
A second way to see it: “every multiple of 4 is even” should be true. Written as “if is a multiple of 4 then is even”, it must hold for (F, F) and (F, T) as well. Those rows have to be T.
Useful equivalent form:
Many phrasings, one meaning. All of these say : “if then ”; ” implies ”; ” if ”; ” only if ”; ” is sufficient for ”; ” is necessary for ”.
Converse, inverse, contrapositive
Starting from :
| Name | Form | Equivalent to the original? |
|---|---|---|
| contrapositive | yes, always | |
| converse | no | |
| inverse | no (it is the contrapositive of the converse) |
Example. “If it is a dog, then it is a mammal.” (True.)
- Contrapositive: “If it is not a mammal, then it is not a dog.” True.
- Converse: “If it is a mammal, then it is a dog.” False.
Confusing a statement with its converse is the most common logical error in everyday reasoning. The equivalence with the contrapositive is a proof technique in its own right (DM 03 Proof Techniques).
Biconditional
, ” if and only if ” (often written “iff”), is true when and have the same truth value. It means . To prove an “if and only if”, prove both directions.
Logical equivalence
Two statements are logically equivalent, written , when they have the same truth table. The important laws:
| Law | Statement |
|---|---|
| double negation | |
| De Morgan | |
| De Morgan | |
| distributive | |
| distributive | |
| implication | |
| negated implication | |
| contrapositive |
De Morgan in words. “It is not the case that both are true” means “at least one is false”. “It is not the case that either is true” means “both are false”. Negation flips and into or.
In code: not (a and b) is (not a) or (not b).
Negating an implication. The negation of “if then ” is not another if-then. It is ” holds and yet fails”: a counterexample.
Worked example: verify by truth table that .
| T | T | F | T | T |
| T | F | F | F | F |
| F | T | T | T | T |
| F | F | T | T | T |
The last two columns match.
Tautologies and contradictions
A tautology is true in every row: . A contradiction is false in every row: . A statement is satisfiable if at least one row makes it true. Deciding satisfiability for large formulas (SAT) is a famous hard problem and the basis of modern verification tools.
Valid arguments
An argument is valid when the conclusion is true in every case where all the premises are true. Two valid patterns and two invalid look-alikes:
| Pattern | Form | Valid? |
|---|---|---|
| modus ponens | , , therefore | yes |
| modus tollens | , , therefore | yes |
| affirming the consequent | , , therefore | no |
| denying the antecedent | , , therefore | no |
“If it rains, the ground is wet. The ground is wet. So it rained.” Invalid: a sprinkler would do.
Validity concerns form, not truth. A valid argument with a false premise can have a false conclusion.
Common mistakes
- Reading as ” causes ”. It is only a statement about truth values.
- Assuming the converse.
- Negating “and” without flipping it to “or”.
- Treating “or” as exclusive.
Learn by doing
- Build the truth table of . What kind of statement is it?
- Write the contrapositive and the negation of “If a number is divisible by 6, then it is divisible by 3.”
- Simplify using De Morgan.
- “If the sensor fails, the robot stops. The robot stopped.” What can you conclude?
- True in all four rows: a tautology.
- Contrapositive: “If a number is not divisible by 3, then it is not divisible by 6.” Negation: “Some number is divisible by 6 and not divisible by 3.”
- .
- Nothing about the sensor. Concluding that it failed would be affirming the consequent.
Where this shows up
Every if condition, database query and safety interlock is a propositional formula. Logic gates implement these connectives in hardware (DM 12 Boolean Algebra and Automata).