CHORD Semantics - PowerPoint PPT Presentation

1 / 45
About This Presentation
Title:

CHORD Semantics

Description:

Is this abduction? Locally Closed OO Semantics for CHORD. Local Inheritance Context ... Negation in Integrity Constraints Abduction ... – PowerPoint PPT presentation

Number of Views:48
Avg rating:3.0/5.0
Slides: 46
Provided by: Meu82
Category:

less

Transcript and Presenter's Notes

Title: CHORD Semantics


1
CHORD Semantics
  • January, 2007

2
F-Atoms
  • User Defined Constraint
  • AB
  • AB-gtC, ABgtC
  • AB(V)-gtC, AB(PT0)gtT1
  • Built-in Constraint
  • 1 Integer, abc String
  • Integer Double
  • 1toString()-gt1
  • ...

3
Monotonic OO Semantics
  • General Rules
  •    XY, YZ gt XZ.
  •    XY, YMgtT gt XMgtT.
  •    XMgtT gt XM-gtV.
  •    XMgtT, XM-gtV gt VT.
  •    XM-gtV1, XM-gtV2 gt V1 V2.
  • XM(V)-gtR, XM(PT0)gtT1) gt VT0, RT1.
  • Simple Inheritance
  • XY, XZ gt Y Z.

4
Non-MonotonicOO Semantics(Overriding Multiple
Inheritance)
5
CHR Semantics x Open World Assumption
  • Notation
  • ConstraintStore Set(Constraint)
  • Program Set(Rule)
  • i initial constraint store
  • p current program

6
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 cant be proved neither true
    nor false

7
CHR Semantics x Open World Assumption
  • ?c?s (c ? s ? s ? R(i,p) ? I(c,i,p) t)
  • Everything appearing in some reachable state is
    true
  • ?c?s (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(i?c,p))
  • Every false constraint causes a failed final
    state when added to some constraint store

8
CHR Semantics x Open World Assumption
  • Remarks
  • We cant 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)

9
OO Inheritance in OWA
10
Closed World Semantics
c1 c2, c2m-gtb
true ? c1 c2, c2m-gtb, c1m-gtb false ? c1
c3, c3 c2 ... undefined ?
11
Open World Semantics
c1 c2, c2m-gtb
true ??X (c1m-gtX), c1 c2, c2m-gtb false ?
c2 c1, c2m-gtc1, ... unknown ? c1m-gtb, c1
c3, c3 c2, ...
12
Overriding in OWA (1st Version)
  • XY, YM-gtgtV gt XM-gtgtV1
  • Problems
  • Too limited
  • Unnatural
  • Solution
  • Use CWA locally for overriding missing facts
  • if obtained facts do not contradict known facts
  • Is this abduction?

13
Locally Closed OO Semantics for CHORD
14
Local Inheritance Context
  • Definition
  • a b, bm-gtd
  • bm-gtd/a

