Skip to content

:prove incorrectly throws a runtime error when evaluating fpToRational using What4-based provers #2021

Description

@RyanGlScott

fpToRational (0 : Float32) should be equal to (ratio 0 1). Cryptol's native and reference evaluators confirm this:

Cryptol> :m Float
Loading module Cryptol
Loading module Float
Float> fpToRational (0 : Float32) == (ratio 0 1)
True
Float> :eval fpToRational (0 : Float32) == (ratio 0 1)
True

If you ask the :prove command with a What4-based prover, however, it claims that evaluating this query will result in a runtime error:

Float> :set prover=w4-z3
Float> :prove fpToRational (0 : Float32) == (ratio 0 1)
Counterexample
(fpToRational (0 : Float32) == (ratio 0 1)) ~> ERROR
(Total Elapsed Time: 0.018s, using "Z3")

As far as I can tell, this is a bug. Strangely, this issue doesn't arise if you try the following, very similar :sat command:

Float> :sat \x -> fpToRational (0 : Float32) == x
Satisfiable
(\x -> fpToRational (0 : Float32) == x) (ratio 0 1) = True
(Total Elapsed Time: 0.021s, using "Z3")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething not working correctlyproverIssues related to :sat and :prove

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions