clingo
clingo copied to clipboard
Rewrite: extern(Device, function) ==> function(Device)
Question.
I have a logic program for PLCs in which a predicate like:
def_extern(Device, request)
means there is an external literal:
extern(Device, request).
With these I create rules like:
extern(Device, switch) :- extern(Device, request).
This rule is then tested with additional logic, which is the whole point of having this ASP program. If all tests succeed, this rule, exactly as it is, then is translated to code for the PLC. I use grounding and reification for that.
However, I would like to write this rule and all its tests in a more direct way, like:
switch(Device) :- request(Device).
This would make my test code more readable and independent of the way it is derived from the definitions.
I know I can project things using #show
, but beside for the tests, there is no solving and hence no model.
Is there a way to rewrite the following?
def_extern(Device, function) ==> function(Device)