-
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
Too many constraints generated #2255
Comments
Wow I have never seen a single file generate that many constraints (maybe that’s two orders of magnitude larger than anything I’ve seen!) - am on a plane right now, will definitely check it out when I get back home tomorrow! Thanks for trying LH and letting us know! |
👋 Hello @oxarbitrage. As workarounds:
Taming this in a controlled fashion is likely to require some debugging and diving into the implementation: Local Refinement Typing from the papers. |
I tried this in the past, it do not make a difference at all in the number of constraints. Ill try the other suggestions and references. Thanks! |
Yea, this makes a difference in the constraints amount. I made some modifications at oxarbitrage/hsalsa20@42ce603 and the number reduced to around 50k. The compile time is still long and the duplicated code more than i will like but it is still some improvement. I will keep learning and improving it. Thanks again for the help. |
Ok, sorry about the mess. I was able to isolate my issue. First, i separated Utils.hs into https://github.com/oxarbitrage/hsalsa20/blob/main/src/Utils.hs and https://github.com/oxarbitrage/hsalsa20/blob/main/src/LittleEndian.hs Now the problem is in LittleEndian.hs mod with the
However, older versions like the one i had before: https://github.com/oxarbitrage/hsalsa20/blob/42ce6030cb2d8cf268aa36fa770dafd6f27c6998/src/Utils.hs#L196 will pass the checks but creating a lot of constrains and really long compiling time. |
Unlike the old version, the new version of Suppose we have a hypothetical function to concat lists of length 8: {-@ assume concat8 :: xs:[{i:[a] | len i == 8}] -> {v:[a] | 8 * len xs == len v} @-}
concat8 :: [[a]] -> [a]
concat8 = concat It is also possible to write a spec close to: {-@ assume concat :: xs:[[a]] -> {v:[a] | sum (map length xs) == len v} @-} But then using it requires PLE and perhaps some lemmas. |
Thanks @facundominguez . https://github.com/oxarbitrage/hsalsa20/blob/9c9140ff668f81561cb991f492d6698d97352a21/src/Utils.hs#L186 It seems PLE should be the proper way to do this so i will probably experiment with that as i keep going. Great help, keep the good work :) |
Thanks @facundominguez !!! |
Hey, i am not sure if this is the best place to ask this as this i am not reporting any issue or requesting any feature so feel free to close or move.
I am trying liquidhaskell on my project, works good for my purposes by now. I am basically using it for checking input and output lengths but i also plan to keep adding more checks.
The problem i am having is that i have a file that it seems to be generating too many constrains (over 1 million) and that slows down a lot the compilation.
The file is https://github.com/oxarbitrage/hsalsa20/blob/main/src/Utils.hs . Keep in mind some functions are long and could be done in 1 line using
Prelude
functions but they are that way to make the solver pass. I think one or several of them are causing a considerable amount of constrains.Here is the compilation logs:
It will be great for me to at least know what are the constrains being generated, some sort of way to debug what function is generating the most constrains and stuff like that.
Thanks for the hard work, any feedback in the subject will be very appreciated.
The text was updated successfully, but these errors were encountered: