-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathparallel_add_n.coma
More file actions
2094 lines (1581 loc) · 123 KB
/
parallel_add_n.coma
File metadata and controls
2094 lines (1581 loc) · 123 KB
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
module M_fraction_1
use real.Real
use real.FromInt
use int.Int
type t_PositiveReal
type t_Ordering = Less | Equal | Greater
function cmp_log_Real (self: Real.real) (o: Real.real) : t_Ordering = if Real.(<) self o then
Less
else
if self = o then Equal else Greater
function eq_cmp_Real (x: Real.real) (y: Real.real) : ()
axiom eq_cmp_Real_spec: forall x: Real.real, y: Real.real. (x = y) = (cmp_log_Real x y = Equal)
function antisym2_Real (x: Real.real) (y: Real.real) : ()
axiom antisym2_Real_spec: forall x: Real.real, y: Real.real. cmp_log_Real x y = Greater -> cmp_log_Real y x = Less
function antisym1_Real (x: Real.real) (y: Real.real) : ()
axiom antisym1_Real_spec: forall x: Real.real, y: Real.real. cmp_log_Real x y = Less -> cmp_log_Real y x = Greater
function trans_Real (x: Real.real) (y: Real.real) (z: Real.real) (o: t_Ordering) : ()
axiom trans_Real_spec: forall x: Real.real, y: Real.real, z: Real.real, o: t_Ordering. cmp_log_Real x y = o
-> cmp_log_Real y z = o -> cmp_log_Real x z = o
function refl_Real (x: Real.real) : ()
axiom refl_Real_spec: forall x: Real.real. cmp_log_Real x x = Equal
function cmp_gt_log_Real (x: Real.real) (y: Real.real) : ()
axiom cmp_gt_log_Real_spec: forall x: Real.real, y: Real.real. Real.(>) x y = (cmp_log_Real x y = Greater)
function cmp_ge_log_Real (x: Real.real) (y: Real.real) : ()
axiom cmp_ge_log_Real_spec: forall x: Real.real, y: Real.real. Real.(>=) x y = (cmp_log_Real x y <> Less)
function cmp_lt_log_Real (x: Real.real) (y: Real.real) : ()
axiom cmp_lt_log_Real_spec: forall x: Real.real, y: Real.real. Real.(<) x y = (cmp_log_Real x y = Less)
function cmp_le_log_Real (x: Real.real) (y: Real.real) : ()
axiom cmp_le_log_Real_spec: forall x: Real.real, y: Real.real. Real.(<=) x y = (cmp_log_Real x y <> Greater)
function to_real (self: t_PositiveReal) : Real.real
axiom to_real_spec: forall self: t_PositiveReal. Real.(>) (to_real self) (FromInt.from_int 0)
function div_PositiveReal (self: t_PositiveReal) (other: t_PositiveReal) : t_PositiveReal
axiom div_PositiveReal_spec: forall self: t_PositiveReal, other: t_PositiveReal. to_real (div_PositiveReal self other)
= Real.(/) (to_real self) (to_real other)
function new (n: Real.real) : t_PositiveReal
axiom new_spec: forall n: Real.real. Real.(>) n (FromInt.from_int 0) -> to_real (new n) = n
function from_int [@inline:trivial] (i: int) : t_PositiveReal = new (FromInt.from_int i)
meta "rewrite_def" function from_int
function fraction (i: int) (n: int) : t_PositiveReal = div_PositiveReal (from_int i) (from_int (n + 1))
predicate ext_eq (self: t_PositiveReal) (other: t_PositiveReal) = to_real self = to_real other
axiom ext_eq_spec: forall self: t_PositiveReal, other: t_PositiveReal. ext_eq self other = (self = other)
meta "compute_max_steps" 1000000
meta "select_lsinst" "all"
constant n : int
function fraction_1 (n: int) : ()
goal vc_fraction_1: [@stop_split] [@expl:fraction_1 ensures] fraction (n + 1) n = from_int 1
end
module M_fraction_add
use real.Real
use real.FromInt
use int.Int
type t_PositiveReal
type t_Ordering = Less | Equal | Greater
function cmp_log_Real (self: Real.real) (o: Real.real) : t_Ordering = if Real.(<) self o then
Less
else
if self = o then Equal else Greater
function eq_cmp_Real (x: Real.real) (y: Real.real) : ()
axiom eq_cmp_Real_spec: forall x: Real.real, y: Real.real. (x = y) = (cmp_log_Real x y = Equal)
function antisym2_Real (x: Real.real) (y: Real.real) : ()
axiom antisym2_Real_spec: forall x: Real.real, y: Real.real. cmp_log_Real x y = Greater -> cmp_log_Real y x = Less
function antisym1_Real (x: Real.real) (y: Real.real) : ()
axiom antisym1_Real_spec: forall x: Real.real, y: Real.real. cmp_log_Real x y = Less -> cmp_log_Real y x = Greater
function trans_Real (x: Real.real) (y: Real.real) (z: Real.real) (o: t_Ordering) : ()
axiom trans_Real_spec: forall x: Real.real, y: Real.real, z: Real.real, o: t_Ordering. cmp_log_Real x y = o
-> cmp_log_Real y z = o -> cmp_log_Real x z = o
function refl_Real (x: Real.real) : ()
axiom refl_Real_spec: forall x: Real.real. cmp_log_Real x x = Equal
function cmp_gt_log_Real (x: Real.real) (y: Real.real) : ()
axiom cmp_gt_log_Real_spec: forall x: Real.real, y: Real.real. Real.(>) x y = (cmp_log_Real x y = Greater)
function cmp_ge_log_Real (x: Real.real) (y: Real.real) : ()
axiom cmp_ge_log_Real_spec: forall x: Real.real, y: Real.real. Real.(>=) x y = (cmp_log_Real x y <> Less)
function cmp_lt_log_Real (x: Real.real) (y: Real.real) : ()
axiom cmp_lt_log_Real_spec: forall x: Real.real, y: Real.real. Real.(<) x y = (cmp_log_Real x y = Less)
function cmp_le_log_Real (x: Real.real) (y: Real.real) : ()
axiom cmp_le_log_Real_spec: forall x: Real.real, y: Real.real. Real.(<=) x y = (cmp_log_Real x y <> Greater)
function to_real (self: t_PositiveReal) : Real.real
axiom to_real_spec: forall self: t_PositiveReal. Real.(>) (to_real self) (FromInt.from_int 0)
function add_PositiveReal (self: t_PositiveReal) (other: t_PositiveReal) : t_PositiveReal
axiom add_PositiveReal_spec: forall self: t_PositiveReal, other: t_PositiveReal. to_real (add_PositiveReal self other)
= Real.(+) (to_real self) (to_real other)
function div_PositiveReal (self: t_PositiveReal) (other: t_PositiveReal) : t_PositiveReal
axiom div_PositiveReal_spec: forall self: t_PositiveReal, other: t_PositiveReal. to_real (div_PositiveReal self other)
= Real.(/) (to_real self) (to_real other)
function new (n: Real.real) : t_PositiveReal
axiom new_spec: forall n: Real.real. Real.(>) n (FromInt.from_int 0) -> to_real (new n) = n
function from_int [@inline:trivial] (i: int) : t_PositiveReal = new (FromInt.from_int i)
meta "rewrite_def" function from_int
function fraction (i: int) (n: int) : t_PositiveReal = div_PositiveReal (from_int i) (from_int (n + 1))
predicate ext_eq (self: t_PositiveReal) (other: t_PositiveReal) = to_real self = to_real other
axiom ext_eq_spec: forall self: t_PositiveReal, other: t_PositiveReal. ext_eq self other = (self = other)
meta "compute_max_steps" 1000000
meta "select_lsinst" "all"
constant a : int
constant b : int
constant n : int
function fraction_add (a: int) (b: int) (n: int) : ()
goal vc_fraction_add: a > 0 /\ b > 0
-> ([@stop_split] [@expl:fraction_add ensures] add_PositiveReal (fraction a n) (fraction b n) = fraction (a + b) n)
end
module M_parallel_add
type namespace_other
type t_Namespace = Namespace_PARALLEL_ADD int | Other namespace_other
use creusot.int.Int32
use real.Real
use real.FromInt
use map.Map
use creusot.prelude.MutBorrow
use bv.Pow2int
use seq.Seq
use creusot.int.UInt64
use creusot.int.Int128
use creusot.prelude.Any
use set.Set
use int.Int
type t_AtomicI32
type t_Perm_AtomicI32
type tup2_AtomicI32_Ghost_Box_Perm_AtomicI32_Global = { f0: t_AtomicI32; f1: t_Perm_AtomicI32 }
predicate inv_AtomicI32 (_1: t_AtomicI32)
predicate inv_tup2_AtomicI32_Ghost_Box_Perm_AtomicI32_Global [@inline:trivial] (_1: tup2_AtomicI32_Ghost_Box_Perm_AtomicI32_Global) =
inv_AtomicI32 _1.f0
meta "rewrite_def" predicate inv_tup2_AtomicI32_Ghost_Box_Perm_AtomicI32_Global
function val_AtomicI32 (self: t_Perm_AtomicI32) : Int32.t
function ward_AtomicI32 (self: t_Perm_AtomicI32) : t_AtomicI32
let rec new (val': Int32.t) (return (x: tup2_AtomicI32_Ghost_Box_Perm_AtomicI32_Global)) = any
[ return (result: tup2_AtomicI32_Ghost_Box_Perm_AtomicI32_Global) ->
{[@stop_split] [@expl:new ensures] ([@stop_split] [@expl:new result type invariant] inv_tup2_AtomicI32_Ghost_Box_Perm_AtomicI32_Global result)
/\ ([@stop_split] [@expl:new ensures #0] val_AtomicI32 result.f1 = val')
/\ ([@stop_split] [@expl:new ensures #1] ward_AtomicI32 result.f1 = result.f0)}
(! return {result}) ]
type tup2_fraction_1_fraction_add = { f0'0: (); f1'0: () }
type t_PositiveReal
type t_Ordering = Less | Equal | Greater
function cmp_log_Real (self: Real.real) (o: Real.real) : t_Ordering = if Real.(<) self o then
Less
else
if self = o then Equal else Greater
function eq_cmp_Real (x: Real.real) (y: Real.real) : ()
axiom eq_cmp_Real_spec: forall x: Real.real, y: Real.real. (x = y) = (cmp_log_Real x y = Equal)
function antisym2_Real (x: Real.real) (y: Real.real) : ()
axiom antisym2_Real_spec: forall x: Real.real, y: Real.real. cmp_log_Real x y = Greater -> cmp_log_Real y x = Less
function antisym1_Real (x: Real.real) (y: Real.real) : ()
axiom antisym1_Real_spec: forall x: Real.real, y: Real.real. cmp_log_Real x y = Less -> cmp_log_Real y x = Greater
function trans_Real (x: Real.real) (y: Real.real) (z: Real.real) (o: t_Ordering) : ()
axiom trans_Real_spec: forall x: Real.real, y: Real.real, z: Real.real, o: t_Ordering. cmp_log_Real x y = o
-> cmp_log_Real y z = o -> cmp_log_Real x z = o
function refl_Real (x: Real.real) : ()
axiom refl_Real_spec: forall x: Real.real. cmp_log_Real x x = Equal
function cmp_gt_log_Real (x: Real.real) (y: Real.real) : ()
axiom cmp_gt_log_Real_spec: forall x: Real.real, y: Real.real. Real.(>) x y = (cmp_log_Real x y = Greater)
function cmp_ge_log_Real (x: Real.real) (y: Real.real) : ()
axiom cmp_ge_log_Real_spec: forall x: Real.real, y: Real.real. Real.(>=) x y = (cmp_log_Real x y <> Less)
function cmp_lt_log_Real (x: Real.real) (y: Real.real) : ()
axiom cmp_lt_log_Real_spec: forall x: Real.real, y: Real.real. Real.(<) x y = (cmp_log_Real x y = Less)
function cmp_le_log_Real (x: Real.real) (y: Real.real) : ()
axiom cmp_le_log_Real_spec: forall x: Real.real, y: Real.real. Real.(<=) x y = (cmp_log_Real x y <> Greater)
function to_real (self: t_PositiveReal) : Real.real
axiom to_real_spec: forall self: t_PositiveReal. Real.(>) (to_real self) (FromInt.from_int 0)
function div_PositiveReal (self: t_PositiveReal) (other: t_PositiveReal) : t_PositiveReal
axiom div_PositiveReal_spec: forall self: t_PositiveReal, other: t_PositiveReal. to_real (div_PositiveReal self other)
= Real.(/) (to_real self) (to_real other)
function new'0 (n: Real.real) : t_PositiveReal
axiom new_spec: forall n: Real.real. Real.(>) n (FromInt.from_int 0) -> to_real (new'0 n) = n
function from_int [@inline:trivial] (i: int) : t_PositiveReal = new'0 (FromInt.from_int i)
meta "rewrite_def" function from_int
function fraction (i: int) (n: int) : t_PositiveReal = div_PositiveReal (from_int i) (from_int (n + 1))
function fraction_1 (n: int) : () = ()
axiom fraction_1_spec: forall n: int. fraction (n + 1) n = from_int 1
function add_PositiveReal (self: t_PositiveReal) (other: t_PositiveReal) : t_PositiveReal
axiom add_PositiveReal_spec: forall self: t_PositiveReal, other: t_PositiveReal. to_real (add_PositiveReal self other)
= Real.(+) (to_real self) (to_real other)
function fraction_add (a: int) (b: int) (n: int) : () = ()
axiom fraction_add_spec: forall a: int, b: int, n: int. a > 0 /\ b > 0
-> add_PositiveReal (fraction a n) (fraction b n) = fraction (a + b) n
type t_Authority_Option_tup2_PositiveReal_Int
predicate invariant_Authority_Option_tup2_PositiveReal_Int (self: t_Authority_Option_tup2_PositiveReal_Int)
predicate inv_Authority_Option_tup2_PositiveReal_Int (_1: t_Authority_Option_tup2_PositiveReal_Int)
axiom inv_axiom:
forall x: t_Authority_Option_tup2_PositiveReal_Int [inv_Authority_Option_tup2_PositiveReal_Int x]. inv_Authority_Option_tup2_PositiveReal_Int x
-> invariant_Authority_Option_tup2_PositiveReal_Int x
predicate invariant_Ghost_Authority_Option_tup2_PositiveReal_Int [@inline:trivial] (self: t_Authority_Option_tup2_PositiveReal_Int) =
inv_Authority_Option_tup2_PositiveReal_Int self
meta "rewrite_def" predicate invariant_Ghost_Authority_Option_tup2_PositiveReal_Int
predicate inv_Ghost_Authority_Option_tup2_PositiveReal_Int [@inline:trivial] (_1: t_Authority_Option_tup2_PositiveReal_Int) =
invariant_Ghost_Authority_Option_tup2_PositiveReal_Int _1
meta "rewrite_def" predicate inv_Ghost_Authority_Option_tup2_PositiveReal_Int
type tup2_PositiveReal_Int = { f0'1: t_PositiveReal; f1'1: int }
type t_Option_tup2_PositiveReal_Int = None | Some tup2_PositiveReal_Int
function view_Authority_Option_tup2_PositiveReal_Int (self: t_Authority_Option_tup2_PositiveReal_Int) : t_Option_tup2_PositiveReal_Int
type t_Option_Option_tup2_PositiveReal_Int = None'0 | Some'0 t_Option_tup2_PositiveReal_Int
type tup2_Option_tup2_PositiveReal_Int_Option_tup2_PositiveReal_Int = {
f0'2: t_Option_tup2_PositiveReal_Int;
f1'2: t_Option_tup2_PositiveReal_Int }
function map_Option_tup2_PositiveReal_Int (self: t_Option_tup2_PositiveReal_Int) (f: Map.map tup2_PositiveReal_Int t_Option_tup2_PositiveReal_Int) : t_Option_Option_tup2_PositiveReal_Int
= match self with
| None -> None'0
| Some x -> Some'0 (Map.get f x)
end
type t_Option_PositiveReal = None'1 | Some'1 t_PositiveReal
type t_Option_Int = None'2 | Some'2 int
type tup2_Option_PositiveReal_Option_Int = { f0'3: t_Option_PositiveReal; f1'3: t_Option_Int }
function op_PositiveReal [@inline:trivial] (self: t_PositiveReal) (other: t_PositiveReal) : t_Option_PositiveReal =
Some'1 (add_PositiveReal self other)
meta "rewrite_def" function op_PositiveReal
function commutative_PositiveReal (a: t_PositiveReal) (b: t_PositiveReal) : ()
axiom commutative_PositiveReal_spec: forall a: t_PositiveReal, b: t_PositiveReal. op_PositiveReal a b
= op_PositiveReal b a
function op_Int [@inline:trivial] (self: int) (other: int) : t_Option_Int = Some'2 (self + other)
meta "rewrite_def" function op_Int
function commutative_Int (a: int) (b: int) : ()
axiom commutative_Int_spec: forall a: int, b: int. op_Int a b = op_Int b a
function op_tup2_PositiveReal_Int (self: tup2_PositiveReal_Int) (other: tup2_PositiveReal_Int) : t_Option_tup2_PositiveReal_Int
= match { f0'3 = op_PositiveReal self.f0'1 other.f0'1; f1'3 = op_Int self.f1'1 other.f1'1 } with
| {f0'3 = Some'1 r1; f1'3 = Some'2 r2} -> Some { f0'1 = r1; f1'1 = r2 }
| _ -> None
end
function commutative_tup2_PositiveReal_Int (a: tup2_PositiveReal_Int) (b: tup2_PositiveReal_Int) : ()
axiom commutative_tup2_PositiveReal_Int_spec:
forall a: tup2_PositiveReal_Int, b: tup2_PositiveReal_Int. op_tup2_PositiveReal_Int a b
= op_tup2_PositiveReal_Int b a
function op_Option_tup2_PositiveReal_Int (self: t_Option_tup2_PositiveReal_Int) (other: t_Option_tup2_PositiveReal_Int) : t_Option_Option_tup2_PositiveReal_Int
= match { f0'2 = self; f1'2 = other } with
| {f0'2 = None} -> Some'0 other
| {f1'2 = None} -> Some'0 self
| {f0'2 = Some x; f1'2 = Some y} -> map_Option_tup2_PositiveReal_Int (op_tup2_PositiveReal_Int x y) (fun (z: tup2_PositiveReal_Int) -> Some z)
end
function commutative_Option_tup2_PositiveReal_Int (a: t_Option_tup2_PositiveReal_Int) (b: t_Option_tup2_PositiveReal_Int) : ()
axiom commutative_Option_tup2_PositiveReal_Int_spec:
forall a: t_Option_tup2_PositiveReal_Int, b: t_Option_tup2_PositiveReal_Int. op_Option_tup2_PositiveReal_Int a b
= op_Option_tup2_PositiveReal_Int b a
constant unit_Option_tup2_PositiveReal_Int: t_Option_tup2_PositiveReal_Int = None
axiom unit_Option_tup2_PositiveReal_Int_spec:
forall x: t_Option_tup2_PositiveReal_Int [op_Option_tup2_PositiveReal_Int x unit_Option_tup2_PositiveReal_Int]. op_Option_tup2_PositiveReal_Int x unit_Option_tup2_PositiveReal_Int
= Some'0 x
let rec alloc_Option_tup2_PositiveReal_Int (return (x: t_Authority_Option_tup2_PositiveReal_Int)) = any
[ return (result: t_Authority_Option_tup2_PositiveReal_Int) ->
{[@stop_split] [@expl:alloc_Option_tup2_PositiveReal_Int ensures] ([@stop_split] [@expl:alloc result type invariant] inv_Ghost_Authority_Option_tup2_PositiveReal_Int result)
/\ ([@stop_split] [@expl:alloc ensures] view_Authority_Option_tup2_PositiveReal_Int result
= unit_Option_tup2_PositiveReal_Int)}
(! return {result}) ]
predicate invariant_ref_Ghost_Authority_Option_tup2_PositiveReal_Int [@inline:trivial] (self: t_Authority_Option_tup2_PositiveReal_Int) =
inv_Ghost_Authority_Option_tup2_PositiveReal_Int self
meta "rewrite_def" predicate invariant_ref_Ghost_Authority_Option_tup2_PositiveReal_Int
predicate inv_ref_Ghost_Authority_Option_tup2_PositiveReal_Int [@inline:trivial] (_1: t_Authority_Option_tup2_PositiveReal_Int) =
invariant_ref_Ghost_Authority_Option_tup2_PositiveReal_Int _1
meta "rewrite_def" predicate inv_ref_Ghost_Authority_Option_tup2_PositiveReal_Int
predicate invariant_ref_Authority_Option_tup2_PositiveReal_Int [@inline:trivial] (self: t_Authority_Option_tup2_PositiveReal_Int) =
inv_Authority_Option_tup2_PositiveReal_Int self
meta "rewrite_def" predicate invariant_ref_Authority_Option_tup2_PositiveReal_Int
predicate inv_ref_Authority_Option_tup2_PositiveReal_Int [@inline:trivial] (_1: t_Authority_Option_tup2_PositiveReal_Int) =
invariant_ref_Authority_Option_tup2_PositiveReal_Int _1
meta "rewrite_def" predicate inv_ref_Authority_Option_tup2_PositiveReal_Int
let rec deref_Ghost_Authority_Option_tup2_PositiveReal_Int (self: t_Authority_Option_tup2_PositiveReal_Int)
(return (x: t_Authority_Option_tup2_PositiveReal_Int)) =
{[@stop_split] [@expl:deref 'self' type invariant] inv_ref_Ghost_Authority_Option_tup2_PositiveReal_Int self}
any
[ return (result: t_Authority_Option_tup2_PositiveReal_Int) ->
{[@stop_split] [@expl:deref_Ghost_Authority_Option_tup2_PositiveReal_Int ensures] ([@stop_split] [@expl:deref result type invariant] inv_ref_Authority_Option_tup2_PositiveReal_Int result)
/\ ([@stop_split] [@expl:deref ensures] result = self)}
(! return {result}) ]
type t_Id
function id_Option_tup2_PositiveReal_Int (self: t_Authority_Option_tup2_PositiveReal_Int) : t_Id
let rec id_ghost_Option_tup2_PositiveReal_Int (self: t_Authority_Option_tup2_PositiveReal_Int) (return (x: t_Id)) =
{[@stop_split] [@expl:id_ghost 'self' type invariant] inv_ref_Authority_Option_tup2_PositiveReal_Int self}
any
[ return (result: t_Id) -> {[@stop_split] [@expl:id_ghost ensures] result = id_Option_tup2_PositiveReal_Int self}
(! return {result}) ]
type t_Resource_View_AuthViewRel_Option_tup2_PositiveReal_Int
type t_Fragment_Option_tup2_PositiveReal_Int = { f0'4: t_Resource_View_AuthViewRel_Option_tup2_PositiveReal_Int }
type t_View_AuthViewRel_Option_tup2_PositiveReal_Int
function factor_PositiveReal [@inline:trivial] (self: t_PositiveReal) (factor: t_PositiveReal) : t_Option_PositiveReal
= if Real.(>) (to_real self) (to_real factor) then
Some'1 (new'0 (Real.(-) (to_real self) (to_real factor)))
else
None'1
meta "rewrite_def" function factor_PositiveReal
axiom factor_PositiveReal_spec:
forall self: t_PositiveReal, factor: t_PositiveReal. match factor_PositiveReal self factor with
| Some'1 c -> op_PositiveReal factor c = Some'1 self
| None'1 -> forall c: t_PositiveReal. op_PositiveReal factor c <> Some'1 self
end
function factor_Int [@inline:trivial] (self: int) (factor: int) : t_Option_Int = Some'2 (self - factor)
meta "rewrite_def" function factor_Int
axiom factor_Int_spec: forall self: int, factor: int. match factor_Int self factor with
| Some'2 c -> op_Int factor c = Some'2 self
| None'2 -> false
end
function factor_tup2_PositiveReal_Int (self: tup2_PositiveReal_Int) (factor: tup2_PositiveReal_Int) : t_Option_tup2_PositiveReal_Int
= match { f0'3 = factor_PositiveReal self.f0'1 factor.f0'1; f1'3 = factor_Int self.f1'1 factor.f1'1 } with
| {f0'3 = Some'1 x; f1'3 = Some'2 y} -> Some { f0'1 = x; f1'1 = y }
| _ -> None
end
axiom factor_tup2_PositiveReal_Int_spec:
forall self: tup2_PositiveReal_Int, factor: tup2_PositiveReal_Int. match factor_tup2_PositiveReal_Int self factor with
| Some c -> op_tup2_PositiveReal_Int factor c = Some self
| None -> forall c: tup2_PositiveReal_Int. op_tup2_PositiveReal_Int factor c <> Some self
end
function factor_Option_tup2_PositiveReal_Int (self: t_Option_tup2_PositiveReal_Int) (factor: t_Option_tup2_PositiveReal_Int) : t_Option_Option_tup2_PositiveReal_Int
= match { f0'2 = self; f1'2 = factor } with
| {f0'2 = x; f1'2 = None} -> Some'0 x
| {f0'2 = None} -> None'0
| {f0'2 = Some x; f1'2 = Some y} -> match factor_tup2_PositiveReal_Int x y with
| Some z -> Some'0 (Some z)
| None -> if x = y then Some'0 (None) else None'0
end
end
axiom factor_Option_tup2_PositiveReal_Int_spec:
forall self: t_Option_tup2_PositiveReal_Int, factor: t_Option_tup2_PositiveReal_Int. match factor_Option_tup2_PositiveReal_Int self factor with
| Some'0 c -> op_Option_tup2_PositiveReal_Int factor c = Some'0 self
| None'0 -> forall c: t_Option_tup2_PositiveReal_Int. op_Option_tup2_PositiveReal_Int factor c <> Some'0 self
end
predicate incl_Option_tup2_PositiveReal_Int (self: t_Option_tup2_PositiveReal_Int) (other: t_Option_tup2_PositiveReal_Int) =
factor_Option_tup2_PositiveReal_Int other self <> None'0
function incl_transitive_Option_tup2_PositiveReal_Int (a: t_Option_tup2_PositiveReal_Int) (b: t_Option_tup2_PositiveReal_Int) (c: t_Option_tup2_PositiveReal_Int) : ()
axiom incl_transitive_Option_tup2_PositiveReal_Int_spec:
forall a: t_Option_tup2_PositiveReal_Int, b: t_Option_tup2_PositiveReal_Int, c: t_Option_tup2_PositiveReal_Int. incl_Option_tup2_PositiveReal_Int a b
-> incl_Option_tup2_PositiveReal_Int b c -> incl_Option_tup2_PositiveReal_Int a c
function associative_some_Option_tup2_PositiveReal_Int (a: t_Option_tup2_PositiveReal_Int) (b: t_Option_tup2_PositiveReal_Int) (c: t_Option_tup2_PositiveReal_Int) (ab: t_Option_tup2_PositiveReal_Int) (bc: t_Option_tup2_PositiveReal_Int) : ()
axiom associative_some_Option_tup2_PositiveReal_Int_spec:
forall a: t_Option_tup2_PositiveReal_Int, b: t_Option_tup2_PositiveReal_Int, c: t_Option_tup2_PositiveReal_Int, ab: t_Option_tup2_PositiveReal_Int, bc: t_Option_tup2_PositiveReal_Int. op_Option_tup2_PositiveReal_Int a b
= Some'0 ab
-> op_Option_tup2_PositiveReal_Int b c = Some'0 bc
-> op_Option_tup2_PositiveReal_Int a bc = op_Option_tup2_PositiveReal_Int ab c
function associative_none_Option_tup2_PositiveReal_Int (a: t_Option_tup2_PositiveReal_Int) (b: t_Option_tup2_PositiveReal_Int) (c: t_Option_tup2_PositiveReal_Int) (bc: t_Option_tup2_PositiveReal_Int) : ()
axiom associative_none_Option_tup2_PositiveReal_Int_spec:
forall a: t_Option_tup2_PositiveReal_Int, b: t_Option_tup2_PositiveReal_Int, c: t_Option_tup2_PositiveReal_Int, bc: t_Option_tup2_PositiveReal_Int. op_Option_tup2_PositiveReal_Int a b
= None'0 -> op_Option_tup2_PositiveReal_Int b c = Some'0 bc -> op_Option_tup2_PositiveReal_Int a bc = None'0
function incl_op_Option_tup2_PositiveReal_Int (self: t_Option_tup2_PositiveReal_Int) (other: t_Option_tup2_PositiveReal_Int) (comb: t_Option_tup2_PositiveReal_Int) : ()
axiom incl_op_Option_tup2_PositiveReal_Int_spec:
forall self: t_Option_tup2_PositiveReal_Int, other: t_Option_tup2_PositiveReal_Int, comb: t_Option_tup2_PositiveReal_Int. op_Option_tup2_PositiveReal_Int self other
= Some'0 comb -> incl_Option_tup2_PositiveReal_Int self comb
predicate rel_AuthViewRel_Option_tup2_PositiveReal_Int (a: t_Option_Option_tup2_PositiveReal_Int) (f: t_Option_tup2_PositiveReal_Int) =
match a with
| Some'0 a'0 -> incl_Option_tup2_PositiveReal_Int f a'0
| None'0 -> true
end
function rel_unit_AuthViewRel_Option_tup2_PositiveReal_Int (a: t_Option_Option_tup2_PositiveReal_Int) : ()
axiom rel_unit_AuthViewRel_Option_tup2_PositiveReal_Int_spec:
forall a: t_Option_Option_tup2_PositiveReal_Int. rel_AuthViewRel_Option_tup2_PositiveReal_Int a unit_Option_tup2_PositiveReal_Int
function rel_none_AuthViewRel_Option_tup2_PositiveReal_Int (a: t_Option_Option_tup2_PositiveReal_Int) (f: t_Option_tup2_PositiveReal_Int) : ()
axiom rel_none_AuthViewRel_Option_tup2_PositiveReal_Int_spec:
forall a: t_Option_Option_tup2_PositiveReal_Int, f: t_Option_tup2_PositiveReal_Int. rel_AuthViewRel_Option_tup2_PositiveReal_Int (None'0) f
function rel_mono_AuthViewRel_Option_tup2_PositiveReal_Int (a: t_Option_Option_tup2_PositiveReal_Int) (f1'4: t_Option_tup2_PositiveReal_Int) (f2: t_Option_tup2_PositiveReal_Int) : ()
axiom rel_mono_AuthViewRel_Option_tup2_PositiveReal_Int_spec:
forall a: t_Option_Option_tup2_PositiveReal_Int, f1'4: t_Option_tup2_PositiveReal_Int, f2: t_Option_tup2_PositiveReal_Int. rel_AuthViewRel_Option_tup2_PositiveReal_Int a f1'4
-> incl_Option_tup2_PositiveReal_Int f2 f1'4 -> rel_AuthViewRel_Option_tup2_PositiveReal_Int a f2
function auth_AuthViewRel_Option_tup2_PositiveReal_Int (self: t_View_AuthViewRel_Option_tup2_PositiveReal_Int) : t_Option_Option_tup2_PositiveReal_Int
function frag_AuthViewRel_Option_tup2_PositiveReal_Int (self: t_View_AuthViewRel_Option_tup2_PositiveReal_Int) : t_Option_tup2_PositiveReal_Int
axiom frag_AuthViewRel_Option_tup2_PositiveReal_Int_spec:
forall self: t_View_AuthViewRel_Option_tup2_PositiveReal_Int. rel_AuthViewRel_Option_tup2_PositiveReal_Int (auth_AuthViewRel_Option_tup2_PositiveReal_Int self) (frag_AuthViewRel_Option_tup2_PositiveReal_Int self)
function val_View_AuthViewRel_Option_tup2_PositiveReal_Int (self: t_Resource_View_AuthViewRel_Option_tup2_PositiveReal_Int) : t_View_AuthViewRel_Option_tup2_PositiveReal_Int
function view_Resource_View_AuthViewRel_Option_tup2_PositiveReal_Int [@inline:trivial] (self: t_Resource_View_AuthViewRel_Option_tup2_PositiveReal_Int) : t_View_AuthViewRel_Option_tup2_PositiveReal_Int
= val_View_AuthViewRel_Option_tup2_PositiveReal_Int self
meta "rewrite_def" function view_Resource_View_AuthViewRel_Option_tup2_PositiveReal_Int
function view_Fragment_Option_tup2_PositiveReal_Int (self: t_Fragment_Option_tup2_PositiveReal_Int) : t_Option_tup2_PositiveReal_Int
=
frag_AuthViewRel_Option_tup2_PositiveReal_Int (view_Resource_View_AuthViewRel_Option_tup2_PositiveReal_Int self.f0'4)
function id_View_AuthViewRel_Option_tup2_PositiveReal_Int (self: t_Resource_View_AuthViewRel_Option_tup2_PositiveReal_Int) : t_Id
function id_Option_tup2_PositiveReal_Int'0 (self: t_Fragment_Option_tup2_PositiveReal_Int) : t_Id =
id_View_AuthViewRel_Option_tup2_PositiveReal_Int self.f0'4
let rec new_unit_Option_tup2_PositiveReal_Int (id: t_Id) (return (x: t_Fragment_Option_tup2_PositiveReal_Int)) = any
[ return (result: t_Fragment_Option_tup2_PositiveReal_Int) ->
{[@stop_split] [@expl:new_unit ensures] view_Fragment_Option_tup2_PositiveReal_Int result
= unit_Option_tup2_PositiveReal_Int
/\ id_Option_tup2_PositiveReal_Int'0 result = id}
(! return {result}) ]
let rec new_Fragment_Option_tup2_PositiveReal_Int (x: t_Fragment_Option_tup2_PositiveReal_Int)
(return (x'0: t_Fragment_Option_tup2_PositiveReal_Int)) = any
[ return (result: t_Fragment_Option_tup2_PositiveReal_Int) -> {[@stop_split] [@expl:new ensures] result = x}
(! return {result}) ]
predicate invariant_refmut_Ghost_Authority_Option_tup2_PositiveReal_Int [@inline:trivial] (self: MutBorrow.t t_Authority_Option_tup2_PositiveReal_Int) =
inv_Ghost_Authority_Option_tup2_PositiveReal_Int self.current
/\ inv_Ghost_Authority_Option_tup2_PositiveReal_Int self.final
meta "rewrite_def" predicate invariant_refmut_Ghost_Authority_Option_tup2_PositiveReal_Int
predicate inv_refmut_Ghost_Authority_Option_tup2_PositiveReal_Int [@inline:trivial] (_1: MutBorrow.t t_Authority_Option_tup2_PositiveReal_Int) =
invariant_refmut_Ghost_Authority_Option_tup2_PositiveReal_Int _1
meta "rewrite_def" predicate inv_refmut_Ghost_Authority_Option_tup2_PositiveReal_Int
predicate invariant_refmut_Authority_Option_tup2_PositiveReal_Int [@inline:trivial] (self: MutBorrow.t t_Authority_Option_tup2_PositiveReal_Int) =
inv_Authority_Option_tup2_PositiveReal_Int self.current /\ inv_Authority_Option_tup2_PositiveReal_Int self.final
meta "rewrite_def" predicate invariant_refmut_Authority_Option_tup2_PositiveReal_Int
predicate inv_refmut_Authority_Option_tup2_PositiveReal_Int [@inline:trivial] (_1: MutBorrow.t t_Authority_Option_tup2_PositiveReal_Int) =
invariant_refmut_Authority_Option_tup2_PositiveReal_Int _1
meta "rewrite_def" predicate inv_refmut_Authority_Option_tup2_PositiveReal_Int
let rec deref_mut_Ghost_Authority_Option_tup2_PositiveReal_Int
(self: MutBorrow.t t_Authority_Option_tup2_PositiveReal_Int)
(return (x: MutBorrow.t t_Authority_Option_tup2_PositiveReal_Int)) =
{[@stop_split] [@expl:deref_mut 'self' type invariant] inv_refmut_Ghost_Authority_Option_tup2_PositiveReal_Int self}
any
[ return (result: MutBorrow.t t_Authority_Option_tup2_PositiveReal_Int) ->
{[@stop_split] [@expl:deref_mut_Ghost_Authority_Option_tup2_PositiveReal_Int ensures] ([@stop_split] [@expl:deref_mut result type invariant] inv_refmut_Authority_Option_tup2_PositiveReal_Int result)
/\ ([@stop_split] [@expl:deref_mut ensures] result = self)}
(! return {result}) ]
let rec deref_mut_Ghost_Fragment_Option_tup2_PositiveReal_Int
(self: MutBorrow.t t_Fragment_Option_tup2_PositiveReal_Int)
(return (x: MutBorrow.t t_Fragment_Option_tup2_PositiveReal_Int)) = any
[ return (result: MutBorrow.t t_Fragment_Option_tup2_PositiveReal_Int) ->
{[@stop_split] [@expl:deref_mut ensures] result = self}
(! return {result}) ]
type t_Option_Option_Option_tup2_PositiveReal_Int = None'3 | Some'3 t_Option_Option_tup2_PositiveReal_Int
type tup2_Option_Option_tup2_PositiveReal_Int_Option_Option_tup2_PositiveReal_Int = {
f0'5: t_Option_Option_tup2_PositiveReal_Int;
f1'5: t_Option_Option_tup2_PositiveReal_Int }
function map_Option_Option_tup2_PositiveReal_Int (self: t_Option_Option_tup2_PositiveReal_Int) (f: Map.map t_Option_tup2_PositiveReal_Int t_Option_Option_tup2_PositiveReal_Int) : t_Option_Option_Option_tup2_PositiveReal_Int
= match self with
| None'0 -> None'3
| Some'0 x -> Some'3 (Map.get f x)
end
function op_Option_Option_tup2_PositiveReal_Int (self: t_Option_Option_tup2_PositiveReal_Int) (other: t_Option_Option_tup2_PositiveReal_Int) : t_Option_Option_Option_tup2_PositiveReal_Int
= match { f0'5 = self; f1'5 = other } with
| {f0'5 = None'0} -> Some'3 other
| {f1'5 = None'0} -> Some'3 self
| {f0'5 = Some'0 x; f1'5 = Some'0 y} -> map_Option_Option_tup2_PositiveReal_Int (op_Option_tup2_PositiveReal_Int x y) (fun (z: t_Option_tup2_PositiveReal_Int) -> Some'0 z)
end
function commutative_Option_Option_tup2_PositiveReal_Int (a: t_Option_Option_tup2_PositiveReal_Int) (b: t_Option_Option_tup2_PositiveReal_Int) : ()
axiom commutative_Option_Option_tup2_PositiveReal_Int_spec:
forall a: t_Option_Option_tup2_PositiveReal_Int, b: t_Option_Option_tup2_PositiveReal_Int. op_Option_Option_tup2_PositiveReal_Int a b
= op_Option_Option_tup2_PositiveReal_Int b a
predicate premise_Snapshot_tup2_Option_tup2_PositiveReal_Int_Option_tup2_PositiveReal_Int [@inline:trivial] (self: tup2_Option_tup2_PositiveReal_Int_Option_tup2_PositiveReal_Int) (from_auth: t_Option_tup2_PositiveReal_Int) (from_frag: t_Option_tup2_PositiveReal_Int) =
forall f: t_Option_Option_tup2_PositiveReal_Int. op_Option_Option_tup2_PositiveReal_Int (Some'0 from_frag) f
= Some'3 (Some'0 from_auth)
-> op_Option_Option_tup2_PositiveReal_Int (Some'0 (self.f1'2)) f = Some'3 (Some'0 (self.f0'2))
meta "rewrite_def" predicate premise_Snapshot_tup2_Option_tup2_PositiveReal_Int_Option_tup2_PositiveReal_Int
function update_Snapshot_tup2_Option_tup2_PositiveReal_Int_Option_tup2_PositiveReal_Int [@inline:trivial] (self: tup2_Option_tup2_PositiveReal_Int_Option_tup2_PositiveReal_Int) (_2: t_Option_tup2_PositiveReal_Int) (_3: t_Option_tup2_PositiveReal_Int) : tup2_Option_tup2_PositiveReal_Int_Option_tup2_PositiveReal_Int
= self
meta "rewrite_def" function update_Snapshot_tup2_Option_tup2_PositiveReal_Int_Option_tup2_PositiveReal_Int
let rec update_Option_tup2_PositiveReal_Int (self: MutBorrow.t t_Authority_Option_tup2_PositiveReal_Int)
(frag: MutBorrow.t t_Fragment_Option_tup2_PositiveReal_Int)
(upd: tup2_Option_tup2_PositiveReal_Int_Option_tup2_PositiveReal_Int) (return (x: ())) =
{[@stop_split] [@expl:update_Option_tup2_PositiveReal_Int requires] ([@stop_split] [@expl:update 'self' type invariant] inv_refmut_Authority_Option_tup2_PositiveReal_Int self)
/\ ([@stop_split] [@expl:update requires #0] id_Option_tup2_PositiveReal_Int self.current
= id_Option_tup2_PositiveReal_Int'0 frag.current)
/\ ([@stop_split] [@expl:update requires #1] premise_Snapshot_tup2_Option_tup2_PositiveReal_Int_Option_tup2_PositiveReal_Int upd (view_Authority_Option_tup2_PositiveReal_Int self.current) (view_Fragment_Option_tup2_PositiveReal_Int frag.current))}
any
[ return (result: ()) ->
{[@stop_split] [@expl:update_Option_tup2_PositiveReal_Int ensures] ([@stop_split] [@expl:update ensures #0] id_Option_tup2_PositiveReal_Int self.current
= id_Option_tup2_PositiveReal_Int self.final)
/\ ([@stop_split] [@expl:update ensures #1] id_Option_tup2_PositiveReal_Int'0 frag.current
= id_Option_tup2_PositiveReal_Int'0 frag.final)
/\ ([@stop_split] [@expl:update ensures #2] incl_Option_tup2_PositiveReal_Int (view_Fragment_Option_tup2_PositiveReal_Int frag.current) (view_Authority_Option_tup2_PositiveReal_Int self.current))
/\ ([@stop_split] [@expl:update ensures #3] { f0'2 = view_Authority_Option_tup2_PositiveReal_Int self.final;
f1'2 = view_Fragment_Option_tup2_PositiveReal_Int frag.final }
= update_Snapshot_tup2_Option_tup2_PositiveReal_Int_Option_tup2_PositiveReal_Int upd (view_Authority_Option_tup2_PositiveReal_Int self.current) (view_Fragment_Option_tup2_PositiveReal_Int frag.current))}
(! return {result}) ]
predicate resolve_refmut_Ghost_Fragment_Option_tup2_PositiveReal_Int [@inline:trivial] (_1: MutBorrow.t t_Fragment_Option_tup2_PositiveReal_Int) =
_1.final = _1.current
meta "rewrite_def" predicate resolve_refmut_Ghost_Fragment_Option_tup2_PositiveReal_Int
predicate resolve_refmut_Fragment_Option_tup2_PositiveReal_Int [@inline:trivial] (_1: MutBorrow.t t_Fragment_Option_tup2_PositiveReal_Int) =
_1.final = _1.current
meta "rewrite_def" predicate resolve_refmut_Fragment_Option_tup2_PositiveReal_Int
predicate resolve_refmut_Authority_Option_tup2_PositiveReal_Int [@inline:trivial] (_1: MutBorrow.t t_Authority_Option_tup2_PositiveReal_Int) =
_1.final = _1.current
meta "rewrite_def" predicate resolve_refmut_Authority_Option_tup2_PositiveReal_Int
let rec new_unit (x: ()) (return (x'0: ())) = any
[ return (result: ()) -> {[@stop_split] [@expl:new ensures] result = x} (! return {result}) ]
let rec into_inner_Box_Perm_AtomicI32_Global (self: t_Perm_AtomicI32) (return (x: t_Perm_AtomicI32)) = any
[ return (result: t_Perm_AtomicI32) -> {[@stop_split] [@expl:into_inner ensures] result = self}
(! return {result}) ]
let rec into_inner_Authority_Option_tup2_PositiveReal_Int (self: t_Authority_Option_tup2_PositiveReal_Int)
(return (x: t_Authority_Option_tup2_PositiveReal_Int)) =
{[@stop_split] [@expl:into_inner 'self' type invariant] inv_Ghost_Authority_Option_tup2_PositiveReal_Int self}
any
[ return (result: t_Authority_Option_tup2_PositiveReal_Int) ->
{[@stop_split] [@expl:into_inner_Authority_Option_tup2_PositiveReal_Int ensures] ([@stop_split] [@expl:into_inner result type invariant] inv_Authority_Option_tup2_PositiveReal_Int result)
/\ ([@stop_split] [@expl:into_inner ensures] result = self)}
(! return {result}) ]
type t_ParallelAddAtomicInv = { own: t_Perm_AtomicI32; auth: t_Authority_Option_tup2_PositiveReal_Int }
predicate inv_ParallelAddAtomicInv (_1: t_ParallelAddAtomicInv)
axiom inv_axiom'0 [@rewrite]:
forall x: t_ParallelAddAtomicInv [inv_ParallelAddAtomicInv x]. inv_ParallelAddAtomicInv x
= inv_Authority_Option_tup2_PositiveReal_Int x.auth
predicate invariant_Ghost_ParallelAddAtomicInv [@inline:trivial] (self: t_ParallelAddAtomicInv) =
inv_ParallelAddAtomicInv self
meta "rewrite_def" predicate invariant_Ghost_ParallelAddAtomicInv
predicate inv_Ghost_ParallelAddAtomicInv [@inline:trivial] (_1: t_ParallelAddAtomicInv) =
invariant_Ghost_ParallelAddAtomicInv _1
meta "rewrite_def" predicate inv_Ghost_ParallelAddAtomicInv
let rec new_ParallelAddAtomicInv (x: t_ParallelAddAtomicInv) (return (x'0: t_ParallelAddAtomicInv)) =
{[@stop_split] [@expl:new 'x' type invariant] inv_ParallelAddAtomicInv x}
any
[ return (result: t_ParallelAddAtomicInv) ->
{[@stop_split] [@expl:new_ParallelAddAtomicInv ensures] ([@stop_split] [@expl:new result type invariant] inv_Ghost_ParallelAddAtomicInv result)
/\ ([@stop_split] [@expl:new ensures] result = x)}
(! return {result}) ]
type tup2_AtomicI32_Id = { f0'6: t_AtomicI32; f1'6: t_Id }
type t_AtomicInvariantSC_ParallelAddAtomicInv
predicate protocol_ParallelAddAtomicInv [@inline:trivial] (self: t_ParallelAddAtomicInv) (data: tup2_AtomicI32_Id) =
data = { f0'6 = ward_AtomicI32 self.own; f1'6 = id_Option_tup2_PositiveReal_Int self.auth }
/\ (exists k: int. view_Authority_Option_tup2_PositiveReal_Int self.auth
= Some { f0'1 = from_int 1; f1'1 = k * Pow2int.pow2 32 + Int32.to_int (val_AtomicI32 self.own) })
meta "rewrite_def" predicate protocol_ParallelAddAtomicInv
function public_ParallelAddAtomicInv (self: t_AtomicInvariantSC_ParallelAddAtomicInv) : tup2_AtomicI32_Id
function namespace_ParallelAddAtomicInv (self: t_AtomicInvariantSC_ParallelAddAtomicInv) : t_Namespace
let rec new_ParallelAddAtomicInv'0 (value: t_ParallelAddAtomicInv) (public: tup2_AtomicI32_Id)
(namespace: t_Namespace) (return (x: t_AtomicInvariantSC_ParallelAddAtomicInv)) =
{[@stop_split] [@expl:new_ParallelAddAtomicInv requires] ([@stop_split] [@expl:new 'value' type invariant] inv_Ghost_ParallelAddAtomicInv value)
/\ ([@stop_split] [@expl:new requires] protocol_ParallelAddAtomicInv value public)}
any
[ return (result: t_AtomicInvariantSC_ParallelAddAtomicInv) ->
{[@stop_split] [@expl:new_ParallelAddAtomicInv ensures] ([@stop_split] [@expl:new ensures #0] public_ParallelAddAtomicInv result
= public)
/\ ([@stop_split] [@expl:new ensures #1] namespace_ParallelAddAtomicInv result = namespace)}
(! return {result}) ]
type closure0 = {
c0: t_AtomicInvariantSC_ParallelAddAtomicInv;
c1: t_AtomicI32;
c2: Int32.t;
c3: MutBorrow.t t_Fragment_Option_tup2_PositiveReal_Int }
let rec borrow_AtomicInvariantSC_ParallelAddAtomicInv (self: t_AtomicInvariantSC_ParallelAddAtomicInv)
(return (x: t_AtomicInvariantSC_ParallelAddAtomicInv)) = any
[ return (result: t_AtomicInvariantSC_ParallelAddAtomicInv) -> {[@stop_split] [@expl:borrow ensures] result = self}
(! return {result}) ]
type t_Vec_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int_Global
type t_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int
predicate inv_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int (_1: t_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int)
predicate invariant_ref_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int [@inline:trivial] (self: t_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int) =
inv_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int self
meta "rewrite_def" predicate invariant_ref_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int
predicate inv_ref_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int [@inline:trivial] (_1: t_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int) =
invariant_ref_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int _1
meta "rewrite_def" predicate inv_ref_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int
predicate invariant_Seq_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int [@inline:trivial] (self: Seq.seq t_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int) =
forall i: int. 0 <= i /\ i < Seq.length self
-> inv_ref_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int (Seq.get self i)
meta "rewrite_def" predicate invariant_Seq_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int
predicate inv_Seq_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int [@inline:trivial] (_1: Seq.seq t_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int) =
invariant_Seq_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int _1
meta "rewrite_def" predicate inv_Seq_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int
constant const_MAX: UInt64.t = (18446744073709551615: UInt64.t)
function view_Vec_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int_Global (self: t_Vec_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int_Global) : Seq.seq t_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int
axiom view_Vec_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int_Global_spec:
forall self: t_Vec_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int_Global. Seq.length (view_Vec_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int_Global self)
<= UInt64.t'int const_MAX
predicate invariant_Vec_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int_Global (self: t_Vec_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int_Global) =
inv_Seq_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int (view_Vec_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int_Global self)
predicate inv_Vec_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int_Global (_1: t_Vec_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int_Global)
axiom inv_axiom'1:
forall x: t_Vec_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int_Global [inv_Vec_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int_Global x]. inv_Vec_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int_Global x
-> invariant_Vec_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int_Global x
let rec new_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int
(return (x: t_Vec_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int_Global)) = any
[ return (result: t_Vec_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int_Global) ->
{[@stop_split] [@expl:new_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int ensures] ([@stop_split] [@expl:new result type invariant] inv_Vec_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int_Global result)
/\ ([@stop_split] [@expl:new ensures] Seq.length (view_Vec_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int_Global result)
= 0)}
(! return {result}) ]
type t_Range_i32 = { start: Int32.t; end': Int32.t }
let rec into_iter_Range_i32 (self_: t_Range_i32) (return (x: t_Range_i32)) = any
[ return (result: t_Range_i32) -> {[@stop_split] [@expl:into_iter ensures] result = self_} (! return {result}) ]
type t_Option_i32 = None'4 | Some'4 Int32.t
function deep_model_i32 [@inline:trivial] (self: Int32.t) : int = Int32.to_int self
meta "rewrite_def" function deep_model_i32
predicate produces_Range_i32 (self: t_Range_i32) (visited: Seq.seq Int32.t) (o: t_Range_i32) =
self.end' = o.end'
/\ deep_model_i32 self.start <= deep_model_i32 o.start
/\ (Seq.length visited > 0 -> deep_model_i32 o.start <= deep_model_i32 o.end')
/\ Seq.length visited = deep_model_i32 o.start - deep_model_i32 self.start
/\ (forall i: int. 0 <= i /\ i < Seq.length visited
-> deep_model_i32 (Seq.get visited i) = deep_model_i32 self.start + i)
function produces_trans_Range_i32 (a: t_Range_i32) (ab: Seq.seq Int32.t) (b: t_Range_i32) (bc: Seq.seq Int32.t) (c: t_Range_i32) : ()
axiom produces_trans_Range_i32_spec:
forall a: t_Range_i32, ab: Seq.seq Int32.t, b: t_Range_i32, bc: Seq.seq Int32.t, c: t_Range_i32. produces_Range_i32 a ab b
-> produces_Range_i32 b bc c -> produces_Range_i32 a (Seq.(++) ab bc) c
function produces_refl_Range_i32 (self: t_Range_i32) : ()
axiom produces_refl_Range_i32_spec:
forall self: t_Range_i32. produces_Range_i32 self (Seq.empty: Seq.seq Int32.t) self
predicate resolve_refmut_Range_i32 [@inline:trivial] (_1: MutBorrow.t t_Range_i32) = _1.final = _1.current
meta "rewrite_def" predicate resolve_refmut_Range_i32
predicate completed_Range_i32 (self: MutBorrow.t t_Range_i32) =
resolve_refmut_Range_i32 self /\ deep_model_i32 self.current.start >= deep_model_i32 self.current.end'
let rec next_Range_i32 (self_: MutBorrow.t t_Range_i32) (return (x: t_Option_i32)) = any
[ return (result: t_Option_i32) -> {[@stop_split] [@expl:next ensures] match result with
| None'4 -> completed_Range_i32 self_
| Some'4 v -> produces_Range_i32 self_.current (Seq.singleton v) self_.final
end}
(! return {result}) ]
predicate valid_result_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int (self: t_ScopedJoinHandle_Ghost_Fragment_Option_tup2_PositiveReal_Int) (_x: t_Fragment_Option_tup2_PositiveReal_Int)
predicate inv_Seq_i32 [@inline:trivial] (_1: Seq.seq Int32.t) = true
meta "rewrite_def" predicate inv_Seq_i32
predicate invariant_ref_AtomicI32 [@inline:trivial] (self: t_AtomicI32) = inv_AtomicI32 self
meta "rewrite_def" predicate invariant_ref_AtomicI32
predicate inv_ref_AtomicI32 [@inline:trivial] (_1: t_AtomicI32) = invariant_ref_AtomicI32 _1
meta "rewrite_def" predicate inv_ref_AtomicI32
predicate inv_closure0 [@inline:trivial] (_1: closure0) =
let {c0 = x0; c1 = x1; c2 = x2; c3 = x3} = _1 in inv_ref_AtomicI32 x1
meta "rewrite_def" predicate inv_closure0
type t_Scope
predicate inv_Scope (_1: t_Scope)
predicate invariant_refmut_Scope [@inline:trivial] (self: MutBorrow.t t_Scope) =
inv_Scope self.current /\ inv_Scope self.final
meta "rewrite_def" predicate invariant_refmut_Scope
predicate inv_refmut_Scope [@inline:trivial] (_1: MutBorrow.t t_Scope) = invariant_refmut_Scope _1
meta "rewrite_def" predicate inv_refmut_Scope
let rec elim_Some (_x: t_Option_i32) (return (f0'7: Int32.t)) = any
[ _k (f0'7: Int32.t) -> {Some'4 f0'7 = _x} (! return {f0'7})
| _chk -> (! {[@expl:elim Some] match _x with
| Some'4 _ -> true
| _ -> false
end}
any) ]
predicate ext_eq (self: t_PositiveReal) (other: t_PositiveReal) = to_real self = to_real other
axiom ext_eq_spec: forall self: t_PositiveReal, other: t_PositiveReal. ext_eq self other = (self = other)
predicate eq_PositiveReal [@inline:trivial] (self: t_PositiveReal) (other: t_PositiveReal) = ext_eq self other
meta "rewrite_def" predicate eq_PositiveReal
axiom eq_PositiveReal_spec: forall self: t_PositiveReal, other: t_PositiveReal. eq_PositiveReal self other
= (self = other)
predicate incl_Int (self: int) (other: int) = factor_Int other self <> None'2
function incl_transitive_Int (a: int) (b: int) (c: int) : ()
axiom incl_transitive_Int_spec: forall a: int, b: int, c: int. incl_Int a b -> incl_Int b c -> incl_Int a c
function associative_some_Int (a: int) (b: int) (c: int) (ab: int) (bc: int) : ()
axiom associative_some_Int_spec: forall a: int, b: int, c: int, ab: int, bc: int. op_Int a b = Some'2 ab
-> op_Int b c = Some'2 bc -> op_Int a bc = op_Int ab c
function associative_none_Int (a: int) (b: int) (c: int) (bc: int) : ()
axiom associative_none_Int_spec: forall a: int, b: int, c: int, bc: int. op_Int a b = None'2
-> op_Int b c = Some'2 bc -> op_Int a bc = None'2
function incl_op_Int (self: int) (other: int) (comb: int) : ()
axiom incl_op_Int_spec: forall self: int, other: int, comb: int. op_Int self other = Some'2 comb -> incl_Int self comb
predicate eq_Int [@inline:trivial] (self: int) (other: int) = self = other
meta "rewrite_def" predicate eq_Int
axiom eq_Int_spec: forall self: int, other: int. eq_Int self other = (self = other)
predicate eq_tup2_PositiveReal_Int [@inline:trivial] (self: tup2_PositiveReal_Int) (other: tup2_PositiveReal_Int) =
eq_PositiveReal self.f0'1 other.f0'1 /\ eq_Int self.f1'1 other.f1'1
meta "rewrite_def" predicate eq_tup2_PositiveReal_Int
axiom eq_tup2_PositiveReal_Int_spec:
forall self: tup2_PositiveReal_Int, other: tup2_PositiveReal_Int. eq_tup2_PositiveReal_Int self other
= (self = other)
predicate eq_Option_tup2_PositiveReal_Int [@inline:trivial] (self: t_Option_tup2_PositiveReal_Int) (other: t_Option_tup2_PositiveReal_Int) =
match { f0'2 = self; f1'2 = other } with
| {f0'2 = Some s; f1'2 = Some o} -> eq_tup2_PositiveReal_Int s o
| {f0'2 = None; f1'2 = None} -> true
| _ -> false
end
meta "rewrite_def" predicate eq_Option_tup2_PositiveReal_Int
axiom eq_Option_tup2_PositiveReal_Int_spec:
forall self: t_Option_tup2_PositiveReal_Int, other: t_Option_tup2_PositiveReal_Int. eq_Option_tup2_PositiveReal_Int self other
= (self = other)
predicate incl_eq_Option_tup2_PositiveReal_Int (self: t_Option_tup2_PositiveReal_Int) (other: t_Option_tup2_PositiveReal_Int) =
eq_Option_tup2_PositiveReal_Int self other \/ incl_Option_tup2_PositiveReal_Int self other
predicate incl_eq_op_Option_tup2_PositiveReal_Int (a: t_Option_tup2_PositiveReal_Int) (b: t_Option_tup2_PositiveReal_Int) (x: t_Option_tup2_PositiveReal_Int) =
match op_Option_tup2_PositiveReal_Int a b with
| None'0 -> false
| Some'0 ab -> incl_eq_Option_tup2_PositiveReal_Int ab x
end
let rec split_off_Option_tup2_PositiveReal_Int (self: MutBorrow.t t_Fragment_Option_tup2_PositiveReal_Int)
(r: t_Option_tup2_PositiveReal_Int) (s: t_Option_tup2_PositiveReal_Int)
(return (x: t_Fragment_Option_tup2_PositiveReal_Int)) =
{[@stop_split] [@expl:split_off requires] incl_eq_op_Option_tup2_PositiveReal_Int r s (view_Fragment_Option_tup2_PositiveReal_Int self.current)}
any
[ return (result: t_Fragment_Option_tup2_PositiveReal_Int) ->
{[@stop_split] [@expl:split_off_Option_tup2_PositiveReal_Int ensures] ([@stop_split] [@expl:split_off ensures #0] id_Option_tup2_PositiveReal_Int'0 self.final
= id_Option_tup2_PositiveReal_Int'0 self.current
/\ id_Option_tup2_PositiveReal_Int'0 result = id_Option_tup2_PositiveReal_Int'0 self.current)
/\ ([@stop_split] [@expl:split_off ensures #1] view_Fragment_Option_tup2_PositiveReal_Int self.final = s)
/\ ([@stop_split] [@expl:split_off ensures #2] view_Fragment_Option_tup2_PositiveReal_Int result = r)}
(! return {result}) ]
type closure0'0 = {
c0'0: t_AtomicI32;
c1'0: t_AtomicInvariantSC_ParallelAddAtomicInv;
c2'0: t_Fragment_Option_tup2_PositiveReal_Int }
type t_Tokens
type closure0'1 = {