15
Local Overriding Inheritance Context
  • Proposal
  • Change the semantics from
  • a b ? bm-gtd (1)
  • To
  • a b ? bm-gtd ? ??X,Y( aX ? Xb ?
    Xm-gtY) (2)
  • In this case we can inherit
  • am-gtd (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

16
Not all Local Overriding Inheritance Contexts are
consistent...
17
c1m-gta gt c1c3. GOAL c1c2, c3c2,
c2m-gta, c3m-gtb c1c2, c2m-gta is a local
overriding inheritance context! c1m-gta/c2 is
NOT a consistent local overridinginheritance
context because ??X,Y( c1X ? Xc2 ? Xm-gtY)
is false for X c3, Y b
18
Proposal
Constraint Store
Local Inheritance Contexts
  • The final stores considers just the
    consistentlocal overriding inheritance contexts
  • Use backtracking to find the consistentlocal
    inheritance contexts

19
Important
  • Theres no negation in CHR so
  • Its not possible to directly prove anything
    like ??X,Y( aX ? Xb ? Xm-gtY)
  • BUT we can look for a counterexample.

20
Overriding in OWA (2nd Version) /1
  • XY, YM-gtV gt
  • XM-gtV1,
  • ((VV1, XM-gtV1/Y) true)

1st option Suppose Im consistent and the value
of V can be directly inherited
2nd option Maybe Im not consistent
21
Overriding in OWA (2nd Version) /2
  • XM-gtV/Y, XC, CY, CM-gtVx gt false.

Is there any provable counterexample? Backtrack.
22
Multiple Inheritance
23
Local Source Based Multiple Inheritance Context
  • Proposal
  • Change the semantics from
  • a b ? bm-gtd (1)
  • To
  • a b ? bm-gtd ? ??X,Y,T( b?X ? aX ? ?bX ?
    ?Xb ? (Xm-gtY ? XmgtT)) (2)
  • In this case we can inherit
  • am-gtd (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

24
Local Value Based Multiple Inheritance Context
  • Proposal
  • Change the semantics from
  • a b ? bm-gtd (1)
  • To
  • a b ? bm-gtd ? ??X,Y,T( b?X ? aX ? ?bX ?
    ?Xb ? Xm-gtY ? Y ? d) (2)
  • In this case we can inherit
  • am-gtd (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

25
Multiple Inheritance in OWA
  • We cant do this change only by the means of
    extra rules
  • We cant prove negative constraints
    like??X,Y,T( b?X ? aX ? ?bX ? ?Xb ?
    (Xm-gtY ? XmgtT)))
  • We cant find a counterexample for it
  • We would need to prove ?Xb
  • We need to change the default semantics of CHR

26
Possible Solutions
  • Adopt a less restrictive multiple inheritance
    semantics
  • Extend CHR semantics to handle negation

27
Less Restrictive Multiple Inheritance Semantics
28
Proposal
  • We do not need extra rules to handle multiple
    inheritance. Ex
  • ab, ac, bm-gt2, bm-gt3
  • This constraint store is false, because we are
    going to inherit am-gt2 and am-gt3 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.

29
Changing default CHR semantics
30
Source Based Multiple inheritance in OWA
  • XM-gtV/Y, XC, ?CY, ?YC, CM-gtVx gt
    Y?C false.
  • XM-gtV/Y, XC, ?CY, ?YC, CMgtT gt
    Y?C false.

Is there any provable counterexample? Backtrack.
31
Value Based Multiple inheritance in OWA
  • XM-gtV/Y, XC, ?CY, ?YC, CM-gtV gt
    Y?C false.

Is there any provable counterexample? Backtrack.
32
CHRD
33
Negation as Absense
  • Extending CHR with negation as Absence
    Schrijvers et al 2006
  • p \\ q gt 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!

34
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 gt false

35
Negation in Integrity Constraints Abduction
  • Conclusion
  • Doesnt properly handle negation in rule head
  • ?p may be true even if theres no ?p in the
    constraint store
  • a gt false
  • p gt a
  • b, ?p gt c
  • d, c gt t
  • Initial store b, d
  • t is true, however Abdennadher cant prove it

36
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) gt X Y false
  • Change rule head matching semantics

37
New rule semantics
  • p0, ..., pn gt 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 (?pk1 ... ?pn) to current
    constraint store doesnt lead to a failed state
  • Guard holds
  • Then
  • Add body to the current constraint store

38
Remarks
  • This approach
  • adds logical negation to CHR
  • Generalizes the semantics of CHR rule matching
  • CHRD rule fires if theres 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

39
Example
  • R1 _at_ p gt false
  • R2 _at_ b, ?p gt c
  • R3 _at_ d, c gt t
  • Initial store b, d

40
Example Extended Program
  • R1 _at_ p gt false
  • R2 _at_ b, ?p gt c
  • R3 _at_ d, c gt t
  • E1 _at_ b, ?b gt false
  • E2 _at_ c, ?c gt false
  • E3 _at_ d, ?d gt false
  • E4 _at_ p, ?p gt false

41
Example Execution
  • R1 _at_ p gt false
  • R2 _at_ b, ?p gt c
  • R3 _at_ d, c gt t
  • E1 _at_ b, ?b gt false
  • E2 _at_ c, ?c gt false
  • E3 _at_ d, ?d gt false
  • E4 _at_ p, ?p gt 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
42
Example with Variables
  • R1 _at_ p(2) gt false.
  • R2 _at_ q(X), ?p(X) gt s(X).
  • Initial store q(2)

43
Example with Variables Extended Program
  • R1 _at_ p(2) gt false.
  • R2 _at_ q(X), ?p(X) gt s(X).
  • E1 _at_ p(X), ?p(Y) gt X Y false.
  • E2 _at_ q(X), ?q(Y) gt X Y false.
  • E3 _at_ s(X), ?s(Y) gt X Y false.

44
Example with Variables Execution
  • R1 _at_ p(2) gt false.
  • R2 _at_ q(X), ?p(X) gt s(X).
  • E1 _at_ p(X), ?p(Y) gt X Y false
  • E2 _at_ q(X), ?q(Y) gt X Y false
  • E3 _at_ s(X), ?s(Y) gt 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)
45
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?
Write a Comment
User Comments (0)
About PowerShow.com