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

Adjust the sort of mlEquals #4633

Merged
merged 4 commits into from
Sep 6, 2024
Merged

Adjust the sort of mlEquals #4633

merged 4 commits into from
Sep 6, 2024

Conversation

ehildenb
Copy link
Member

@ehildenb ehildenb commented Sep 6, 2024

Currently mlEquals has GeneratedTopCell as the default argument sort, which is pretty specific/limited. Instead, we set K as the default argument sort (supersort of all sorts), and then go to all the sites that use it and specify the argument sort more carefully.

This doesn't affect any downstream repos, none of them use mlEquals directly.

@ehildenb ehildenb self-assigned this Sep 6, 2024
@rv-jenkins rv-jenkins changed the base branch from master to develop September 6, 2024 15:16
@ehildenb ehildenb marked this pull request as ready for review September 6, 2024 16:15
@rv-jenkins rv-jenkins merged commit 86cb320 into develop Sep 6, 2024
17 checks passed
@rv-jenkins rv-jenkins deleted the ml-equals-sort branch September 6, 2024 17:42
rv-jenkins pushed a commit that referenced this pull request Sep 9, 2024
~Blocked on: #4631
~Blocked on: #4630
~Blocked on: #4633

While reviewing and going over
#4621 with @Stevengre , it
became somewhat clear that how we handle turning substitions into ML
predicates is a bit dirty. This attempts to clean this up a bit. Where
potentially breaking changes to API are introduced here, I've checked if
it affects the following repos when I mention "downstream" below:
`evm-semantics kontrol wasm-semantics riscv-semantics mir-semantics`.

In particular:

- The function `CTerm.anti_unify` has a simplification where it reuses a
function from `kast.manip` instead of reimplementing it.
- The functions `CSubst.from_pred` and `CSubst.pred` are added, as
replacements for `Subst.ml_pred`. This is because `Subst.ml_pred`
doesn't have a good way to produce correctly sorted predicates, because
it's in module `kast.inner`.
- `Subst.ml_pred` is removed, and tests are updated to use the new
`CSubst` variant. None of the downstream repositories use
`Subst.ml_pred` directly.
- The new `CSubst.pred` correctly sorts the generated `#Equals` clauses,
defaulting to `K` sort or if a `KDefinition` is supplied using it to do
sort inference. It also provides options for controlling whether we
include the substitution or the constraints in the generated predicate.
- A test is added for a `CSubst.pred` case which caused a bug in the
integration tests dealing with identity substitutions.
- The `CTermSymbolic.implies` function is updated to reuse
`CSubst.from_pred` instead of reimplementing it.
- On the case of duplicate entries, the first is kept and the latter are
made as predicates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants