Skip to content

Commit 54ea9c3

Browse files
committed
wip
1 parent 8bf255f commit 54ea9c3

File tree

122 files changed

+1351
-4550
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+1351
-4550
lines changed

lib/common/Pulse.Lib.Core.fsti

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,6 @@ val share
749749
(pcm_pts_to r (v0 `op pcm` v1))
750750
(fun _ -> pcm_pts_to r v0 ** pcm_pts_to r v1)
751751

752-
[@@allow_ambiguous]
753752
val gather
754753
(#a:Type)
755754
(#pcm:pcm a)
@@ -916,7 +915,6 @@ val big_share
916915
(big_pcm_pts_to r (v0 `op pcm` v1))
917916
(fun _ -> big_pcm_pts_to r v0 ** big_pcm_pts_to r v1)
918917

919-
[@@allow_ambiguous]
920918
val big_gather
921919
(#a:Type)
922920
(#pcm:pcm a)
@@ -987,7 +985,6 @@ val big_ghost_share
987985
(big_ghost_pcm_pts_to r (v0 `op pcm` v1))
988986
(fun _ -> big_ghost_pcm_pts_to r v0 ** big_ghost_pcm_pts_to r v1)
989987

990-
[@@allow_ambiguous]
991988
val big_ghost_gather
992989
(#a:Type)
993990
(#pcm:pcm a)

lib/pulse/lib/Pulse.Lib.AVLTree.fst

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,16 @@ fn cases_of_is_tree #t (x:tree_t t) (ft:T.tree t)
120120
T.Leaf -> {
121121
unfold (is_tree x T.Leaf);
122122
fold (is_tree_cases None ft);
123+
rewrite is_tree_cases None ft as is_tree_cases x ft;
123124
}
124125
T.Node data ltree rtree -> {
125126
unfold (is_tree x (T.Node data ltree rtree));
126127
with p lct rct. _;
127128
with n. assert p |-> n;
128129
with l'. rewrite is_tree lct l' as is_tree n.left l';
129130
with r'. rewrite is_tree rct r' as is_tree n.right r';
130-
fold (is_tree_cases (Some p) (T.Node data ltree rtree))
131+
fold (is_tree_cases (Some p) ft);
132+
rewrite (is_tree_cases (Some p) ft) as is_tree_cases x ft;
131133
}
132134
}
133135
}
@@ -240,8 +242,6 @@ fn node_cons (#t:Type0) (v:t) (ltree:tree_t t) (rtree:tree_t t) (#l:(T.tree t))
240242
ensures is_tree y (T.Node v l r) ** (pure (Some? y))
241243
{
242244
let y = Box.alloc { data=v; left =ltree; right = rtree };
243-
rewrite each ltree as ({data = v; left = ltree; right = rtree}).left in (is_tree ltree l);
244-
rewrite each rtree as ({data = v; left = ltree; right = rtree}).right in (is_tree rtree r);
245245
intro_is_tree_node (Some y) y;
246246
Some y
247247
}
@@ -293,18 +293,12 @@ fn rec append_left (#t:Type0) (x:tree_t t) (v:t) (#ft:G.erased (T.tree t))
293293

294294
is_tree_case_some (Some vl) vl;
295295

296-
with _node _ltree _rtree._;
297-
298296
let node = !vl;
299297

300298
let left_new = append_left node.left v;
301299

302300
vl := {node with left = left_new};
303301

304-
rewrite each left_new as ({ node with left = left_new }).left in (is_tree left_new ((T.append_left (reveal _ltree) v)));
305-
306-
rewrite each node.right as ({ node with left = left_new }).right in (is_tree node.right _rtree);
307-
308302
intro_is_tree_node x vl;
309303

310304
x
@@ -344,18 +338,12 @@ fn rec append_right (#t:Type0) (x:tree_t t) (v:t) (#ft:G.erased (T.tree t))
344338
Some np -> {
345339
is_tree_case_some (Some np) np;
346340

347-
with _node _ltree _rtree._;
348-
349341
let node = !np;
350342

351343
let right_new = append_right node.right v;
352344

353345
np := {node with right = right_new};
354346

355-
rewrite each right_new as ({ node with right = right_new }).right in (is_tree right_new ((T.append_right (reveal _rtree) v)));
356-
357-
rewrite each node.left as ({node with right = right_new}).left in (is_tree node.left _ltree);
358-
359347
intro_is_tree_node x np;
360348

361349
x

lib/pulse/lib/Pulse.Lib.BigGhostReference.fst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fn free (#a:Type u#2) (r:ref a) (#n:erased a)
9999
{
100100
unfold pts_to r #1.0R n;
101101
Pulse.Lib.Core.big_ghost_write r _ _ (mk_frame_preserving_upd_none n);
102-
Pulse.Lib.Core.drop_ _;
102+
Pulse.Lib.Core.drop_ (big_ghost_pcm_pts_to _ _);
103103
}
104104

105105

lib/pulse/lib/Pulse.Lib.CancellableInvariant.fsti

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ val cinv : Type0
2525
instance val non_informative_cinv
2626
: NonInformative.non_informative cinv
2727

28-
val cinv_vp (c:cinv) (v:slprop) : slprop
28+
val cinv_vp ([@@@mkey] c:cinv) (v:slprop) : slprop
2929

30-
val active (c:cinv) (p:perm) : slprop
30+
val active ([@@@mkey] c:cinv) (p:perm) : slprop
3131

3232
val active_timeless (c:cinv) (p:perm)
3333
: Lemma (timeless (active c p))

lib/pulse/lib/Pulse.Lib.ConditionVar.fst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ ensures
167167
later_intro (cvar_inv b.core p);
168168
drop_ (Box.pts_to b.core.r #0.5R _)
169169
};
170-
drop_ _
170+
drop_ (inv _ _)
171171
}
172172

173173
fn signal (c:cvar_t) (#p:slprop)

lib/pulse/lib/Pulse.Lib.Deque.fst

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,6 @@ type deque (t:Type0) = {
2121
tail: option (node_ptr t);
2222
}
2323

24-
(* Note: since within this module there is usually a *single* linked list
25-
around, we mark the list predicated with no_mkeys so the matcher can be
26-
more liberal. Crucially, this attribute is only set behind the interface,
27-
and clients will just use the mkey in is_deque.
28-
29-
This is a bit of a hack, the fact that F* allows the attributes to differ
30-
between fst/fsti is probably wrong. Maybe we should have a typeclass? *)
31-
32-
[@@no_mkeys]
3324
let rec is_deque_suffix
3425
(#t:Type0)
3526
([@@@mkey] p:node_ptr t)
@@ -82,7 +73,6 @@ fn fold_is_deque_suffix_cons
8273

8374

8475

85-
[@@no_mkeys]
8676
let is_deque #t ([@@@mkey] x:deque t) (l:list t)
8777
: Tot slprop (decreases l)
8878
= match l with
@@ -120,7 +110,7 @@ fn push_front_empty (#t:Type) (l : deque t) (x : t)
120110
};
121111
let node = Box.alloc vnode;
122112

123-
fold (is_deque_suffix node [x] None node);
113+
fold (is_deque_suffix node [x] None node None);
124114

125115
let l' = {
126116
head = Some node;
@@ -287,10 +277,8 @@ let is_deque_suffix_factored
287277
: Tot slprop
288278
= exists* (v:node t).
289279
pts_to x v **
290-
pure (
291-
v.value == List.Tot.hd l /\
292-
v.dprev == prev
293-
) **
280+
pure (v.value == List.Tot.hd l) **
281+
pure (v.dprev == prev) **
294282
is_deque_suffix_factored_next x l tail last v.dnext
295283

296284

@@ -655,7 +643,7 @@ fn pop_front (#t:Type) (l : deque t)
655643
{
656644
let b = is_singleton l;
657645
if b {
658-
pop_front_nil l;
646+
pop_front_nil l #x;
659647
} else {
660648
pop_front_cons l;
661649
}

lib/pulse/lib/Pulse.Lib.Forall.fst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn elim_forall u#a
4747
{
4848
unfold (forall* x. p x);
4949
unfold uquant (F.on_dom a (fun x -> p x));
50-
with v. assert token v; unfold token v;
50+
with v. unfold token v;
5151
extract_q v (F.on_domain a (fun x -> p x)) () x;
5252
}
5353

lib/pulse/lib/Pulse.Lib.GhostReference.fst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ fn write (#a:Type) (r:ref a) (x:erased a) (#n:erased a)
6969
ensures pts_to r #1.0R x
7070
{
7171
unfold (pts_to r #1.0R n);
72-
H.(r := (U.raise_val x));
72+
H.(r := U.raise_val (reveal x));
7373
fold (pts_to r #1.0R x)
7474
}
7575

lib/pulse/lib/Pulse.Lib.HashTable.fst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,6 @@ fn delete
555555
if (voff = ht.sz)
556556
{
557557
cont := false;
558-
rewrite each vcont as false; // also relying on #110
559558
}
560559
else
561560
{
@@ -583,7 +582,6 @@ fn delete
583582
{
584583
cont := false;
585584
assert (pure (pht.repr == (PHT.delete pht k).repr));
586-
rewrite each vcont as false; // also relying on #110
587585
}
588586
Zombie ->
589587
{

lib/pulse/lib/Pulse.Lib.HashTable.fsti

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ let related #kt #vt (ht:ht_t kt vt) (pht:pht_t kt vt) : prop =
4444
SZ.v ht.sz == pht.repr.sz /\
4545
pht.repr.hashf == lift_hash_fun ht.hashf
4646

47-
let models #kt #vt (ht:ht_t kt vt) (pht:pht_t kt vt) : slprop =
47+
let models #kt #vt ([@@@mkey]ht: ht_t kt vt) (pht:pht_t kt vt) : slprop =
4848
V.pts_to ht.contents pht.repr.seq **
4949
pure (related ht pht /\
5050
V.is_full_vec ht.contents /\
5151
SZ.fits (2 `op_Multiply` SZ.v ht.sz))
5252

53-
val models_timeless #kt #vt (ht:ht_t kt vt) (pht:pht_t kt vt)
53+
val models_timeless #kt #vt ([@@@mkey] ht:ht_t kt vt) (pht:pht_t kt vt)
5454
: Lemma (timeless (models ht pht))
5555
[SMTPat (timeless (models ht pht))]
5656

0 commit comments

Comments
 (0)