0% found this document useful (0 votes)
1 views32 pages

Module 4

This document discusses First Order Logic (FOL) as a more expressive representation language compared to propositional logic, highlighting its ability to represent complex relationships and facts about objects in the universe. It covers the syntax and semantics of FOL, the differences between FOL and propositional logic, and includes examples of inference, unification, and applications in domains like the Wumpus world. Additionally, it outlines various algorithms such as forward and backward chaining, and poses questions for further exploration of FOL concepts.

Uploaded by

dr9741372168
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views32 pages

Module 4

This document discusses First Order Logic (FOL) as a more expressive representation language compared to propositional logic, highlighting its ability to represent complex relationships and facts about objects in the universe. It covers the syntax and semantics of FOL, the differences between FOL and propositional logic, and includes examples of inference, unification, and applications in domains like the Wumpus world. Additionally, it outlines various algorithms such as forward and backward chaining, and poses questions for further exploration of FOL concepts.

Uploaded by

dr9741372168
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Module 4

First Order Logic


Representation Revisited:
• In this section, we discuss the nature of representation languages. Our
discussion motivates the development of first-order logic, a much more
expressive language than the propositional logic.
• Programming languages (such as C++ or Java or Lisp) are by far the largest
class of formal languages in common use. Data structures within programs
can represent facts; for example, a program could use a 4 × 4 array to
represent the contents of the Wumpus world.
• Thus, the programming language statement World [2,2] ← Pit is a fairly
natural way to assert that there is a pit in a square [2,2].

Drawback of Propositional Logic:


• Propositional logic is very simple & declarative, in which knowledge and
inference are separate, and inference is entirely domain independent.

• Propositional logic has lack of data structure in programming.

• Propositional logic is not sufficient for complex or natural language


sentences.
o Eg: Some students in the class are intelligent

• Propositional logic has very limited expressive power


o Eg: cannot say “pits cause breezes in adjacent squares” except by
writing one sentence for each square.

First Order Logic:


• First Order Logic is also known as Predicate Logic or First Order Predicate
Logic.
• First Order Logic, like natural language has well defined syntax and
semantics.
• It assumes the world contains
o Objects: people, houses, numbers, colors, baseball games, wars, …..
o Relations: red, round prime, brother of, bigger than, part of, comes
between,….
o Functions: father of, best friend, one more than, plus,…

Properties of FOL
• It has ability to represent the facts about some or all of the objects and
relations in the universe.
• Represent law & rules extracted from real world.
• Useful language for maths, philosophy and AI
• Represents facts in realistic manner rather than just true/false
• Makes ontological commitment.

Difference between First Order Logic & Positional Logic:

The primary difference between propositional and first-order logic lies in the
ontological commitment made by each language—that is, what it assumes about
the nature of reality.
Mathematically, this commitment is expressed through the nature of the formal
models with respect to which the truth of sentences is defined.

• For example, propositional logic assumes that there are facts that either
hold or do not hold in the world. Each fact can be in one of two states:
true or false, and each model assigns true or false to each proposition
symbol.
• First-order logic assumes more; namely, that the world consists of objects
with certain relations among them that do or do not hold.
• Temporal logic assumes that facts hold at particular times and that those
times (which may be points or intervals) are ordered.
• Higher-order logic views the relations and functions referred to by first-
order logic as objects in themselves.

Logic can also be characterized by its epistemological commitments—the


possible states of knowledge that it allows with respect to each fact.
Systems using probability theory, on the other hand, can have any degree of
belief, ranging from 0 (total disbelief) to 1 (total belief).

Syntax and Semantics of First Order Logic:


Syntax of FOL

Following are the basic elements of first order logic

Semantics of FOL
I) Models for first order logic
ii) Atomic Sentence

iii) Complex sentence


iV) Quantifiers in FOL

a) Universal quantifiers
Example

b) Existential Quantifier
Example

Points to remember:
Properties of Quantifier:

Equality

Example1:
Example 2

Example 3:
Using First Order Logic

i) Assertion & Queries


ii) The kinship Domain

iii) Sets
iV) The Wumpus World:

Wumpus agent receives a percept vector with five elements. The typical percept
sentence is as given below:

Percept ([Stench, Breeze, Glitter, None, None], 5)

That gets stored along with the time it occurred, to avoid confusing the agent.

• The possible actions taken in response :


Turn(Right), Turn(Left ), Forward , Shoot , Grab, Climb.

• Ask the agent program what to do using a query:


ASKVARS(∃ a BestAction(a, 5))

The query could return a binding list like:


