AI Propositional Predicate Logic
AI Propositional Predicate Logic
Truth Table:
In propositional logic, we need to know the truth
values of propositions in all possible scenarios. We can
combine all the possible combination with logical
connectives, and the representation of these
combinations in a tabular format is called Truth table.
Following are the truth table for all logical connectives:
Truth table with three propositions:
We can build a proposition composing three
propositions P, Q, and R. This truth table is made-up of
8n Tuples as we have taken three proposition symbols.
Precedence of connectives:
Just like arithmetic operators, there is a precedence
order for propositional connectors or logical operators.
This order should be followed while evaluating a
propositional problem. Following is the list of the
precedence order for operators:
Precedence Operators
Logical equivalence:
Logical equivalence is one of the features of
propositional logic. Two propositions are said to be
logically equivalent if and only if the columns in the
truth table are identical to each other.
Let's take two propositions A and B, so for logical
equivalence, we can write it as A⇔B. In below truth
table we can see that column for ¬A∨ B and A→B, are
identical hence A is Equivalent to B
Properties of Operators:
o Commutativity:
o P∧ Q= Q ∧ P, or
o P ∨ Q = Q ∨ P.
o Associativity:
o (P ∧ Q) ∧ R= P ∧ (Q ∧ R),
o (P ∨ Q) ∨ R= P ∨ (Q ∨ R)
o Identity element:
o P ∧ True = P,
o P ∨ True= True.
o Distributive:
o P∧ (Q ∨ R) = (P ∧ Q) ∨ (P ∧ R).
o P ∨ (Q ∧ R) = (P ∨ Q) ∧ (P ∨ R).
o DE Morgan's Law:
o ¬ (P ∧ Q) = (¬P) ∨ (¬Q)
o ¬ (P ∨ Q) = (¬ P) ∧ (¬Q).
o Double-negation elimination:
o ¬ (¬P) = P.
Limitations of Propositional logic:
o We cannot represent relations like ALL, some, or
none with propositional logic. Example:
0. All the girls are intelligent.
a. Some apples are sweet.
o Propositional logic has limited expressive power.
o In propositional logic, we cannot describe
statements in terms of their properties or logical
relationships.
Predicate Logic or First Order Logic (FOL) or
Mathematics logic
In the topic of Propositional logic, we have seen that
how to represent statements using propositional logic.
But 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.
o "Some humans are intelligent", or
o "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.
Consider the following example. We need to convert
the following sentence into a mathematical statement
using propositional logic only.
"Every person who is 18 years or older, is eligible to
vote."
The above statement cannot be adequately expressed
using only propositional logic. The problem in trying to
do so is that propositional logic is not expressive
enough to deal with quantified variables. It would have
been easier if the statement were referring to a
specific person. But since it is not the case and the
statement applies to all people who are 18 years or
older, we are stuck.
Therefore we need a more powerful type of logic.
Predicate Logic or First-Order logic:
o First-order logic is another way of knowledge
theories, squares
o Relations: It can be unary relation such
Variables x, y, z, a, b,....
Connectives ∧, ∨, ¬, ⇒, ⇔
Equality ==
Quantifier ∀, ∃
Atomic sentences:
o 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.
o We can represent atomic sentences as Predicate
(term1, term2, ......, term n).
Example: Ravi and Ajay are brothers: =>
Brothers (Ravi, Ajay).
Chinky is a cat: => cat (Chinky).
Complex Sentences:
o Complex sentences are made by combining atomic
sentences using connectives.
First-order logic statements can be divided into two
parts:
o Subject: Subject is the main part of the statement.
o 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.
Consider the statement, “x is greater than 3″. It has
two parts. The first part, the variable x, is the subject of
the statement. The second part, “is greater than 3”, is
the predicate. It refers to a property that the subject of
the statement can have.
The statement “ x is greater than 3″ can be denoted
by P(x) where P denotes the predicate “is greater than
3” and x is the variable.
The following are some examples of predicates.
o Consider E(x, y) denote "x = y"
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.
Note: 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:
o There exists a 'x.'
o For some 'x.'
o For at least one 'x.'
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.
Points to remember:
o The main connective for universal quantifier ∀ is
implication →.
o The main connective for existential quantifier ∃ is
and ∧.
Properties of Quantifiers:
o In universal quantifier, ∀x∀y is similar to ∀y∀x.
o In Existential quantifier, ∃x∃y is similar to ∃y∃x.
o ∃x∀y is not similar to ∀y∃x.
Some Examples of FOL using quantifier:
1. All birds fly.
In this question the predicate is "fly (bird)."
And since there are all birds that fly so it will be
represented as follows.
∀x: bird(x) →fly(x).
For all x such that x is a bird it implies that birds fly
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).
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))
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.
Inference:
In artificial intelligence, we need intelligent computers which can
create new logic from old logic or by evidence, so generating the
conclusions from evidence and facts is termed as Inference.
Inference rules:
Inference rules are the templates for generating valid arguments.
Inference rules are applied to derive proofs in artificial intelligence,
and the proof is a sequence of the conclusion that leads to the desired
goal.
In inference rules, the implication among all the connectives plays an
important role. Following are some terminologies related to inference
rules:
o Implication:
o Converse:
o Contrapositive:
o Inverse:
From the above term some of the compound statements are equivalent
to each other, which we can prove using truth table:
Hence from the above truth table, we can prove that P Q is equivalent to ¬ Q ¬ P
1. Modus Ponens:
The Modus Ponens rule is one of the most important rules of inference, and it stat
Example:
Statement-1: "If I am sleepy then I go to bed" ==> P Q
2. Modus Tollens:
Statement-1:
Statement-2: "I do not go to the bed."==> ~Q
Statement-3: Which infers that "I am not sleepy" => ~P
Proof by Truth table:
3. Hypothetical Syllogism:
The Hypothetical Syllogism rule state that if PR is true whenever PQ is true, and Q
Example:
Statement-1: If you have my home key then you can unlock my
home. PQ
Statement-2: If you can unlock my home then you can take my
money. QR
Conclusion: If you have my home key then you can take my
money. PR
Proof by truth table:
4. Disjunctive Syllogism:
The Disjunctive syllogism rule state that if P∨Q is true, and ¬P is true,
then Q will be true. It can be represented as:
Example:
Statement-1: Today is Sunday or Monday. ==>P∨Q
Statement-2: Today is not Sunday. ==> ¬P
Conclusion: Today is Monday. ==> Q
Proof by truth-table:
5. Addition:
The Addition rule is one the common inference rule, and it states that
If P is true, then P∨Q will be true.
Example:
Statement: I have a vanilla ice-cream. ==> P
Statement-2: I have Chocolate ice-cream.
Conclusion: I have vanilla or chocolate ice-cream. ==> (P∨Q)
Proof by Truth-Table:
6. Simplification:
Proof by Truth-Table:
7. Resolution:
The Resolution rule state that if P∨Q and ¬ P∧R is true, then Q∨R
will also be true. It can be represented as
Proof by Truth-Table: