Open Armael opened 2 weeks ago
Actually, proof_assert!
looks like a red herring here. I'm getting the same issue with the following program:
#[logic]
#[ensures(true)]
fn foo() -> Seq<Int> { pearlite!{
Seq::create(42, { |k:Int| 42 })
}}
Ah, the #[ensures(true)]
seems to be required for the error to appear.
Yes, the logic vcgenerator doesn't support closures.
I had assumed that adding contracts to a logical function simply generate a proof obligation of the form forall x y z. pre(x,y,z) ==> post(x,y,z,func(x,y,z))
, which doesn't seem to require a specific VCgen as long as the definition of func
is transparent.
Is this not how it works? (and if so, why?)
the VC it generates is a bit more complex than this, but that is the principle, the issue though is what happens if your closure contains a recursive call? what if it contains an expression with preconditions etc..
the current vc is extremely conservative.
YEah, but we should really do something (even if stupid) with every language construct, including closures.
It look like the closure syntax is allowed in
pearlite!{}
blocks to defineMapping
s, but when trying to use it in aproof_assert!{}
I get an error from creusot.raises the error
Closure(path/to/file.rs)