-
Notifications
You must be signed in to change notification settings - Fork 139
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
Termination check on local recursive function #2279
Comments
Hello @amigalemming. It looks to me like Liquid Haskell should have rejected all flavors of iterateTo0 :: Int -> Int
iterateTo0 0 = 0
iterateTo0 n = iterateTo0 (div n 2)
main :: IO ()
main = print $ iterateTo0 (-1) This program doesn't terminate, and yet, it passes verification. |
You are so right! So, it's a bug, but a different one. |
I created #2285 to deal with negative dividends. Regarding this issue, looks like it could be addressed by either documenting why the termination checker fails to verify |
This is likely a duplicate of #2200. I cannot reproduce this error but I can reproduce the one in #2200. @amigalemming, what version of |
The original module is here: |
This function definition does not satisfy the termination checker:
Liquid error is:
But this definition passes the termination checker:
I prefer the first version in order to reduce the parameters that are carried through the recursion. I think the first version is also more comprehensible because it is obvious that
op
stays the same throughout the recursion.Unfortunately, I cannot add a Liquid type signature to
go
in order to mark the decreasing parameter, because that type signature would be too general in the type variablea
. I tried:The text was updated successfully, but these errors were encountered: