Propositional and Predicate Logic
Propositional and Predicate Logic
Predicate logic
LAB #09
Saqib Daud
• From this module, we will start embarking on methods to represent
knowledge.
• We have seen algorithms for searching, heuristics based methods,
planning, game playing etc.
• Each of these things needs some way to represent knowledge
forstoring as well as processing.
• In fact we have discussed a few ways of representing knowledge in
our initial modules when we wrote rules to represent problems and
their solutions.
• We are going to learn them formally now.
• We will begin with Formal Logic and then we will see other ways of
representing knowledge using formal logic.
• The module discusses formal logic on which both propositional and
predicate logic is based.
• We will see how simple statements are represented using
propositional and predicate logic and how one can infer using that
representation.
Knowledge Representation
• Formal Logic
• Frame Representation
• Semantic Network
• Production Rules
Logical Representation
• It is a language with set of some concrete rules which deals with
some propositions and has no ambiguity in representation
• Semantics
Defines the truth meaning of sentence
Why Formal logic
• The study of formal Logic helps two things.
• Representing knowledge and infer from it. For any problem to be solved, all related
information is to be stored in some conceivable form and we also have to have some
method for inferring from it.
• We have already learned a few examples of representation of knowledge and also
using rules etc. to reason from them.
• Formal logic begins with some facts known to be true and continuously incrementing
number of true facts based on old known facts and inferring from the collection of
facts.
• Old known-to-be-true facts are known as premises and the methods used to infer are
known as arguments.
• The resultant additional true facts are called conclusions.
Examples
For example we have following premises
• Vijay is a teacher
• All teachers are educated
And we apply argument to conclude that
Vijay is educated.
We can get many similar examples to illustrate same argument. For example we
might also conclude using argument for a very different set of premises
• Radha is a housewife.
• All housewives like to cook. And we apply argument to conclude that
Radha likes to cook.
• The arguments discussed above are based on inference rule known as
syllogism; i.e. x → y and y→z than x→z.
• Not always such argument is valid. Let us take another example to
understand. We have two premises yet again.
• Sachin is a sportsman.
• Sportsmen are found all over the world.
And we can apply the same argument, what will be the conclusion?
Sachin is found all over the world
• Thus, even when given premises are correct and the argument
applied in one case is correct, it might fail to get correct conclusion
otherwise. Thus we must need a formal structure to validate this
process.
Propositional logic
A simplest logic
A declarative statement that is either true or false.
In propositional logic, a real world situation is represented using a proposition.
Here are examples of real world statements.
• Afridi is a cricketer
• Saina is a badminton player
• Saniya is a tennis player
• Jay is a badminton player or a tennis player.
If Afridi is a cricketer, he is a sportsperson
• We can represent them as follows using propositional logic
AfridiCricketer
• SainaBadminton
• SaniyaTennis
• JayBadminton V JayTennis
• AfridiCricketer→AfridiSportsPerson
• Some authors prefer to use single letter symbols like P, Q, R etc. to describe
propositions rather than using more explicit AfridiCricketer or SainaBadminton.
That method helps representing complex cases. For example if we have following
statements.
R = Jon is a sportsman
P = Jon is a cricketer
S = Jon lives in America
Q = Jon is a badminton Player
If we want to state that “Jon lives in America and he is either a cricketer or a
badminton player” we can represent that as
S ⋀ (P V Q)
R = Jon is a sportsman
P = Jon is a cricketer
S = Jon lives in America
Q = Jon is a badminton Player
• This representation is quite appealing if one wants to prove simple facts. For example we can have following facts known to us
1. P
2. Q
3. P V Q
Now if we know that 1 is true, we can easily conclude that 3 is true.
Let us take another example
1. P
2. Q
3. P → Q
Now we know that P is true, we can conclude that Q is true.
Predicate Logic
• Predicate Logic
• Predicate Logic deals with predicates, which are propositions, consist
of variables.
• Predicate Logic - Definition
• A predicate is an expression of one or more variables determined on
some specific domain. A predicate with variables can be made a
proposition by either authorizing a value to the variable or by
quantifying the variable.
Quantifier:
• The variable of predicates is quantified by quantifiers. There are two types of quantifier in predicate logic - Existential Quantifier
and Universal Quantifier.
Existential Quantifier:
• If p(x) is a proposition over the universe U. Then it is denoted as ∃x p(x) and read as "There exists at least one value in the universe
of variable x such that p(x) is true. The quantifier ∃ is called the existential quantifier.
• There are several ways to write a proposition, with an existential quantifier, i.e.,
• (∃x∈A)p(x) or ∃x∈A such that p (x) or (∃x)p(x) or p(x) is true for some x ∈A.
Universal Quantifier:
• If p(x) is a proposition over the universe U. Then it is denoted as ∀x,p(x) and read as "For every x∈U,p(x) is true." The quantifier ∀
is called the Universal Quantifier.
There are several ways to write a proposition, with a universal quantifier.
• ∀x∈A,p(x) or p(x), ∀x ∈A Or ∀x,p(x) or p(x) is true for all x ∈A.
Negation of Quantified Propositions:
• When we negate a quantified proposition, i.e., when a universally quantified proposition is negated, we obtain an existentially
quantified proposition,and when an existentially quantified proposition is negated, we obtain a universally quantified proposition.
Need for Predicate logic
• Can you see the problem with this representation? If we have one more statement,
“all cricketers are rich” in our kitty, can we prove Afridi to be rich? It is hard unless
we will try a little different way of representing the statements. For example, we can
represent them using first order predicate logic. This is the first example given below.
• 1. Cricketer (Sachin)
• 2. Badminton (Saina)
• 3. Tennis (Saniya)
• 4. Badminton (Jay) V Tennis (Jay)
• The universal quantifiers are handy when we want to have statements like “All
cricketers are rich” and use them for implication as follows.
• 5. ∀𝑥 Cricketer(𝑋) → 𝑅ich(𝑋)
• In the above statement X is known as a variable which can assume values like Jay
and Sachin. Now we can combine 5 and 1 with X = Sachin and can prove Rich
(Sachin). This is the power of first order predicate logic. The statements Cricketer
(Sachin) are known as predicates. The word Cricketer is a name of that predicate
and Sachin is the argument of that predicate. A predicate can have multiple
argument as in following cases.
1. Mama(Bajrangi, Shahida)
2. Brother(Shan, Sagarika)
3. Father (Rajiv, Rahul)
4. Relation (Gujarat, Capital, Gandhinagar)
5. Relation (Gujarat, LargestCity, Ahmedabad)
• Last two predicates can also be written in a little different form as
• 1. Relation (Gujarat ( Capital, Gandhinagar))
• 2. Relation (Gujarat ( LargestCity, Ahmedabad))
1. Cricketer (Afridi)
2. Badminton (Saina)
3. Tennis (Saniya)
4. Badminton (Jay) V Tennis (Jay)
The universal quantifiers are handy when we want to have statements like “All cricketers
are rich” and use them for implication as follows.
5. ∀ Cricketer(X) --> Rich(X)
In the above statement X is known as a variable which can assume values like Jon and
Afridi. Now we can combine 5 and 1 with X = Afridi and can prove Rich (Afridi). This is the
power of first order predicate logic. The statements Cricketer (Afridi) are known as
predicates. The word Cricketer is a name of that predicate and Afridi is the argument of
that predicate.
Example.