-
Notifications
You must be signed in to change notification settings - Fork 147
reflection of quot and rem #2540
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
reflection of quot and rem #2540
Conversation
I implemented Also, I'm still to run all tests to look for regressions (or does ci/circleci does this already?). |
Thanks @ninioArtillero. CI might catch some regressions indeed. For tests, you could add a module under "tests/" with concrete examples like {-@ exQuot1 :: { -2 = quot -5 2 } @-}
exQuot1 :: ()
exQuot1 = () and/or create a testsuite in the liquidhaskell package for property based tests. |
For the second option, you mean something like what I just pushed? I would add all the properties as post-conditions of that same function. |
Not really. It would have to be a test suite using QuickCheck, to test for the equivalence of |
I have played around with QuickCheck and think I can implement the tests. As there are no custom data types involved, guess it should not be much of a problem. |
I implemented Nevertheless, I found some specific cases that prevented verification of my original |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bravo @ninioArtillero! Here go some comments.
test/Main.hs
Outdated
-- | Throws error if a test fails. Use this alternative to abort build | ||
-- in case of failure when test condition is enabled. | ||
main' :: IO () | ||
main' = do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good observation. In Haskell QuickCheck is used with tasty and tasty-quickcheck or similar scaffolding for tests.
I've found these tests can be integrated in tests:test:tasty
. It is a testsuite inside the tests
package. If you want, you can look into that. Otherwise I could do it too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could look into that after having my test pass LH verification.
Co-authored-by: Facundo Domínguez <facundominguez@gmail.com>
Co-authored-by: Facundo Domínguez <facundominguez@gmail.com>
Co-authored-by: Facundo Domínguez <facundominguez@gmail.com>
Used an alternative implementation proposed by @facundominguez that uses an explicit termination metric to make verification pass. Now both the property tests and LH verification pass, so we can be confident that the logic implementation of But the |
The regression was introduced at |
I'm setting up to merge. We need an issue to investigate the negative test. Thanks @ninioArtillero! |
This reverts commit 921a2d7.
hm, the neg test started failing after 280c0e1. I thought I had tested that before. |
This PR aims to fix #1447
I start by adding a negative test showing the offending behavior.
It is on
/test/reflect/neg/
, but welcome suggestions if there is a more appropriate place.A lead: both
quot
andrem
functions are opaque-reflected, whilediv
andmod
are not.