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 / spec / type-system.md

50 lines · 2810 bytes Raw Blame History Rendered
1# SPECIFICATION: The OMEGA Type System
2
3```text
4Document ID: SPEC-OMEGA-TYPE-M4
5Classification: Sovereign Semantic Specification
6Target Substrate: Typed AST and Semantic Value Graphs
7Status: RATIFIED FOR M4 (OMEGA_SEMANTICS)
8```
9
10---
11
12## 1. Type Invariants
13
14The OMEGA type system enforces:
151. **Explicit Bounds**: Every type declares exact mathematical bit-widths or cardinalities.
162. **Substrate Independence**: Host machine words (`int`, `long`, `usize`, `uintptr_t`) are strictly forbidden.
173. **Finite Representation**: Infinite types or unbounded recursive structures are refused fail-closed.
18
19---
20
21## 2. Canonical Semantic Types
22
23| Type Tag | Name | Parameters | Allowed Range / Constraints |
24| :--- | :--- | :--- | :--- |
25| `0x01` | `UNIT` | None | Singleton type. Value: `()` |
26| `0x02` | `BOOL` | None | Boolean truth values: `false (0)`, `true (1)` |
27| `0x03` | `UNSIGNED_INTEGER` | `width: u16` | Fixed width $w \in [1, 256]$ bits |
28| `0x04` | `SIGNED_INTEGER` | `width: u16` | Fixed width $w \in [2, 256]$ bits, two's complement |
29| `0x05` | `BITVECTOR` | `width: u16` | Bit sequence $w \in [1, 256]$ bits |
30| `0x06` | `BYTE` | None | Exact 8-bit octet (isomorphic to `BITVECTOR(8)`) |
31| `0x07` | `SEQUENCE` | `elem_type_id: SemanticId, len: u32` | Fixed-length homogeneous sequence ($L \le 65535$) |
32| `0x08` | `TUPLE` | `element_types: List<SemanticId>` | Ordered heterogeneous elements ($N \le 255$) |
33| `0x09` | `ADDRESS` | `width: u16` | Memory or register address index ($w \in [16, 64]$) |
34| `0x0A` | `RESOURCE` | `resource_class: u16` | Abstract resource identifier class |
35| `0x0B` | `CAPABILITY_REFERENCE` | `slot: u32, generation: u64` | OMEGA reference to an M3 capability token (64-bit generation: see `spec/effect-cap64-migration.md`) |
36| `0x0C` | `EFFECT_INTENT_REFERENCE`| `intent_digest: [u8; 32]` | Reference to an intended physical effect |
37| `0x0D` | `EFFECT_RECEIPT_REFERENCE`| `receipt_digest: [u8; 32]` | Reference to an authoritative execution receipt |
38| `0x0E` | `FP32`| `width: u16 = 32` | IEEE binary32 value; amendment for E1 gap row 12 (spec/program-fp32.md); mixing with integers needs an explicit `CONVERT` (opcode `0x10`) |
39
40---
41
42## 3. Values
43
44A value $v$ is a typed tuple $v = (\tau, \beta)$ where $\tau$ is the canonical `SemanticId` of its declared `SemanticType`, and $\beta$ is its canonical big-endian byte sequence.
45
46### Integer Canonicalization
47Non-semantic human syntactic variations collapse to identical binary representations:
48- `4`, `04`, `0x04`, `0b00000100` with type `UNSIGNED_INTEGER(8)` all canonicalize to `[0x04]`.
49- With type `UNSIGNED_INTEGER(32)`, all canonicalize to `[0x00, 0x00, 0x00, 0x04]`.
50- Distinct types (`U8(4)` vs `U32(4)`) have distinct semantic types, hence distinct canonical encodings and distinct `SemanticId`s.