chord semantics january, 2007. f-atoms user defined constraint – a::b – a[b->c], a[b=>c]...
TRANSCRIPT
![Page 1: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/1.jpg)
CHORD Semantics
January, 2007
![Page 2: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/2.jpg)
F-Atoms
• User Defined Constraint– A::B– A[B->C], A[B=>C]– A[B(V)->C], A[B(P:T0)=>T1]
• Built-in Constraint– 1 : Integer, “abc” : String– Integer :: Double– 1[toString()->”1”]– ...
![Page 3: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/3.jpg)
Monotonic OO Semantics
General Rules: X::Y, Y::Z ==> X::Z.
X::Y, Y[M=>T] ==> X[M=>T]. X[M=>T] ==> X[M->V].
X[M=>T], X[M->V] ==> V::T. X[M->V1], X[M->V2] ==> V1 = V2.
X[M(V)->R], X[M(P:T0)=>T1) ==> V:T0, R:T1.
Simple Inheritance: X::Y, X::Z ==> Y = Z.
![Page 4: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/4.jpg)
Non-MonotonicOO Semantics
(Overriding & Multiple Inheritance)
![Page 5: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/5.jpg)
CHR Semantics x Open World Assumption
• Notation– ConstraintStore = Set(Constraint)– Program = Set(Rule)– i = initial constraint store– p = current program
![Page 6: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/6.jpg)
CHR Semantics x Open World Assumption
• R : ConstraintStore x Program x ConstraintStore– Reachable predicate– R(cs, p) = some constraint store reachable from cs by
iteratively applying the rules from p
• I : Constraint x ConstraintStore x Program { t, f, u}– Interpretation function– Computes the “truth-value” of a constraint given some
initial constraint store and set of rules• t, the constraint can be proved true• f, the constraint can be proved false• u, the constraint can’t be proved neither true nor false
![Page 7: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/7.jpg)
CHR Semantics x Open World Assumption
• cs (c s s R(i,p) I(c,i,p) = t)– Everything appearing in some reachable state is true
• cs (I(c,i,p) = u c s s R(i,p))– Every undefined constraint does not appear in any reachable
state
• c s (I(c,i,p) = f c s s R(i,p) false R(ic,p))– Every false constraint causes a failed final state when added to
some constraint store
![Page 8: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/8.jpg)
CHR Semantics x Open World Assumption
• Remarks– We can’t reason directly about negative or
undefined facts in CHR– The set of positive facts is partially observable– We can prove some fact to be false by finding a
proof for its negation (Reductio Ad Absurdum)
![Page 9: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/9.jpg)
OO Inheritance in OWA
![Page 10: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/10.jpg)
c1 :: c2, c2[m->b]
true c1 :: c2, c2[m->b], c1[m->b]false c1 :: c3, c3 :: c2 ...undefined
Closed World Semantics
![Page 11: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/11.jpg)
c1 :: c2, c2[m->b]
true X (c1[m->X]), c1 :: c2, c2[m->b]false c2 :: c1, c2[m->c1], ...unknown c1[m->b], c1 :: c3, c3 :: c2, ...
Open World Semantics
![Page 12: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/12.jpg)
Overriding in OWA (1st Version)
X::Y, Y[M->>V] ==> X[M->>V1]
• Problems:– Too limited– Unnatural
• Solution– Use CWA locally for overriding missing facts
• if obtained facts do not contradict known facts
– Is this abduction?
![Page 13: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/13.jpg)
Locally Closed OO Semantics for CHORD
![Page 14: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/14.jpg)
Local Inheritance Context
• Definition:–a :: b, b[m->d]–b[m->d]/a
![Page 15: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/15.jpg)
Local Overriding Inheritance Context
• Proposal:– Change the semantics from:
• a :: b b[m->d] (1)– To:
• a :: b b[m->d] X,Y( a::X X::b X[m->Y]) (2)– In this case we can inherit:
• a[m->d] (3)• If it comes directly from b
– If (2) is consistent with the current constraint store and program rules we say that (1) is a Consistent Overriding Local Inheritance Context
![Page 16: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/16.jpg)
Not all Local Overriding Inheritance Contexts are consistent...
![Page 17: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/17.jpg)
c1[m->a] ==> c1::c3.
GOAL: c1::c2, c3::c2, c2[m->a], c3[m->b]
c1::c2, c2[m->a] is a local overriding inheritance context!
c1[m->a]/c2 is NOT a consistent local overridinginheritance context because
X,Y( c1::X X::c2 X[m->Y]) is false for X = c3, Y = b
![Page 18: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/18.jpg)
Proposal
Local Inheritance Contexts
Constraint Store
1. The final stores considers just the consistentlocal overriding inheritance contexts
2. Use backtracking to find the consistentlocal inheritance contexts
![Page 19: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/19.jpg)
Important
There’s no negation in CHR so:
It’s not possible to directly prove anything like:
X,Y( a::X X::b X[m->Y])
BUT we can look for a counterexample.
![Page 20: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/20.jpg)
Overriding in OWA (2nd Version) /1
X::Y, Y[M->V] ==> X[M->V1], ((V=V1, X[M->V1]/Y) ; true)
1st option:Suppose I’m consistent and the value of V can be directly inherited
2nd option:Maybe I’m not consistent
![Page 21: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/21.jpg)
Overriding in OWA (2nd Version) /2
X[M->V]/Y, X::C, C::Y, C[M->Vx] ==> false.
Is there any provable counterexample?Backtrack.
![Page 22: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/22.jpg)
Multiple Inheritance
![Page 23: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/23.jpg)
Local Source Based Multiple Inheritance Context
• Proposal:– Change the semantics from:
• a :: b b[m->d] (1)– To:
• a :: b b[m->d] X,Y,T( b≠X a::X b::X X::b (X[m->Y] X[m=>T])) (2)
– In this case we can inherit:• a[m->d] (3)• If no other unrelated superclass defines m (for any value)
– If (2) is consistent with the current constraint store and program rules we say that (1) is a Consistent Local Source Based Multiple Inheritance Context
![Page 24: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/24.jpg)
Local Value Based Multiple Inheritance Context
• Proposal:– Change the semantics from:
• a :: b b[m->d] (1)– To:
• a :: b b[m->d] X,Y,T( b≠X a::X b::X X::b X[m->Y] Y ≠ d) (2)
– In this case we can inherit:• a[m->d] (3)• If no other unrelated superclass defines m to be d
– If (2) is consistent with the current constraint store and program rules we say that (1) is a Consistent Local Value Based Multiple Inheritance Context
![Page 25: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/25.jpg)
Multiple Inheritance in OWA
• We can’t do this change only by the means of extra rules:– We can’t prove negative constraints like
X,Y,T( b≠X a::X b::X X::b (X[m->Y] X[m=>T])))
– We can’t find a counterexample for it• We would need to prove “X::b”
• We need to change the default semantics of CHR
![Page 26: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/26.jpg)
Possible Solutions
• Adopt a less restrictive multiple inheritance semantics
• Extend CHR semantics to handle negation
![Page 27: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/27.jpg)
Less Restrictive Multiple Inheritance Semantics
![Page 28: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/28.jpg)
Proposal
• We do not need extra rules to handle multiple inheritance. Ex:
a::b, a::c, b[m->2], b[m->3]
– This constraint store is false, because we are going to inherit a[m->2] and a[m->3] for a
• This is a similar approach to current programming languages supporting multiple inhertance (e. g. C++)– Multiple inheritance conflicts cause compilation or runtime
errors.
![Page 29: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/29.jpg)
Changing default CHR semantics
![Page 30: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/30.jpg)
Source Based Multiple inheritance in OWA
X[M->V]/Y, X::C, C::Y, Y::C, C[M->Vx] ==> YC | false.
X[M->V]/Y, X::C, C::Y, Y::C, C[M=>T] ==> YC | false.
Is there any provable counterexample?Backtrack.
![Page 31: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/31.jpg)
Value Based Multiple inheritance in OWA
X[M->V]/Y, X::C, C::Y, Y::C, C[M->V] ==> YC | false.
Is there any provable counterexample?Backtrack.
![Page 32: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/32.jpg)
CHRD¬
![Page 33: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/33.jpg)
Negation as Absense
• Extending CHR with negation as Absence [Schrijvers et al 2006]
• p \\ q ==> r– If p is present and q is absent, then add r
• Conclusion– Lost declarativity– Lost theoretical properties – Non-logical negation
• We need logical negation!
![Page 34: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/34.jpg)
Negation in Integrity Constraints + Abduction
• An Experimental CLP Platform for Integrity Constraints and Abduction [Abdennadher, 2000]
• For each predicate p, generate an abducible predicate p characterized by the integrity constraint:– p, p ==> false
![Page 35: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/35.jpg)
Negation in Integrity Constraints + Abduction
• Conclusion– Doesn’t properly handle negation in rule head
• p may be true even if there’s no “p” in the constraint store
a ==> falsep ==> ab, p ==> cd, c ==> t
Initial store: b, d
“t” is true, however Abdennadher can’t prove it
![Page 36: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/36.jpg)
My Proposal
• For each user defined constraint p– allow the constraint p having the same
arity– add the following integrity constraint
• p(X), p(Y) ==> X = Y | false
• Change rule head matching semantics
![Page 37: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/37.jpg)
New rule semantics
• p0, ..., pn ==> g | b– If
• “p0,...,pk” match some constraint set in the current constraint store
– At least one constraint in the rule head must be on the constraint store (avoids trivial non termination)
• Adding “(pk+1 ; ... ; pn)” to current constraint store doesn’t lead to a failed state
• Guard holds
– Then• Add body to the current constraint store
![Page 38: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/38.jpg)
Remarks
• This approach • adds logical negation to CHR• Generalizes the semantics of CHR rule matching
– CHRD: rule fires if there’s a set of matching constraints on the constraint store– CHRD : rule fires if there is a proof for the existence of matching
constraints for the rule head» Looking for matching constraints is still proving them
• Adding “(r s)” to current constraint store means:• T (r s ) |= • T |= (r s ) • T |= (r s )• T |= r s
![Page 39: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/39.jpg)
Example
R1 @ p ==> falseR2 @ b, p ==> cR3 @ d, c ==> t
Initial store: b, d
![Page 40: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/40.jpg)
Example – Extended Program
R1 @ p ==> falseR2 @ b, p ==> cR3 @ d, c ==> tE1 @ b, b ==> falseE2 @ c, c ==> falseE3 @ d, d ==> falseE4 @ p, p ==> false
![Page 41: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/41.jpg)
Example – Execution
R1 @ p ==> falseR2 @ b, p ==> cR3 @ d, c ==> t
E1 @ b, b ==> falseE2 @ c, c ==> falseE3 @ d, d ==> falseE4 @ p, p ==> false
+ Store: b, d+ Rule try: R3, (trying: c)
++ Store: b, d, c++ Rule try: R2 (trying: p)
+++ Store: b, d, c, p+++ Rule: R1 – failed state, backtrack
++ Store: b, d, c, c++ Rule: E2 – failed state, backtrack
+ Store: b, d, t
![Page 42: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/42.jpg)
Example with Variables
R1 @ p(2) ==> false.R2 @ q(X), p(X) ==> s(X).
Initial store: q(2)
![Page 43: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/43.jpg)
Example with Variables – Extended Program
R1 @ p(2) ==> false.R2 @ q(X), p(X) ==> s(X).E1 @ p(X), p(Y) ==> X = Y | false.E2 @ q(X), q(Y) ==> X = Y | false.E3 @ s(X), s(Y) ==> X = Y | false.
![Page 44: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/44.jpg)
Example with Variables – Execution
R1 @ p(2) ==> false.R2 @ q(X), p(X) ==> s(X).
E1 @ p(X), p(Y) ==> X = Y | falseE2 @ q(X), q(Y) ==> X = Y | falseE3 @ s(X), s(Y) ==> X = Y | false
+ Store: q(2)+ Rule try: R2 (trying p(2))
++ Store: q(2), p(2)++ Rule: R1, failed state, backtrack
+ Store: q(2), s(2)
![Page 45: CHORD Semantics January, 2007. F-Atoms User Defined Constraint – A::B – A[B->C], A[B=>C] – A[B(V)->C], A[B(P:T0)=>T1] Built-in Constraint – 1 : Integer,](https://reader035.vdocuments.net/reader035/viewer/2022062515/56649d0b5503460f949dee20/html5/thumbnails/45.jpg)
Future Work on CHRD¬
• Investigate termination of CHRD¬ programs– Rules may be appliable even with no matching
constraint at current constraint store
• Investigate variables in rule head– How to deal with not found constraints containing
uninstantiated variables?