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 / program-fp32.md
| 1 | # FP32 in the program IR (amendment, E1 gap row 12) |
| 2 | |
| 3 | Status: implemented on branch e1-gap-close-2. Amends the ratified type table |
| 4 | (spec/type-system.md) with tag 0x0E and the operation table with opcode 0x10. |
| 5 | No existing tag, opcode or program id changes. |
| 6 | |
| 7 | ## What is added |
| 8 | - Type `FP32` (tag 0x0E, width 32): an IEEE binary32 value, carried as its 32-bit pattern. |
| 9 | - Operation `CONVERT` (opcode 0x10): `imm` is the target type tag (FP32 or u32). |
| 10 | - `src/omega_program_fp32.{h,c}`: build, type check, and library-tier evaluation. |
| 11 | |
| 12 | ## Type check (omega_program_fp32_check) |
| 13 | A two-state machine over the body, starting in the contract input type: |
| 14 | - FP32 state: ADD, SUB, MUL, DIV with a binary32 constant (`imm` = its bits, at most 32 bits), |
| 15 | or CONVERT to u32. |
| 16 | - u32 state: only CONVERT to FP32. Any other step is refused with the reason |
| 17 | "mixed types need an explicit CONVERT". |
| 18 | - CONVERT to the type the value already has is refused. |
| 19 | - The final state must equal the contract output type; contract widths must be 32. |
| 20 | - A stale or forged program id is refused (v2 id recomputed). |
| 21 | |
| 22 | ## Identity |
| 23 | The v2 program id already binds body root, input/output type ids and constraint ids; the type ids |
| 24 | differ for FP32 vs u32 so the same steps over different types never share an id. Composition |
| 25 | requires OutType == InType, so FP32 and u32 programs join only through a CONVERT program. |
| 26 | |
| 27 | ## Tier |
| 28 | FP32 programs are evaluated by the qualified library tier (omega_numeric_cpu_realize: FADD FSUB |
| 29 | FMUL DIV I2FP_U32 F2U, every one on the E1 gap-table "closed" list). The AArch64 integer |
| 30 | realizer refuses them on type (omega_program_realize_ex returns a reason). There is no new |
| 31 | machine code path. |
| 32 | |
| 33 | ## Evidence |
| 34 | `make test-program-fp32` prints `GATE OMEGA_PROGRAM_FP32_PASS PASS 33/33`. |
| 35 | Regression: test-program-realize, test-program-id, test-visor-core, test-numeric-cpu all pass. |