FStarLang / fstar-mode.el

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

compute: do not use pure-subterms flag #101

Closed mtzguido closed 5 years ago

mtzguido commented 5 years ago

Hey Clément, a small bugfix arising from a report in our public Slack. The commit message below explains.


This flag is meant for extraction, and prevents the reduction of pure letbindings such as let x = 1 in 2. The funny thing is that F* will call Normalize.term_to_string before giving the printed term back to fstar-mode, so this is not that easy to trigger.

With this snippet, however:

val tail_fib : nat -> (int * int) let rec tailfib n = match n with | 0 -> (0, 0) | 1 -> (1, 0) | -> let (n1, n2) = tail_fib (n-1) in (n1 + n2, n1)

let fib2 n = let a, b = tail_fib n in a

Evaluating fib2 4 actually gives

fib2 4 ↓βδιζrp 1 + 0 + 1 + (1 + 0) <: int

cpitclaudel commented 5 years ago

Looks perfect. Thanks for the detailed commit message.