0% found this document useful (0 votes)
19 views

4. Predicate Logic

The document discusses the fundamentals of logic, focusing on syntax, semantics, and inference procedures, and highlights the limitations of propositional logic in representing complex statements. It introduces first-order predicate logic as a more powerful alternative that can express relationships and properties of objects in a structured manner. The document also explains the use of quantifiers, free and bound variables, and provides examples of how real-world facts can be represented in first-order logic.

Uploaded by

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

4. Predicate Logic

The document discusses the fundamentals of logic, focusing on syntax, semantics, and inference procedures, and highlights the limitations of propositional logic in representing complex statements. It introduces first-order predicate logic as a more powerful alternative that can express relationships and properties of objects in a structured manner. The document also explains the use of quantifiers, free and bound variables, and provides examples of how real-world facts can be represented in first-order logic.

Uploaded by

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

Logic

 Logic is concerned with the truth of statements about the world.


 Generally each statement is either TRUE or FALSE.
 Logic includes :Syntax, Semantics and Inference Procedure.

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

• Real-world facts are represented as logical propositions written as well-


formed formulas (wff's)

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.

 Consider the following sentence, which we cannot


represent using PL logic.

 "Some humans are intelligent", or

 "Sachin likes cricket."

 To represent the above statements, PL logic is not sufficient, so we


required some more powerful logic, such as first-order logic.
5
Predicate logic

 Also known as First-Order logic (FOL) or First-order


predicate logic (FOPL)

 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 a powerful language that develops information about the


objects in a more easy way and can also express the relationship between
those objects.

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, ......

 As a natural language, first-order logic also has two main parts:


• Syntax
• Semantics

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:

Constant 1, 2, A, John, Mumbai, cat,....


Variables x, y, z, a, b,....
Predicates Brother, Father, >,....
Function sqrt, LeftLegOf, ....
Connectives ∧, ∨, ¬, ⇒, ⇔
Equality ==
Quantifier ∀, ∃ 8
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).
• Example:
1. Chinky is a cat: => cat (Chinky).
2. Ravi and Ajay are brothers: => Brothers(Ravi,
Ajay)
Complex Sentences:
• Complex sentences are made by combining atomic sentences
using connectives.

9
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.

10
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:

1. Universal Quantifier, (for all, everyone,

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.

• If x is a variable, then ∀x is read


as:
 For all x
 For each x
 For every x.
Note: In universal quantifier we use implication "→".

Example: All man drink coffee.

∀x: man(x) → drink (x, coffee).

It will be read as: There are all x where x is a man who drink
coffee. 12
2. 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
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.'

Note: In Existential quantifier we always use AND or Conjunction symbol (∧).

Example: Some boys are intelligent.


∃x: boys(x) ∧ intelligent(x)
It will be read as: There are some x where x is a boy who is intelligent.
13
1. All dolphins are mammals
∀x: dolphin(x) → mammal(x)

2. Some mammals lays eggs.


∃x: mammal(x) ∧ lays-eggs(x)

14
Properties of Quantifiers:

• In universal quantifier, ∀x∀y is similar to

∀y∀x.

• In Existential quantifier, ∃x∃y is similar to

∃y∃x.

• ∃x∀y is not similar to ∀y∃x.

15
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).
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).
16
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,
5. Only one student failed in Mathematics.
Science)].

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)].
17
Free and Bound Variables:

The quantifiers interact with variables which appear in a suitable way.

There are two types of variables in First-order logic which are given

below:

Free Variable: A variable is said to be a free variable in a formula if it

occurs outside the scope of the quantifier.

Example: ∀x: ∃y: [P (x, y, z)], where z is a free variable.

Bound Variable: A variable is said to be a bound variable in a formula

if it occurs within the scope of the quantifier.

Example: ∀x [A (x) B(y)], here x and y are the bound

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

You might also like