Predicate Logic

809 words
4 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Predicate Logic ## ๐ŸŽฏ Learning Objectives - Distinguish predicates from propositions - Use universal ($\forall$) and existential ($\exists$) quantifiers - Translate between English statements and logical notation - Negate quantified statements correctly - Understand nested quantifiers and their order * * * ## 2.1...

Predicate Logic

๐ŸŽฏ Learning Objectives

  • Distinguish predicates from propositions
  • Use universal (โˆ€\forall) and existential (โˆƒ\exists) quantifiers
  • Translate between English statements and logical notation
  • Negate quantified statements correctly
  • Understand nested quantifiers and their order

2.1 Intuition: Beyond Atomic Statements

Propositional logic treats "x > 5" as a single letter PP, but something is lost โ€” the structure inside. Predicate logic lets us say: "For all xx, if x>5x > 5 then x>3x > 3" โ€” capturing the internal structure.
๐Ÿ”‘ Key Insight: Predicates are like functions that return truth values: P(x)P(x) is true or false depending on xx.

2.2 Predicates and Quantifiers

Predicates

A predicate P(x)P(x) is a statement involving a variable xx. Its truth value depends on xx. Example: P(x)="xP(x) = "x is prime."
  • P(2)P(2) = True
  • P(4)P(4) = False
  • P(x)P(x) is not a proposition until xx is specified or quantified.

Universal Quantifier (โˆ€\forall)

โˆ€xP(x)\forall x P(x) means "P(x)P(x) is true for all xx 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."
StatementIn EnglishTrue If...
โˆ€xP(x)\forall x P(x)All xx satisfy PPEvery single xx makes PP true
โˆƒxP(x)\exists x P(x)Some xx satisfies PPAt least one xx makes PP true

2.3 Quantifier Negation

ยฌโˆ€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)
Intuition: "Not everyone passed" = "There is someone who didn't pass." Example: Negate "All swans are white."
  • Original: โˆ€x(Sw(x)โ†’Wh(x))\forall x (\text{Sw}(x) \to \text{Wh}(x))
  • Negation: ยฌโˆ€x(Sw(x)โ†’Wh(x))โ‰กโˆƒxยฌ(Sw(x)โ†’Wh(x))\neg \forall x (\text{Sw}(x) \to \text{Wh}(x)) \equiv \exists x \neg (\text{Sw}(x) \to \text{Wh}(x))
  • โ‰กโˆƒx(Sw(x)โˆงยฌWh(x))\equiv \exists x (\text{Sw}(x) \land \neg \text{Wh}(x))
  • English: "There exists a swan that is not white."

2.4 Nested Quantifiers

Statements with two or more quantifiers:
StatementMeaningTrue When
โˆ€xโˆ€yP(x,y)\forall x \forall y P(x,y)For all xx and all yy , PP holdsAlways true
โˆ€xโˆƒyP(x,y)\forall x \exists y P(x,y)For each xx , there is some yyyy can depend on xx
โˆƒxโˆ€yP(x,y)\exists x \forall y P(x,y)There's an xx that works for all yyOne xx fits all
โˆƒxโˆƒyP(x,y)\exists x \exists y P(x,y)There exist xx and yySome pair exists

Order Matters!

  • โˆ€xโˆƒy(y=x2)\forall x \exists y (y = x^2) is true over real numbers (every number has a square)
  • โˆƒyโˆ€x(y=x2)\exists y \forall x (y = x^2) is false (no single number equals every square)

2.5 Translating English to Logic

Example 1: "Everyone has someone they love."
  • โˆ€xโˆƒyL(x,y)\forall x \exists y L(x,y) where L(x,y)L(x,y) = "xx loves yy" Example 2: "There is a person who loves everyone."
  • โˆƒxโˆ€yL(x,y)\exists x \forall y L(x,y) Example 3: "If all men are mortal and Socrates is a man, then Socrates is mortal."
  • [โˆ€x(M(x)โ†’R(x))โˆงM(s)]โ†’R(s)[\forall x (M(x) \to R(x)) \land M(s)] \to R(s)
  • M(x)M(x) = "xx is a man", R(x)R(x) = "xx is mortal", ss = Socrates

2.6 Multiple Domain Considerations

Sometimes quantifiers range over different domains:
โˆ€ฯต>0ย โˆƒฮด>0ย โˆ€x(โˆฃxโˆ’aโˆฃ<ฮดโ†’โˆฃf(x)โˆ’f(a)โˆฃ<ฯต)\forall \epsilon > 0 \ \exists \delta > 0 \ \forall x (|x - a| < \delta \to |f(x) - f(a)| < \epsilon)
This is the definition of continuity โ€” ฯต\epsilon ranges over positive reals, ฮด\delta over positive reals, xx over real numbers.

๐Ÿ“Š Formula Summary

LawRule
Negate โˆ€\forallยฌโˆ€xP(x)โ‰กโˆƒxยฌP(x)\neg \forall x P(x) \equiv \exists x \neg P(x)
Negate โˆƒ\existsยฌโˆƒxP(x)โ‰กโˆ€xยฌP(x)\neg \exists x P(x) \equiv \forall x \neg P(x)
Order mattersโˆ€xโˆƒyโ‰กฬธโˆƒyโˆ€x\forall x \exists y \not\equiv \exists y \forall x

โœ… Practice Questions

Q1: Translate: "No one is perfect."
Solution
ยฌโˆƒxP(x)\neg \exists x P(x) where P(x)P(x) = "xx is perfect." Equivalent to โˆ€xยฌP(x)\forall x \neg P(x). Q2: Negate "Everyone passed the exam." Solution
Original: โˆ€xP(x)\forall x P(x). Negation: โˆƒxยฌP(x)\exists x \neg P(x) = "Someone did not pass." Q3: Determine truth: โˆ€xโˆˆZย โˆƒyโˆˆZย (x+y=0)\forall x \in \mathbb{Z} \ \exists y \in \mathbb{Z} \ (x + y = 0). Solution
True. For any integer xx, choose y=โˆ’xy = -x. Then x+(โˆ’x)=0x + (-x) = 0. Q4: Determine truth: โˆƒyโˆˆZย โˆ€xโˆˆZย (x+y=0)\exists y \in \mathbb{Z} \ \forall x \in \mathbb{Z} \ (x + y = 0). Solution
False. We'd need a single yy such that x+y=0x + y = 0 for ALL xx. If y=0y = 0, then x=0x = 0 for all xx โ€” false. No such yy exists. Q5: Write the logical form of: "Some students in this class have taken every course in the program." Solution
โˆƒx(S(x)โˆงโˆ€y(C(y)โ†’T(x,y)))\exists x (S(x) \land \forall y (C(y) \to T(x,y))) where S(x)S(x) = "xx is a student in this class," C(y)C(y) = "yy is a course in the program," T(x,y)T(x,y) = "xx has taken yy." Join Discord PreviousPropositional LogicNextQuantifier Applications
Document outline

Keep your place and jump directly to a heading.

Table of contents

No note selected

Open a chapter to see its outline, backlinks, and sources here.