-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug-reports: strange failure invoking FStar GTot fn in Pulse
- Loading branch information
1 parent
6fecd23
commit 73a7c5c
Showing
2 changed files
with
73 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
module FStarGhost | ||
|
||
open Pulse.Main | ||
open Pulse.Steel.Wrapper | ||
open Steel.ST.Util | ||
module G = FStar.Ghost | ||
module R = Steel.ST.Reference | ||
module GR = Steel.ST.GhostReference | ||
|
||
let fstar_gtot_incr (n:G.erased nat) : GTot nat | ||
= n + 1 | ||
|
||
(* this checks *) | ||
```pulse | ||
ghost | ||
fn invoke_fstar_gtot (r:GR.ref nat) (#n:G.erased nat) | ||
requires GR.pts_to r full_perm n | ||
ensures GR.pts_to r full_perm (n+1) | ||
{ | ||
gwrite r (fstar_gtot_incr n) | ||
} | ||
``` | ||
|
||
(* invocation of GTot fcn: expected a total term, got a ghost term *) | ||
[@@expect_failure] | ||
```pulse | ||
ghost | ||
fn bind_fstar_gtot (r:GR.ref nat) (#n:G.erased nat) | ||
requires GR.pts_to r full_perm n | ||
ensures GR.pts_to r full_perm (n+1) | ||
{ | ||
let nn = fstar_gtot_incr n; | ||
gwrite r nn | ||
} | ||
``` | ||
|
||
(* same issue as above *) | ||
[@@expect_failure] | ||
```pulse | ||
ghost | ||
fn return_fstar_gtot (#n:G.erased nat) | ||
requires emp | ||
ensures emp | ||
{ | ||
fstar_gtot_incr n | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters