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
| 1 | # seed/: a compiler chain born from nothing |
| 2 | |
| 3 | Drake's question: C was built from B, B from something older. If every old tool added mistakes or waste, |
| 4 | I would inherit all of it. So this folder grows a toolchain from a few hundred hand-written bytes, step by |
| 5 | step, with the existing C compiler and the GNU tools used only as a referee that checks the answers, never |
| 6 | as a builder. |
| 7 | |
| 8 | The current completeness audit (implemented areas, open compiler work, and what is blocked on a |
| 9 | decision or an external store) is `docs/one_layer/OM_COMPLETION.md`. |
| 10 | |
| 11 | The scalar OSC IR backends are `wasm/irwasm.om` (WebAssembly MVP) and |
| 12 | `spirv/irspirv.om` (SPIR-V 1.0 OpenCL Kernel). Both are compiled by seeded omc. |
| 13 | IR mode casts (`TYPE value`) read the operand at its own type and convert it, the same as the |
| 14 | AArch64 path, so `ret ulong sub c 48` with `c` a `uchar` compiles. A bare number in the cast is |
| 15 | range-checked against the cast's type (error 8) and a bool converts to or from a number only by |
| 16 | comparison (error 9). `seed/omc/gate-ir.sh` pins 21 cast units against the C oracle plus 6 cast |
| 17 | refusals; reverting the operand read to the cast's type makes the gate fail. |
| 18 | |
| 19 | See [SPIR-V usage, CPU parity gate and OpenCL demo](../docs/SPIRV.md). |
| 20 | |
| 21 | To rebuild omc from the 408-byte seed on your own AArch64 Linux machine and check every rung against |
| 22 | published hashes without touching tracked files, run `sh seed/challenge/run.sh` |
| 23 | (see [the seed-chain bootstrap challenge](challenge/CHALLENGE.md)). |
| 24 | |
| 25 | At commit `e5b32567` (2026-10-27) the compiler source `omc/omc.om` is 12,040 lines and 208,168 bytes |
| 26 | (sha256 `7703da00055fc0c7a91fcae43071df76a3f277dbe867cb284a3bdff3bedb7e1b`), and `out/omc` is |
| 27 | 325,524 bytes. The line, function and byte counts given in each rung section below were recorded when |
| 28 | that rung landed and are not current sizes. |
| 29 | |
| 30 | Think of it as a ladder. Each rung is a small program, written in the language the rung below understands, |
| 31 | and built by the rung below. Every rung must rebuild itself to the exact same bytes, which proves it reads |
| 32 | its own language the same way the rung below does. |
| 33 | |
| 34 | The only source for instruction bits is the public Arm Architecture Reference Manual (Arm document DDI 0487, |
| 35 | revision M.d, sha256 80d589a4...e3d5). Every instruction in every hand-written file names the manual section |
| 36 | it came from. |
| 37 | |
| 38 | ## Rung 0: seed-0 (done) |
| 39 | |
| 40 | - `rung0/seed0.hex`: the whole program, written by hand as 102 lines of 8 hex digits: 30 lines are the |
| 41 | file header Linux needs to start a program (each field explained on its line), 72 are machine |
| 42 | instructions (each one named, with its manual section). |
| 43 | - What it does: reads text, turns every 8 hex digits into one 32-bit word, writes the words out. It skips |
| 44 | comments (`#` to the end of the line) and spaces, and stops with an error on anything else. |
| 45 | - `rung0/seed0.bin`: the program, 408 bytes. |
| 46 | - The one outside tool: the very first `seed0.bin` was made by `rung0/load0.sh`, a 24-line (1,048-byte) |
| 47 | shell script that uses only the shell's own `printf`. After that first build, seed-0 builds itself. |
| 48 | - Checks (`rung0/gate0.sh`, results in `evidence/SEED-0/rung0/`): |
| 49 | - seed-0 reading its own text produces itself, byte for byte; |
| 50 | - every one of the 72 instructions is read back by two independent decoders (my own, in |
| 51 | `seed/check/a64check.om`, and GNU objdump), and both agree with the name written beside it: |
| 52 | 0 disagreements (`rung0/seed0.audit`, every word listed); |
| 53 | - controls: a wrong name is caught; a bad character and a half-written word are refused. |
| 54 | - Limit, said plainly: my own decoder does not know the "system call" instruction (SVC, 3 of the 72 |
| 55 | words) and does not read the immediate number of the compare instructions; for those, objdump and |
| 56 | the hand decode in the comment are the checks. |
| 57 | |
| 58 | ## Rung 1: hex1, labels (done) |
| 59 | |
| 60 | - `rung1/hex1.hex`: 164 instructions plus the 30-word header, written in seed-0's language and built by |
| 61 | seed-0 (776 bytes). |
| 62 | - What it adds: names for places. `:c` marks a spot in the program, `@c` after a branch word fills in |
| 63 | "how far to jump to c". That saves the writer from counting distances by hand, which is the most |
| 64 | error-prone part of writing machine words. Labels are one character long; there is one branch form |
| 65 | (the 19-bit distance field that conditional branches use; unconditional jumps use the "always" |
| 66 | condition so they fit the same form). |
| 67 | - Checks (`rung1/gate1.sh`, results in `evidence/SEED-0/rung1/`): |
| 68 | - seed-0 builds hex1; hex1 then rebuilds itself to the same bytes; |
| 69 | - I counted all 50 jump distances inside hex1 by hand. As a cross-check, a copy of hex1 with those |
| 70 | distances wiped out and replaced by labels (`rung1/hex1.hex1`) is fed to hex1: it gives back exactly |
| 71 | the same program, so hex1's arithmetic and my counting agree on every jump; |
| 72 | - both decoders agree with every named instruction (0 disagreements, `rung1/hex1.audit`); |
| 73 | - controls: seed-0 refuses labels (it never learned them); missing, doubled and misplaced labels are |
| 74 | refused with their own error codes. |
| 75 | |
| 76 | ## Rung 2: asm2, instructions by name (done) |
| 77 | |
| 78 | - `rung2/table.s2`: the instruction table, plain text. One line per instruction: its name, the bits that |
| 79 | never change, and where each operand goes, for example `= add.x 0x8b000000 r0 r5 r16` ("add, 64-bit: |
| 80 | destination register at bit 0, first source at bit 5, second at bit 16"). Each line names its |
| 81 | manual section. Anyone can read and check it without knowing how asm2 works inside. |
| 82 | - `rung2/asm2.hex1`: the assembler, 580 instructions written in hex1's language (with labels), built by |
| 83 | hex1 (2464 bytes). It reads the table first, then a program written with those names and with labels |
| 84 | of up to 16 characters, and writes the machine words. Mistakes stop it with the line number. |
| 85 | - Checks (`rung2/gate2.sh`, results in `evidence/SEED-0/rung2/`): |
| 86 | - hex1 builds asm2; asm2 written in its own language (`rung2/asm2.s`) assembles back into exactly |
| 87 | the same 2464 bytes, so the readable table and my hand-made words agree on all 580 instructions; |
| 88 | - both decoders agree with every named instruction (0 disagreements, `rung2/asm2.audit`); |
| 89 | - against the C encoder (the referee): every one of the 25 instruction forms it knows, 5,496 cases |
| 90 | with registers and numbers at their limits and jumps out to the farthest distance each form can |
| 91 | hold: asm2 and the C encoder give the same word every time (`encoder-compare.tsv`). There was no |
| 92 | disagreement, so the manual did not have to settle one; |
| 93 | - both refuse the same out-of-range numbers; each of asm2's error messages fires on a broken input. |
| 94 | - Limit, said plainly: the farthest plain jump (`b`, about 128 MiB away) cannot be tested through a |
| 95 | label because asm2's output buffer is 8 MiB; it is tested at its limits with the number written in, |
| 96 | and through labels up to 1,048,575 words. |
| 97 | |
| 98 | ## Rung 3: om3, a translator for Omegese (done) |
| 99 | |
| 100 | - `rung3/om3.s`: a translator from Omegese (the small program language the model writes, see |
| 101 | `docs/one_layer/OMEGESE.md`) to machine words. It is 1,486 instructions written in asm2's language and |
| 102 | built by asm2 (7,092 bytes, `rung3/om3.bin`). `rung3/table3.s2` adds 5 instruction lines to asm2's |
| 103 | table, each naming its manual section. |
| 104 | - What it reads: one Omegese function. What it writes: that function's machine words, ready to be called |
| 105 | the same way the existing C compiler's output is called (same rules for inputs, result and errors). |
| 106 | - The subset grew to what the 10 public practice tasks actually use: all nine number types, if/else, |
| 107 | while with a limit, for, return, and add, subtract, multiply, divide, remainder, and/or/xor, shifts, |
| 108 | comparisons, negate, not, and type conversions, each with the same error stops ("traps") as the C path: |
| 109 | overflow of a signed number, division by zero, a loop that runs past its limit, a conversion that does |
| 110 | not fit, a shift that is too far. It refuses, with its own error number, what the tasks do not use |
| 111 | (signed division, calls, arrays, more than one function). |
| 112 | - How it builds code: every name gets its own register for as long as it exists. The C path keeps every |
| 113 | value in memory and loads and stores it around each step (that is its documented design, OSC-1 design |
| 114 | section 7, "no register allocation"), so a difference in word counts below measures that choice. |
| 115 | - Checks (`rung3/gate3.sh`, results in `build/seed/r3/evidence/`, compared with the recorded receipt |
| 116 | `evidence/SEED-0/rung3/`, never written over it): |
| 117 | - asm2 builds om3 twice to the same bytes; objdump (the referee) reads every one of the 1,486 |
| 118 | instructions back to the name, registers, numbers and jump targets written in `om3.s`: |
| 119 | 0 disagreements (`rung3/om3.audit`); five planted mistakes in the text are each caught; |
| 120 | - the 10 public practice tasks, 80 test inputs in all, 9 of them ending in an error stop: the functions |
| 121 | om3 makes give exactly the same result as the C path (`omegese emit`, `omega_emit`, the C back end), |
| 122 | down to the raw 64-bit register, and the same as each task's expected answers. The same runner |
| 123 | (`check/runner.c`, a referee) calls both; |
| 124 | - every word om3 made is a real instruction; om3 refuses 14 broken or out-of-subset programs, each |
| 125 | with its own error number. |
| 126 | - Words of machine code per task (counts only, no timing; `evidence/SEED-0/rung3/words.tsv`): |
| 127 | |
| 128 | | task | C path | seed chain | |
| 129 | |---|---:|---:| |
| 130 | | dev01 clamp_add | 58 | 17 | |
| 131 | | dev02 absdiff | 48 | 16 | |
| 132 | | dev03 popcount | 80 | 15 | |
| 133 | | dev04 gcd | 71 | 20 | |
| 134 | | dev05 checked_mul | 23 | 9 | |
| 135 | | dev06 safe_div | 21 | 8 | |
| 136 | | dev07 isqrt | 95 | 29 | |
| 137 | | dev08 collatz_steps | 111 | 28 | |
| 138 | | dev09 bitrev8 | 73 | 14 | |
| 139 | | dev10 to_i8 | 20 | 8 | |
| 140 | | total | 600 | 164 | |
| 141 | |
| 142 | Said plainly: the seed chain uses fewer words on every task, 164 against 600 in total (27%). Most of |
| 143 | the gap is the C path's chosen design (every value goes to memory and back, see above), not a defect |
| 144 | carried down from older tools. |
| 145 | ## Rung 4: om4, the systems words a compiler needs (done) |
| 146 | |
| 147 | - `rung4/om4.s`: om3 grown, feature by feature, into a translator that can build a real program. It is |
| 148 | about 4,000 lines in asm2's language, built by asm2 (14,224 bytes, `rung4/om4.bin`); `rung4/table4.s2` |
| 149 | adds 3 instruction lines for om4's own use, each naming its manual section; `rung4/mk4.sh` writes the |
| 150 | file's own size into its header (asm2 cannot add up sizes). |
| 151 | - Function table: 4096 entries of 128 bytes at 0x19f0000, past the call records, so om4 holds the same |
| 152 | 4096 functions as omc (the 4097th is error 14, `gate4.sh` section 7b). Through om4 `d0da40e4` the |
| 153 | table had 512 entries at 0x1840000, and `omc.om` itself had to stay within them. The move changes |
| 154 | five instruction words and the `p_memsz` word, not the file size; the omc that om4 births is byte-identical. |
| 155 | - What it adds, and why each one is needed (every new word is used by the Omega compiler of rung R5 or |
| 156 | by the test programs): |
| 157 | - many functions, and a names pass so a call may name any function in the unit, earlier or |
| 158 | later (a later function is a call, never a new scalar). Program mode may recurse mutually. |
| 159 | Function mode refuses a call cycle, including a function calling itself, as error 9; |
| 160 | |
| 161 | - whole programs: a source with `fn main` comes out as a complete Linux program, file header laid |
| 162 | out by hand, no linker; it runs, reads its input, writes its output and exits; |
| 163 | - fixed pools (`global`): memory for the source text, the tables and the output, sized when the |
| 164 | program is translated. There is no heap at all, by Drake's rule 24; |
| 165 | - local arrays (`new`), array inputs to functions (`view` read-only, `edit` writable), `get`, `put`, |
| 166 | `len`; every array carries its length and every index is checked. There is no `free`: nothing is |
| 167 | ever given back by hand (rule 24); fm7 and fm8, shared with the C path whose language needs `free`, |
| 168 | are given to om4 without their `free` lines; |
| 169 | - `text`: a fixed piece of bytes (an error message, the keyword list), stored with its length; |
| 170 | - `read`, `write`, `exit`: the three Linux calls a compiler needs (stdin in, stdout out, a status); |
| 171 | - signed divide, remainder and shift, `true`/`false`, `for` with a computed count, `note` lines. |
| 172 | The exact meaning of every new word, and which check tests it, is in `docs/one_layer/OMEGESE.md` |
| 173 | section 9. |
| 174 | - Rules from the B-to-C lessons (Drake, decisions 16-24), and how om4 keeps them: |
| 175 | - no terminator bytes: arrays and texts know their length (om4 itself no longer looks for an end |
| 176 | byte in its input); an array written without its length is refused; |
| 177 | - no pointers: you can only index an array, and the index is checked; |
| 178 | - no hidden sharing: the same array cannot be passed twice in one call, and a global pool is never |
| 179 | passed at all, so two names never point at the same memory; |
| 180 | - no undefined behaviour: unsigned numbers wrap, signed numbers stop with an error ("trap") when they |
| 181 | overflow, division by zero traps, a bad index traps, running out of stack traps; the spec has no |
| 182 | "undefined" in it (the gate checks with a search); |
| 183 | - no automatic conversions: mixing two types in one operation is refused; |
| 184 | - capacities (decision 23): input past a capacity is refused with error 14, never overrun. om4 keeps |
| 185 | its fixed tables. Amended 2026-11-11 for omc (Drake: no hard caps on our own software; notice and |
| 186 | fix instead): omc's tables grow in one arena, which itself grows at run time (a run-time pool, |
| 187 | `docs/RUNTIME-POOLS.md` landing 2), so the refusals left are the host refusing that growth and value |
| 188 | nesting past omc's own stack, and a test alarms on usage instead (`seed/omc/gate-usage.sh`, `gate-nocaps.sh`; |
| 189 | `docs/one_layer/OMEGESE.md` 9.6). |
| 190 | - Checks (`rung4/gate4.sh`, results in `build/seed/r4/evidence/`, compared with the recorded receipt |
| 191 | `evidence/SEED-0/rung4/`, never written over it), 217 cases, all pass: |
| 192 | - asm2 rebuilds om4 to the same bytes; objdump (the referee) reads all 3,170 instructions back to |
| 193 | what `om4.s` says (0 disagreements); five planted mistakes in the text are each caught; |
| 194 | - the 10 practice tasks: om4 makes exactly the same machine words as om3, and the same results as the |
| 195 | C path (80 inputs) and the expected answers; |
| 196 | - 9 new programs in the old calling form that the C path can also express (signed divide and |
| 197 | remainder at their limits, signed shifts, calls, computed loop counts, local arrays, a bad index): |
| 198 | om4 and the C path give the same result or the same trap on all 69 inputs; |
| 199 | - 4 whole programs against committed expected outputs (no C twin at runtime): recursive |
| 200 | Fibonacci, sorting 1,000 numbers, echo of 50,000 fixture bytes, a byte copy that reverses its input: |
| 201 | same output every time; |
| 202 | - 14 whole programs that must stop with a given status or value (among them 2^64 - 1 and 2^63 read as |
| 203 | ulong numbers, fixed after the independent interpreter L412 found om4 refused them): divide by zero, bad index, read past the end, loop |
| 204 | limit, bad conversion, overflow, stack used up, `exit`, and a void call: each stops as written; |
| 205 | - 41 broken or forbidden programs are refused, each with its own error number, among them a value |
| 206 | nested 1,025 deep (om4 used to crash on very deep nesting; it now stops at 1,024 with error 14); |
| 207 | - a copy of om4 with one instruction word changed (signed divide made unsigned) gives different |
| 208 | results, so the checks would notice such a slip. |
| 209 | - Machine words per program, where the C path can express it (`evidence/SEED-0/rung4/words.tsv`): |
| 210 | the 10 practice tasks are the same 164 words as om3 (C path 600). The 9 new programs: C path 552, |
| 211 | om4 267. One is larger than the C path: the program with three calls (79 against 59), because each |
| 212 | call saves and restores every register in use. |
| 213 | - Limits, said plainly: variable names are at most 8 characters; a function may use at most 16 |
| 214 | registers for its names and working values (om4 stops with error 12 beyond that). `omegese next` (the |
| 215 | C tool that lists the legal next words) does not know the new words, so the next-word check for them |
| 216 | is my own (decision 22, gate4 section 10, `check/nextfuzz.sh`): 20 random programs using every new |
| 217 | word are generated (`check/nextgen.awk`) and all accepted; then each is cut after every word and has |
| 218 | each word swapped for a wrong one, 4,860 inputs, and om4 answers every one with its result or an error |
| 219 | number, never a crash. |
| 220 | |
| 221 | |
| 222 | ## Rung 5: Atlas reborn (done) |
| 223 | |
| 224 | - `atlas/atlas.s2`: the Atlas boot image (the first program the emulated machine runs, which checks the |
| 225 | next stage's fingerprint before handing over), written line for line from `~/workspace/atlas/atlas.s` |
| 226 | and its SHA-256 code in asm2's language. The way the old linker placed the pieces (code at 0, messages, |
| 227 | fingerprint, constants, the SHA-256 code from byte 384, its table at byte 1224) is written out by hand |
| 228 | in the same file. `atlas/table5.s2` adds 28 instruction lines, each naming its manual section. |
| 229 | - Built by asm2, with no GNU assembler and no linker: `atlas/atlas.bin`, 1,480 bytes. |
| 230 | - Checks (`atlas/gate5.sh`, results in `build/seed/r5/evidence/`, compared with the recorded receipt |
| 231 | `evidence/SEED-0/rung5/`, never written over it): |
| 232 | - asm2 builds it twice to the same bytes, and it is byte for byte the audited Atlas image |
| 233 | (sha256 f7802501...a5): no difference, so the manual had nothing to settle; |
| 234 | - objdump (the referee) reads all 263 instructions back to what `atlas.s2` says: 0 disagreements; |
| 235 | five planted mistakes are caught; |
| 236 | - the existing Atlas M1 tests (`run_m1_gates.sh`, not edited) pass on a scratch copy of the Atlas folder |
| 237 | holding the asm2-made image: the SHA-256 known answers, the static audits, and in QEMU the boot |
| 238 | (AWAKEN, VERIFY, HANDOFF) and the refusal of every corrupted next stage. `~/workspace/atlas` was |
| 239 | only read. |
| 240 | |
| 241 | ## Rung R5: omc, the Omega compiler written in Omega (done) |
| 242 | |
| 243 | - Born from the seed, not from C: `make omega-from-seed` (or `sh seed/omega-from-seed.sh`) turns |
| 244 | the hand-written `seed0.hex` into seed0 with the one named outside step (`load0.sh`, POSIX printf), |
| 245 | then seed0 builds hex1, hex1 builds asm2, asm2 builds om4, om4 builds omc, and omc builds itself |
| 246 | twice. The two self-builds must be the same bytes. The compiler is left at `seed/out/omc`, with |
| 247 | its sha256 beside it. That file is the Omega compiler. Nothing in that path is C. |
| 248 | |
| 249 | - `omc/omc.om`: the compiler itself, written in Omegese, using only words om4 understands. It reads a |
| 250 | program on its input and writes a ready-to-run Linux program (or, without `fn main`, bare machine |
| 251 | words) on its output, with the file header laid out by hand and no linker. 3,212 lines, 125 functions. |
| 252 | `omc/genkw.awk` once wrote the keyword chain into `omc.om`; the committed `omc.om` is the source, |
| 253 | and the generator now lists every keyword (including host words 100-134) and packs 64-bit words |
| 254 | exactly with decimal string arithmetic (verified against the chain: 0 mismatches). |
| 255 | and the seed path does not run awk. |
| 256 | - It is meant to do exactly what om4 does, word for word: the same machine words, the same error |
| 257 | numbers, on the same line. That is on purpose: om4 then becomes a strict referee for omc, because any |
| 258 | difference at all is a mistake. It is checked on every input listed below, not on every possible one. |
| 259 | - How it is built: om4 translates `omc.om` into a program (stage 1, 76,748 bytes). Stage 1 then |
| 260 | translates `omc.om` again (stage 2), and stage 2 translates it a third time (stage 3). |
| 261 | - The few places where the language shaped the design: |
| 262 | - a names pass reads every signature first, so a call may name a function written later. |
| 263 | Reading a value is still one function that calls itself, because a value contains values; |
| 264 | - every working number is kept as a plain 64-bit value, because the language refuses mixed types; |
| 265 | - every loop over the input is two loops inside each other. A single loop stops itself after a |
| 266 | million passes, and om4 has no such limit on input size. |
| 267 | - Historical R5 checks (`omc/gate5.sh`, retained results in `evidence/SEED-0/omc/`), 177 cases, all pass: |
| 268 | - (a) self-rebuild: stages 1, 2 and 3 are the same file (sha256 191b776e...98e9), so omc translates |
| 269 | itself the same way om4 translates it; |
| 270 | - (b) a second route: the C path (the older compiler written in C) cannot read `omc.om`. It lacks |
| 271 | global pools, a function calling itself, arrays over 64 cells, text, `read`/`write`, `exit`, and a |
| 272 | colon inside a note. Also it makes a file for a test runner, not a program. The gate tries each of |
| 273 | these and requires the refusal to name that word, so it notices if the C path learns one. So, as the brief allows, the two parents |
| 274 | are om4 and omc itself: both build the same omc. This is weaker than a truly independent route, |
| 275 | because one author designed both; |
| 276 | - om4 and stage 2 agree on 147 of the 153 inputs: every input gate4 gives om4, every Omegese file in the |
| 277 | repo, and `omc.om`. They agree on output, exit status, and the error number and line of all 57 refusals. |
| 278 | The other 6 are repo programs that use words omc added beyond om4 (grouping parentheses, trap, fixed-width |
| 279 | type names); each is listed in `seed/omc/tests/om4-superset.tsv` by the sha256 of its text with om4's |
| 280 | refusal and omc's exit, and the C path must accept it. A difference not on the list, a listed program that |
| 281 | no longer differs, a listed program the corpus does not reach, or one the C path refuses fails the gate; |
| 282 | - what that list missed, found by an outside review: no program in it wrote out a text successfully, |
| 283 | and error numbers 1, 2, 4, 11, 12, 13 and 14 never came up. Now a program writes a text with every |
| 284 | escape and must give fixed bytes and a fixed exit value (204, worked out by hand, not taken from om4), |
| 285 | and each of those errors has its own case. The gate then checks that every error number from 1 to 23 |
| 286 | comes up somewhere, from both om4 and omc; |
| 287 | - the next-word fuzz (decision 22, below): om4 and omc give the same answer on 4,860 cut or altered |
| 288 | programs; |
| 289 | - (c) the whole of gate4 run with stage 2 in om4's place passes (116 checks): the 10 practice tasks |
| 290 | and 9 programs give the C path's results and traps; the 4 whole programs match their gcc-built |
| 291 | twins; its refusals give the same numbers. Table: `evidence/SEED-0/omc/corpus-words.tsv`; |
| 292 | - (d) planted mistakes. A changed word that omc itself uses (`or` made into `and`) breaks the |
| 293 | self-rebuild and the comparison with om4. A changed word omc does not use (signed divide made |
| 294 | unsigned) keeps the self-rebuild, which shows a self-rebuild alone proves too little, but the om4 |
| 295 | comparison catches it. The same wrong word put into both om4 and omc fools both of those checks, |
| 296 | and only the C path catches it (fm1, fm2: -7 / 2). A broken program is refused with error 3; |
| 297 | - the output does not change with the run: same bytes under another environment and a second later. |
| 298 | - Historical R5 size and speed (`size.tsv`, `size-history.tsv`, `omc-words.tsv`, `compile-time.tsv` |
| 299 | in `evidence/SEED-0/omc/`; these receipts are immutable): |
| 300 | - omc is 19,143 machine words; the largest functions are the value reader (2,073 words) and local |
| 301 | arrays (695); |
| 302 | - on the programs the C path can also translate, omc makes the same words as om4. The 10 practice |
| 303 | tasks take 164 words (C path 600); the 9 others take 267 (C path 552). The one larger than the C |
| 304 | path is still fm5, the program with three calls (79 against 59); |
| 305 | - time to translate one program (10 practice tasks and 9 others), 200 runs each, including starting it: |
| 306 | omc 0.4 to 0.6 ms, the C path 5.9 to 6.7 ms (it runs two programs and writes a file in between). |
| 307 | omc translates itself in 2.6 ms. These are not compared against the machine's limit (not measured). |
| 308 | - Current `omc/gate5.sh` writes disposable results to `build/seed/r5/evidence/`, never over historical |
| 309 | receipts. `seed/omc/size-history.tsv` is the living measured-size ledger, initially copied byte for |
| 310 | byte from the historical ledger. Before qualifying a compiler change, append its observed source |
| 311 | line/function counts, emitted word count and compiler SHA-256. The gate checks that the **last** |
| 312 | row names its independently rebuilt stage2; missing, empty or stale ledgers fail. It never updates |
| 313 | its own prerequisite. Keep durable runs under a new evidence directory. |
| 314 | - Current size reporting measures the complete compiler only. Compiling incomplete source prefixes |
| 315 | is not a valid per-function measurement in a compiler with forward references; that old diagnostic |
| 316 | was removed. All parent, C-referee, wrong-word-mutant, fuzz and refusal checks remain mandatory. |
| 317 | - The branch-range gate is seeded `.om`, including its coordinator, generator, source mutator |
| 318 | and decoder-output checker. See `seed/qualification/security673/README.md` for reconstruction. |
| 319 | The compiler accepts the exact forward maximum and refuses larger conditional branches |
| 320 | before emitting an executable. Direct probes of the actual encoder cover both signed extrema |
| 321 | and misalignment; a local-array fixture exercises the current backward caller. GNU objdump |
| 322 | independently decodes accepted forward branches and catches a deliberately weakened limit. |
| 323 | Malformed-output controls and supervisor failures are separate from compiler correctness. |
| 324 | Corrected evidence is in `evidence/SECURITY-673/correction1/`; earlier evidence is historical. |
| 325 | - Limits, said plainly: omc has om4's limits, because it copies om4 (names up to 8 characters, 16 |
| 326 | registers per function, values nested up to 1,024 deep, 8 MiB of input). |
| 327 | |
| 328 | ## Rung R6, first piece: structs (done for the language; GPU words still open) |
| 329 | |
| 330 | om4 does not learn structs. It remains the parent that rebuilds omc, and omc.om does not use the new |
| 331 | words, so the two parents still build the same compiler. A struct program is a stack of 8-byte cells, |
| 332 | given back when the function returns. There is no `free`. |
| 333 | |
| 334 | - `seed/omc/gate6.sh`, 26 cases, RC=0. The compiler built by om4 and the compiler built by itself are |
| 335 | the same file, sha256 01b1545b23e8ff40cb5691e20b5df910ea4acaefde3495f0d62d270465b98cd6 (93,184 bytes). |
| 336 | omc.om is 3,772 lines, 149 functions. |
| 337 | - Twelve programs run and exit with the value worked out in Wolfram (`evidence/SEED-0/r6-structs/wolfram.txt`), |
| 338 | not copied from this compiler. Three of them (t7, t8, t9) would change that value if a field were |
| 339 | stored at the wrong width. A one-word field swap changes the exit from 20 to 22, so a gate that |
| 340 | ignored field names would fail. |
| 341 | - Thirteen broken programs are refused with the stated error number. om4 itself refuses a struct |
| 342 | program (exit 16). `free` is still refused. |
| 343 | - Not in this piece: a kernel on the chip. That stays on L408. The experimental single-function |
| 344 | OSC IR emitter from `fix/seed-ir-trap` is now part of this line; see rung R8. |
| 345 | |
| 346 | ## Rung R6b: one compiler line, structs and native host operations (done) |
| 347 | |
| 348 | Structs and the native host extension were built on separate branches from R5. They are now one |
| 349 | compiler: `seed/omc/omc.om`, 4,616 lines and 173 functions, accepts both. The keyword table keeps |
| 350 | both islands with no id shared (struct 85; host words 100 to 131). |
| 351 | |
| 352 | - self-rebuild: stage1 = stage2 = stage3, sha256 |
| 353 | `1a25cf0be96972206d6904638ded6729c65b69a12c788d7fe370e6dadd22e533` (126,528 bytes). |
| 354 | - `seed/omc/gate6.sh` passes its 26 struct cases; struct programs stay omc-only (om4 error 16). |
| 355 | - `seed/host/check.sh` passes every host case and the 70 original corpus fixtures. The om4/omc |
| 356 | corpus leaves out `seed/omc/tests/struct/`: om4's refusal there is the documented om4-only limit |
| 357 | (decision 32), and gate6 owns that check. |
| 358 | Correction (2026-10-26): the selector at `ec07d25d` actually retains 62 cases; |
| 359 | `seed/host/original-fixtures.tsv` now fixes their paths and expected parent |
| 360 | statuses. The former content filters must not silently shrink qualification. |
| 361 | - `seed/host/tests/structfile.om` is one program that builds a struct, creates and writes a file |
| 362 | through the native host words, closes and unlinks it, and returns a struct field; `gate.sh` runs it. |
| 363 | |
| 364 | ## Rung R7: break and trap (done) |
| 365 | |
| 366 | Section 3 listed both words while the compiler refused them (keyword 77). omc now implements them |
| 367 | (86 and 87) with the following semantics, and `seed/omc/gate7.sh` checks each one (11 cases plus the |
| 368 | om4 refusal); `seed/host/check.sh` runs gate7. |
| 369 | |
| 370 | - `break` leaves the innermost `while` or `for`. Outside a loop it is error 9. Like `ret` it ends the |
| 371 | path, so a later line in the same block is error 17. Its branch is recorded with the loop's block |
| 372 | index, patched when that loop closes, and marked spent, so a later loop reusing the slot cannot move |
| 373 | an earlier break. 1024 sites per function (error 14). |
| 374 | - `trap N` takes 1..14 (error 8 out of range, error 4 when the line ends, 16 when the token is not a |
| 375 | number). Program mode exits 100 + N; function mode calls `OscRt.trap` through the same stub the |
| 376 | runtime checks use. A later line in the same block is error 17. |
| 377 | |
| 378 | ## Rung R8: OSC IR output, one line (experimental checkpoint) |
| 379 | |
| 380 | `fix/seed-ir-trap` added a leading `ir` line that writes OSC IR version 1 for one function instead of |
| 381 | AArch64 words. It branched from R6, so it lacked the native host words and break/trap. It is now part |
| 382 | of the same compiler: `seed/omc/omc.om`, 5,395 lines and 209 functions, sha256 |
| 383 | `2b029a217e8f2d033b484dec3a5a24570370b8a139157f4204358e226d1e5bd9` (149,904 bytes). |
| 384 | |
| 385 | - `seed/omc/gate-ir.sh` passes: 10/10 dev programs are byte-identical to the C-built `omegese` + |
| 386 | `omega_emit` oracle, `checker2` ACCEPTs every unit, and the mul-to-add mutant differs. The C tools |
| 387 | are referees only. |
| 388 | - IR mode is still one function and scalar values. It refuses `struct`, the native host words and |
| 389 | `break` with error 3, because none has an IR lowering yet. Multifunction IR, struct IR and refusal |
| 390 | hardening remain open. |
| 391 | - `seed/host/check.sh` runs gate-ir only when the three oracle binaries exist, and prints `SKIP` |
| 392 | with the build command otherwise; the compiler itself still needs no C tool. |
| 393 | |
| 394 | ## Rung R9: f32 and f64 (done) |
| 395 | |
| 396 | IEEE-754 binary32 and binary64 are now part of the language, written in omc (`f32`, `f64`, |
| 397 | `bitcast`, decimal literals, arithmetic, comparisons and conversions). A float value is its bit pattern in an |
| 398 | ordinary integer register; arithmetic moves it to v0/v1, runs one scalar FP instruction and moves it |
| 399 | back, with FPCR untouched and no fused operation. |
| 400 | |
| 401 | - `seed/omc/omc.om`, 6,241 lines and 233 functions, sha256 |
| 402 | `f769b4a8c2ecd9006ade38b5d10c6d3e12bd3044b7418a3a87b6b4e2731c824a` (169,276 bytes). |
| 403 | - `seed/omc/gate8.sh` passes 21 cases: exact bits for 1.5, 0.1, pi, 1e-3 and -0.0 in both widths; |
| 404 | arithmetic; IEEE comparisons including NaN; fsqrt, fabs, fmin and fmax with minNum/maxNum and -0.0 |
| 405 | ordering; int<->float and f32<->f64 conversions with saturation; float arrays, pools, parameters, |
| 406 | returns and struct fields; and refusals for mixed types, integer intrinsic operands, ambiguous |
| 407 | literals, float indices, float `for` counts, `read`/`write` on float arrays, malformed literals, |
| 408 | out-of-range literals and IR mode. om4 refuses float syntax, and the gate checks that. |
| 409 | - Limits, said plainly: the significant digits of a literal must fit in 2^63-1 (error 8 beyond |
| 410 | that); the decimal scale is unlimited, and the full IEEE range is converted exactly, subnormals |
| 411 | included. A literal that rounds to infinity is refused (error 8); underflow gives signed zero. |
| 412 | Struct fields may be floats (an f32 field still uses an 8-byte cell). IR lowering of floats is not |
| 413 | implemented and is refused, not miscompiled. |
| 414 | |
| 415 | ## Rung R10: grouping parentheses (done) |
| 416 | |
| 417 | The design says brackets are optional and separate words; the lexer did not implement that, so |
| 418 | `(5)` was read as one unknown name. `tok2` now emits `(` and `)` as one-character tokens even when |
| 419 | they touch a value, and the existing group path returns the inner value with no code. |
| 420 | |
| 421 | - `seed/omc/omc.om`, 6,252 lines and 233 functions, sha256 |
| 422 | `89887ff473e89f870f8f1dbd1e2b46f008ad076ef168480238ac1ec1bc3e557a` (169,428 bytes). |
| 423 | - `seed/omc/gate9.sh` passes 4 cases: grouped integers, nested groups, a grouped float expression, |
| 424 | the still-ambiguous `x = (5)` (error 11) and an unclosed group (error 16). |
| 425 | - No existing program changes meaning: the om4/omc byte-equality corpus continues to pass with the |
| 426 | paren fixtures excluded, since om4's lexer does not split them. |
| 427 | |
| 428 | ## Rung R11: full-range decimal literals (done) |
| 429 | |
| 430 | The first float slice converted `N * 10^p` only while both factors fit u64 (scale at most 18). The |
| 431 | converter now keeps a normalized 64-bit significand, a binary exponent and one sticky bit |
| 432 | (`fmul10`/`fdiv10`), rounds once to nearest even (`froundsh`) and packs with subnormal handling |
| 433 | (`fpack`). No 128-bit integer and no double rounding are needed. |
| 434 | |
| 435 | - `seed/omc/omc.om`, 6,259 lines and 234 functions, sha256 |
| 436 | `7453603d943a5bb75e85b672bbbbd200abfe12a38b040b8521cf00a2beac29ef` (169,636 bytes). The restricted |
| 437 | long-division converter and its state are removed, not left beside the new one. |
| 438 | - The expected bits for 50 literals were produced with `strtod`/`strtof` outside this compiler and |
| 439 | matched exactly: 0.1, pi, 6.02214076e23, 1.602176634e-19, 1e308, 5e-324, 1e-45, the maximum finite |
| 440 | values, values just below the overflow boundary, and values that underflow to zero. |
| 441 | - `gate8` now has 23 cases: the two literal fixtures cover large and subnormal values, and |
| 442 | `neg_overflow2`/`neg_overflow3` check that a literal which rounds to infinity is refused. |
| 443 | - Correction (#1024, #1026): the per-digit `fmul10`/`fdiv10` steps truncated at every factor of ten, |
| 444 | so some literals came out one ulp low (6816.702656e-27 gave 0x3B207B55A6D4A12F, not ...130; |
| 445 | 2.4703282292062328e-324 gave 0, not 0x1). `fbits` now forms the exact quotient of two integers in |
| 446 | 40 32-bit limbs (`fbmul`, `fbpow`, `fbsub`) and rounds once. `gate8 lit_round` checks 512 literals |
| 447 | against `seed/omc/float-lits.py`'s exact rational oracle, and `float-lits.py diff OMC N SEED` is |
| 448 | the randomized differential (1,000,000 literals, seed 1024: 0 mismatches). An integer literal under |
| 449 | a float type, formerly stored as raw bits, is now error 7 (`gate8 neg_int_*`). |
| 450 | |
| 451 | ## Rung R12: layout queries (done) |
| 452 | |
| 453 | `sizeof T` / `sizeof S` and `offsetof S f` are compile-time constants of type ulong over the same |
| 454 | 8-byte-cell layout that `new`/`get`/`put` use. They add no code and compose in expressions, which is |
| 455 | the primitive that structure formats and the future C ABI work need in order to describe a layout |
| 456 | without hard-coded numbers. |
| 457 | |
| 458 | - `seed/omc/omc.om`, 6,315 lines and 236 functions, sha256 |
| 459 | `1912bef8638c39ef8730d2ec3bddff3a9169f00f21613b5f5e68a55375847f34` (171,076 bytes). |
| 460 | - `seed/omc/gate10.sh` passes 5 cases: every scalar size, a struct with scalar and array fields |
| 461 | (size 40, offsets 0/8/16), composition in an expression, and refusals (unknown type 16, unknown |
| 462 | struct or field 3, `sizeof void` 9). |
| 463 | |
| 464 | ## Rung R13: keyword compatibility (done) |
| 465 | |
| 466 | The first float slice spelled its words `bits`, `sqrt`, `abs`, `min` and `max`. Auditing the 103 |
| 467 | `.om` files of the benchmark corpus against the pinned compiler (`e5d60db8…`) showed seven refusals: |
| 468 | existing code uses `bits` as a parameter or variable in six files and `min` in one. A keyword may not |
| 469 | take a name that existing code uses, so the float words are now `bitcast`, `fsqrt`, `fabs`, `fmin`, |
| 470 | `fmax` (ids unchanged). |
| 471 | |
| 472 | - Re-running the same audit after the rename: 103 files, 0 output differences, 0 crashes against the |
| 473 | pinned compiler, so every existing program still compiles to identical machine code. |
| 474 | - `seed/omc/gate11.sh` pins the rule: `bits`, `min`, `max`, `abs` and `sqrt` are usable as names |
| 475 | (`names.om`, exit 10), while `bitcast` is a keyword (`neg_reserved.om`, error 16). |
| 476 | - `seed/omc/omc.om`, 6,315 lines and 236 functions, sha256 |
| 477 | `c7f4fc4fac585653226468251ca86e1900ff7f51e9f731687cc2e176702c7f8d` (171,088 bytes). |
| 478 | - The audit method and result are recorded in `evidence/SEED-0/keyword-compat/README.md`. |
| 479 | |
| 480 | ## Rung R14: continue (done) |
| 481 | |
| 482 | `break` had no counterpart. `continue` now finds the innermost loop like `break`, but its branch is |
| 483 | patched to the loop's latch instead of its exit: the head of a `while`, so the condition and the |
| 484 | hidden bound count run again, or the increment of a `for`, so the counter still advances. It uses the |
| 485 | same fixup discipline (recorded with the loop's block index, patched when that loop closes, then |
| 486 | marked spent) and the same 1024-site limit per function. |
| 487 | |
| 488 | - `seed/omc/gate7.sh` now has 18 cases: while (18), for (12), nested (36), an empty `for` body that |
| 489 | still terminates, a bounded while that still traps 4 (exit 104), and refusals (error 9 outside a |
| 490 | loop, error 17 for a later line). om4 refuses the word, which the gate also checks. |
| 491 | - Auditing the benchmark corpus again after adding the keyword: 103 files, 0 output differences, |
| 492 | 0 crashes against the pinned compiler. |
| 493 | - `seed/omc/omc.om`, 6,374 lines and 237 functions, sha256 |
| 494 | `068a9675ca20699433cd51b468703012cdbc12cfd5ea0e9204a1d0dc1ca7544e` (172,296 bytes). |
| 495 | |
| 496 | ## Rung R15: benchmark parity audit (evidence) |
| 497 | |
| 498 | The current compiler was checked against the benchmark-pinned compiler over the real benchmark |
| 499 | workspace, not just this repository's fixtures: |
| 500 | |
| 501 | - 103 authored `.om` sources: 0 output differences, 0 crashes. |
| 502 | - 53 `om/build.plan` targets (each a concatenation of 2 to 21 units, including `prime_race`, the |
| 503 | JSON/measure/stream tools and every test target): 0 differences, 0 crashes. |
| 504 | - `prime-reference` runtime behaviour on six requests (two primes, a pseudoprime, two counts and a |
| 505 | raw bitmap): identical stdout, stderr and exit status. |
| 506 | |
| 507 | Method and per-scope counts: `evidence/SEED-0/benchmark-parity/README.md`. The corpus is external, |
| 508 | so this is evidence rather than a gate. |
| 509 | |
| 510 | ## Rung R16: IR refusals (done) |
| 511 | |
| 512 | IR mode used to consume non-`fn` top-level tokens and silently skip them, so a `struct`, `global` or |
| 513 | `text` declaration simply vanished from the IR. `ir_run` now classifies every top-level token: blank |
| 514 | lines and `note` lines are skipped, `fn` goes through the IR path, a `struct`/`global`/`text` |
| 515 | declaration is error 9, and any other token is error 16. Nothing is lowered by accident. |
| 516 | |
| 517 | - `seed/omc/gate-ir.sh` still proves 10/10 dev programs byte-identical with checker2 ACCEPT, and now |
| 518 | also checks five refusals: struct, global and text declarations (9), a float use and a continue |
| 519 | use (3). |
| 520 | - `seed/omc/omc.om`, 6,391 lines and 237 functions, sha256 |
| 521 | `22be10f8cccd23de1830e06ddb1c28ba77c7e78a6d7284bd1334fc18908a0cd8` (172,640 bytes). |
| 522 | |
| 523 | ## Rung R17: getrandom (done) |
| 524 | |
| 525 | `random A off n flags` fills a writable `uchar` slice from Linux `getrandom` through the same |
| 526 | host-word path as the other slice operations: `off`/`n` are bounds-checked (trap 3), a `view` or |
| 527 | `text` is refused (error 20), and `flags` is a typed `int`. It returns the bytes written or -errno; |
| 528 | unknown flags return -EINVAL. |
| 529 | |
| 530 | - The host gate compiles and runs `seed/host/tests/random.om`: exactly 8 bytes, not all zero, two |
| 531 | calls differ (a byte-for-byte comparison), and flags 8 is refused with a negative result. |
| 532 | - Auditing the benchmark corpus after adding the keyword: 103 files, 0 output differences, 0 crashes. |
| 533 | - `seed/omc/omc.om`, 6,414 lines and 238 functions, sha256 |
| 534 | `7326b100d3c85d4e58707deb8a8c3cf826b6dcc55280b3ffb3e76272cc07eaa8` (173,472 bytes). |
| 535 | |
| 536 | ## Rung R18: environment access (done) |
| 537 | |
| 538 | `envcnt` and `envread index A off capacity` read the process's own environment vector, which the |
| 539 | start code preserves in X27 beside argv. `envp[0]` sits at `X27 + 8*(argc+2)`; `envread` walks the |
| 540 | entries before the requested index, so an index at or past the count traps 3. The slice rules match |
| 541 | `argread`: bounds trap 3, a `view`/`text` is refused (error 20), and a short buffer returns -105 |
| 542 | without modifying it. |
| 543 | |
| 544 | - The host gate runs with `OMTEST=hello` in both a full and a minimal environment, finds the entry |
| 545 | byte-for-byte, checks the short-buffer refusal and checks that `envread envcnt` exits 103. |
| 546 | - Auditing the benchmark corpus after the two keywords: 103 files, 0 output differences, 0 crashes. |
| 547 | - `seed/omc/omc.om`, 6,466 lines and 238 functions, sha256 |
| 548 | `cd928e07506a505a7ec4e2b9f018bde6df20d56b9b59d7c13e7d50ebe81ba8fc` (176,048 bytes). |
| 549 | |
| 550 | ## Rung R19: chdir (done) |
| 551 | |
| 552 | `chdir A off n` changes the working directory through the same checked-path machinery as |
| 553 | open/unlink/mkdir/rmdir: length-delimited path, private NUL-terminated copy, bounds trap 3, |
| 554 | nonempty/embedded-zero refused, result 0 or -errno. The `*at` words leave AT_FDCWD in X0; `chdir` |
| 555 | moves the path into X0 before syscall 49. |
| 556 | |
| 557 | - The host gate creates `sub`, enters it, creates a relative file there, returns, and refuses a |
| 558 | missing directory; it then verifies the file exists at `sub/inside`. |
| 559 | - Auditing the benchmark corpus after the keyword: 103 files, 0 output differences, 0 crashes. |
| 560 | - `seed/omc/omc.om`, 6,474 lines and 238 functions, sha256 |
| 561 | `7e7b68fd8922284e4b535005aef40b179bca70d8f3e775d7862af8c62c57e382` (176,188 bytes). |
| 562 | |
| 563 | ## Rung R20: capacity boundaries gated (done) |
| 564 | |
| 565 | OMEGESE 9.6 states where the compiler runs out of room. `seed/omc/gate12.sh` now generates each |
| 566 | boundary and checks both sides: |
| 567 | |
| 568 | - 1024 globals accepted, the 1025th error 14; 511 functions plus `main` accepted, a 512th function |
| 569 | (512 total) error 14; 512 nested blocks accepted, the 513th error 14. |
| 570 | - a 4 MiB + 1 local array and a 16 MiB + 1 array length are refused with error 23; 64 pools of |
| 571 | 16 MiB plus one more byte (1 GiB + 1) error 23. |
| 572 | - an input one byte over 8 MiB is refused with error 14. |
| 573 | |
| 574 | `seed/host/check.sh` runs gate12. Compiler unchanged since R19: 6,474 lines, 238 functions, sha256 |
| 575 | `7e7b68fd8922284e4b535005aef40b179bca70d8f3e775d7862af8c62c57e382`. |
| 576 | |
| 577 | ## Rung R21: compiler fuzz gate (done) |
| 578 | |
| 579 | `seed/omc/gate13.sh` embeds two deterministic generators (an explicit 16-bit LCG, never `rand()`): |
| 580 | |
| 581 | - 300 token streams drawn from the language vocabulary plus garbage: every run exits inside 0..23, |
| 582 | twice with identical bytes and diagnostics, and never crashes, traps (100+) or times out. |
| 583 | - 300 structured programs (typed variables, array `put`/`get`, balanced `if`/`while`/`for` up to |
| 584 | depth four): all compile, and twice to identical output. |
| 585 | |
| 586 | The 600 programs run in about two seconds and `seed/host/check.sh` runs the gate. |
| 587 | |
| 588 | ## Rung R22: ftrunc (done) |
| 589 | |
| 590 | `ftrunc fd length` sets an open descriptor's length through the scalar host path (Linux `ftruncate`, |
| 591 | syscall 46). `fd` is `int`, `length` is `long`, and the result is `long`: 0 or minus the kernel error. |
| 592 | |
| 593 | - The host gate writes 8 bytes, shortens the file to 4, rewinds, reads 4 bytes and then EOF, and |
| 594 | refuses a closed descriptor; the file is unlinked at the end. |
| 595 | - Auditing the benchmark corpus after adding the keyword: 103 files, 0 output differences, 0 crashes |
| 596 | against the pinned compiler (`e5d60db8…`). No corpus file uses `ftrunc` as an identifier. |
| 597 | - `seed/omc/omc.om`, 6,480 lines and 238 functions, sha256 |
| 598 | `4aa1b0bfd082e2ed11785b179c97af6cb848f926ed6818e9a3c08eb433b5deb3` (108,629 bytes). |
| 599 | |
| 600 | ## Rung R23: numeric conformance from Wolfram (done) |
| 601 | |
| 602 | `seed/omc/gate14.sh` runs 35 programs whose expected exit statuses were computed exactly in Wolfram |
| 603 | Language through the Wolfram MCP server (2026-10-23; server 2026.09.15), not by this compiler. The |
| 604 | expressions and the returned table are in `evidence/SEED-0/num-conformance/wolfram.txt`. |
| 605 | |
| 606 | - 19 value cases: unsigned wrap at 8/16/32/64 bits, arithmetic right shift, truncating signed |
| 607 | division and remainder at both signs, `min rem -1`, 64-bit max div/rem, and conversions. |
| 608 | - 16 trap cases: signed overflow for byte/short/int/long, `min div -1`, signed `shl` overflow, |
| 609 | divide/remainder by zero, a runtime bounds check, a passed loop bound, conversions and a shift |
| 610 | out of range. |
| 611 | |
| 612 | Values are compared as `main`'s value mod 256; traps must exit `100 + code`. The gate runs in about |
| 613 | 0.1 s and `seed/host/check.sh` runs it. Compiler unchanged: 6,480 lines, 238 functions, sha256 |
| 614 | `4aa1b0bf…`. |
| 615 | |
| 616 | ## Rung R24: path stat (done) |
| 617 | |
| 618 | `stat A off n B off capacity` returns metadata for a checked path without opening it: Linux |
| 619 | `newfstatat` with `AT_FDCWD` (syscall 79), writing the same 128-byte ARM64 structure as `fstat`. |
| 620 | It returns 0 or minus the kernel error. The output slice must hold 128 bytes; a shorter one traps 3 |
| 621 | before the kernel writes anything. |
| 622 | |
| 623 | - The host gate creates an 8-byte file, states it, checks `st_size` at byte 48 (8) and that the |
| 624 | other seven size bytes are zero, checks that a missing path returns a negative error, and checks |
| 625 | that a 64-byte output traps 3 (exit 103). |
| 626 | - The first `hstat` draft used X4 for the capacity constant, clobbering the path source register |
| 627 | that `hcopy` needs; the gate caught it as a SIGSEGV before the syscall. The constant now uses X6. |
| 628 | - `seed/omc/omc.om`, 6,518 lines and 239 functions, sha256 |
| 629 | `e4f1e7e9e315151ca4b0b2d188d2b8778a1cc62224043f067089338078519ad5` (109,505 bytes). |
| 630 | - Auditing the benchmark corpus after adding the keyword: 103 files, 0 output differences, 0 crashes |
| 631 | against the pinned compiler (`e5d60db8…`). No corpus file uses `stat` as an identifier. |
| 632 | |
| 633 | ## Rung R25: hard and symbolic links (done) |
| 634 | |
| 635 | `link A off n` and `symlnk A off n` create a hard link or a symbolic link from a packed two-path |
| 636 | list, reusing the `renames`/`execprog` list format: little-endian `u16` count, then per record a |
| 637 | `u16` length and the bytes. The count must be 2, both records nonempty, the packet at most 4096 |
| 638 | bytes. They call `linkat` (syscall 37) and `symlinkat` (36) and return 0 or minus the kernel error. |
| 639 | |
| 640 | - The host gate builds `[a, b]`, links, and checks `st_nlink` is 2 at byte 20 of the stat structure; |
| 641 | it then overwrites the second record with `c`, creates the symlink, and checks `readlnk c` returns |
| 642 | a's bytes. All three names are unlinked. A one-record list traps 3 before the kernel. |
| 643 | - A two-slice draft was rejected: carrying the second path across the first copy either clobbers |
| 644 | value registers or breaks the save-frame discipline. The packed list reuses the proven `hpack` |
| 645 | buffer and pointer list, with one save frame. |
| 646 | - `seed/omc/omc.om`, 6,542 lines and 239 functions, sha256 |
| 647 | `540baf9338b5b26bcfffb852a3a94af0d7617d60e2d3bbebbf5d31931a4ee5e2` (109,961 bytes). |
| 648 | - Auditing the benchmark corpus after adding the words: 103 files, 0 output differences, 0 crashes |
| 649 | against the pinned compiler (`e5d60db8…`). Neither word is used as an identifier there. |
| 650 | |
| 651 | ## Rung R26: chmod (done) |
| 652 | |
| 653 | `chmod A off n mode` sets permissions on a checked path through `fchmodat` (syscall 53, flags 0). It |
| 654 | reuses the path-copy machinery and the one-int argument shape of `makedir`; it returns 0 or minus |
| 655 | the kernel error. |
| 656 | |
| 657 | - The host gate creates a file, sets mode 0600 (384), states it, and checks the low 12 bits of |
| 658 | `st_mode` at byte 16; a missing path returns a negative error; the file is unlinked. |
| 659 | - `seed/omc/omc.om`, 6,552 lines and 239 functions, sha256 |
| 660 | `36ff6d3f5565aebb4ceffd0a1908a85b9289578e2fa78fb502ac1fe0dd17e2a1` (110,089 bytes). |
| 661 | - Auditing the benchmark corpus after adding the keyword: 103 files, 0 output differences, 0 crashes |
| 662 | against the pinned compiler (`e5d60db8…`). No corpus file uses `chmod` as an identifier. |
| 663 | |
| 664 | ## Rung R27: access checks and identity (done) |
| 665 | |
| 666 | `faccess A off n mode` checks a checked path through `faccessat` (syscall 48, flags 0); mode is |
| 667 | `F_OK` 0, `X_OK` 1, `W_OK` 2, `R_OK` 4. `getuid`, `geteuid`, `getgid` and `getegid` are |
| 668 | zero-argument words (syscalls 174-177) returning the process's real and effective ids. |
| 669 | |
| 670 | - The host gate checks `F_OK` on an existing path (0) and on a missing path (negative). Each |
| 671 | identity word's exit equals the low byte of `id -u` or `id -g`. |
| 672 | - `seed/omc/omc.om`, 6,589 lines and 239 functions, sha256 |
| 673 | `aa4e1fee085671718255da851aafa41a92a619317868a26ed4463708675e91c2` (110,557 bytes). |
| 674 | - Auditing the benchmark corpus after adding the words: 103 files, 0 output differences, 0 crashes |
| 675 | against the pinned compiler (`e5d60db8…`). None of the five words is used as an identifier there. |
| 676 | |
| 677 | ## Rung R28: lstat (done) |
| 678 | |
| 679 | `lstat A off n B off capacity` writes the same 128-byte ARM64 stat structure as `stat`, but passes |
| 680 | `AT_SYMLINK_NOFOLLOW` (256) to `newfstatat`, so a final symbolic link is reported instead of |
| 681 | followed. It returns 0 or minus the kernel error; a short output traps 3. |
| 682 | |
| 683 | - The host gate creates a 4-byte file and a symlink to it: `stat` reports size 4 at byte 48, |
| 684 | `lstat` reports `S_IFLNK` (`mode & 0xF000 == 0xA000`) at byte 16; both names are unlinked. |
| 685 | - `seed/omc/omc.om`, 6,599 lines and 239 functions, sha256 |
| 686 | `1b4de297c969f6c75dc58c02491a466fba617c00f6e48f849ef75c9c3bd557d0` (110,669 bytes). |
| 687 | - Auditing the benchmark corpus after adding the keyword: 103 files, 0 output differences, 0 crashes |
| 688 | against the pinned compiler (`e5d60db8…`). No corpus file uses `lstat` as an identifier. |
| 689 | |
| 690 | ## Rung R29: path truncate (done) |
| 691 | |
| 692 | `truncate A off n length` sets a checked path's length through Linux `truncate` (syscall 45). It |
| 693 | reuses the path-copy machinery; the length is a `long`, and after the copy the path moves to X0 and |
| 694 | the length to X1. |
| 695 | |
| 696 | - The host gate creates an 8-byte file, truncates it to 4, and checks `st_size` 4 at byte 48; a |
| 697 | missing path returns a negative error; the file is unlinked. |
| 698 | - `seed/omc/omc.om`, 6,616 lines and 239 functions, sha256 |
| 699 | `45029fb384a4944ffe9b021991cf214d86e0ae794dc09830096787dff8bf541e` (110,921 bytes). |
| 700 | - Auditing the benchmark corpus after adding the keyword: 103 files, 0 output differences, 0 crashes |
| 701 | against the pinned compiler (`e5d60db8…`). No corpus file uses `truncate` as an identifier. |
| 702 | |
| 703 | ## Rung R30: refusal-code conformance gate (done) |
| 704 | |
| 705 | `seed/omc/gate15.sh` pins the compiler's refusal table. At R30 that was one minimal program per code |
| 706 | 3..23, each of which had to exit with exactly that code and print `error N`, plus a valid control. |
| 707 | Since #797 the codes live in one registry, `seed/omc/error-codes.reg`, and gate15 covers every emitted |
| 708 | code 1..25 and 27..30 (33 cases, each checked against its exact `omc: line L: error C`) and runs the |
| 709 | `seed/omc/codereg.om` drift check with three negative controls; see OMEGESE §9.14. |
| 710 | |
| 711 | - The cases are: 3 unknown name, 4 line ends early, 5 extra words, 6 bad number, 7 type mismatch, |
| 712 | 8 out of range, 9 word not allowed, 10 duplicate name, 11 ambiguous literal, 12 register pool, |
| 713 | 13 long variable, 14 capacity, 15 missing end, 16 syntax, 17 line after a path end, 18 missing |
| 714 | return, 19 aliasing, 20 readonly, 21 constant index, 22 text literal, 23 size capacity. |
| 715 | - 21 cases and the control run in about 0.04 s; `seed/host/check.sh` runs the gate. Compiler |
| 716 | unchanged: 6,616 lines, 239 functions, sha256 `45029fb3…`. |
| 717 | |
| 718 | ## Rung R31: chown (done) |
| 719 | |
| 720 | `chown A off n uid gid` sets ownership on a checked path through `fchownat` (syscall 54, flags 0). |
| 721 | It reuses the open-path argument shape (path plus two `int` ids); -1 leaves that id unchanged. |
| 722 | |
| 723 | - The host gate creates a file, chowns it to the current uid with gid -1, states it, and checks the |
| 724 | low byte of `st_uid` at byte 24; a missing path returns a negative error; the file is unlinked. |
| 725 | - `seed/omc/omc.om`, 6,626 lines and 239 functions, sha256 |
| 726 | `c0c2a935c6f2cde58f2e2c83e89df062e50fef8ced9d074ff2c6a882bf0cdd7a` (111,135 bytes). |
| 727 | - Auditing the benchmark corpus after adding the keyword: 103 files, 0 output differences, 0 crashes |
| 728 | against the pinned compiler (`e5d60db8…`). No corpus file uses `chown` as an identifier. |
| 729 | |
| 730 | ## Rung R32: named integer constants (done) |
| 731 | |
| 732 | `const NAME TYPE INTEGER` at top level defines a typed value before use. It is visible to later |
| 733 | functions, composes wherever a value goes (including call arguments), cannot be assigned (error 7), |
| 734 | and is kept across function scope resets by advancing the global-name watermark. Integer types only; |
| 735 | `f32`/`f64` constants and IR mode are refused (error 9). Names are at most 8 characters and may not |
| 736 | collide with a visible name, function or struct (error 10); the value must fit (error 8). |
| 737 | |
| 738 | - `seed/omc/gate16.sh` runs 8 accepted programs (basic, negative, expression, call argument, bool |
| 739 | flag, ulong max, long min, defined between functions) and 11 refusals (assign, duplicate, range, |
| 740 | float, IR, extra word, long name, reserved, missing value, inside a function, use before |
| 741 | definition). `seed/host/check.sh` runs it. |
| 742 | - `seed/omc/omc.om`, 6,670 lines and 240 functions, sha256 |
| 743 | `a2a9c1df23270408e1c2e63c43dcae043dee36ad5fd0ce2076b2848c338d62ba` (111,810 bytes). |
| 744 | - Auditing the benchmark corpus after adding the keyword: 103 files, 0 output differences, 0 crashes |
| 745 | against the pinned compiler (`e5d60db8…`). No corpus file uses `const` as an identifier. |
| 746 | |
| 747 | ## Rung R33: constants as array lengths (done) |
| 748 | |
| 749 | `lenval` accepts either a number or an integer constant name wherever an array length is parsed: |
| 750 | local `new`, `global` pools, and `view`/`edit` parameter declarations. A name that is not an integer |
| 751 | constant is error 16, and `arrlen` keeps the 1..16777216 range (errors 8 and 23). `namescan` now |
| 752 | scans `const` lines before function signatures, so a signature may use a previously defined |
| 753 | constant; the scan resets the global-name watermark afterwards so the body pass re-registers it. |
| 754 | |
| 755 | - `gate16` now runs 11 accepted programs (adding local, global and parameter array lengths) and 15 |
| 756 | refusals (adding zero length, too-large length, a variable as length, and use before definition). |
| 757 | - `seed/omc/omc.om`, 6,687 lines and 241 functions, sha256 |
| 758 | `b4ac449f19fa5b77f90d697fc6c35223f3ca23c071732fc7e340754cbe5be642` (112,213 bytes). |
| 759 | - Auditing the benchmark corpus: 103 files, 0 output differences, 0 crashes against the pinned |
| 760 | compiler (`e5d60db8…`). |
| 761 | |
| 762 | ## Rung R34: float constants and constant field lengths (done) |
| 763 | |
| 764 | `const` now accepts a float literal (`f64 0.1`, `f32 0.1`): `rdval` reads the float token, `fspan` |
| 765 | converts it to target bits, and the name stores the bits with the float type. An integer literal |
| 766 | under a float type (`f64 5`) is refused (error 16). Integer constants are also accepted as struct |
| 767 | field lengths (1..64; over that is error 14), while a float constant used as any length is error 16. |
| 768 | |
| 769 | - `gate16` now runs 15 accepted programs (adding f64/f32 bit patterns, float arithmetic, and a |
| 770 | struct length) and 17 refusals (adding a float length, an integer literal under a float type, and |
| 771 | an over-limit struct length). |
| 772 | - `seed/omc/omc.om`, 6,726 lines and 241 functions, sha256 |
| 773 | `8f359d577d78195ee2debdeb263e1347b42aa8733ae36d03e13ce1b99e9ec4af` (112,812 bytes). |
| 774 | - Auditing the benchmark corpus: 103 files, 0 output differences, 0 crashes against the pinned |
| 775 | compiler (`e5d60db8…`). |
| 776 | |
| 777 | ## Rung R35: constants in trap codes, loop bounds and for counts (done) |
| 778 | |
| 779 | `trap N` and `while ... bound N` now accept an integer constant as well as a literal (ranges 1..14 |
| 780 | and 1..999999); a `for` count was already an ordinary value, so a constant works there too. A float |
| 781 | constant is error 16 and an out-of-range integer keeps error 8. |
| 782 | |
| 783 | - `gate16` now runs 18 accepted programs and 19 refusals. |
| 784 | - `seed/omc/omc.om`, 6,716 lines and 241 functions, sha256 |
| 785 | `1e1b7cde509347dfc351c26419df298907d85bb0572712b62f55d3fe95e6ee19` (112,706 bytes). |
| 786 | - Auditing the benchmark corpus: 103 files, 0 output differences, 0 crashes against the pinned |
| 787 | compiler (`e5d60db8…`). |
| 788 | |
| 789 | ## Rung R36: integer constants in IR mode (done) |
| 790 | |
| 791 | IR mode now accepts top-level integer constants and folds each use to the same IR literal: the |
| 792 | gate compiles `const N uint 5` with `ret N` and the literal `ret uint 5` form and requires |
| 793 | byte-identical IR. Float constants in IR are still refused (error 9), as are struct/global/text |
| 794 | declarations. `ir_name` consults the global name table only after failing to find an IR-local name, |
| 795 | so locals still shadow as before. |
| 796 | |
| 797 | - `gate-ir` passes 10/10 dev programs, 7 refusals, and the const-fold equality case. |
| 798 | - `seed/omc/omc.om`, 6,732 lines and 241 functions, sha256 |
| 799 | `4fb90a600960c62221ec2862752f5d44880449e9e8f30ae1d99352d6d7230d02` (112,897 bytes). |
| 800 | - Auditing the benchmark corpus: 103 files, 0 output differences, 0 crashes against the pinned |
| 801 | compiler (`e5d60db8…`). |
| 802 | |
| 803 | ## Rung R37: fchdir, getppid and umask (done) |
| 804 | |
| 805 | `fchdir fd` changes the working directory to an open directory descriptor (syscall 50); |
| 806 | `getppid` returns the parent process id (110); `umask mask` sets the file-mode mask and returns the |
| 807 | previous one (166). All use the scalar host path; `fd` and `mask` are `int`, results are `long`. |
| 808 | |
| 809 | - The host gate opens `subdir` with `O_DIRECTORY` (16384 on ARM64), calls `fchdir`, and creates a |
| 810 | relative file that lands in `subdir/inside`. It also sets umask 0, creates a 0777 file, checks the |
| 811 | low 12 bits of `st_mode` are 0777, restores the mask, and checks `getppid` is nonzero and differs |
| 812 | from `getpid`. |
| 813 | - `seed/omc/omc.om`, 6,754 lines and 241 functions, sha256 |
| 814 | `fcd8b9da50c47975bafb8414d972e045c09d73bb4f7071494d94f36b35c70e6f` (113,171 bytes). |
| 815 | - Auditing the benchmark corpus: 103 files, 0 output differences, 0 crashes against the pinned |
| 816 | compiler (`e5d60db8…`). `sync` was not added: the corpus uses it as an identifier four times. |
| 817 | |
| 818 | ## Rung R38: data sync and anonymous files (done) |
| 819 | |
| 820 | `fdsync fd` syncs file data only (`fdatasync`, syscall 83). `memfd A off n flags` creates an |
| 821 | anonymous in-memory file (`memfd_create`, syscall 279) and returns its descriptor; the slice is a |
| 822 | name, copied privately like a path. Both are ordinary host words. |
| 823 | |
| 824 | - The host gate writes 4 bytes, calls `fdsync`, closes, and checks a later `fdsync` returns a |
| 825 | negative error. It then creates a memfd, writes, seeks to 0, reads 4 bytes back, and closes. |
| 826 | - `seed/omc/omc.om`, 6,777 lines and 241 functions, sha256 |
| 827 | `f9539e127e6696c62e32817bc57deb030cc296c564fa9adcd28d8140f2e09ae7` (113,507 bytes). |
| 828 | - Auditing the benchmark corpus: 103 files, 0 output differences, 0 crashes against the pinned |
| 829 | compiler (`e5d60db8…`). Neither word is used as an identifier there. |
| 830 | |
| 831 | ## Rung R39: process groups (done) |
| 832 | |
| 833 | `setsid` (syscall 157), `getpgid pid` (155) and `setpgid pid pgid` (154) are scalar host words; |
| 834 | pid/pgid 0 means self (and own pid for `setpgid`). The gate checks `getpgid 0 > 0`, accepts |
| 835 | `setpgid` to the current group (0) or EPERM, accepts `setsid` or EPERM when already a session |
| 836 | leader, and checks `getpgid 0 > 0` afterwards. |
| 837 | |
| 838 | While adding these, the zero-argument `hargc` chain reached nine `or` operands and om4 refused the |
| 839 | source with error 12 (register pool). `hargc` is now a list of individual `if eq c N ret K end` |
| 840 | checks; the argument counts are unchanged. |
| 841 | |
| 842 | - `seed/omc/omc.om`, 6,853 lines and 241 functions, sha256 |
| 843 | `ff9f6e71378747885e0473a6661d139ce0cfa1291fc844ec61dff31dc9b4b8b6` (113,956 bytes). |
| 844 | - Auditing the benchmark corpus: 103 files, 0 output differences, 0 crashes against the pinned |
| 845 | compiler (`e5d60db8…`). None of the three words is used as an identifier there. |
| 846 | |
| 847 | ## Rung R40: IR constants in trap/bound/for; IR trap dispatch fixed (done) |
| 848 | |
| 849 | IR mode now folds integer constants used as `trap` codes, `while` bounds and `for` counts to the |
| 850 | same IR as their literals; gate-ir compares each pair byte for byte. Two latent IR bugs surfaced and |
| 851 | were fixed: |
| 852 | |
| 853 | - `ir_stmt` dispatched `trap` on keyword id 77 (`own`) instead of 87, so `trap` in IR fell through |
| 854 | to assignment parsing and was miscompiled. It now reaches `ir_trap`. |
| 855 | - `ir_while` and `ir_for` read the token bits directly, so `bound B` / `for i ulong K` fed the |
| 856 | packed name into the IR instead of the constant's value. They now use `lenval` and `ir_val`. |
| 857 | |
| 858 | The ten one-function dev outputs stay byte-identical; the literal `for` count is still allocated in |
| 859 | the same register order as before. |
| 860 | |
| 861 | - `seed/omc/omc.om`, 6,850 lines and 241 functions, sha256 |
| 862 | `d0a15906da52c69c128bb1f38540a0ce33f3404fbecf9eeb7014c797f69c049d` (113,927 bytes). |
| 863 | - Auditing the benchmark corpus: 103 files, 0 output differences, 0 crashes against the pinned |
| 864 | compiler (`e5d60db8…`). |
| 865 | |
| 866 | ## Rung R41: IR multi-function calls (done) |
| 867 | |
| 868 | IR mode now emits a unit of up to 32 function records and supports calls to earlier functions. |
| 869 | |
| 870 | - `ir_fn` records each signature (packed name, parameters, return) in a 32-entry table; |
| 871 | `ir_emit_record` appends each encoded record; `ir_encode` writes `nfuncs` and the records. |
| 872 | - CALL (opcode 11) carries dst, callee index, nargs and up to six argument registers. Value calls |
| 873 | and void statement calls are both supported; argument types are checked (error 7); self and |
| 874 | forward calls are error 3; call names use the full 63-byte format limit; non-void as a statement and |
| 875 | void as a value are error 7. |
| 876 | - `gate-ir` compares nine multi-function units (value call, void call, zero arguments, two |
| 877 | arguments, long name, nested call, two calls in an expression, a call in a loop, six arguments) byte-for-byte with the C `omegese` + `omega_emit` oracle and requires `checker2` |
| 878 | ACCEPT. The ten one-function dev outputs stay byte-identical; the gate now pins 14 refusals. |
| 879 | - `seed/omc/omc.om`, 7,039 lines and 246 functions, sha256 |
| 880 | `0eec74110bb3580dcd0aaff0f963bdb4010183e3e89cdf14e8a2a54eef89f01a` (117,218 bytes). |
| 881 | - Auditing the benchmark corpus: 103 files, 0 output differences, 0 crashes against the pinned |
| 882 | compiler (`e5d60db8…`). |
| 883 | - Still open: IR structs are spec-blocked (OSC-1 excludes structs); calls remain earlier-only and |
| 884 | scalar. |
| 885 | |
| 886 | ## Rung R42: positioned I/O (done) |
| 887 | |
| 888 | `pread fd A off n pos` and `pwrite fd A off n pos` (syscalls 67/68) move bytes at an explicit `long` |
| 889 | position without changing the descriptor's file offset; slice checks and the result match |
| 890 | `read`/`write`. A `text` is readonly, so `pwrite`'s source must be a writable array (error 20). |
| 891 | |
| 892 | - The host gate creates 8 bytes, writes "XY" at offset 4 with `pwrite`, reads all 8 with `pread`, |
| 893 | checks bytes 4 and 5, and refuses a closed descriptor. |
| 894 | - `seed/omc/omc.om`, 7,100 lines and 249 functions, sha256 |
| 895 | `bdc20d7dd10c3b3ccd70ce742f2622c59fc6207cbd792a128ef69ae1ed97ec60` (118,219 bytes). |
| 896 | - Auditing the benchmark corpus: 103 files, 0 output differences, 0 crashes against the pinned |
| 897 | compiler (`e5d60db8…`). Neither word is used as an identifier there. |
| 898 | |
| 899 | ## Rung R43: differential fuzz against the pinned compiler (done) |
| 900 | |
| 901 | `seed/omc/pinned.om` is the R5 compiler source from commit `f0499f41`. `gate17.sh` builds it with |
| 902 | the seed-owned om4 and asserts the resulting digest `e5d60db8…`; it then generates 300 deterministic |
| 903 | structured programs (scalars, arrays, `if`/`while`/`for`, arithmetic; explicit 16-bit LCG) and |
| 904 | compiles each with both compilers. Every program must be accepted with byte-identical machine code. |
| 905 | |
| 906 | This is a regression net wider than the 103-file benchmark corpus: 300 programs, 0 differences, |
| 907 | about 0.5 s total. `seed/host/check.sh` runs it. |
| 908 | |
| 909 | ## Rung R44: IR differential fuzz (done) |
| 910 | |
| 911 | gate-ir now generates 30 deterministic two-function programs (a helper with random |
| 912 | arithmetic/comparison/`if`, and a caller with a call and arithmetic) from an explicit 16-bit LCG. Each |
| 913 | must be byte-identical to the C `omegese` + `omega_emit` oracle and checker2 ACCEPT. This covers random |
| 914 | call sites and argument values beyond the nine hand-written units: 30 programs, 0 differences, about |
| 915 | 0.5 s. |
| 916 | |
| 917 | ## Rung R45: IR break (done) |
| 918 | |
| 919 | IR mode lowers `break` to a `BR` to the innermost loop's exit and marks the path dead; the enclosing |
| 920 | `if`/loop closes skip unreachable joins exactly as after `ret` or `trap`. The gate compares `while`, |
| 921 | `for` and nested-loop break programs byte-for-byte with the C oracle and requires checker2 ACCEPT; |
| 922 | `break` outside a loop is error 9 and a later line in the same block is error 17. `continue` remains |
| 923 | refused (error 3), matching the C `omegese`, which does not accept it. |
| 924 | |
| 925 | - gate-ir now pins 10 dev programs, 9 call units, 3 break units, 30 fuzz units and 16 refusals. |
| 926 | - `seed/omc/omc.om`, 7,128 lines and 251 functions, sha256 |
| 927 | `a9cd48e909861051cd3ee771b1160fa31ce0cf8b95b559f54e6bf6e50958c297` (118,732 bytes). |
| 928 | - Auditing the benchmark corpus: 103 files, 0 output differences. |
| 929 | |
| 930 | ## Rung R46: getsid, syncfs and shutdown (done) |
| 931 | |
| 932 | `getsid pid` (syscall 156), `syncfs fd` (267) and `shutdown fd how` (210) are scalar host words. |
| 933 | The gate checks `getsid 0 > 0`, a successful `syncfs` on an open file, and a negative `shutdown` on |
| 934 | a regular file (not a socket); the file is unlinked. |
| 935 | |
| 936 | - `seed/omc/omc.om`, 7,159 lines and 251 functions, sha256 |
| 937 | `a75ee5dec21c784c4bbc27e426b5124aebef4580b1b9587f60f7a2d6b7aa2a91` (119,031 bytes). |
| 938 | - Auditing the benchmark corpus: 103 files, 0 output differences. |
| 939 | |
| 940 | ## Rung R47: IR binary operand types (done) |
| 941 | |
| 942 | `ir_bin_r` now checks the right operand against the left: arithmetic and comparisons require the |
| 943 | same type (bool arithmetic is refused); shifts allow any whole-number amount, matching the language |
| 944 | (`shl ulong 1 uint 3` is oracle-identical), but refuse bool or float amounts; float operands are |
| 945 | refused. Before this, `add s i` with `s uint`, `i ulong` emitted IR that checker2 rejected; it now |
| 946 | fails 7 instead. |
| 947 | |
| 948 | - gate-ir: 19 refusals and one mixed-shift unit; totals are 10/10 dev, 9 call units, 3 break units, |
| 949 | 1 shift unit, 30 fuzz units. |
| 950 | - `seed/omc/omc.om`, 7,181 lines and 251 functions, sha256 |
| 951 | `fe3fde9be68a069d20d89e3851596ebac1bd6daa42e4caf3079b0c60b87ba8d8` (119,291 bytes). |
| 952 | - Auditing the benchmark corpus: 103 files, 0 output differences. |
| 953 | |
| 954 | ## Rung R48: IR operator result types and comparison destinations (done) |
| 955 | |
| 956 | `ir_val` now checks the result type of `bin`/`un`/`true`/`false` against the expected context |
| 957 | (error 7), closing the class where `ret uchar add uint 1 uint 2` or `x = eq ...` with a `uint` `x` |
| 958 | emitted checker2-rejected IR. `ir_bin_r` writes comparison results into the destination register |
| 959 | (a fresh one only for the sentinels), so reassigning a bool local now matches the oracle exactly. |
| 960 | |
| 961 | - gate-ir: 23 refusals and a bool-assignment oracle unit; totals are 10/10 dev, 9 call units, 3 break |
| 962 | units, 1 shift unit, 1 bool unit, 30 fuzz units. |
| 963 | - `seed/omc/omc.om`, 7,196 lines and 251 functions, sha256 |
| 964 | `3379c90abf70beb9ca76079956de2ac9dbb2a30e709ae8cfb9c777effe5053a9` (119,499 bytes). |
| 965 | - Auditing the benchmark corpus: 103 files, 0 output differences. |
| 966 | |
| 967 | ## Rung R49: IR context types without blocking casts (done) |
| 968 | |
| 969 | Type enforcement moved out of `ir_val`'s name/literal/call paths (which wrongly rejected explicit |
| 970 | conversions such as `x = ushort a` and `ret uchar uint 1`) to the sites that require an exact type: |
| 971 | `if`/`while` conditions, `for` counts, returns, local assignments, binary operands and call |
| 972 | arguments. Explicit `TYPE value` casts may still change type; the cast-return unit is oracle-identical. |
| 973 | |
| 974 | This fixes `if x` with `uint x`, `ret x` in a `uchar` function, and `x = eq ...` with a `uint x` |
| 975 | (all now error 7), while dev01/dev02 (`ushort a`, `long a`) and `uchar inc ...` compile. |
| 976 | |
| 977 | - gate-ir: 26 refusals and a cast-return oracle unit; totals are 10/10 dev, 9 call units, 3 break |
| 978 | units, 1 shift unit, 1 bool unit, 1 cast unit, 30 fuzz units. |
| 979 | - `seed/omc/omc.om`, 7,208 lines and 251 functions, sha256 |
| 980 | `ef19aa993d210ad20070ef99bce1e2ef02921d9541d7a443f973072c4d6fa6a3` (119,643 bytes). |
| 981 | - Auditing the benchmark corpus: 103 files, 0 output differences. |
| 982 | |
| 983 | ## Rung R50: keyword generator parity (done) |
| 984 | |
| 985 | `seed/omc/gate18.sh` regenerates the chain with `genkw.awk` and compares every literal pack/id |
| 986 | pair with `fn kw` scoped to that function. It independently checks the complete ID multiset |
| 987 | and derives the expected pair count from the semantic canonicalizer's committed `tkw1` |
| 988 | inventory (`seed/semhash/semhash.om`), without regenerating that inventory during verification. |
| 989 | The two computed entries (`readlnk` 133, `sockopt` 134) and target-scoped `efi` are checked |
| 990 | separately. Thus deleting a word from both the generator and compiler chain still fails; |
| 991 | `tests/kfd/check.py` exercises that coordinated-removal control. |
| 992 | To generate the canonicalizer inventory when changing the language, use |
| 993 | `awk -v semhash=1 -f seed/omc/genkw.awk`; replace its `text tkw1` declaration with that output. |
| 994 | `seed/semhash/check.sh` checks the canonicalizer's full spelling/id parity. |
| 995 | Decimal string arithmetic preserves packs above 2^53 exactly. `seed/host/check.sh` runs gate18. |
| 996 | |
| 997 | ## Rung R51: constants in function mode (done) |
| 998 | |
| 999 | A function-mode unit (no `fn main`) used to refuse any top-level name with error 9 at the end of the |
| 1000 | input, because `s_eof` tested the count of top-level names, and that count includes constants. The |
| 1001 | new `fnstore` scans those names and refuses only a `global` pool (kind 4) or a `text` (kind 5); a |
| 1002 | constant (kind 9) folds to its typed number at every read and needs no program image. Host words |
| 1003 | keep their error 9 at the line that uses them. |
| 1004 | |
| 1005 | - `gate16` now runs 18 accepted programs, 27 refusals (adding function-mode `global`, `text`, a |
| 1006 | global or text beside a constant, a host word, a trap code out of range, a float length and an |
| 1007 | assignment) and 9 function-mode units whose words must equal the literal-only unit byte for byte. |
| 1008 | - Negative controls: the same gate16 against the previous compiler (`befb8199…`) fails at `fm_value` |
| 1009 | with error 9; a compiled mutant whose `fnstore` never refuses fails at `fm_global`. |
| 1010 | - `seed/omc/omc.om`, 11,131 lines and 379 functions. The committed `seed/out/omc` is not refreshed in |
| 1011 | this change; the integration owner reseeds once per batch. |
| 1012 | |
| 1013 | ## TileLab planner input refusal (TL907-01) |
| 1014 | |
| 1015 | Build the candidate compiler with `sh seed/omega-from-seed.sh`, then run |
| 1016 | `sh seed/tilelab/gate.sh` from the repository root on an AArch64 Linux host. |
| 1017 | The gate prints the compiler and planner binary SHA256 values before checking |
| 1018 | the exact planner output and process status in `seed/tilelab/expected.txt`. |
| 1019 | |
| 1020 | Planner dimensions remain decimal integers in the documented range. Decimal |
| 1021 | overflow is refused before unsigned multiplication or addition can wrap. |
| 1022 | An optional REGS budget must be a nonempty decimal `ulong`: malformed, |
| 1023 | over-capacity and overflowing input returns usage status 3 without a plan. |
| 1024 | A valid budget too small for any configuration still returns refusal status 2. |
| 1025 | The maximum representable `ulong` budget is valid; parse failure is tracked |
| 1026 | separately rather than interpreting its value as an unlimited budget. |
| 1027 | |
| 1028 | The host gate includes the independent audit's overflowing dimensions and |
| 1029 | malformed REGS input, empty and over-capacity REGS controls, and maximum-value |
| 1030 | acceptance. `seed/tilelab/parser_mutant.om` removes the overflow guard or the |
| 1031 | REGS status check independently. Each mutant must compile, return success |
| 1032 | and emit a plan for the corresponding invalid audit input; compiler failures |
| 1033 | or unrelated runtime failures are not accepted as control evidence. |
| 1034 | These checks qualify host parsing only. They do not access or qualify a GPU, |
| 1035 | alter the empirical scheduling model, or rewrite historical evidence. |
| 1036 | |
| 1037 | ## Local trace segment (omega-mv #608) |
| 1038 | |
| 1039 | `seed/trace/segment.om` is a library unit (no `main`) for a local, append-only trace segment: a |
| 1040 | 16-byte header and 64-byte records, each with its sequence number and a CRC-32. It can scan a segment |
| 1041 | read-only, and its recovery keeps the valid prefix and quarantines the damaged file as `<segment>.bad`. |
| 1042 | Run `sh seed/trace/gate.sh` (or `tests/gates/run.sh trace`) from the repository root on an |
| 1043 | AArch64 Linux host. The gate checks `seed/out/omc` against its recorded SHA-256, then requires the 71 checks |
| 1044 | in `seed/trace/segment-test.om` to print exactly `seed/trace/expected.txt`. It also requires four source |
| 1045 | mutants to fail their own checks: CRC comparison removed, torn tail ignored, append alignment guard |
| 1046 | weakened, and create with O_TRUNC in place of O_EXCL. `seed/trace/README.md` describes the format. |
| 1047 | |
| 1048 | `seed/trace/tracecli.om` is the offline read-only CLI for that format (omega-mv #610): `version`, |
| 1049 | `verify`, `show`, `events`, `stats`, `export`, `compare` and `list`. Nothing is written except stdout. |
| 1050 | Run `sh seed/trace/cli-gate.sh` (or `tests/gates/run.sh tracecli`) from the repository root on an |
| 1051 | AArch64 Linux host. The gate checks `seed/out/omc` against its recorded SHA-256, pins the generated |
| 1052 | fixture SHA-256 values and the golden stdout, refuses a mode-0000 segment, and requires four source |
| 1053 | mutants to fail their own checks. One of those is a literal scan of the read-only open flags (`32768`; |
| 1054 | a change to `32770`, which is `O_RDWR|O_NOFOLLOW`, must fail the scan). `seed/trace/README.md` |
| 1055 | describes the format and the CLI. |
| 1056 | |
| 1057 | ## Candidate scalar `fma` and exact literals |
| 1058 | |
| 1059 | `fma a b c` (keyword 227) is explicit AArch64 scalar FMADD for three equal f32/f64 types. |
| 1060 | It rounds once, unlike separate `mul` and `add`. x86linux/x86efi refuse a well-typed `fma` |
| 1061 | with error 9 rather than silently substituting non-fused arithmetic; operand errors 7 and 11 |
| 1062 | come first, as on AArch64. See OMEGESE section 9.9 for NaNs, signed zero, literal rounding |
| 1063 | and refusal rules. |
| 1064 | |
| 1065 | The exact-limb decimal converter and 512-literal fixture are reused from the core of draft |
| 1066 | #1027 (`681d6f487ac3c237e0b8d73c287e0a8f232b1434`, fixing #1024 and #1026), applied to |
| 1067 | main `5287336a50b4b75a357bfc330f599cc604209e40`. They are not an independent second fix. |
| 1068 | `evidence/SEED-0/fma-exact-literals/oracle.wl` records a mounted Wolfram evaluation that |
| 1069 | independently checks all 512 expected patterns and the f32/f64 fused counterexamples. |
| 1070 | The inherited Python oracle is not needed for this qualification. |
| 1071 | |
| 1072 | Run the seed fixpoint, then `sh seed/omc/gate8.sh` and `sh seed/omc/gate-fma.sh`. |
| 1073 | The latter compiles a seeded exact-once source mutator, rejects an absent mutation site, |
| 1074 | and requires detection of FMSUB, unfused multiply/add, discarded decimal remainder and |
| 1075 | ties-down mutants. `seed/host/check.sh` includes both gates. |
| 1076 | |
| 1077 | This is an additive candidate profile, not a production compiler-pin refresh. Per integration |
| 1078 | ownership, the bridge's e5b32567 profile and active generated-unit/gate pins remain frozen. |
| 1079 | Adoption requires a separately authorized batch reseed, generated-unit regeneration and |
| 1080 | full pin refresh; this draft must not be treated as installed or independently merge-ready. |
| 1081 | |
| 1082 | ## How the checks stay honest |
| 1083 | |
| 1084 | - `check/a64check.om` and `check/audit.sh` are reference checks only. Rung 0 builds the Omega |
| 1085 | decoder/encoder with `out/omc`, after checking `out/omc.sha256` and logging the compiler hash; |
| 1086 | rungs 1 and 2 reuse it. No C compiler is needed for these gates. The Omega oracle now shares |
| 1087 | ancestry with the chain it checks; GNU objdump remains the independent second decoder. The retained |
| 1088 | C references are labelled ORACLE for these seed gates only; the two src/ implementations remain |
| 1089 | active first-party C code in other targets. None of these checks writes a byte of any rung. |
| 1090 | Generated parity inputs are `omc/tests/a64-decode-cases.om` and `a64-encode-edge-cases.om`. |
| 1091 | - `check/audit2.sh` (GNU objdump) and `check/runner.c` (built with the C compiler) are reference checks |
| 1092 | for rungs 3 and 5 in the same way: one reads every instruction back, the other calls the functions |
| 1093 | both paths made and compares the answers. Neither writes a byte of any rung. |
| 1094 | - `evidence/SEED-0/rung3-worksheet.sh` and `rung5-worksheet.sh` are the arithmetic behind the keyword |
| 1095 | table of om3 and the message bytes and constants of Atlas, kept so anyone can redo the sums. |
| 1096 | - `evidence/SEED-0/rung0-worksheet.sh` is the arithmetic I did while writing the words: each manual field |
| 1097 | layout with the numbers put in. It is kept so anyone can redo the sums. It caught one typing slip of |
| 1098 | mine (word 26) before the first run. |