Commit Graph

7 Commits

Author SHA1 Message Date
Patrick Lühne 2245e139b2
Reimplement integer variable detection
This is a reimplementation of the integer variable detection procedure.
The idea is to iteratively assume variables to be noninteger, and to
prove that this would lead to a false or erroneous result. If the proof
is successful, the variable is integer as a consequence.
2018-04-20 16:37:48 +02:00
Patrick Lühne 7ba48044ee
Propagate predicate parameter domains
With this change, domains detected for predicate parameters are properly
propagated to all occurences of the respective variables, enabling more
integer simplifications.
2018-04-20 16:37:48 +02:00
Patrick Lühne 862d03881a
Fix typo 2018-04-20 16:37:48 +02:00
Patrick Lühne 159717f51c
Support declaring functions as integer
This adds a new syntax for declaring functions integer:

    #external integer(<function name>(<arity)).

If a function is declared integer, it may enable some variables to be
detected as integer as well.
2018-04-20 16:37:48 +02:00
Patrick Lühne ae918a0846
Moved Domain enum to separate header
For clarity, this moves the Domain enum class to a separate header,
because it’s not just variable-specific but also applicable to
functions, for example.
2018-04-20 16:37:48 +02:00
Patrick Lühne b5b05b766c
Remove Constant class
Constants are not a construct present in Clingo’s AST and were
unintentionally made part of anthem’s AST. This removes the unused
classes for clarity.
2018-04-20 16:37:48 +02:00
Patrick Lühne 165f6ac059
Implement basic integer variable detection
This adds initial support for detecting integer variables in formulas.
The scope is somewhat limited in that variables matching predicate
parameters with known integer type aren’t propagated to be integer as
well yet. Also, the use of constants and functions prevents variables
from being detected as integer, because they have to be assumed to be
externally defined in such a way that they evaluate to general values
and not necessarily integers.
2018-04-20 16:37:48 +02:00