-
Hi, i have writen some functions with a fairly simple result to construct, yet a difficult condition to prove for that result. -edit: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
By default, F* preserves the let-binding structure of a source program when extracting it. I guess you have something that looks like this:
And the extracted code produced by
Notice the call to First, in general, F*'s extraction to OCaml could use some love ... the generated code is syntactically not very pretty. So, we should improve that. But, here are few things you can do about your specific problem for additional sub-terms remaining: Use Ghost.erasedSee this chapter: http://fstar-lang.org/tutorial/book/part4/part4_ghost.html#erasure-and-the-ghost-effect If you don't intend for the auxiliary function like
Now you get:
If the
And you get:
(Equivalently, you can write Attributes: Inline let and noextractIf for whatever reason, you don't want to go with the type-and-effect based treatment of erasure, a more ad hoc approach is to use various attributes to control F*'s code generation. I would generally recommend preferring the erased type & ghost effect, but I'll include this here for completeness.
The The
Note, if you leave off the
See https://github.com/FStarLang/FStar/wiki/Custom-attributes |
Beta Was this translation helpful? Give feedback.
By default, F* preserves the let-binding structure of a source program when extracting it.
I guess you have something that looks like this:
And the extracted code produced by
fstar.exe --codegen OCaml
looks likeNotice the call to
lem
is erased (total let bindings ofunit
are erased). But …