Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.

Improved support for IntMod type in symbolic backends #93

Merged
merged 12 commits into from
Nov 3, 2020
Merged

Conversation

brianhuffman
Copy link
Contributor

This fixes some of the problems mentioned as part of GaloisInc/saw-script#745, specifically the ones involving uninterpreted functions over the integers-mod-n type: GaloisInc/saw-script#745 (comment)

@brianhuffman
Copy link
Contributor Author

There is still a bit more work to do here, related to the Labeler datatype. I realized that the getLabelValues function in saw-script uses the Labeler values to build FirstOrderValues from solver counterexamples. But currently this will produce a FOVInt constructor for any IntMod-typed variable, which doesn't have the right type. It will work well enough if we're just printing out the counterexamples, but if we try to build saw-core terms from them, they won't be type correct.

To get this in a better state, we first need to add a FOVIntMod constructor to the FirstOrderValue datatype. Then we need to move the definition of getLabelValues from saw-script into saw-core-what4 (which will allow us to keep type Labeler abstract) and modify it (and the Labeler type as needed) to produce the right values for IntMod variables.

@brianhuffman brianhuffman marked this pull request as draft October 23, 2020 16:21
Brian Huffman added 9 commits November 2, 2020 17:27
Also reimplement `IntMod` type in simulator backends
to use it.
Also convert primitive implementations to use it.
Quantified variables of type `IntMod n` should work again in
the what4/sbv backends.
…nds.

When we generate an uninterpreted function in a symbolic backend that
takes an argument of type `IntMod n`, we normalize the symbolic integer
argument by reducing mod n. This ensures that the resulting expression
will respect the underlying equivalence relation for the `IntMod n` type.
Brian Huffman added 2 commits November 2, 2020 18:51
Also add `getLabelValues` function from saw-script to saw-core-what4.
@brianhuffman brianhuffman marked this pull request as ready for review November 3, 2020 04:20
@brianhuffman
Copy link
Contributor Author

I think this is ready to merge now. There are some additional refactorings that could be done to the Labeler type, but I think those can wait until we switch saw-script to use the getLabelValues function from saw-core-what4 instead of its own version of that function; at that point we can make the Labeler type abstract and then we can refactor it freely.

Copy link
Contributor

@robdockins robdockins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK to me.

@brianhuffman brianhuffman merged commit 7b04d2e into master Nov 3, 2020
brianhuffman pushed a commit to GaloisInc/saw-script that referenced this pull request Nov 7, 2020
The What4 prover interface now uses `getLabelValues` from the
saw-core-what4 package.
brianhuffman pushed a commit that referenced this pull request Nov 24, 2020
It had been broken since #93 introduced a separate value constructor
for the `IntMod` type.

(GaloisInc/saw-script#936)
brianhuffman pushed a commit that referenced this pull request Dec 10, 2020
This was an unintentional omission from PR #93, which correctly
updated `intModUnOp` in the what4 backend, but not in sbv.

Fixes #114.
@brianhuffman brianhuffman deleted the intmod branch January 22, 2021 12:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants