Logic & ProofsTopic #3 of 40

Predicate Logic

Predicates, quantifiers (∀ and ∃), nested quantifiers, and translating English to logical statements.

Predicates

A predicate is a statement containing variables that becomes a proposition when values are substituted.

Notation

  • P(x)P(x): predicate with one variable
  • Q(x,y)Q(x, y): predicate with two variables

Example

Let P(x)P(x): "x>3x > 3"

  • P(4)P(4) is true
  • P(2)P(2) is false

Quantifiers

Universal Quantifier (\forall)

xP(x)\forall x \, P(x)

Means: "For all xx, P(x)P(x) is true"

True when: P(x)P(x) is true for every element in the domain.

Existential Quantifier (\exists)

xP(x)\exists x \, P(x)

Means: "There exists an xx such that P(x)P(x) is true"

True when: P(x)P(x) is true for at least one element in the domain.

Uniqueness Quantifier (!\exists!)

!xP(x)\exists! x \, P(x)

Means: "There exists exactly one xx such that P(x)P(x) is true"

!xP(x)x(P(x)y(P(y)y=x))\exists! x \, P(x) \equiv \exists x (P(x) \land \forall y (P(y) \rightarrow y = x))

Domain of Discourse

The domain (or universe of discourse) specifies what values variables can take.

Example

If domain is Z+\mathbb{Z}^+ (positive integers):

  • x(x>0)\forall x (x > 0) is true
  • x(x<0)\exists x (x < 0) is false

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)

Example

¬\neg"All students passed" \equiv "Some student did not pass"

¬xPassed(x)x¬Passed(x)\neg \forall x \, \text{Passed}(x) \equiv \exists x \, \neg \text{Passed}(x)

Nested Quantifiers

Order Matters!

xyP(x,y)≢yxP(x,y)\forall x \, \exists y \, P(x, y) \not\equiv \exists y \, \forall x \, P(x, y)

Examples

Let L(x,y)L(x, y): "xx loves yy"

StatementMeaning
xyL(x,y)\forall x \, \forall y \, L(x,y)Everyone loves everyone
xyL(x,y)\exists x \, \exists y \, L(x,y)Someone loves someone
xyL(x,y)\forall x \, \exists y \, L(x,y)Everyone loves someone
yxL(x,y)\exists y \, \forall x \, L(x,y)Someone is loved by everyone
xyL(x,y)\exists x \, \forall y \, L(x,y)Someone loves everyone

Negating Nested Quantifiers

Move negation inward, flipping each quantifier:

¬xyP(x,y)xy¬P(x,y)\neg \forall x \, \exists y \, P(x,y) \equiv \exists x \, \forall y \, \neg P(x,y)

Example

¬\neg"Every student has taken some course" = "Some student has taken no courses"

¬scTaken(s,c)sc¬Taken(s,c)\neg \forall s \, \exists c \, \text{Taken}(s,c) \equiv \exists s \, \forall c \, \neg \text{Taken}(s,c)

Translating English to Logic

Common Patterns

EnglishLogical Form
All AA are BBx(A(x)B(x))\forall x (A(x) \rightarrow B(x))
Some AA are BBx(A(x)B(x))\exists x (A(x) \land B(x))
No AA are BBx(A(x)¬B(x))\forall x (A(x) \rightarrow \neg B(x))
Some AA are not BBx(A(x)¬B(x))\exists x (A(x) \land \neg B(x))

Example

"Every prime greater than 2 is odd"

Let P(x)P(x): "xx is prime", G(x)G(x): "x>2x > 2", O(x)O(x): "xx is odd"

x((P(x)G(x))O(x))\forall x ((P(x) \land G(x)) \rightarrow O(x))

Bound and Free Variables

  • Bound variable: Quantified variable
  • Free variable: Not quantified

In x(P(x)Q(x,y))\forall x (P(x) \land Q(x, y)):

  • xx is bound
  • yy is free

Rules of Inference for Quantifiers

Universal Instantiation

xP(x)P(c) for any c in domain\frac{\forall x \, P(x)}{P(c)} \text{ for any } c \text{ in domain}

Universal Generalization

P(c) for arbitrary cxP(x)\frac{P(c) \text{ for arbitrary } c}{\forall x \, P(x)}

Existential Instantiation

xP(x)P(c) for some element c\frac{\exists x \, P(x)}{P(c) \text{ for some element } c}

Existential Generalization

P(c) for some element cxP(x)\frac{P(c) \text{ for some element } c}{\exists x \, P(x)}