Date post: | 31-Dec-2015 |
Category: |
Documents |
Upload: | aladdin-delaney |
View: | 24 times |
Download: | 0 times |
Knowledge Representation and Reasoning
University "Politehnica" of Bucharest
Department of Computer Science
Fall 2011
Adina Magda Florea
Master of Science in Artificial Intelligence, 2011-2013
Lecture 4 – NML Supliment
Truth Maintenance Systems TMS Functioning Data structures for a TMS TMS/IE responsibilities TMS/IE interface
TMS
Truth Maintenance Systems
Non monotonic reasoning Increase efficiency of problem solving Good for:
• validate assumptions
• redraw abandoned conclusions NMR dependency directed backtracking (DDBkt)
• control program actions
• explain reasoning3
Dependency Directed Bkt
(1) x {0,1} (2) a = e1(x)
(3) y {0,1} (4) b = e2(x)
(5) z {0,1} (6) c = e3(x)
(7) b c (8) a b
ei(x) = (x+100000)!, i=1,2,3
Find a, b, c to satisfy (1)-(8)
x=0, y=0, z=0 and x=0, y=0, z=1 are rejected because of (7) and (8) – y's value
backtrack to y c = e3(0) and c = e3(1) are lost 4
TMS principles
Each action in the problem solving process has an associated justification
When a contradiction is obtained, find the minimal set of assumptions which generated the contradiction – if we eliminate an element from this set, the justification for the contradiction is not valid any more and the contradiction is removed
Propagate the effects of adding a justification and of eliminating a belief + keep consistency
Select an assumption from the minimal set which generated the contradiction and defeat it
5
TMS Structure
InferenceEngine (IE)
TMS
KnowledgeBase
Justifications
Beliefs
Belief -
expression which can be true or false Justification -
inference rule (step) which lead to
a belief Premise -
true fact (no justification needed)
6
TMS Structure
Set of nodes in the TMS Every node has 2 states
• IN (believed node)
• OUT (node not believed) Set of valid assumptions = set of IN nodes
in the TMS
7
TMS Structure
The nodes may be:
• premises – no justification needed, IN nodes
• belief – may be believed (IN) or not (OUT)
• assumption - with supporting justifications – IN nodes if the justification is true, OUT nodes otherwise
A justification = set of nodes used to infer the justified node, composed of 2 lists:
• IN List – nodes that have to be IN for the justification to be true / to support an IN node
• OUT List – nodes that have to be OUT for the justification to be true / to support an IN node
8
The ABC Murder
Initial set of beliefs
Beneficiar (Alecu) ~Alibi(Alecu)
Beneficiar(Barbu)
Beneficiar(Cezar)
R1: if Beneficiar(x)
and ifnot Alibi(x)
then Suspect(x)
Beneficiar(x) ~ Alibi(x) Suspect(x) : /
Nonmonotonic production rule
9
The ABC Murder
RulesR1: if Beneficiar(x)
and ifnot Alibi(x)then Suspect(x)
R2: if Hotel(x,y)
and Departe(y)
and ifnot Falsificat(y)
then Alibi(x)
R3: if Aparat(x, y)
and ifnot Minte(y)
then Alibi(x)
R4: ifnot ~Spune_adevar(x)
then Alibi(x)
Beneficiar(x) ~ Alibi(x) Suspect(x) : /
10
TMS for the ABC Murder
(Node (IN_List OUT_List))
N1 = Suspect (Alecu) (N1, ( (N2) (N3) ) )N2 = Beneficiar (Alecu)N3 = ~Alibi(Alecu)
Suspect Alecu [IN]
Beneficiar Alecu [IN] Alibi Alecu [OUT]
+ Lista IN Lista OUT
premisã aserþiune nejustificatã
justificare
aserþiune justificatã
justification
justifiedassumption
premise unjustified assumption 11
TMS for the ABC Murder
Suppose new beliefs are addedInregistrat la hotel Alecu, Departe Arad, ~Falsificat registruR2: if Hotel(x,y)
and Departe(y)
and ifnot Falsificat(y)
then Alibi(x) Suspect Alecu [OUT]
Beneficiar Alecu [IN] Alibi Alecu [IN]
+
Înregistrat la hotel Alecu [IN] Departe Arad [IN] Falsificat registru [OUT]
+ +
R1: if Beneficiar(x) and ifnot Alibi(x) then Suspect(x)
12
TMS for the ABC Murder
Suppose another new belief is addedBarbu aparat de CumnatR3: if Aparat(x, y)
and ifnot Minte(y)
then Alibi(x)
Suspect Barbu [OUT]
Beneficiar Barbu [IN] Alibi Barbu [IN]
+
Barbu apãrat de Cumnat [IN] Minte Cumnat [OUT]
+
R1: if Beneficiar(x) and ifnot Alibi(x) then Suspect(x)
13
TMS for the ABC Murder
What about Cezar?R4: ifnot ~Spune_adevar(x)
then Alibi(x)
Suspect Cezar [IN]
Beneficiar Cezar [IN] Alibi Cezar [OUT]
+
Spune adevãrul Cezar [OUT]+
+
R1: if Beneficiar(x) and ifnot Alibi(x) then Suspect(x)
14
TMS for the ABC Murder
Represent contradiction
Contradicþie [OUT]
Suspect Alecu [OUT] Suspect Barbu [OUT] Suspect Cezar [IN] Alþi Suspecþi [OUT]
15
TMS for the ABC Murder
New beliefs are added
Suspect Cezar [OUT]
Beneficiar Cezar [IN] Alibi Cezar [IN]
+
Spune adevãrul Cezar [IN]+
+
Vãzut TV Cezar [IN] TV Falsificat [OUT]
+
16
TMS for the ABC Murder
The new beliefs bring a contradiction
Contradicþie [IN]
Suspect Alecu[OUT] Suspect Barbu[OUT] Suspect Cezar[OUT] Alþi Suspecþi[OUT]
17
Removing the contradiction
• Identify the minimal set of beliefs that brought the contradiction
• OUT some belief to remove contradiction• Select an assumption (node) N and add a valid
justification to a node N’ OUT List of NOR
• OUT a node N’ IN List of N by adding a valid justification to a node N” OUT List of N’
18
Removing the contradiction
• Justification to remove the contradiction• {Suspect Alecu, Suspect Barbu, Suspect Cezar, Alti
Suspecti}
Contradicþie [OUT]
Suspect Alecu[OUT] Suspect Barbu[OUT] Suspect Cezar[OUT] Alþi Suspecþi[IN]
Alþi Suspecþi [IN]
Suspect Alecu [OUT] Suspect Barbu [OUT] Suspect Cezar [OUT]
19
Data structures for a TMS
Data structures
(1)Node. Contains the following slots: Value – the representation of the associated fact; a unique
value, which is identical with the representation in the KB Label – state of the node - IN or OUT. NodeJustification – list of justifications which justify a given
node. Note that a node may have several justifications IsConsequence – list of justifications in which the node take
part. It is formed of 2 lists:
• ConseqIN – list of justifications in which the node appears in the IN list (N.ConseqIN)
• ConseqOUT - list of justifications in which the node appears in the OUT list (N.ConseqOUT)
Contradiction – a flag indicating if the node is a contradiction 20
Data structures for a TMS
(2) Justification. Contains the following slots: Type – represents the inference type of a justification,
namely premise, Modus Ponens, rule, inheritance, etc. Depends on the Inference Engine and it is given by the IE to the TMS
Consequence – the node the justification justifies Premises – list of nodes that participated in the
inference, formed of the INList of nodes and the OUTList of nodes
(N.Justification)(3) An indexing structure and mechanism to allow fast
search of nodes in the TMS
21
Types of nodes
(Node (IN_List OUT_List))
N1 = Suspect (Alecu) (N1, ( (N2) (N3) ) )N2 = Beneficiar (Alecu)N3 = ~Alibi(Alecu)
Suspect Alecu [IN]
Beneficiar Alecu [IN] Alibi Alecu [OUT]
+ Lista IN Lista OUT
premisã aserþiune nejustificatã
justificare
aserþiune justificatã
Justification
JustifiedAssumption(Regular node)
Premise Unjustified assumption(Assumption)
Rau Alecu [IN]
Unjustified assumption(Assumption)
+
22
Types of nodes
Premise nodes – always true (IN)
Unjustified assumptions nodes (Assumptions) – nodes which IE wants to believe (IN) or not (OUT), although they are not supported by the existing evidence
Justified assumptions nodes (Regular nodes) - nodes which are believed only if there is a valid reason for that (a valid justification). An assumptions that has a valid justification is treated as a Regular node and is IN.
Contradiction nodes – always false (OUT)
23
TMS/IE responsibilities
Responsibilities of the IE:
Adds premises and makes assumptions
Apply rules and adds justifications
Retracts assumptions Provides advise on
handling contradictions
Responsibilities of the TMS:
Cashes beliefs and maintains node labels
Detects contradictions Performs belief revision Generates explanations
24
TMS/IE interface IE action
A. Provides a mapping between IE and TMS data structures:
1. If a new node is needed, IE must inform TMS about it, and give the connection between this node and the corresponding assertions.
2. To use TMS nodes, IE must be able to retrieve TMS nodes associated with assertions that IE works with.
3. IE must provide a way for defining nodes as premises, and for enabling/retracting assumptions.
TMS action
A. Creates nodes with specified properties
25
TMS/IE interface IE action
B. Provides facilities for representing justifications.
C. Provides facilities for inspecting TMS beliefs, i.e. accessing label information.
TMS actionB. Accepts records of IE
deductions (as justifications)
C. Computes the correct label for nodes and supplies them on request.
1. Derives consequences of assumptions & premises based on the dependency network
2. When assumptions are retracted, their consequences are retracted
3. Provides explanations for beliefs, e.g., inferences
26
TMS/IE interface
IE action
D. Provides facilities for contradiction handling.
TMS action
D. Detects contradictions, based on contradiction nodes and explicit dependencies.
Ensuring a proper mapping between IE and TMS structures
Assertion i Cash assertion i Node I
TMS network Belief status for Node i
27
TMS – Computes the correct label
Algorithm: Add a node justification
1. Create justification J for node N
2. Update the links to referred nodes for connecting J in the TMS
3. if justified node N is IN
then STOP /* justification does not modify N state*/
4. if justified node N is OUT
then
4.1. Evaluate justification J
4.2. if J is valid
then
4.2.1. Change N state in IN
/* node changes from OUT to IN */
4.2.2. Propagate(N)
end 28
TMS – Computes the correct label
Propagate(N)
1. for all nodes Ni in N.ConseqIN do
1.1. if Ni is OUT
then
1.1.1. Evaluate new state of Ni based on Ni.Justification
/* considering new state IN of N */
1.1.2. if new sate of Ni is IN
then Propagate(Ni)
/* if Ni is IN no modification required */
29
TMS – Computes the correct label
2. for all nodes Ni in N.ConseqOUT do
2.1. if Ni is IN
then
2.1.1. Build list LN with all nodes recursively justified by N
2.1.2. for all nodes Nj in LN do
i. Nj.Label OUT
/* mark Nj with OUT */
2.1.3. for all nodes Nj in LN do
i. Evaluate Nj.State
/* Nj.State may be IN or OUT */
ii. Nj.Label Nj.State
/* update Nj state */
end30
Network update when changing a node state in OUT
N2 [IN] N3 [OUT]
N1 [IN] N4 [IN]
N
OUT
OUT
OUT
[OUT]
[IN][OUT]
[OUT]
+
+