FStarLang / fstar-mode.el

Emacs support for F*
Apache License 2.0
67 stars 17 forks source link

Collapsing computationally irrelevant code #72

Open jkzinzindohoue opened 7 years ago

jkzinzindohoue commented 7 years ago

Hi Clement,

How hard would it be to implement a feature in the interactive mode which would collapse all the expressions (assumed on a single statement-like line) which either return Tot unit or Ghost 'a pre post ? I am assuming it may be feasible since the interactive mode gets type information from F but I have no clue whether it would be easy or not... It would be an auditing / readability improvement feature for already written code, the idea being to hide all the lemma and ghost calls to only be left with the real* code.

Thanks !

cpitclaudel commented 7 years ago

Hi Jean-Karim,

Thanks for the suggestions! I don't think it's currently feasible (but I'm hoping to be wrong!)

The problem is that we have types for identifiers, but not for expressions — that information is computed by the typechecker, but promptly discarded (we used to store it in .tk fields, but I think we got rid of those recently to reduce our memory footprint)

If we had that information in F, it would be easy to expose it to fstar-mode — we'd just request a collection of text ranges from F. On the F* side, we'd need two things:

I might have missed something though. Maybe there's an easier way?