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