Closed owickstrom closed 5 years ago
This is confusing, but not a bug!
The rev_involutive
in the body is resolving to FStar.List.Tot.Properties.rev_involutive
, and not to the one you're defining. When you add the rec
, it does resolve to the one in your module, as expected.
Now why are you getting a could not prove post-condition
error? Because the lemma in ulib
speaks about FStar.List.Tot.Base.rev
, and not the reverse
you are defining which is potentially completely different.
Just for fun, you can add this just before your last lemma to make it succeed (and prove it if you want):
val rev_is_reverse : l:list 'a -> Lemma (reverse l == rev l) [SMTPat (reverse l)]
let rev_is_reverse l = admit ()
Oh, nice one! Thanks for the quick and detailed response.
So, follow-up question. In F*, can I open modules in a way that they're qualified? I'm mostly doing Haskell programming otherwise, and I'd like to do something like:
import qualified FStar.List.Tot as List
import FStar.List.Tot (list, Cons, Nil)
I'm not very good with OCaml/ML in general, maybe there's a way of doing this that also exists in F*? Thanks!
You can qualify the import with
module List = FStar.List.Tot
But I don't think you can select what to import from it.
Thanks!
This code is from the tutorial, section "4.2. To type intrinsically, or to prove lemmas?" I typed it in myself and forgot a
rec
when definingrev_involutive
:I would expect the compiler to complain about
rev_involutive
not being in scope, but instead if says:Making it
let rec rev_involutive ...
it verifies correctly. Is this expected behavior or a bug? I found it a bit confusing.Reproducing
I compiled
fstar.exe
from the git repository using the provided OCaml sources: