Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/seed/helix/ollm_factory/strand4_attr.om # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / seed / helix / ollm_factory / strand4_attr.om` 775 lines ยท 12773 bytes Raw Blame History 1 om2 2 note SPDX-License-Identifier: Apache-2.0 3 note seed/helix/ollm_factory/strand4_attr.om: 4 note Pure seeded OM-2 4-Strand Fault Attribution Engine, Dual-View NUL-Delimited 5 note Trace Extractor, Minimum Batch-Floor Guard, Four-Wall RSI + BFT Quorum Promotion 6 note Gate, and Post-Cycle Scaling Decision Rule (Sections 4, 5, and 6). 7 8 global saInBuf uchar 65536 9 global saOutBuf uchar 131072 10 global saLine uchar 1024 11 global saTok uchar 128 12 global saTaskId uchar 128 13 global saFam uchar 128 14 global saPathA uchar 256 15 global saPathB uchar 256 16 global saComp ulong 4 17 global saPass ulong 4 18 global saHash ulong 4 19 global saErr ulong 4 20 global saOutPos ulong 1 21 global saStats ulong 8 22 global saPArg ulong 16 23 global saTmpA uchar 16384 24 global saTmpB uchar 16384 25 global saTmpC uchar 16384 26 27 text saModeAttr "attribute" 28 text saModeExtr "extract" 29 text saModeProm "promote" 30 text saModeDec "decide" 31 text saModeSelf "selfcheck" 32 33 text saClsUnan "UNANIMOUS_PASS" 34 text saClsGap "BUILDER_STRAND_GAP" 35 text saClsSyn "OM2_SYNTAX_GAP" 36 text saClsLogic "ARCHITECT_LOGIC_FLAW" 37 text saClsUnder "UNDERSPECIFIED_PLAN" 38 text saClsMixed "MIXED_COMPILE_FAIL" 39 40 text saActGold "HARVEST_GOLD_DUAL_VIEW" 41 text saActGap "HARVEST_GOLD_AND_ROUTE_S4_REPAIR" 42 text saActSyn "ROUTE_BEST_ERR_TO_S4_REPAIR" 43 text saActLogic "FLAG_DEFECTIVE_PLAN_REQUEUE_Q36" 44 text saActUnder "REQUEUE_Q36_STRICT_DECOMPOSE" 45 text saActMixed "ROUTE_FAIL_TO_S4_REPAIR" 46 47 text saHdrAttr "task_id\tfamily\tfault_class\taction\twinning_strand\tfailing_mask\tbest_err\n" 48 text saNotePfx "note " 49 text saPlanPfx "note ARCH_PLAN: " 50 text saNl "\n" 51 52 text saSumA "STRAND4_ATTR SUMMARY tasks=" 53 text saSumB " unanimous=" 54 text saSumC " builder_gap=" 55 text saSumD " syntax_gap=" 56 text saSumE " arch_logic=" 57 text saSumF " underspec=" 58 text saSumG " mixed=" 59 60 text saPrProm "FOUR_WALL_BFT strand=" 61 text saPrVerP " verdict=PROMOTE\n" 62 text saPrVerFl " verdict=SKIP_BELOW_BATCH_FLOOR\n" 63 text saPrVerW1 " verdict=WALL1_INTEGRITY_REJECT\n" 64 text saPrVerW2 " verdict=REJECT_OVERFIT_KEEP_P1\n" 65 text saPrVerW3 " verdict=WALL3_LEAKAGE_REJECT\n" 66 text saPrVerW4 " verdict=WALL4_QUARANTINE_STRAND\n" 67 68 text saDecCont "SCALING_RULE DECISION=CONTINUE_SCALING_STRANDS\n" 69 text saDecWide "SCALING_RULE DECISION=WIDEN_LOOPED_CORE\n" 70 71 text saExtrOk "DUAL_VIEW_EXTRACT PASS direct_bytes=" 72 text saExtrOk2 " align_bytes=" 73 74 text saSelfOk "STRAND4_ATTR SELFCHECK PASS fault_matrix=6/6 dual_view_nul=1 batch_floor=1 four_wall_bft=6/6 scaling_rule=2/2\n" 75 text saUsage "usage: strand4_attr \n" 76 77 fn saWrt1 s view uchar * to void 78 r = write 1 s 0 len s 79 end 80 81 fn saWrt2 s view uchar * to void 82 r = write 2 s 0 len s 83 end 84 85 fn saNum1 v ulong to void 86 b = new uchar 24 0 87 p = ulong 24 88 x = v 89 while true bound 24 90 p = sub p 1 91 put b p uchar add 48 rem x 10 92 x = div x 10 93 if eq x 0 94 break 95 end 96 end 97 r = write 1 b p sub 24 p 98 end 99 100 fn saEqBuf a view uchar * al ulong b view uchar * to bool 101 if ne al len b 102 ret false 103 end 104 for i ulong al bound 256 105 if ne get a i get b i 106 ret false 107 end 108 end 109 ret true 110 end 111 112 fn saParseUlong a view uchar * al ulong to ulong 113 v = ulong 0 114 for i ulong al bound 32 115 c = get a i 116 if and ge c 48 le c 57 117 v = add mul v 10 ulong sub c 48 118 end 119 end 120 ret v 121 end 122 123 fn saParseTok al ulong to ulong 124 v = ulong 0 125 for i ulong al bound 32 126 c = get saTok i 127 if and ge c 48 le c 57 128 v = add mul v 10 ulong sub c 48 129 end 130 end 131 ret v 132 end 133 134 fn saArgUlong idx ulong to ulong 135 b = new uchar 32 0 136 if le ulong argcnt idx 137 ret 0 138 end 139 lr = argread idx b 0 32 140 if le lr 0 141 ret 0 142 end 143 ret saParseUlong b ulong lr 144 end 145 146 fn saOutReset to void 147 put saOutPos 0 0 148 end 149 150 fn saOutByte c uchar to void 151 p = get saOutPos 0 152 if lt p 131070 153 put saOutBuf p c 154 put saOutPos 0 add p 1 155 end 156 end 157 158 fn saOutStr s view uchar * to void 159 for i ulong len s bound 512 160 saOutByte get s i 161 end 162 end 163 164 fn saOutFld which ulong n ulong to void 165 if eq which 0 166 for i ulong n bound 128 167 saOutByte get saTaskId i 168 end 169 ret 170 end 171 for i ulong n bound 128 172 saOutByte get saFam i 173 end 174 end 175 176 fn saOutNum v ulong to void 177 b = new uchar 24 0 178 p = ulong 24 179 x = v 180 while true bound 24 181 p = sub p 1 182 put b p uchar add 48 rem x 10 183 x = div x 10 184 if eq x 0 185 break 186 end 187 end 188 while lt p 24 bound 24 189 saOutByte get b p 190 p = add p 1 191 end 192 end 193 194 fn saReadInFile plen ulong to ulong 195 fd = fopen saPathA 0 plen 0 0 196 if lt fd 0 197 ret 0 198 end 199 tot = ulong 0 200 while lt tot 65536 bound 256 201 r = read int fd saInBuf tot sub 65536 tot 202 if le r 0 203 break 204 end 205 tot = add tot ulong r 206 end 207 z = fclose int fd 208 ret tot 209 end 210 211 fn saReadTmpFile which ulong plen ulong to ulong 212 fd = fopen saPathA 0 plen 0 0 213 if lt fd 0 214 ret 0 215 end 216 tot = ulong 0 217 while lt tot 16384 bound 256 218 r = long 0 219 if eq which 0 220 r = read int fd saTmpA tot sub 16384 tot 221 else 222 if eq which 1 223 r = read int fd saTmpB tot sub 16384 tot 224 else 225 r = read int fd saTmpC tot sub 16384 tot 226 end 227 end 228 if le r 0 229 break 230 end 231 tot = add tot ulong r 232 end 233 z = fclose int fd 234 ret tot 235 end 236 237 fn saWriteOutFile plen ulong to bool 238 fd = fopen saPathB 0 plen 577 420 239 if lt fd 0 240 ret false 241 end 242 n = get saOutPos 0 243 off = ulong 0 244 while lt off n bound 256 245 w = write int fd saOutBuf off sub n off 246 if le w 0 247 z = fclose int fd 248 ret false 249 end 250 off = add off ulong w 251 end 252 z = fclose int fd 253 ret true 254 end 255 256 fn saClassify4 to ulong 257 ccnt = ulong 0 258 pcnt = ulong 0 259 for s ulong 4 260 if ne get saComp s 0 261 ccnt = add ccnt 1 262 end 263 if ne get saPass s 0 264 pcnt = add pcnt 1 265 end 266 end 267 if eq pcnt 4 268 ret 0 269 end 270 if gt pcnt 0 271 ret 1 272 end 273 if eq ccnt 0 274 ret 2 275 end 276 if eq ccnt 4 277 h0 = get saHash 0 278 same = true 279 for s ulong 3 280 if ne get saHash add s 1 h0 281 same = false 282 end 283 end 284 if same 285 ret 3 286 end 287 ret 4 288 end 289 ret 5 290 end 291 292 fn saWinStrand to ulong 293 for s ulong 4 294 if ne get saPass s 0 295 ret add s 1 296 end 297 end 298 ret 0 299 end 300 301 fn saFailMask to ulong 302 m = ulong 0 303 for s ulong 4 304 if eq get saPass s 0 305 m = or m shl ulong 1 s 306 end 307 end 308 ret m 309 end 310 311 fn saBestErr to ulong 312 for s ulong 4 313 e = get saErr s 314 if ne e 0 315 ret e 316 end 317 end 318 ret 0 319 end 320 321 fn saSplitTabTo llen ulong k ulong which ulong to ulong 322 cur = ulong 0 323 p = ulong 0 324 for i ulong llen bound 1024 325 c = get saLine i 326 if eq c 9 327 cur = add cur 1 328 if gt cur k 329 break 330 end 331 else 332 if eq cur k 333 if lt p 128 334 if eq which 0 335 put saTaskId p c 336 else 337 if eq which 1 338 put saFam p c 339 else 340 put saTok p c 341 end 342 end 343 p = add p 1 344 end 345 end 346 end 347 end 348 ret p 349 end 350 351 fn saOutClass cls ulong to void 352 if eq cls 0 353 saOutStr saClsUnan 354 saOutByte 9 355 saOutStr saActGold 356 ret 357 end 358 if eq cls 1 359 saOutStr saClsGap 360 saOutByte 9 361 saOutStr saActGap 362 ret 363 end 364 if eq cls 2 365 saOutStr saClsSyn 366 saOutByte 9 367 saOutStr saActSyn 368 ret 369 end 370 if eq cls 3 371 saOutStr saClsLogic 372 saOutByte 9 373 saOutStr saActLogic 374 ret 375 end 376 if eq cls 4 377 saOutStr saClsUnder 378 saOutByte 9 379 saOutStr saActUnder 380 ret 381 end 382 saOutStr saClsMixed 383 saOutByte 9 384 saOutStr saActMixed 385 end 386 387 fn saRunAttribute inLen ulong outLen ulong to int 388 nbytes = saReadInFile inLen 389 if eq nbytes 0 390 ret 2 391 end 392 for i ulong 8 393 put saStats i 0 394 end 395 saOutReset 396 saOutStr saHdrAttr 397 pos = ulong 0 398 while lt pos nbytes bound 2048 399 llen = ulong 0 400 while lt pos nbytes bound 1024 401 c = get saInBuf pos 402 pos = add pos 1 403 if eq c 10 404 break 405 end 406 if and ne c 13 lt llen 1020 407 put saLine llen c 408 llen = add llen 1 409 end 410 end 411 if eq llen 0 412 continue 413 end 414 if eq get saLine 0 35 415 continue 416 end 417 tidLen = saSplitTabTo llen 0 0 418 famLen = saSplitTabTo llen 1 1 419 if or eq tidLen 0 eq famLen 0 420 continue 421 end 422 t2l = saSplitTabTo llen 2 2 423 if eq t2l 0 424 continue 425 end 426 c0 = get saTok 0 427 if or lt c0 48 gt c0 57 428 continue 429 end 430 for s ulong 4 431 base = add 2 mul s 4 432 tl = saSplitTabTo llen base 2 433 put saComp s saParseTok tl 434 tl = saSplitTabTo llen add base 1 2 435 put saPass s saParseTok tl 436 tl = saSplitTabTo llen add base 2 2 437 put saHash s saParseTok tl 438 tl = saSplitTabTo llen add base 3 2 439 put saErr s saParseTok tl 440 end 441 cls = saClassify4 442 put saStats 7 add get saStats 7 1 443 put saStats cls add get saStats cls 1 444 saOutFld 0 tidLen 445 saOutByte 9 446 saOutFld 1 famLen 447 saOutByte 9 448 saOutClass cls 449 saOutByte 9 450 saOutNum saWinStrand 451 saOutByte 9 452 saOutNum saFailMask 453 saOutByte 9 454 saOutNum saBestErr 455 saOutByte 10 456 end 457 if not saWriteOutFile outLen 458 ret 3 459 end 460 saWrt1 saSumA 461 saNum1 get saStats 7 462 saWrt1 saSumB 463 saNum1 get saStats 0 464 saWrt1 saSumC 465 saNum1 get saStats 1 466 saWrt1 saSumD 467 saNum1 get saStats 2 468 saWrt1 saSumE 469 saNum1 get saStats 3 470 saWrt1 saSumF 471 saNum1 get saStats 4 472 saWrt1 saSumG 473 saNum1 get saStats 5 474 saWrt1 saNl 475 ret 0 476 end 477 478 fn saRunExtract to int 479 if lt argcnt 7 480 ret 2 481 end 482 l1 = argread 2 saPathA 0 256 483 if le l1 0 484 ret 2 485 end 486 nOrig = saReadTmpFile 0 ulong l1 487 l2 = argread 3 saPathA 0 256 488 if le l2 0 489 ret 2 490 end 491 nPlan = saReadTmpFile 1 ulong l2 492 l3 = argread 4 saPathA 0 256 493 if le l3 0 494 ret 2 495 end 496 nCode = saReadTmpFile 2 ulong l3 497 if or eq nOrig 0 or eq nPlan 0 eq nCode 0 498 ret 3 499 end 500 l4 = argread 5 saPathB 0 256 501 if le l4 0 502 ret 2 503 end 504 saOutReset 505 saOutStr saNotePfx 506 for i ulong nOrig bound 16384 507 c = get saTmpA i 508 if and ne c 10 ne c 13 509 saOutByte c 510 end 511 end 512 saOutByte 10 513 for i ulong nCode bound 16384 514 saOutByte get saTmpC i 515 end 516 if ne get saTmpC sub nCode 1 10 517 saOutByte 10 518 end 519 saOutByte 0 520 dirBytes = get saOutPos 0 521 if not saWriteOutFile ulong l4 522 ret 4 523 end 524 l5 = argread 6 saPathB 0 256 525 if le l5 0 526 ret 2 527 end 528 saOutReset 529 saOutStr saPlanPfx 530 for i ulong nPlan bound 16384 531 c = get saTmpB i 532 if and ne c 10 ne c 13 533 saOutByte c 534 end 535 end 536 saOutByte 10 537 for i ulong nCode bound 16384 538 saOutByte get saTmpC i 539 end 540 if ne get saTmpC sub nCode 1 10 541 saOutByte 10 542 end 543 saOutByte 0 544 alnBytes = get saOutPos 0 545 if not saWriteOutFile ulong l5 546 ret 5 547 end 548 saWrt1 saExtrOk 549 saNum1 dirBytes 550 saWrt1 saExtrOk2 551 saNum1 alnBytes 552 saWrt1 saNl 553 ret 0 554 end 555 556 fn saEvalPromote traces ulong minFl ulong w1Ok ulong t60 ulong t61 ulong t62 ulong to ulong 557 if lt traces minFl 558 ret 10 559 end 560 if or eq w1Ok 0 or ne t60 60 or ne t61 61 ne t62 62 561 ret 11 562 end 563 ret 0 564 end 565 566 fn saEvalWalls234 baseH ulong candH ulong maxDr ulong seenD ulong baseP ulong candP ulong to ulong 567 if gt candH add baseH maxDr 568 ret 12 569 end 570 if ne seenD 0 571 ret 13 572 end 573 if lt candP baseP 574 ret 14 575 end 576 ret 0 577 end 578 579 fn saRunPromote to int 580 if lt argcnt 17 581 ret 2 582 end 583 for i ulong 15 584 put saPArg i saArgUlong add i 2 585 end 586 rc = saEvalPromote get saPArg 1 get saPArg 2 get saPArg 3 get saPArg 4 get saPArg 5 get saPArg 6 587 if eq rc 0 588 rc = saEvalWalls234 get saPArg 7 get saPArg 8 get saPArg 9 get saPArg 10 get saPArg 11 get saPArg 12 589 end 590 if and eq rc 0 or ne get saPArg 13 0 ne get saPArg 14 0 591 rc = 14 592 end 593 saWrt1 saPrProm 594 saNum1 get saPArg 0 595 if eq rc 0 596 saWrt1 saPrVerP 597 ret 0 598 end 599 if eq rc 10 600 saWrt1 saPrVerFl 601 ret 10 602 end 603 if eq rc 11 604 saWrt1 saPrVerW1 605 ret 11 606 end 607 if eq rc 12 608 saWrt1 saPrVerW2 609 ret 12 610 end 611 if eq rc 13 612 saWrt1 saPrVerW3 613 ret 13 614 end 615 saWrt1 saPrVerW4 616 ret 14 617 end 618 619 fn saEvalScaling c1P ulong c2P ulong baseP ulong c2H ulong baseH ulong k32FailPct ulong to ulong 620 if le c2P baseP 621 if or ge k32FailPct 80 gt c2H add baseH 150 622 ret 1 623 end 624 end 625 if and le c2P c1P gt c2H add baseH 150 626 ret 1 627 end 628 ret 0 629 end 630 631 fn saRunDecide to int 632 if lt argcnt 8 633 ret 2 634 end 635 c1P = saArgUlong 2 636 c2P = saArgUlong 3 637 baseP = saArgUlong 4 638 c2H = saArgUlong 5 639 baseH = saArgUlong 6 640 k32F = saArgUlong 7 641 d = saEvalScaling c1P c2P baseP c2H baseH k32F 642 if eq d 0 643 saWrt1 saDecCont 644 ret 0 645 end 646 saWrt1 saDecWide 647 ret 1 648 end 649 650 fn saSetStrand s ulong c ulong p ulong h ulong e ulong to void 651 put saComp s c 652 put saPass s p 653 put saHash s h 654 put saErr s e 655 end 656 657 fn saSelfCheck to int 658 for s ulong 4 659 saSetStrand s 1 1 777 0 660 end 661 if ne saClassify4 0 662 ret 20 663 end 664 saSetStrand 0 1 1 777 0 665 saSetStrand 1 1 0 111 0 666 saSetStrand 2 0 0 0 7 667 saSetStrand 3 1 1 777 0 668 if ne saClassify4 1 669 ret 21 670 end 671 if ne saWinStrand 1 672 ret 22 673 end 674 if ne saFailMask 6 675 ret 23 676 end 677 saSetStrand 0 0 0 0 7 678 saSetStrand 1 0 0 0 16 679 saSetStrand 2 0 0 0 12 680 saSetStrand 3 0 0 0 7 681 if ne saClassify4 2 682 ret 24 683 end 684 if ne saBestErr 7 685 ret 25 686 end 687 for s ulong 4 688 saSetStrand s 1 0 99999 0 689 end 690 if ne saClassify4 3 691 ret 26 692 end 693 saSetStrand 0 1 0 1001 0 694 saSetStrand 1 1 0 2002 0 695 saSetStrand 2 1 0 3003 0 696 saSetStrand 3 1 0 4004 0 697 if ne saClassify4 4 698 ret 27 699 end 700 saSetStrand 0 1 0 1001 0 701 saSetStrand 1 0 0 0 16 702 saSetStrand 2 1 0 2002 0 703 saSetStrand 3 0 0 0 7 704 if ne saClassify4 5 705 ret 28 706 end 707 if ne saEvalPromote 16 64 1 60 61 62 10 708 ret 29 709 end 710 if ne saEvalPromote 80 64 1 60 61 0 11 711 ret 30 712 end 713 if ne saEvalPromote 80 64 1 60 61 62 0 714 ret 31 715 end 716 if ne saEvalWalls234 3061 3206 150 0 6 8 0 717 ret 32 718 end 719 if ne saEvalWalls234 3206 4829 150 0 6 6 12 720 ret 33 721 end 722 if ne saEvalWalls234 3061 3128 150 1 6 9 13 723 ret 34 724 end 725 if ne saEvalWalls234 3061 3128 150 0 6 5 14 726 ret 35 727 end 728 if ne saEvalScaling 9 14 6 3140 3128 35 0 729 ret 36 730 end 731 if ne saEvalScaling 6 6 6 3310 3128 85 1 732 ret 37 733 end 734 saWrt1 saSelfOk 735 ret 0 736 end 737 738 fn main to int 739 a1 = new uchar 64 0 740 if lt argcnt 2 741 saWrt2 saUsage 742 ret 2 743 end 744 l1r = argread 1 a1 0 64 745 if le l1r 0 746 ret 2 747 end 748 l1 = ulong l1r 749 if saEqBuf a1 l1 saModeSelf 750 ret saSelfCheck 751 end 752 if saEqBuf a1 l1 saModeAttr 753 if lt argcnt 4 754 saWrt2 saUsage 755 ret 2 756 end 757 l2r = argread 2 saPathA 0 256 758 l3r = argread 3 saPathB 0 256 759 if or le l2r 0 le l3r 0 760 ret 2 761 end 762 ret saRunAttribute ulong l2r ulong l3r 763 end 764 if saEqBuf a1 l1 saModeExtr 765 ret saRunExtract 766 end 767 if saEqBuf a1 l1 saModeProm 768 ret saRunPromote 769 end 770 if saEqBuf a1 l1 saModeDec 771 ret saRunDecide 772 end 773 saWrt2 saUsage 774 ret 2 775 end