Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
62 views33 pages

L02 - Knowledge-Rep - Part 2

This document discusses logical knowledge representation using propositional logic and first-order predicate logic. It introduces propositional logic and its operators like AND, OR, NOT. It then discusses first-order predicate logic which uses predicates, quantifiers, variables and constants to represent knowledge in a more expressive way than propositional logic by overcoming limitations like expressing universality and existence. Truth tables are also introduced as a way to determine the truth value of propositions.

Uploaded by

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

L02 - Knowledge-Rep - Part 2

This document discusses logical knowledge representation using propositional logic and first-order predicate logic. It introduces propositional logic and its operators like AND, OR, NOT. It then discusses first-order predicate logic which uses predicates, quantifiers, variables and constants to represent knowledge in a more expressive way than propositional logic by overcoming limitations like expressing universality and existence. Truth tables are also introduced as a way to determine the truth value of propositions.

Uploaded by

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

Lecture 2: Knowledge

Representation – Part 2 (Logic)

KT24202 Artificial Intelligence


Faculty of Computing & Informatics,
Universiti Malaysia Sabah

1
Content
• Logical Knowledge Representation
• Propositional Logic
• First Order Predicate Logic

2
Logical Knowledge Representation
Oldest form of KR
in computer

Concerned with
truthfulness

Propositional Predicate Calculus /


2 kinds of logic:
Logic FOPL

Manipulate
BICONDITIO
Boolean AND OR NOT IMPLIES
NAL
operators

3
3
Logical Knowledge Representation
• Using propositional Logic & First Order Logic.
• Logic make statements about the world which
are true or false.
• Logic is defined by:
o Syntax (possible configurations of sentences)
o Semantics (interpretation)
o Proof theory (entailment to derive new fact)

4
4
Propositional Logic (PL)
• PL (or propositional calculus) - is a branch of
mathematical logic that studies the logical
relationships between propositions, or
statements that are either true or false.
• PL - uses symbols to represent propositions
and logical connectives to link propositions
together to form compound propositions.

5
Propositional Logic (PL)
• Compound proposition is made up of
operators and >1 elementary
propositions
• Boolean operators
– AND (ꓥ), OR (ꓦ), NOT(¬), BICONDITIONAL (),
IMPLIES(→)

6
Intro to Propositional Logic
it_is_raining
elementary (P)
proposition

E.g.

kitty_gets_wet kitty_is_outside
(Q) (R)

7
7
Propositional logic
• Logical constants: true, false
• Propositional symbols: P, Q, S, ...
• Wrapping parentheses: ( … )
• Sentences are combined by connectives:
 ...and
 ...or
...implies
..is equivalent
 ...not

88
Propositional logic (PL)
• A simple language useful for showing key
ideas and definitions
• User defines a set of propositional
symbols, like P and Q.
• User defines the semantics of each of
these symbols, e.g.:
– P means "It is hot"
– Q means "It is humid"
– R means "It is raining"
99
Operator and Symbol for PL


General Name Formal Name Symbol
Not Negation
And Conjunction

Or Disjunction

If…
Then/Implies
Conditional

If and only if Biconditional 
10
Examples of PL sentences
• (P ^ Q) => R : “If it is hot and humid,
then it is raining”
• Q => P : “If it is humid, then it is hot”
• Q : “It is humid.”

11
11
Operator and Symbol
• The use of bracket “(…)” will affect the
meaning of the whole PL representation
• Example:
(A ^ B) v C
A ^ (B v C)
• Shows the boundary of each operator

12
Operators and PL
• The most important operator will be
selected as the principal operator.
(A ^ B)  (C v D)

• The principal operator is used to break a


compound proposition into smaller units.

13
Example
Word Representation
Today is hot h
I feel dehydrate d
I need to drink water w

i) Today is hot and I feel dehydrated then I need to


drink water. [ hd  w]
ii) Today is not hot and I don’t feel dehydrated then I
do not need to drink water. [ h  d w]
iii) Today is not hot but I feel dehydrated then I need
to drink water. [ h  d w ]
14
14
More examples
• Normal: The sky is blue and windy. It is really great
for picnic
– PL: sky_blue  windy  great_for_picnic
• Normal: If the weather is cloudy, then it will be
raining. If it is raining, people will stay at home.
– PL: (weather_cloudy  raining)  (raining 
people_stay_home).
• Normal: I will rather stay if and only if it is raining.
– PL: i_will_stay  raining

