Predicate Logic

From BloomWiki
Revision as of 01:56, 25 April 2026 by Wordpad (talk | contribs) (BloomWiki: Predicate Logic)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

How to read this page: This article maps the topic from beginner to expert across six levels � Remembering, Understanding, Applying, Analyzing, Evaluating, and Creating. Scan the headings to see the full scope, then read from wherever your knowledge starts to feel uncertain. Learn more about how BloomWiki works ?

Predicate Logic (or First-Order Logic) is the "Upgrade" to propositional logic that allows us to talk about "Objects" and "Properties." While propositional logic can only handle whole sentences (P or Q), predicate logic can "Look inside" the sentence to see the relationship between things. It uses "Quantifiers" to make statements like "All humans are mortal" or "There is at least one planet with life." It is the language of modern "Mathematics," "Databases," and "AI Knowledge Representation." By moving from "Simple Statements" to "Complex Relationships," predicate logic gives us a powerful tool to describe the entire universe in a single, consistent language.

Remembering

  • Predicate Logic — A system of logic that uses predicates and quantifiers to describe properties and relationships.
  • Predicate — A property or relation (e.g., in "P(x)", P might mean "Is a Cat").
  • Universal Quantifier (∀, "For All"): A statement that is true for EVERY object in a group (e.g., ∀x P(x) = "Everything is a cat").
  • Existential Quantifier (∃, "There Exists"): A statement that is true for AT LEAST ONE object (e.g., ∃x P(x) = "There is at least one cat").
  • Variable (x, y, z): A placeholder for an object in the universe.
  • Constant (a, b, c): A specific, named object (e.g., "Socrates").
  • Domain of Discourse — The "World" of objects we are talking about (e.g., "The set of all animals").
  • First-Order Logic — A system where we can talk about "Objects," but not about "Properties of Properties" (which would be Higher-Order logic).
  • Arity — The number of objects a predicate takes (e.g., "Is_Red(x)" has arity 1; "Is_Brother_Of(x, y)" has arity 2).
  • Inference — The process of deriving a new true statement from existing ones (e.g., "If all humans are mortal, and Socrates is human, then Socrates is mortal").

Understanding

Predicate logic is understood through Quantification and Relationships.

1. The Power of "All" and "Some": Propositional logic is too "Small" for most math.

  • You can't say "All numbers are even" with simple P and Q.
  • Predicate logic allows you to "Loop" over a whole world.
  • **∀x (Even(x))**: This statement is only true if every single 'x' in the world is even.
  • This allows us to write "General Rules" rather than just "Individual Facts."

2. Relationships (Relations): Predicate logic can describe "Graphs" and "Connections."

  • **Likes(x, y)**: This is a relationship between two people.
  • We can say complex things like: "There is someone (x) who is liked by everyone (y)."
  • **∃x ∀y Likes(y, x)**.
  • This is the foundation of "SQL Databases"—every query you run on a database is actually a statement in predicate logic.

3. The "Scope" of a Variable: Variables are "Bound" by their quantifiers.

  • Just like in programming, a variable 'x' inside a "For Each" loop only exists inside that loop.
  • Logic allows us to "Nests" these loops to create incredibly complex descriptions of reality.

The 'Syllogism' Upgrade': Aristotle's famous "Socrates is mortal" logic was actually the very first (and simplest) form of predicate logic. It took 2,000 years for Gottlob Frege to add the "Quantifiers" (∀ and ∃) to turn it into the "Full Version" we use today.

Applying

Modeling 'The Database Query' (Translating English into Predicate Logic): <syntaxhighlight lang="python"> def evaluate_predicate(domain, predicate_func, quantifier):

   """
   Simulates ∀ and ∃ logic.
   """
   results = [predicate_func(obj) for obj in domain]
   
   if quantifier == "ALL": # ∀
       return all(results)
   elif quantifier == "EXISTS": # ∃
       return any(results)
       
   return None
  1. World: [1, 2, 3, 4] | Predicate: "Is even?"

numbers = [1, 2, 3, 4] is_even = lambda x: x % 2 == 0

  1. Check: "Are ALL numbers even?" (∀x Even(x))

print(f"∀x Even(x): {evaluate_predicate(numbers, is_even, 'ALL')}")

  1. Check: "Is there SOME number that is even?" (∃x Even(x))

print(f"∃x Even(x): {evaluate_predicate(numbers, is_even, 'EXISTS')}") </syntaxhighlight>

Logic Landmarks
Begriffsschrift (1879) → Gottlob Frege's book that "Invented" modern predicate logic, often called the "Most important work in logic since Aristotle."
Principia Mathematica (1910) → Russell and Whitehead's attempt to derive all of math from pure predicate logic (a massive task that took 2,000 pages).
SQL (1974) → The standard language for databases, which is literally just "Predicate Logic in a Suit."
Prolog (1972) → The first "Logic Programming Language," where you don't write "Steps," you just write "Facts and Rules" in predicate logic, and the computer finds the answer for you.

Analyzing

Propositional vs. Predicate Logic
Feature Propositional (Small) Predicate (Big)
Basic Unit The Sentence (P) The Object and Property (P(x))
Scope Single facts General rules (All / Some)
Complexity Low (Calculated with Truth Tables) High (Often "Un-calculable")
Analogy A 'Calculator' A 'Programming Language'

The Concept of "Bound" vs. "Free" Variables: Analyzing why variables can be confusing. A variable is Bound if it is inside a quantifier (like 'x' in ∀x). A variable is Free if it is just a "Hole" in the sentence. Predicate logic is only "True or False" if all its variables are bound—otherwise, it's just a "Formula."

Evaluating

Evaluating predicate logic:

  1. The "Decidability" Problem: Unlike propositional logic, you can't always "Calculate" if a predicate statement is true. Alan Turing proved that some problems in predicate logic are "Un-solvable" by any computer.
  2. Higher-Order Logic: Predicate logic can't talk about "Properties of Properties" (e.g., "Kindness is a Virtue"). Does this mean it's "Too weak" to describe human life?
  3. Natural Language: Humans say "Most people like pizza." Predicate logic only has "All" or "Some." It doesn't have a symbol for "Most."
  4. Complexity: As soon as you add a few variables (x, y, z), the number of possible "Worlds" explodes, making it very hard for AIs to "Reason" using pure logic alone.

Creating

Future Frontiers:

  1. Knowledge Graphs: Using predicate logic to connect all the data on the internet (The "Semantic Web") so AIs can truly "Understand" the relationships between people and things.
  2. Formal Verification: Using predicate logic to "Prove" that the code in a self-driving car or a nuclear reactor is 100% safe before it is ever turned on.
  3. Neuro-Symbolic AI: Merging "Neural Networks" (which are good at seeing patterns) with "Predicate Logic" (which is good at following rules) to create the next generation of AI.
  4. Computational Law: Turning the "Laws of a Country" into predicate logic so that contracts can be "Executed" automatically by a computer without needing a lawyer.