First-Order Logic in Artificial Intelligence
First-Order Logic in Artificial Intelligence
First-Order logic:
a. Syntax
b. Semantics
Variables x, y, z, a, b,....
Connectives ∧, ∨, ¬, ⇒, ⇔
Equality ==
Quantifier ∀, ∃
Atomic sentences:
Complex Sentences:
o For all x
o For each x
o For every x.
Example:
It will be read as: There are all x where x is a man who drink coffee.
Existential Quantifier:
Example:
Properties of Quantifiers:
Inference engine:
1. Forward chaining
2. Backward chaining
Horn clause and definite clause are the forms of sentences, which
enables knowledge base to use a more restricted and efficient
inference algorithm. Logical inference algorithms use forward and
backward chaining approaches, which require KB in the form of
the first-order definite clause.
Definite clause: A clause which is a disjunction of literals
with exactly one positive literal is known as a definite clause or strict
horn clause.
It is equivalent to p ∧ q → k.
A. Forward Chaining
Example:
To solve the above problem, first, we will convert all the above facts
into first-order definite clauses, and then we will use a forward-
chaining algorithm to reach the goal.
Step-1:
In the first step we will start with the known facts and will choose the
sentences which do not have implications, such
as: American(Robert), Enemy(A, America), Owns(A, T1), and
Missile(T1). All these facts will be represented as below.
Step-2:
At the second step, we will see those facts which infer from available
facts and with satisfied premises.
Rule-(1) does not satisfy premises, so it will not be added in the first
iteration.
Step-3:
At step-3, as we can check Rule-(1) is satisfied with the
substitution {p/Robert, q/T1, r/A}, so we can add
Criminal(Robert) which infers all the available facts. And hence we
reached our goal statement.
B. Backward Chaining:
Example:
Backward-Chaining proof:
Step-1:
At the first step, we will take the goal fact. And from the goal fact, we
will infer other facts, and at last, we will prove those facts true. So our
goal fact is "Robert is Criminal," so following is the predicate of it.
Step-2:
At the second step, we will infer other facts form goal fact which
satisfies the rules. So as we can see in Rule-1, the goal predicate
Criminal (Robert) is present with substitution {Robert/P}. So we will
add all the conjunctive facts below the first level and will replace p
with Robert.
Step-4:
At step-4, we can infer facts Missile(T1) and Owns(A, T1) form
Sells(Robert, T1, r) which satisfies the Rule- 4, with the substitution
of A in place of r. So these two statements are proved here.
Step-5: