4. Predicate Logic
4. Predicate Logic
Syntax :
• Specifies the symbols in the language about how they can be combined to form
sentences. The facts about the world are represented as sentences in logic.
Semantic :
• Specifies how to assign a truth value to a sentence based on its meaning in the
world. It Specifies what facts a sentence refers to.
• A fact is a claim about the world, and it may be TRUE or FALSE.
Inference Procedure :
• Specifies methods for computing new sentences from the existing sentences.
1
Representation of Simple Facts in Logic
2
Since the assertions are separate, it is not possible to draw any conclusion
about similarities between Socrates and Plato.
3
This fails to capture the relationship between any individual being a man and
that individual being a mortal.
Therefore it is necessary to move to first order predicate logic as a way of
representing knowledge because it permits representation of things that
cannot reasonably be represented in prepositional logic.
In predicate logic, real world facts are represented as statements written as
well-formed formulas (wff's)
4
But unfortunately, in propositional logic (PL), 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.
6
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, wumpus, ......
• Relations: It can be unary relation such as: red, round, is
adjacent, or and-any relation such as: the
sister of, brother of, has color, comes between…
• Function: Father of, best friend, third inning of, end of, ......
7
Syntax of First-Order logic:
• The syntax of FOL determines which collection of symbols is a logical
expression in first-order logic.
• The basic Semantic elements of first-order logic are symbols. We
write statements in short-hand notation in FOL.
Basic Elements of First-order logic:
Following are the basic elements of FOL syntax:
9
First-order logic statements can be divided into two parts:
parts, the first part x is the subject of the statement and second part
10
Quantifiers in First-order logic:
everything)
11
1. 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.
It will be read as: There are all x where x is a man who drink
coffee. 12
2. Existential Quantifier:
the statement within its scope is true for at least one instance of
something.
• When
If x is it is used with
a variable, a predicatequantifier
then existential variable will
thenbe it
∃xisorcalled as an
∃(x). And it
will be read as:
existential
Therequantifier.
exists a 'x.'
For some 'x.'
For at least one 'x.'
14
Properties of Quantifiers:
∀y∀x.
∃y∃x.
15
Some Examples of FOL using quantifier:
There are two types of variables in First-order logic which are given
below:
variables. 18
Consider the following example that shows the use of predicate
logic as a way of representing knowledge.
1. Marcus was a man.
2. Marcus was a Pompeian.
3. All Pompeians were Romans.
4. Caesar was a ruler.
5. All Pompeians were either loyal to Caesar or hated him.
6. Everyone is loyal to someone.
7. People only try to assassinate rulers they are not loyal to.
8. Marcus tried to assassinate Caesar.
9. All men are people
19
The facts described by these sentences can be represented as a set
of well-formed formulas (wffs) as follows:
1. Marcus was a man.
man(Marcus)
2. Marcus was a Pompeian.
Pompeian(Marcus)
3. All Pompeians were Romans.
∀x: Pompeian(x) → Roman(x)
4. Caesar was a ruler.
ruler(Caesar)
20
5. All Pompeians were either loyal to Caesar or hated him.
• ∀x: Pompeian(x) → loyalto(x, Caesar) ∨ hate(x, Caesar)
6. Everyone is loyal to someone.
• ∀x: ∃y: loyalto(x, y)
7. People only try to assassinate rulers they are not loyal to.
• ∀x: ∀y: person(x) ∧ ruler(y) ∧ tryassassinate(x,
y)→¬loyalto(x,y)
8. Marcus tried to assassinate Caesar.
• tryassassinate(Marcus, Caesar)
9. All men are people
• ∀x: man(x) → person(x) 21