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

quickcheck fails on goals that quantify over tuple or record types #669

Open
brianhuffman opened this issue Apr 7, 2020 · 2 comments · Fixed by GaloisInc/saw-core#51
Open
Assignees
Labels
easy Issues that are expected to be easy to resolve and might therefore be good for new contributors needs test Issues for which we should add a regression test type: bug Issues reporting bugs or unexpected/unwanted behavior
Milestone

Comments

@brianhuffman
Copy link
Contributor

Quantified variables with tuple or record types produce a "term has non-testable type" error message. Tuple and record types should definitely be considered testable.

sawscript> prove (quickcheck 100) {{ \(x:([8],[8])) -> x.0 == x.1 }}
[03:19:09.799] WARNING: using quickcheck to prove goal...

user error ("prove" (<stdin>:1:1-1:6):
"quickcheck" (<stdin>:1:8-1:18):
quickcheck:
term has non-testable type:
let { x@1 = Prelude.Vec 8 Prelude.Bool
    }
 in (x : (x@1 * x@1))
-> Prelude.Bool, for term: let { x@1 = Prelude.Vec 8 Prelude.Bool
    }
 in \(x : (x@1 * x@1)) ->
      Cryptol.ecEq x@1 (Cryptol.PCmpSeqBool (Cryptol.TCNum 8)) x.1 x.2)
sawscript> prove (quickcheck 100) {{ \(x:{a:Bit, b:Bit}) -> x.a \/ x.b }}
[03:20:54.542] WARNING: using quickcheck to prove goal...

user error ("prove" (<stdin>:1:1-1:6):
"quickcheck" (<stdin>:1:8-1:18):
quickcheck:
term has non-testable type:
(x : (Prelude.Bool * Prelude.Bool))
-> Prelude.Bool, for term: \(x : (Prelude.Bool * Prelude.Bool)) -> \/ x.1 x.2)

The same error occurs if the variable was created with fresh_symbolic.

sawscript> x <- fresh_symbolic "x" {| (Bit, Bit) |}
sawscript> prove (quickcheck 100) {{ x.0 \/ x.1 }}
[03:22:34.481] WARNING: using quickcheck to prove goal...

user error ("prove" (<stdin>:1:1-1:6):
"quickcheck" (<stdin>:1:8-1:18):
quickcheck:
term has non-testable type:
(x : (Prelude.Bool * Prelude.Bool))
-> Prelude.Bool, for term: \(x : (Prelude.Bool * Prelude.Bool)) -> \/ x.1 x.2)
@brianhuffman
Copy link
Contributor Author

It looks like the problem originates in the function asFiniteTypePure from module Verifier.SAW.FiniteValue in the saw-core package, which is defined in terms of Verifier.SAW.Recognizer.asTupleType. Apparently, the asTupleType recognizer still expects tuples to be encoded as nested pair types with the unit type at the end; we have not used this encoding of tuples since December 2018 (GaloisInc/saw-core@5c0f54e).

@brianhuffman
Copy link
Contributor Author

PR GaloisInc/saw-core#51 fixes the problem, but we should probably leave the ticket open until we add a saw-script regression test and update the saw-core submodule.

@brianhuffman brianhuffman reopened this Apr 10, 2020
@brianhuffman brianhuffman added the needs test Issues for which we should add a regression test label Apr 10, 2020
@brianhuffman brianhuffman added the easy Issues that are expected to be easy to resolve and might therefore be good for new contributors label Jul 16, 2021
@brianhuffman brianhuffman self-assigned this Jul 16, 2021
@sauclovian-g sauclovian-g added the type: bug Issues reporting bugs or unexpected/unwanted behavior label Oct 29, 2024
@sauclovian-g sauclovian-g added this to the 2024T3 milestone Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy Issues that are expected to be easy to resolve and might therefore be good for new contributors needs test Issues for which we should add a regression test type: bug Issues reporting bugs or unexpected/unwanted behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants