Inference in First-Order Logic
Inference in First-Order Logic
Inference in First-Order Logic is used to deduce new facts or sentences from existing
sentences. Before understanding the FOL inference rule, let's understand some basic
terminologies used in FOL.
Substitution:
Equality:
First-Order logic does not only use predicate and terms for making atomic sentences but also
uses another way, which is equality in FOL. For this, we can use equality symbols which
specify that the two terms refer to the same object.
As propositional logic we also have inference rules in first-order logic, so following are some
basic inference rules in FOL:
1. Universal Generalization
2. Universal Instantiation
3. Existential Instantiation
4. Existential introduction
1. Universal Generalization:
• Universal generalization is a valid inference rule which states that if premise P(c) is true
for any arbitrary element c in the universe of discourse, then we can have a conclusion as
∀ x P(x).
• It can be represented as
• This rule can be used if we want to show that every element has a similar property.
• Example: Let's represent, P(c): "A byte contains 8 bits", so for ∀ x P(x) "All bytes contain
8 bits.", it will also be true.
2. Universal Instantiation:
• As per UI, we can infer any sentence obtained by substituting a ground term for the
variable.
• The UI rule state that we can infer any sentence P(c) by substituting a ground term c (a
constant within domain x) from ∀ x P(x) for any object in the universe of discourse.
Example:1.
IF "Every person like ice-cream"=> ∀x P(x) so we can infer that
"John likes ice-cream" => P(c)
Example: 2.
"All kings who are greedy are Evil." So let our knowledge base contains this detail as in the
form of FOL:
So from this information, we can infer any of the following statements using Universal
Instantiation:
• The new KB is not logically equivalent to old KB, but it will be satisfiable if old KB was
satisfiable.
• This rule states that one can infer P(c) from the formula given in the form of ∃x P(x) for
a new constant symbol c.
• The restriction with this rule is that c used in the rule must be a new term for which P(c )
is true.
So we can infer: Crown(K) ∧ OnHead( K, John), as long as K does not appear in the
knowledge base.
This rule states that if there is some element c in the universe of discourse which has a
property P, then we can infer that there exists something in the universe which has the
property P.
For the inference process in FOL, we have a single inference rule which is called
Generalized Modus Ponens. It is lifted version of Modus ponens.
Generalized Modus Ponens can be summarized as, " P implies Q and P is asserted to be
true, therefore Q must be True.“
Example:
• It takes two literals as input and makes them identical using substitution.
• Let Ψ1 and Ψ2 be two atomic sentences and 𝜎 be a unifier such that, Ψ1𝜎 = Ψ2𝜎, then it
can be expressed as UNIFY(Ψ1, Ψ2).
• Substitution θ = {John/x} is a unifier for these atoms and applying this substitution, and
both expressions will be identical.
• The UNIFY algorithm is used for unification, which takes two atomic sentences and
returns a unifier for those sentences (If any exist).
E.g. Let's say there are two different expressions, P(x, y), and P(a, f(z)).
In this example, we need to make both above statements identical to each other. For this,
we will perform the substitution.
Substitute x with a, and y with f(z) in the first expression, and it will be represented
as a/x and f(z)/y.
With both the substitutions, the first expression will be identical to the second expression
and the substitution set will be: [a/x, f(z)/y].
Conditions for Unification:
• Predicate symbol must be same, atoms or expression with different predicate symbol
can never be unified.
• Unification will fail if there are two similar variables present in the same expression.
1. Find the MGU of {p(f(a), g(Y)) and p(X, X)}
SUBST θ= {f(a) / X}
SUBST θ={b/Z}