Salta al contenuto
Note per Studenti Logic and Proof Techniques Report

Logic and Proof Techniques

In questa pagina 7

Mathematics is made of statements and of arguments that lead from one statement to another. Logic is the grammar of those arguments: it says how statements are written with symbols, when they are true and how they are negated. Everything that follows in the course (sets, supremum, limits) is written in this language. Related notes: Sets and Set OperationsWays of describing a set, subsets and equality, the power set, finite and infinite sets, union, intersection, difference, complement, De Morgan laws and the Cartesian product.Sets and Set Operations → (set operations are logic "seen through sets") and Induction, Sums and the Binomial TheoremThe principle of induction with its proof, summation notation and its properties, Gauss and geometric sums, factorials, binomial coefficients, Pascal's triangle and Newton's binomial theorem.Induction, Sums and the Binomial Theorem → (a fourth proof technique, for statements about all n∈Nn \in \mathbb{N}).

Propositions

A proposition is a statement that is either true (T) or false (F), with nothing in between. They are denoted by letters such as pp, qq.

Sentence Proposition? Value
"3>23 > 2" yes T
"77 is even" yes F
"x2≤4x^2 \le 4" no: depends on xx -
"What time is it?" no (a question) -

A statement containing a free variable is neither true nor false until the variable is given a value: this is a predicate (see below).

Logical connectives

Symbol Read True when
¬p\neg p ("not pp") not pp pp is false
p∧qp \wedge q pp and qq both are true
p∨qp \vee q pp or qq at least one is true (possibly both)
p⇒qp \Rightarrow q pp implies qq, if pp then qq whenever pp is true, qq is true too
p⇔qp \Leftrightarrow q pp if and only if qq pp and qq are true or false together

Careful with "or". In mathematics p∨qp \vee q is true also when both are true: it is not the exclusive "or" of everyday language.

Careful with implication. p⇒qp \Rightarrow q only says: "if pp is true, then qq is true". It says nothing when pp is false ("if it rains I take the umbrella": if it does not rain, the sentence is never contradicted). So p⇒qp \Rightarrow q is false only in the case "pp true and qq false".

pp qq ¬p\neg p p∧qp \wedge q p∨qp \vee q p⇒qp \Rightarrow q p⇔qp \Leftrightarrow q
T T F T T T T
T F F F T F F
F T T F T T F
F F T F F T T

p⇔qp \Leftrightarrow q means that both p⇒qp \Rightarrow q and q⇒pq \Rightarrow p hold: to prove an "if and only if" one proves two implications.

Predicates

Definition (predicate). A predicate p(x)p(x) is a statement containing a variable xx taken from a set XX, which becomes a proposition (T or F) as soon as a value of x∈Xx \in X is chosen.

Example. X=RX = \mathbb{R}, p(x)p(x): "x2≤4x^2 \le 4". For x=1x = 1: 1≤41 \le 4, so p(1)p(1) is T. For x=3x = 3: 9≤49 \le 4 is false, so p(3)p(3) is F. For x=−2x = -2: 4≤44 \le 4, so p(−2)p(-2) is T.

Two predicates are equivalent if they are true for exactly the same xx: for instance x2≤4  ⟺  −2≤x≤2x^2 \le 4 \iff -2 \le x \le 2 (indeed x2−4≤0  ⟺  (x−2)(x+2)≤0x^2 - 4 \le 0 \iff (x-2)(x+2) \le 0, values between the roots).

Quantifiers

A predicate becomes a proposition also by saying for how many xx it must hold:

Symbol Read Meaning
∀\forall for all holds for every element
∃\exists there exists holds for at least one
∄\nexists there is no holds for none
∃!\exists! there exists a unique holds for exactly one

In formulas the colon "::" reads "such that" or "we have". Golden rule: quantifier + predicate = proposition.

  • "∀x∈R:x2>0\forall x \in \mathbb{R} : x^2 > 0" is false: one counterexample suffices, x=0x = 0 (02=00^2 = 0 is not >0> 0). To disprove a "for all" one counterexample is enough; to prove it, a thousand examples are not enough, an argument valid for every xx is needed.
  • "∃x∈R:x2≤0\exists x \in \mathbb{R} : x^2 \le 0" is true (x=0x = 0). To prove an "exists" it suffices to exhibit an example.
  • "∃x∈R:∃ x−1\exists x \in \mathbb{R} : \exists\, x^{-1}" is true: x=2x = 2 has inverse 12\frac12.

The order of quantifiers matters

  • "∀x∈R ∃y∈R:y>x\forall x \in \mathbb{R}\ \exists y \in \mathbb{R} : y > x" ("every number has a larger one") is true: given xx take y=x+1y = x + 1. Here yy may depend on xx.
  • "∃y∈R ∀x∈R:y>x\exists y \in \mathbb{R}\ \forall x \in \mathbb{R} : y > x" ("there is a number larger than all") is false: no yy is larger than y+1y + 1.

