310 likes | 390 Views
Master of Science in Artificial Intelligence, 2011-2013. Knowledge Representation and Reasoning. University "Politehnica" of Bucharest Department of Computer Science Fall 2011 Adina Magda Florea http://turing.cs.pub.ro/krr_11 curs.cs.pub.ro. Lecture 4 - Supliment.
E N D
Master of Science in Artificial Intelligence, 2011-2013 Knowledge Representation and Reasoning University "Politehnica" of Bucharest Department of Computer Science Fall 2011 Adina Magda Florea http://turing.cs.pub.ro/krr_11 curs.cs.pub.ro
Lecture 4 - 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 reasoning 3
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 TMS • Belief - expression which can be true or false • Justification - inference rule (step) which lead to a belief • Premise - true fact (no justification needed) Inference Engine (IE) Justifications Beliefs Knowledge Base 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) Nonmonotonic production rule 9
The ABC Murder Rules R1: 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) andifnot Minte(y) then Alibi(x) R4: ifnot ~Spune_adevar(x) then Alibi(x) 10
justified assumption justification premise unjustified assumption TMS for the ABC Murder (Node (IN_List OUT_List)) N1 = Suspect (Alecu) (N1, ( (N2) (N3) ) ) N2 = Beneficiar (Alecu) N3 = ~Alibi(Alecu) 11
TMS for the ABC Murder Suppose new beliefs are added Inregistrat la hotel Alecu, Departe Arad, ~Falsificat registru R2: if Hotel(x,y) and Departe(y) and ifnot Falsificat(y) then Alibi(x) R1: if Beneficiar(x) and ifnot Alibi(x) then Suspect(x) 12
TMS for the ABC Murder Suppose another new belief is added Barbu aparat de Cumnat R3: if Aparat(x, y) andifnot Minte(y) then Alibi(x) 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) R1: if Beneficiar(x) and ifnot Alibi(x) then Suspect(x) 14
TMS for the ABC Murder Represent contradiction 15
TMS for the ABC Murder New beliefs are added 16
TMS for the ABC Murder The new beliefs bring a contradiction 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 N OR • 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} 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
Justified Assumption (Regular node) Justification Premise Unjustified assumption (Assumption) Types of nodes (Node (IN_List OUT_List)) N1 = Suspect (Alecu) (N1, ( (N2) (N3) ) ) N2 = Beneficiar (Alecu) N3 = ~Alibi(Alecu) + 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
Responsibilities of the IE: Adds premises and makes assumptions Apply rules and adds justifications Retracts assumptions Provides advise on handling contradictions TMS/IE responsibilities • Responsibilities of the TMS: • Cashes beliefs and maintains node labels • Detects contradictions • Performs belief revision • Generates explanations 24
IE action A. Provides a mapping between IE and TMS data structures: If a new node is needed, IE must inform TMS about it, and give the connection between this node and the corresponding assertions. To use TMS nodes, IE must be able to retrieve TMS nodes associated with assertions that IE works with. IE must provide a way for defining nodes as premises, and for enabling/retracting assumptions. TMS/IE interface • TMS action A. Creates nodes with specified properties 25
IE action B. Provides facilities for representing justifications. C. Provides facilities for inspecting TMS beliefs, i.e. accessing label information. TMS/IE interface • TMS action B. Accepts records of IE deductions (as justifications) C. Computes the correct label for nodes and supplies them on request. • Derives consequences of assumptions & premises based on the dependency network • When assumptions are retracted, their consequences are retracted • Provides explanations for beliefs, e.g., inferences 26
IE action D. Provides facilities for contradiction handling. TMS/IE interface • 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. ifJ 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. ifNi is OUT then 1.1.1. Evaluate new state of Nibased 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. ifNi is IN then 2.1.1. Build list LN with all nodes recursively justified by N 2.1.2. for all nodes Nj in LNdo i. Nj.Label OUT /* mark Nj with OUT */ 2.1.3. for all nodes Nj in LNdo i. Evaluate Nj.State /* Nj.State may be IN or OUT */ ii. Nj.Label Nj.State /* update Nj state */ end 30