sentence to predicate logic

Real-Life Examples of Predicate Logic


1) Social Relationships

Example 1: Family Relationships

Natural language:

  • "Alice is Bob's mother"
  • "Everyone has a biological mother"
  • "If Alice is Bob's mother and Bob is Carol's mother, then Alice is Carol's grandmother"

Predicate logic:

Mother(alice, bob)
∀x ∃y Mother(y, x)
∀x ∀y ∀z (Mother(x, y) ∧ Mother(y, z) → Grandmother(x, z))

Why it matters:

  • Genealogy databases use this structure
  • Family tree reasoning requires transitive relations
  • Legal inheritance laws depend on these relationships

Example 2: Social Networks

Statement: "Everyone on Facebook has at least one friend"

Predicate logic:

∀x (OnFacebook(x) → ∃y Friend(x, y))

Contrast with: "There's someone who is friends with everyone"

∃x ∀y (OnFacebook(y) → Friend(x, y))

Real application:

  • Social network algorithms (friend recommendations)
  • Graph theory in network analysis
  • Privacy settings ("friends of friends")

2) Medical Diagnosis

Example 3: Disease Diagnosis

Medical rules:

  • "All patients with fever AND cough should be tested for flu"
  • "If a patient tests positive for strep AND has a sore throat, prescribe antibiotics"
  • "No patient allergic to penicillin should receive amoxicillin"

Predicate logic:

∀x (Fever(x) ∧ Cough(x) → TestForFlu(x))
∀x (PositiveStrep(x) ∧ SoreThroat(x) → Prescribe(antibiotics, x))
∀x (AllergicTo(x, penicillin) → ¬Prescribe(amoxicillin, x))

Real systems:

  • Expert medical systems (MYCIN was an early AI system)
  • Clinical decision support software
  • Drug interaction databases

Example 4: Symptom Reasoning

Statement: "Some patients with headaches have migraines, but not all"

Predicate logic:

∃x (Headache(x) ∧ Migraine(x))    [Some do]
∃x (Headache(x) ∧ ¬Migraine(x))   [Some don't]

Or equivalently:

¬(∀x (Headache(x) → Migraine(x)))  [Not all headaches are migraines]

3) Legal Reasoning

Example 5: Contract Law

Contract clause: "Any person who signs this agreement and is over 18 years old is legally bound by its terms"

Predicate logic:

∀x (Signs(x, agreement) ∧ Age(x) ≥ 18 → LegallyBound(x, agreement))

Contrapositive (equally valid):

∀x (¬LegallyBound(x, agreement) → ¬Signs(x, agreement) ∨ Age(x) < 18)

Real use: Contract management systems, automated legal review


Example 6: Traffic Laws

Law: "Every driver who exceeds the speed limit AND is caught by camera will receive a fine"

Predicate logic:

∀x (Driver(x) ∧ ExceedsLimit(x) ∧ CaughtOnCamera(x) → ReceivesFine(x))

Individual case:

Driver(john) ∧ ExceedsLimit(john) ∧ CaughtOnCamera(john)
∴ ReceivesFine(john)  [modus ponens]

4) E-commerce & Databases

Example 7: Amazon Product Search

Query: "Find all books under $20 that have 4+ star ratings"

Predicate logic:

∀x (Book(x) ∧ Price(x) < 20 ∧ Rating(x) ≥ 4 → InResults(x))

SQL translation:

SELECT * FROM products 
WHERE type='book' AND price < 20 AND rating >= 4;

SQL is literally applied predicate logic!


Example 8: Customer Eligibility

Business rule: "Customers who have spent over $500 in the past year OR have premium membership qualify for free shipping"

Predicate logic:

∀x (Customer(x) ∧ (AnnualSpending(x) > 500 ∨ PremiumMember(x)) 
    → QualifiesForFreeShipping(x))

5) Natural Language Ambiguity

Example 9: Scope Ambiguity

Ambiguous sentence: "Everyone loves someone"

Two interpretations:

Interpretation 1: "Each person loves at least one person (possibly different people)"

∀x ∃y Loves(x, y)

Example: Alice loves Bob, Bob loves Carol, Carol loves Dave

Interpretation 2: "There's one person loved by everyone"

∃y ∀x Loves(x, y)

Example: Everyone loves Taylor Swift

Why this matters:

  • Legal ambiguity ("all students must take a foreign language")
  • Policy interpretation
  • Understanding natural language processing

Example 10: Negation Scope

Sentence: "Not all students passed the exam"

Incorrect interpretation:

∀x (Student(x) → ¬Passed(x))  [No students passed]

Correct interpretation:

¬(∀x (Student(x) → Passed(x)))  [At least one student didn't pass]

Equivalently:

∃x (Student(x) ∧ ¬Passed(x))  [Some student failed]

6) Access Control & Security

Example 11: File Permissions

Rule: "A user can delete a file if they own it OR they have admin privileges"

Predicate logic:

∀u ∀f (User(u) ∧ File(f) ∧ (Owns(u, f) ∨ Admin(u)) → CanDelete(u, f))

Checking permission:

User(alice), File(report.pdf), Owns(alice, report.pdf)
∴ CanDelete(alice, report.pdf)

Real systems: Unix permissions, cloud storage (Dropbox, Google Drive)


Example 12: Building Access

Security policy: "Only employees with active badges can enter after 6 PM"

Predicate logic:

∀x ∀t (Employee(x) ∧ Time(t) > 18:00 → (CanEnter(x, building, t) ↔ ActiveBadge(x)))

Contrapositive use: If someone entered after 6 PM, they must have an active badge.


7) Education & Grading

Example 13: Course Prerequisites

Rule: "To enroll in Advanced AI, a student must have completed Intro to AI AND either Calculus or Linear Algebra"

Predicate logic:

∀s (CanEnroll(s, AdvancedAI) ↔ 
    Completed(s, IntroAI) ∧ (Completed(s, Calculus) ∨ Completed(s, LinearAlgebra)))

Checking eligibility:

Student(bob), Completed(bob, IntroAI), Completed(bob, Calculus)
∴ CanEnroll(bob, AdvancedAI)

Example 14: Dean's List Criteria

Rule: "Students with GPA ≥ 3.5 AND no grades below B qualify for Dean's List"

Predicate logic:

∀s (Student(s) ∧ GPA(s) ≥ 3.5 ∧ ¬∃c (Enrolled(s, c) ∧ Grade(s, c) < B) 
    → DeansList(s))

Note the nested quantifier: "no grades below B" = "there does not exist a course..."


8) Transportation & Navigation

Example 15: Flight Connections

Statement: "There's a direct flight from every major US city to at least one European city"

Predicate logic:

∀x (MajorUSCity(x) → ∃y (EuropeanCity(y) ∧ DirectFlight(x, y)))

Pathfinding: "There's a route from A to B if there's a direct flight OR a connection through some intermediate city"

∀x ∀y (Route(x, y) ↔ 
    DirectFlight(x, y) ∨ ∃z (DirectFlight(x, z) ∧ Route(z, y)))

Real application: Google Flights, airline reservation systems


9) Healthcare Policy

Example 16: Vaccination Requirements

Policy: "All children entering kindergarten must have MMR vaccine UNLESS they have a medical exemption"

Predicate logic:

∀c (Child(c) ∧ EnteringKindergarten(c) ∧ ¬MedicalExemption(c) 
    → MustHaveVaccine(c, MMR))

Contrapositive reasoning:

If a child doesn't have MMR vaccine, then either they're not entering kindergarten OR they have a medical exemption

10) Restaurant & Food Service

Example 17: Menu Restrictions

Restaurant rule: "A dish is vegetarian if it contains no meat, fish, or poultry"

Predicate logic:

∀d (Dish(d) → (Vegetarian(d) ↔ 
    ¬Contains(d, meat) ∧ ¬Contains(d, fish) ∧ ¬Contains(d, poultry)))

Allergy warnings: "Customers allergic to nuts should not order any dish containing nuts"

∀c ∀d (Customer(c) ∧ AllergicTo(c, nuts) ∧ Contains(d, nuts) 
    → ¬ShouldOrder(c, d))

11) Sports & Games

Example 18: Tournament Eligibility

Rule: "A team qualifies for playoffs if they win more than 50% of games OR they're division champions"

Predicate logic:

∀t (Team(t) → (QualifiesForPlayoffs(t) ↔ 
    WinRate(t) > 0.5 ∨ DivisionChampion(t)))

Example 19: Chess Rules

Rule: "A player is in checkmate if their king is in check AND there's no legal move that removes the check"

Predicate logic:

∀p (Player(p) → (Checkmate(p) ↔ 
    InCheck(King(p)) ∧ ¬∃m (LegalMove(m, p) ∧ RemovesCheck(m, p))))

12) Environmental Policy

Example 20: Emissions Standards

Regulation: "Any vehicle manufactured after 2020 must meet emissions standard X OR be electric"

Predicate logic:

∀v (Vehicle(v) ∧ ManufactureYear(v) > 2020 → 
    (MeetsStandard(v, X) ∨ Electric(v)))

Compliance checking:

Vehicle(car123), ManufactureYear(car123) = 2022, ¬Electric(car123)
∴ MeetsStandard(car123, X)  [must be true for compliance]

13) Human Resources

Example 21: Promotion Criteria

Company policy: "An employee is eligible for promotion if they've been with the company for 2+ years AND have received 'excellent' performance reviews AND completed leadership training"

Predicate logic:

∀e (Employee(e) → (EligibleForPromotion(e) ↔ 
    Tenure(e) ≥ 2 ∧ PerformanceReview(e, excellent) ∧ Completed(e, leadershipTraining)))

14) Cognitive Science Applications

Example 22: Categorization

Prototype theory: "Something is a bird if it has wings AND feathers AND can fly (typically)"

Classical predicate logic (oversimplified):

∀x (HasWings(x) ∧ HasFeathers(x) ∧ CanFly(x) → Bird(x))

Problem: Penguins are birds but can't fly!

This shows limitations of classical logic for natural categories → leads to fuzzy logic, prototype theory, exemplar models


Example 23: Reasoning Errors

Common fallacy: "All birds can fly. Penguins are birds. Therefore, penguins can fly."

Formal structure (valid but unsound):

∀x (Bird(x) → CanFly(x))    [FALSE premise]
Bird(penguin)               [TRUE]
∴ CanFly(penguin)          [Valid inference, but FALSE conclusion]

Lesson: Validity ≠ Truth. Predicate logic reveals structure of arguments, not truth of premises.


15) Everyday Reasoning

Example 24: Party Invitation

Statement: "I'll invite anyone who is a friend AND either likes pizza OR likes board games"

Predicate logic:

∀x (Friend(x) ∧ (Likes(x, pizza) ∨ Likes(x, boardGames)) → Invite(x))

Who gets invited?

  • Alice: friend, likes pizza ✓
  • Bob: friend, likes board games ✓
  • Carol: friend, likes both ✓
  • Dave: friend, likes neither ✗
  • Eve: not friend, likes pizza ✗

Example 25: Dating App Preferences

Profile: "Looking for someone who is kind, enjoys hiking, and lives within 50 miles"

Predicate logic:

∀x (Match(me, x) ↔ Kind(x) ∧ Enjoys(x, hiking) ∧ Distance(me, x) ≤ 50)

Real algorithms: Matching algorithms use conjunctions/disjunctions of preferences with weights


16) Complex Real-World Reasoning

Example 26: Insurance Claims

Policy: "A claim is approved if the incident is covered AND the policy was active AND all required documentation is submitted AND there's no evidence of fraud"

Predicate logic:

∀c (Claim(c) → (Approved(c) ↔ 
    Covered(Incident(c)) ∧ 
    PolicyActive(c, IncidentDate(c)) ∧
    ∀d (RequiredDoc(d, c) → Submitted(d, c)) ∧
    ¬∃e Evidence(e, fraud, c)))

Note: This includes nested quantifiers and complex conditions—real insurance systems use this!


Key Takeaways

  1. Predicate logic is everywhere – databases, legal systems, medical AI, access control
  2. Disambiguates natural language – reveals hidden structure and ambiguity
  3. Enables automated reasoning – computers can process FOL formulas
  4. Shows reasoning structure – valid vs. sound arguments
  5. Limitations exist – natural categories often need probabilistic/fuzzy logic

For cognitive science: Predicate logic is both:

  • A model of human reasoning (mental logic theory)
  • A tool for analyzing linguistic and conceptual structure
  • A benchmark showing where human reasoning differs from formal logic (cognitive biases, context effects)

Would you like me to develop any specific example further or add examples from another domain?


You'll only receive email when they publish something new.

More from prasanth
All posts