Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ST example from tutorial not working #1328

beta-ziliani opened this issue Nov 1, 2017 · 3 comments

ST example from tutorial not working #1328

beta-ziliani opened this issue Nov 1, 2017 · 3 comments


Copy link

@beta-ziliani beta-ziliani commented Nov 1, 2017

In 2.3.2 of the tutorial there is a simple example every ML user is familiar with:

open FStar.ST

val new_counter: int -> St (unit -> St int)
let new_counter (start: int) =
  let c = ST.alloc start in
  fun () -> c := !c + 1; !c

However, F* is not able to verify this example, throwing the error:

(Error) Failed to resolve implicit argument of type 'FStar.Preorder.preorder ((fun start -> (fun start -> (fun start -> (fun start -> start) start) start) start)' introduced in (*?u41*) _ start (see also Eff2(9,25-9,27))
Copy link

@mtzguido mtzguido commented Nov 1, 2017

Good to see you around here :)

This is already tracked in #1056, which has a fix for that inference failure. However, the example has an assertion failure which I'm not sure has had a proper diagnosis.

In general, the tutorial usually lags behind development as we don't yet have a way to automatically test it.

Copy link

@aseemr aseemr commented Nov 1, 2017

Hi! The assertion failure is due to the imprecise encoding of impure arrows to the smt solver (#855). I need to fix it soon.

Regarding the inference failure, we should change the tutorial to use open FStar.Ref instead of open FStar.ST. This is also logged in the README here: (the second bullet under Standard Library).

Copy link

@catalin-hritcu catalin-hritcu commented Nov 11, 2017

Closing as duplicate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants