-
Notifications
You must be signed in to change notification settings - Fork 0
/
event_space.ml
executable file
·1318 lines (1171 loc) · 33.6 KB
/
event_space.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(***********************************************************************)
(* Event Spaces *)
(* *)
(* Néstor CATAÑO, Lemme project *)
(* INRIA Sophia Antipolis *)
(* 2004 route des Lucioles-B.P. 93 *)
(* 06902 Sophia Antipolis Cedex (France) *)
(* *)
(***********************************************************************)
(***********************************************************************)
(* This file implements an Event Space. *)
(***********************************************************************)
(***********************************************************************)
(* An Event Space is implemented as a set of (event * event) elements. *)
(***********************************************************************)
open Javasyntax
open Display
module type EVENTSPACE =
sig
type t
val empty: t
val isMember: t -> (event * event) -> bool
val add: t -> (event * event) -> t
val elements: t -> (event * event) list
val isSubset: t -> t -> bool
val isEqual: t -> t -> bool
val union: t -> t -> t
val intersection: t -> t -> t
val fold: t -> ((event * event) -> 'a -> 'a) -> 'a -> 'a
val forAll: t -> ((event * event) -> bool) -> bool
val exists: t -> ((event * event) -> bool) -> bool
val filter: t -> ((event * event) -> bool) -> t
type f
val empty_f: f
val isMember_f: f -> event -> bool
val add_f: f -> event -> f
val elements_f: f -> event list
val isSubset_f: f -> f -> bool
val isEqual_f: f -> f -> bool
val union_f: f -> f -> f
val intersection_f: f -> f -> f
val fold_f: f -> (event -> 'a -> 'a) -> 'a -> 'a
val forAll_f: f -> (event -> bool) -> bool
val exists_f: f -> (event -> bool) -> bool
val filter_f: f -> (event -> bool) -> f
val carrier: t -> f
val isRelated: t -> event -> event -> bool
val isReflexive: f -> bool
val isTransitive: f -> bool
val isAntisimetric: f -> bool
val isTotal: t -> f -> bool
val display: t -> string -> displevel -> string
val getLastAssign: t -> thread -> (event option)
val getLastStore: t -> thread -> (event option)
val getLastWriteList: t -> (event list)
val getLastReadList: t -> (event list)
val locks: t -> thread -> obj -> int
val isComplete: t -> bool
val alpha : thread -> event -> bool
val betal : lval -> event -> bool
val beta : obj -> event -> bool
val read_of: t -> event -> event option
val store_of: t -> event -> event option
val rule1: t -> f -> bool
val rule2l: t -> f -> bool
val rule2o: t -> f -> bool
val rule3: t -> f -> bool
val rule4: t -> f -> bool
val rule5: t -> f -> bool
val rule6: t -> f -> bool
val rule7: t -> f -> bool
val rule8: t -> f -> bool
val rule9: t -> f -> bool
val rule10: t -> f -> bool
val rule11: t -> f -> bool
val rule12: t -> f -> bool
val rule13: t -> f -> bool
val rule14: t -> f -> bool
val rule15: t -> f -> bool
val rule16: t -> f -> bool
val rule17: t -> f -> bool
val isEventSpace: t -> f -> bool
(*-*val extends: t -> t -> bool*-*)
val getRsCandidates: t -> f -> event -> t list
val adjointSet: t -> f -> event -> t list
val plusE: t -> event -> (t option)
type disp
end
module Make: EVENTSPACE =
struct
module Elt = Set.Make(struct type t = (event * event) let compare = compare end);;
type t = Elt.t (* (event * event) Set.t *)
module Felt = Set.Make(struct type t = event let compare = compare end);;
type f = Felt.t (* event Set.t *)
module Lelt = Set.Make(struct type t = lval let compare = compare end);;
module Relt = Set.Make(struct type t = rval let compare = compare end);;
module Oelt = Set.Make(struct type t = obj let compare = compare end);;
module Telt = Set.Make(struct type t = thread let compare = compare end);;
type disp = {mutable prf: string; mutable res: string}
(***********************************************************************)
(** Functionalities taken from the standard library Set and related **)
(** with the type t. **)
(***********************************************************************)
(** Constructs a empty set **)
let empty = Elt.empty
(** is 'x' member of 'xs' ? **)
let isMember xs x = Elt.mem x xs
(** adds 'x' to 'xs' provided that x isn't already **)
let add xs x = Elt.add x xs
(** converts a set into a list **)
let elements xs = Elt.elements xs
(** is xset subset of yset ? **)
let isSubset xs ys = Elt.subset xs ys
(** are the sets 'xs' and 'ys' equals ? **)
let isEqual xs ys = Elt.equal xs ys
(** union of sets **)
let union xs ys = Elt.union xs ys
(** intersection of sets **)
let intersection xs ys = Elt.inter xs ys
(** Computes (f xN ... (f x2 (f x1 a))...), **)
(** where x1 ... xN are the elements of xs *)
let fold xs f a = Elt.fold f xs a
(** Checks if all elements of 'xs' satisfy the predicate p **)
let forAll xs p = Elt.for_all p xs
(** Checks if exists an element of 'xs' satisfing p **)
let exists xs p = Elt.exists p xs
(** Filters all elements of 'xs' satisfy the predicate p **)
let filter xs p = Elt.filter p xs
(***********************************************************************)
(***********************************************************************)
(** Functionalities taken from the standard library Set and related **)
(** with the flat type f. **)
(***********************************************************************)
(** Constructs a empty set **)
let empty_f = Felt.empty
(** is 'x' member of 'xs' ? **)
let isMember_f xs x = Felt.mem x xs
(** adds 'x' to 'xs' provided that x isn't already **)
let add_f xs x = Felt.add x xs
(** converts a set into a list **)
let elements_f xs = Felt.elements xs
(** is xset subset of yset ? **)
let isSubset_f xs ys = Felt.subset xs ys
(** are the sets 'xs' and 'ys' equals ? **)
let isEqual_f xs ys = Felt.equal xs ys
(** union of sets **)
let union_f xs ys = Felt.union xs ys
(** intersection of sets **)
let intersection_f xs ys = Felt.inter xs ys
(** Computes (f xN ... (f x2 (f x1 a))...), **)
(** where x1 ... xN are the elements of s *)
let fold_f xs f a = Felt.fold f xs a
(** Checks if exists an element of 'xs' satisfing p **)
let exists_f xs p = Felt.exists p xs
(** Checks if all elements of the 'xs' satisfy the predicate p **)
let forAll_f xs p = Felt.for_all p xs
(** Filters all elements of 'xs' satisfy the predicate p **)
let filter_f xs p = Felt.filter p xs
(***********************************************************************)
(***********************************************************************)
(** Functionalities taken from the standard library Set and related **)
(** with the left values. **)
(***********************************************************************)
(** adds 'x' to 'xs' provided that x isn't already **)
let add_l xs x = Lelt.add x xs
(** Constructs a empty set **)
let empty_l = Lelt.empty
(** Computes (f xN ... (f x2 (f x1 a))...), **)
(** where x1 ... xN are the elements of xs *)
let fold_l xs f a = Lelt.fold f xs a
(** Checks if all elements of the 'xs' satisfy the predicate p **)
let forAll_l xs p = Lelt.for_all p xs
(** Checks if exists an element of 'xs' satisfing p **)
let exists_l xs p = Lelt.exists p xs
(***********************************************************************)
(***********************************************************************)
(** Functionalities taken from the standard library Set and related **)
(** with the right values. **)
(***********************************************************************)
(** adds 'x' to 'xs' provided that x isn't already **)
let add_r xs x = Relt.add x xs
(** Constructs an empty set **)
let empty_r = Relt.empty
(** Computes (f xN ... (f x2 (f x1 a))...), **)
(** where x1 ... xN are the elements of xs *)
let fold_r xs f a = Relt.fold f xs a
(** Checks if all elements of the 'xs' satisfy the predicate p **)
let forAll_r xs p = Relt.for_all p xs
(** Checks if exists an element of 'xs' satisfing p **)
let exists_r xs p = Relt.exists p xs
(***********************************************************************)
(***********************************************************************)
(** Functionalities taken from the standard library Set and related **)
(** with objects. **)
(***********************************************************************)
(** adds 'x' to 'xs' provided that x isn't already **)
let add_o xs x = Oelt.add x xs
(** Constructs a empty set **)
let empty_o = Oelt.empty
(** Computes (f xN ... (f x2 (f x1 a))...), **)
(** where x1 ... xN are the elements of xs *)
let fold_o xs f a = Oelt.fold f xs a
(** Checks if all elements of the 'xs' satisfy the predicate p **)
let forAll_o xs p = Oelt.for_all p xs
(** Checks if exists an element of 'xs' satisfing p **)
let exists_o xs p = Oelt.exists p xs
(***********************************************************************)
(***********************************************************************)
(** Functionalities taken from the standard library Set and related **)
(** with threads. **)
(***********************************************************************)
(** adds 'x' to 'xs' provided that x isn't already **)
let add_t xs x = Telt.add x xs
(** Constructs a empty set **)
let empty_t = Telt.empty
(** Computes (f xN ... (f x2 (f x1 a))...), **)
(** where x1 ... xN are the elements of xs *)
let fold_t xs f a = Telt.fold f xs a
(** Checks if all elements of the 'xs' satisfy the predicate p **)
let forAll_t xs p = Telt.for_all p xs
(** Checks if exists an element of 'xs' satisfing p **)
let exists_t xs p = Telt.exists p xs
(***********************************************************************)
(***********************************************************************)
(************* New functionalities added to the Event Space ************)
(***********************************************************************)
(** Returns the set of (diferent) events of
Event Space 'evs'.
**)
let carrier evs =
(fold
evs
(function e -> function xs -> match e with (x,y) -> add_f (add_f xs x) y)
(empty_f)
)
(*-* Are 'x' and 'y' related in the Event Space 'evs' ? *-*)
let rec isRelated evs x y =
x=y
||
( exists
evs
( function (w,z) ->
if w=x then
z=y || (z<>w && isRelated evs z y)
else false
)
)
(** Is the Event Space 'evs' reflexive ? **)
(*-* a = (carrier evs) *-*)
let isReflexive a = true
(** Is the Event Space 'evs' transitive ? **)
(*-* a = (carrier evs) *-*)
let isTransitive a = true
(** Is the Event Space 'evs' antisimetric ? **)
(*-* a = (carrier evs) *-*)
let isAntisimetric a = true
(** Is the Event Space 'evs' total ? **)
(** 'xs' is subset of events of 'evs', usually xs << (carrier evs) **)
let isTotal evs xs = true
(*-* ???
( forAll_f
xs
(function x ->
(forAll_f xs (function y ->
(isRelated evs x y) || (isRelated evs y x))))
)
*-*)
(***********************************************************************)
(***********************************************************************)
(* Some auxiliary functions *)
(***********************************************************************)
(** display the event space 'evs' **)
let display evs pfix swt =
let r = {prf=pfix; res="\n"} in
let () = r.res <- r.res ^ r.prf
and () = r.res <- r.res ^"|--"
and () = r.prf <- r.prf ^"| "
and () = r.res <- r.res ^"EVENT_SPACE" in
let () =
( fold
evs
(function (e1,e2)-> function a ->
r.res <- r.res ^(disp_event_pair r.prf e1 e2 swt)
)
()
)
in r.res
(** Retrieves all left values from a = carrier evs **)
let getLvals a =
( fold_f
a
( function e -> function xs -> match e with
Use(_,l,_) |
Assign(_,l,_) |
Load(_,l,_) |
Store(_,l,_) |
Read(_,l,_) |
Write(_,l,_) -> add_l xs l
| _ -> xs
)
(empty_l)
)
(** Retrieves all right values from a = carrier evs **)
let getRvals a =
( fold_f
a
( function e -> function xs -> match e with
Use(_,_,r) |
Assign(_,_,r) |
Load(_,_,r) |
Store(_,_,r)|
Read(_,_,r) |
Write(_,_,r) -> add_r xs r
| _ -> xs
)
(empty_r)
)
(** Retrieves all objects from a = carrier evs **)
let getObjects a =
( fold_f
a
( function e -> function xs -> match e with
Lock(_,o) |
Unlock(_,o) -> add_o xs o
| _ -> xs
)
(empty_o)
)
(** Retrieves all objects from a = carrier evs **)
let getThreads a =
( fold_f
a
( function e -> function xs -> match e with
| Use(th,_,_)
| Assign(th,_,_)
| Load(th,_,_)
| Store(th,_,_)
| Read(th,_,_)
| Write(th,_,_)
| Lock(th,_)
| Unlock(th,_) -> add_t xs th
)
(empty_t)
)
(** Retrieves the last Assign event from the Event Space 'evs'. **)
let getLastAssign evs th =
let a = carrier evs in
match
( fold_f
a
(function e -> function xs ->
match e with
| Assign(t,_,_) ->
if t=th then
if xs=[] then [e] else if (isRelated evs (List.hd xs) e) then [e] else xs
else xs
| _ -> xs
)
[]
)
with
| [] -> None
| l::_ -> Some l
(** Retrieves the last event from the Event Space 'evs'. **)
let getLastStore evs th =
let a = carrier evs in
match
( fold_f
a
(function e -> function xs ->
match e with
| Store(t,_,_) ->
if t=th then
if xs=[] then [e] else if (isRelated evs (List.hd xs) e) then [e] else xs
else xs
| _ -> xs
)
[]
)
with
| [] -> None
| l::_ -> Some l
(** Retrieves the last Write events from the Event Space 'evs'. **)
let getLastWriteList evs =
let a = carrier evs in
let f t l =
( fold_f
a
(function e -> function xs ->
match e with
| Write(t1,l1,_) ->
if t1=t && l1=l then
if xs=[] then [e] else if (isRelated evs (List.hd xs) e) then [e] else xs
else xs
| _ -> xs
)
[]
) in
( fold_t
(getThreads a)
( function t -> function listt ->
( fold_l
(getLvals a)
( function l -> function listl ->
match f t l with
| [] -> listl
| lh::lt -> lh::listl
)
[]
)@listt
)
[]
)
(** Retrieves the last Read events from the Event Space 'evs'. **)
let getLastReadList evs =
let a = carrier evs in
let f t l =
( fold_f
a
(function e -> function xs ->
match e with
| Read(t1,l1,_) ->
if t1=t && l1=l then
if xs=[] then [e] else if (isRelated evs (List.hd xs) e) then [e] else xs
else xs
| _ -> xs
)
[]
) in
( fold_t
(getThreads a)
( function t -> function listt ->
( fold_l
(getLvals a)
( function l -> function listl ->
match f t l with
| [] -> listl
| lh::lt -> lh::listl
)
[]
)@listt
)
[]
)
(** computes the number of locks that 'the current thread' 'th' has
owned on the 'this Thread' 'o': the number of 'Lock(th,o)' without
matching 'Unlock(th,o)'.
**)
let locks evs th o =
let a = carrier evs in
( fold_f
a
(function e -> function xs ->
match e with
| Lock(th1,o1) -> if th1=th && o1=o then xs+1 else xs
| _ -> xs
)
0
)
(***********************************************************************)
(***********************************************************************)
(* This module presents the rules defining the property *)
(* "beeing an Event Space" *)
(***********************************************************************)
(** Predicate returning the set actions performed by the thread 'th' **)
let alpha th = function
| Lock(t,_)
| Unlock(t,_)
| Use(t,_,_)
| Assign(t,_,_)
| Load(t,_,_)
| Store(t,_,_) -> if t=th then true else false
| Read(_,_,_)
| Write(_,_,_) -> false
(** Predicate returning the set of actions performed by the Main **)
(** Memory for any one object 'o' **)
let beta o = function
Lock(_,o1) |
Unlock(_,o1) -> if o1=o then true else false
| _ -> false
(** Predicate returning the set of actions performed by the Main **)
(** Memory for any one variable 'l' **)
let betal l = function
| Write(_,l1,_)
| Read(_,l1,_) -> if l1=l then true else false
| _ -> false
(** The monotone injective partial function implementing 'read_of' **)
let read_of evs = function
Load(th,l,r) -> let (nl,nr) =
( fold
evs
(function e -> function (n1,n2) ->
match e with (x,y) ->
((if x=Load(th,l,r) then if y=Load(th,l,r) then n1+2 else n1+1 else n1),
(if x=Read(th,l,r) then if y=Read(th,l,r) then n2+2 else n2+1 else n2))
)
(0,0)
) in
if (nr>=nl) && (isMember_f (carrier evs) (Read(th,l,r)))
then Some (Read(th,l,r))
else None
| _ -> None
(** 'load_of' is the partial inverse function of 'read_of' **)
let load_of evs = function
Read(th,l,r) as f ->
(
match read_of evs (Load(th,l,r)) with
| Some f1 -> if f1=f then Some (Load(th,l,r)) else None
| _ -> None
)
| _ -> None
(** The monotone injective partial function implementing 'store_of' **)
let store_of evs = function
Write(th,l,r) ->let (nw,ns) =
( fold
evs
(function e -> function (n1,n2) ->
match e with (x,y) ->
((if x=Write(th,l,r) then if y=Write(th,l,r) then n1+2 else n1+1 else n1),
(if x=Store(th,l,r) then if y=Store(th,l,r) then n2+2 else n2+1 else n2))
)
(0,0)
) in
if (ns>=nw) && (isMember_f (carrier evs) (Store(th,l,r)))
then Some (Store(th,l,r))
else None
| _ -> None
(** 'write_of' is the partial inverse function of 'store_of' **)
let write_of evs = function
| Store(th,l,r) as f->
(
match store_of evs (Write(th,l,r)) with
| Some f1 -> if f1=f then Some (Write(th,l,r)) else None
| _ -> None
)
| _ -> None
(** lock_of **)
let lock_of evs = function
| Unlock(th,o) ->
if isMember_f (carrier evs) (Lock(th,o))
then Some (Lock(th,o))
else None
| _ -> None
(** **)
let unlock_of evs = function
| Lock(th,o) as f ->
( match lock_of evs (Unlock(th,o)) with
| Some f1 -> if f1=f then Some (Unlock(th,o)) else None
| _ -> None
)
| _ -> None
(************************ The rules themselves... ***********************)
(*-* a =(carrier evs) *-*)
let rule1 evs a =
( forAll_t
(getThreads a)
(function th -> isTotal evs (filter_f a (alpha th)))
)
(*-* a =(carrier evs) *-*)
let rule2o evs a =
( forAll_o
(getObjects a)
(function o -> isTotal evs (filter_f a (beta o)))
)
(*-* a =(carrier evs) *-*)
let rule2l evs a =
( forAll_l
(getLvals a)
(function l -> isTotal evs (filter_f a (betal l)))
)
(*-* a =(carrier evs) *-*)
let rule3 evs a =
( forAll_t
(getThreads a)
(function t ->
( forAll_l
(getLvals a)
(function l ->
let rVals = (getRvals a) in
( forAll_r
rVals
(function r ->
( forAll_r
rVals
(function s ->
let eA = Assign(t,l,r) in
let eL = Load(t,l,s) in
if (isRelated evs eA eL) then
( exists_r
rVals
(function u ->
let eS = Store(t,l,u)
in (isRelated evs eA eS) && (isRelated evs eS eL)
)
)
else true
)
)
)
)
)
)
)
)
(*-* a =(carrier evs) *-*)
let rule4 evs a =
( forAll_t
(getThreads a)
(function t ->
( forAll_l
(getLvals a)
(function l ->
let rVals = (getRvals a) in
( forAll_r
rVals
(function r ->
( forAll_r
rVals
(function s ->
let eS1 = Store(t,l,r) in
let eS2 = Store(t,l,s) in
if not (eS1=eS2) then
if(isRelated evs eS1 eS2) then
( exists_r
rVals
(function u ->
let eA = Assign(t,l,u)
in (isRelated evs eS1 eA) && (isRelated evs eA eS2)
)
)
else true
else true
)
)
)
)
)
)
)
)
(*-* a =(carrier evs) *-*)
let rule5 evs a =
( forAll_t
(getThreads a)
(function t ->
( forAll_l
(getLvals a)
(function l ->
let rVals = (getRvals a) in
( forAll_r
rVals
( function r ->
let eU = Use(t,l,r) in
if (isMember_f a eU) then
( exists_r
rVals
( function s ->
let eA = Assign(t,l,s)
in (isRelated evs eA eU)
)
)
||
( exists_r
rVals
( function s ->
let eL = Load(t,l,s)
in (isRelated evs eL eU)
)
)
else true
)
)
)
)
)
)
(*-* a =(carrier evs) *-*)
let rule6 evs a =
( forAll_t
(getThreads a)
(function t ->
( forAll_l
(getLvals a)
(function l ->
let rVals = (getRvals a) in
( forAll_r
rVals
( function r ->
let eS = Store(t,l,r) in
if (isMember_f a eS) then
( exists_r
rVals
( function s ->
let eA = Assign(t,l,s)
in (isRelated evs eA eS)
)
)
else true
)
)
)
)
)
)
(*-* a =(carrier evs) *-*)
let rule7 evs a =
( forAll_t
(getThreads a)
(function t ->
( forAll_l
(getLvals a)
(function l ->
let rVals = (getRvals a) in
( forAll_r
rVals
(function r ->
( forAll_r
rVals
(function s ->
let eA = Assign(t,l,r) in
let eU = Use(t,l,s) in
if not (r=s) then
if (isRelated evs eA eU) then
( exists_r
rVals
(function u ->
let eA1 = Assign(t,l,u)
and eL = Load(t,l,u) in
( ( (isRelated evs eA eA1) &&
(isRelated evs eA1 eU) &&
not(eA = eA1)
)
||
( (isRelated evs eA eL) &&
(isRelated evs eL eU)
)
)
)
)
else true
else true
)
)
)
)
)
)
)
)
(*-* a =(carrier evs) *-*)
let rule8 evs a =
( forAll_t
(getThreads a)
(function t ->
( forAll_l
(getLvals a)
(function l ->
let rVals = (getRvals a) in
( forAll_r
rVals
(function r ->
( forAll_r
rVals
(function s ->
let eL = Load(t,l,r) in
let eU = Use(t,l,s) in
if not (r=s) then
if (isRelated evs eL eU) then
( exists_r
rVals
(function u ->
let eA = Assign(t,l,u)
and eL1 = Load(t,l,u) in
( ( (isRelated evs eL eA) &&
(isRelated evs eA eU)
)
||
( (isRelated evs eL eL1) &&
(isRelated evs eL1 eU)
)
)
)
)
else true
else true
)
)
)
)
)
)
)
)
(*-* a =(carrier evs) *-*)
let rule9 evs a =
( forAll_t
(getThreads a)
(function t ->
( forAll_l
(getLvals a)
(function l ->
let rVals = (getRvals a) in
( forAll_r
rVals
(function r ->
( forAll_r
rVals
(function s ->
let eA = Assign(t,l,r) in
let eS = Store(t,l,s) in
if not (r=s) then
if (isRelated evs eA eS) then
( exists_r
rVals
(function u ->
let eA1 = Assign(t,l,u) in
(isRelated evs eA eA1) &&
(isRelated evs eA1 eS) &&
not (eA = eA1)
)
)
else true
else true
)
)
)
)
)
)
)
)
(*-* a =(carrier evs) *-*)
let rule10 evs a =
( forAll_t
(getThreads a)
(function t ->
( forAll_l
(getLvals a)
(function l ->
let rVals = (getRvals a) in
( forAll_r
rVals
( function r ->
let eL = Load(t,l,r) in
if (isMember_f a eL) then
( let eR = Read(t,l,r) in
(read_of evs eL) = (Some eR) &&
(isRelated evs eR eL)
)
else true
)
)
)
)
)
)
(*-* a =(carrier evs) *-*)
let rule11 evs a =
( forAll_t
(getThreads a)
(function t ->
( forAll_l
(getLvals a)
(function l ->
let rVals = (getRvals a) in
( forAll_r
rVals
( function r ->
let eW = Write(t,l,r) in
if (isMember_f a eW) then
(
let eS = Store(t,l,r)
in (store_of evs eW) = (Some eS) &&