FOPL
FOPL
Universal Quantifier:
Universal quantifier is a symbol of logical representation, which specifies that the
statement within its range is true for everything or every instance of a particular thing.
The Universal quantifier is represented by a symbol ∀, which resembles an inverted A.
Those which produce a proposition when their symbols are interpreted must follow the rules given below, and they
are called wffs(well-formed formulas) of the first order predicate logic.
A predicate name followed by a list of variables such as P(x, y), where P is a predicate name, and
x and y are variables, is called an atomic formula.
One way to check whether or not an expression is a wff is to try to state it in English. If you
can translate it into a correct English sentence, then it is a wff.
.
More examples: To express the fact that Tom is taller than John, we can use the
atomic formula taller(Tom, John), which is a wff. This wff can also be part of some
compound statement such as taller(Tom, John) &~ taller(John, Tom), which is also
a wff.
However, taller(∀x ,John) and taller(Tom V Mary, Jim), for example, are NOT wffs
Inference in First-Order Logic
1. Modus Ponen
2. Chain Rule
3. Substitution
4. Equivalence
FOL inference rules for quantifier:
As propositional logic we also have inference rules in first-order logic, so following are some basic inference rules in
FOL:
Universal Generalization
Universal Instantiation
Existential Instantiation
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: Inference in First-Order Logic.
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:
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.
It can be represented as
Example:1.
3. Existential Instantiation:
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.
It can be represented as:
4. Existential introduction
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.
Example: Let's say that,
"Priyanka got good marks in English."
"Therefore, someone got good marks in English."
Conversion to Clause Form
One method for Inferencing is Resolution. It requires that all the statements be
converted into normalized clausal form. A clause is disjunction of number of literal
PROCEDURE
1. Eliminate logical implications,->, using the fact that A -> B is equivalent to ¬A ∨ B.
2. Reduce the scope of each negation to a single term, using the following facts:
¬(¬P) = P
¬(A ∨ B) = ¬A ∧ ¬B
¬(A ∧ B) = ¬A V ¬B
¬∀xP(x) = ∃x¬P(x)
¬∃x P(x) = ∀x ¬P(x)
3.Standardize variables so that each quantifier binds a unique variable.
4. Skolemize by replacing all existentially quantified variable with skolem functions and
delete corresponding existential quantifier.
SKOLEMIZATION:
1. If the leftmost quantifier in an expression is existential quantifier ,replace all
occurrences of the variable it quantifies with a constant not appearing elsewhere in
the expression and delete the quantifier. Follow the same procedure for all
existential quantifier preceded by Universal quantifier.
2. For each existential quantifier that is preceded by one or more universal quantifier ,
replace all occurrences of existentially quantified variable by a function symbol not
appearing elsewhere in the expression
6. Eliminate all existential quantifiers, using Skolem functions (functions of the preceding
universally quantified variables) and Conjunctions. The resultant expression are clauses and
set of such expression is said to be in Clausal form
Simplify
∀Y (~∀X (taller(Y,X) V wise(X)) V wise(Y))
Move negations in
∀Y (∃X (~taller(Y,X) & ~wise(X)) V wise(Y))
Skolemize
Replacing X of Existential quantifier with g(y)
Vy(~taller(Y,g(Y)) & ~wise(g(Y))) V wise(Y)
Distribute disjunctions
(P & Q) V R can be written as (P V R) & (Q V R)
Convet to CNF
(~taller(Y,g(Y)) V wise(Y) & (~wise(x(Y)) V wise(Y))
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.
P(x, y)......... (i)
P(a, f(z))......... (ii)
•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:
Following are some basic conditions for unification:
•Predicate symbol must be same, atoms or expression with different predicate symbol can
never be unified.
•Number of Arguments in both expressions must be identical.
•Unification will fail if there are two similar variables present in the same expression.
Algorithm
Lkes (steve,easycourse)
Vx Sciencecourse(x)->~easy(x)
Vx Course(x, Humaniities)-> easy(x)
Course(HM101, Humanities)
~likes(steve,HM101)
(a)Marcus was a man.
(b) Marcus was a Roman.
(c) All men are people.
(d) Caesar was a ruler.
(e) All Romans were either loyal to Caesar or
hated him
(f) Everyone is loyal to someone.
(g) People only try to assassinate rulers they are
not loyal to.
(h) Marcus tried to assassinate Caesar.
PT Marcus hates Ceaser
(a)man(marcus)
(b) roman(marcus)
(c) VX. man(X) -> person(X)
(d) ruler(caesar)
(e) VX. roman(x) -> loyal(X,caesar) V hate(X,caesar)
(f) Vx∃y loyal(X,Y)
(g) VxVy person(X) & ruler(Y)&tryassasin(X,Y) ->~loyal(X,Y)
(h) tryassasin(marcus,caesar)
~Man(x) V People(x)
~Roman(x)V Loyal(x,ceaser)V Hate (x,ceaser)
~people(x) V ~ruler (y) V ~tryassasinate(x,y)V ~loyal(x,y)
man(marcus)
roman(marcus)
P T ~hate(Marcus ,Ceaser)
Example of FOPL resolution
Consider the following knowledge base:
1.Gita likes all kinds of food.
2.Mango and chapati are food.
3.Gita eats almond and is still alive.
4.Anyone alive is not killed
5. Anyone not killed is alive.
Goal: Gita likes almond.
Solution: Convert the given sentences into FOPL as:
¬food(x) V likes(Gita, x)
food(Mango)V food(chapati)
¬eats(x,y) V killed(x) V food(y)
eats(Gita, almonds)V alive(Gita)
killed(x) V alive(x)
¬alive(x) V ¬killed(x)
An inference is a process of drawing conclusions based on the evidence
Types of Inference
There are two basic types of inference:
a. Abductive (or “deductive inference”) is an inference based on logical certainty. It usually starts
from a general principle and then infers something about specific cases.
This allows you to infer that grapes are poisonous for your dog, too. If the premise is true then the
conclusion has to be true. There’s no other possibility. Notice, however, that this doesn’t really tell
you anything new: once you say “grapes are poisonous to all dogs,” you already know that grapes
are poisonous for your specific dog. Deduction has the advantage of certainty, but it doesn’t
generate new knowledge.
Induction (or “inductive inference”) is an inference based on probability. It usually starts from specific
information and then infers the more general principle.
“For the last two years, Amanda has woken up at 8am every day”
This allows you to infer that Amanda will probably wake up at 8am tomorrow, too. You would probably be
right, and it’s a reasonable inference but it’s not certain! Tomorrow could be the first day that Amanda
decides to sleep in. Despite this uncertainty, however, induction does offer the possibility of predicting
future events and creating new knowledge.
Analogical Inference- It is a form of experiential inference Situation or entities alike in some
respect can be similar in other respects Example if we know to solve a equation with 2 unknowns
we can extend the method to solve an equation with 3 unknowns
TYPES OF RESOLUTION
1. BINARY RESOLUTION – Two clauses having complimentary literals are combined as disjunct to
produce a single clause after deleting complementary literals
Ex ~P(x,a) V Q (x) and ~Q(b) V R(x)
is ~P(b,a) V R(b)
2. UNIT RESOLUTION - a number of clauses are resolved simultaneously to produce a unit clause
Ex: (~married (x,y) V ~ mother(x,z) V Father (y,z), married(sue,joe), ~father(joe,bill)
After substituting sue/x, joe/y, bill/z
Unit clause is ~mother(sue,bill)
3. LINEAR RESOLUTION When each resolved clause Ci is a parent to the clause Ci+1 (i=1,2,3,…n)
the process is called linear Resolution
Example:
1.John likes all kind of food.
2.Apple and vegetable are food
3.Anything anyone eats and not killed is food.
4.Anil eats peanuts and still alive
5.Harry eats everything that Anil eats.
6.Anyone not killed is alive and vice versa
Prove by resolution that:
7.John likes peanuts.
Step-1: Conversion of Facts into FOL
In the first step we will convert all the given statements into its first order logic.
Step-2: Conversion of FOL into CNF
In First order logic resolution, it is required to convert the FOL into CNF as CNF
form makes easier for resolution proofs.
•Eliminate all implication (→) and rewrite
• ∀x ¬ food(x) V likes(John, x)
• food(Apple) Λ food(vegetables)
• ∀x ∀y ¬ [eats(x, y) Λ ¬ killed(x)] V food(y)
• eats (Anil, Peanuts) Λ alive(Anil)
• ∀x ¬ eats(Anil, x) V eats(Harry, x)
• ∀x¬ [¬ killed(x) ] V alive(x)
• ∀x ¬ alive(x) V ¬ killed(x)
likes(John, Peanuts).