Skip to content
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

fix(Shostak): names must return false for X.is_constant #1031

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

bclement-ocp
Copy link
Collaborator

The X.is_constant function is intended to determine whether a semantic value is a constant value (it is documented to be equivalent to having an empty X.leaves). This invariant is relied upon by the code for delayed computation in Rel_utils that it was introduced for in #869. While the change only makes the delayed computation code less efficient, it makes the X.is_constant function worthless for its original purpose in planned patches.

The invariant was broken in #925 which causes X.is_constant to now consider some terms (specifically, names, i.e. uninterpreted constants) as constants, which is incorrect for the intended and documented purpose of X.is_constant (uninterpreted constants have different values in different context, they are thus not constant values).

This patch restores the original semantic of X.is_constant with improved documentation, and removes the assertion introduced in #925 which seems to be the only incorrect use.

The `X.is_constant` function is intended to determine whether a semantic
value is a constant value (it is documented to be equivalent to having
an empty `X.leaves`). This invariant is relied upon by the code for
delayed computation in `Rel_utils` that it was introduced for in OCamlPro#869.
While the change only makes the delayed computation code less efficient,
it makes the `X.is_constant` function worthless for its original purpose
in planned patches.

The invariant was broken in OCamlPro#925 which causes `X.is_constant` to now
consider some terms (specifically, names, i.e. uninterpreted constants)
as constants, which is incorrect for the intended and documented purpose
of `X.is_constant` (uninterpreted constants have different values in
different context, they are thus not constant values).

This patch restores the original semantic of `X.is_constant` with
improved documentation, and removes the assertion introduced in OCamlPro#925
which seems to be the only incorrect use.
@Halbaroth Halbaroth merged commit 607b93a into OCamlPro:next Jan 23, 2024
13 checks passed
@bclement-ocp bclement-ocp deleted the bclement/const branch March 20, 2024 10:27
@bclement-ocp bclement-ocp added this to the 2.6.0 milestone Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants