Using Predicate Logic
Using Predicate Logic
Using Predicate Logic
• Truth
Table
Logical Connectives
• Truth
Table
Propositional Logic
• For propositional logic, a row in the truth table is
one interpretation
Logical Connectives
• Truth table with three
propositions:
• Logical
equivalence:
Example
• Translation
Example
• Translation
Formalizing English Sentences
• Let’s consider a propositional language where p means ”Priti is happy”, q
means ” Priti paints a picture”, and r means ”Renzo is happy”.
• Formalize the following sentences:
”if Priti is happy and paints a picture then Renzo isn’t happy”
• p 𝖠 q → ¬r
”if Priti is happy, then she paints a picture”
• p→q
” Priti is happy only if she paints a picture”
• p⇔q
Formalizing English Sentences
• Let A= ” Angelo comes to the party”,
B= ”Bruno comes to the party”,
C= ”Carlo comes to the party”, and
D =”Davide comes to the party”.
1. ”If Davide comes to the party then Bruno and Carlo come too”
2. ”Carlo comes to the party only if Angelo and Bruno do not come”
3. ”If Davide comesto the party, then, if Carlo doesn’t come then Angelo
comes”
4. ”Carlo comes to the party provided that Davide doesn’t come, but, if
Davide comes, then Bruno doesn’t come”
5. ”A necessary condition for Angelo coming to the party, is that, if Bruno
and Carlo aren’t coming, Davide comes”
6. ”Angelo, Bruno and Carlo come to the party if and only if Davide doesn’t
come, but, if neither Angelo nor Bruno come, then Davide comes only if
Carlo comes”
Formalizing English Sentences
• Let A = ”Angelo comes to the party”,
B = ”Bruno comes to the party”,
C = ”Carlo comes to the party”, and
D = ”Davide comes to the party”.
1. ”If Davide comes to the party then Bruno and Carlo come too”
D→B𝖠C
2. ”Carlo comes to the party only if Angelo and Bruno do not come”
C → ¬A 𝖠 ¬B
3. ”If Davide comes to the party, then, if Carlo doesn’t come then Angelo
comes”
D → (¬C → A)
Formalizing English Sentences
• Let A = ”Angelo comes to the party”,
B = ”Bruno comes to the party”,
C = ”Carlo comes to the party”, and
D = ”Davide comes to the party”.
4. ”Carlo comes to the party provided that Davide doesn’t come, but, if Davide
comes, then Bruno doesn’t come”
(C → ¬D) 𝖠 (D → ¬B)
5. ”A necessary condition for Angelo coming to the party, is that, if Bruno
and Carlo aren’t coming, Davide comes”
A → (¬B 𝖠 ¬C → D)
6. ”Angelo, Bruno and Carlo come to the party if and only if Davide doesn’t
come, but, if neither Angelo nor Bruno come, then Davide comes only if
Carlo comes”
(A 𝖠 B 𝖠 C ↔ ¬D) 𝖠 (¬A 𝖠 ¬B → (D → C))
Contradiction and Tautology
• Some composite sentences may always (under any
interpretation) evaluate to a single truth value:
Rules of Inference
• 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 are the templates for generating valid
arguments. Inference rules are applied to derive proofs in AI,
and the proof is a sequence of the conclusion that leads to the
desired goal.
Following are some terminologies related to inference rules:
• Implication: It is one of the logical connectives which can be
represented as P → Q. It is a Boolean expression.
• Converse: The converse of implication, which means the right-
hand side proposition goes to the left-hand side and vice-versa.
It can be written as Q → P.
Rules of Inference
• Contrapositive: The negation of converse is termed as
contrapositive, and it can be represented as ¬ Q → ¬ P.
• Inverse: The negation of implication is called inverse. It can be
represented as
¬ P → ¬ Q.
From the above term some of the compound statements are
equivalent to each other, which we can prove using truth table:
Types of Inference Rules
• Modus Ponens: if P and P → Q is true, then we can infer that Q will be
true.
• Example
• Statement-1: "If I am sleepy then I go to bed" ==>
P→ Q Statement-2: "I am sleepy" ==> P
• Conclusion: "I go to bed." ==> Q.
• Hence, we can say that, if P→ Q is true and P is
true then Q will be true.
• Proof by Truth table:
Types of Inference Rules
• Modus Tollens: The Modus Tollens rule state that if P→ Q is
true and ¬ Q is true, then ¬ P will also true.
• Predicate Symbols
– Stand for relations
– E.g., Brother(Richard, John),
greater_than(3,2)...
• Function Symbols
– Stand for functions
– E.g., Sqrt(3), LeftLegOf(John),...
Syntax of FOL: Basic elements
• Constants (KingJohn, 2, UCI,...)
• Predicates (Brother, >,... Sqrt)
• Functions (LeftLegOf,...)
• Variables (x, y, a, b,...)
• Connectives (, , , , )
• Equality (=)
• Quantifiers (, )
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:
• Tryassassinate(Marcus
• ,Caesar)
Knowledge Base in CNF
Query: Does Marcus hate Caesar?
• Negation of Query ¬Hate(Marcus, Caesar)
Resolution
Does Marcus hate
Caesar?
• So hate(Markus,
ceaser) is true.
Representing Instance and ISA Relationships
• Specific attributes instance and isa play an important role particularly
in a useful form of reasoning called property inheritance.
• The predicates instance and isa explicitly captured the relationships
they used to express, namely class membership and class inclusion.
Representing Instance and ISA Relationships
• The first part of the figure contains, class membership
represented with unary predicates (such as Roman), each of
which corresponds to a class.
• Asserting that P(x) is true is equivalent to asserting that x is
an instance (or element) of P.
• The second part of the figure contains
representations that use the instance predicate explicitly.
• The predicate instance is a binary one, whose first argument is
an object and whose second argument is a class to which the
object belongs.
• But these representations do not use an explicit isa predicate.
• Instead, subclass relationships, such as that between
Pompeians and Romans, described as shown in sentence 3.
Representing Instance and ISA Relationships
• The implication rule states that if an object is an instance of the
subclass Pompeian then it is an instance of the superclass
Roman.
• The third part contains representations that use both the
instance and isa predicates explicitly.
• The use of the isa predicate simplifies the representation of
sentence 3, but it requires that one additional axiom (shown
here as number 6) be provided.
Computable Functions and Predicates
• To express simple facts, such as the following greater-than and
less-than relationships:
• gt(1,O) It(0,1) gt(2,1) It(1,2) gt(3,2) It( 2,3)
• It is often also useful to have computable functions as well as
computable predicates.
• Thus we might want to be able to evaluate the truth of gt(2 +
3,1)
• To do so requires that we first compute the value
of the plus function given the arguments 2 and 3,
and then send the arguments 5 and 1 to gt.
Computable Functions and Predicates
• Consider the following set of facts, again involving
Marcus:
Computable Functions and Predicates
• So, Now suppose we want to answer the question “Is Marcus
alive?”
• The statements suggested here, there may be two ways of
deducing an answer.
• Either we can show that Marcus is dead because he was killed
by the volcano or we can show that he must be dead because
he would otherwise be more than 150 years old, which we
know is not possible.
• Also, As soon as we attempt to follow either of those paths
rigorously, however, we discover, just as we did in the last
example, that we need some additional knowledge. For
example, our statements talk about dying, but they say nothing
that relates to being alive, which is what the question is asking.
Computable Functions and Predicates
• So we add the following facts: