Quiz 2

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
xyP(x,y)\forall x \forall y P(x,y)For all xx and all yy , PP holdsAlways true
xyP(x,y)\forall x \exists y P(x,y)For each xx , there is some yyyy can depend on xx
xyP(x,y)\exists x \forall y P(x,y)There's an xx that works for all yyOne xx fits all
xyP(x,y)\exists x \exists y P(x,y)There exist xx and yySome pair exists

Order Matters!

  • xy(y=x2)\forall x \exists y (y = x^2) is true over real numbers (every number has a square)
  • yx(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."
  • xyL(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."
  • xyL(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(xa<δ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 mattersxy≢yx\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: xZ yZ (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: yZ xZ (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
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.