Artificial Intelligence
Ms. Aiman
Propositional logic (Recap)
In the topic of Propositional logic, we have seen that how
to represent statements using propositional logic.
Unfortunately, in propositional logic, we can only represent
the facts, which are either true or false.
PL is not sufficient to represent the complex sentences or
natural language statements.
The propositional logic has very limited expressive power.
Consider the following sentence, which we cannot
represent using PL logic.
EX- "Some humans are intelligent“
To represent the above statements, PL logic is not
sufficient, so we required some more powerful logic, such
as first-order logic.
First-Order Logic in Artificial
intelligence
First-order logic is another way of knowledge
representation in artificial intelligence. It is an extension to
propositional logic.
FOL is sufficiently expressive to represent the natural
language statements in a concise way.
First-order logic is also known as Predicate logic or First-
order predicate logic. First-order logic is a powerful
language that develops information about the objects in a
more easy way and can also express the relationship
between those objects.
First-Order Logic in Artificial
intelligence
First-order logic (like natural language) does not only assume
that the world contains facts like propositional logic but also
assumes the following things in the world
Objects: A, B, people, numbers, colors, wars, theories,
squares, pits etc.
Relations: It can be unary relation such as: red,
round, is adjacent, or n-any relation such as: the
sister of, brother of, has color, comes between
Function: Father of, best friend, third inning of, end of
etc
As a natural language, first-order logic also has two main parts:
Syntax
Semantics
First-Order Logic in Artificial
intelligence
Main Parts of First-Order
Logic
As a natural language, first-order logic also has two main parts
are Syntax and Semantics
1. Syntax of First Order Logic
The syntax of FOL determines which collection of symbols is a
logical expression in first-order logic.
The basic syntactic elements of first-order logic are symbols.
We write statements in short-hand notation in FOL.
Main Parts of First-Order Conti
Logic
Basic Elements of First-order logic Syntax
First-Order Logic
Atomic Sentences
Atomic sentences are the most basic sentences of first-order
logic.
These sentences are formed from a predicate symbol followed
by a parenthesis with a sequence of terms.
We can represent atomic sentences as Predicate (term1,
term2, ......, term n).
EX- Example: Ali and Hamza are brothers: =>
Brothers(Ali, Hamza).
Pinky is a cat: => cat (Pinky).
First-Order Logic
Complex Sentences
Complex sentences are made by combining atomic sentences
using connectives.
First-Order Logic
First-order logic statements can be divided into two parts
Subject: Subject is the main part of the statement.
Predicate: A predicate can be defined as a relation, which
binds two atoms together in a statement.
Consider the statement: "x is an integer.", it consists of
two parts, the first part x is the subject of the statement and
second part "is an integer," is known as a predicate.
Quantifiers in First-order
logic
A quantifier is a language element which generates
quantification, and quantification specifies the quantity of
specimen in the universe of discourse.
These are the symbols that permit to determine or identify the
range and scope of the variable in the logical expression.
There are two types of quantifier
A. Universal Quantifier, (for all, everyone, everything)
B. Existential quantifier, (for some, at least one).
Quantifiers in First-order
logic
A. 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.
In universal quantifier we use implication "→“.
If x is a variable, then ∀x is read as:
For all x
For each x
For every x.
Quantifiers in First-order
logic(Universal)
Ex-All man drink coffee.
Let a variable x which refers to a man so all x can be
represented in UOD as below:
Quantifiers in First-order
logic
Universal Quantifier
∀x man(x) → drink (x, coffee).
It will be read as: There are all x where x is a man who
drink coffee.
Quantifiers in First-order
logic
B. Existential Quantifier
Existential quantifiers are the type of quantifiers, which
express that the statement within its scope is true for at
least one instance of something.
It is denoted by the logical operator ∃, which resembles
as inverted E. When it is used with a predicate variable
then it is called as an existential quantifier.
In Existential quantifier we always use AND or
Conjunction symbol (∧).
If x is a variable, then existential quantifier will be ∃x or
∃(x). And it will be read as.
Quantifiers in First-order
logic
B. Existential Quantifier
There exists a 'x’. For some 'x’. For at least one 'x.'
EX- Some boys are intelligent.
Quantifiers in First-order
logic
B. Existential Quantifier
∃x: boys(x) ∧ intelligent(x)
It will be read as: There are some x where x is a boy who
is intelligent.
Points to remember
The main connective for universal quantifier ∀ is
implication →.
The main connective for existential quantifier ∃ is and ∧.
First-order logic using
Quantifiers
Some Examples of FOL using quantifier
1. All birds fly.
In this question the predicate is "fly(bird)."
And since there are all birds who fly so it will be
represented as follows.
∀x bird(x) →fly(x).
2. Every man respects his parent.
In this question, the predicate is "respect(x, y),"
where x=man, and y= parent.
Since there is every man so will use ∀, and it will be
represented as follows:
∀x man(x) → respects (x, parent).
First-order logic using
Quantifiers
3. Some boys play cricket.
In this question, the predicate is "play(x, y)," where x=
boys, and y= game. Since there are some boys so we will
use ∃, and it will be represented as:
∃x boys(x) → play(x, cricket).
4. Not all students like both Mathematics and
Science.
In this question, the predicate is "like(x, y)," where x=
student, and y= subject.
Since there are not all students, so we will use ∀ with
negation, so following representation for this:
¬∀ (x) [ student(x) → like(x, Mathematics) ∧
like(x, Science)].
First-order logic using
Quantifiers
5. Only one student failed in Mathematics.
In this question, the predicate is "failed(x, y)," where x=
student, and y= subject.
Since there is only one student who failed in Mathematics,
so we will use following representation for this
∃(x) [ student(x) → failed (x, Mathematics)
∧∀ (y) [¬(x==y) ∧ student(y) → ¬failed (x,
Mathematics)].