Академический Документы
Профессиональный Документы
Культура Документы
Representation
1
Overview
Introduction
Logical Representation
Propositional Logic
Predicate Logic
Procedural representation
Network representation
Structured representation
Frames
Scripts
Ontology
2
Introduction
3
Major KR Techniques
4
Logical representation
5
Logic
6
Propositional logic
7
Semantics of Propositional Logic
Here is a truth value table for two propositions P and Q
P Q P PQ PQ PQ P Q
T T T 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
P Q = (P Q) ( Q P )
P Q = ~P Q is read as P implies Q
P Q is read as p if and only if q
8
Consider the connective P Q in detail
How can P Q be true for P=F and Q=T?
Suppose your friend asks whether you have an umbrella
and you respond if I had an umbrella, (then) I would not
have got wet
Here, P = I had an umbrella, Q = I would not
have got wet
Suppose P=F. That is I do not have an umbrella.
Is the proposition P Q true?
If we take Q as F, then not having an umbrella
could certainly make you wet. So P Q = T
If we take Q as T, then not having an umbrella
may not necessarily make you wet (e.g., you were
indoors at that time!), Then P Q = T
9
Example
0 0 0 1 1 1
0 1 0 1 0 0
1 0 0 1 1 1
1 1 1 0 1 1
10
Examples
P- I work hard
Q I will pass the exam
(P Q)P Q
11
Propositional logic
Assignment: each raw of a truth table
Interpretation: what each assignment yields
Model: an assignment that makes a true interpretation
Counter example: an assignment that makes a false
interpretation
Tautology: an expression whose interpretation is always
true
Contradiction: an expression whose interpretation is
always false
Equivalence: Two expressions with same interpretations
12
Examples
P T and Q-F is a model for P Q
((P Q) P) Q is a tautology
13
Two statements X and Y are logically
equivalent if X Y is a tautology.
From a practical point of view, you can
replace a statement in a proof by any
logically equivalent statement.
14
Propositional Logic..
Argument
An argument consists of set of propositions
called premises and another proposition
called conclusion as in the following form
P1P2P3Pn C
15
Inference Methods
16
Truth Table Method
17
Truth Table Method (2)
The truth table method can be formalized as
follows:
Step 1: Starting with a complete truth table for the
propositional constants, iterate through all the premises
of the problem, for each premise eliminating any row that
does not satisfy the premise
Step 2: Do the same for the conclusion
Step 3: Finally, compare the two tables; If every row
that remains in the premise table, i.e. not eliminated,
also remains in the conclusion table, i.e. not eliminated,
then the premises logically entail the conclusion
18
Example
Simple sentences:
Amy loves Pat: P
It is Monday: R
Premises:
If Amy loves Pat, Amy loves Quincy: P Q
Question:
If it is Monday, does Amy love Quincy?
19
Example 2
20
Equivalencies
(P) P
PQ QP
PQ QP
P Q PQ
(PQ) PQ
(PQ) PQ
P(QR) (PQ) (PR)
P Q Q P
21
Inference Rules
Modus ponens P Q, P Q
Modus tolens P Q, Q P
And- elimination P1P2 ..Pn Pi
And introduction P1,P2,..Pn P1P2..Pn
Or introduction P1 P1P2 ...Pn
Double negation P P
Unit resolution PQ, Q P
Resolution PQ, Q R PR
22
Reasoning in Propositional Logic
23
Reasoning Example
24
Conjunctive Normal Forms
Procedure to convert propositional logic expression to CNF
With the use of CNF proof can be done by using the method
of contradiction
25
Using CNF - Example
Consider the paragraph:
If Sarath works hard and or lucky he can pass the exam.
Sarath is curious but he is not lucky. If sarath is curious
then he works hard.
26
Using CNF Example
Paragraph in propositional logic
(PQ) R ----(a)
SQ ----(b)
SP ----(c)
Converting to CNF
(a) Eliminate , we get (PQ)R
remove , then get (PQ)R
R(PQ)
(R P) (RQ)
break at sign
(R P) ----(a1)
(RQ) ----(a2)
(b) Only the last step apply
S ----(b1)
Q ----(b2)
(c) elimination
SP ----(c1)
27
Using CNF Example
In Propositional Logic In CNF
SQ ----(b) S ----(b1)
Q ----(b2)
SP ----(c) SP ----(c1)
28
Using CNF Example
In order to show Sarath can pass the exam.
We assume its negation is true add it as a new
CNF to the system
R ----(d1)
29
Using CNF Example
Elegant use of Modus ponens
P, PQx Q(a)
This is same as P, PQ Q
PQ P
Q
Now we resolve the above problem as follows
30
Using CNF Example
R P R
P SP
S S
{}
31
Limitations of Propositional logic
Inability to generalize
Inability to represent internal information
32
Predicate Logic
This Address the issues of propositional logic
Predicate Logic is also known as First Order Logic
x universal quantifiers
Read as for all x
x existential quantifier
Read as for some, there exists
34
Examples
35
Order of quantifiers
xy P(x,y) yx P(x,y)
x y P(x,y) y x P(x,y)
xy P(x,y) yx P(x,y)
36
Reasoning in First-order logic
Most useful rule is the modus ponens
P(a), P(x) Q(x) Q(a)
This is same as P(a), P(x)Q(x) Q(a)
P(x)Q(x) P(a)
X= a
Q(a)
37
CNF with FOL
38
Procedure - FOL to CNF
S1 - Elimination of implication
S2- Move inwards
S3 - Standardize variables
S4- Remove existential quantifier (skolemize)
S5- Drop universal quantifiers
S6- Distribute over
39
Example FOL to CNF
Consider the sentence every one who loves all
animals is loved by someone
x [y animal(y)loves(x,y)] [y loves(y,x)]
40
Example FOL to CNF
Using S3: rename variable not to appear twice
x [y animal(y)loves(x,y))][z loves(z,x)]
x [animal(F(x))loves(x,F(x)))]loves(G(x),x)
41
Example FOL to CNF
Using S5
[animal(F(x))loves(x,F(x)))]loves(G(x),x)
Using S6
[animal(F(x))loves(G(x),x)]
[loves(x,F(x)))loves(G(x),x)]
42
Resolution using CNF - Example
43
Writing in FOL
A. x [y animal(y)loves(x,y)] [y loves(y,x)]
B. x [y animal(y) kills(x,y)] [z loves(z,x)]
C. x animal(x) loves(Jack,x)
D. kills(Jack,Tuna) kills(Curiosity, Tuna)
E. Cat(Tuna)
F. x cat(x) animal(x)
G. kills(Curiosity, Tuna)
Note that we have assumed that Curiosity did not kills Tuna, as
we prove this using method of contradiction
44
Corresponding CNF
A1 animal(F(x)) loves(G(x), x)
A2 loves(x,F(x)) loves(G(x), x)
B aniaml(y)kills(x,y) loves(z,x)
C aniaml(x)loves(Jack,x)
D kills(Jack, Tuna) kills(Curiosity, Tuna)
E cat(Tuna)
F cat(x) animal(x)
G kills(Curiosity, Tuna)
45
Proof by contradiction
kills(Curiosity, Tuna)
kills(Jack, Tuna)
animal(Tuna)
aniaml(y)kills(x,y) loves(z,x) loves(x,F(x)) loves(G(x), x)
aniaml(x)loves(Jack,x)
kills(x,Tuna)loves(z,x)
loves(z,Jack)
aniaml(F(Jack)) loves(G(Jack), Jack)
loves(G(Jack), Jack)
{}
46
Procedural Representation
IF <Condition>
THEN <Conclusion-1/Action-1>
ELSE <Conclusion-2/Action-2>
47
Examples rule-based representation
48
Production Systems
49
Inference in rule-based representation
Backward chaining
Begins with a hypothesis, matches with the head
of a rule and tries to satisfy its body by matching
with head of another rule
By default Prolog operates in this manner
Forward chaining
Begins with facts, and tries to derive moving
towards conclusion.
50
Example Rule-based KB
leak_in_bathroom :- hall_wet, kitechn_dry
problem_in-kitechen :- hall_wer,bathroom_dry
kitchen
no_water_fron_out_side :- window_closed
; no_rain br hall
leak_in_kichen :- problem_in_kitchen,
no_water_from out_side
Some Observations as facts
hall_wet.
bathroom_dry.
window_closed.
Query ?- leak_in_kitchen.
yes
51
Inference network
kitechn_dry
leak_in_bathroom
hall_wet
problem_in_kitchen
bathroom_dry
leak_in_kitchen
window_closed
no_water_from_outside
no_rain
52
Backward chaining example
53
Forward chaining example
Start with some known facts (but not from a hypothesis)
For example, having noticed the hall_wet and bathroom_dry
concludes that problem_in_kitchen
Having noticed, window_closed the concludes
no_water_from_outside
From the above two, we conclude leak_in_kitchen
Note: if we begin with facts, kitchen_dry and hall_wet we get
unnecessary conclusion, leak_in_bath_room
As such FC can go ahead with unnecessary derivations, without
an idea about a goal
Good for configuration, planning, design problems
54
Advantages of rules
Easy to implement
Easy to drive process reasoning
Easy to modify and maintain
Can extend incorporating concepts such as
uncertainty
55
Network Representation
56
Example 1 - Semantic networks
lecturer
Is_a
Is_a
AI asoka
Human
teaches
being
enjoys
needs
writing
subset
has_feature
bird can fly
is_a
Due to inheritance from superior
Ostrich cannot fly
nodes we can conclude that
has_feature
(i) Ostrich can move
(ii) Ostrich can fly
58
Comments on Semantic networks
Easy to understand
Large domains may need very complex
semantic networks
Cannot represent negations, disjunction,
variables and quantifiers
Yet, we can include logic and rules with
semantic networks to overcome the above
issue
59
Structured Representation
60
Frames
61
Example - Frame
Consider the following frame describing about a car
slots
Note: we can define new frames by referring to values of slots of a given frame
For example, we define new frame as vehicle:Toyota and link the new
frame with the above frame through the slot called Make
So we can have a network of frames
62
Comments on Frames
63
Scripts
64
Components of a script
Entry conditions
Assumption about the world for a script to begin (e.g. fight)
Results
Condition to meet once the script terminate
Props
Things that are involved in the scene (tables, etc.)
Roles
People and actions
Scenes
Temporal sequence of the sub-event in a script
65
Ontology
66