potassco / ngo

Non Ground Optimizer for logic programs.
MIT License
4 stars 0 forks source link

Unused - improve unused arity detection #97

Open MaxOstrowski opened 10 months ago

MaxOstrowski commented 10 months ago
q(X,Y) :- p(X), w(Y).
r(X) :- q(X,X).

The second parameter of q is not really used but an equivalence is implied. This could be translated to:

q(X) :- p(X), w(Y), X = Y.
r(X) :- q(X).

Not only equalities, but all kinds of relations between X and Y can be captured to reduce the number of rules grounded from the first rule.