Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-architecture-mv/blob/main/docs/milestone-4-spec.md # aien-architecture-mv Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-architecture-mv / docs / milestone-4-spec.md` 376 lines · 15099 bytes Raw Blame History Rendered 1 # Specification: Milestone 4 — Omega Semantic Substrate (`OMEGA_SEMANTICS`) 2 3 ```text 4 Document ID: SPEC-OMEGA-M4 5 Milestone: Milestone 4 (OMEGA_SEMANTICS) 6 Classification: Sovereign Machine Canonical Specification 7 Target Substrate: Sovereign Semantic Graph (Substrate-Independent Content-Addressed Identity) 8 Status: SPECIFIED / IN PROGRESS (aien-spark/aien-architecture#16) 9 Lineage: SILICON -> ATLAS (M1) -> PHYSICS (M2/M3) -> OMEGA (M4+) -> AIEN 10 ``` 11 12 --- 13 14 ## 1. Executive Summary & Foundational Invariants 15 16 Milestone 0 defined the sovereign doctrine. 17 Milestone 1 established ATLAS as the irreducible bootstrap seed (`ATLAS_BOOT`). 18 Milestone 2 established PHYSICS as physical machine authority (`PHYSICS_BOOT`). 19 Milestone 3 established that PHYSICS exercises authority strictly through capability-bounded, receipt-producing physical effects (`PHYSICS_EFFECTS`). 20 21 Milestone 4 establishes the sovereign layer directly above PHYSICS: 22 23 > **OMEGA DEFINES WHAT COMPUTATION MEANS WITHOUT COMMITTING THAT MEANING TO A PARTICULAR MACHINE REPRESENTATION.** 24 25 The objective of Milestone 4 is not to build a programming language, compiler, optimizer, model runtime, tensor engine, or AI system. The objective is to construct the smallest sovereign semantic substrate capable of representing computation independently of the physical machine that will eventually realize it. 26 27 ### Canonical Stack at M4 28 29 ```text 30 SILICON / UNAVOIDABLE FIRMWARE 31 ↓ 32 ATLAS 33 BOOTSTRAP SEED 34 ↓ 35 PHYSICS 36 PHYSICAL AUTHORITY 37 ↓ 38 OMEGA 39 SEMANTIC MEANING 40 ↓ 41 AIEN 42 NOT YET BUILT 43 ``` 44 45 ### Canonical Responsibility Boundary 46 47 ```text 48 ATLAS 49 awakens the machine. 50 51 PHYSICS 52 owns physical authority and mediates physical effects. 53 54 OMEGA 55 defines meaning, invariants, relations, constraints, 56 effects, resources, and realizations. 57 58 AIEN 59 will later search over those meanings. 60 ``` 61 62 Milestone 4 strictly preserves the sovereign axioms: 63 64 ```text 65 SMART ≠ TRUSTED 66 INTELLIGENCE ≠ AUTHORITY 67 MEANING IS PERMANENT; REPRESENTATION IS DISPOSABLE. 68 ``` 69 70 --- 71 72 ## 2. The Primary M4 Invariant 73 74 Milestone 4 succeeds when the system demonstrates: 75 76 > **THE SAME SEMANTIC OBJECT HAS THE SAME CANONICAL IDENTITY REGARDLESS OF NON-SEMANTIC REPRESENTATION DETAILS.** 77 78 Formally: 79 80 $$\text{SEMANTICALLY\_EQUIVALENT}(A, B) \implies \text{SEMANTIC\_ID}(A) = \text{SEMANTIC\_ID}(B)$$ 81 82 while: 83 84 $$\text{SEMANTICALLY\_DIFFERENT}(A, B) \implies \text{SEMANTIC\_ID}(A) \neq \text{SEMANTIC\_ID}(B)$$ 85 86 A semantic identity is **never** simply the hash of raw representation bytes: 87 88 $$\text{SEMANTIC\_ID} \neq \text{SHA256}(\text{raw\_input\_bytes})$$ 89 90 Instead, canonical identity is derived exclusively through the canonicalization pipeline: 91 92 ```text 93 RAW REPRESENTATION (Text / Binary / Builder Sequence / AST) 94 ↓ 95 PARSE / CONSTRUCT 96 ↓ 97 VALIDATE (Types, bounds, relations, acyclicity) 98 ↓ 99 CANONICALIZE SEMANTICS (Sort, normalize, deduplicate, un-alias) 100 ↓ 101 CANONICAL SEMANTIC ENCODING (Deterministic byte stream) 102 ↓ 103 SEMANTIC_ID = SHA256(canonical_semantic_bytes) 104 ``` 105 106 --- 107 108 ## 3. Strict Anti-Scope (The Anti-Bloat Law for OMEGA) 109 110 Milestone 4 is the foundation of the sovereign semantic universe. It is **not** a general language compiler or execution runtime. 111 112 The following components are **strictly excluded** from Milestone 4: 113 - Direct AArch64 machine byte realization generator (strictly reserved for M5 `OMEGA_AARCH64`) 114 - Self-hosting realization compiler (strictly reserved for M6 `OMEGA_SELF_HOST`; as qualified, M6 proved only a self-copy check, see `doctrine/ROADMAP.md` §3 M6 correction note) 115 - V3-V5 proof engines and proof-carrying code generators (reserved for M7 `OMEGA_VERIFY`) 116 - Program synthesis solvers, synthesis task schemas, and cost models (reserved for M8/M9) 117 - Equality saturation, e-graphs, rewriting optimizers, and JIT compilers 118 - MachineGraph physical pipeline topologies (reserved for M13) 119 - GPU initialization, Blackwell MMIO, and vector/matrix compute (reserved for M15-M18) 120 - Tensor multi-dimensional strides, autograd, and loss functions (reserved for M20-M22) 121 - Neural models, search guides, weights, and AIEN cognitive agents (reserved for M24+) 122 - Filesystems, POSIX interfaces, networking stacks, and operating system runtimes 123 124 --- 125 126 ## 4. The Initial OMEGA Semantic Universe 127 128 M4 establishes the foundational set of first-class semantic object categories: 129 130 ```text 131 VALUE 132 TYPE 133 OPERATION 134 RELATION 135 CONSTRAINT 136 MEMORY 137 MACHINE 138 EFFECT 139 REALIZATION 140 EVIDENCE 141 PROOF 142 ``` 143 144 These are **semantic categories**. They are not Rust enums, C structs, or JSON schemas in the permanent architecture. Temporary bootstrap representations in implementation languages are permitted, but they must be explicitly declared as: 145 146 ```text 147 BOOTSTRAP REPRESENTATION 148 NOT PERMANENT SEMANTIC DEFINITION 149 ``` 150 151 --- 152 153 ## 5. The Initial Semantic Graph ($G_S$) 154 155 OMEGA represents meaning as a directed, typed, content-addressed graph $G_S = (V, E)$. 156 157 ### Canonical Conceptual Object 158 159 ```text 160 OMEGA_OBJECT { 161 semantic_id: SemanticId (32 bytes SHA-256) 162 kind: SemanticKind 163 attributes: CanonicalAttributeMap 164 relations: SortedSet 165 constraints: SortedSet 166 } 167 ``` 168 169 - Relationships are explicit first-class semantic objects or typed directed edges. 170 - Objects reference other objects **strictly by semantic identity** (`SemanticId`), never by ephemeral physical host memory pointer addresses. 171 - All attribute keys, relation targets, and constraints are deterministically ordered. 172 173 --- 174 175 ## 6. Types 176 177 M4 provides an explicit, unambiguous type system with strictly bounded widths. Ambiguous machine-dependent types (`int`, `long`, `usize`, `native_word`) are forbidden at the semantic layer. 178 179 ### Initial Type Universe 180 1. `UNIT`: The singleton type representing computational void. 181 2. `BOOL`: Standard boolean value ($\{\text{false}, \text{true}\}$). 182 3. `UNSIGNED_INTEGER(width)`: Fixed-width unsigned integer ($w \in [1, 256]$ bits). 183 4. `SIGNED_INTEGER(width)`: Fixed-width two's complement signed integer ($w \in [2, 256]$ bits). 184 5. `BITVECTOR(width)`: Uninterpreted bit vector of exact width ($w \in [1, 256]$ bits). 185 6. `BYTE`: Exact 8-bit octet (`BITVECTOR(8)` equivalent). 186 7. `SEQUENCE(element_type, length)`: Homogeneous fixed-length sequence ($L \in [0, 65535]$). 187 8. `TUPLE(types...)`: Heterogeneous fixed-order tuple of types. 188 9. `ADDRESS`: Semantic computational address (width explicitly parameterized). 189 10. `RESOURCE`: Abstract resource identifier type. 190 11. `CAPABILITY_REFERENCE`: Abstract semantic capability handle referencing authority. 191 12. `EFFECT_INTENT_REFERENCE`: Abstract reference to an intended physical effect. 192 13. `EFFECT_RECEIPT_REFERENCE`: Abstract reference to an authoritative execution receipt. 193 194 --- 195 196 ## 7. Values 197 198 A semantic value is: 199 - **typed**: Every value holds an immutable reference to its canonical `SemanticType`. 200 - **finite**: Infinite structures are non-admissible. 201 - **canonicalizable**: All non-semantic representation variations collapse into a unique canonical payload. 202 - **bounded**: Value bit-widths and sequence lengths must strictly obey declared type bounds. 203 204 ### Literal Canonicalization Rule 205 Syntactic variations in integer representation (decimal `18`, hexadecimal `0x12`, octal `022`, binary ``0b00010010``) collapse to the identical canonical big-endian byte sequence of length $\lceil \text{width} / 8 \rceil$. 206 207 --- 208 209 ## 8. Operations 210 211 M4 defines an irreducible set of pure primitive operations: 212 213 ```text 214 IDENTITY, CONSTANT, ADD, SUB, MUL, DIV, 215 EQUAL, LESS_THAN, AND, OR, NOT, 216 SELECT, CONCAT, SLICE 217 ``` 218 219 Every operation specification must define: 220 - `INPUT TYPES`: Fixed arity and expected operand types. 221 - `OUTPUT TYPE`: Exact deterministic result type. 222 - `PRECONDITIONS`: Formal domain boundaries (e.g. divisor $\neq 0$). 223 - `SEMANTIC RULE`: Pure mathematical function mapping inputs to output. 224 - `FAILURE CONDITIONS & OVERFLOW POLICY`: Explicitly declared behavior (`WRAP`, `SATURATE`, or `FAIL_CLOSED`). No operation inherits ambient host platform overflow semantics. 225 226 --- 227 228 ## 9. Relations 229 230 Relations are first-class directed semantic entities binding objects in $G_S$: 231 232 ```text 233 EQUAL 234 NOT_EQUAL 235 LESS_THAN 236 CONTAINS 237 SUBSET_OF 238 DEPENDS_ON 239 DERIVED_FROM 240 SATISFIES 241 EQUIVALENT_TO 242 ``` 243 244 Relations are never buried in prose comments or string metadata; they are structural edges admitting deterministic traversal, cycle detection, and deductive reasoning. 245 246 --- 247 248 ## 10. Constraints & Invariant Envelopes 249 250 A constraint specifies an invariant property that must hold over semantic objects: 251 252 ```text 253 EQUALITY 254 INEQUALITY 255 RANGE 256 TYPE 257 LENGTH 258 CONTAINMENT 259 PRECONDITION 260 POSTCONDITION 261 INVARIANT 262 ``` 263 264 ### Example Authority Constraints 265 - Spatial containment: $\text{child.bounds} \subseteq \text{parent.bounds}$ 266 - Generation invariance: $\text{child.generation} = \text{parent.generation}$ 267 - Monotonic attenuation: $\text{derived.rights} \subseteq \text{parent.rights}$ 268 269 These primitives provide the semantic vocabulary to express Milestone 3 authority laws prior to machine code generation. 270 271 --- 272 273 ## 11. Pure Computation vs Physical Effects 274 275 OMEGA enforces an impenetrable boundary between pure computation and physical effects: 276 - **Pure Semantics**: Side-effect-free mathematical relations ($7 + 11 = 18$). Can be evaluated, synthesized, or cached without physical authority. 277 - **Physical Effects**: Operations that alter or observe physical state (console writes, memory frame grants, hardware measurement). 278 279 An `OMEGA_EFFECT` object **does not execute the effect**. It defines the desired semantic meaning, parameters, and required authority: 280 281 ```text 282 OMEGA_EFFECT { 283 operation: OperationId 284 target_resource: SemanticResourceId 285 constraints: Set 286 expected_invariants: Set 287 required_authority: CapabilityReference 288 } 289 ``` 290 291 The future physical bridge lowers an `OMEGA_EFFECT` into a Physics M3 `EFFECT_INTENT`, verified against kernel-private capabilities and recorded in an immutable `EFFECT_RECEIPT`. 292 293 --- 294 295 ## 12. Canonical Serialization & Canonical Hashing 296 297 A semantic object produces exactly one canonical byte representation: 298 299 $$\text{canonical\_bytes} = \text{CANONICAL\_ENCODE}(\text{object})$$ 300 $$\text{SEMANTIC\_ID} = \text{SHA256}(\text{canonical\_bytes})$$ 301 302 ### Deterministic Encoding Grammar 303 1. **Magic Header**: `0x4F, 0x4D, 0x47, 0x30` (`"OMG0"`). 304 2. **Object Kind**: 1 byte enum tag ($0x01 = \text{TYPE}, 0x02 = \text{VALUE}, 0x03 = \text{OPERATION}, \dots$). 305 3. **Canonical Attributes**: Length-prefixed sequence of key-value pairs sorted lexicographically by UTF-8 key. 306 4. **Canonical Relations**: Length-prefixed sequence of relation tuples `(rel_type, target_semantic_id)` sorted lexicographically by relation type then target ID. 307 5. **Canonical Constraints**: Length-prefixed sequence of constraint descriptors sorted lexicographically. 308 6. **Payload**: Big-endian, strictly bounded value or descriptor bytes. 309 310 --- 311 312 ## 13. Graph Validation & Malformed Refusal Matrix 313 314 Before an object is admitted to $G_S$ or assigned a canonical identity, it must pass strict validation: 315 1. **Reference Completeness**: All referenced `SemanticId`s must resolve within the graph envelope. 316 2. **Kind Compatibility**: Relation sources and targets must match valid semantic categories. 317 3. **Type Consistency**: Operand values must match declared operation input signatures. 318 4. **Structural Acyclicity**: M4 expression graphs must be strictly acyclic DAGs. Structural cycles produce immediate validation refusal. 319 5. **Finite Bounds**: Sequence lengths $\le 65535$, integer widths $\le 256$, string/attribute keys $\le 255$ bytes. 320 321 Malformed, ambiguous, or out-of-bounds representations are rejected fail-closed. 322 323 --- 324 325 ## 14. Trust Boundary 326 327 Milestone 4 establishes the immutable semantic trust boundary: 328 329 ```text 330 UNTRUSTED SEARCH (Future AIEN / Synthesizers / Optimizers) 331 ↓ 332 TRUSTED CHECKER (OMEGA Semantic Validator & Type Checker) 333 ↓ 334 VERIFIED SEMANTICS ($G_S$ with Canonical SEMANTIC_ID) 335 ``` 336 337 No synthesis engine or heuristic optimizer is ever trusted. Only representations that pass the deterministic OMEGA validator cross the trust boundary. 338 339 --- 340 341 ## 15. Canonical Qualification Gates 342 343 Milestone 4 requires formal verification across 12 canonical gates: 344 345 1. `OMEGA_OBJECT_MODEL_PASS`: All 11 semantic categories instantiated, populated, and structurally typed. 346 2. `OMEGA_TYPE_SYSTEM_PASS`: Bounded types validate width, length, and scalar bounds; illegal types rejected. 347 3. `OMEGA_GRAPH_VALIDATION_PASS`: Valid graphs admitted; dangling references, type mismatches, and broken edges refused. 348 4. `OMEGA_CANONICAL_ENCODING_PASS`: Canonical byte serialization satisfies strict deterministic layout rules. 349 5. `OMEGA_SEMANTIC_ID_DETERMINISM_PASS`: Repeated evaluation across distinct memory allocations yields bit-for-bit identical SHA-256 IDs. 350 6. `OMEGA_REPRESENTATION_INDEPENDENCE_PASS`: Independent builder orders, AST structures, and surface encodings collapse to the exact same canonical `SEMANTIC_ID`. 351 7. `OMEGA_SEMANTIC_DIFFERENCE_PASS`: Single-bit or operator mutations (`ADD` $\to$ `SUB`, width $8 \to 16$, bounds change) produce distinct `SEMANTIC_ID`s. 352 8. `OMEGA_RELATION_PASS`: Directed semantic relations evaluate correctly; relation ordering differences collapse into canonical identity. 353 9. `OMEGA_CONSTRAINT_PASS`: Invariant envelopes and arithmetic/spatial constraints validate and evaluate against concrete models. 354 10. `OMEGA_PURE_EFFECT_SEPARATION_PASS`: Pure mathematical expressions produce zero physical effect requests; effect objects demand explicit capability references. 355 11. `OMEGA_MALFORMED_OBJECT_REFUSAL_PASS`: Hostile/malformed corpus (truncated headers, oversized lengths, cycle violations, type violations) rejected fail-closed. 356 12. `OMEGA_CROSS_BUILD_DETERMINISM_PASS`: Identical test vectors produce identical digests and results across compilation flags and environments. 357 358 --- 359 360 ## 16. Central Demonstrations 361 362 ### Demonstration 1: Pure Arithmetic Equivalence Across 4 Representations 363 Construct the computation: 364 $$\text{ADD}(a = \text{U32}(7), b = \text{U32}(11)) \implies \text{U32}(18)$$ 365 via: 366 1. Builder ordering A (create operands first, then operation, then binding) 367 2. Builder ordering B (create operation first, insert operands in reverse order) 368 3. Non-canonical human-readable textual notation 369 4. Direct compact binary deserialization 370 371 **Proof Requirement**: All 4 representations must yield the identical canonical byte sequence and identical `SEMANTIC_ID`. Changing `ADD` to `SUB` must yield a completely distinct `SEMANTIC_ID`. 372 373 ### Demonstration 2: Physics Authority Semantics 374 Represent the Milestone 3 authority law: 375 $$\text{child.bounds} \subseteq \text{parent.bounds} \quad \land \quad \text{child.rights} \subseteq \text{parent.rights}$$ 376 as an OMEGA constraint object. Prove that two independently constructed representations of this law canonicalize to the identical semantic identity.