aien-train
AIEN training programme: language-model history, GB10 constraints and the route to training on the project engine. Plans and runnable checks are distinguished.
Brought by drakestapleton
aien-train / evidence / ECOSYSTEM5 / raw / compile4-combined.om
| 1 | note LEARN653 v1 consumer checks. No compiler, judge, signer or process supervisor. |
| 2 | note Task slots are 32 ulongs; see docs/learning/benchmark-v1.md. |
| 3 | global LT ulong 2048 |
| 4 | global LS ulong 24 |
| 5 | global LSeen ulong 64 |
| 6 | global LWon ulong 64 |
| 7 | global LPin ulong 16 |
| 8 | global LWant uchar 256 |
| 9 | global LGot uchar 256 |
| 10 | |
| 11 | fn lequal a ulong b ulong n ulong to bool |
| 12 | for k ulong n |
| 13 | if ne get LT add a k get LT add b k |
| 14 | ret false |
| 15 | end |
| 16 | end |
| 17 | ret true |
| 18 | end |
| 19 | |
| 20 | fn lnonzero a ulong to bool |
| 21 | x = ulong 0 |
| 22 | for k ulong 4 |
| 23 | x = or x get LT add a k |
| 24 | end |
| 25 | ret ne x 0 |
| 26 | end |
| 27 | |
| 28 | fn lrecord a ulong to ulong |
| 29 | split = get LT add a 1 |
| 30 | if or eq get LT a 0 or lt split 1 gt split 4 |
| 31 | ret 2 |
| 32 | end |
| 33 | if or ne get LT add a 5 1 ne get LT add a 4 1 |
| 34 | ret 3 |
| 35 | end |
| 36 | if eq get LT add a 3 0 |
| 37 | ret 4 |
| 38 | end |
| 39 | if eq get LT add a 6 0 |
| 40 | ret 4 |
| 41 | end |
| 42 | if eq get LT add a 7 0 |
| 43 | ret 4 |
| 44 | end |
| 45 | note Only public train/dev records are admissible to this builder-side API. |
| 46 | note Adaptive/final custody stays with the existing independent owner. |
| 47 | if or gt split 2 ne get LT add a 2 1 |
| 48 | ret 5 |
| 49 | end |
| 50 | for h ulong 5 |
| 51 | if eq lnonzero add a add 8 mul h 4 false |
| 52 | ret 6 |
| 53 | end |
| 54 | end |
| 55 | if or eq get LT add a 28 0 gt get LT add a 28 256 |
| 56 | ret 7 |
| 57 | end |
| 58 | if or eq get LT add a 29 0 gt get LT add a 29 256 |
| 59 | ret 7 |
| 60 | end |
| 61 | if or eq get LT add a 30 0 gt get LT add a 30 1000000 |
| 62 | ret 7 |
| 63 | end |
| 64 | if ne get LT add a 31 0 |
| 65 | ret 7 |
| 66 | end |
| 67 | ret 0 |
| 68 | end |
| 69 | |
| 70 | fn lpair a ulong b ulong to ulong |
| 71 | if eq get LT a get LT b |
| 72 | ret 8 |
| 73 | end |
| 74 | if lequal add a 8 add b 8 4 |
| 75 | ret 9 |
| 76 | end |
| 77 | if lequal add a 12 add b 12 4 |
| 78 | ret 10 |
| 79 | end |
| 80 | if ne get LT add a 1 get LT add b 1 |
| 81 | if eq get LT add a 3 get LT add b 3 |
| 82 | ret 15 |
| 83 | end |
| 84 | if eq get LT add a 7 get LT add b 7 |
| 85 | ret 11 |
| 86 | end |
| 87 | if lequal add a 16 add b 16 4 |
| 88 | ret 12 |
| 89 | end |
| 90 | if lequal add a 20 add b 20 4 |
| 91 | ret 13 |
| 92 | end |
| 93 | if lequal add a 24 add b 24 4 |
| 94 | ret 14 |
| 95 | end |
| 96 | end |
| 97 | ret 0 |
| 98 | end |
| 99 | |
| 100 | fn lmanifest n ulong to ulong |
| 101 | if or eq n 0 gt n 64 |
| 102 | ret 1 |
| 103 | end |
| 104 | for i ulong n |
| 105 | a = mul i 32 |
| 106 | code = lrecord a |
| 107 | if ne code 0 |
| 108 | ret code |
| 109 | end |
| 110 | for j ulong i |
| 111 | b = mul j 32 |
| 112 | code = lpair a b |
| 113 | if ne code 0 |
| 114 | ret code |
| 115 | end |
| 116 | end |
| 117 | end |
| 118 | ret 0 |
| 119 | end |
| 120 | |
| 121 | note Caller supplies independent expected bytes and actual executor observations. |
| 122 | note Status 0=completed, 1=syntax,2=type,3=unsupported,4=timeout,5=resource,6=operational. |
| 123 | note Result 0=correct,1..6 as above,7=wrong value,8=trap mismatch,9=empty output,10=malformed. |
| 124 | fn lobserve status ulong wantcode ulong gotcode ulong wantn ulong gotn ulong to ulong |
| 125 | if gt status 6 |
| 126 | ret 10 |
| 127 | end |
| 128 | if ne status 0 |
| 129 | ret status |
| 130 | end |
| 131 | if or gt wantn 256 gt gotn 256 |
| 132 | ret 10 |
| 133 | end |
| 134 | if ne wantcode gotcode |
| 135 | ret 8 |
| 136 | end |
| 137 | if ne wantcode 0 |
| 138 | note Only declared runtime traps 101..107; arbitrary exit failures never pass. |
| 139 | if or lt wantcode 101 or gt wantcode 107 ne wantn 0 |
| 140 | ret 10 |
| 141 | end |
| 142 | if ne gotn 0 |
| 143 | ret 8 |
| 144 | end |
| 145 | ret 0 |
| 146 | end |
| 147 | if eq wantn 0 |
| 148 | ret 10 |
| 149 | end |
| 150 | if eq gotn 0 |
| 151 | ret 9 |
| 152 | end |
| 153 | if ne wantn gotn |
| 154 | ret 7 |
| 155 | end |
| 156 | for i ulong wantn |
| 157 | if ne get LWant i get LGot i |
| 158 | ret 7 |
| 159 | end |
| 160 | end |
| 161 | ret 0 |
| 162 | end |
| 163 | |
| 164 | note Full 256-bit compiler and executable identities, expected then observed. |
| 165 | note LPin[0..3] expected compiler, [4..7] observed, [8..11] expected ELF, [12..15] observed. |
| 166 | fn lpins to bool |
| 167 | ca = ulong 0 |
| 168 | ba = ulong 0 |
| 169 | for i ulong 4 |
| 170 | ca = or ca get LPin i |
| 171 | ba = or ba get LPin add i 8 |
| 172 | if ne get LPin i get LPin add i 4 |
| 173 | ret false |
| 174 | end |
| 175 | if ne get LPin add i 8 get LPin add i 12 |
| 176 | ret false |
| 177 | end |
| 178 | end |
| 179 | ret and ne ca 0 ne ba 0 |
| 180 | end |
| 181 | |
| 182 | note Each begin is one explicit fresh development run; no durable resume API exists. |
| 183 | note LS: active,tasks,maxattempts,attempts,pass1,passbudget,invalid,closed, |
| 184 | note generation_us,compile_us,judge_us,other_us,input_tokens,output_tokens,peak_bytes, |
| 185 | note energy_uj,energy_unknown,budget_us,completed,abstained,reserved... |
| 186 | fn lbegin n ulong maxtries ulong budget ulong to ulong |
| 187 | if eq get LS 0 1 |
| 188 | ret 20 |
| 189 | end |
| 190 | for i ulong 24 |
| 191 | put LS i 0 |
| 192 | end |
| 193 | for i ulong 64 |
| 194 | put LSeen i 0 |
| 195 | put LWon i 0 |
| 196 | end |
| 197 | code = lmanifest n |
| 198 | if ne code 0 |
| 199 | put LS 6 code |
| 200 | ret code |
| 201 | end |
| 202 | if or eq maxtries 0 or gt maxtries 64 or eq budget 0 gt budget 1000000000000 |
| 203 | put LS 6 21 |
| 204 | ret 21 |
| 205 | end |
| 206 | put LS 0 1 |
| 207 | put LS 1 n |
| 208 | put LS 2 maxtries |
| 209 | put LS 17 budget |
| 210 | ret 0 |
| 211 | end |
| 212 | |
| 213 | note Charge before classifying. Costs are exact integer caller measurements, never estimates. |
| 214 | note Missing cost values use all-ones and invalidate the run, never become free. |
| 215 | fn lcost slot ulong value ulong to ulong |
| 216 | if or lt slot 8 gt slot 15 |
| 217 | put LS 6 22 |
| 218 | ret 22 |
| 219 | end |
| 220 | if gt value 1000000000000 |
| 221 | put LS 6 23 |
| 222 | ret 23 |
| 223 | end |
| 224 | if eq slot 14 |
| 225 | if gt value get LS slot |
| 226 | put LS slot value |
| 227 | end |
| 228 | else |
| 229 | if gt get LS slot sub ulong 1000000000000 value |
| 230 | put LS 6 23 |
| 231 | ret 23 |
| 232 | end |
| 233 | put LS slot add get LS slot value |
| 234 | end |
| 235 | ret 0 |
| 236 | end |
| 237 | |
| 238 | note Attempt outcomes come from lobserve or explicit abstention 11, never compiler acceptance. |
| 239 | note Mandatory cost vector is supplied per attempt in LC; energy unknown is explicit. |
| 240 | global LC ulong 9 |
| 241 | |
| 242 | fn lattempt task ulong ordinal ulong outcome ulong to ulong |
| 243 | if ne get LS 0 1 |
| 244 | ret 24 |
| 245 | end |
| 246 | for k ulong 8 |
| 247 | r = lcost add k 8 get LC k |
| 248 | end |
| 249 | if eq get LC 8 0 |
| 250 | put LS 16 add get LS 16 1 |
| 251 | if ne get LC 7 0 |
| 252 | put LS 6 25 |
| 253 | end |
| 254 | else |
| 255 | if ne get LC 8 1 |
| 256 | put LS 6 25 |
| 257 | end |
| 258 | end |
| 259 | put LS 3 add get LS 3 1 |
| 260 | note At most 64 attempts across a public development run, including failed attempts. |
| 261 | if gt get LS 3 64 |
| 262 | put LS 6 31 |
| 263 | ret 31 |
| 264 | end |
| 265 | if eq lpins false |
| 266 | put LS 6 26 |
| 267 | end |
| 268 | note Invalid costs or identities can never add successful tasks. |
| 269 | if ne get LS 6 0 |
| 270 | ret get LS 6 |
| 271 | end |
| 272 | if or ge task get LS 1 gt outcome 11 |
| 273 | put LS 6 27 |
| 274 | ret 27 |
| 275 | end |
| 276 | if or ne ordinal add get LSeen task 1 gt ordinal get LS 2 |
| 277 | put LS 6 28 |
| 278 | ret 28 |
| 279 | end |
| 280 | put LSeen task ordinal |
| 281 | if eq outcome 0 |
| 282 | if eq ordinal 1 |
| 283 | put LS 4 add get LS 4 1 |
| 284 | end |
| 285 | if eq get LWon task 0 |
| 286 | put LWon task 1 |
| 287 | put LS 5 add get LS 5 1 |
| 288 | end |
| 289 | end |
| 290 | if eq outcome 11 |
| 291 | put LS 19 add get LS 19 1 |
| 292 | end |
| 293 | elapsed = add get LS 8 get LS 9 |
| 294 | elapsed = add elapsed get LS 10 |
| 295 | elapsed = add elapsed get LS 11 |
| 296 | if gt elapsed get LS 17 |
| 297 | put LS 6 29 |
| 298 | end |
| 299 | ret get LS 6 |
| 300 | end |
| 301 | |
| 302 | fn lfinish to ulong |
| 303 | if ne get LS 0 1 |
| 304 | ret 24 |
| 305 | end |
| 306 | put LS 0 0 |
| 307 | for i ulong get LS 1 |
| 308 | if eq get LSeen i 0 |
| 309 | if eq get LS 6 0 |
| 310 | put LS 6 30 |
| 311 | end |
| 312 | end |
| 313 | end |
| 314 | if ne get LS 6 0 |
| 315 | ret get LS 6 |
| 316 | end |
| 317 | put LS 18 1 |
| 318 | ret 0 |
| 319 | end |
| 320 | |
| 321 | note GEN-1 genjac rule reused: lowercase ASCII word-triple SET Jaccard strictly above 1/2. |
| 322 | note Input contains two public prompts only; never load final or sealed text here. |
| 323 | global LText uchar 512 |
| 324 | global LStart ulong 128 |
| 325 | global LLength ulong 128 |
| 326 | global LCount ulong 2 |
| 327 | |
| 328 | fn llower c uchar to uchar |
| 329 | if and ge c 65 le c 90 |
| 330 | ret add c 32 |
| 331 | end |
| 332 | ret c |
| 333 | end |
| 334 | |
| 335 | fn lword c uchar to bool |
| 336 | d = llower c |
| 337 | ret or and ge d 97 le d 122 and ge d 48 le d 57 |
| 338 | end |
| 339 | |
| 340 | fn ltokens side ulong size ulong to bool |
| 341 | if or gt side 1 gt size 256 |
| 342 | ret false |
| 343 | end |
| 344 | base = mul side 256 |
| 345 | slots = mul side 64 |
| 346 | count = ulong 0 |
| 347 | pos = ulong 0 |
| 348 | while lt pos size |
| 349 | if gt get LText add base pos 127 |
| 350 | ret false |
| 351 | end |
| 352 | if lword get LText add base pos |
| 353 | start = pos |
| 354 | scanning = true |
| 355 | while and lt pos size scanning |
| 356 | if lword get LText add base pos |
| 357 | pos = add pos 1 |
| 358 | else |
| 359 | scanning = false |
| 360 | end |
| 361 | end |
| 362 | if ge count 64 |
| 363 | ret false |
| 364 | end |
| 365 | put LStart add slots count add base start |
| 366 | put LLength add slots count sub pos start |
| 367 | count = add count 1 |
| 368 | else |
| 369 | pos = add pos 1 |
| 370 | end |
| 371 | end |
| 372 | put LCount side count |
| 373 | ret true |
| 374 | end |
| 375 | |
| 376 | fn lwordeq a ulong b ulong to bool |
| 377 | n = get LLength a |
| 378 | if ne n get LLength b |
| 379 | ret false |
| 380 | end |
| 381 | for k ulong n |
| 382 | if ne llower get LText add get LStart a k llower get LText add get LStart b k |
| 383 | ret false |
| 384 | end |
| 385 | end |
| 386 | ret true |
| 387 | end |
| 388 | |
| 389 | fn ltriple a ulong b ulong to bool |
| 390 | for k ulong 3 |
| 391 | if eq lwordeq add a k add b k false |
| 392 | ret false |
| 393 | end |
| 394 | end |
| 395 | ret true |
| 396 | end |
| 397 | |
| 398 | fn lunique at ulong base ulong to bool |
| 399 | j = base |
| 400 | while lt j at |
| 401 | if ltriple at j |
| 402 | ret false |
| 403 | end |
| 404 | j = add j 1 |
| 405 | end |
| 406 | ret true |
| 407 | end |
| 408 | |
| 409 | note 0=no near match,1=above threshold,2=insufficient words,3=unsupported input. |
| 410 | fn lnear an ulong bn ulong to ulong |
| 411 | if eq ltokens 0 an false |
| 412 | ret 3 |
| 413 | end |
| 414 | if eq ltokens 1 bn false |
| 415 | ret 3 |
| 416 | end |
| 417 | a = get LCount 0 |
| 418 | b = get LCount 1 |
| 419 | if or lt a 3 lt b 3 |
| 420 | ret 2 |
| 421 | end |
| 422 | ua = ulong 0 |
| 423 | ub = ulong 0 |
| 424 | overlap = ulong 0 |
| 425 | for i ulong sub a 2 |
| 426 | if lunique i 0 |
| 427 | ua = add ua 1 |
| 428 | hit = false |
| 429 | for j ulong sub b 2 |
| 430 | if ltriple i add 64 j |
| 431 | hit = true |
| 432 | end |
| 433 | end |
| 434 | if hit |
| 435 | overlap = add overlap 1 |
| 436 | end |
| 437 | end |
| 438 | end |
| 439 | for j ulong sub b 2 |
| 440 | if lunique add 64 j 64 |
| 441 | ub = add ub 1 |
| 442 | end |
| 443 | end |
| 444 | if gt mul overlap 3 add ua ub |
| 445 | ret 1 |
| 446 | end |
| 447 | ret 0 |
| 448 | end |
| 449 | note SPDX-License-Identifier: AGPL-3.0-or-later |
| 450 | note L776 public record-admission preparation, consuming frozen L775 core84d03c55. |
| 451 | note Caller supplies independently measured metadata and observation bytes. |
| 452 | note This component does not authenticate receipts, execute candidates or persist state. |
| 453 | note CMeta schema/profile/license/provenance/oracle/template/evidence/samples then source SHA256 then zero reserved. |
| 454 | global CMeta ulong 16 |
| 455 | global CSeen ulong 64 |
| 456 | global CDiag ulong 64 |
| 457 | global CGood ulong 64 |
| 458 | global CBad ulong 64 |
| 459 | global CFreeze ulong 2048 |
| 460 | note CState good count,bad count,ready. Consume accepted indices only after cfinish returns zero. |
| 461 | global CState ulong 3 |
| 462 | |
| 463 | fn cbegin n ulong budget ulong to ulong |
| 464 | put CState 2 0 |
| 465 | r = lbegin n 1 budget |
| 466 | if ne r 0 |
| 467 | ret r |
| 468 | end |
| 469 | for i ulong mul n 32 |
| 470 | put CFreeze i get LT i |
| 471 | end |
| 472 | for i ulong 64 |
| 473 | put CSeen i 0 |
| 474 | put CDiag i 99 |
| 475 | put CGood i 0 |
| 476 | put CBad i 0 |
| 477 | end |
| 478 | for i ulong 3 |
| 479 | put CState i 0 |
| 480 | end |
| 481 | ret 0 |
| 482 | end |
| 483 | |
| 484 | fn cmeta task ulong to ulong |
| 485 | base = mul task 32 |
| 486 | for k ulong 32 |
| 487 | if ne get LT add base k get CFreeze add base k |
| 488 | ret 47 |
| 489 | end |
| 490 | end |
| 491 | if or ne get CMeta 0 1 ne get CMeta 1 get LT add base 4 |
| 492 | ret 40 |
| 493 | end |
| 494 | note License1 is AGPL-3.0-or-later; provenance1 is disclosed handwritten public fixture. |
| 495 | if ne get CMeta 2 1 |
| 496 | ret 41 |
| 497 | end |
| 498 | if ne get CMeta 3 1 |
| 499 | ret 42 |
| 500 | end |
| 501 | if ne get CMeta 4 get LT add base 6 |
| 502 | ret 43 |
| 503 | end |
| 504 | if ne get CMeta 5 get LT add base 7 |
| 505 | ret 43 |
| 506 | end |
| 507 | if eq get CMeta 4 get CMeta 5 |
| 508 | ret 43 |
| 509 | end |
| 510 | note Only bounded tested evidence1; no formal-proof label admitted here. |
| 511 | if ne get CMeta 6 1 |
| 512 | ret 44 |
| 513 | end |
| 514 | note Narrow supported packet: three independent fixed u64 observations,24bytes. |
| 515 | if or ne get CMeta 7 3 lt get LT add base 29 24 |
| 516 | ret 45 |
| 517 | end |
| 518 | for k ulong 4 |
| 519 | if ne get CMeta add k 8 get LT add base add k 12 |
| 520 | ret 46 |
| 521 | end |
| 522 | if ne get CMeta add k 12 0 |
| 523 | ret 40 |
| 524 | end |
| 525 | end |
| 526 | ret 0 |
| 527 | end |
| 528 | |
| 529 | fn csubmit task ulong status ulong gotcode ulong gotn ulong to ulong |
| 530 | if ne get LS 0 1 |
| 531 | ret 24 |
| 532 | end |
| 533 | if ge task get LS 1 |
| 534 | ret lattempt task 1 10 |
| 535 | end |
| 536 | if ne get CSeen task 0 |
| 537 | note Charge the attempted duplicate; preserve its first stored record. |
| 538 | ret lattempt task 2 10 |
| 539 | end |
| 540 | why = cmeta task |
| 541 | outcome = ulong 10 |
| 542 | if eq why 0 |
| 543 | outcome = lobserve status 0 gotcode 24 gotn |
| 544 | why = outcome |
| 545 | end |
| 546 | code = lattempt task 1 outcome |
| 547 | put CSeen task 1 |
| 548 | if ne code 0 |
| 549 | why = code |
| 550 | end |
| 551 | put CDiag task why |
| 552 | if eq why 0 |
| 553 | put CGood get CState 0 task |
| 554 | put CState 0 add get CState 0 1 |
| 555 | else |
| 556 | put CBad get CState 1 task |
| 557 | put CState 1 add get CState 1 1 |
| 558 | end |
| 559 | ret why |
| 560 | end |
| 561 | |
| 562 | fn cfinish to ulong |
| 563 | code = lfinish |
| 564 | if ne code 0 |
| 565 | ret code |
| 566 | end |
| 567 | put CState 2 1 |
| 568 | ret 0 |
| 569 | end |
| 570 | note SPDX-License-Identifier: AGPL-3.0-or-later |
| 571 | note PACK5 v1 consumes L775 core84d03c55 and L776 admitd8d14c47 unchanged. |
| 572 | note Trusted single-thread caller supplies tokenization; no authentication or tokenizer. |
| 573 | note DPCfg schema,vocabulary size,split,padding token. DPPin expected+observed tokenizer then template SHA256 words. |
| 574 | global DPCfg ulong 4 |
| 575 | global DPPin ulong 16 |
| 576 | global DPLen ulong 64 |
| 577 | global DPPrompt ulong 64 |
| 578 | global DPToken ulong 16384 |
| 579 | global DPOut ulong 256 |
| 580 | global DPLabel ulong 256 |
| 581 | global DPMask ulong 256 |
| 582 | global DPTask ulong 256 |
| 583 | global DPPos ulong 256 |
| 584 | note DPState ready,count,records. A failed call invalidates readiness and count; payload stays unchanged. |
| 585 | global DPState ulong 3 |
| 586 | |
| 587 | fn dppins to bool |
| 588 | a = ulong 0 |
| 589 | b = ulong 0 |
| 590 | for i ulong 4 |
| 591 | a = or a get DPPin i |
| 592 | b = or b get DPPin add i 8 |
| 593 | if ne get DPPin i get DPPin add i 4 |
| 594 | ret false |
| 595 | end |
| 596 | if ne get DPPin add i 8 get DPPin add i 12 |
| 597 | ret false |
| 598 | end |
| 599 | end |
| 600 | ret and ne a 0 ne b 0 |
| 601 | end |
| 602 | |
| 603 | fn dpinput task ulong to ulong |
| 604 | if ne get CFreeze add mul task 32 1 get DPCfg 2 |
| 605 | ret 77 |
| 606 | end |
| 607 | count = get DPLen task |
| 608 | prompt = get DPPrompt task |
| 609 | if or eq count 0 gt count 256 |
| 610 | ret 74 |
| 611 | end |
| 612 | if gt prompt count |
| 613 | ret 74 |
| 614 | end |
| 615 | for j ulong count |
| 616 | if ge get DPToken add mul task 256 j get DPCfg 1 |
| 617 | ret 75 |
| 618 | end |
| 619 | end |
| 620 | ret 0 |
| 621 | end |
| 622 | |
| 623 | fn dpvalidate to ulong |
| 624 | if or ne get CState 2 1 ne get LS 18 1 |
| 625 | ret 70 |
| 626 | end |
| 627 | if or ne get LS 0 0 ne get LS 6 0 |
| 628 | ret 70 |
| 629 | end |
| 630 | n = get LS 1 |
| 631 | good = get CState 0 |
| 632 | bad = get CState 1 |
| 633 | if or eq n 0 gt n 64 |
| 634 | ret 73 |
| 635 | end |
| 636 | if or gt good n gt bad n |
| 637 | ret 73 |
| 638 | end |
| 639 | if ne add good bad n |
| 640 | ret 73 |
| 641 | end |
| 642 | if or ne get DPCfg 0 1 eq get DPCfg 1 0 |
| 643 | ret 71 |
| 644 | end |
| 645 | if or gt get DPCfg 1 4294967296 ge get DPCfg 3 get DPCfg 1 |
| 646 | ret 71 |
| 647 | end |
| 648 | if or lt get DPCfg 2 1 gt get DPCfg 2 2 |
| 649 | ret 71 |
| 650 | end |
| 651 | if eq dppins false |
| 652 | ret 72 |
| 653 | end |
| 654 | total = ulong 0 |
| 655 | for i ulong good |
| 656 | t = get CGood i |
| 657 | if ge t n |
| 658 | ret 73 |
| 659 | end |
| 660 | if or ne get CSeen t 1 ne get CDiag t 0 |
| 661 | ret 73 |
| 662 | end |
| 663 | for j ulong i |
| 664 | if eq t get CGood j |
| 665 | ret 73 |
| 666 | end |
| 667 | end |
| 668 | r = dpinput t |
| 669 | if ne r 0 |
| 670 | ret r |
| 671 | end |
| 672 | count = get DPLen t |
| 673 | if gt count sub 256 total |
| 674 | ret 76 |
| 675 | end |
| 676 | total = add total count |
| 677 | end |
| 678 | note No tokens or prompt markers may be supplied for quarantined or absent slots. |
| 679 | for t ulong 64 |
| 680 | found = false |
| 681 | for i ulong good |
| 682 | if eq t get CGood i |
| 683 | found = true |
| 684 | end |
| 685 | end |
| 686 | if eq found false |
| 687 | if or ne get DPLen t 0 ne get DPPrompt t 0 |
| 688 | ret 73 |
| 689 | end |
| 690 | end |
| 691 | end |
| 692 | ret 0 |
| 693 | end |
| 694 | |
| 695 | fn dppack to ulong |
| 696 | for i ulong 3 |
| 697 | put DPState i 0 |
| 698 | end |
| 699 | r = dpvalidate |
| 700 | if ne r 0 |
| 701 | ret r |
| 702 | end |
| 703 | for i ulong 256 |
| 704 | put DPOut i get DPCfg 3 |
| 705 | put DPLabel i get DPCfg 3 |
| 706 | put DPMask i 0 |
| 707 | put DPTask i 18446744073709551615 |
| 708 | put DPPos i 0 |
| 709 | end |
| 710 | p = ulong 0 |
| 711 | for i ulong get CState 0 |
| 712 | t = get CGood i |
| 713 | count = get DPLen t |
| 714 | for j ulong count |
| 715 | put DPOut p get DPToken add mul t 256 j |
| 716 | put DPTask p t |
| 717 | put DPPos p j |
| 718 | next = add j 1 |
| 719 | if lt next count |
| 720 | put DPLabel p get DPToken add mul t 256 next |
| 721 | if ge next get DPPrompt t |
| 722 | put DPMask p 1 |
| 723 | end |
| 724 | end |
| 725 | p = add p 1 |
| 726 | end |
| 727 | end |
| 728 | put DPState 1 p |
| 729 | put DPState 2 get CState 0 |
| 730 | put DPState 0 1 |
| 731 | ret 0 |
| 732 | end |
| 733 | |
| 734 | fn dpattend q ulong k ulong to bool |
| 735 | if ne get DPState 0 1 |
| 736 | ret false |
| 737 | end |
| 738 | if or ge q get DPState 1 ge k get DPState 1 |
| 739 | ret false |
| 740 | end |
| 741 | if gt k q |
| 742 | ret false |
| 743 | end |
| 744 | ret eq get DPTask q get DPTask k |
| 745 | end |
| 746 | note SPDX-License-Identifier: AGPL-3.0-or-later |
| 747 | note Public synthetic admission records; independent token/position oracle uses absolute packed coordinates. |
| 748 | global Checks ulong 1 |
| 749 | global Dec uchar 32 |
| 750 | global Snapshot ulong 1280 |
| 751 | text Pass "PACK5_PASS " |
| 752 | text Fail "PACK5_FAIL " |
| 753 | text NL "\n" |
| 754 | |
| 755 | fn number x ulong to void |
| 756 | n = ulong 0 |
| 757 | while true |
| 758 | put Dec n uchar add 48 mod x 10 |
| 759 | n = add n 1 |
| 760 | x = div x 10 |
| 761 | if eq x 0 |
| 762 | break |
| 763 | end |
| 764 | end |
| 765 | while gt n 0 |
| 766 | n = sub n 1 |
| 767 | w = write 1 ptr Dec n 1 |
| 768 | end |
| 769 | end |
| 770 | |
| 771 | fn ck got ulong want ulong to void |
| 772 | put Checks 0 add get Checks 0 1 |
| 773 | if ne got want |
| 774 | w = write 1 ptr Fail 0 11 |
| 775 | number get Checks 0 |
| 776 | w = write 1 ptr NL 0 1 |
| 777 | exit 1 |
| 778 | end |
| 779 | end |
| 780 | |
| 781 | fn setup n ulong to void |
| 782 | for i ulong 2048 |
| 783 | put LT i 0 |
| 784 | end |
| 785 | for i ulong n |
| 786 | b = mul i 32 |
| 787 | put LT b add i 1 |
| 788 | put LT add b 1 1 |
| 789 | put LT add b 2 1 |
| 790 | put LT add b 3 add i 1 |
| 791 | put LT add b 4 1 |
| 792 | put LT add b 5 1 |
| 793 | put LT add b 6 776 |
| 794 | put LT add b 7 add i 17 |
| 795 | for k ulong 20 |
| 796 | put LT add b add k 8 add add mul i 100 k 1 |
| 797 | end |
| 798 | put LT add b 28 24 |
| 799 | put LT add b 29 24 |
| 800 | put LT add b 30 1000 |
| 801 | end |
| 802 | for i ulong 4 |
| 803 | put LPin i add i 1 |
| 804 | put LPin add i 4 add i 1 |
| 805 | put LPin add i 8 add i 5 |
| 806 | put LPin add i 12 add i 5 |
| 807 | put DPPin i add i 1 |
| 808 | put DPPin add i 4 add i 1 |
| 809 | put DPPin add i 8 add i 5 |
| 810 | put DPPin add i 12 add i 5 |
| 811 | end |
| 812 | for i ulong 24 |
| 813 | put LS i 0 |
| 814 | end |
| 815 | for i ulong 9 |
| 816 | put LC i 0 |
| 817 | end |
| 818 | put LC 0 1 |
| 819 | put DPCfg 0 1 |
| 820 | put DPCfg 1 1024 |
| 821 | put DPCfg 2 1 |
| 822 | put DPCfg 3 0 |
| 823 | for i ulong 64 |
| 824 | put DPLen i 0 |
| 825 | put DPPrompt i 0 |
| 826 | end |
| 827 | for i ulong 16384 |
| 828 | put DPToken i mod add i 1 1024 |
| 829 | end |
| 830 | end |
| 831 | |
| 832 | fn submit task ulong outcome ulong to void |
| 833 | for i ulong 16 |
| 834 | put CMeta i 0 |
| 835 | end |
| 836 | put CMeta 0 1 |
| 837 | put CMeta 1 1 |
| 838 | put CMeta 2 1 |
| 839 | put CMeta 3 1 |
| 840 | put CMeta 4 776 |
| 841 | put CMeta 5 get LT add mul task 32 7 |
| 842 | put CMeta 6 1 |
| 843 | put CMeta 7 3 |
| 844 | for i ulong 4 |
| 845 | put CMeta add i 8 get LT add mul task 32 add i 12 |
| 846 | end |
| 847 | for i ulong 24 |
| 848 | put LWant i uchar i |
| 849 | put LGot i uchar i |
| 850 | end |
| 851 | ck csubmit task outcome 0 24 outcome |
| 852 | end |
| 853 | |
| 854 | fn admitted n ulong to void |
| 855 | setup n |
| 856 | ck cbegin n 10000 0 |
| 857 | for i ulong n |
| 858 | submit i 0 |
| 859 | put DPLen i 2 |
| 860 | put DPPrompt i 1 |
| 861 | end |
| 862 | ck cfinish 0 |
| 863 | end |
| 864 | |
| 865 | fn save to void |
| 866 | for i ulong 256 |
| 867 | put Snapshot i get DPOut i |
| 868 | put Snapshot add i 256 get DPLabel i |
| 869 | put Snapshot add i 512 get DPMask i |
| 870 | put Snapshot add i 768 get DPTask i |
| 871 | put Snapshot add i 1024 get DPPos i |
| 872 | end |
| 873 | end |
| 874 | |
| 875 | fn refused code ulong to void |
| 876 | ck dppack code |
| 877 | ck get DPState 0 0 |
| 878 | ck get DPState 1 0 |
| 879 | ck ulong dpattend 0 0 0 |
| 880 | for i ulong 256 |
| 881 | ck get DPOut i get Snapshot i |
| 882 | ck get DPLabel i get Snapshot add i 256 |
| 883 | ck get DPMask i get Snapshot add i 512 |
| 884 | ck get DPTask i get Snapshot add i 768 |
| 885 | ck get DPPos i get Snapshot add i 1024 |
| 886 | end |
| 887 | end |
| 888 | |
| 889 | fn oracle a ulong b ulong pa ulong pb ulong to void |
| 890 | put DPLen 0 a |
| 891 | put DPLen 1 b |
| 892 | put DPPrompt 0 pa |
| 893 | put DPPrompt 1 pb |
| 894 | ck dppack 0 |
| 895 | ck get DPState 1 add a b |
| 896 | for q ulong add a b |
| 897 | owner = ulong 0 |
| 898 | pos = q |
| 899 | plen = pa |
| 900 | stop = a |
| 901 | if ge q a |
| 902 | owner = 1 |
| 903 | pos = sub q a |
| 904 | plen = pb |
| 905 | stop = add a b |
| 906 | end |
| 907 | ck get DPOut q add add mul owner 256 pos 1 |
| 908 | ck get DPTask q owner |
| 909 | ck get DPPos q pos |
| 910 | label = ulong 0 |
| 911 | mask = ulong 0 |
| 912 | if lt add q 1 stop |
| 913 | label = add add mul owner 256 pos 2 |
| 914 | if ge add pos 1 plen |
| 915 | mask = 1 |
| 916 | end |
| 917 | end |
| 918 | ck get DPLabel q label |
| 919 | ck get DPMask q mask |
| 920 | for k ulong add a b |
| 921 | want = ulong 0 |
| 922 | note Independent partition intervals and absolute lower triangle; no product helper used. |
| 923 | if le k q |
| 924 | if lt q a |
| 925 | if lt k a |
| 926 | want = 1 |
| 927 | end |
| 928 | else |
| 929 | if ge k a |
| 930 | want = 1 |
| 931 | end |
| 932 | end |
| 933 | end |
| 934 | ck ulong dpattend q k want |
| 935 | end |
| 936 | end |
| 937 | for tail ulong sub 256 add a b |
| 938 | q = add add a b tail |
| 939 | ck get DPOut q 0 |
| 940 | ck get DPLabel q 0 |
| 941 | ck get DPMask q 0 |
| 942 | ck get DPTask q 18446744073709551615 |
| 943 | ck ulong dpattend q 0 0 |
| 944 | end |
| 945 | end |
| 946 | |
| 947 | fn main to int |
| 948 | admitted 2 |
| 949 | for aa ulong 4 |
| 950 | for bb ulong 4 |
| 951 | for pa ulong add aa 2 |
| 952 | for pb ulong add bb 2 |
| 953 | oracle add aa 1 add bb 1 pa pb |
| 954 | end |
| 955 | end |
| 956 | end |
| 957 | end |
| 958 | ck dppack 0 |
| 959 | save |
| 960 | put CState 2 0 |
| 961 | refused 70 |
| 962 | put CState 2 1 |
| 963 | put DPCfg 0 2 |
| 964 | refused 71 |
| 965 | put DPCfg 0 1 |
| 966 | put DPPin 7 99 |
| 967 | refused 72 |
| 968 | put DPPin 7 4 |
| 969 | put DPPin 15 99 |
| 970 | refused 72 |
| 971 | put DPPin 15 8 |
| 972 | put DPCfg 2 2 |
| 973 | refused 77 |
| 974 | put DPCfg 2 1 |
| 975 | put CGood 1 0 |
| 976 | refused 73 |
| 977 | put CGood 1 1 |
| 978 | put DPLen 0 0 |
| 979 | refused 74 |
| 980 | put DPLen 0 257 |
| 981 | refused 74 |
| 982 | put DPLen 0 4 |
| 983 | put DPPrompt 0 5 |
| 984 | refused 74 |
| 985 | put DPPrompt 0 4 |
| 986 | put DPToken 0 1024 |
| 987 | refused 75 |
| 988 | put DPToken 0 1 |
| 989 | put DPLen 0 253 |
| 990 | refused 76 |
| 991 | put DPLen 0 4 |
| 992 | put DPLen 63 1 |
| 993 | refused 73 |
| 994 | put DPLen 63 0 |
| 995 | admitted 1 |
| 996 | put DPLen 0 256 |
| 997 | put DPPrompt 0 0 |
| 998 | ck dppack 0 |
| 999 | ck get DPState 1 256 |
| 1000 | ck get DPMask 254 1 |
| 1001 | ck get DPMask 255 0 |
| 1002 | ck ulong dpattend 255 0 1 |
| 1003 | ck ulong dpattend 256 0 0 |
| 1004 | ck ulong dpattend 18446744073709551615 0 0 |
| 1005 | admitted 64 |
| 1006 | ck dppack 0 |
| 1007 | ck get DPState 1 128 |
| 1008 | ck get DPState 2 64 |
| 1009 | ck get DPTask 127 63 |
| 1010 | setup 2 |
| 1011 | ck cbegin 2 10000 0 |
| 1012 | submit 0 1 |
| 1013 | submit 1 0 |
| 1014 | ck cfinish 0 |
| 1015 | put DPLen 1 3 |
| 1016 | put DPPrompt 1 1 |
| 1017 | ck dppack 0 |
| 1018 | ck get DPTask 0 1 |
| 1019 | ck get DPOut 0 257 |
| 1020 | save |
| 1021 | put DPLen 0 1 |
| 1022 | refused 73 |
| 1023 | setup 1 |
| 1024 | ck cbegin 1 10000 0 |
| 1025 | submit 0 1 |
| 1026 | ck cfinish 0 |
| 1027 | ck dppack 0 |
| 1028 | ck get DPState 1 0 |
| 1029 | ck get DPState 2 0 |
| 1030 | ck ulong dpattend 0 0 0 |
| 1031 | w = write 1 ptr Pass 0 11 |
| 1032 | number get Checks 0 |
| 1033 | w = write 1 ptr NL 0 1 |
| 1034 | ret 0 |
| 1035 | end |