;; Derived set constraints
(define (!uniono l r l+r)
(fresh (N)
(conde
[(ino N l+r) (!ino N l) (!ino N r)]
[(ino N r) (!ino N l+r)]
[(ino N l) (!ino N l+r)])))
This definition will lead to duplicate answers when N is in r and l but not in l+r.
One way to avoid this overlap would be to explicitly enumerate all three cases: N in r but not in l; N in l but not in r; and N in both r and l.
Another way to avoid the overlap would be to leave !uniono as it is currently defined, but to change the last clause from
[(ino N l) (!ino N l+r)]
to
[(ino N l) (!ino N r) (!ino N l+r)]
This approach introduces asymmetry with respect to the
[(ino N r) (!ino N l+r)]
clause, though.
Other relations in the implementation of CLP(Set) might also have this issue of overlapping clauses.
!uniono
inmk.scm
hasconde
clauses that overlap:This definition will lead to duplicate answers when
N
is inr
andl
but not inl+r
.One way to avoid this overlap would be to explicitly enumerate all three cases:
N
inr
but not inl
;N
inl
but not inr
; andN
in bothr
andl
.Another way to avoid the overlap would be to leave
!uniono
as it is currently defined, but to change the last clause fromto
This approach introduces asymmetry with respect to the
clause, though.
Other relations in the implementation of CLP(Set) might also have this issue of overlapping clauses.