15
Propositional Logic and Truth Table
• PL truth can be determined with a truth table using the
following:
• Tautology (Valid)
– Sentence that is True under all interpretations
– E.g. (P(PQ))Q
• Contingent (Satisfiable)
– Sentence is sometimes T sometimes F
– E.g. (AB)C
• Inconsistent (Unsatisfiable)
– Formula is always F
– E.g. P(P)

16
Truth table – proving PL
• Example: the truth value of a statement
written in PL.
P Q P PQ PQ PQ PQ
T T F T T T T
T F F F T F F

F T T F T T F

F F T F F T T

17
17
Limitation of PL
• Consider the following statement:
– “If Comel is meowing, then Comel is a cat. Comel is
meowing, therefore Comel is a cat”
– PL: ((comel_meowing → comel_isa_cat) Ʌ
comel_meowing) → comel_isa_cat
• How about this: is any_meowing or any_isa_cat refer
to “comel”?
– “Any that meowing is a cat”
– PL: ((any_meowing → any_isa_cat) Ʌ comel_meowing) →
comel_isa_cat

18
Propositional Logic Limitation
1. Cannot express universality of objects

• E.g.
• “all computers have processor”
• “all birds flly”

E.g. “all birds fly”

• parrot_flies  canary_flies 
backyard_bird_flies  ………..
19
19
Propositional Logic Limitation
2. Cannot express existence / inexistence / partial
quantity of objects
• E.g.
• “some UMS students are international
students”
• “none of us is immortal”

E.g. “some UMS students are international


students”
• jaafaru_international_student 
afiq_international student  ……
20
20
Propositional Logic Limitation

Solution

Use predicate calculus / First –Order


Predicate Logic (FOPL)
21
21
Predicate Calculus

First Order Predicate Logic (FOPL).

Overcomes PL limitations through quantifiers


and variables
Universal quantifier,  Existential quantifier, 
22
22
Predicate
Notation / logic statement that consists
of:
Argument
• predicate name
• describe / relates the • variable (A, Y, Man etc)
arguments • constant (a, y, man etc)

Functor

23
23
Structure of Predicate

• functor(argument1, argument2,
…, argumentN)

Structure

Describing:
name of relation / adjective / verb / possession
24
24
Relationship becomes functor

“she likes chocolate”

Objects becomes arguments

likes(she,chocolate)
25
25
Variations of predicates
• likes(she, chocolate)
• teaches(X, Y)
• likes(X, chocolate)
• likes(she, What)
• teaches(bob, Course)
• teaches(Who, comp1013)
• teaches(bob, _)
• teaches(X, comp1013, monday)
26
Quantifier


Expression true
for ALL values of X X (bird(X) 
‘for all’
designated likes(X,icecream) flies(X))
variables

27
27
Quantifier


X
‘there Expression true
X (bird(X) 
exist’. for SOME
values of likes(X,icecream) flies(X))
designated
variables

28
28
More examples
• E.g. 1:
– Normal: If it doesn’t rain today, Ahmad will go to the
beach
– FOPL: “rain(today) go(ahmad, beach)”
• E.g. 2:
– Normal: All volleyball players are tall
– FOPL: “X (volleyball_player (X)  tall (X))”
• E.g. 3:
– Normal: Some people like durian.
– FOPL: “X (person(X)  likes(X, durian))”
• E.g. 4:
– Normal: Nobody likes war
– FOPL: “ X  likes (X, war)” OR “X likes(X,war)” 29
29
Practice converting English to first-
order logic
• “John has an umbrella”
–  y (Has(John, y)  IsUmbrella(y))
• “Anything that has an umbrella is not wet”
–  x  y Has(x, y)  IsUmbrella(y) => IsWet(x)
• “Any person who has an umbrella is not wet”
–  x IsPerson(x) => ( y Has(x, y)  IsUmbrella(y) =>
IsWet(x))

30
Practice converting English to first-
order logic
• “John has at least two umbrellas”
–  x, y Has(John, x)  IsUmbrella(x) 
Has(John, y)  IsUmbrella(y)  (x=y)

31
Proving FOPL
• Truth table can be used only for short
sentence and impractical for complex
sentence.
• FOPL proving – using deduction or
resolution
• (Next chapter…)

32
Summary
• Propositional logic and FOPL are two popular knowledge
representation techniques used in artificial intelligence.
• PL is suitable for representing simple and static knowledge,
while FOPL is suitable for representing complex and dynamic
knowledge.
• FOPL provides more expressive power than propositional
logic and allows for the representation of variables,
quantifiers, and functions.
• Both propositional logic and FOPL allow for the use of
inference rules to derive new knowledge from existing
knowledge.

33

You might also like