I would like to be able to formulate the following FOL sentence in ASP/clingo:
∀ X. prop(X) ⇐ (∃ Y. ∀ V. ∃ A.
(p(Y, V, A) ∧ q(X, V, A))
)
The domain of both X
and Y
is given by dom/1
. The domain for A
is given by domA/1
. The domain for V
is 1..n
.
The problem for me is the mixed quantification. Now, of course, I could expand the ∀ V
and get something like this:
prop(X) :- p(Y, 1, A_1), q(X, 1, A_1), domA(A_1),
p(Y, 2, A_2), q(X, 1, A_2), domA(A_2),
...,
p(Y, n, A_n), q(X, n, A_n), domA(A_n)
dom(X), dom(Y).
But that does not work well when I don't know n
until runtime (I pass it as a parameter to clingo).
Is there a way to this conveniently and cleanly with clingo? Or should I use the Python/Lua scripting capabilities instead? If so, how?