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/si/benchmarks/native/neuralese/nl7-score.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 / si / benchmarks / native / neuralese / nl7-score.om` 526 lines ยท 8341 bytes Raw Blame History 1 om2 2 note NL7 independent scorer, frozen prereg benchmarks `989fb7a214d8e0d6c7ed04f5f48c45d68a43d5a3`. 3 note Synthetic host evidence only. CSV predictions are scored, not used as truth or codewords. 4 note D, and P, printable bounded diagnostics are explicitly non-scoring records. 5 const CHUNK ulong 16384 6 global Buf uchar CHUNK 7 global Io ulong 2 8 global Row ulong 9 9 global Seen ulong 65536 10 global Count ulong 131072 11 global Good ulong 131072 12 global Refuse ulong 131072 13 global Robust ulong 360 14 global Rgood ulong 360 15 global Rrefuse ulong 360 16 global Failed ulong 1 17 text BAD "NL7 INVALID\n" 18 text PASS "NL7 CHECKS PASS\n" 19 text FAIL "NL7 CHECKS FAIL\n" 20 text HEAD "NL7SCORE1,seed,split,arm,budget,mode,scope,total,correct,refused,undetected\n" 21 text TAG "S," 22 text RTAG "R," 23 text LTAG "L," 24 text LHEAD "NL7LEARN1,seed,split,fullfit,heldout,improves,no_more_undetected\n" 25 text YES "NL7 LEARNED SUPPORTED\n" 26 text NO "NL7 LEARNED NOT_SUPPORTED\n" 27 text COMMA "," 28 text LF "\n" 29 fn putout a view uchar * n ulong to void 30 p = ulong 0 31 while lt p n 32 k = write 1 a p sub n p 33 if le k 0 34 exit 93 35 end 36 p = add p ulong k 37 end 38 end 39 fn invalid to void 40 putout BAD len BAD 41 exit 90 42 end 43 fn number n ulong to void 44 b = new uchar 20 0 45 p = ulong 20 46 while true bound 20 47 p = sub p 1 48 put b p uchar add rem n 10 48 49 n = div n 10 50 if eq n 0 51 break 52 end 53 end 54 putout part b p sub ulong 20 p sub ulong 20 p 55 end 56 fn flag v bool to ulong 57 if v 58 ret 1 59 end 60 ret 0 61 end 62 fn sep to void 63 putout COMMA 1 64 end 65 fn next to long 66 if eq get Io 0 get Io 1 67 k = read 0 Buf 0 CHUNK 68 if lt k 0 69 invalid 70 end 71 if eq k 0 72 ret -1 73 end 74 put Io 0 0 75 put Io 1 ulong k 76 end 77 p = get Io 0 78 put Io 0 add p 1 79 ret long get Buf p 80 end 81 fn value delim long to ulong 82 v = ulong 0 83 n = ulong 0 84 first = long -1 85 while true bound 8 86 c = next 87 if eq c delim 88 if eq n 0 89 invalid 90 end 91 if and gt n 1 eq first 48 92 invalid 93 end 94 ret v 95 end 96 if or lt c 48 gt c 57 97 invalid 98 end 99 if eq n 0 100 first = c 101 end 102 if gt n 5 103 invalid 104 end 105 v = add mul v 10 ulong sub c 48 106 n = add n 1 107 end 108 ret 0 109 end 110 fn seedindex seed ulong to ulong 111 if eq seed 101 112 ret 0 113 end 114 if eq seed 211 115 ret 1 116 end 117 if eq seed 307 118 ret 2 119 end 120 invalid 121 ret 0 122 end 123 fn seedvalue si ulong to ulong 124 if eq si 0 125 ret 101 126 end 127 if eq si 1 128 ret 211 129 end 130 ret 307 131 end 132 fn budindex budget ulong to ulong 133 if eq budget 8 134 ret 0 135 end 136 if eq budget 24 137 ret 1 138 end 139 if eq budget 96 140 ret 2 141 end 142 if eq budget 192 143 ret 3 144 end 145 invalid 146 ret 0 147 end 148 fn budvalue bi ulong to ulong 149 if eq bi 0 150 ret 8 151 end 152 if eq bi 1 153 ret 24 154 end 155 if eq bi 2 156 ret 96 157 end 158 ret 192 159 end 160 fn group si ulong split ulong arm ulong bi ulong to ulong 161 ret add mul add mul add mul si 3 split 5 arm 4 bi 162 end 163 fn heldout split ulong id ulong to bool 164 if eq split 0 165 ret false 166 end 167 if or eq id 0 or eq id 1 or eq id 2 or eq id 4 eq id 8 168 ret false 169 end 170 if eq split 1 171 if or eq id 3 or eq id 5 eq id 9 172 ret false 173 end 174 else 175 if or eq id 6 or eq id 10 eq id 12 176 ret false 177 end 178 end 179 ret true 180 end 181 fn validmode arm ulong mode ulong to bool 182 if or eq arm 0 or eq arm 2 eq arm 3 183 ret le mode 18 184 end 185 if eq mode 0 186 ret true 187 end 188 n = ulong 8 189 if eq arm 4 190 n = 4 191 end 192 if and ge mode 100 lt mode add 100 n 193 ret true 194 end 195 if lt mode 200 196 ret false 197 end 198 i = div sub mode 200 8 199 j = rem sub mode 200 8 200 ret and lt i j lt j n 201 end 202 note Independent RM codeword from four coefficient bits and eight evaluation triples. 203 fn codeword id ulong to ulong 204 word = ulong 0 205 for t ulong 8 206 bit = and id 1 207 for k ulong 3 208 coef = and shr id add k 1 1 209 coord = and shr t k 1 210 bit = xor bit and coef coord 211 end 212 word = or word shl bit t 213 end 214 ret word 215 end 216 fn corrupt word ulong mode ulong to ulong 217 if eq mode 0 218 ret word 219 end 220 if lt mode 200 221 ret xor word shl ulong 1 sub mode 100 222 end 223 i = div sub mode 200 8 224 j = rem sub mode 200 8 225 ret xor xor word shl ulong 1 i shl ulong 1 j 226 end 227 fn hamming a ulong b ulong to ulong 228 v = xor a b 229 d = ulong 0 230 for k ulong 8 231 d = add d and shr v k 1 232 end 233 ret d 234 end 235 fn rmdecode word ulong to ulong 236 found = ulong 99 237 for cand ulong 16 238 if le hamming word codeword cand 1 239 if ne found 99 240 ret 99 241 end 242 found = cand 243 end 244 end 245 ret found 246 end 247 fn violation to void 248 put Failed 0 add get Failed 0 1 249 end 250 fn guarantees to void 251 arm = get Row 2 252 id = get Row 3 253 mode = get Row 5 254 pred = get Row 6 255 status = get Row 7 256 if eq arm 0 257 must = eq mode 0 258 if and ge get Row 4 96 le mode 6 259 must = true 260 end 261 if and must or ne status 0 ne pred id 262 violation 263 end 264 end 265 if eq arm 1 266 expected = rmdecode corrupt codeword id mode 267 if ne pred expected 268 violation 269 end 270 if ne status flag eq expected 99 271 violation 272 end 273 end 274 if eq arm 4 275 expected = corrupt id mode 276 if or ne status 0 ne pred expected 277 violation 278 end 279 end 280 end 281 fn increment idx ulong good bool refused bool to void 282 put Count idx add get Count idx 1 283 if good 284 put Good idx add get Good idx 1 285 end 286 if refused 287 put Refuse idx add get Refuse idx 1 288 end 289 end 290 fn rincrement idx ulong good bool refused bool to void 291 put Robust idx add get Robust idx 1 292 if good 293 put Rgood idx add get Rgood idx 1 294 end 295 if refused 296 put Rrefuse idx add get Rrefuse idx 1 297 end 298 end 299 fn grade base ulong to void 300 id = get Row 3 301 mode = get Row 5 302 idx = add mul base 256 mode 303 bit = shl ulong 1 id 304 if ne and get Seen idx bit 0 305 invalid 306 end 307 put Seen idx or get Seen idx bit 308 correct = and eq get Row 7 0 eq get Row 6 id 309 refused = eq get Row 7 1 310 increment mul idx 2 correct refused 311 if ne mode 0 312 rincrement mul base 2 correct refused 313 end 314 if heldout get Row 1 id 315 increment add mul idx 2 1 correct refused 316 if ne mode 0 317 rincrement add mul base 2 1 correct refused 318 end 319 end 320 guarantees 321 end 322 fn row to void 323 for j ulong 9 324 d = long 44 325 if eq j 8 326 d = 10 327 end 328 put Row j value d 329 end 330 si = seedindex get Row 0 331 bi = budindex get Row 4 332 if or gt get Row 1 2 or gt get Row 2 4 gt get Row 3 15 333 invalid 334 end 335 if not validmode get Row 2 get Row 5 336 invalid 337 end 338 if gt get Row 7 1 339 invalid 340 end 341 if eq get Row 7 0 342 if gt get Row 6 15 343 invalid 344 end 345 else 346 if ne get Row 6 99 347 invalid 348 end 349 end 350 payload = get Row 4 351 if eq payload 8 352 payload = 6 353 end 354 if eq get Row 2 1 355 payload = 8 356 end 357 if eq get Row 2 4 358 payload = 4 359 end 360 if or ne get Row 8 payload gt get Row 8 get Row 4 361 invalid 362 end 363 grade group si get Row 1 get Row 2 bi 364 end 365 fn diagnostic to void 366 if ne next 44 367 invalid 368 end 369 note Diagnostics are at most 8192 printable ASCII bytes followed by LF, never EOF. 370 while true bound 8193 371 c = next 372 if eq c 10 373 ret 374 end 375 if or lt c 32 gt c 126 376 invalid 377 end 378 end 379 invalid 380 end 381 fn load to void 382 while true 383 c = next 384 if eq c -1 385 break 386 end 387 if eq c 78 388 if ne next 44 389 invalid 390 end 391 row 392 else 393 if or eq c 68 eq c 80 394 diagnostic 395 else 396 invalid 397 end 398 end 399 end 400 end 401 fn complete to void 402 for base ulong 180 403 arm = rem div base 4 5 404 for mode ulong 256 405 if validmode arm mode 406 if ne get Seen add mul base 256 mode 65535 407 invalid 408 end 409 end 410 end 411 end 412 end 413 fn counters idx ulong to void 414 number get Count idx 415 sep 416 number get Good idx 417 sep 418 number get Refuse idx 419 sep 420 number sub sub get Count idx get Good idx get Refuse idx 421 putout LF 1 422 end 423 fn rcounters idx ulong to void 424 number get Robust idx 425 sep 426 number get Rgood idx 427 sep 428 number get Rrefuse idx 429 sep 430 number sub sub get Robust idx get Rgood idx get Rrefuse idx 431 putout LF 1 432 end 433 fn identity base ulong to void 434 number seedvalue div base 60 435 sep 436 number rem div base 20 3 437 sep 438 number rem div base 4 5 439 sep 440 number budvalue rem base 4 441 sep 442 end 443 fn report to void 444 putout HEAD len HEAD 445 for base ulong 180 446 arm = rem div base 4 5 447 for mode ulong 256 448 if validmode arm mode 449 for scope ulong 2 450 putout TAG len TAG 451 identity base 452 number mode 453 sep 454 number scope 455 sep 456 counters add mul add mul base 256 mode 2 scope 457 end 458 end 459 end 460 for scope ulong 2 461 putout RTAG len RTAG 462 identity base 463 number 99 464 sep 465 number scope 466 sep 467 rcounters add mul base 2 scope 468 end 469 end 470 end 471 fn wrongcount idx ulong to ulong 472 ret sub sub get Count idx get Good idx get Refuse idx 473 end 474 fn learnedone si ulong sp ulong to bool 475 idx = add mul mul group si sp 2 3 256 2 1 476 baseline = add mul mul group si sp 3 3 256 2 1 477 fullfit = eq get Good mul mul group si 0 2 3 256 2 16 478 held = eq get Good idx 8 479 improve = gt get Good idx get Good baseline 480 safe = le wrongcount idx wrongcount baseline 481 putout LTAG len LTAG 482 number seedvalue si 483 sep 484 number sp 485 sep 486 number flag fullfit 487 sep 488 number flag held 489 sep 490 number flag improve 491 sep 492 number flag safe 493 putout LF 1 494 ret and fullfit and held and improve safe 495 end 496 fn learned to void 497 putout LHEAD len LHEAD 498 support = true 499 for si ulong 3 500 for split ulong 2 501 if not learnedone si add split 1 502 support = false 503 end 504 end 505 end 506 if support 507 putout YES len YES 508 else 509 putout NO len NO 510 end 511 end 512 fn main to int 513 if ne argcnt 1 514 invalid 515 end 516 load 517 complete 518 report 519 learned 520 if ne get Failed 0 0 521 putout FAIL len FAIL 522 ret 1 523 end 524 putout PASS len PASS 525 ret 0 526 end