Some Explanation On Inference in FOL
Some Explanation On Inference in FOL
What It Means:
● Universal Quantification (∀ v α): This means that a statement (let's call it α) is true
for all possible values of a variable v.
● Instantiation: Taking the general statement and applying it to a specific instance (or
value) for the variable v.
Rule of UI:
If you know something is true for all values of a variable (∀), then you can infer that it is true for
any specific value of that variable.
1. Start with a universally quantified statement: ∀ v α (e.g., "For all x, something is true").
2. Replace the variable v with a specific "ground term" g (a concrete value, name, or
expression).
3. The result is a new statement that is entailed (logically follows) from the original
universal statement.
Notation:
Example Walkthrough:
Original Statement:
Now we pick specific terms for x (like "John," "Richard," or a more complex expression like
"Father(John)"):
1. Substitute x with "John": King(John) ∧ Greedy(John) ⇒ Evil(John)
○ This means: "If John is a King and John is Greedy, then John is Evil."
2. Substitute x with "Richard": King(Richard) ∧ Greedy(Richard) ⇒
Evil(Richard)
○ This means: "If Richard is a King and Richard is Greedy, then Richard is
Evil."
3. Substitute x with "Father(John)" (a more complex term): King(Father(John)) ∧
Greedy(Father(John)) ⇒ Evil(Father(John))
○ This means: "If John’s father is a King and John’s father is Greedy, then
John’s father is Evil."
Key Insights:
Why It Matters:
UI is a fundamental rule in logic and reasoning, enabling us to apply general principles (like laws
or rules) to specific situations or individuals.
P2
What it Means:
● Existential Quantification (∃ v α): This means that there exists at least one value for
the variable v that makes the statement α true.
● Instantiation: Taking the general statement (which claims something exists) and
replacing the variable with a specific, new constant symbol to represent the thing that
exists.
Rule of EI:
Notation:
Example Walkthrough:
1. First Example:
● This says: "There exists an x such that x is a Crown and x is on John's head."
Applying EI:
2. Second Example:
∃ x (d(x^y)/dy = x^y)
● This says: "There exists an x such that the derivative of x^y with respect to y
equals x^y."
Applying EI:
Key Insights:
Why It Matters:
Example of UI:
Result:
1. EI replaces the existential claim (∃) with a specific assumption (e.g., using a Skolem
constant).
2. The original KB stated that "something exists" without specifying what it is.
3. The new KB assumes that this "something" is a specific thing, which is logically
stronger than the original claim.
Example of EI:
● The new KB is not logically equivalent to the original because we added a specific
assumption.
● However, the new KB is satisfiable if and only if the original KB was satisfiable:
○ If there was some crown satisfying the original claim, then C1 satisfies the new
KB.
Inferential Equivalence:
Both UI and EI allow us to make inferences that are valid in the original KB:
While the KBs differ (due to EI not preserving equivalence), the inferences we can draw remain
consistent, provided we reason correctly within the rules.
1. Reduction to Propositional Inference
● What it means:
○We take a knowledge base (KB) that contains first-order logic (FOL) sentences
(with quantifiers, variables, predicates, etc.) and convert it into a KB that uses
only propositional symbols (statements about specific entities without
variables).
○ This process involves instantiating universal statements (via UI) and treating the
resulting sentences as propositional facts.
● Why do this?
1. King(John)
2. Greedy(John)
3. Brother(Richard, John)
4. King(John) ∧ Greedy(John) ⇒ Evil(John)
5. King(Richard) ∧ Greedy(Richard) ⇒ Evil(Richard)
5. Propositionalization
1. P1 (John is a King)
2. P2 (John is Greedy)
3. P6 (Richard is John’s brother)
4. P1 ∧ P2 ⇒ P3 (If John is a King and Greedy, then he is Evil)
5. P4 ∧ P5 ⇒ P7 (If Richard is a King and Greedy, then he is Evil)
● The original FOL KB contained quantifiers (∀), variables (x), and predicates (King(x)).
● After propositionalization, the KB uses only propositional symbols (P1, P2, etc.),
simplifying inference to propositional logic techniques.
● Caveat: This approach may cause an explosion of propositions if the domain (set of
constants) is large.
7. Final Result:
● The new KB contains only propositional sentences, which can be evaluated using truth
tables or resolution.
● All reasoning becomes purely propositional, allowing for simpler computational methods.
1. Claim: A Ground Sentence is Entailed by the New KB if and only if it is
Entailed by the Original KB
○ For any FOL KB, you can always convert it into an equivalent propositional KB
that preserves entailment. In other words:
■ If the original FOL KB entails a query α, the propositionalized KB will also
entail α.
● Why Propositionalization Helps:
○ Propositional logic is simpler than FOL and can use efficient algorithms like
resolution to answer queries.
● What it says:
1. For n = 0 to ∞:
○ Generate a propositional KB by instantiating terms with depth n.
○ Check if α (the query) is entailed by this KB.
2. If α is entailed: Stop and return the result.
3. If α is not entailed: Keep increasing n.
● The Problem:
○ If α is not entailed by the KB, this process will never terminate (it "loops"
forever).
○ If the FOL KB does entail a query α, the process will eventually find a proof.
○ However, if the FOL KB does not entail α, the process may never terminate.
● Why this happens:
Key Takeaways:
Example Breakdown:
○ "John is a King."
3. ∀ y Greedy(y)
○ "Everyone is Greedy."
4. Brother(Richard, John)
Intuitive Conclusion:
The other facts, like Greedy(Richard) or Brother(Richard, John), are irrelevant to the
query Evil(John).
We ground the universal statements by substituting all possible constants into the predicates.
● Irrelevant facts: For a specific query (e.g., Evil(John)), many generated sentences
(like Greedy(Richard)) don't contribute to answering it.
● Computational cost: The grounding process wastes time and resources by instantiating
predicates that don't matter to the query.
How to Address This Problem
2. Unification
● Instead of grounding all possible terms, use unification to substitute terms dynamically
during inference. This avoids generating irrelevant facts.
3. Smart Instantiation
4. Resolution in FOL
● Use first-order resolution directly without propositionalizing the entire KB, keeping the
representation compact and focused.
Summary
● What it is:
○ Unification is the process of finding a substitution 𝜃 (a set of variable
assignments) that makes two logical expressions (predicates) identical.
● What substitution 𝜃 does:
○ A substitution replaces variables in a predicate with constants, other variables, or
functions.
○ Example: If 𝜃={𝑥/𝐽𝑜ℎ𝑛,𝑦/𝐽𝑎𝑛𝑒}, then:
■ 𝐾𝑛𝑜𝑤𝑠(𝑥,𝑦) becomes 𝐾𝑛𝑜𝑤𝑠(𝐽𝑜ℎ𝑛,𝐽𝑎𝑛𝑒).
● Formal definition of unification:
○ Two expressions 𝛼 and 𝛽 unify if there exists a substitution 𝜃 such
that:𝑆𝑈𝐵𝑆𝑇(𝜃,𝛼)=𝑆𝑈𝐵𝑆𝑇(𝜃,𝛽)
○ 𝜃 is called the unifier.
The task is to unify two predicates, 𝑝 and 𝑞, by finding a substitution 𝜃. Let’s analyze the
examples provided:
4. Applications of Unification
Unification is a foundational concept in automated reasoning and forms the basis for logical
inference systems like Prolog.
Explanation of Generalized Modus Ponens (GMP)
Generalized Modus Ponens (GMP) is an extension of the classical Modus Ponens rule in
propositional logic. It applies in the context of First-Order Logic (FOL), where predicates
contain variables. GMP allows inference by matching facts with universally quantified rules
through substitutions.
● Input:
○ A set of facts 𝑝1′,𝑝2′,…,𝑝𝑛′.
○ A universally quantified rule: 𝑝1∧𝑝2∧…∧𝑝𝑛⇒𝑞.
● Process:
○ Find a substitution 𝜃 that makes the rule’s antecedent 𝑝1,…,𝑝𝑛 match the facts
𝑝1′,…,𝑝𝑛′.
● Output:
○ The conclusion 𝑞, instantiated with 𝜃, written as 𝑞𝜃.
● Rule: 𝑝1∧𝑝2⇒𝑞
○ 𝑝1=𝐾𝑖𝑛𝑔(𝑥)
○ 𝑝2=𝐺𝑟𝑒𝑒𝑑𝑦(𝑥)
○ 𝑞=𝐸𝑣𝑖𝑙(𝑥)
● Facts:
○ 𝑝1′=𝐾𝑖𝑛𝑔(𝐽𝑜ℎ𝑛)
○ 𝑝2′=𝐺𝑟𝑒𝑒𝑑𝑦(𝐽𝑜ℎ𝑛)
● Substitution 𝜃={𝑥/𝐽𝑜ℎ𝑛,𝑦/𝐽𝑜ℎ𝑛} makes:
○ 𝑝1′𝜃=𝑝1𝜃=𝐾𝑖𝑛𝑔(𝐽𝑜ℎ𝑛),
○ 𝑝2′𝜃=𝑝2𝜃=𝐺𝑟𝑒𝑒𝑑𝑦(𝐽𝑜ℎ𝑛).
● Conclusion:
○ 𝑞𝜃=𝐸𝑣𝑖𝑙(𝐽𝑜ℎ𝑛).
Soundness of GMP
GMP is sound, meaning the conclusion 𝑞𝜃 is logically entailed by the given facts and rule. The
proof ensures this through three steps:
● The facts 𝑝1′,…,𝑝𝑛′ are true, so their conjunction 𝑝1′∧…∧𝑝𝑛′ is also true.
● Since 𝑝𝑖′𝜃=𝑝𝑖𝜃 for all 𝑖, we conclude:𝑝1′𝜃∧…∧𝑝𝑛′𝜃=𝑝1𝜃∧…∧𝑝𝑛𝜃.
● From Step 1 (substituted rule) and Step 2 (matching facts), we can apply the classical
Modus Ponens:(𝑝1𝜃∧…∧𝑝𝑛𝜃⇒𝑞𝜃),(𝑝1𝜃∧…∧𝑝𝑛𝜃)⊨𝑞𝜃.
● This concludes that 𝑞𝜃 is true, which in this example is 𝐸𝑣𝑖𝑙(𝐽𝑜ℎ𝑛).
1. Definite Clauses:
○ A clause with exactly one positive literal (e.g., 𝑝1∧𝑝2⇒𝑞).
○ All variables are assumed to be universally quantified.
2. Substitution 𝜃:
○ A mapping of variables to constants, variables, or function terms that makes
predicates match.
3. Unification:
○ The process of finding 𝜃 such that 𝑝𝑖′𝜃=𝑝𝑖𝜃.
4. Universal Instantiation (UI):
○ Replacing universally quantified variables with specific constants or terms.
Example Recap
● Rule: 𝐾𝑖𝑛𝑔(𝑥)∧𝐺𝑟𝑒𝑒𝑑𝑦(𝑥)⇒𝐸𝑣𝑖𝑙(𝑥).
● Facts: 𝐾𝑖𝑛𝑔(𝐽𝑜ℎ𝑛),𝐺𝑟𝑒𝑒𝑑𝑦(𝐽𝑜ℎ𝑛).
● Substitution: 𝜃={𝑥/𝐽𝑜ℎ𝑛}.
● Conclusion: 𝐸𝑣𝑖𝑙(𝐽𝑜ℎ𝑛).