interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / docs / physics0 / OMEGA-MIGRATION.md

40 lines · 4202 bytes Raw Blame History Rendered
1# PD-0 substrate: what is in the Omega language today, what moves later
2
3Status at this commit (OSC-3 slice of the Omega Systems Core compiler; `docs/osc/OSC-1-SELF-HOST-STATEMENT.md` and `docs/osc/OSC-3-DESIGN.md` for what the language can express: integer scalars `u8..u64`, `i8..i64`, `bool`, fixed arrays of at most 64 cells, structs (OSC-2), bounded loops, no recursion, no bytes or strings, no I/O, no 128-bit integers).
4
5## In Omega now
6
7`tests/physics0/osc/pd0_helpers.osc` (same header format as the OSC golden corpus in `tests/compiler/progs/`): 10 functions, 62 lines.
8
9| Function | Spec item | C twin |
10| --- | --- | --- |
11| `mul(a, b)` | 2.1 product rescale `(a*b)/1e6`, truncating | `pd0_mul` (`src/physics0/pd0_rng.c`) |
12| `const_draw(lo, hi, u)` | 3 constant draw | `pd0_const` |
13| `noise_map(u1..u4, sigma)` | 3 Irwin-Hall noise from four uniforms | `pd0_noise` |
14| `l0_s0`, `l0_s1` | 4.1 L0 kinematics tick | `pd0_gen_step` case L0 |
15| `l1_s0`, `l1_s1` | 4.1 L1 spring tick | `pd0_gen_step` case L1 |
16| `l2_s1` | 4.1 L2 damped spring velocity tick | `pd0_gen_step` case L2 |
17| `cube(s0)` | the L4 monomial `s0*s0*s0` | `pd0_monomial` with exponent 3 |
18| `description_bits(...)` | 6.2 description length rule | `pd0_relation_description_bits` |
19
20Differential test `tests/physics0/test_pd0_osc.c` (gate `PHYSICS0_OSC_DIFF`): the file is compiled by the OSC front end, every function runs through the reference interpreter and through the native AArch64 code (`osc_cg` + `osc_native`), and both results are compared with the C twin on 20 000 seeded input sets per function (200 000 runs, 0 mismatches at this commit, plain and ASan/UBSan). Inputs stay inside the world box (|v| <= 10.0 units, constants <= 9.0, `u` <= 2.0).
21
22Line count at this commit (`wc -l`, comments included): Omega 62 lines (one `.osc` file) versus C 1 334 lines under `src/physics0/` and 925 lines of test-only C and shell under `tests/physics0/`. The Omega share of the substrate is the pure integer arithmetic of the spec; everything that touches bytes, hashes, processes or files is C.
23
24## Why the rest is not in Omega yet, item by item
25
26| Piece | Blocker in the language today | Moves when |
27| --- | --- | --- |
28| `pd0_mul` with 128-bit intermediate | no `i128`; `a*b` traps OVERFLOW for |a*b| >= 2^63. Inside the world box the i64 product is at most ~1e14, so the Omega `mul` agrees, but the general spec rule needs the wide product | OSC gains a wide multiply or an `i128` type |
29| `pd0_gen_step` as one function over a state array | arrays of `i64` are expressible, but the step needs the level selector and constants as parameters (at most 6 scalar parameters, `OSC_MAX_PARAMS`) and no struct parameters | struct or array parameters beyond 6 scalars, or a module with globals |
30| `pd0_relation_step` (sum over terms of coef * monomial) | the relation is a struct of arrays of structs; OSC-2 structs cannot hold arrays of structs and there are no array parameters across functions with bounds checks over 64 cells | nested aggregates or byte slices |
31| SplitMix64 and FNV-1a | `u64` wrapping arithmetic exists; the stream needs the tag as bytes (`fnv1a64("const")`) | bytes / strings |
32| PD0REC1 / PDLAW1 encode and decode, SHA-256 chain | bytes, slices, a SHA-256 in Omega | bytes plus a verified Omega SHA-256 |
33| world server (pipe), `pd0-world` binary | no I/O, no processes | capabilities / effects (OSC-0 decision 5 says never inside the language core; an Omega runtime seam is needed) |
34| least squares and NRMSE in the calibration code | floating point; the calibration is test-only anyway | stays C (or integer rational arithmetic if a future owner wants it bit-reproducible) |
35
36## Rules kept
37
38- The spec's canonical bytes are all integers; the Omega helpers are integer only, so a future Omega world can reproduce the same record bytes bit for bit.
39- The `.osc` file carries `// expect-run:` headers in the golden corpus format so it can be moved into `tests/compiler/progs/` when the compiler lane wants it as a golden program.
40- No production C was "migrated": the Omega functions are second implementations checked by differential test, not claims of self-hosting (OSC-1 statement, unchanged).