The semantics of operator /
in assertions is not the proper felt
semantics
#161
Labels
bug
Something isn't working
/
in assertions is not the proper felt
semantics
#161
Describe the bug
For field elements, the operation
a / b
results in anx
such thatb * x = a
. (Because this is an operation in the field, whena
is not a multiple ofb
,x
is not the integral part of the quotient as if operating withInt
s).Horus-compile
transforms the/
operator in assertions to thediv
operator in SMTLIB. The assertion@post $Return.res == a / b
will be translated to(= (memory (+ ap (- 1))) (div (memory (+ fp (- 4))) (memory (+ fp (- 3)))))
(wherea
andb
are the arguments of the function).This leads to unexpected behavior, even if
horus-check
encodes operations using moduloP
.Expected behavior
I expect
I get
To Reproduce
horus-compile==0.0.6.11
horus-check
latest version inmaster
Solver: default (cvc5)
Operating system
[x] Linux
[ ] MacOS
[ ] Windows
[ ] Other (please write)
CPU architecture
[ ] x86-64
[x] AArch64
[ ] Other (please write)
Additional context
Unoptimized smt query obtained from the example (simplified, showing only the relevant assertions)
z3 output
spec.json:
The text was updated successfully, but these errors were encountered: