I am using functions in my solver to model discrete time. The problem is that right now we use functions like z3.Function(\'f\', IntSort(), IntSort())
and negative
As pointed out in the comments, there's no such sort; and your best bet is to make sure you have t >= 0
assertions for all uses.
Note that this is actually trickier in practice. Not only you need to make this assertion for all your "fresh" variables, but also whenever you do any arithmetic with such variables to ensure the results remain within the domain. That is, if you ever compute t-1
, then you'll want t >= 1
as an assertion appearing, assuming the result of that expression is used as a time value itself.
This can get really tedious really quick, so having a mechanism ("overloaded arithmetic") can simplify life. But of course, that depends on exactly how you are programming your constraints, whether you're using SMT-Lib, or one of the APIs via a higher-level language.