Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F2730666
meta.lp
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Mar 13, 11:51 PM
Size
2 KB
Mime Type
text/plain
Expires
Sun, Mar 15, 11:51 PM (1 d, 15 h)
Engine
blob
Format
Raw Data
Handle
243591
Attached To
rXR Xreate
meta.lp
View Options
#hide.
#show holds(atom(_)).
% extract body elements
body(B) :- rule(_,pos(B)).
body(B) :- body(conjunction(S)), set(S,pos(B)).
body(B) :- body(conjunction(S)), set(S,neg(B)).
% define bodies
holds(conjunction(S)) :- holds(A) : set(S,pos(A)),
not holds(A) : set(S,neg(A)), body(conjunction(S)).
holds(sum(L,WL,U)) :- L #sum [ holds(A) = W : wlist(WL,_,pos(A),W),
not holds(A) = W : wlist(WL,_,neg(A),W) ] U, body(sum(L,WL,U)).
holds(avg(L,WL,U)) :- L #avg [ holds(A) = W : wlist(WL,_,pos(A),W),
not holds(A) = W : wlist(WL,_,neg(A),W) ] U, body(avg(L,WL,U)).
holds(min(L,WL,U)) :- L #min [ holds(A) = W : wlist(WL,_,pos(A),W),
not holds(A) = W : wlist(WL,_,neg(A),W) ] U, body(min(L,WL,U)).
holds(max(L,WL,U)) :- L #max [ holds(A) = W : wlist(WL,_,pos(A),W),
not holds(A) = W : wlist(WL,_,neg(A),W) ] U, body(max(L,WL,U)).
holds(even(L,WL,U)) :- #even [ holds(A) = W : wlist(WL,_,pos(A),W),
not holds(A) = W : wlist(WL,_,neg(A),W) ] , body(even(L,WL,U)).
holds(odd(L,WL,U)) :- #odd [ holds(A) = W : wlist(WL,_,pos(A),W),
not holds(A) = W : wlist(WL,_,neg(A),W) ] , body(odd(L,WL,U)).
% derive heads
head(A) :- rule(pos(A),pos(B)), holds(B).
holds(false) :- head(false).
holds(atom(A)) :- head(atom(A)).
holds(A) : set(S,pos(A)) :- head(disjunction(S)).
L #sum [ holds(A) = W : wlist(WL,_,pos(A),W),
not holds(A) = W : wlist(WL,_,neg(A),W) ] U :- head(sum(L,WL,U)).
L #avg [ holds(A) = W : wlist(WL,_,pos(A),W),
not holds(A) = W : wlist(WL,_,neg(A),W) ] U :- head(avg(L,WL,U)).
L #min [ holds(A) = W : wlist(WL,_,pos(A),W),
not holds(A) = W : wlist(WL,_,neg(A),W) ] U :- head(min(L,WL,U)).
L #max [ holds(A) = W : wlist(WL,_,pos(A),W),
not holds(A) = W : wlist(WL,_,neg(A),W) ] U :- head(max(L,WL,U)).
#even [ holds(A) = W : wlist(WL,_,pos(A),W),
not holds(A) = W : wlist(WL,_,neg(A),W) ] :- head(even(L,WL,U)).
#odd [ holds(A) = W : wlist(WL,_,pos(A),W),
not holds(A) = W : wlist(WL,_,neg(A),W) ] :- head(odd(L,WL,U)).
#minimize [ holds(A) = W @ P : wlist(WL,_,pos(A),W) : minimize(P,WL),
not holds(A) = W @ P : wlist(WL,_,neg(A),W) : minimize(P,WL) ].
:- holds(false).
Event Timeline
Log In to Comment