This will come back in the definitions of sup, inf and limit ("for every ε>0\varepsilon > 0 there exists ...": what "exists" may depend on ε\varepsilon).

Negation

Law (negation of quantifiers). ¬(∀x∈X:p(x))=∃x∈X:¬p(x)¬(∃x∈X:q(x))=∀x∈X:¬q(x)\neg\big(\forall x \in X : p(x)\big) = \exists x \in X : \neg p(x) \qquad\qquad \neg\big(\exists x \in X : q(x)\big) = \forall x \in X : \neg q(x) The negation swaps ∀\forall with ∃\exists and negates the predicate.

"Not all students passed the exam" means "at least one did not pass" (not "none passed"!). With several quantifiers apply the rule one piece at a time, left to right: ¬(∀x ∃y:p(x,y))=∃x ∀y:¬p(x,y)\neg\big(\forall x\ \exists y : p(x,y)\big) = \exists x\ \forall y : \neg p(x,y)

Law (logical De Morgan). ¬(p∨q)=¬p∧¬q¬(p∧q)=¬p∨¬q\neg(p \vee q) = \neg p \wedge \neg q \qquad\qquad \neg(p \wedge q) = \neg p \vee \neg q

Example: ¬(x<0∨x>1)\neg(x < 0 \vee x > 1) is x≥0∧x≤1x \ge 0 \wedge x \le 1, i.e. x∈[0,1]x \in [0,1].

Law (negation of an implication). ¬(p⇒q)=p∧¬q\neg(p \Rightarrow q) = p \wedge \neg q.

Example: the negation of "if nn is a multiple of 44 then nn is even" is "nn is a multiple of 44 and not even" (impossible, so the implication is true).

Note that the negation of "x2>0x^2 > 0" is "x2≤0x^2 \le 0", not "x2<0x^2 < 0". A statement and its negation always have opposite truth values.

Proposition Value Negation Value
∀x∈R:x2>0\forall x \in \mathbb{R} : x^2 > 0 F ∃x∈R:x2≤0\exists x \in \mathbb{R} : x^2 \le 0 T (with x=0x = 0)
∃x∈R:∃ x−1\exists x \in \mathbb{R} : \exists\, x^{-1} T ∀x∈R:∄ x−1\forall x \in \mathbb{R} : \nexists\, x^{-1} F (22 has an inverse)

Hypothesis and thesis; proof techniques

A theorem almost always has the form p⇒qp \Rightarrow q: pp is the hypothesis (assumed true), qq is the thesis (to be shown). To prove it means to show, through justified steps (a definition, an already proved theorem, a computation rule), that whenever pp holds qq holds. There are three main, logically equivalent ways.

1. Direct proof

Start from pp and reach qq step by step. Wording: pp is a sufficient condition for qq.

Example. "If nn is odd then n2n^2 is odd": write n=2k+1n = 2k + 1, then n2=4k2+4k+1=2(2k2+2k)+1n^2 = 4k^2 + 4k + 1 = 2(2k^2 + 2k) + 1, which is odd.

2. Proof by contrapositive

Instead of p⇒qp \Rightarrow q prove ¬q⇒¬p\neg q \Rightarrow \neg p (if the thesis is false, then the hypothesis is false). They are equivalent: both are false exactly in the case "pp true, qq false".

pp qq p⇒qp \Rightarrow q ¬q\neg q ¬p\neg p ¬q⇒¬p\neg q \Rightarrow \neg p
T T T F F T
T F F T F F
F T T F T T
F F T T T T

Wording: qq is a necessary condition for pp. "If it rains the street is wet" is equivalent to "if the street is not wet it does not rain", but not to "if the street is wet it rains" (that is the converse q⇒pq \Rightarrow p, a different statement). Every theorem gives two: from "nn odd ⇒\Rightarrow n2n^2 odd" we get "n2n^2 even ⇒\Rightarrow nn even", which is what is needed to show that 2\sqrt 2 is irrational.

3. Proof by contradiction

Assume the hypothesis true and the thesis false (p∧¬qp \wedge \neg q, the only case where p⇒qp \Rightarrow q fails) and reason until a contradiction is reached (something impossible, e.g. a statement both true and false). Then that case cannot occur, so the implication is true.

Example. "c2=2⇒c∉Qc^2 = 2 \Rightarrow c \notin \mathbb{Q}": suppose c2=2c^2 = 2 and c=mn∈Qc = \frac mn \in \mathbb{Q} in lowest terms; then m2=2n2m^2 = 2n^2, so m2m^2 is even, hence mm is even (contrapositive above), m=2hm = 2h, so 4h2=2n24h^2 = 2n^2, n2=2h2n^2 = 2h^2 and nn is even too: contradiction with m,nm, n coprime.

How to choose

