-
Notifications
You must be signed in to change notification settings - Fork 6
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
Records with references are tedious to work with #15
Comments
Unfold & Fold
Fold and Unfold, with bindersYou can also combine binding witnesses with fold and unfold, like this
On the fold side, this is a bit subtle, since in addition to folding the head symbol u8_pair_pred you also have to fold fst and snd Folding with a ghost functionThe style that we're settling on for folding is to use a ghost function to package things up.
|
There are still two remaining problems: 1. Allocating a record of referencesCurrently, you have to do this:
where
You need to explicitly do the two rewrites to "rename" |
E.g., writing ...
Causes a crash with
|
Slightly more compact syntax for rewrites allows us to write this now: fn alloc_rec_alt (v1 v2:U8.t)
requires emp
returns r:rec2
ensures rec_perm r (mk_rec_repr v1 v2)
{
let r1 = alloc v1;
let r2 = alloc v2;
let r = mk_rec2 r1 r2;
rewrite each r1 as r.r1, r2 as r.r2;
fold_rec_perm r;
r
}
|
record literal syntax is fixed since 5e397ba |
Syntactically,
p.a := v
does not parse. You have to write(write p.a v)
instead.But, more significantly, you need explicit rewrites to unpack the permissions in a record and then pack it back at the end. We should automate this.
See https://github.com/FStarLang/steel/blob/nik_dice/share/steel/examples/pulse/bug-reports/RecordWithRefs.fst
The text was updated successfully, but these errors were encountered: