-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve behavior of mod
, int2bv
, bv2nat
, etc. when called on non-constant terms
#801
Comments
Writing this so that I don't forget again: we can't make a second call to |
So now I think that the best way to do this would be:
Of course, if It feels kind of weird because it somewhat blurs the line between terms and representatives, but I don't see a better way. |
This patch lifts the existing implementation in `IntervalCalculus` for delayed computation of the `pow` function (by "delayed computation" I mean that we remember `pow` terms with uninterpreted arguments and evaluate them once their arguments become interpreted). This is a generic way of integrating functions that we know how to compute but not necessarily how to reason about. The patch is concerned about lifting the implementation for `pow` to a generic one and adds `int2bv` and `bv2nat` as delayed functions (with corresponding tests), but does not (yet) use it for other partially interpreted functions from the arithmetic theory (e.g. `Modulo`, `Real_of_int`, and the like); this will be done separately. The implementation is placed in a new `Rel_utils` module that is intended to provide scaffolding for generic behavior (such as delayed computation) that can be useful for all relations. An alternative would be to support delayed computation in a fully generic way in the `Relation` module directly; providing the feature in `Rel_utils` is (slightly) simpler and keeps things more decoupled; the implementation can easily be moved to `Relation` later if we want to. Fixes OCamlPro#801
This patch lifts the existing implementation in `IntervalCalculus` for delayed computation of the `pow` function (by "delayed computation" I mean that we remember `pow` terms with uninterpreted arguments and evaluate them once their arguments become interpreted). This is a generic way of integrating functions that we know how to compute but not necessarily how to reason about. The patch is concerned about lifting the implementation for `pow` to a generic one and adds `int2bv` and `bv2nat` as delayed functions (with corresponding tests), but does not (yet) use it for other partially interpreted functions from the arithmetic theory (e.g. `Modulo`, `Real_of_int`, and the like); this will be done separately. The implementation is placed in a new `Rel_utils` module that is intended to provide scaffolding for generic behavior (such as delayed computation) that can be useful for all relations. An alternative would be to support delayed computation in a fully generic way in the `Relation` module directly; providing the feature in `Rel_utils` is (slightly) simpler and keeps things more decoupled; the implementation can easily be moved to `Relation` later if we want to. Fixes OCamlPro#801
This patch lifts the existing implementation in `IntervalCalculus` for delayed computation of the `pow` function (by "delayed computation" I mean that we remember `pow` terms with uninterpreted arguments and evaluate them once their arguments become interpreted). This is a generic way of integrating functions that we know how to compute but not necessarily how to reason about. The patch is concerned about lifting the implementation for `pow` to a generic one and adds `int2bv` and `bv2nat` as delayed functions (with corresponding tests), but does not (yet) use it for other partially interpreted functions from the arithmetic theory (e.g. `Modulo`, `Real_of_int`, and the like); this will be done separately. The implementation is placed in a new `Rel_utils` module that is intended to provide scaffolding for generic behavior (such as delayed computation) that can be useful for all relations. An alternative would be to support delayed computation in a fully generic way in the `Relation` module directly; providing the feature in `Rel_utils` is (slightly) simpler and keeps things more decoupled; the implementation can easily be moved to `Relation` later if we want to. Fixes OCamlPro#801
This patch lifts the existing implementation in `IntervalCalculus` for delayed computation of the `pow` function (by "delayed computation" I mean that we remember `pow` terms with uninterpreted arguments and evaluate them once their arguments become interpreted). This is a generic way of integrating functions that we know how to compute but not necessarily how to reason about. The patch is concerned about lifting the implementation for `pow` to a generic one and adds `int2bv` and `bv2nat` as delayed functions (with corresponding tests), but does not (yet) use it for other partially interpreted functions from the arithmetic theory (e.g. `Modulo`, `Real_of_int`, and the like); this will be done separately. The implementation is placed in a new `Rel_utils` module that is intended to provide scaffolding for generic behavior (such as delayed computation) that can be useful for all relations. An alternative would be to support delayed computation in a fully generic way in the `Relation` module directly; providing the feature in `Rel_utils` is (slightly) simpler and keeps things more decoupled; the implementation can easily be moved to `Relation` later if we want to. Fixes #801
This is an alternative / improved approach to (some of) #736
The crux of the issue is that if we have a function that is interpreted only on constants (i.e. a function for which we can compute, but not reason about, such as
mod
orbv2nat
andint2bv
), once we fall back to its "term" version when the argument is not a constant, we will never evaluate the result.Simple example:
It is not clear to me at the time of writing what the proper fix for this is. Preprocessing unconstrained equalities into hard rewrites would make sense, but we are not really equipped to do it because there are term-indexed maps everywhere. Probably the better fix would be to have a way to indicate that certain functions should trigger a second call to
X.make
when (one of) their argument gets substituted. I am not sure if this should be a different type of semantic values (say,Lazy
orPartial
) or just a flag onTerm
semantic values, although the latter is probably more pragmatic.The text was updated successfully, but these errors were encountered: