interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / seed / qualification / security673 / game / evidence / native-v3 / check0.attempt1.om

887 lines · 13954 bytes Raw Blame History
1note SC1-G transport only. No transition or invariant code is shared.
2global wire uchar 4096
3global pos ulong 1
4global avail ulong 1
5global digits uchar 32
6global samples ulong 101
7text nl "\n"
8text sp " "
9text tags "construct_ns=\nsolve_ns=\ncheck_ns=\nstates=\nedges=\nwinning=\nrounds=\narray_bytes=\nPASS SC1-G-v3 finite model only\nFAIL QUANTIFIER_CLOSURE\nFAIL OMITTED_DISTURBANCE_CLOSURE\nFAIL FRESHNESS_AT_RENAME\nFAIL UNCERTAIN_REFUND\nFAIL SELECTED_NOT_SAFE\nFAIL EARLY_STOP_CLOSURE\nFAIL CERTIFICATE\nPASS certified serial witnesses empty-set costs\nFAIL PAIRED_PRODUCT\ndistinct_hidden_states=\ndistinct_hidden_edges=\nsample_ns=\np50_ns=\np95_ns=\np99_ns=\nidentical_zero_states=\nidentical_zero_edges=\nWITNESS source action disturbance raw effective\nFAIL TRANSITION_CONFORMANCE\nFAIL CLOSURE\nFAIL SOURCE_INVARIANT\nFAIL DISABLED_ACTION\nFAIL EXACTNESS\nFAIL SELECTION_COST\n"
10fn label id uint to void
11p = ulong 0
12n = uint 0
13for j ulong len tags
14if eq get tags j 10
15if eq n id
16r = write 2 tags p add sub j p 1
17if ne r long add sub j p 1
18exit 90
19end
20ret
21end
22n = add n 1
23p = add j 1
24end
25end
26exit 90
27end
28fn number n ulong to void
29p = ulong 0
30while ge n 10 bound 32
31put digits p uchar add rem n 10 48
32n = div n 10
33p = add p 1
34end
35put digits p uchar add n 48
36p = add p 1
37for j ulong p
38r = write 2 digits sub sub p j 1 1
39if ne r 1
40exit 90
41end
42end
43r = write 2 nl 0 1
44if ne r 1
45exit 90
46end
47end
48fn mode to uint
49if eq argcnt 1
50ret 0
51end
52if ne argcnt 2
53exit 90
54end
55if ne argread 1 wire 0 1 1
56exit 90
57end
58m = get wire 0
59if or lt m 48 gt m 56
60exit 90
61end
62ret sub uint m 48
63end
64fn flush to void
65n = get pos 0
66if ne write 1 wire 0 n long n
67exit 90
68end
69put pos 0 0
70end
71fn sendword x uint to void
72for i ulong 4
73p = get pos 0
74put wire p uchar and shr x mul uint i 8 255
75put pos 0 add p 1
76if eq get pos 0 4096
77flush
78end
79end
80end
81fn recvword to uint
82x = uint 0
83for i ulong 4
84if eq get pos 0 get avail 0
85n = read 0 wire 0 len wire
86if le n 0
87exit 90
88end
89put avail 0 ulong n
90put pos 0 0
91end
92p = get pos 0
93x = or x shl uint get wire p mul uint i 8
94put pos 0 add p 1
95end
96ret x
97end
98fn endinput to void
99if ne get pos 0 get avail 0
100exit 90
101end
102if ne read 0 wire 0 len wire 0
103exit 90
104end
105end
106fn percentiles to void
107for i ulong 101
108label 20
109number get samples i
110end
111for i ulong 101
112for j ulong 100
113if gt get samples j get samples add j 1
114t = get samples j
115put samples j get samples add j 1
116put samples add j 1 t
117end
118end
119end
120label 21
121number get samples 50
122label 22
123number get samples 95
124label 23
125number get samples 99
126end
127note SC1-G-v3 source-fixed experiment 0; no runtime fault selector.
128fn fault to uint
129ret 0
130end
131note SC1-G-v3 frozen fixture IDs, compiled into the checker and used by witnesses.
132note 0 initial,1 losing,2 early,3 stale,4 uncertain,5 eager,6 serialized,7 final,8 BAD.
133fn fixture id uint to uint
134if eq id 0
135ret 0
136end
137if eq id 1
138ret 15
139end
140if eq id 2
141ret 16
142end
143if eq id 3
144ret 331
145end
146if eq id 4
147ret 11
148end
149if eq id 5
150ret 20
151end
152if eq id 6
153ret 32
154end
155if eq id 7
156ret 266
157end
158if eq id 8
159ret 2592
160end
161exit 90
162end
163note Independent SC1-G-v3 enumerator and rename safety monitor.
164note Reverse-order in-place losing attractor, versus synchronous solver bitmaps.
165global fields uint 5
166global costs uint 18
167global rules uint 18
168global submit uint 2593
169global chosen uint 2593
170global alive uchar 2593
171global counts ulong 3
172global pairs ulong 4
173global variant uint 1
174global claim uint 1
175fn refuse id uint to void
176if eq id 8
177label 17
178exit 78
179end
180label add id 8
181exit add int id 70
182end
183fn witness s uint u uint d uint raw uint effect uint to void
184label 26
185number ulong s
186number ulong u
187number ulong d
188number ulong raw
189number ulong effect
190end
191fn unpack s uint to void
192put fields 0 rem s 18
193put fields 1 rem div s 18 18
194put fields 2 and div s 324 1
195put fields 3 and div s 648 1
196put fields 4 div s 1296
197end
198fn pack to uint
199n = get fields 4
200n = add mul n 2 get fields 3
201n = add mul n 2 get fields 2
202n = add mul n 18 get fields 1
203ret add mul n 18 get fields 0
204end
205fn localok s uint to bool
206if eq s 2592
207ret false
208end
209x = rem s 18
210y = rem div s 18 18
211if or eq x 17 eq y 17
212ret false
213end
214if gt add get costs x get costs y 3
215ret false
216end
217if ne rem div s 324 4 0
218if and ge x 15 le x 16
219ret false
220end
221if and ge y 15 le y 16
222ret false
223end
224end
225ret true
226end
227fn actions s uint to uint
228if not localok s
229ret 0
230end
231if ge s 1296
232ret 2
233end
234x = rem s 18
235y = rem div s 18 18
236m = shl get rules x 2
237m = or m shl get rules y 10
238if gt add get costs x get costs y 1
239m = and m not uint 1028
240end
241if ne rem div s 324 4 0
242m = and m not uint 131584
243end
244if and or eq x 0 eq x 14 or eq y 0 eq y 14
245m = or m 1
246end
247ret m
248end
249fn init to void
250for p uint 18
251put costs p 2
252end
253put costs 0 0
254put costs 1 0
255put costs 12 1
256put costs 13 1
257put costs 14 1
258put rules 1 3
259put rules 2 6
260for p uint 4
261put rules add p 3 138
262put rules add p 7 18
263end
264put rules 11 32
265put rules 12 64
266put rules 13 64
267put rules 15 48
268put rules 16 128
269for s uint 2593
270put alive s 0
271if localok s
272put alive s 1
273end
274end
275end
276fn disturb d uint to void
277if eq d 4
278put fields 3 1
279end
280if eq d 3
281put fields 2 1
282end
283if eq d 2
284if eq get fields 1 0
285put fields 1 1
286end
287end
288if eq d 1
289if eq get fields 0 0
290put fields 0 1
291end
292end
293end
294fn special c uint k uint d uint to uint
295p = get fields c
296if or eq d 7 and eq p 15 eq d 6
297ret pack
298end
299if eq d 5
300put fields c 0
301put fields 4 1
302ret pack
303end
304if or eq d 3 eq d 4
305if eq p 15
306if eq add k d 8
307ret 2592
308end
309end
310put fields c 0
311disturb d
312ret pack
313end
314if eq p 16
315put fields c 15
316else
317put fields c 14
318end
319disturb d
320ret pack
321end
322fn reconc to uint
323for c uint 2
324p = get fields c
325if ge p 15
326ret 2592
327end
328if and ge p 2 lt p 11
329put fields c 0
330end
331if eq p 11
332put fields c 12
333end
334end
335put fields 4 0
336ret pack
337end
338fn enact c uint k uint d uint to uint
339p = get fields c
340q = p
341if eq k 7
342if eq add get fields 2 get fields 3 0
343q = 16
344end
345end
346if eq k 6
347q = 14
348if eq d 8
349q = 13
350end
351end
352if eq k 5
353if ne d 6
354q = 12
355if eq d 8
356q = 13
357end
358end
359end
360if eq k 4
361t = add get fields 2 mul get fields 3 2
362if eq sub p 7 t
363q = 11
364end
365end
366if eq k 3
367if ne d 6
368q = add p 4
369end
370end
371if eq k 2
372q = add uint 3 add get fields 2 mul get fields 3 2
373end
374if eq k 1
375q = 0
376end
377if eq k 0
378q = 2
379end
380put fields c q
381ret pack
382end
383fn oracle s uint u uint d uint to uint
384if eq and actions s shl uint 1 u 0
385ret 2592
386end
387unpack s
388if ge u 2
389c = uint 0
390if ge u 10
391c = 1
392end
393p = get fields c
394if and ge p 15 le p 16
395ret special c rem sub u 2 8 d
396end
397end
398if eq d 7
399ret s
400end
401if eq d 5
402put fields 4 1
403ret pack
404end
405disturb d
406if eq u 1
407ret reconc
408end
409if eq u 0
410ret pack
411end
412ret enact div sub u 2 8 rem sub u 2 8 d
413end
414fn clientphase s uint c uint to uint
415if eq c 1
416s = div s 18
417end
418ret rem s 18
419end
420fn monitor s uint u uint d uint got uint to uint
421if or lt u 2 ge got 2592
422ret 0
423end
424c = div sub u 2 8
425p = clientphase s c
426q = clientphase got c
427if and eq p 11 eq q 17
428ret 4
429end
430if ne rem sub u 2 8 4
431ret 0
432end
433if or lt p 7 gt p 10
434ret 0
435end
436if ne q 11
437ret 0
438end
439e = and div s 324 1
440v = and div s 648 1
441if eq d 3
442e = 1
443end
444if eq d 4
445v = 1
446end
447if ne sub p 7 add e mul v 2
448ret 3
449end
450ret 0
451end
452fn readstate s uint to void
453m = recvword
454if ne m actions s
455refuse 7
456end
457put submit s recvword
458put chosen s recvword
459for u uint 18
460if ne and m shl uint 1 u 0
461for d uint 9
462got = recvword
463if ge got 2593
464refuse 7
465end
466bad = monitor s u d got
467if ne bad 0
468witness s u d got 2592
469refuse bad
470end
471want = oracle s u d
472put counts 0 add get counts 0 1
473if ne got want
474witness s u d got want
475label 27
476exit 79
477end
478end
479end
480end
481end
482fn allwithin s uint u uint nd uint to bool
483if or eq nd 0 gt nd 9
484ret false
485end
486if eq and actions s shl uint 1 u 0
487ret false
488end
489d = nd
490while gt d 0 bound 9
491d = sub d 1
492y = oracle s u d
493if eq get alive y 0
494ret false
495end
496end
497ret true
498end
499fn allsafe s uint u uint to bool
500ret allwithin s u 9
501end
502fn actionmask s uint to uint
503m = uint 0
504u = uint 18
505while gt u 0 bound 18
506u = sub u 1
507if allsafe s u
508m = or m shl uint 1 u
509end
510end
511ret m
512end
513fn attractor to void
514change = true
515while change bound 2594
516change = false
517put counts 1 add get counts 1 1
518s = uint 2593
519while gt s 0 bound 2593
520s = sub s 1
521if ne get alive s 0
522if eq actionmask s 0
523put alive s 0
524change = true
525end
526end
527end
528end
529end
530fn closurefail s uint u uint d uint y uint to void
531witness s u d y y
532label 28
533note Untrusted experiment label annotates an observed closure violation, not its inferred cause.
534v = get claim 0
535if or eq v 1 or eq v 2 eq v 6
536refuse v
537end
538exit 80
539end
540fn closeone s uint to void
541m = get submit s
542if eq m 0
543ret
544end
545if not localok s
546witness s 18 9 s s
547label 29
548exit 81
549end
550if ne and m not actions s 0
551witness s 18 9 m actions s
552label 30
553exit 82
554end
555for u uint 18
556if ne and m shl uint 1 u 0
557for d uint 9
558y = oracle s u d
559if eq get submit y 0
560closurefail s u d y
561end
562end
563end
564end
565end
566fn validate to void
567if eq get submit fixture 0 0
568refuse 7
569end
570for s uint 2593
571closeone s
572end
573for s uint 2593
574m = uint 0
575if ne get alive s 0
576m = actionmask s
577put counts 2 add get counts 2 1
578end
579if ne get submit s m
580witness s 18 9 get submit s m
581label 31
582exit 83
583end
584end
585end
586fn require b bool to void
587if not b
588refuse 7
589end
590end
591fn rank s uint identity uint to uint
592if ne identity 1
593ret 18
594end
595best = uint 18
596price = uint 99
597for u uint 18
598if ne and get submit s shl uint 1 u 0
599p = uint 2
600if lt u 2
601p = 1
602else
603k = rem sub u 2 8
604if eq k 7
605p = 0
606end
607if eq k 1
608p = 4
609end
610end
611if lt p price
612price = p
613best = u
614end
615end
616end
617ret best
618end
619fn selections to void
620for s uint 2593
621u = get chosen s
622if eq get submit s 0
623require eq u 18
624else
625if ge u 18
626witness s u 9 2592 2592
627refuse 5
628end
629if eq and get submit s shl uint 1 u 0
630witness s u 9 u get submit s
631refuse 5
632end
633if ne u rank s 1
634witness s u 9 u rank s 1
635label 32
636exit 84
637end
638if ge u 2
639require ne rem sub u 2 8 7
640end
641require eq rank s 0 18
642require eq rank s 2 18
643end
644end
645end
646fn serial s uint u uint d uint to uint
647require ne get submit s 0
648require ne and get submit s shl uint 1 u 0
649y = oracle s u d
650require ne get submit y 0
651ret y
652end
653fn observation secret uint protect bool to uint
654used = secret
655if protect
656used = 2
657end
658note Public envelope size2 within public capacity3 and fixed release identity1.
659ret add sub uint 3 used 16
660end
661fn witnesses to void
662require localok fixture 1
663require eq get alive fixture 1 0
664require eq get alive fixture 2 0
665require eq oracle fixture 1 6 4 fixture 8
666require eq oracle fixture 1 7 3 fixture 8
667require eq oracle fixture 3 6 0 fixture 3
668require eq oracle fixture 4 7 6 fixture 4
669require eq and actions fixture 5 shl uint 1 10 0
670require ne and actions fixture 6 shl uint 1 10 0
671note Every step uses the submitted safe certificate, not only the transition relation.
672s = serial fixture 0 0 1
673s = serial s 2 2
674require eq s fixture 5
675s = serial s 4 0
676s = serial s 5 0
677s = serial s 6 0
678s = serial s 7 0
679s = serial s 8 0
680require eq s fixture 6
681s = serial s 10 0
682s = serial s 12 0
683s = serial s 13 0
684s = serial s 14 0
685s = serial s 15 0
686s = serial s 16 0
687require eq s fixture 7
688require eq add get costs rem s 18 get costs rem div s 18 18 2
689require eq actions fixture 8 0
690require eq oracle fixture 8 0 0 fixture 8
691require eq oracle fixture 0 0 0 fixture 0
692require not allwithin 0 0 0
693require not allwithin 0 0 10
694require eq observation 1 true observation 2 true
695require ne observation 1 false observation 2 false
696label 16
697end
698fn envelope s uint to bool
699if ge s 2592
700ret false
701end
702ret or eq get costs rem s 18 2 eq get costs rem div s 18 18 2
703end
704fn hidden s uint h uint to bool
705if envelope s
706ret or eq h 1 eq h 2
707end
708ret eq h 0
709end
710fn pairmask s uint h uint to uint
711if not hidden s h
712refuse 8
713end
714m = actions s
715note Negative baseline incorrectly uses physical hidden occupancy instead of full reservation.
716if and eq get variant 0 8 eq h 1
717if eq rem s 18 1
718m = or m 4
719end
720if eq rem div s 18 18 1
721m = or m 1024
722end
723end
724ret m
725end
726fn pairnext s uint u uint d uint h uint to uint
727if not hidden s h
728refuse 8
729end
730note Actual game relation, independently compared to every submitted solver edge.
731ret oracle s u d
732end
733fn publicob s uint h uint to uint
734if not hidden s h
735refuse 8
736end
737if eq s 2592
738ret 2592
739end
740q = add get costs rem s 18 get costs rem div s 18 18
741if gt q 3
742ret 2592
743end
744note Available public capacity plus whole-service ready/recovery class.
745ret add sub uint 3 q mul div s 1296 4
746end
747fn newlabel s uint old uint to uint
748if envelope s
749if eq old 0
750ret 1
751end
752ret old
753end
754ret 0
755end
756fn pairselect s uint h uint to uint
757m = pairmask s h
758if ne and get submit s not m 0
759witness s 18 9 get submit s m
760refuse 8
761end
762ret get chosen s
763end
764fn pairrun s uint h1 uint h2 uint to void
765m = pairmask s h1
766if ne m pairmask s h2
767witness s 18 9 m pairmask s h2
768refuse 8
769end
770if ne pairselect s h1 pairselect s h2
771refuse 8
772end
773m = get submit s
774if ne publicob s h1 publicob s h2
775refuse 8
776end
777for u uint 18
778if ne and m shl uint 1 u 0
779for d uint 9
780x = pairnext s u d h1
781y = pairnext s u d h2
782if ne x y
783refuse 8
784end
785if eq get submit x 0
786refuse 8
787end
788if ne publicob x newlabel x h1 publicob y newlabel y h2
789refuse 8
790end
791if eq h1 h2
792put pairs 3 add get pairs 3 1
793else
794put pairs 1 add get pairs 1 1
795end
796end
797end
798end
799end
800fn product to void
801for s uint 2593
802if localok s
803if envelope s
804put pairs 0 add get pairs 0 1
805pairrun s 1 2
806else
807put pairs 2 add get pairs 2 1
808pairrun s 0 0
809end
810end
811end
812end
813fn checkonce to void
814for i ulong 3
815put counts i 0
816end
817for i ulong 4
818put pairs i 0
819end
820init
821if ne recvword 1396912455
822refuse 7
823end
824if ne recvword 3
825refuse 7
826end
827if ne recvword 2593
828refuse 7
829end
830put claim 0 recvword
831if gt get claim 0 6
832refuse 7
833end
834for s uint 2593
835readstate s
836end
837endinput
838attractor
839validate
840selections
841product
842end
843fn main to int
844m = mode
845if and ne m 0 ne m 7
846ret 90
847end
848put variant 0 fault
849start = monons
850checkonce
851label 2
852number ulong sub monons start
853witnesses
854label 3
855number 2593
856label 4
857number get counts 0
858label 5
859number get counts 2
860label 6
861number get counts 1
862label 7
863number 28517
864label 18
865number get pairs 0
866label 19
867number get pairs 1
868label 24
869number get pairs 2
870label 25
871number get pairs 3
872if eq m 7
873for i ulong 101
874if ne fseek 0 0 0 0
875ret 90
876end
877put pos 0 0
878put avail 0 0
879start = monons
880checkonce
881put samples i ulong sub monons start
882end
883percentiles
884end
885label 8
886ret 0
887end