aien-architecture-mv
Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.
Brought by drakestapleton
aien-architecture-mv / docs / milestone-7-spec.md
| 1 | # Specification: Milestone 7 — Omega Trusted Verification Engine (`OMEGA_VERIFY`) |
| 2 | |
| 3 | ```text |
| 4 | Document ID: SPEC-OMEGA-M7 |
| 5 | Milestone: Milestone 7 (OMEGA_VERIFY) |
| 6 | Classification: Sovereign Machine Canonical Specification |
| 7 | Target Substrate: Multi-Tier Trusted Verification Ladder (V0, V1, V2) |
| 8 | Status: SPECIFIED / IN PROGRESS (aien-spark/aien-architecture#19) |
| 9 | Lineage: SILICON -> ATLAS (M1) -> PHYSICS (M2/M3) -> OMEGA (M4/M5/M6/M7) -> AIEN |
| 10 | ``` |
| 11 | |
| 12 | --- |
| 13 | |
| 14 | ## 1. Executive Summary & Foundational Invariants |
| 15 | |
| 16 | Milestone 6 (`OMEGA_SELF_HOST`) established a closed-loop reproduction check of a fixed realization emitter. Correction 2026-09-30: that check holds by self-copy, not by compilation, and is not evidence of a self-hosting compiler (see `doctrine/ROADMAP.md` §3, M6 correction note). |
| 17 | Milestone 7 establishes the **sovereign verification authority** of OMEGA: |
| 18 | |
| 19 | > **AIEN MAY PROPOSE. OMEGA MUST VERIFY. PHYSICS MUST AUTHORIZE. EVIDENCE DECIDES WHAT SURVIVES.** |
| 20 | |
| 21 | OMEGA requires a trusted, deterministic verification engine to gate candidate programs, realization binaries, and transformations before increasingly complex generated code is admitted into the ecosystem. |
| 22 | |
| 23 | The fundamental trust asymmetry is inviolable: |
| 24 | |
| 25 | ```text |
| 26 | GENERATOR = UNTRUSTED (Search, AIEN, Heuristics, Lowering) |
| 27 | VERIFIER = TRUSTED (OMEGA Formal Ladder: V0, V1, V2) |
| 28 | ``` |
| 29 | |
| 30 | No code, program, or transformation survives without passing the required verification tier. |
| 31 | |
| 32 | --- |
| 33 | |
| 34 | ## 2. The Verification Ladder |
| 35 | |
| 36 | The OMEGA verification engine implements a hierarchical ladder of increasing epistemic rigor: |
| 37 | |
| 38 | ```text |
| 39 | V5 — PROOF-CARRYING (Machine-checked proofs) [Future] |
| 40 | V4 — SYMBOLIC / FORMAL (SMT, Equivalence proofs) [Future] |
| 41 | V3 — ADVERSARIAL (Fuzzing, Fault injection, Boundary sweeps) [Future] |
| 42 | V2 — PROPERTY / INVARIANT (Algebraic laws, Bounds, Contracts) [M7 MANDATORY] |
| 43 | V1 — DIFFERENTIAL (Reference Semantic Eval vs Native Realization) [M7 MANDATORY] |
| 44 | V0 — STRUCTURAL (Types, DAG validity, Memory bounds, Opcode decoding) [M7 MANDATORY] |
| 45 | ``` |
| 46 | |
| 47 | ### V0: Structural Verification |
| 48 | Guarantees physical and syntactic safety before execution: |
| 49 | 1. **Semantic Type Safety**: Operand types, bit-widths, and arities match operation specifications. |
| 50 | 2. **DAG Integrity**: Semantic graph contains no cycles and no dangling object references. |
| 51 | 3. **Target Profile Compliance**: Realization targets valid, admitted profile (`AARCH64_PROFILE_V8A_BAREMETAL`). |
| 52 | 4. **Code Buffer Bounds**: $4 \le \text{code\_len} \le 4096$, strictly divisible by 4 bytes. |
| 53 | 5. **Instruction Validity**: Every machine word decodes to a valid, permitted AArch64 instruction via the independent bitmask decoder (`aarch64_decoder`). |
| 54 | 6. **Bounded Control Flow**: Function terminates strictly with `RET`; branches do not escape code bounds. |
| 55 | |
| 56 | ### V1: Differential Verification |
| 57 | Verifies semantic preservation between abstract evaluation and physical execution: |
| 58 | 1. Drives an exhaustive or bounded test corpus $I = \{x_1, x_2, \dots, x_N\}$ across: |
| 59 | $$\text{Eval}_{\text{semantic}}(G, x_i) \quad \text{vs} \quad \text{Exec}_{\text{native}}(R, x_i)$$ |
| 60 | 2. Requires bit-for-bit identity across all test vectors: |
| 61 | $$\forall x_i \in I, \quad \text{Eval}(G, x_i) == \text{Exec}(R, x_i)$$ |
| 62 | 3. Refuses realization immediately upon any observed divergence. |
| 63 | |
| 64 | ### V2: Property and Invariant Verification |
| 65 | Validates that computation obeys declared semantic contracts and mathematical laws: |
| 66 | 1. **Algebraic Laws**: |
| 67 | - Commutativity: $\forall a, b: op(a, b) == op(b, a)$ (e.g. `OP_ADD`, `OP_MUL`, `OP_AND`, `OP_OR`). |
| 68 | - Identity Elements: $\forall a: op(a, e) == a$ (e.g. $a + 0 = a$, $a \times 1 = a$, $a \land \text{0xFF...} = a$). |
| 69 | - Associativity: $\forall a, b, c: op(op(a, b), c) == op(a, op(b, c))$. |
| 70 | 2. **Range and Bounds Safety**: Output values strictly reside within declared domain ranges $[V_{\min}, V_{\max}]$. |
| 71 | 3. **Declared Overflow Policies**: Verifies wrapping on 64-bit boundary when `OVERFLOW_WRAP` is declared. |
| 72 | 4. **Pre/Postconditions**: Explicit predicate constraints attached to semantic operations must hold over all admissible inputs. |
| 73 | |
| 74 | --- |
| 75 | |
| 76 | ## 3. Qualification Gates for M7 |
| 77 | |
| 78 | 1. `OMEGA_VERIFY_V0_TYPE_PASS`: V0 structural verifier accepts well-typed graphs and rejects ill-typed graphs. |
| 79 | 2. `OMEGA_VERIFY_V0_DAG_PASS`: V0 structural verifier rejects cyclic or dangling graphs. |
| 80 | 3. `OMEGA_VERIFY_V0_CODE_BOUNDS_PASS`: V0 verifies code length, 4-byte alignment, and buffer boundaries. |
| 81 | 4. `OMEGA_VERIFY_V0_INSN_DECODE_PASS`: V0 validates every instruction word and refuses corrupt/unallocated opcodes. |
| 82 | 5. `OMEGA_VERIFY_V0_TERMINAL_RET_PASS`: V0 enforces strictly bounded control flow terminating in `RET`. |
| 83 | 6. `OMEGA_VERIFY_V1_DIFFERENTIAL_PASS`: V1 confirms bit-for-bit output identity between semantic evaluation and native AArch64 execution across test corpus. |
| 84 | 7. `OMEGA_VERIFY_V1_DIVERGENCE_REFUSAL_PASS`: V1 immediately detects and refuses mutant realization causing output mismatch. |
| 85 | 8. `OMEGA_VERIFY_V2_COMMUTATIVITY_PASS`: V2 property verifier proves commutativity over declared commutative operations. |
| 86 | 9. `OMEGA_VERIFY_V2_IDENTITY_PASS`: V2 property verifier proves identity element preservation. |
| 87 | 10. `OMEGA_VERIFY_V2_OVERFLOW_PASS`: V2 property verifier validates declared overflow wrapping semantics. |