Situation Usual choice
the hypothesis gives a formula to compute with (e.g. n=2k+1n = 2k+1) direct
the thesis is "negative" (∉\notin, ≠\ne, "does not exist") contradiction
negating the thesis gives more usable information than the hypothesis contrapositive
statement "for all n∈Nn \in \mathbb{N}" Induction, Sums and the Binomial TheoremThe principle of induction with its proof, summation notation and its properties, Gauss and geometric sums, factorials, binomial coefficients, Pascal's triangle and Newton's binomial theorem.Induction, Sums and the Binomial Theorem →

Numerical examples do not prove anything for all cases: reason on a generic element (n=2k+1n = 2k+1 with kk arbitrary).

Common mistakes

  • Negating "for all" with "for none"; negating >> with << (the opposite of a>ba > b is a≤ba \le b).
  • Proving a "for all" with examples; swapping the order of quantifiers.
  • Reading p⇒qp \Rightarrow q as q⇒pq \Rightarrow p: "multiple of 44 implies even" is true, "even implies multiple of 44" is false (n=2n = 2).
  • Confusing the contrapositive (¬q⇒¬p\neg q \Rightarrow \neg p, equivalent) with ¬p⇒¬q\neg p \Rightarrow \neg q (not equivalent).
  • In a proof by contradiction, negating the thesis incorrectly or forgetting to say where the contradiction lies.

Versione ripasso

A proposition is true (T) or false (F). A predicate p(x)p(x) contains a variable and becomes a proposition when xx is chosen or a quantifier is added. Example: "x2≤4x^2 \le 4" is T for x=1x = 1, F for x=3x = 3, equivalent to −2≤x≤2-2 \le x \le 2.

pp qq ¬p\neg p p∧qp \wedge q p∨qp \vee q p⇒qp \Rightarrow q p⇔qp \Leftrightarrow q
T T F T T T T
T F F F T F F
F T T F T T F
F F T F F T T
  • ∨\vee is true also when both are true. p⇒qp \Rightarrow q is false only when pp is true and qq false. p⇔qp \Leftrightarrow q is proved with two implications.
  • ∀\forall: disprove with one counterexample, prove with an argument for every xx. ∃\exists: prove with one example.
  • Order matters: "∀x ∃y:y>x\forall x\ \exists y : y > x" is true (y=x+1y = x + 1), "∃y ∀x:y>x\exists y\ \forall x : y > x" is false. This is the order in the definition of limit.

Negations. ¬(∀x:p(x))=∃x:¬p(x)¬(∃x:q(x))=∀x:¬q(x)\neg(\forall x : p(x)) = \exists x : \neg p(x) \qquad \neg(\exists x : q(x)) = \forall x : \neg q(x) ¬(p∨q)=¬p∧¬q¬(p∧q)=¬p∨¬q¬(p⇒q)=p∧¬q\neg(p \vee q) = \neg p \wedge \neg q \qquad \neg(p \wedge q) = \neg p \vee \neg q \qquad \neg(p \Rightarrow q) = p \wedge \neg q Negation of x2>0x^2 > 0 is x2≤0x^2 \le 0. With several quantifiers negate one at a time: ¬(∀x ∃y:p)=∃x ∀y:¬p\neg(\forall x\,\exists y : p) = \exists x\,\forall y : \neg p.

Proof techniques for p⇒qp \Rightarrow q (pp hypothesis, qq thesis):

  1. Direct: from pp reach qq. (nn odd, n=2k+1n = 2k+1, n2=2(2k2+2k)+1n^2 = 2(2k^2+2k)+1 odd.) pp is sufficient conditionknowing p is enough to get q for qq.
  2. Contrapositive: prove ¬q⇒¬p\neg q \Rightarrow \neg p, equivalent to the original. qq is necessary conditionwithout q there cannot be p for pp. Gives for free: n2n^2 even ⇒\Rightarrow nn even.
  3. Contradiction: assume p∧¬qp \wedge \neg q and reach an impossibility. Used when the thesis is negative (∉\notin, ≠\ne), e.g. c2=2⇒c∉Qc^2 = 2 \Rightarrow c \notin \mathbb{Q}.
  4. For "for all n∈Nn \in \mathbb{N}": Induction, Sums and the Binomial TheoremThe principle of induction with its proof, summation notation and its properties, Gauss and geometric sums, factorials, binomial coefficients, Pascal's triangle and Newton's binomial theorem.Induction, Sums and the Binomial Theorem →.

Mistakes: negating "for all" with "for none"; a>ba > b negated as a<ba < b; proving the converse instead; examples as proofs; swapping quantifiers. The set operations mirror these rules: Sets and Set OperationsWays of describing a set, subsets and equality, the power set, finite and infinite sets, union, intersection, difference, complement, De Morgan laws and the Cartesian product.Sets and Set Operations →.

Teoria collegata