Discrete Structures · Unit 3 · 6 hrs
Logic and Proof Methods
Exam-focused notes for Logic and Proof Methods (Discrete Structures, CSC165): what the TU syllabus asks and how it has actually been tested, with 14 solved past questions from this unit.
Logic and Proof Methods in short
This chapter develops mathematical logic, the formal language for reasoning that underlies circuit design, program verification and every proof written afterward: propositions and their connectives, quantified statements over predicates, valid rules of inference, and the standard techniques for writing a correct proof.
What this unit covers
- Logic
- Propositional Logic
- Propositional Equivalences
- Predicates and Quantifiers
- Negation of Quantified Statements
- Proof of quantified statements
- Nested Quantifiers
- Rules of Inferences
- Proof Methods
- Basic Terminologies
- Proof Methods (Direct Proof, Indirect Proof, Proof by Contradiction, Proof By Contraposition, Exhaustive Proofs and Proof by Cases)
- Mistakes in Proof
Rules of Inferences
2081 · 10 marks
List any four rules of inference. Using direct and indirect proof show that, for any real number $x$, if $x^3 - 7x^2 + x - 7 = 0$, then $x = 7$ [10]
Show solved answerHide answer
Rules of Inference and Proof Techniques
Part 1: Four Rules of Inference
| Rule of Inference | Form | Name |
|---|---|---|
| 1 | p, p→q ∴ q | Modus Ponens |
| 2 | ¬q, p→q ∴ ¬p | Modus Tollens |
| 3 | p→q, q→r ∴ p→r | Hypothetical Syllogism |
| 4 | p∨q, ¬p ∴ q | Disjunctive Syllogism |
Part 2: Proof of the Statement
Theorem: For any real number x, if x³ - 7x² + x - 7 = 0, then x = 7.
Note: The converse of this statement is NOT true in general (x = 7 gives 343 - 343 + 7 - 7 = 0 ✓, but x = i and x = -i also satisfy the equation). The correct interpretation for this exam is to prove: if x is a real number satisfying x³ - 7x² + x - 7 = 0, then x = 7 (since the other roots i and -i are not real).
Let:
- p: x³ - 7x² + x - 7 = 0
- q: x = 7
Method 1: Direct Proof (Proving p → q)
Assume p is true, i.e., assume:
$$x^3 - 7x^2 + x - 7 = 0$$
Step 1: Factor the left-hand side by grouping:
$$x^3 - 7x^2 + x - 7 = 0$$
$$x^2(x - 7) + 1(x - 7) = 0$$
Step 2: Factor out the common term (x - 7):
$$(x^2 + 1)(x - 7) = 0$$
Step 3: Apply the Zero Product Property. Either:
$$x^2 + 1 = 0 \quad \text{or} \quad x - 7 = 0$$
Step 4: Analyze each case:
- From x² + 1 = 0: x² = -1, which has no real solution (since x² ≥ 0 for all real x).
- From x - 7 = 0: x = 7 ✓
Step 5: Since x is a real number, the only valid solution is x = 7.
Therefore, if x³ - 7x² + x - 7 = 0, then x = 7. [Direct Proof Complete] ∎
Method 2: Indirect Proof (Proof by Contradiction, Proving p → q)
In indirect proof, we assume p is true and q is false, and derive a contradiction.
Assume:
- p is true: x³ - 7x² + x - 7 = 0
- q is false: x ≠ 7 (i.e., x is a real number and x ≠ 7)
Step 1: Factor the equation as before:
$$x^3 - 7x^2 + x - 7 = 0$$
$$x^2(x - 7) + 1(x - 7) = 0$$
$$(x^2 + 1)(x - 7) = 0$$
Step 2: Since we assumed x ≠ 7, we have (x - 7) ≠ 0.
Therefore, for the product to equal zero, we must have:
$$x^2 + 1 = 0$$
$$x^2 = -1$$
Step 3: But x is a real number, so x² ≥ 0 for all real x.
This means x² = -1 is impossible for any real number x.
Step 4: This is a contradiction -- we assumed x is real but arrived at x² = -1, which has no real solution.
Step 5: Therefore, our assumption that x ≠ 7 must be false.
Hence, x = 7 must be true.
[Indirect Proof Complete] ∎
Summary
| Method | Approach | Conclusion |
|---|---|---|
| Direct Proof | Assume p, derive q through factoring | x = 7 follows directly |
| Indirect Proof | Assume p and ¬q, derive contradiction | ¬q leads to x² = -1, impossible for real x |
Both methods confirm: For any real number x, if x³ - 7x² + x - 7 = 0, then x = 7.
2079 · 5 marks
Give the premise 'If it rains or strike holds then the exam will be cancelled. If it doesn't rain then it will be sunny day. The exam was not cancelled. Show that it was sunny day'. [5]
2078 · 5 marks
Define proposition. Consider the argument 'John, a student in this class knows how to write program in C. Everyone who knows how to write program in C can get a high paying job. Therefore, someone in this class can get high paying job'. Now, explain which rules of inferences are used for each step. [5]
Predicates and Quantifiers
2080 · 5 marks
Express the following sentences using quantifier. 1) Not all people are loyal. 2)Everybody loves somebody. 3). Someone has passed the exam 4). Aquatic animals can't live without water 5). Some subjects are not interesting. [5]
2079 · 5 marks
List any one example of tautology. Represent the following sentences into predicate logic. a. Not all employees are loyal. b. All students having good attitude are lovable. [5]
2078 · 10 marks
State division and remainder algorithm. Suppose that the domain of the propositional function P(x) consists of the integer 0, 1, 2, 3 and 4. Write out each of the following propositions using disjunctions, conjunctions and negations. a. ∃x P(x)b. ∀x P(x)c. ∃x ¬P(x)d. ∀x ¬P(x)e. ¬∃x P(x)f. ¬∀x P(x)\text{a. } \exists x , P(x) \quad \text{b. } \forall x , P(x) \quad \text{c. } \exists x , \neg P(x) \quad \text{d. } \forall x , \neg P(x) \quad \text{e. } \neg \exists x , P(x) \quad \text{f. } \neg \forall x , P(x)a. ∃xP(x)b. ∀xP(x)c. ∃x¬P(x)d. ∀x¬P(x)e. ¬∃xP(x)f. ¬∀xP(x)[10]
Show solved answerHide answer
Division and Remainder Algorithm + Quantifier Expansion
Part 1: Division and Remainder Algorithm (The Division Algorithm)
Statement
Division Algorithm: Let a be an integer and d a positive integer. Then there exist unique integers q and r with 0 ≤ r < d such that:
a = d·q + r
Where:
- d is called the divisor
- a is called the dividend
- q is called the quotient → written as
q = a div d - r is called the remainder → written as
r = a mod d
Procedure (div-mod algorithm from notes)
procedure div-mod(a ∈ Z, d ∈ Z⁺)
q := 0
r := |a|
while r ≥ d begin
r := r - d
q := q + 1
end
if a < 0 and r > 0 then
q := -(q + 1)
r := d - r
return q, r
Working principle: When a is positive, we subtract d from a repeatedly until what remains is less than d. The number of subtractions performed is the quotient q, and what remains is the remainder r.
Example
What is the quotient and remainder when 101 is divided by 11?
101 = 11 × 9 + 2
So: q = 101 div 11 = 9 and r = 101 mod 11 = 2
Part 2: Expanding Quantified Propositions
Given: Domain of P(x) = {0, 1, 2, 3, 4}
The key rules used are:
| Quantifier | Expansion Rule |
|---|---|
| ∃x P(x) | P(0) ∨ P(1) ∨ P(2) ∨ P(3) ∨ P(4) |
| ∀x P(x) | P(0) ∧ P(1) ∧ P(2) ∧ P(3) ∧ P(4) |
a. ∃x P(x)
"There exists at least one x in the domain such that P(x) is true."
$$\exists x, P(x) \equiv P(0) \lor P(1) \lor P(2) \lor P(3) \lor P(4)$$
b. ∀x P(x)
"P(x) is true for every x in the domain."
$$\forall x, P(x) \equiv P(0) \land P(1) \land P(2) \land P(3) \land P(4)$$
c. ∃x ¬P(x)
"There exists at least one x for which P(x) is false."
$$\exists x, \neg P(x) \equiv \neg P(0) \lor \neg P(1) \lor \neg P(2) \lor \neg P(3) \lor \neg P(4)$$
d. ∀x ¬P(x)
"P(x) is false for every x in the domain."
$$\forall x, \neg P(x) \equiv \neg P(0) \land \neg P(1) \land \neg P(2) \land \neg P(3) \land \neg P(4)$$
e. ¬∃x P(x)
"There is no x for which P(x) is true."
By De Morgan's Law for quantifiers: ¬∃x P(x) ≡ ∀x ¬P(x)
$$\neg \exists x, P(x) \equiv \neg P(0) \land \neg P(1) \land \neg P(2) \land \neg P(3) \land \neg P(4)$$
Note: This is logically equivalent to part (d).
f. ¬∀x P(x)
"It is not the case that P(x) is true for all x."
By De Morgan's Law for quantifiers: ¬∀x P(x) ≡ ∃x ¬P(x)
$$\neg \forall x, P(x) \equiv \neg P(0) \lor \neg P(1) \lor \neg P(2) \lor \neg P(3) \lor \neg P(4)$$
Note: This is logically equivalent to part (c).
Summary Table
| Proposition | Expanded Form |
|---|---|
| ∃x P(x) | P(0) ∨ P(1) ∨ P(2) ∨ P(3) ∨ P(4) |
| ∀x P(x) | P(0) ∧ P(1) ∧ P(2) ∧ P(3) ∧ P(4) |
| ∃x ¬P(x) | ¬P(0) ∨ ¬P(1) ∨ ¬P(2) ∨ ¬P(3) ∨ ¬P(4) |
| ∀x ¬P(x) | ¬P(0) ∧ ¬P(1) ∧ ¬P(2) ∧ ¬P(3) ∧ ¬P(4) |
| ¬∃x P(x) | ¬P(0) ∧ ¬P(1) ∧ ¬P(2) ∧ ¬P(3) ∧ ¬P(4) |
| ¬∀x P(x) | ¬P(0) ∨ ¬P(1) ∨ ¬P(2) ∨ ¬P(3) ∨ ¬P(4) |
Conclusion
Over a finite domain a quantifier is only a compact way of writing a long connective: the existential quantifier unfolds into a disjunction and the universal quantifier unfolds into a conjunction, one term for each element of the domain. The two De Morgan laws for quantifiers, $\neg \exists x, P(x) \equiv \forall x, \neg P(x)$ and $\neg \forall x, P(x) \equiv \exists x, \neg P(x)$, are visible directly in the table above, since (e) matches (d) and (f) matches (c). The division algorithm plays the same role for integers: it guarantees that for any integer $a$ and any positive divisor $d$ the pair $(q, r)$ with $a = dq + r$ and $0 \le r < d$ exists and is unique, which is what makes div and mod well defined operations.
Proof Methods
2080 · 5 marks
What is proof by contradiction? Give a proof by contradiction to show that if 3n+2 is odd then n is odd. [5]
Show solved answerHide answer
Proof by Contradiction
Definition
Proof by contradiction is a method of mathematical proof in which we assume that the statement to be proved is false, and then show that this assumption leads to a logical contradiction (an impossibility). Since the assumption leads to a contradiction, the original statement must be true.
The general structure is:
- Assume the negation of what we want to prove.
- Use logical reasoning to derive a contradiction.
- Conclude that the original statement is true.
Theorem to Prove
If 3n + 2 is odd, then n is odd.
Proof
Step 1: Identify the structure
- Hypothesis (p): 3n + 2 is odd
- Conclusion (q): n is odd
- We want to prove: p → q
Step 2: Assume the negation of the conclusion
For proof by contradiction, we assume:
- 3n + 2 is odd (hypothesis holds)
- n is NOT odd, i.e., n is even (negation of conclusion)
Step 3: Use the assumption
Since n is even, by definition of even integers, we can write:
$$n = 2k \quad \text{for some integer } k$$
Step 4: Substitute into 3n + 2
$$3n + 2 = 3(2k) + 2 = 6k + 2 = 2(3k + 1)$$
Step 5: Analyze the result
Since $3k + 1$ is an integer, the expression $2(3k + 1)$ is of the form $2m$ where $m = 3k + 1$.
By definition of even numbers, $3n + 2$ is even.
Step 6: Identify the contradiction
We assumed that 3n + 2 is odd, but our derivation shows that 3n + 2 is even.
This is a contradiction because a number cannot be both odd and even at the same time.
Step 7: Conclusion
Since assuming "n is even" leads to a contradiction, our assumption must be false. Therefore:
$$\boxed{n \text{ is odd}}$$
This completes the proof by contradiction. $\blacksquare$
2079 · 5 marks
Prove that 'If the product of two integers a and b is even then either a is even or b is even' using condition method. [5]
2078 · 5 marks
Prove that if n is positive integer, then n is odd if and only if 5n + 6 is odd. [5]
2075 · 5 marks
Prove that the product xy is odd if and only if both x and y are odd integers. [5]
2080.1 · 5 marks
What is direct proof? Give a direct proof that if m and n are both perfect squares, then mn is also a perfect square. [5]
Show solved answerHide answer
Direct Proof: Product of Two Perfect Squares is a Perfect Square
Definition: Direct Proof
A direct proof is a method of proving a statement of the form "if P then Q" by assuming that P is true and then, using definitions, axioms, theorems, and logical reasoning step by step, showing that Q must also be true.
In other words, we start from the hypothesis and proceed forward through a chain of logical deductions until we reach the conclusion.
Definition: Perfect Square
An integer $n$ is called a perfect square if there exists an integer $k$ such that: $$n = k^2$$
Examples: $1, 4, 9, 16, 25, \ldots$ are perfect squares.
Theorem
If $m$ and $n$ are both perfect squares, then $mn$ is also a perfect square.
Direct Proof
Assume (hypothesis) that $m$ and $n$ are both perfect squares.
Step 1: Since $m$ is a perfect square, by definition there exists an integer $a$ such that: $$m = a^2$$
Step 2: Since $n$ is a perfect square, by definition there exists an integer $b$ such that: $$n = b^2$$
Step 3: Compute the product $mn$: $$mn = a^2 \cdot b^2$$
Step 4: Using the properties of exponents and multiplication: $$mn = a^2 \cdot b^2 = (ab)^2$$
Step 5: Let $c = ab$. Since $a$ and $b$ are integers, their product $c = ab$ is also an integer.
Step 6: Therefore: $$mn = c^2$$
where $c$ is an integer.
Conclusion: By the definition of a perfect square, $mn$ is a perfect square. $\blacksquare$
Summary Table
| Step | Statement | Reason |
|---|---|---|
| 1 | $m = a^2$ for some integer $a$ | $m$ is a perfect square (hypothesis) |
| 2 | $n = b^2$ for some integer $b$ | $n$ is a perfect square (hypothesis) |
| 3 | $mn = a^2 b^2$ | Substitution |
| 4 | $mn = (ab)^2$ | Laws of exponents |
| 5 | Let $c = ab \in \mathbb{Z}$ | Product of integers is an integer |
| 6 | $mn = c^2$ | Definition of perfect square satisfied |
Nested Quantifiers
2076 · 5 marks
All over smart people are stupid. Children of stupid people are naughty. John is a children of Jane. Jane is over smart. Represent these statements in FOPL and prove that John is naughty. [5]
Propositional Logic
2075 · 5 marks
Let A = 'Aldo is Italian' and B = 'Bob is English'. Formalize the following sentences into proposition.a. Aldo isn't Italian.b. Aldo is Italian while Bob is English.c. If Aldo is Italian then Bob is not English.d. Aldo is Italian or if Aldo isn't Italian then Bob is English.e. Either Aldo is Italian and Bob is English, or neither Aldo is Italian nor is Bob English. [5]
Propositional Equivalences
2080.1 · 5 marks
Give an example of tautology and contradiction. Show that implication and contrapositive are equivalence. [5]
Make Unit 3 stick
Practice CSC165 with flashcards & quizzes