Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/seed/equiv/README.md # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / seed / equiv / README.md` 53 lines ยท 3739 bytes Raw Blame History Rendered 1 # irequiv: exhaustive equivalence of OSC IR scalar functions (issue 826) 2 3 `irequiv.om` is seeded Omega. It reads one OSC IR v1 unit (`spec/one-layer-format.md`) on stdin, 4 interprets its functions with the semantics of `src/compiler/osc_interp.c` (wrapping unsigned 5 arithmetic, signed overflow, division, shift and conversion traps, explicit `trap N`), and compares 6 two functions over every input of their shared signature. Two results are equal only when both 7 return the same bits or both trap with the same code. 8 9 ```sh 10 seed/out/omc < seed/equiv/irequiv.om > irequiv && chmod +x irequiv 11 { printf 'ir\n'; cat seed/equiv/pop16.unit.om; } | seed/out/omc > pop16.ir 12 ./irequiv check pop16 pop16s < pop16.ir # EQUIV PASS ... domain=65536 checked=65536 differing=0 13 ./irequiv check pop16 pop16e < pop16.ir # EQUIV FAIL ... differing=1 first=ushort:65535 ... 14 ./irequiv sample A B N SEED < unit.ir # wider domains: EQUIV SAMPLED ... NOT_A_PROOF, exit 10 15 ./irequiv eval F uchar:1 uchar:9 < unit.ir # value:N or trap:C 16 ./irequiv dump F < unit.ir # 8 LE bytes per input, enumeration order 17 sh seed/equiv/gate-irequiv.sh 18 ``` 19 20 - `check` needs identical parameter and return types and at most 24 parameter bits (bool counts 1); 21 inputs are enumerated with the last parameter in the low bits. The whole domain is scanned; the 22 line reports the count of differing inputs and the first one with both results. 23 - `sample` draws N inputs (at most `67108864`) from xorshift64* seeded by SEED. Agreement exits 10, 24 never 0, and prints `NOT_A_PROOF`. 25 - Each evaluation has `16777216` instructions of fuel; running out prints `EQUIV INCONCLUSIVE` 26 and exits 6, never PASS or FAIL. 27 - Exit codes: 0 PASS, 1 FAIL, 2 usage, 3 unknown function, 4 signature, 5 domain over 24 bits, 28 6 fuel, 7 trap during `dump`, 10 sampled agreement, 20-28 the IR reader's refusals. 29 30 Lines 43-496 are the OSC IR v1 reader and validator, shared byte for byte with 31 `seed/spirv/irspirv.om` (the same lines there). `seed/wasm/irwasm.om` copied the same reader and 32 then extended it for IR v7 (regions, f32/f64, RLOAD/RSTORE/BITCAST/RINIT; #818). Its lines 65-843 33 must equal irequiv's range with the POSIX sed edits in `irwasm-v7.sed` applied (`N a\` inserts 34 after range line N, `N c\` replaces it). Any change on either side that the recorded edits do not 35 cover fails the gate as `reader drift`. A deliberate irwasm reader change updates `irwasm-v7.sed` 36 in the same commit. The gate also builds irwasm and requires both readers to give the same 37 verdict on every v1 unit it uses: they accept the same units and refuse bad magic (20), 38 version (21), truncation (22) and trailing bytes (27) with the same status 39 (`READERS units=26 agree=26`). It also requires irequiv to refuse a version-7 header as VERSION. 40 Fixtures: `hexv` (js_hexv from seed/json/json.om, 41 hhexv from seed/net/http.om), `clamp` (dev01 clamp_add), `bitrev` (dev09 bitrev8), `rot` (r8 from 42 seed/omc/om2/s1/rot.om), `pop16`, and `wide` (sampling and fuel). Each names its source and its 43 deliberate mutants. 44 45 The gate also runs every row of `seed/wasm/cases.tsv` (129), `seed/spirv/regression.tsv` (8) and 46 `seed/spirv/demo.tsv` (3) twice: as a native program built by `omc` with the irwasm/irspirv gates' 47 64-bit result dumper, and through `irequiv eval` on the unit's IR. It requires the same bits or the 48 same trap code on all 140 rows (`CONFORM native rows=140 equal=140`), so an interpreter defect that 49 no fixture pair reaches still fails the gate. 50 51 Limits: OSC IR v1 scalar functions only (what `omc` IR mode emits: at most 32 functions, 6 52 parameters); the result is a statement about the IR both functions lowered to, not about the 53 AArch64 words the native path emits for the same source.