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
omega-mv / spec / universal / translation-compose-v1.md
| 1 | # Translation composition contract v1 (#624 G2) |
| 2 | |
| 3 | Status: FROZEN for G2 (C, Rust, Python) on 2026-10-25 by the #624 integration coordinator. Additive to |
| 4 | `translation-v1.md`, which stays unchanged and governs G1. Envelope v1 (`source-aware-v1.md`) unchanged. |
| 5 | C++, Zig and Go need new registry codes (a v2 envelope owned by the #621 codec lane); they are not |
| 6 | covered here. |
| 7 | |
| 8 | ## 1. The S1 family |
| 9 | |
| 10 | The u64 pure profiles already in the v1 registry share one operation set and one semantics (integers |
| 11 | modulo 2^64, ops 1/2/3/4/9, `translation-v1.md` section 2): |
| 12 | |
| 13 | | member | header language / profile / runtime / ABI | op dialect byte | arithmetic (ops 2/3/4) obligations | |
| 14 | |---|---|---|---| |
| 15 | | C | 1 C17 / 1 c17-uint64-pure-v1 / 0 / 1 | 1 | 1 | |
| 16 | | Rust | 2 Rust2021 / 2 rust-u64-wrapping-pure-v1 / 0 / 1 | 2 | 1 | |
| 17 | | Python | 3 Python3 / 4 python-explicit-u64-pure-v1 / 0 / 1 | 3 | 5 (input-domain + source-explicit-masking) | |
| 18 | |
| 19 | Inputs (op 9) and constants (op 1) have the same fields in every member (`translation-v1.md` section 2). |
| 20 | Profile 3 (CPython bigint) and 6 (dynamic retained) are not in the family: their semantics differ, so |
| 21 | they are never retargeted to a u64 member. An exporter given them refuses 68. |
| 22 | |
| 23 | ## 2. Canonical form N and retargeting R |
| 24 | |
| 25 | `R(U, M)` rewrites a family unit U to member M: the header language and profile bytes, every op's |
| 26 | dialect byte, and the arithmetic obligations per the table. Nothing else changes: same record count, |
| 27 | order, operands, immediates, input slots and parent-semantics hash. `N(U) = R(U, C)`; the |
| 28 | language-neutral semantic identity of U is `sha256(N(U) semantic bytes)`. R is total on the family and |
| 29 | `N(R(U, M)) = N(U)` for every member M. |
| 30 | |
| 31 | Every exporter accepts any family unit, so retargeting is not a separate tool. Its output is the source |
| 32 | of its own language generated from the records; the source language of the input is ignored. Every |
| 33 | importer emits units of its own member only. |
| 34 | |
| 35 | ## 3. Normalization pairs |
| 36 | |
| 37 | Each importer declares in its profile spec whether it appends a normalization pair (`translation-v1.md` |
| 38 | section 4; the C importer always does). `strip(U)` removes one trailing NORMALIZED pair iff the |
| 39 | importer that produced U declares one. An exporter emits the expression of the pre-normalization root |
| 40 | iff U is NORMALIZED (`translation-v1.md` section 4), whatever the member. |
| 41 | |
| 42 | ## 4. Directions and compositions |
| 43 | |
| 44 | An adapter direction is (language, import) or (language, export): 12 for 6 languages, 6 in G2 (C, Rust, |
| 45 | Python x import/export). A directed composition A -> B (A != B) is: `U_A = import_A(src)`; |
| 46 | `src_B = export_B(U_A)`; `U_B = import_B(src_B)`. 30 for 6 languages; 6 in G2. Required evidence per |
| 47 | composition and fixture: |
| 48 | 1. Identity: `N(strip(U_B)) = N(strip(U_A))` byte for byte. |
| 49 | 2. DIFFERENTIAL: the original A program (compiled or run by A's declared oracle), the reference model |
| 50 | on U_A, the generated B program (by B's oracle) and the native realization of U_A |
| 51 | (`translation-v1.md` section 5 lowering, after R to C if the lowering accepts only C) agree on the |
| 52 | section 3 vectors. |
| 53 | 3. Generated, not replayed: `src_B` is exported from the records; a semantic-only envelope gives the |
| 54 | same bytes. |
| 55 | Same-language round trips (A -> A) are reported separately and are not counted among the 30. |
| 56 | |
| 57 | ## 5. Fixture set F2 |
| 58 | |
| 59 | F2 = the F1 expressions (`fixtures-f1.json`) rewritten by each source lane into its own language, with |
| 60 | the same input count and the same expected values; IDs are `F2-<lang>-<F1 id>`. A lane that cannot |
| 61 | express an F1 expression in its profile records it as `NOT_IN_PROFILE` with the reason; it is not |
| 62 | dropped silently. Lanes own `tests/universal/translation/fixtures-f2-<lang>.json`. |
| 63 | |
| 64 | ## 6. Ownership (adds to translation-v1.md section 9) |
| 65 | |
| 66 | | lane | paths | |
| 67 | |---|---| |
| 68 | | Rust (#626) | `src/adapters/rust-u64-import.om`, `src/adapters/rust-u64-export.om`, `tools/adapters/rust-import`, `tools/adapters/rust-export`, `tools/adapters/build-rust-*.py`, `mk/rust-u64.mk`, `spec/universal/rust-u64-v1.md`, `tests/universal/translation/rust_selftest.py`, `tests/universal/translation/fixtures-f2-rust.json` | |
| 69 | | Python (#627) | the same pattern with `python` | |
| 70 | | C export family extension (#622) | `src/adapters/c-u64-export.om` (accept the whole family, section 2) | |
| 71 | | composition validation (#623) | `tests/universal/translation/validate_compose*.py` | |