Justifications in Constraint Handling Paper: Thom Frühwirth Rules for Logical Retraction in Dynamic Presentation: Daniel Gall October 10, 2017 Algorithms
Page 2 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 Constraint Handling Rules with Justifications Justifications ◮ Mark derived information explicitly ◮ Track origin of information ◮ Logical Retraction ◮ Conclusions can be withdrawn by retracting their premises
Page 2 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 Constraint Handling Rules with Justifications Justifications ◮ Mark derived information explicitly ◮ Track origin of information ◮ Logical Retraction ◮ Conclusions can be withdrawn by retracting their premises Goal ◮ Extend Constraint Handling Rules (CHR) with justifications (CHR J ) ◮ Operational equivalence of rule applications ◮ Logical retraction ◮ Correctness and confluence of retraction ◮ Proof-of-concept implementation
Page 3 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 Constraint Handling Rules with Justifications – Example Minimum min(N) \ min(M) <=> N<M | true. Example min ( 1 ) { f 1 } , min ( 0 ) { f 2 } , min ( 2 ) { f 3 } ◮ c F : F is set of justifications for constraint c
Page 3 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 Constraint Handling Rules with Justifications – Example Minimum min(N) \ min(M) <=> N<M | true. Example min ( 1 ) { f 1 } , min ( 0 ) { f 2 } , min ( 2 ) { f 3 } �→ rem ( min ( 1 ) { f 1 } ) { f 1 , f 2 } , min ( 2 ) { f 3 } , min ( 0 ) { f 2 } ◮ c F : F is set of justifications for constraint c
Page 3 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 Constraint Handling Rules with Justifications – Example Minimum min(N) \ min(M) <=> N<M | true. Example min ( 1 ) { f 1 } , min ( 0 ) { f 2 } , min ( 2 ) { f 3 } �→ rem ( min ( 1 ) { f 1 } ) { f 1 , f 2 } , min ( 2 ) { f 3 } , min ( 0 ) { f 2 } �→ rem ( min ( 1 ) { f 1 } ) { f 1 , f 2 } , rem ( min ( 2 ) { f 3 } ) { f 2 , f 3 } , min ( 0 ) { f 2 } ◮ c F : F is set of justifications for constraint c
Page 3 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 Constraint Handling Rules with Justifications – Example Minimum min(N) \ min(M) <=> N<M | true. Example min ( 1 ) { f 1 } , min ( 0 ) { f 2 } , min ( 2 ) { f 3 } �→ rem ( min ( 1 ) { f 1 } ) { f 1 , f 2 } , min ( 2 ) { f 3 } , min ( 0 ) { f 2 } �→ rem ( min ( 1 ) { f 1 } ) { f 1 , f 2 } , rem ( min ( 2 ) { f 3 } ) { f 2 , f 3 } , min ( 0 ) { f 2 } ◮ c F : F is set of justifications for constraint c ◮ Constraint min ( 0 ) remained ◮ Constraints min ( 1 ) and min ( 2 ) have been removed ◮ Constraint with justification f 2 reason for removal
Page 4 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 Constraint Handling Rules (CHR) ◮ Constraints: first-order logic predicates
Page 4 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 Constraint Handling Rules (CHR) ◮ Constraints: first-order logic predicates Rules H k \ H r ⇔ G | B . ◮ H r removed heads (only user-defined constraints) ◮ H k : kept heads (only user-defined constraints) ◮ G : guard (only built-in constraints) ◮ B : body (user-defined and built-in constraints) ◮ Constraints that match head and satisfy guard are removed/kept ◮ Body is added
Page 5 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 CHR with Justifications (CHR J ) Original Rule l m n � � � r : K i \ R j ⇔ C | B k i = 1 j = 1 k = 1 Translated Rule l m m n R F j rem ( R F j j ) F ∧ K F i � � � � B F rf : \ ⇔ C | k i j i = 1 j = 1 j = 1 k = 1 l m � � where F = F i ∪ F j . i = 1 j = 1 ◮ F i and F j fresh variables that match justification sets ◮ Each CHR constraint in body annotated with union of all justifications
Page 6 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 CHR with Justifications (CHR J ) Original Rule – Short Hand Notation r : H 1 \ H 2 ⇔ C | B . Translated Rule – Short Hand Notation 2 ⇔ C | rem ( H 2 ) J ∧ B J . rf : H J 1 \ H J
Page 6 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 CHR with Justifications (CHR J ) Original Rule – Short Hand Notation r : H 1 \ H 2 ⇔ C | B . Translated Rule – Short Hand Notation 2 ⇔ C | rem ( H 2 ) J ∧ B J . rf : H J 1 \ H J Lemma (Equivalence of Program Rules) The following two propositions are equivalent: ◮ There is a computation step with simpagation rule r: S �→ r T. ◮ There is a computation step with justifications S J �→ rf T J with corresponding rule with justifications rf.
Page 7 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 Logical Retraction Idea ◮ Remove CHR constraint from computation without recomputation from scratch ◮ All consequences due to rule applications using this constraint are undone ◮ Remove CHR constraints added by those rules ◮ Re-add CHR constraints removed by those rules
Page 8 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 Logical Retraction Rules for Retraction For each constraint c / n : kill : kill ( f ) \ G F ⇔ f ∈ F | true revive : kill ( f ) \ rem ( G F c ) F ⇔ f ∈ F | G F c , where ◮ G = c ( X 1 ,..., X n ) , ◮ X 1 ,..., X n are different variables. ◮ Constraint may be revived and subsequently killed: ◮ if F c and F contain justification f
Page 9 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 Confluence of Logical Retraction Confluence
Page 9 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 Confluence of Logical Retraction Confluence ∗
Page 9 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 Confluence of Logical Retraction Confluence ∗ ∗
Page 9 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 Confluence of Logical Retraction Confluence ∗ ∗ ∗ ∗
Page 10 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 Confluence of Logical Retraction Confluence in CHR ◮ Decidable criterion for terminating programs
Page 10 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 Confluence of Logical Retraction Confluence in CHR ◮ Decidable criterion for terminating programs ◮ Two rules: r 1 and r 2
Page 10 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 Confluence of Logical Retraction Confluence in CHR ◮ Decidable criterion for terminating programs ◮ Two rules: r 1 and r 2 ◮ Overlap states: Overlap heads and guard of rules
Page 10 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 Confluence of Logical Retraction Confluence in CHR ◮ Decidable criterion for terminating programs ◮ Two rules: r 1 and r 2 r 1 r 2 ◮ Overlap states: Overlap heads and guard of rules ◮ Critical pairs: Apply rules to overlap state
Page 10 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 Confluence of Logical Retraction Confluence in CHR ◮ Decidable criterion for terminating programs ◮ Two rules: r 1 and r 2 r 1 r 2 ∗ ∗ ◮ Overlap states: Overlap heads and guard of rules ◮ Critical pairs: Apply rules to overlap state ◮ If all critical pairs joinable, the program is confluent
Page 11 Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms | T. Frühwirth, D. Gall | October 10, 2017 Confluence of Logical Retraction Idea ◮ Intuitively: Rules for retraction do not interefere with each other ◮ Additional rules do not break potential confluence of a program ◮ It does not make a difference if a justification is retracted immediately or if other rules are applied first
Recommend
More recommend