— notes — 8 min read
Symbol | Meaning |
---|---|
Z+ | Positive integers. |
:= | Equal by definition: It implies that the equality is based on a specific definition or set of rules rather than just numerical equivalence. It’s always ok simply to write = instead of ::= because something that is equal by definition is a form of equality. |
∀ | For all. |
N | Non-negative integers. |
∈ | Element of. |
A proposition is a statement that is either true or false. e.g. Fermat’s last theorem is a proposition that states “there are no positive integers x, y, and z such that xn+yn=zn”. The proposition was shared by Fermat in 1630 and was only proven in 1994.
💡 You can't check a claim about an infinite set by checking a finite sample of its elements, no matter how large the sample.
A conjecture is a proposition that is believed to be true based on limited evidence but has not been proven. e.g. Goldbach’s conjecture states that “every even integer greater than 2 is the sum of two prime numbers”.
A predicate is a proposition whose truth depends on the value of one or more variables. e.g “n is a perfect square”.
Like propositions, predicates are named with letters, often with function notation. The output is either true or false depending on the input. This is in contrast to ordinary functions where the output is a numerical value. e.g. p(n) ::= n is a perfect square.
💡 Euler is pronounced “oiler”.
Logical operators or connectives are used to combine or modify logical propositions. These are the common logical connectives:
Symbol: ¬
Negation is a unary logical connective that takes a proposition P to another proposition “not P”, standing for “P is not true”. It is interpreted intuitively as being true
when P is false
, and false
when P is true
.
P | ¬P |
---|---|
T | F |
F | T |
Symbol: ∧
A conjunction is a (binary) logical connective on two propositions that produces a value of true
if and only if both propositions are true
.
A | B | A∧B |
---|---|---|
F | F | F |
F | T | F |
T | F | F |
T | T | T |
Symbol: ∨
A disjunction is a (binary) logical connective on two propositions that produces a value of true
if either one of the propositions is true
.
A | B | A∨B |
---|---|---|
F | F | F |
F | T | T |
T | F | T |
T | T | T |
Symbol: ⟹
A material implication or material conditional is a (binary) logical connective on two propositions that produces a value of true
unless its first proposition (antecedent) is true
and its second proposition (consequent) is false
.
The only circumstance in which a conditional is false
is if the consequent (Q) does not follow when the antecedent (P) is true
. The material conditional is only concerned with the hypothetical relationship between P and Q, not their actual truth values.
✏️ I have always scratched my head as to why the conditional was defined to be
true
if the antecedent isfalse
.One explanation is that if the antecedent is
false
, then the relationship (implication) doesn't matter. But then this begs the question: Why not define it to befalse
?One argument against that is that it would make the implication operator have the same truth table as the conjunction operator. But why is that a problem?
The argument that sits well with me so far is: The logical connectives must be truth-functional, i.e. its truth value is determined exclusively by the truth values of its arguments. Hence, we must define them to have a stable value. When P is
false
, we have two viable options: returnfalse
or returntrue
. We are using the latter option because of legacy reasons and because it “plays nicely” with the rest of the subject.
The material conditional (P⟹Q) can be expressed in various ways:
P | Q | P⟹Q |
---|---|---|
F | F | T |
F | T | T |
T | F | F |
T | T | T |
Symbol: ⟺
A material equivalence is a (binary) logical connective on two propositions that produces a value of true
only if both both propositions are true
or both are false
.
"P if and only if Q" can be decomposed into "P if Q" and "P only if Q":
true
, which is to say that when Q is false
, P must also be false
(i.e. P⟹Q). Notice that it does not tell us anything about the truth value of P if Q is true.true
, then we know Q must also be true
; however, if we know Q is true
, we do not necessarily know anything about the truth value of P.So, P if and only if Q is logically equivalent to (Q⟹P)∧(P⟹Q)
P | Q | P⟹Q | Q⟹P | P⟺Q |
---|---|---|---|---|
T | T | T | T | T |
T | F | F | T | F |
F | T | T | F | F |
F | F | T | T | T |
In implications relationships, a necessary condition is one (possibly one of multiple conditions) that must be present in order for another condition to occur, while a sufficient condition is one that produces the said condition.
In a conditional statement (P⟹Q) that is true
, the antecedent (P) is a sufficient condition for the consequent (Q) and the consequent is a necessary condition for the antecedent:
true
always implies that Q is true
.Being in the purple region is sufficient for being in A, but not necessary. Being in A is necessary for being in the purple region, but not sufficient. Being in A and being in B is necessary and sufficient for being in the purple region.
e.g.
A number's being divisible by 4 is sufficient (but not necessary) for it to be even, but being divisible by 2 is both sufficient and necessary for it to be even.
An inference is a set of premises together with a conclusion.
A rule of inference is a way or schema of drawing a conclusion from a set of premises, usually based only on the logical form of the premises.
Some common inference rules:
Modus ponens:
true
. P is true
. Therefore, Q must also be true
.If today is Tuesday, then John will go to work. Today is Tuesday. Therefore, John will go to work.
Modus tollens:
false
. Therefore, P must also be false
.If the dog detects an intruder, the dog will bark. The dog did not bark. Therefore, no intruder was detected by the dog.
Hypothetical syllogism:
If I do not wake up, then I cannot go to work. If I cannot go to work, then I will not get paid. Therefore, if I do not wake up, then I will not get paid.
Disjunctive syllogism
true
or Q is true
and P is false
, then Q is true
.Contraposition:
An inference is valid if, assuming its premises are true, the conclusion must be true.
An inference is sound if it is valid and all of its premises are true (and as a consequence its conclusion is true as well).
e.g.
A sound inference
(premises)
All men are mortal.
Socrates is a man.
(conclusion)
Therefore, Socrates is mortal.
e.g.
A valid but unsound inference
All birds can fly.
Penguins are birds.
Therefore, penguins can fly.
The standard form for inference rules is:
ConclusionPremise 1Premise 2When the statements above the line (the premises or antecedents) are proved, then the statement below the line (the conclusion or consequent) is considered to also be proved.
❌ Fallacies
Affirming the consequent:
If an animal is a dog, then it has four legs.
My cat has four legs.
Therefore, my cat is a dog.
Denying the antecedent:
If you are a ski instructor, then you have a job.
You are not a ski instructor.
Therefore, you have no job.
Begging the question:
An axiom or postulate is a proposition that is taken to be true, to serve as a premise or starting point for further reasoning and arguments. For instance, Euclid begun with five assumptions (axioms) about geometry, which seemed undeniable based on direct experience, e.g. “There is a straight line segment between every pair of points”.
A proof is a sequence of logical deductions from axioms or previously proved statements (like theorems) that concludes with the proposition of interest.
Logical deductions or inference rules are used to prove new propositions using axioms or previously proved propositions.
The axiomatic method, invented by Euclid, is the standard procedure for establishing truth in mathematics using axioms and proofs.
To prove p⟹q directly, assume p is true, then use axioms, definitions, rules of inference, and logical equivalences to prove q is also true.
A useful technique in constructing direct proofs is working backwards:
e.g.
Proposition: “If a number is divisible by 6, then it is also divisible by 3”
Proof:
- Assume x is divisible by 6 (💬 Assume p).
- x=k⋅6 (for some k in Z, by definition of division).
- x=k⋅(2⋅3) (known fact about numbers).
- x=(k⋅2)⋅3 (associative property of multiplication).
- x=m⋅3 (where m=k⋅2 is an integer).
- x is divisible by 3 ■ (💬 Demonstrated that q logically follows).
To prove p⟹q by contraposition, assume q is false, then use axioms, definitions, rules of inference, and logical equivalences to prove p is also false. This is essentially a direct proof that ¬q⟹¬p.
The best approach in doing a proof by contrapositive is to restate the original problem in the form, If p, then q. The contrapositive is then, If not q, then not p.
e.g.
Proposition: “If x is divisible by 6, then x is divisible by 3”
Proof:
- Assume x is not divisible by 3 (💬 Assume ¬q).
- x=k⋅3 (∀k∈Z)
- x=2m⋅3 (∀m∈Z)
- x=m⋅6 (∀m∈Z)
- x is not divisible by 6 ■ (💬 ¬p).
This method works by assuming your implication is not true, then deriving a contradiction. Recall that if p is false then p⟹q is always true, thus the only way our implication can be false is if p is true and q is false.
In practice then, we assume our premise is true but our conclusion is false and use this to derive a contradiction: either a violation of a law or a previously established result. Having derived the contradiction you can then conclude that your assumption (that p⟹q is false) was false and so the implication is true.
e.g.
Proposition: If x+x=x then x=0
Proof:
- Assume x+x=x and x=0.
- Then 2x=x and since x=0 we can divide both sides by x to get 2=1 which is a contradiction.
- Our assumption that the implication “If x+x=x then x=0” is false is itself false, therefore the original implication is proven to be true. ■
A proof is trivial if the statement q in the implication p⟹q is true regardless of the truth value of p.
e.g.
Prove A={}⟹A is a subset of A∪B for any set B.
If the statement p in the implication p⟹q is false then the implication is always true.
e.g.
A is a proper subset of A⟹A is a proper subset of A∩B for any set B, where the containments here are strict.
Some implications come in the form, p1∨p2∨...∨pn⟹q. Often these cases will be derived in the course of the proof. In this case you must prove that EACH of the separate implications, pi⟹q is true.
The statement P⟺Q is equivalent to the the two statements:
Hence, P⟺Q can be proved by proving the two implications.
e.g.
Proposition: “P⟺Q”
Proof: First, we show P⟹Q Use any of the types of proof above to prove this.
Finally, we show Q⟹P Use any of the types of proof above to prove this.
This proves the proposition because P⟺Q=(P⟹Q)∧(Q⟹P)■
To prove P⟺Q is true, prove P is equivalent to a second statement which is equivalent to a third statement and so forth until you reach Q.
This method can lead to short & elegant proofs, but it requires more ingenuity than the first.
e.g.
Proposition: The standard deviation of a sequence of values x1, … , xn is zero iff all the values are equal to the mean (xˉ).
Proof: We construct a chain of “iff” implications, starting with the statement that the standard deviation is zero:
n(x1−xˉ)2+(x2−xˉ)2+...+(xn−xˉ)2=0Now, since zero is the only number whose square root is zero, the equation above holds iff: (x1−xˉ)2+(x2−xˉ)2+...+(xn−xˉ)2=0
Squares of real numbers are always non-negative, so every term on the left-hand side of the equation above is non-negative. This means the above equation holds iff:
Every term on the left-hand side of the equation is zero.
But a term (xi−xˉ)2 is zero iff xi=xˉ, so the above statement is true iff: Every xi equals the mean (xˉ) ■
The same rigorous thinking needed for proofs is essential in the design of critical computer systems. When algorithms and protocols only "mostly work" due to reliance on hand-waving arguments, the results can range from problematic to catastrophic