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-8-spec.md
| 1 | # Specification: Milestone 8 — Omega Program Core (`OMEGA_PROGRAM_CORE`) |
| 2 | |
| 3 | ```text |
| 4 | Document ID: SPEC-OMEGA-M8 |
| 5 | Milestone: Milestone 8 (OMEGA_PROGRAM_CORE) |
| 6 | Classification: Sovereign Machine Canonical Specification |
| 7 | Target Substrate: Explicit Program Objects, Contracts, Cost Accounting, and Composition |
| 8 | Status: SPECIFIED / IN PROGRESS (aien-spark/aien-architecture#20) |
| 9 | Lineage: SILICON -> ATLAS (M1) -> PHYSICS (M2/M3) -> OMEGA (M4-M8) -> AIEN |
| 10 | ``` |
| 11 | |
| 12 | --- |
| 13 | |
| 14 | ## 1. Executive Summary & Core Invariants |
| 15 | |
| 16 | Milestone 7 established the trusted verification engine (`OMEGA_VERIFY`). |
| 17 | Milestone 8 formalizes programs from isolated semantic graph operations into first-class sovereign objects: |
| 18 | |
| 19 | > **A PROGRAM IS NOT MERELY A SEQUENCE OF INSTRUCTIONS; IT IS A BOUNDED SEMANTIC CONTRACT WITH DECLARED TYPES, COSTS, COMPOSITION LAWS, AND EVIDENCE OF VERIFICATION.** |
| 20 | |
| 21 | The `OMEGA_PROGRAM` substrate establishes: |
| 22 | 1. **Explicit Program Objects**: Typed boundaries separating inputs, outputs, preconditions, postconditions, and resource costs. |
| 23 | 2. **Deterministic Composition**: Algebraic composition $C = A \circ B$ where $C(x) = B(A(x))$ with automated intermediate type unification. |
| 24 | 3. **Additive Cost Accounting**: Formally modeled costs (instruction count, register pressure, memory overhead) that compose strictly and monotonically. |
| 25 | 4. **Verification-Coupled Realization**: Programs compile to native AArch64 machine code and must pass the M7 verification ladder ($V_0, V_1, V_2$). |
| 26 | |
| 27 | --- |
| 28 | |
| 29 | ## 2. Program Data Model & Interface |
| 30 | |
| 31 | ```c |
| 32 | typedef struct { |
| 33 | uint32_t insn_count; |
| 34 | uint32_t reg_pressure; |
| 35 | uint32_t memory_bytes; |
| 36 | uint32_t latency_cycles; |
| 37 | } OmegaCost; |
| 38 | |
| 39 | typedef struct { |
| 40 | TypeTag input_type; |
| 41 | uint16_t input_width; |
| 42 | TypeTag output_type; |
| 43 | uint16_t output_width; |
| 44 | char precondition[64]; |
| 45 | char postcondition[64]; |
| 46 | } OmegaContract; |
| 47 | |
| 48 | typedef struct { |
| 49 | SemanticId program_id; |
| 50 | char name[64]; |
| 51 | OmegaContract contract; |
| 52 | OmegaCost cost; |
| 53 | OmegaGraph *graph; |
| 54 | RealizationObject realization; |
| 55 | bool is_realized; |
| 56 | bool is_verified; |
| 57 | } OmegaProgram; |
| 58 | |
| 59 | typedef struct { |
| 60 | SemanticId task_id; |
| 61 | char description[128]; |
| 62 | OmegaContract target_contract; |
| 63 | OmegaCost cost_budget; |
| 64 | size_t example_count; |
| 65 | uint64_t inputs[16]; |
| 66 | uint64_t expected_outputs[16]; |
| 67 | } SynthesisTask; |
| 68 | ``` |
| 69 | |
| 70 | ### Composition Invariant: |
| 71 | Given $A: X \to Y$ and $B: Y \to Z$: |
| 72 | - Requires: $\text{Type}(A_{\text{out}}) == \text{Type}(B_{\text{in}})$ |
| 73 | - Derived Contract: $C: X \to Z$, with $\text{Pre}(C) = \text{Pre}(A)$, $\text{Post}(C) = \text{Post}(B) \circ \text{Post}(A)$ |
| 74 | - Derived Cost: $\text{Cost}(C) = \text{Cost}(A) + \text{Cost}(B)$ |
| 75 | |
| 76 | --- |
| 77 | |
| 78 | ## 3. Qualification Gates for M8 |
| 79 | |
| 80 | 1. `OMEGA_PROGRAM_OBJECT_PASS`: `OMEGA_PROGRAM` instantiated with explicit contracts and cost models. |
| 81 | 2. `OMEGA_PROGRAM_CONTRACT_VALIDATION_PASS`: Type checking enforces input/output contract validity. |
| 82 | 3. `OMEGA_PROGRAM_COMPOSITION_PASS`: Programs $A$ and $B$ composed into $C = A \circ B$ with intermediate type unification. |
| 83 | 4. `OMEGA_PROGRAM_TYPE_MISMATCH_REFUSAL_PASS`: Incompatible composition ($A_{\text{out}} \ne B_{\text{in}}$) refused fail-closed. |
| 84 | 5. `OMEGA_PROGRAM_COST_ACCOUNTING_PASS`: Composite cost $\text{Cost}(C) = \text{Cost}(A) + \text{Cost}(B)$ strictly verified. |
| 85 | 6. `OMEGA_PROGRAM_REALIZATION_PASS`: Composite program lowered to native AArch64 machine instructions. |
| 86 | 7. `OMEGA_PROGRAM_V0_STRUCTURAL_PASS`: Composite program passes M7 V0 structural verification. |
| 87 | 8. `OMEGA_PROGRAM_V1_DIFFERENTIAL_PASS`: Composite program passes M7 V1 differential evaluation vs native execution. |
| 88 | 9. `OMEGA_PROGRAM_V2_PROPERTY_PASS`: Composite program passes M7 V2 property/invariant verification. |
| 89 | 10. `OMEGA_PROGRAM_SYNTHESIS_TASK_PASS`: `SYNTHESIS_TASK` schema verified with input-output test harness ready for M9 search. |