Open
Description
Logic /
and mod
(from liquid-fixpoint
) don´t match Haskell's div
and mod
behavior, as they should given that the former is used to define the latter in src/GHC/Real_LHAssumptions.hs
.
{-@
...
define div x y = (x / y)
define mod x y = (x mod y)
...
@-}
As a consequence, in the next example both functions fail verification but should not:
{-@exampleHaskellDiv :: {x:Int | x = 2} @-}
exampleHaskellDiv :: Int
exampleHaskellDiv = div (-5) (-2)
{-@ exampleHaskellMod :: {x:Int | x = -1} @-}
exampleHaskellMod :: Int
exampleHaskellMod = mod (-5) (-2)
On the other hand, this is ok:
{-@ exampleLogicDiv :: { 3 = (-5) / (-2)} @-}
exampleLogicDiv :: ()
exampleLogicDiv = ()
{-@ exampleLogicMod :: { 1 = (-5) mod (-2)} @-}
exampleLogicMod :: ()
exampleLogicMod = ()
Metadata
Metadata
Assignees
Labels
No labels