Skip to content

Commit ce07ca0

Browse files
committed
Do not expose counters.
1 parent 89411d4 commit ce07ca0

File tree

6 files changed

+120
-270
lines changed

6 files changed

+120
-270
lines changed

lib/core/PulseCore.BaseHeapSig.fst

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,6 @@ let addr_as_core_ghost_ref (a:nat)
106106
let core_ghost_ref_as_addr_injective r1 = H2.core_ghost_ref_as_addr_injective r1
107107
let addr_as_core_ghost_ref_injective a = H2.addr_as_core_ghost_ref_injective a
108108
let select_ghost i m = H2.select_ghost i m
109-
let ghost_ctr m = H2.ctr GHOST m
110-
let ctr m = H2.ctr CONCRETE m
111-
let empty_mem_props () =
112-
H2.ctr_empty GHOST;
113-
H.ctr_prop (H2.ghost empty_mem);
114-
FStar.Classical.forall_intro_2 H2.select_ghost_interp
115109

116110
(* Lifting H2 actions *)
117111
let mg_of_mut (m:Tags.mutability) =
@@ -174,7 +168,7 @@ let elim_init (fp: H2.slprop) (frame:slprop u#a) (m:mem)
174168
H2.intro_star fp (lower frame m) m1 m4
175169

176170
let intro_fin (post: H2.slprop) (frame:slprop) (m:mem)
177-
(m0: mem { ctr m0 <= ctr m /\ ghost_ctr m0 <= ghost_ctr m })
171+
(m0: mem)
178172
: Lemma
179173
(requires H2.interp (post `H2.star` lower frame m0) m)
180174
(ensures interp (post `star` frame) m)
@@ -204,7 +198,7 @@ let lift_heap_action
204198
(#a:Type u#b)
205199
(#fp':a -> H2.slprop u#a)
206200
(#mut:_)
207-
($f:H2.action #mut #None fp a fp')
201+
($f:H2.action #mut fp a fp')
208202
(#fp_post: a -> slprop u#a { forall x. fp' x == fp_post x })
209203
: _action_except a (mg_of_mut mut) fp fp_post
210204
= let act : _action_except a (mg_of_mut mut) fp fp_post =
@@ -216,9 +210,7 @@ let lift_heap_action
216210
assert H2.interp (fp' x) h1;
217211
let m1 = h1 in
218212
assert (H2.interp (fp' x `H2.star` lower frame m0) m1);
219-
assert (H2.action_related_heaps #mut #None h0 h1);
220-
assert (H2.does_not_allocate CONCRETE h0 h1);
221-
assert (H2.does_not_allocate GHOST h0 h1);
213+
assert (H2.action_related_heaps #mut h0 h1);
222214
intro_fin (fp' x) frame m1 m0;
223215
assert (maybe_ghost_action (mg_of_mut mut) m0 m1);
224216
(x, m1)

lib/core/PulseCore.BaseHeapSig.fsti

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,6 @@ val addr_as_core_ghost_ref_injective (a:nat)
129129
: Lemma
130130
(ensures core_ghost_ref_as_addr (addr_as_core_ghost_ref a) == a)
131131
val select_ghost (i:nat) (m:mem u#a) : GTot (option (H.cell u#a))
132-
val ghost_ctr (b:mem) : GTot nat
133-
let free_above_ghost_ctr (m:mem u#a)
134-
: prop
135-
= forall addr. addr >= ghost_ctr m ==> select_ghost addr m == None
136-
val empty_mem_props ()
137-
: Lemma (
138-
free_above_ghost_ctr empty_mem /\
139-
ghost_ctr empty_mem == 0
140-
)
141132

142133
val pts_to (#a:Type u#a) (#p:pcm a) (r:ref a p) (x:a) : slprop u#a
143134
val ghost_pts_to (#a:Type u#a) (#p:pcm a) (r:ghost_ref a p) (x:a) : slprop u#a

lib/core/PulseCore.Heap.fst

Lines changed: 21 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -734,12 +734,6 @@ let full_cell (c:cell) =
734734
let full_heap_pred h =
735735
forall a. contains_addr h a ==> full_cell (select_addr h a)
736736

737-
let ctr_empty () = ()
738-
739-
let ctr_join h1 h2 a = ()
740-
741-
let ctr_prop h = ()
742-
743737
////////////////////////////////////////////////////////////////////////////////
744738
// sel
745739
////////////////////////////////////////////////////////////////////////////////
@@ -778,7 +772,7 @@ let sel_lemma (#a:_) (#pcm:_) (r:ref a pcm) (m:full_hheap (ptr r))
778772
#set-options "--fuel 2 --ifuel 2"
779773
#restart-solver
780774
let sel_action (#a:_) (#pcm:_) (r:ref a pcm) (v0:erased a)
781-
: action #immut_heap #no_allocs
775+
: action #immut_heap
782776
(pts_to r v0)
783777
(v:a{compatible pcm v0 v})
784778
(fun _ -> pts_to r v0)
@@ -798,7 +792,7 @@ let sel_action' (#a:_) (#pcm:_)
798792
compatible pcm frame v)}
799793
= sel_v r v0 h
800794

801-
let refined_pre_action (#immut:bool) (#allocates:bool)
795+
let refined_pre_action (#immut:bool)
802796
(#[T.exact (`trivial_pre)]pre:heap ->prop)
803797
(#[T.exact (`trivial_pre)]post:heap -> prop)
804798
(fp0:slprop) (a:Type) (fp1:a -> slprop) =
@@ -808,12 +802,12 @@ let refined_pre_action (#immut:bool) (#allocates:bool)
808802
(requires pre m0)
809803
(ensures fun (| x, m1 |) ->
810804
post m1 /\
811-
(forall frame. frame_related_heaps m0 m1 fp0 (fp1 x) frame immut allocates))
805+
(forall frame. frame_related_heaps m0 m1 fp0 (fp1 x) frame immut))
812806

813807
#restart-solver
814-
let refined_pre_action_as_action #immut #allocs #pre #post (#fp0:slprop) (#a:Type) (#fp1:a -> slprop)
815-
($f:refined_pre_action #immut #allocs #pre #post fp0 a fp1)
816-
: action #immut #allocs #pre #post fp0 a fp1
808+
let refined_pre_action_as_action #immut #pre #post (#fp0:slprop) (#a:Type) (#fp1:a -> slprop)
809+
($f:refined_pre_action #immut #pre #post fp0 a fp1)
810+
: action #immut #pre #post fp0 a fp1
817811
= let g : pre_action fp0 a fp1 = fun m -> f m in
818812
g
819813

@@ -838,7 +832,7 @@ let select_refine_pre (#a:_) (#p:_)
838832
(f:(v:a{compatible p x v}
839833
-> GTot (y:a{compatible p y v /\
840834
frame_compatible p x v y})))
841-
: refined_pre_action #immut_heap #no_allocs
835+
: refined_pre_action #immut_heap
842836
(pts_to r x)
843837
(v:a{compatible p x v /\ p.refine v})
844838
(fun v -> pts_to r (f v))
@@ -927,7 +921,7 @@ let select_refine (#a:_) (#p:_)
927921
(f:(v:a{compatible p x v}
928922
-> GTot (y:a{compatible p y v /\
929923
frame_compatible p x v y})))
930-
: action #immut_heap #no_allocs (pts_to r x)
924+
: action #immut_heap (pts_to r x)
931925
(v:a{compatible p x v /\ p.refine v})
932926
(fun v -> pts_to r (f v))
933927
= refined_pre_action_as_action (select_refine_pre r x f)
@@ -1068,7 +1062,7 @@ let upd_gen_fp3 #a p r
10681062
h3
10691063

10701064
#push-options "--z3rlimit 10"
1071-
let upd_gen_frame_preserving #a #p r x v f : Lemma (is_frame_preserving mut_heap no_allocs (upd_gen #a #p r x v f)) =
1065+
let upd_gen_frame_preserving #a #p r x v f : Lemma (is_frame_preserving mut_heap (upd_gen #a #p r x v f)) =
10721066
introduce forall (frame: slprop) (h0:full_hheap (pts_to r x `star` frame)).
10731067
(affine_star (pts_to r x) frame h0;
10741068
let (| _, h1 |) = upd_gen r x v f h0 in
@@ -1201,7 +1195,7 @@ let extend_alt
12011195
(| r, h2 |)
12021196

12031197
#push-options "--z3rlimit 10"
1204-
let extend_fp #a #pcm x : Lemma (is_frame_preserving mut_heap allocs (extend_alt #a #pcm x)) =
1198+
let extend_fp #a #pcm x : Lemma (is_frame_preserving mut_heap (extend_alt #a #pcm x)) =
12051199
introduce forall (frame: slprop) (h0:full_hheap (emp `star` frame)).
12061200
(let (| r, h1 |) = extend_alt #a #pcm x h0 in
12071201
interp (pts_to r x `star` frame) h1) with (
@@ -1220,37 +1214,27 @@ let extend_fp #a #pcm x : Lemma (is_frame_preserving mut_heap allocs (extend_alt
12201214

12211215
let extend #a #pcm
12221216
(x:a{pcm.refine x})
1223-
: action #mut_heap #allocs emp (ref a pcm) (fun r -> pts_to r x)
1217+
: action #mut_heap emp (ref a pcm) (fun r -> pts_to r x)
12241218
= extend_fp #a #pcm x; extend_alt x
12251219

1226-
let extend_modifies_nothing
1227-
#a #pcm (x:a { pcm.refine x })
1228-
(h:full_hheap emp)
1229-
= ()
1230-
1231-
let hprop_sub (p q:slprop) (h0 h1:heap)
1232-
: Lemma (requires (forall (hp:hprop (p `star` q)). hp h0 == hp h1))
1233-
(ensures (forall (hp:hprop q). hp h0 == hp h1))
1234-
= ()
1235-
12361220
#push-options "--z3rlimit_factor 4 --max_fuel 1 --max_ifuel 1"
12371221
#restart-solver
12381222
let frame (#a:Type)
1239-
(#immut #allocates #hpre #hpost:_)
1223+
(#immut #hpre #hpost:_)
12401224
(#pre:slprop)
12411225
(#post:a -> slprop)
12421226
(frame:slprop)
12431227
($f:action pre a post)
12441228
= let g
1245-
: refined_pre_action #immut #allocates #hpre #hpost
1229+
: refined_pre_action #immut #hpre #hpost
12461230
(pre `star` frame) a (fun x -> post x `star` frame)
12471231
= fun h0 ->
12481232
assert (interp (pre `star` frame) h0);
12491233
affine_star pre frame h0;
12501234
let (| x, h1 |) = f h0 in
12511235
assert (interp (post x) h1);
12521236
assert (interp (post x `star` frame) h1);
1253-
assert (forall frame'. frame_related_heaps h0 h1 pre (post x) frame' immut allocates);
1237+
assert (forall frame'. frame_related_heaps h0 h1 pre (post x) frame' immut);
12541238
introduce forall frame'.
12551239
(interp ((pre `star` frame) `star` frame') h0 ==>
12561240
interp ((post x `star` frame) `star` frame') h1)
@@ -1264,7 +1248,7 @@ let frame (#a:Type)
12641248

12651249
let change_slprop (p q:slprop)
12661250
(proof: (h:heap -> Lemma (requires interp p h) (ensures interp q h)))
1267-
: action #immut_heap #no_allocs p unit (fun _ -> q)
1251+
: action #immut_heap p unit (fun _ -> q)
12681252
= let g
12691253
: refined_pre_action p unit (fun _ -> q)
12701254
= fun h ->
@@ -1273,46 +1257,22 @@ let change_slprop (p q:slprop)
12731257
in
12741258
refined_pre_action_as_action g
12751259

1276-
// let elim_pure (p:prop)
1277-
// : action (pure p) (u:unit{p}) (fun _ -> emp)
1278-
// = let f
1279-
// : refined_pre_action (pure p) (_:unit{p}) (fun _ -> emp)
1280-
// = fun h -> (| (), h |)
1281-
// in
1282-
// refined_pre_action_as_action f
1283-
1284-
// let intro_pure (p:prop) (_:squash p)
1285-
// : action emp unit (fun _ -> pure p)
1286-
// = let f
1287-
// : refined_pre_action emp unit (fun _ -> pure p)
1288-
// = fun h -> (| (), h |)
1289-
// in
1290-
// refined_pre_action_as_action f
1291-
12921260
let pts_to_evolve (#a:Type u#a) (#pcm:_) (r:ref a pcm) (x y : a) (h:heap)
12931261
: Lemma (requires (interp (pts_to r x) h /\ compatible pcm y x))
12941262
(ensures (interp (pts_to r y) h))
12951263
= let Ref a' pcm' v' = (select_addr h (Addr?._0 r)) in
12961264
compatible_trans pcm y x v'
12971265

1298-
// let drop p
1299-
// = let f
1300-
// : refined_pre_action p unit (fun _ -> emp)
1301-
// = fun h -> (| (), h |)
1302-
// in
1303-
// refined_pre_action_as_action f
1304-
1305-
13061266
let erase_action_result
13071267
(#pre #post:_)
1308-
(#immut #alloc:_)
1268+
(#immut:_)
13091269
(#fp:slprop)
13101270
(#a:Type)
13111271
(#fp':a -> slprop)
1312-
(act:action #immut #alloc #pre #post fp a fp')
1313-
: action #immut #alloc #pre #post fp (erased a) (fun x -> fp' x)
1272+
(act:action #immut #pre #post fp a fp')
1273+
: action #immut #pre #post fp (erased a) (fun x -> fp' x)
13141274
= let g
1315-
: refined_pre_action #immut #alloc #pre #post fp (erased a) (fun x -> fp' x)
1275+
: refined_pre_action #immut #pre #post fp (erased a) (fun x -> fp' x)
13161276
= fun h ->
13171277
let (| x, h1 |) = act h in
13181278
let y : erased a = hide x in
@@ -1323,11 +1283,11 @@ let erase_action_result
13231283

13241284
let erase_action_result_identity
13251285
(#pre #post:_)
1326-
(#immut #alloc:_)
1286+
(#immut:_)
13271287
(#fp:slprop)
13281288
(#a:Type)
13291289
(#fp':a -> slprop)
1330-
(act:action #immut #alloc #pre #post fp a fp')
1290+
(act:action #immut #pre #post fp a fp')
13311291
(h:full_hheap fp { pre h})
13321292
: Lemma (
13331293
let (| x, h1 |) = act h in

0 commit comments

Comments
 (0)