Skip to content

Commit d69eccb

Browse files
committed
wip
1 parent 647594b commit d69eccb

Some content is hidden

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

52 files changed

+1143
-270
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.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: 2 additions & 12 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;
@@ -655,7 +645,7 @@ fn pop_front (#t:Type) (l : deque t)
655645
{
656646
let b = is_singleton l;
657647
if b {
658-
pop_front_nil l;
648+
pop_front_nil l #x;
659649
} else {
660650
pop_front_cons l;
661651
}

lib/pulse/lib/Pulse.Lib.HigherGhostReference.fst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ fn free #a (r:ref a) (#n:erased a)
103103
{
104104
unfold pts_to r #1.0R n;
105105
Pulse.Lib.Core.ghost_write r _ _ (mk_frame_preserving_upd_none n);
106-
Pulse.Lib.Core.drop_ _;
106+
Pulse.Lib.Core.drop_ (ghost_pcm_pts_to _ _);
107107
}
108108

109109

lib/pulse/lib/Pulse.Lib.LinkedList.fst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,8 @@ fn move_next (#t:Type) (x:llist t)
290290
let node = !np;
291291
intro_yields_cons np;
292292
rewrite each (Some np) as x;
293+
with tl. rewrite trade (is_list node.tail tl) (is_list x (node.head :: tl))
294+
as trade (is_list node.tail tl) (is_list x 'l);
293295
node.tail
294296
}
295297

lib/pulse/lib/Pulse.Lib.MonotonicGhostRef.fst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,5 @@ fn update (#t:Type) (#p:preorder t) (r:mref p) (#u:t) (v:t)
131131
unfold pts_to;
132132
with f h. assert (GR.pts_to r (f, h));
133133
GR.write r _ _ (FP.mk_frame_preserving_upd p h v);
134-
fold pts_to;
134+
fold pts_to r #1.0R v;
135135
}

lib/pulse/lib/Pulse.Lib.Mutex.fst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ fn unlock (#a:Type0) (#v:a -> slprop) (#p:perm) (m:mutex a) (mg:mutex_guard a)
9494
unfold (mg `belongs_to` m);
9595
with x. rewrite (pts_to mg x) as (R.pts_to (B.box_to_ref m.r) x);
9696
B.to_box_pts_to m.r;
97-
fold lock_inv;
97+
fold lock_inv m.r v;
9898
release m.l;
9999
fold (mutex_live m #p v)
100100
}

lib/pulse/lib/Pulse.Lib.OnRange.fst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ fn rec on_range_unzip (p q:nat -> slprop) (i j:nat)
481481
rewrite (on_range (fun k -> p k ** q k) i j) as pure False;
482482
unreachable ();
483483
} else if (j = i) {
484+
rewrite each j as i;
484485
on_range_empty_elim (fun k -> p k ** q k) i;
485486
on_range_empty p i;
486487
on_range_empty q i;

0 commit comments

Comments
 (0)