{a/Grab}
The program could return Grab as the action to take.

• The raw percept data implies certain facts about the current state
example:
∀ t, s, g, m, c Percept ([s, Breeze, g, m, c], t) ⇒ Breeze(t) ,
∀ t, s, b, m, c Percept([s, b, Glitter , m, c], t) ⇒ Glitter (t) ,…….

• These rules exhibit a trivial form of the reasoning process called perception

• Simple “reflex” behavior can also be implemented by quantified implication


sentences.
Example: ∀ t Glitter (t) ⇒ BestAction(Grab, t)

• What about the representing the environment?


Representing adjacent squares:
∀ x, y, a, b Adjacent([x, y], [a, b]) ⇔
(x = a ∧ (y = b − 1 ∨ y = b + 1)) ∨ (y = b ∧ (x = a − 1 ∨ x = a + 1))

• The agent’s location changes over time


At(Agent , s, t) to mean that the agent is at square s at time t

• Fix the Wumpus’s location with


∀t At(Wumpus, [2, 2], t)
• objects can only be at one location at a time
∀ x, s1, s2,t At(x, s1, t) ∧ At(x, s2, t) ⇒ s1 = s2

• If the agent is at a square and perceives a breeze, then that square is breezy
∀ s, t At(Agent , s, t) ∧ Breeze(t) ⇒ Breezy (s)

• First-order logic just needs one axiom to deduce where the pits are :
∀ s Breezy (s) ⇔ ∃ r Adjacent (r, s) ∧ Pit(r)

• The axiom for the arrow


∀ t HaveArrow (t + 1) ⇔ (HaveArrow (t) ∧ ¬Action(Shoot , t))

Inference in First Order Logic:

What is Inference:

Examples of Inference:
First Order Inference:

Steps to generate Inferences from First-Order-Logic Statements:

Inference Rules for Quantifiers:

1.Universal Instantiation:
2.Existential Instantiation:

Reducing FOL to Propositional Inference:


(Converting FOL to Propositional Logic)
Disadvantages:

Unification:

• Unification is the process used to find substitutions that make


different First Order Logical expressions look identical.

• Unification is a key component of all first-order Inference


algorithms.

• UNIFY(p,q) = θ
Where SUBST (θ,p) = SUBST (θ, q)

• Θ is our unifier value(if one exist)


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.

Examples:

1) UNIFY (knows (John, x), Knows (John, Jane))

Θ = {x / Jane}

2) UNIFY (knows (John, x), Knows (y, Bill))

Θ = { x/Bill, y/John}

3) UNIFY (Knows (John, x), Knows (y, Mother(y)))

Θ = {x/Mother (John), y/John}

4) UNIFY (Knows (John,x), Knows (x, Elizabeth))

Θ = FAIL

To avoid this, change the variables x to y in Knows (x, Elizabeth) to


Knows(y, Elizabeth). It still means the same. This is called
Standardizing.
Θ = {x/Elizabeth, y/ John}
Unification Algorithm:

Forward Chaining:

First Order Definite Clause:


A simple Forward Chaining Algorithm:
Example:
Forward Chaining Proof:
Algorithm:

Summary:
Backward Chaining:

Example:

Conversion of the given statement in the example into First Order


Logic:
Proof by Resolution:
Example:
FOL:

Next step is converting the above FOL into Conjunctive normal form:
Resolution Tree

Questions

1) Explain the syntax and semantics of the First Order Logic.

2) Explain the following wrt to the first Order Logic

i) Assertions & Queries in FOL


ii) The Kinship Domain
iii) Numbers & Stets

3) Explain Unification in Detail.

4) Explain Forward Chaining algorithm with an example.

5) Explain various ambiguities in Natural Language Processing with examples


& summarize in the form of table about formal languages and their
ontological and their epistemological commitments.
6) Define Universal and Exponential Instantiation & give example for both.
Prove the following using Backward & Forward Chaining. “As per the law,
it is crime for an American to sell weapons to hostile nations. Country E,
an enemy of America, has some missiles, and all the missiles were sold to
it by solan, who is an American citizen”.

Prove that Solan is criminal.

7) Explain i) Unification & ii) Subsumption Lattice with examples. Write short
note on how first Order logic is applied to Wumpus world.

8) Write appropriate quantifier for the following:


i) Some students read well
ii) Some students like some books
iii) Some students like all books
iv) All students like some books
v) All students like no books
Explain the concept of resolution with appropriate procedure.
9) Explain the syntax & semantics of First Order Logic.

10) Explain forward chaining algorithm with an example.

-----------------------------------

You might also like