Logic and Propositions: Comprehensive Study Notes

INTRODUCTION TO LOGIC

  • Logic is the study of the principles that govern correct reasoning.
  • Mastering formal logic is vital for computing students because propositional and predicate logic serve as the languages for conditional statements, loop invariants, database queries, circuit designs, and program specifications.
  • This domain involves the mathematical language of logic, which includes propositions, logical connectives, predicates, quantifiers, and rules of inference.
  • These components form the basis for standard methods of mathematical proof.

PROPOSITIONAL LOGIC

Definition and Recognition

  • Proposition: A proposition is a declarative sentence that is either true or false, but not both. Every proposition has exactly one definite truth value.
  • Non-propositions: Sentences that are not propositions include:
    • Questions.
    • Commands.
    • Sentences where truth depends on an unassigned variable (e.g., x+3=8x + 3 = 8).
  • Examples of Propositions:
    • "Gaborone is the capital of Botswana": This is a true proposition.
    • "2+2=52 + 2 = 5": This is a false proposition.
    • "Every even integer greater than 2 is the sum of two primes" (Goldbach’s Conjecture): This is a proposition because it has a definite truth value, regardless of whether mathematicians have yet proven what that value is.
  • Notation: Propositions are typically denoted by lower-case letters như p,q,r,sp, q, r, s, referred to as propositional variables or statement letters.
    • p≡truep \equiv \text{true} indicates that the proposition pp is true.
    • p≡falsep \equiv \text{false} indicates that the proposition pp is false.

Logical Connectives and Compound Propositions

  • Compound Propositions: Created by building upon existing propositions using logical connectives.
  • Atomic Propositions: Propositions that cannot be broken down into further components.
  • Negation (¬\neg): Let pp be a proposition. the negation of pp is written as ¬p\neg p (read as "not pp"). It is the proposition "It is not the case that pp". The truth value of ¬p\neg p is the exact opposite of pp.
    • Truth Table for Negation:
      • If pp is true, ¬p\neg p is false.
      • If pp is false, ¬p\neg p is true.
  • Conjunction (∧\wedge): The conjunction of pp and qq (read as "pp and qq") is true only when both pp and qq are true; otherwise, it is false.
  • Disjunction (∨\vee): The disjunction of pp and qq (read as "pp or qq") is false only when both pp and qq are false; otherwise, it is true.
    • Inclusive vs. Exclusive "Or": The connective ∨\vee is an inclusive or, meaning it is true if either or both propositions are true. This differs from the exclusive or (⊕\oplus), where the proposition is true only if precisely one of the variables is true.
  • Exclusive Or (⊕\oplus): The proposition p⊕qp \oplus q is true exactly when precisely one of pp or qq is true.
ppqqp∧qp \wedge qp∨qp \vee qp⊕qp \oplus q
truetruetruetruefalse
truefalsefalsetruetrue
falsetruefalsetruetrue
falsefalsefalsefalsefalse

Conditional Statements

  • Definition: The conditional statement p→qp \rightarrow q (read as "if pp then qq") is false only when the hypothesis (antecedent) pp is true and the conclusion (consequent) qq is false. It is true in all other scenarios.
  • Vacuous Truth: The statement p→qp \rightarrow q is considered true whenever pp is false, regardless of the truth value of qq. This is because the statement makes no claim when the hypothesis is not met.
  • Truth Table for Conditional (p→qp \rightarrow q):
    • true, true: true
    • true, false: false
    • false, true: true
    • false, false: true
  • English Equivalents for p→qp \rightarrow q:
    • "pp implies qq"
    • "pp is sufficient for qq"
    • "qq is necessary for pp"
    • "qq if pp"
    • "qq whenever pp"
    • "qq follows from pp"
  • Related Statements:
    • Converse: q→pq \rightarrow p
    • Inverse: ¬p→¬q\neg p \rightarrow \neg q
    • Contrapositive: ¬q→¬p\neg q \rightarrow \neg p
    • Note: Only the contrapositive is logically equivalent to the original conditional statement (p→qp \rightarrow q). The converse and inverse are generally not equivalent to the original.

Biconditional Statements

  • Definition: The biconditional statement p↔qp \leftrightarrow q (read as "pp if and only if qq" or "iff") is true only when pp and qq possess the same truth value.
  • Equivalence: p↔qp \leftrightarrow q is true precisely when both p→qp \rightarrow q and q→pq \rightarrow p are true.
ppqqp↔qp \leftrightarrow q
truetruetrue
truefalsefalse
falsetruefalse
falsefalsetrue

Precedence of Logical Operators

To minimize the need for parentheses, connectives are evaluated in a standardized order:

  1. Negation (¬\neg)
  2. Conjunction (∧\wedge)
  3. Disjunction (∨\vee)
  4. Conditional (→\rightarrow)
  5. Biconditional (↔\leftrightarrow)

PROPOSITIONAL EQUIVALENCES

Tautologies, Contradictions, and Contingencies

  • Tautology: A compound proposition that is always true, regardless of the truth values of its variables (e.g., p∨¬pp \vee \neg p, the Law of the Excluded Middle).
  • Contradiction: A compound proposition that is always false, regardless of variable truth values (e.g., p∧¬pp \wedge \neg p).
  • Contingency: A compound proposition that is neither a tautology nor a contradiction (it is true for at least one assignment and false for at least one other).

Logical Equivalence

  • Two compound propositions AA and BB are logically equivalent (A≡BA \equiv B) if A↔BA \leftrightarrow B is a tautology, meaning they have identical truth tables.
  • De Morgan's Laws:
    • ¬(p∧q)≡¬p∨¬q\neg (p \wedge q) \equiv \neg p \vee \neg q
    • ¬(p∨q)≡¬p∧¬q\neg (p \vee q) \equiv \neg p \wedge \neg q

Fundamental Logical Equivalences Toolkit

EquivalenceName
p∧true≡pp \wedge \text{true} \equiv p, p∨false≡pp \vee \text{false} \equiv pIdentity laws
p∨true≡truep \vee \text{true} \equiv \text{true}, p∧false≡falsep \wedge \text{false} \equiv \text{false}Domination laws
p∨p≡pp \vee p \equiv p, p∧p≡pp \wedge p \equiv pIdempotent laws
¬(¬p)≡p\neg(\neg p) \equiv pDouble negation law
p∨q≡q∨pp \vee q \equiv q \vee p, p∧q≡q∧pp \wedge q \equiv q \wedge pCommutative laws
(p∨q)∨r≡p∨(q∨r)(p \vee q) \vee r \equiv p \vee (q \vee r), (p∧q)∧r≡p∧(q∧r)(p \wedge q) \wedge r \equiv p \wedge (q \wedge r)Associative laws
p∨(q∧r)≡(p∨q)∧(p∨r)p \vee (q \wedge r) \equiv (p \vee q) \wedge (p \vee r)Distributive law
p∧(q∨r)≡(p∧q)∨(p∧r)p \wedge (q \vee r) \equiv (p \wedge q) \vee (p \wedge r)Distributive law
¬(p∧q)≡¬p∨¬q\neg(p \wedge q) \equiv \neg p \vee \neg q, ¬(p∨q)≡¬p∧¬q\neg(p \vee q) \equiv \neg p \wedge \neg qDe Morgan's laws
p∨(p∧q)≡pp \vee (p \wedge q) \equiv p, p∧(p∨q)≡pp \wedge (p \vee q) \equiv pAbsorption laws
p∨¬p≡truep \vee \neg p \equiv \text{true}, p∧¬p≡falsep \wedge \neg p \equiv \text{false}Negation laws

Rewriting Conditionals and Biconditionals

  • Conditional as disjunction: p→q≡¬p∨qp \rightarrow q \equiv \neg p \vee q
  • Contrapositive law: p→q≡¬q→¬pp \rightarrow q \equiv \neg q \rightarrow \neg p
  • Biconditional expansion: p↔q≡(p→q)∧(q→p)p \leftrightarrow q \equiv (p \rightarrow q) \wedge (q \rightarrow p)
  • Other Identities:
    • p∨q≡¬p→qp \vee q \equiv \neg p \rightarrow q
    • p∧q≡¬(p→¬q)p \wedge q \equiv \neg(p \rightarrow \neg q)
    • p↔q≡¬p↔¬qp \leftrightarrow q \equiv \neg p \leftrightarrow \neg q

Satisfiability

  • Satisfiable: A compound proposition is satisfiable if there is at least one assignment of truth values to its variables that makes it true (called a solution).
  • Unsatisfiable: A compound proposition is unsatisfiable if no such assignment exists (i.e., it is a contradiction).
  • Importance: The satisfiability problem (SAT) is the archetypal NP-complete problem in computer science.

PREDICATES AND QUANTIFIERS

Predicates (Propositional Functions)

  • Ordinary propositional logic cannot capture the internal structure of sentences like "x>3x > 3".
  • Definition: A predicate or propositional function P(x)P(x) involves a variable xx from a domain of discourse DD. It becomes a proposition once a specific value from DD is substituted for xx.
  • Example: Let P(x)P(x) denote "x2−5x+6=0x^2 - 5x + 6 = 0" with domain ZZ.
    • P(2)P(2) is true (0=00 = 0).
    • P(5)P(5) is false (6=06 = 0).

Quantifiers

  • Universal Quantifier (∀\forall): The proposition "P(x)P(x) is true for all values of xx in the domain DD," denoted ∀xP(x)\forall x P(x). A value that makes P(x)P(x) false is a counterexample.
  • Existential Quantifier (∃\exists): The proposition "there exists an element xx in the domain DD for which P(x)P(x) is true," denoted ∃xP(x)\exists x P(x). A value that makes P(x)P(x) true is a witness.
  • Bound vs. Free Variables: A variable associated with a quantifier is bound. A variable not associated with one is free. A statement with no free variables is a true proposition.
  • Restricted Domain Shorthand:
    • ∀x<0(x2>0)\forall x < 0 (x^2 > 0) is shorthand for ∀x(x<0→x2>0)\forall x (x < 0 \rightarrow x^2 > 0).
    • ∃x>100(x is prime)\exists x > 100 (\text{x is prime}) is shorthand for ∃x(x>100∧x is prime)\exists x (x > 100 \wedge \text{x is prime}).

Negating Quantifiers (De Morgan's Laws for Quantifiers)

  • ¬[∀xP(x)]≡∃x¬P(x)\neg [\forall x P(x)] \equiv \exists x \neg P(x)
  • ¬[∃xP(x)]≡∀x¬P(x)\neg [\exists x P(x)] \equiv \forall x \neg P(x)
  • Negation swaps ∀\forall for ∃\exists and moves the negation symbol inside next to the predicate.

NESTED QUANTIFIERS

  • Nested quantifiers occur when multiple quantifiers are applied in sequence (e.g., the definition of a limit in Calculus).
  • Order Matters:
    • Quantifiers of the same type can be reordered (∀x∀y≡∀y∀x\forall x \forall y \equiv \forall y \forall x and ∃x∃y≡∃y∃x\exists x \exists y \equiv \exists y \exists x).
    • Mixed quantifiers cannot generally be reordered. ∀x∃yP(x,y)\forall x \exists y P(x, y) (where yy may depend on xx) is not the same as ∃y∀xP(x,y)\exists y \forall x P(x, y) (which requires one single yy for all xx).

RULES OF INFERENCE

Validity and Arguments

  • Argument: A sequence of propositions (premises) followed by a final proposition (conclusion).
  • Validity: An argument is valid if the conclusion is necessarily true whenever all premises are true. Formally, (p1∧p2∧⋯∧pn)→q(p_1 \wedge p_2 \wedge \dots \wedge p_n) \rightarrow q must be a tautology.
  • Rule of Inference: A standard, verified argument form used as a single step in a proof.

Table of Rules for Propositional Logic

NameRuleTautology Form
Modus Ponensp→q,p∴qp \rightarrow q, p \therefore q(p∧(p→q))→q(p \wedge (p \rightarrow q)) \rightarrow q
Modus Tollensp→q,¬q∴¬pp \rightarrow q, \neg q \therefore \neg p(¬q∧(p→q))→¬p(\neg q \wedge (p \rightarrow q)) \rightarrow \neg p
Hypothetical Syllogismp→q,q→r∴p→rp \rightarrow q, q \rightarrow r \therefore p \rightarrow r((p→q)∧(q→r))→(p→r)((p \rightarrow q) \wedge (q \rightarrow r)) \rightarrow (p \rightarrow r)
Disjunctive Syllogismp∨q,¬p∴qp \vee q, \neg p \therefore q((p∨q)∧¬p)→q((p \vee q) \wedge \neg p) \rightarrow q
Additionp∴p∨qp \therefore p \vee qp→(p∨q)p \rightarrow (p \vee q)
Simplificationp∧q∴pp \wedge q \therefore p(p∧q)→p(p \wedge q) \rightarrow p
Conjunctionp,q∴p∧qp, q \therefore p \wedge q((p)∧(q))→(p∧q)((p) \wedge (q)) \rightarrow (p \wedge q)
Resolutionp∨q,¬p∨r∴q∨rp \vee q, \neg p \vee r \therefore q \vee r((p∨q)∧(¬p∨r))→(q∨r)((p \vee q) \wedge (\neg p \vee r)) \rightarrow (q \vee r)

Rules for Quantified Statements

  • Universal Instantiation: From ∀xP(x)\forall x P(x), infer P(c)P(c) for a particular element cc.
  • Universal Generalisation: From P(c)P(c) for an arbitrary cc, infer ∀xP(x)\forall x P(x).
  • Existential Instantiation: From ∃xP(x)\exists x P(x), infer P(c)P(c) for some element cc.
  • Existential Generalisation: From P(c)P(c) for some witness cc, infer ∃xP(x)\exists x P(x).

Logic Fallacies

  • Affirming the Consequent: Concluding pp from p→qp \rightarrow q and qq. Invalid because qq might be true for other reasons.
  • Denying the Hypothesis: Concluding ¬q\neg q from p→qp \rightarrow q and ¬p\neg p. Invalid because qq might still be true even if pp is false.

INTRODUCTION TO PROOFS

Mathematical Definitions

  • Theorem: A proposition proved true, usually significant.
  • Proof: A valid chain of reasoning establishing a theorem's truth.
  • Axiom (Postulate): A statement accepted as true without proof.
  • Lemma: A minor theorem used as a stepping stone.
  • Corollary: A theorem that follows directly from a proved theorem.
  • Conjecture: A statement believed but not yet proved true. Once proved, it becomes a theorem.
  • Even Integer: an integer nn such that n=2kn = 2k for some integer kk.
  • Odd Integer: an integer nn such that n=2k+1n = 2k + 1 for some integer kk.
  • Rational Number: A real number rr that can be expressed as a/ba/b where a,b∈Za, b \in Z and b≠0b \neq 0.
  • Irrational Number: A real number that is not rational.

Proof Methods

  • Direct Proof: To prove p→qp \rightarrow q, assume pp is true and use axioms/definitions to show qq must be true.
    • Standard pattern: Unpack definition (e.g., n=2kn = 2k), compute algebraically, repackage into the required form.
  • Proof by Contraposition: To prove p→qp \rightarrow q, give a direct proof of the contrapositive ¬q→¬p\neg q \rightarrow \neg p. Assume qq is false and show pp must be false.
    • Example: To prove "if 3n+23n + 2 is odd, then nn is odd," it is easier to show "if nn is even, then 3n+23n + 2 is even."
  • Proof by Contradiction: Assume the negation of what you want to prove (assume ¬p\neg p) and derive a contradiction (r∧¬rr \wedge \neg r). Since ¬p\neg p leads to a falsehood, pp must be true.
  • Proof by Cases: Establish p→qp \rightarrow q by proving it for an exhaustive list of individual scenarios (p1→q,p2→q,…p_1 \rightarrow q, p_2 \rightarrow q, \dots). Example: Proving a property for all integers by checking cases for n≤−1n \leq -1, n=0n = 0, and n≥1n \geq 1.
  • Existence Proofs:
    • Constructive: Explicitly find a witness aa that satisfies P(a)P(a).
    • Nonconstructive: Show that an element must exist without finding it (e.g., using cases or contradiction).
  • Uniqueness Proofs: To show a unique element exists, prove existence first, then prove that any arbitrary element satisfying the property must be equal to that first element.
  • Counterexamples: A single counterexample is sufficient to disprove a universal statement ∀xP(x)\forall x P(x).

Case Study: Proof by Contradiction of 2\sqrt{2}

  1. Suppose 2\sqrt{2} is rational: 2=a/b\sqrt{2} = a/b where gcd(a,b)=1\text{gcd}(a, b) = 1.
  2. Square both sides: 2=a2/b22 = a^2/b^2, so a2=2b2a^2 = 2b^2.
  3. a2a^2 is even, so aa is even (by lemma: even square implies even base). Let a=2ca = 2c.
  4. Substitute: (2c)2=2b2→4c2=2b2→2c2=b2(2c)^2 = 2b^2 \rightarrow 4c^2 = 2b^2 \rightarrow 2c^2 = b^2.
  5. b2b^2 is even, so bb is even.
  6. If both aa and bb are even, gcd(a,b)≥2\text{gcd}(a, b) \geq 2, contradicting the assumption gcd(a,b)=1\text{gcd}(a, b) = 1. Therefore, 2\sqrt{2} is irrational.