@@ -14,147 +14,6 @@ ghost fn dup_in_same_process p () : duplicable_f (in_same_process p) = {
1414instance duplicable_in_same_process p : duplicable ( in_same_process p ) =
1515 { dup_f = dup_in_same_process p }
1616
17- let can_see_writes_from ( other_loc : loc_id ) : slprop =
18- in_same_process other_loc **
19- emp // extra assumptions
20-
21- ghost fn can_see_writes_from_prop other_loc
22- preserves can_see_writes_from other_loc
23- ensures in_same_process other_loc
24- {
25- unfold can_see_writes_from other_loc ;
26- dup ( in_same_process other_loc ) ();
27- fold can_see_writes_from other_loc ;
28- }
29-
30- ghost fn writes_visible_in_prop other_loc
31- preserves writes_visible_in other_loc
32- ensures in_same_process other_loc
33- {
34- unfold writes_visible_in other_loc ;
35- with l . assert loc l ; loc_dup l ;
36- ghost_impersonate other_loc
37- ( on other_loc ( can_see_writes_from l ))
38- ( on other_loc ( can_see_writes_from l ) ** pure ( process_of other_loc == process_of l ))
39- fn _ {
40- on_elim ( can_see_writes_from l );
41- can_see_writes_from_prop l ;
42- on_intro ( can_see_writes_from l );
43- unfold in_same_process l ;
44- loc_gather other_loc # _ ;
45- };
46- fold in_same_process other_loc ;
47- fold writes_visible_in other_loc ;
48- }
49-
50-
51- [ @@deprecated " UNSAFE" ]
52- ghost fn unsafe_attest_can_see_writes_from ( other_loc : loc_id )
53- pre post ( k : unit -> stt_ghost unit emp_inames ( can_see_writes_from other_loc ** pre )
54- ( fun _ -> can_see_writes_from other_loc ** post ))
55- preserves in_same_process other_loc
56- requires pre
57- ensures post
58- {
59- dup ( in_same_process other_loc ) ();
60- fold can_see_writes_from other_loc ;
61- k ();
62- drop_ ( can_see_writes_from other_loc );
63- }
64-
65- [ @@deprecated " UNSAFE" ]
66- ghost fn unsafe_attest_writes_visible_in ( other_loc : loc_id )
67- pre post ( k : unit -> stt_ghost unit emp_inames ( writes_visible_in other_loc ** pre )
68- ( fun _ -> writes_visible_in other_loc ** post ))
69- preserves in_same_process other_loc
70- requires pre
71- ensures post
72- {
73- unfold in_same_process other_loc ;
74- with l . assert loc l ;
75- on_intro pre ;
76- ghost_impersonate other_loc ( on l pre ) ( on l post ) fn _ {
77- loc_dup other_loc ;
78- fold in_same_process l ;
79- unsafe_attest_can_see_writes_from l ( loc other_loc ** on l pre ) ( loc other_loc ** on l post ) fn _ {
80- on_intro ( can_see_writes_from l );
81- ghost_impersonate l
82- ( on other_loc ( can_see_writes_from l ) ** on l pre )
83- ( on other_loc ( can_see_writes_from l ) ** on l post )
84- fn _ {
85- loc_dup l ;
86- fold writes_visible_in other_loc ;
87- on_elim pre ;
88- k ();
89- on_intro post ;
90- unfold writes_visible_in other_loc ; with l' . _ ;
91- loc_gather l # l' ;
92- rewrite each l' as l ;
93- };
94- on_elim ( can_see_writes_from l );
95- };
96- drop_ ( in_same_process l );
97- };
98- on_elim post ;
99- fold in_same_process other_loc ;
100- }
101-
102- ghost fn is_send_acq ( p : slprop ) {| inst : is_send p |} ( other_loc : loc_id )
103- preserves can_see_writes_from other_loc
104- requires on other_loc p
105- ensures p
106- {
107- inst other_loc ;
108- }
109-
110- ghost fn is_send_rel ( p : slprop ) {| is_send p |} ( other_loc : loc_id )
111- preserves writes_visible_in other_loc
112- requires p
113- ensures on other_loc p
114- {
115- unfold writes_visible_in ;
116- with l . assert loc l ;
117- on_intro p ;
118- ghost_impersonate other_loc
119- ( on other_loc ( can_see_writes_from l ) ** on l p )
120- ( on other_loc ( can_see_writes_from l ) ** on other_loc p )
121- fn _ {
122- on_elim ( can_see_writes_from l );
123- is_send_acq p l ;
124- on_intro p ;
125- on_intro ( can_see_writes_from l );
126- };
127- fold writes_visible_in other_loc ;
128- }
129-
130- [ @@deprecated " UNSAFE" ]
131- ghost fn unsafe_attest_released ( p : slprop ) {| is_send p |} (# l : loc_id )
132- preserves loc l
133- requires p
134- ensures on ( process_of l ) p
135- {
136- loc_dup l ;
137- fold in_same_process ( process_of l );
138- unsafe_attest_writes_visible_in ( process_of l ) p ( on ( process_of l ) p )
139- fn _ { is_send_rel p ( process_of l ) };
140- unfold in_same_process ( process_of l );
141- loc_gather l # _ ;
142- }
143-
144- [ @@deprecated " UNSAFE" ]
145- ghost fn unsafe_attest_acquired ( p : slprop ) {| is_send p |} (# l : loc_id )
146- preserves loc l
147- requires on ( process_of l ) p
148- ensures p
149- {
150- loc_dup l ;
151- fold in_same_process ( process_of l );
152- unsafe_attest_can_see_writes_from ( process_of l ) ( on ( process_of l ) p ) p
153- fn _ { is_send_acq p ( process_of l ) };
154- unfold in_same_process ( process_of l );
155- loc_gather l # _ ;
156- }
157-
15817ghost fn on_star_elim # l ( p q : slprop )
15918 requires on l ( p ** q )
16019 ensures on l p
@@ -189,64 +48,65 @@ ghost fn on_exists_elim u#a #l (#a: Type u#a) (p: a -> slprop)
18948 }
19049}
19150
192- ghost fn is_send_placeless p {| inst : placeless p |} : is_send p = l {
193- loc_get (); with l0 . assert loc l0 ;
194- inst l l0 ;
195- on_elim p ;
196- drop_ ( loc l0 );
197- }
198-
199- ghost fn is_send_star p q {| is_send p , is_send q |} : is_send ( p ** q ) = l {
200- on_star_elim p q ;
201- is_send_acq p l ;
202- is_send_acq q l ;
203- }
204-
205- ghost fn is_send_exists' u# a (# a : Type u# a ) ( p : a -> slprop ) {| (( x : a ) -> is_send ( p x )) |} :
206- is_send ( exists * x . p x ) = l {
207- on_exists_elim p ;
208- with x . assert on l ( p x );
209- is_send_acq ( p x ) l ;
210- }
211- let is_send_exists p = is_send_exists' p
212-
213- ghost fn is_sync_elim p {| inst : is_sync p |} # l l'
51+ ghost fn is_send_elim p {| inst : is_send p |} # l l'
21452 requires on l p
21553 requires pure ( process_of l == process_of l' )
21654 ensures on l' p
21755{
21856 inst l l'
21957}
22058
221- ghost fn is_sync_elim_on p {| is_sync p |} # l
59+ ghost fn is_send_elim_on p {| is_send p |} # l
22260 preserves in_same_process l
22361 requires on l p
22462 ensures p
22563{
22664 unfold in_same_process l ;
22765 with l0 . assert loc l0 ;
228- is_sync_elim p l0 ;
66+ is_send_elim p l0 ;
22967 on_elim p ;
23068 fold in_same_process l ;
23169}
23270
233- ghost fn is_sync_intro_on p {| is_sync p |} l
71+ ghost fn is_send_intro_on p {| is_send p |} l
23472 preserves in_same_process l
23573 requires p
23674 ensures on l p
23775{
23876 unfold in_same_process l ;
23977 with l0 . assert loc l0 ;
24078 on_intro p ;
241- is_sync_elim p l ;
79+ is_send_elim p l ;
24280 fold in_same_process l ;
24381}
24482
245- ghost fn is_sync_placeless p {| inst : placeless p |} : is_sync p = l l' {
83+ ghost fn is_send_elim_on' p {| is_send p |} # l
84+ preserves loc l
85+ requires on ( process_of l ) p
86+ ensures p
87+ {
88+ loc_dup l ;
89+ fold in_same_process ( process_of l );
90+ is_send_elim_on p # _ ;
91+ drop_ ( in_same_process ( process_of l ));
92+ }
93+
94+ ghost fn is_send_intro_on' p {| is_send p |} l
95+ preserves loc l
96+ requires p
97+ ensures on ( process_of l ) p
98+ {
99+ loc_dup l ;
100+ fold in_same_process ( process_of l );
101+ is_send_intro_on p ( process_of l );
102+ drop_ ( in_same_process ( process_of l ));
103+ }
104+
105+ ghost fn is_send_placeless p {| inst : placeless p |} : is_send p = l l' {
246106 inst l l'
247107}
248108
249- ghost fn is_sync_in_same_process p : is_sync ( in_same_process p ) = l l' {
109+ ghost fn is_send_in_same_process p : is_send ( in_same_process p ) = l l' {
250110 ghost_impersonate l
251111 ( on l ( in_same_process p ))
252112 ( on l' ( in_same_process p ))
@@ -262,35 +122,27 @@ ghost fn is_sync_in_same_process p : is_sync (in_same_process p) = l l' {
262122 }
263123}
264124
265- ghost fn is_send_of_is_sync p {| is_sync p |} : is_send p = l {
266- can_see_writes_from_prop l ;
267- unfold in_same_process l ; with l0 . assert loc l0 ;
268- is_sync_elim p l0 ;
269- on_elim p ;
270- drop_ ( loc l0 );
271- }
272-
273- ghost fn is_sync_star p q {| is_sync p , is_sync q |} : is_sync ( p ** q ) = l l' {
125+ ghost fn is_send_star p q {| is_send p , is_send q |} : is_send ( p ** q ) = l l' {
274126 on_star_elim p q ;
275- is_sync_elim p l' ;
276- is_sync_elim q l' ;
127+ is_send_elim p l' ;
128+ is_send_elim q l' ;
277129 on_star_intro p q ;
278130}
279131
280- ghost fn is_sync_exists ' u# a (# a : Type u# a ) ( p : a -> slprop ) {| (( x : a ) -> is_sync ( p x )) |} :
281- is_sync ( exists * x . p x ) = l l' {
132+ ghost fn is_send_exists ' u# a (# a : Type u# a ) ( p : a -> slprop ) {| (( x : a ) -> is_send ( p x )) |} :
133+ is_send ( exists * x . p x ) = l l' {
282134 ghost_impersonate l ( on l ( exists * x . p x )) ( on l' ( exists * x . p x )) fn _ {
283135 on_elim ( exists * x . p x );
284136 with x . assert p x ;
285137 on_intro ( p x );
286- is_sync_elim ( p x ) l' ;
138+ is_send_elim ( p x ) l' ;
287139 ghost_impersonate l' ( on l' ( p x )) ( on l' ( exists * x . p x )) fn _ {
288140 on_elim ( p x );
289141 on_intro ( exists * x . p x )
290142 };
291143 }
292144}
293- let is_sync_exists = is_sync_exists '
145+ let is_send_exists = is_send_exists '
294146
295147
296148inline_for_extraction noextract fn fork'
@@ -299,11 +151,13 @@ inline_for_extraction noextract fn fork'
299151 requires pre
300152{
301153 loc_get (); with l . assert loc l ;
302- unsafe_attest_released pre # _ # l ;
154+ loc_dup l ; fold in_same_process ( process_of l );
155+ is_send_intro_on pre ( process_of l );
156+ drop_ ( in_same_process ( process_of l ));
303157 fork ( on ( process_of l ) pre ) # _ # l fn l' {
304- rewrite on ( process_of l ) pre as on ( process_of l' ) pre ;
305- unsafe_attest_acquired pre # _ # l' ;
306- drop_ ( loc l' );
158+ fold in_same_process ( process_of l );
159+ is_send_elim_on pre # _ ;
160+ drop_ ( in_same_process ( process_of l ) );
307161 f ();
308162 };
309163}
0 commit comments