Closed AlecsFerra closed 1 month ago
The issue on the liquid haskell main repo is related to programs like this:
{-@ LIQUID "--reflection" @-}
{-@ LIQUID "--ple" @-}
module Example where
{-@ reflect idu @-}
{-@ idu :: Int -> Int @-}
idu :: Int -> Int
idu x = x
{-@ proof :: {(\x:Int -> x) = idu } @-}
proof = ()
As it throws crash: SMTLIB2 respSat = Error "line 3 column 18650: unknown constant lam_arg$35$$35$1"
whenever a lambda is used this way in the refinements
This error is already present is not caused by this patch
Yes, right now there is no real support for lambdas in LH :)
Uhm ok then I'm stuck
Right now It's verifying the example but it's also making some tests in the LH repo fail because it's unfolding some types and inserting lambdas
I think I fixed the bug regarding lambdas, I'll run the tests on the main repo to double check
The tests on the liquidhaskell are passing!
But I still have to fix a minor bug for my tests
Can confirm that it's passing all the test on the main LH repo, now I'm running the benchmarks
Benchmarks:
On average we are not extremely slower than then original PLE
Ops forgot about the tests on liquid-fixpoint
I can open a PR on LH when we are done here https://github.com/AlecsFerra/liquidhaskell/commits/develop/ I've also added two tests to showcase the feature:
Btw I think that now we can allow lambdas in reflected functions definitions, at least for the reader monad example it works
I will squash the commits at the end
Following some discussion in private I decided to remove the code relating to make PLE aware of dependent pattern matching / unification
The code of the reader monad still passes, the SKI calculus instead will require some extra lemmas
The only open discussion that I could catch is about making a comment more instructive. Update: oh, I asked about a couple other things in comments later.
Regarding performance, if the verification times worsen when enabling extensionality and --etabeta
I'd say it is fine to merge. If verification worsens even when not enabling the flags, then I'd prefer to understand why before merging.
Looks way better I guess the slowdowns were actually caused by the elaboration
Also, note the comment edits that I just contributed. Feel free to adjust them if you see anything amiss.
Ops
Ok now It's ok to merge
The extensionality flag fails when a function used as argument of a data constructor, take this as an example:
it cannot prove that f and g are the same function since it cannot add the
ext$...
variable on the functions (and then cause their unfolding by PLE) since they would make the program ill-typed, the solution is eta-expanding the definitions off
andg
to(\x:Int -> \y:Int -> f x y)
(\x:Int -> \y:Int -> g x y)
to let PLE then unfold the definitions in the body of the lambda and prove the equality.DO NOT MERGE: This feature is exposing another LF bug in some tests in the liquidhaskell repo related to lambdas in the refinements.