2078 2

CSC165 · 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)\t

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]

Discrete StructuresChapter 3: Logic and Proof MethodsPredicates and Quantifiers

Quick answer

What is the quotient and remainder when 101 is divided by 11?

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

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:

QuantifierExpansion 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

PropositionExpanded 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.

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.