Discrete Mathematics: Mathematical Logic and Methods of Proof
Propositions and Logical Connectives
Definition of Proposition
A proposition is a declarative sentence (an assertion) which is either true or false, but not both.
Example 1.1 – Propositions
(a) "3 is a prime number." (true)
(b) "Warangal is the capital of India." (false)
(c) "." (true)
(d) "6 divides 13." (false)
Key Point / Common Mistake
Not every sentence is a proposition! The following sentences are not propositions:
(a) "Read this carefully." – an order, not true/false.
(b) "Are you attending this class?" – a question.
(c) "." – an open sentence; truth depends on unknown .
(d) "." – an open sentence; truth depends on .
A sentence only qualifies as a proposition once it has a fixed, well-defined truth value.
Truth Value and Propositional Variables
Definition: Truth Value
If a proposition is true, its truth value is denoted or . If false, its truth value is denoted or .
Notation:
(i) Throughout, and stand for true and false.
(ii) denotes a proposition that is always true; denotes one that is always false.
Definition: Propositional Variables
Variables that represent propositions (with unspecified truth value) are called propositional variables, usually written (some references use ).
Example:
: "3 is a prime number."
: "."
: "6 divides 11."
Exercises 1
Which of the following are propositions? For each proposition, give its truth value.
(a) "Every prime number is odd."
(b) "Please close the door."
(c) "."
(d) "What time is it?"
(e) "."
(f) "Hyderabad is the capital of Telangana."
Write two propositions of your own – one true and one false.
Explain, in one line, why " is an even number" is not a proposition, while "4 is an even number" is.
Logical Connectives
Propositions built from existing propositions using logical connectives are called compound propositions:
Negation: (NOT)
Conjunction: (AND)
Disjunction: (OR)
Implication: (if)
Biconditional: (if and only if)
Exclusive OR: (XOR)
Definition: Negation,
Negation is a unary operator (it acts on a single proposition). If is a proposition, its negation is denoted (also written or ), read "not ".
1 | 0 |
0 | 1 |
Example 1.2 – Negation
: "4 is a prime number." (0)
: "4 is not a prime number." (1)
Definition: Conjunction,
Conjunction is a binary operator. If are propositions, their conjunction is read " and ", and is true Leicester/exactly when both and are true.
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
Example 1.3 – Conjunction
: "4 is a prime number."
: "."
: "4 is a prime number and ." – false (since is false).
Definition: Disjunction,
Disjunction is a binary operator. If are propositions, their disjunction is read " or ", and is true whenever at least one of is true.
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |
Example 1.4 – Disjunction
: "4 is a prime number."
: "."
: "4 is a prime number or ." – true (since is true).
Key Point / Common Mistake
needs both sides true (only row 1,1 gives 1).
needs at least one side true (only row 0,0 gives 0).
They agree everywhere except when exactly one of is true and one is false – then says false, says true.
Exercises
Let : "It is raining," : "It is cold."
Write , , and in words.
Construct the truth table for
Construct the truth table for
If is true and is false, find the truth values of , , and p \vee q$.\n5. Translate into symbols: "It is not raining, but it is cold."\n\n# Implication and Equivalence\n\n## Implication (Conditional Statement)\n\n### Definition: Implication, \rightarrow\n\n- If p, qp \rightarrow qpq".\n- In p \rightarrow qpq is the **conclusion** (consequence).\n\n| pqp \rightarrow q |\n| :---: | :---: | :---: |\n| 0 | 0 | 1 |\n| 0 | 1 | 1 |\n| 1 | 0 | 0 |\n| 1 | 1 | 1 |\n\n- p \rightarrow qpq is false – a true hypothesis leading to a false conclusion.\n\n### Example 2.1 – Implication\n\n- "If Warangal is the capital of Telangana, then New Delhi is not the capital of India." – **true** (1), because the hypothesis "Warangal is the capital of Telangana" is false, and 0 \rightarrow q is always true.\n\n### Key Point / Common Mistake\n\n- p \rightarrow q can be read in many equivalent ways – all mean exactly the same thing:\n - if pq\n - pq\n - pq\n - pq\n - qp\n - qp\n - qp\n - qp\n- **Common mistake:** "pqqp" say the *same* thing – students often confuse which variable is "necessary" and which is "sufficient".\n\n### Definition: Converse, Contrapositive, Inverse\n\n- From p \rightarrow q we can form three new conditionals:\n - **Converse:** q \rightarrow p\n - **Contrapositive:** eg q \rightarrow eg p\n - **Inverse:** eg p \rightarrow eg q\n- **Note:** p \rightarrow q eg q \rightarrow eg pq \rightarrow p eg p \rightarrow eg q *always* have the same truth value.\n\n### Example 2.2 – Converse, Contrapositive, Inverse\n\nLet pqp \rightarrow q:\n- **Converse** (q \rightarrow p): "If I excel in life, then I study well."\n- **Contrapositive** ( eg q \rightarrow eg p): "If I do not excel in life, then I do not study well."\n- **Inverse** ( eg p \rightarrow eg q): "If I do not study well, then I do not excel in life."\n\n## Biconditional (Equivalence)\n\n### Definition: Biconditional, \leftrightarrow\n\n- If p, qp \leftrightarrow qpqpq").\n\n| pqp \leftrightarrow q |\n| :---: | :---: | :---: |\n| 0 | 0 | 1 |\n| 0 | 1 | 0 |\n| 1 | 0 | 0 |\n| 1 | 1 | 1 |\n\n- p \leftrightarrow qpq have the **same** truth value.\n- Equivalent readings: "pqpqpqpqqp".\n\n### Key Point / Common Mistake\n\n- **Fact:** p \leftrightarrow q(p \rightarrow q) \wedge (q \rightarrow p) always have the same truth value – "iff" really does mean "implies both ways".\n\n### Exercises\n\nLet pqr : "you get an A in this class."\n\n1. Translate into symbols: "You get an A in this class, but you do not do every exercise in the book."\n2. Translate into symbols: "To get an A in this class, it is necessary for you to get an A on the final."\n3. Translate into symbols: "Getting an A on the final and doing every exercise in the book is sufficient for getting an A in this class."\n4. Translate into symbols: "You will get an A in this class if and only if you either do every exercise in the book or get an A on the final."\n5. Now let pqr : "X is inside the room." Write an English sentence for each:\n - (a) p \rightarrow eg q\n - (b) r \rightarrow q\n - (c) (r \wedge q) \rightarrow eg p\n - (d) eg(r \wedge q)\n6. Write the converse, contrapositive, and inverse of: "If nn is divisible by 3."\n\n# Truth Tables and Logical Equivalences\n\n## Precedence of Logical Operators\n\n- When a compound proposition uses several connectives without brackets, the order of operations decides how to evaluate it:\n\n| Operator | Precedence |\n| :---: | :---: |\n| eg | 1 (highest) |\n| \wedge | 2 |\n| \vee | 3 |\n| \rightarrow | 4 |\n| \leftrightarrow | 5 (lowest) |\n\n### Key Point / Common Mistake\n\n- p \rightarrow (q \rightarrow r)(p \rightarrow q) \rightarrow r\rightarrow is **not** associative. Always keep brackets around nested implications; never drop them "for short".\n\n## Constructing Truth Tables for Compound Propositions\n\n- To build a truth table for a compound proposition: list all combinations of truth values for the variables (2^nn variables), then fill in intermediate columns from the inside out.\n\n### Example 3.1 – Truth Table of (p \rightarrow q) \wedge ( eg p \rightarrow q)\n\n| pqp \rightarrow q eg p eg p \rightarrow q(p \rightarrow q) \wedge ( eg p \rightarrow q) |\n| :---: | :---: | :---: | :---: | :---: | :---: |\n| 0 | 0 | 1 | 1 | 0 | 0 |\n| 0 | 1 | 1 | 1 | 1 | 1 |\n| 1 | 0 | 0 | 0 | 1 | 0 |\n| 1 | 1 | 1 | 0 | 1 | 1 |\n\n- Notice the final column equals the column for qq.\n\n### Example 3.2 – Truth Table of (p \leftrightarrow q) \vee ( eg q \leftrightarrow r)\n\n| pqrp \leftrightarrow q eg q eg q \leftrightarrow r(p \leftrightarrow q) \vee ( eg q \leftrightarrow r) |\n| :---: | :---: | :---: | :---: | :---: | :---: | :---: |\n| 0 | 0 | 0 | 1 | 1 | 0 | 1 |\n| 0 | 0 | 1 | 1 | 1 | 1 | 1 |\n| 0 | 1 | 0 | 0 | 0 | 1 | 1 |\n| 0 | 1 | 1 | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 1 | 0 | 0 |\n| 1 | 0 | 1 | 0 | 1 | 1 | 1 |\n| 1 | 1 | 0 | 1 | 0 | 1 | 1 |\n| 1 | 1 | 1 | 1 | 0 | 0 | 1 |\n\n### Exercises – Building Truth Tables\n\nConstruct the truth table for each compound proposition:\n- (i) p \rightarrow ( eg q \vee r)\n- (ii) eg p \rightarrow (q \rightarrow r)\n- (iii) (p \rightarrow q) \vee ( eg p \rightarrow r)\n- (iv) (p \rightarrow q) \wedge ( eg p \rightarrow r)\n- (v) ( eg p \leftrightarrow eg q) \leftrightarrow (q \leftrightarrow r)\n- (vi) ((p \wedge q) \vee eg r) \leftrightarrow p\n\n## Tautology, Contradiction, Contingency\n\n### Definition: Tautology, Contradiction, Contingency\n\n- A compound proposition that is **true in every row** of its truth table is a **tautology**.\n- One that is **false in every row** is a **contradiction**.\n- One that is neither – true in some rows, false in others – is a **contingency**.\n\n### Example 3.3 – Classifying Compound Propositions\n\n- **Tautologies:** p \vee eg p(p \wedge q) \rightarrow (p \vee q).\n- **Contradictions:** p \wedge eg p(p \leftrightarrow q) \wedge ( eg p \wedge q).\n- **Contingency:** (p \vee q) \rightarrow eg r – true for some assignments, false for others.\n\n## Logical Equivalence\n\n### Definition: Logical Equivalence, \equiv\n\n- Two compound propositions are **logically equivalent** if they have the *same truth table* (same truth value in every row). We write P \equiv Q.\n\n### Example 3.4 – Proving eg(p \wedge q) \equiv eg p \vee eg q – De Morgan's Law\n\n| pqp \wedge q eg(p \wedge q) eg p eg q eg p \vee eg q |\n| :---: | :---: | :---: | :---: | :---: | :---: | :---: |\n| 0 | 0 | 0 | 1 | 1 | 1 | 1 |\n| 0 | 1 | 0 | 1 | 1 | 0 | 1 |\n| 1 | 0 | 0 | 1 | 0 | 1 | 1 |\n| 1 | 1 | 1 | 0 | 0 | 0 | 0 |\n\n- Columns 4 and 7 match in every row, so eg(p \wedge q) \equiv eg p \vee eg q\blacksquare\n\n## Table of Important Logical Equivalences\n\n| Name | Equivalence |\n| :--- | :--- |\n| **Idempotent Laws** | p \wedge p \equiv pp \vee p \equiv p |\n| **Double Negation Law** | eg( eg p) \equiv p |\n| **Commutative Laws** | p \wedge q \equiv q \wedge pp \vee q \equiv q \vee p |\n| **Associative Laws** | (p \vee q) \vee r \equiv p \vee (q \vee r)(p \wedge q) \wedge r \equiv p \wedge (q \wedge r) |\n| **Distributive Laws** | p \vee (q \wedge r) \equiv (p \vee q) \wedge (p \vee r)p \wedge (q \vee r) \equiv (p \wedge q) \vee (p \wedge r) |\n| **De Morgan's Laws** | eg(p \wedge q) \equiv eg p \vee eg q eg(p \vee q) \equiv eg p \wedge eg q |\n| **Absorption Laws** | p \vee (p \wedge q) \equiv pp \wedge (p \vee q) \equiv p |\n| **Identity Laws** | p \wedge 1 \equiv pp \vee 0 \equiv p |\n| **Domination Laws** | p \wedge 0 \equiv 0p \vee 1 \equiv 1 |\n| **Negation Laws** | p \wedge eg p \equiv 0p \vee eg p \equiv 1 |\n| **Law of Implication** | p \rightarrow q \equiv eg p \vee q |\n| **Law of Contrapositive** | p \rightarrow q \equiv eg q \rightarrow eg p |\n| **Law of Exportation** | (p \wedge q) \rightarrow r \equiv p \rightarrow (q \rightarrow r) |\n| **Law of Biconditional** | p \leftrightarrow q \equiv (p \wedge q) \vee ( eg p \wedge eg q)p \leftrightarrow q \equiv (p \rightarrow q) \wedge (q \rightarrow p) |\n\n### Example 3.5 – Proving Equivalence Without a Truth Table\n\nShow that eg(p \vee ( eg p \wedge q)) \equiv eg p \wedge eg q.\n\n\begin{aligned}
eg(p \vee ( eg p \wedge q)) &\equiv eg p \wedge eg( eg p \wedge q) && \text{(De Morgan)} \ &\equiv eg p \wedge ( eg( eg p) \vee eg q) && \text{(De Morgan)} \ &\equiv eg p \wedge (p \vee eg q) && \text{(Double negation)} \ &\equiv ( eg p \wedge p) \vee ( eg p \wedge eg q) && \text{(Distributive)} \ &\equiv F \vee ( eg p \wedge eg q) && \text{(Negation law)} \ &\equiv eg p \wedge eg q && \text{(Identity law)} \end{aligned}\n\n### Example 3.6 – Simplifying a Circuit Expression\n\nSimplify (p \wedge q) \vee (p \wedge eg q) \vee ( eg p \wedge q).\n\n\begin{aligned} (p \wedge q) \vee (p \wedge eg q) \vee ( eg p \wedge q) &\equiv [p \wedge (q \vee eg q)] \vee ( eg p \wedge q) && \text{(Distributive, on first two terms)} \ &\equiv (p \wedge T) \vee ( eg p \wedge q) && \text{(Negation law)} \ &\equiv p \vee ( eg p \wedge q) && \text{(Identity law)} \ &\equiv (p \vee eg p) \wedge (p \vee q) && \text{(Distributive)} \ &\equiv T \wedge (p \vee q) && \text{(Negation law)} \ &\equiv p \vee q && \text{(Identity law)} \end{aligned}\n\n### Example 3.7 – Simplifying Using the Conditional Identity\n\nSimplify eg(p \rightarrow q) \vee (p \wedge q).\n\n\begin{aligned}
eg(p \rightarrow q) \vee (p \wedge q) &\equiv eg( eg p \vee q) \vee (p \wedge q) && \text{(Conditional identity)} \ &\equiv (p \wedge eg q) \vee (p \wedge q) && \text{(De Morgan, double negation)} \ &\equiv p \wedge ( eg q \vee q) && \text{(Distributive)} \ &\equiv p \wedge T && \text{(Negation law)} \ &\equiv p && \text{(Identity law)} \end{aligned}\n\n### Example 3.8 – Proving a Biconditional Equivalence Step by Step\n\nShow that p \leftrightarrow q \equiv (p \wedge q) \vee ( eg p \wedge eg q).\n\n\begin{aligned} p \leftrightarrow q &\equiv (p \rightarrow q) \wedge (q \rightarrow p) && \text{(Biconditional identity)} \ &\equiv ( eg p \vee q) \wedge ( eg q \vee p) && \text{(Conditional identity, twice)} \ &\equiv [( eg p \vee q) \wedge eg q] \vee [( eg p \vee q) \wedge p] && \text{(Distributive)} \ &\equiv [( eg p \wedge eg q) \vee (q \wedge eg q)] \vee [( eg p \wedge p) \vee (q \wedge p)] && \text{(Distributive, twice more)} \ &\equiv [( eg p \wedge eg q) \vee F] \vee [F \vee (p \wedge q)] && \text{(Negation laws)} \ &\equiv ( eg p \wedge eg q) \vee (p \wedge q) && \text{(Identity laws)} \end{aligned}\n\n### Exercises – Logical Equivalences\n\n1. Use De Morgan's laws to find the negation of: "Priya has a laptop and an internet connection."\n2. Show, using a truth table, that (p \rightarrow q) \wedge (p \rightarrow r) \equiv p \rightarrow (q \wedge r).\n3. Simplify eg(p \leftrightarrow q)\oplus.\n4. Show that (p \wedge q) \rightarrow p is a tautology, without a truth table.\n5. Determine whether p \rightarrow (q \rightarrow p) is a tautology, contradiction, or contingency.\n6. Simplify (p \vee q) \wedge ( eg p \vee q) \wedge (p \vee eg q) step by step, citing a law at each stage.\n7. Prove, using only the laws of the table above (no truth table), that p \rightarrow (q \rightarrow r) \equiv (p \wedge q) \rightarrow r.\n8. Show that eg p \vee (p \wedge q) \equiv eg p \vee q using the distributive and absorption laws.\n9. Simplify the following digital-logic expression to a minimum number of gates: (A \wedge B \wedge C) \vee (A \wedge B \wedge eg C) \vee ( eg A \wedge B \wedge C).\n\n## Tautological Implication\n\n### Definition: Tautological Implication\n\n- Let P, QP \rightarrow QPQP \implies QPQ is true).\n\n### Example 3.9 – Standard Tautological Implications\n\n- p \wedge q \implies pp \wedge q \implies q\n- p \implies p \vee qq \implies p \vee q\n- q \implies p \rightarrow qq \rightarrow (p \rightarrow q) is a tautology)\n- eg p \implies p \rightarrow q eg p \rightarrow (p \rightarrow q) is a tautology)\n\n### Exercises – Tautological Implication\n\n1. Show that eg(p \rightarrow q) \equiv p \wedge eg q$.
Show that .
Simplify using the laws above.
Simplify – what kind of proposition is it?
Show that \neg(p \vee (\neg p \wedge q)) \equiv \neg p \wedge \neg q$.\n6. Verify q \implies p \vee q eg p \implies p \rightarrow q using truth tables.\n\n# Predicate Logic: Predicates and Quantifiers\n\n## Predicate\n\n### Definition: Predicate\n\n- A **predicate** (propositional function) is a statement P(x)xx is assigned a value, or bound by a quantifier.\n\n### Example 4.1\n\n- Let P(x)x > 3P(4)P(2).\n- **Solution:** P(4)4 > 3P(2)2 > 3" is False.\n\n## Quantifiers\n\n### Definition: Universal Quantifier\n\n- The **universal quantification** of P(x)P(x)x\forall x \, P(x)P(x)x in the domain.\n\n### Definition: Existential Quantifier\n\n- The **existential quantification** of P(x)xP(x)\exists x \, P(x)P(x)x in the domain.\n\n## Negating Quantifiers (De Morgan's Laws for Quantifiers)\n\n| Negation | Equivalent Statement |\n| :--- | :--- |\n| eg \forall x \, P(x)\exists x \, eg P(x) |\n| eg \exists x \, P(x)\forall x \, eg P(x) |\n\n### Example 4.2\n\n- Negate: "Every student in this class has taken a course in calculus."\n- **Solution:** Let C(x)x\forall x \, C(x)\exists x \, eg C(x) – "There is a student in this class who has not taken calculus."\n\n### Example 4.3\n\n- Negate: \exists x \, (x^2 = 2) over the integers.\n- **Solution:** eg \exists x \, (x^2 = 2) \equiv \forall x \, (x^2 eq 2)xx^2 eq 2" (true, since 2 is not a perfect square).\n\n## Translating Statements Involving Quantifiers\n\n### Example 4.4\n\n- Translate: "Some students have visited Mexico but not Canada" using M(x)xC(x)x has visited Canada, domain: students.\n- **Solution:** \exists x \, (M(x) \wedge eg C(x))$.
Exercises
Let : " spends more than 5 hours studying daily," domain = students of your class. Express in words: (a) , (b) .
Write the negation of "All Amrita students are hardworking" using quantifiers, then in plain English.
Express "No student failed the exam" symbolically, using : failed.
Determine the truth value of and .
Nested Quantifiers
Definition: Nested Quantifiers
Nested quantifiers occur when one quantifier lies within the scope of another, e.g. . The order of quantifiers matters when they are of different types.
Example 4.5 – Order Matters!
Let : "" over the real numbers.
: "For every there is a with " – True (take ).
: "There is a single that works for every " – False (no fixed satisfies for all ).
Negating Nested Quantifiers
Apply De Morgan's rule for quantifiers repeatedly, flipping each quantifier and negating the innermost predicate.
Example 4.6
Negate .
\begin{aligned}\n\neg(\forall x \exists y \, (x + y = 1)) &\equiv \exists x \, \neg(\exists y \, (x + y = 1)) \\\n&\equiv \exists x \forall y \, \neg(x + y = 1) \\\n&\equiv \exists x \forall y \, (x + y \neq 1)\n\end{aligned}
Example 4.7
Translate: "The sum of two positive integers is always positive" and negate it.
Solution: .
Negation: – "There exist positive integers whose sum is not positive" (a false statement, but the correctly-formed negation).
Exercises – Nested Quantifiers
Let : " is the mother of ". Express in words: ; then state its truth value.
Translate "Every real number except zero has a multiplicative inverse" using nested quantifiers.
Negate fully, moving all negations inward.
Determine whether and are equivalent over the integers. Justify.
Express symbolically: "For every positive integer there exists a prime number greater than ".
Translate into nested quantifiers: "Every student has emailed at least one professor, but no professor has been emailed by every student." (Domain: students , professors ; predicate : has emailed .)
Negate the statement fully.
Rules of Inference and Natural Deduction
Inference and Inference Rules
When we reason logically, we start from things we already know (or accept) to be true, and we derive new true statements from them. This process of generating conclusions from evidence and known facts is called inference.
Definition: Inference and Inference Rules
Inference is the process of deriving new (true) conclusions from existing facts or statements.
Inference rules are templates for generating valid arguments. They are applied step by step to build a proof – a sequence of statements that leads from given premises to a desired conclusion.
Example 5.1 – Checking Equivalence by Truth Table
Recall that an implication has a converse , a contrapositive , and an inverse . Which of these four are logically equivalent to one another?
Solution: We build the truth table for all four statements:
T | T | T | T | T | T |
T | F | F | T | F | T |
F | T | T | F | T | F |
F | F | T | T | T | T |
Comparing columns: the column is identical to the column, and the column is identical to the column.
Conclusion: An implication is always logically equivalent to its contrapositive: . (Similarly, the converse is equivalent to the inverse.) The implication is not, in general, equivalent to its converse or its inverse.
Key Point / Common Mistake
This is one of the most useful facts in all of mathematics: to prove , it is sometimes easier to prove the contrapositive instead – they say exactly the same thing. (This becomes Proof by Contraposition).
Standard Rules of Inference
Each rule below has the same shape: some statements are given as true (above the line), and a new statement is guaranteed to be true as a result (below the line, marked , read "therefore").
Every rule can be checked by writing out a truth table and confirming that whenever every statement above the line is true, the statement below the line is also true.
Rule: Modus Ponens
If is true, and is true, then must be true.
Example 5.2 – Modus Ponens
Statement 1: "If I am sleepy, then I go to bed." ()
Statement 2: "I am sleepy." ()
Conclusion: "I go to bed." ()
This is valid because if is true and is true, the only row of the truth table of where is true and is true has true as well.
Rule: Modus Tollens
If is true, and is false (), then must be false ().
Example 5.3 – Modus Tollens
Statement 1: "If I am sleepy, then I go to bed." ()
Statement 2: "I do not go to bed." ()
Conclusion: "I am not sleepy." ()
Why it works: If were true, then by Modus Ponens would have to be true – but we are told is false. So cannot be true; it must be false.
Rule: Hypothetical Syllogism
If is true, and is true, then must be true. (Implications "chain together".)
Example 5.4 – Hypothetical Syllogism
Statement 1: "If you have my home key, then you can unlock my home." ()
Statement 2: "If you can unlock my home, then you can take my money." ()
Conclusion: "If you have my home key, then you can take my money." ()
Rule: Disjunctive Syllogism
If is true, and is false (), then must be true.
Example 5.5 – Disjunctive Syllogism
Statement 1: "Today is Sunday or Monday." ()
Statement 2: "Today is not Sunday." ()
Conclusion: "Today is Monday." ()
Rule: Addition
If is true, then is true, no matter what is.
Example 5.6 – Addition
Statement: "I have a vanilla ice-cream." ()
Conclusion: "I have a vanilla or a chocolate ice-cream." ()
This looks strange at first – we never said anything about chocolate! – but it is valid: if is true, then is automatically true, whatever happens to be.
Rule: Simplification
If is true, then is true (and separately, is true).
Example 5.7 – Simplification
Statement: "It is raining and it is cold." ()
Conclusion: "It is raining." () (or equally, "It is cold.")
Rule: Resolution
If is true, and is true, then must be true.
Example 5.8 – Resolution
Statement 1: "I will study or I will fail." ()
Statement 2: "I will not study, or I will sleep early." ()
Conclusion: "I will fail, or I will sleep early." ()
Natural Deduction
Normal human reasoning moves in a line: from premises, step by step, to a conclusion. Natural Deduction is the formal method in Propositional Logic that mimics exactly this natural process – and it is what mathematicians actually use when they write proofs.
Definition: Natural Deduction
A Natural Deduction proof is a sequence of well-formed formulas (statements) that:
begins with one or more given premises (fresh premises may also be added later in the proof), and
generates every new statement by applying an inference rule or a replacement rule to statements that already appear earlier in the sequence, continuing until the desired conclusion is reached.
Key Point / Common Mistake
A Natural Deduction system has just two ingredients: a set of rules, and a method for applying them. This is exactly how theorems are proved in mathematics – so every mathematical proof is an instance of Natural Deduction.
Replacement Rules
Besides inference rules, a Natural Deduction proof is also allowed to replace any statement (or part of a statement) by something logically equivalent to it. These logical equivalences are called replacement rules.
Key Point / Common Mistake
Do not confuse inference rules with replacement rules. An inference rule only works "forward", in one direction, on a whole statement. A replacement rule works in either direction, and can be applied to just a part of a longer statement, because the two sides are fully equivalent.
A Worked Natural Deduction Proof
Example 5.9 – Combining Several Rules
Given the premises , , , prove using Natural Deduction.
Solution: We build a sequence of statements, justifying each new line by a rule applied to earlier lines.
Step | Statement | Justification |
|---|---|---|
1 | Premise | |
2 | Premise | |
3 | Premise | |
4 | Hypothetical Syllogism (1, 2) | |
5 | Modus Tollens (4, 3) |
Conclusion: follows from the three premises.
Practice Questions
Name the inference rule used, and state the conclusion: "If it rains, the match is cancelled." "It rains."
Name the inference rule used, and state the conclusion: "If the alarm rings, I wake up." "I did not wake up."
Name the inference rule used, and state the conclusion: "If you study, you pass." "If you pass, you graduate."
Name the inference rule used, and state the conclusion: "I will take the bus or the train." "I will not take the bus."
Write the converse, inverse, and contrapositive of: "If a number is divisible by 4, then it is divisible by 2."
Using a truth table, verify the Disjunctive Syllogism rule.
Give the replacement rule that justifies rewriting as
Using Natural Deduction, prove from the premises , , , and . (Hint: first find , then , then – a chain of Modus Tollens steps.)
Methods of Proof: Direct Proof, Contraposition, Contradiction
Core Definitions
Theorem: A statement proved true.
Proof: A valid chain of reasoning (using axioms, definitions, and previously proved theorems) establishing the truth of a theorem.
Axiom (Postulate): A statement assumed true without proof.
Even and Odd Integers: An integer is even if for some integer . It is odd if for some integer k$.\n\n## Direct Proof\n\n- To prove p \rightarrow qpq must also be true, using definitions, axioms, and known results.\n\n### Example 6.1 – Direct Proof\n\n- **Prove:** If nn^2 is odd.\n- **Proof:** Assume nn = 2k + 1k. So:\n n^2 = (2k + 1)^2 = 4k^2 + 4k + 1 = 2(2k^2 + 2k) + 1\n Since 2k^2 + 2kn^22m + 1n^2\blacksquare\n\n## Proof by Contraposition\n\n- To prove p \rightarrow q eg q \rightarrow eg p – justified by the Law of Contrapositive.\n\n### Example 6.2 – Proof by Contraposition\n\n- **Prove:** If n^2n is even.\n- **Proof:** We prove the contrapositive: if nn^2n^2n\blacksquare\n\n### Example 6.3 – Contraposition with Quadratics\n\n- **Prove:** If n^2n is odd.\n- **Proof (by contraposition):** We prove: if nn^2n = 2kn^2 = 4k^2 = 2(2k^2)n^2n^2 \text{ odd} \implies n \text{ odd}\blacksquare\n\n## Proof by Contradiction\n\n- Assume the negation of what you want to prove, and derive a contradiction (a statement of the form r \wedge eg r).\n\n### Example 6.4 – Proof by Contradiction\n\n- **Prove:** \sqrt{2} is irrational.\n- **Proof:** Suppose, for contradiction, that \sqrt{2}\sqrt{2} = \frac{a}{b}a, b\gcd(a, b) = 1.\n Squaring both sides:\n 2 = \frac{a^2}{b^2} \implies a^2 = 2b^2\n Thus a^2aa = 2c. Then:\n 4c^2 = 2b^2 \implies b^2 = 2c^2\n so b^2bab\gcd(a, b) = 1\sqrt{2}\blacksquare\n\n### Example 6.5 – Contradiction with a Sum\n\n- **Prove:** The sum of a rational number and an irrational number is irrational.\n- **Proof:** Suppose, for contradiction, that rxr + xr = \frac{a}{b}r + x = \frac{c}{d}a, b, c, db, d eq 0. Then:\n x = (r + x) - r = \frac{c}{d} - \frac{a}{b} = \frac{cb - ad}{db}\n which is a ratio of integers, so xxr + x\blacksquare\n\n## Proof by Cases\n\n- Split the hypothesis into an exhaustive set of cases, and prove the conclusion in each case separately.\n\n### Example 6.6 – Proof by Cases\n\n- **Prove:** For every integer nn^2 \geq n$.
Proof:
Case 1 (): then n^2 \geq 0 \geq n$.\n - Case 2 (n = 1n^2 = 1 = n$.
Case 3 (): n^2 = n \cdot n \geq n \cdot 2 > n$.\n All cases give n^2 \geq n\blacksquare\n\n## Additional Solved Proofs\n\n### Example 6.7 – Direct Proof Involving Divisibility\n\n- **Prove:** If a \mid ba \mid ca \mid (b + c).\n- **Proof:** Assume a \mid ba \mid cb = akc = amk, m. Then:\n b + c = ak + am = a(k + m)\n Since k + ma \mid (b + c)\blacksquare\n\n### Exercises\n\n1. Give a direct proof that if nmnm is a perfect square.\n2. Prove by contraposition: If 3n + 2n is odd.\n3. Prove by contradiction that there is no smallest positive rational number.\n4. Give a constructive proof that there exists a positive integer that can be written as the sum of cubes of positive integers in two different ways.\n5. Prove by contradiction that there are infinitely many prime numbers. (Euclid's classical proof.)\n6. Prove: if xyx^2 + y^2 is even but not divisible by 4.\n\n# Mathematical Induction and Recursive Definitions\n\n## The Principle of Mathematical Induction\n\n- Mathematical induction is a method of proof used to establish that a statement P(n)n (or every natural number from some starting point onward).\n\n### Definition: Principle of Mathematical Induction (P.M.I.)\n\n- Let P(n)n. Suppose:\n 1. P(1) is true (or true for some fixed starting natural number), and\n 2. whenever P(k)P(k + 1)k$. Then is true for all natural numbers (from the starting point onward).
Steps to prove a statement by induction:
Basis of Induction: Show that is true (check the statement for the starting value).
Inductive Hypothesis: Assume that is true, for some natural number k$.\n 3. **Inductive Step:** Using the assumption that P(k)P(k + 1) is also true.\n If all three steps succeed, then by P.M.I., P(n)n$.
Key Point / Common Mistake
The Inductive Hypothesis is not the same as assuming what we want to prove. We are only assuming the statement holds for one particular (but arbitrary) value – we are not assuming it is true for all . The whole point of the Inductive Step is to use this single assumption to honestly derive the next case, .
Worked Examples of Induction
Example 7.1 – Sum of the First Odd Numbers
Use induction to prove that the sum of the first odd natural numbers is :
Solution: Let be the statement 1 + 3 + 5 + \dots + (2n - 1) = n^2$.\n - **Basis of Induction:** For n = 11^2 = 1P(1) is true.\n - **Inductive Hypothesis:** Assume P(k)k \in \mathbb{N}1 + 3 + 5 + \dots + (2k - 1) = k^2$.
Inductive Step: We must show is true, i.e. 1 + 3 + 5 + \dots + (2k - 1) + (2k + 1) = (k + 1)^2$.\n \text{L.H.S.} = [1 + 3 + 5 + \dots + (2k - 1)] + (2k + 1) = k^2 + (2k + 1) = (k + 1)^2 = \text{R.H.S.} \n So P(k + 1) is true.\n - **Conclusion:** By P.M.I., P(n)n \in \mathbb{N}\blacksquare\n\n### Example 7.2 – Sum of the First n Natural Numbers\n\n- Use induction to prove that for all n \in \mathbb{N},\n 1 + 2 + 3 + \dots + n = \frac{n(n + 1)}{2}\n- **Solution:** Let P(n)1 + 2 + \dots + n = \frac{n(n + 1)}{2}$.
Basis of Induction: For : L.H.S. = 1, R.H.S. = . So is true.
Inductive Hypothesis: Assume is true: 1 + 2 + \dots + k = \frac{k(k + 1)}{2}$.\n - **Inductive Step:** We show P(k + 1)1 + 2 + \dots + k + (k + 1) = \frac{(k + 1)(k + 2)}{2}$.
Conclusion: By P.M.I., for all .
Example 7.3 – A Divisibility Statement
Use induction to prove that for all , is divisible by 3.
Solution: Let be the statement: is divisible by 3.
Basis of Induction: For : , which is divisible by 3. So is true.
Inductive Hypothesis: Assume is true, i.e. for some integer m$.\n - **Inductive Step:** We show P(k + 1)2^{2(k+1)} - 1 is divisible by 3.\n 2^{2(k+1)} - 1 = 2^{2k+2} - 1 = 4 \cdot 2^{2k} - 1 = 4(2^{2k} - 1) + 4 - 1 = 4(3m) + 3 = 3(4m + 1)\n which is divisible by 3. So P(k + 1) is true.\n - **Conclusion:** By P.M.I., 2^{2n} - 1n \in \mathbb{N}\blacksquare\n\n### Example 7.4 – Another Divisibility Statement\n\n- Prove that n^3 - nn$.
Solution: Let be the statement: is divisible by 3.
Basis of Induction: For : , which is divisible by 3. So is true.
Inductive Hypothesis: Assume is true, i.e. for some integer m$.\n - **Inductive Step:** We show P(k + 1)(k + 1)^3 - (k + 1) is divisible by 3.\n (k + 1)^3 - (k + 1) = k^3 + 3k^2 + 3k + 1 - k - 1 = (k^3 - k) + 3(k^2 + k) = 3m + 3(k^2 + k) = 3(m + k^2 + k)\n So (k + 1)^3 - (k + 1)P(k + 1) is true.\n - **Conclusion:** By P.M.I., n^3 - nn \geq 1\blacksquare\n\n### Example 7.5 – Divisibility with a Different Base\n\n- Prove that 5^n - 1n$.
Solution: Let be the statement: is divisible by 4.
Basis of Induction: For : , which is divisible by 4. So is true.
Inductive Hypothesis: Assume is true, i.e. for some integer m$.\n - **Inductive Step:** We show P(k + 1)5^{k+1} - 1 is divisible by 4.\n 5^{k+1} - 1 = 5 \cdot 5^k - 1 = 5(4m + 1) - 1 = 20m + 5 - 1 = 20m + 4 = 4(5m + 1)\n So 5^{k+1} - 1P(k + 1) is true.\n - **Conclusion:** By P.M.I., 5^n - 1n \geq 1\blacksquare\n\n### Key Point / Common Mistake\n\n- For a divisibility statement, the trick in the Inductive Step is always the same: rewrite the (k + 1)k-th expression as a piece, plus something extra. Then replace that piece using the Inductive Hypothesis, and check the whole sum is still a multiple of the required number.\n\n### Example 7.6 – An Inequality Proof\n\n- Prove that 2^n > n^2n \geq 5$.
Solution: Let be the statement: 2^n > n^2$.\n - **Basis of Induction:** For n = 52^5 = 32 > 25 = 5^2P(5) is true.\n - **Inductive Hypothesis:** Assume P(k)k \geq 52^k > k^2$.
Inductive Step: We want to show is true, i.e. 2^{k+1} > (k + 1)^2$.\n 2^{k+1} = 2 \cdot 2^k > 2k^2 \quad \text{(by hypothesis)}\n So it is enough to show 2k^2 \geq (k + 1)^2 = k^2 + 2k + 1 \iff k^2 - 2k - 1 \geq 0$. For : k^2 - 2k - 1 = k(k - 2) - 1 \geq 5(3) - 1 = 14 > 0$. Hence 2k^2 > (k + 1)^22^{k+1} > (k + 1)^2.\n - **Conclusion:** By P.M.I., 2^n > n^2n \geq 5\blacksquare\n\n### Example 7.7 – A Recursive Sequence\n\n- A sequence is defined recursively by a_1 = 1a_n = a_{n-1} + 2n - 1n \geq 2a_n = n^2n \geq 1$.
Solution: Let be the statement: a_n = n^2$.\n - **Basis of Induction:** For n = 1a_1 = 1 = 1^2P(1) is true.\n - **Inductive Hypothesis:** Assume P(k)a_k = k^2$.
Inductive Step: We show is true, i.e. a_{k+1} = (k + 1)^2$.\n a_{k+1} = a_k + 2(k + 1) - 1 = k^2 + 2k + 1 = (k + 1)^2\n - **Conclusion:** By P.M.I., a_n = n^2n \geq 1\blacksquare\n\n## Strong Induction\n\n- Ordinary induction lets us assume only P(k)P(k + 1)kk itself.\n\n### Definition: Strong Induction\n\n- To prove P(n)n \geq b:\n - **Basis:** Prove P(b) (and possibly a few more base cases).\n - **Inductive Step:** Assume P(b), P(b + 1), \dots, P(k)P(k + 1).\n\n### Example 7.8 – Fibonacci Inequality – Strong Induction\n\n- Let F_1 = 1, F_2 = 1, F_n = F_{n-1} + F_{n-2}n \geq 3F_n < 2^nn \geq 1$.
Solution: Let be the statement: F_n < 2^n$.\n - **Basis:** F_1 = 1 < 2^1 = 2F_2 = 1 < 2^2 = 4P(1)P(2) are true.\n - **Inductive Step:** Assume P(j)j1 \leq j \leq kk \geq 2F_j < 2^jjP(k + 1)F_{k+1} < 2^{k+1}$. Since , the recursive definition gives , and both are covered by the inductive assumption:
Conclusion: By strong induction, for all .
Practice Questions – Prove by P.M.I.
For all natural numbers , show using the Principle of Mathematical Induction:
For any natural number , is divisible by , where and are any integers with x \neq y$.\n7. For all natural numbers n \geq 5n^2 < 2^n$.
For all natural numbers , n^3 < 3^n$.\n9. For all natural numbers n \geq 32n + 1 < 2^n$.
For all , is divisible by 3.
Recursive Definitions
Definition: Recursive Definition
A recursive definition defines a mathematical object in terms of simpler or smaller instances of the same object. A recursive definition consists of two essential parts:
a base case, which specifies the initial value or values; and
a recursive rule, which defines new values in terms of previously defined values.
Recursively Defined Functions
Definition: Recursively Defined Function
A function is said to be defined recursively if its value is defined for one or more initial values and a rule is given for determining the value at subsequent inputs from previously defined values.
Example 7.9 – Factorial Function
The factorial function can be defined recursively by:
For example, 4! = 4(3!) = 4(3)(2!) = 4(3)(2)(1!) = 4(3)(2)(1)(0!) = 4(3)(2)(1)(1) = 24$.\n- Here, 0! = 1n! = n(n - 1)! is the recursive rule.\n\n### Example 7.10 – Power Function\n\n- For a nonzero real number aa^nn by:\n a^0 = 1 \quad \text{and} \quad a^n = a \cdot a^{n-1}, \quad n \geq 1\n- For example, a^4 = a \cdot a^3 = a \cdot a \cdot a^2 = a \cdot a \cdot a \cdot a = a^4$.
Recursively Defined Sequences
Definition: Recursively Defined Sequence
A sequence is said to be defined recursively if one or more initial terms are specified and each subsequent term is defined in terms of one or more preceding terms.
Example 7.11 – Fibonacci Sequence
The Fibonacci sequence is defined recursively by:
Thus, , , , F_5 = F_4 + F_3 = 5$.\n- Hence the sequence begins as 0, 1, 1, 2, 3, 5, 8, 13, \dots\n\n### Example 7.12 – Sum of the First n Positive Integers\n\n- Define the sequence recursively by:\n S_0 = 0 \quad \text{and} \quad S_n = S_{n-1} + n, \quad n \geq 1\n- Therefore, S_1 = 1S_2 = 3S_3 = 6S_4 = 10S_n = 1 + 2 + \dots + n$.
Recursively Defined Sets
Definition: Recursively Defined Set
A set can be defined recursively by specifying:
a basis, which specifies the initial elements of the set; and
a recursive rule, which specifies how new elements are generated from elements that are already in the set.
Example 7.13 – Positive Integers Divisible by 3
Define the set of positive integers divisible by 3 recursively:
Basis: 3 \in S$.\n - **Recursive rule:** If x \in Sx + 3 \in S$.
Therefore, S = \{3, 6, 9, 12, 15, \dots\}$.\n\n### Example 7.14 – Powers of 2\n\n- Define the set S = {1, 2, 4, 8, 16, \dots} recursively:\n - **Basis:** 1 \in S$.
Recursive rule: If , then 2x \in S$.\n- Hence, S = {1, 2, 4, 8, 16, \dots}$.
Recursive Algorithms
Definition: Recursive Algorithm
A recursive algorithm is an algorithm that solves a problem by calling itself on a smaller instance of the same problem. A recursive algorithm has two essential parts:
a base case, which can be solved directly; and
a recursive case, in which the algorithm calls itself with a smaller input.
Example 7.15 – Recursive Factorial Algorithm
procedure factorial(n)
if n = 0 then return 1
else return n * factorial(n - 1)
The base case is , for which the algorithm returns 1. The recursive case is .
Example 7.16 – Tracing the Factorial Algorithm
Consider . The recursive calls are:
\begin{aligned}\n\text{factorial}(4) &= 4 \cdot \text{factorial}(3) \\\n&= 4 \cdot 3 \cdot \text{factorial}(2) \\\n&= 4 \cdot 3 \cdot 2 \cdot \text{factorial}(1) \\\n&= 4 \cdot 3 \cdot 2 \cdot 1 \cdot \text{factorial}(0) \\\n&= 4 \cdot 3 \cdot 2 \cdot 1 \cdot 1 = 24\n\end{aligned}
Example 7.17 – Recursive Power Algorithm
procedure power(a, n)
if n = 0 then return 1
else return a * power(a, n - 1)
For example, produces:
\begin{aligned}\n\text{power}(2, 4) &= 2 \cdot \text{power}(2, 3) \\\n&= 2 \cdot 2 \cdot \text{power}(2, 2) \\\n&= 2 \cdot 2 \cdot 2 \cdot \text{power}(2, 1) \\\n&= 2 \cdot 2 \cdot 2 \cdot 2 \cdot \text{power}(2, 0) = 16\n\end{aligned}
Example 7.18 – Euclidean Algorithm for GCD
The greatest common divisor can be computed recursively using:
The recursive algorithm is:
procedure gcd(a, b)
if b = 0 then return a
else return gcd(b, a mod b)
The base case is b = 0$.\n\n### Example 7.19 – Finding \gcd(48, 18)\n\n- Using the recursive Euclidean algorithm:\n\n\begin{aligned} \gcd(48, 18) &= \gcd(18, 48 \bmod 18) = \gcd(18, 12) \ &= \gcd(12, 18 \bmod 12) = \gcd(12, 6) \ &= \gcd(6, 12 \bmod 6) = \gcd(6, 0) = 6 \end{aligned}\n\n- Therefore, \gcd(48, 18) = 6$.
Exercises
Define the factorial function recursively and use it to compute 5!$.\n2. Give a recursive definition of a^nan$.
Give a recursive definition of the Fibonacci sequence.
Find using the recursive definition F_0 = 0, F_1 = 1, F_n = F_{n-1} + F_{n-2}$.\n5. Define the sequence 1, 3, 5, 7, 9, \dots recursively.\n6. Define the set of positive integers divisible by 5 recursively.\n7. Define the set {1, 2, 4, 8, 16, \dots} recursively.\n8. Write a recursive algorithm for computing n!$.
Trace the recursive algorithm for .
Write a recursive algorithm for computing a^n$.\n11. Trace the recursive algorithm for \text{power}(2, 5).\n12. Use the recursive Euclidean algorithm to find \gcd(48, 18).\n13. Write a recursive algorithm for computing the n$$-th Fibonacci number.
Explain the base case and recursive case in a recursive algorithm.
Explain why a recursive algorithm must eventually reach its base case.