potassco / clingo

🤔 A grounder and solver for logic programs.
https://potassco.org/clingo
MIT License
589 stars 79 forks source link

quick arithmetic between two aggregate expression in place #458

Closed evan0greenup closed 9 months ago

evan0greenup commented 9 months ago

Currently clingo only support comparison or arithmetic operation between constant or variable and aggregate expression. like hello(N, P) :- N = #count{A: kick(A)}.. But it doesn't support for example :- #count{X: vertex(X)} = #count{X,Y: edge(X, Y)}.

It would be nice to add support for expression similar to :- #count{X: vertex(X)} = #count{X,Y: edge(X, Y)}..

rkaminsk commented 9 months ago

It is unlikely that clingo will ever have such an extension. However, you can express this particular case already:

:- #sum{-1,X: vertex(X); 1,X,Y: edge(X, Y)} = 0.