interplane.Get Omega
Read in your language

aien-architecture-mv

Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.

Brought by drakestapleton

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
4Document ID: SPEC-OMEGA-M4
5Milestone: Milestone 4 (OMEGA_SEMANTICS)
6Classification: Sovereign Machine Canonical Specification
7Target Substrate: Sovereign Semantic Graph (Substrate-Independent Content-Addressed Identity)
8Status: SPECIFIED / IN PROGRESS (aien-spark/aien-architecture#16)
9Lineage: SILICON -> ATLAS (M1) -> PHYSICS (M2/M3) -> OMEGA (M4+) -> AIEN
10```
11
12---
13
14## 1. Executive Summary & Foundational Invariants
15
16Milestone 0 defined the sovereign doctrine.
17Milestone 1 established ATLAS as the irreducible bootstrap seed (`ATLAS_BOOT`).
18Milestone 2 established PHYSICS as physical machine authority (`PHYSICS_BOOT`).
19Milestone 3 established that PHYSICS exercises authority strictly through capability-bounded, receipt-producing physical effects (`PHYSICS_EFFECTS`).
20
21Milestone 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
25The 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
30SILICON / 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
48ATLAS
49 awakens the machine.
50
51PHYSICS
52 owns physical authority and mediates physical effects.
53
54OMEGA
55 defines meaning, invariants, relations, constraints,
56 effects, resources, and realizations.
57
58AIEN
59 will later search over those meanings.
60```
61
62Milestone 4 strictly preserves the sovereign axioms:
63
64```text
65SMART ≠ TRUSTED
66INTELLIGENCE ≠ AUTHORITY
67MEANING IS PERMANENT; REPRESENTATION IS DISPOSABLE.
68```
69
70---
71
72## 2. The Primary M4 Invariant
73
74Milestone 4 succeeds when the system demonstrates:
75
76> **THE SAME SEMANTIC OBJECT HAS THE SAME CANONICAL IDENTITY REGARDLESS OF NON-SEMANTIC REPRESENTATION DETAILS.**
77
78Formally:
79
80$$\text{SEMANTICALLY\_EQUIVALENT}(A, B) \implies \text{SEMANTIC\_ID}(A) = \text{SEMANTIC\_ID}(B)$$
81
82while:
83
84$$\text{SEMANTICALLY\_DIFFERENT}(A, B) \implies \text{SEMANTIC\_ID}(A) \neq \text{SEMANTIC\_ID}(B)$$
85
86A semantic identity is **never** simply the hash of raw representation bytes:
87
88$$\text{SEMANTIC\_ID} \neq \text{SHA256}(\text{raw\_input\_bytes})$$
89
90Instead, canonical identity is derived exclusively through the canonicalization pipeline:
91
92```text
93RAW REPRESENTATION (Text / Binary / Builder Sequence / AST)
94 ↓
95PARSE / CONSTRUCT
96 ↓
97VALIDATE (Types, bounds, relations, acyclicity)
98 ↓
99CANONICALIZE SEMANTICS (Sort, normalize, deduplicate, un-alias)
100 ↓
101CANONICAL SEMANTIC ENCODING (Deterministic byte stream)
102 ↓
103SEMANTIC_ID = SHA256(canonical_semantic_bytes)
104```
105
106---
107
108## 3. Strict Anti-Scope (The Anti-Bloat Law for OMEGA)
109
110Milestone 4 is the foundation of the sovereign semantic universe. It is **not** a general language compiler or execution runtime.
111
112The 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
128M4 establishes the foundational set of first-class semantic object categories:
129
130```text
131VALUE
132TYPE
133OPERATION
134RELATION
135CONSTRAINT
136MEMORY
137MACHINE
138EFFECT
139REALIZATION
140EVIDENCE
141PROOF
142```
143
144These 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
147BOOTSTRAP REPRESENTATION
148NOT PERMANENT SEMANTIC DEFINITION
149```
150
151---
152
153## 5. The Initial Semantic Graph ($G_S$)
154
155OMEGA represents meaning as a directed, typed, content-addressed graph $G_S = (V, E)$.
156
157### Canonical Conceptual Object
158
159```text
160OMEGA_OBJECT {
161 semantic_id: SemanticId (32 bytes SHA-256)
162 kind: SemanticKind
163 attributes: CanonicalAttributeMap
164 relations: SortedSet<SemanticRelation>
165 constraints: SortedSet<SemanticConstraint>
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
177M4 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
1801. `UNIT`: The singleton type representing computational void.
1812. `BOOL`: Standard boolean value ($\{\text{false}, \text{true}\}$).
1823. `UNSIGNED_INTEGER(width)`: Fixed-width unsigned integer ($w \in [1, 256]$ bits).
1834. `SIGNED_INTEGER(width)`: Fixed-width two's complement signed integer ($w \in [2, 256]$ bits).
1845. `BITVECTOR(width)`: Uninterpreted bit vector of exact width ($w \in [1, 256]$ bits).
1856. `BYTE`: Exact 8-bit octet (`BITVECTOR(8)` equivalent).
1867. `SEQUENCE(element_type, length)`: Homogeneous fixed-length sequence ($L \in [0, 65535]$).
1878. `TUPLE(types...)`: Heterogeneous fixed-order tuple of types.
1889. `ADDRESS`: Semantic computational address (width explicitly parameterized).
18910. `RESOURCE`: Abstract resource identifier type.
19011. `CAPABILITY_REFERENCE`: Abstract semantic capability handle referencing authority.
19112. `EFFECT_INTENT_REFERENCE`: Abstract reference to an intended physical effect.
19213. `EFFECT_RECEIPT_REFERENCE`: Abstract reference to an authoritative execution receipt.
193
194---
195
196## 7. Values
197
198A 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
205Syntactic 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
211M4 defines an irreducible set of pure primitive operations:
212
213```text
214IDENTITY, CONSTANT, ADD, SUB, MUL, DIV,
215EQUAL, LESS_THAN, AND, OR, NOT,
216SELECT, CONCAT, SLICE
217```
218
219Every 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
230Relations are first-class directed semantic entities binding objects in $G_S$:
231
232```text
233EQUAL
234NOT_EQUAL
235LESS_THAN
236CONTAINS
237SUBSET_OF
238DEPENDS_ON
239DERIVED_FROM
240SATISFIES
241EQUIVALENT_TO
242```
243
244Relations 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
250A constraint specifies an invariant property that must hold over semantic objects:
251
252```text
253EQUALITY
254INEQUALITY
255RANGE
256TYPE
257LENGTH
258CONTAINMENT
259PRECONDITION
260POSTCONDITION
261INVARIANT
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
269These 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
275OMEGA 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
279An `OMEGA_EFFECT` object **does not execute the effect**. It defines the desired semantic meaning, parameters, and required authority:
280
281```text
282OMEGA_EFFECT {
283 operation: OperationId
284 target_resource: SemanticResourceId
285 constraints: Set<ConstraintId>
286 expected_invariants: Set<InvariantId>
287 required_authority: CapabilityReference
288}
289```
290
291The 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
297A 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
3031. **Magic Header**: `0x4F, 0x4D, 0x47, 0x30` (`"OMG0"`).
3042. **Object Kind**: 1 byte enum tag ($0x01 = \text{TYPE}, 0x02 = \text{VALUE}, 0x03 = \text{OPERATION}, \dots$).
3053. **Canonical Attributes**: Length-prefixed sequence of key-value pairs sorted lexicographically by UTF-8 key.
3064. **Canonical Relations**: Length-prefixed sequence of relation tuples `(rel_type, target_semantic_id)` sorted lexicographically by relation type then target ID.
3075. **Canonical Constraints**: Length-prefixed sequence of constraint descriptors sorted lexicographically.
3086. **Payload**: Big-endian, strictly bounded value or descriptor bytes.
309
310---
311
312## 13. Graph Validation & Malformed Refusal Matrix
313
314Before an object is admitted to $G_S$ or assigned a canonical identity, it must pass strict validation:
3151. **Reference Completeness**: All referenced `SemanticId`s must resolve within the graph envelope.
3162. **Kind Compatibility**: Relation sources and targets must match valid semantic categories.
3173. **Type Consistency**: Operand values must match declared operation input signatures.
3184. **Structural Acyclicity**: M4 expression graphs must be strictly acyclic DAGs. Structural cycles produce immediate validation refusal.
3195. **Finite Bounds**: Sequence lengths $\le 65535$, integer widths $\le 256$, string/attribute keys $\le 255$ bytes.
320
321Malformed, ambiguous, or out-of-bounds representations are rejected fail-closed.
322
323---
324
325## 14. Trust Boundary
326
327Milestone 4 establishes the immutable semantic trust boundary:
328
329```text
330UNTRUSTED SEARCH (Future AIEN / Synthesizers / Optimizers)
331 ↓
332TRUSTED CHECKER (OMEGA Semantic Validator & Type Checker)
333 ↓
334VERIFIED SEMANTICS ($G_S$ with Canonical SEMANTIC_ID)
335```
336
337No 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
343Milestone 4 requires formal verification across 12 canonical gates:
344
3451. `OMEGA_OBJECT_MODEL_PASS`: All 11 semantic categories instantiated, populated, and structurally typed.
3462. `OMEGA_TYPE_SYSTEM_PASS`: Bounded types validate width, length, and scalar bounds; illegal types rejected.
3473. `OMEGA_GRAPH_VALIDATION_PASS`: Valid graphs admitted; dangling references, type mismatches, and broken edges refused.
3484. `OMEGA_CANONICAL_ENCODING_PASS`: Canonical byte serialization satisfies strict deterministic layout rules.
3495. `OMEGA_SEMANTIC_ID_DETERMINISM_PASS`: Repeated evaluation across distinct memory allocations yields bit-for-bit identical SHA-256 IDs.
3506. `OMEGA_REPRESENTATION_INDEPENDENCE_PASS`: Independent builder orders, AST structures, and surface encodings collapse to the exact same canonical `SEMANTIC_ID`.
3517. `OMEGA_SEMANTIC_DIFFERENCE_PASS`: Single-bit or operator mutations (`ADD` $\to$ `SUB`, width $8 \to 16$, bounds change) produce distinct `SEMANTIC_ID`s.
3528. `OMEGA_RELATION_PASS`: Directed semantic relations evaluate correctly; relation ordering differences collapse into canonical identity.
3539. `OMEGA_CONSTRAINT_PASS`: Invariant envelopes and arithmetic/spatial constraints validate and evaluate against concrete models.
35410. `OMEGA_PURE_EFFECT_SEPARATION_PASS`: Pure mathematical expressions produce zero physical effect requests; effect objects demand explicit capability references.
35511. `OMEGA_MALFORMED_OBJECT_REFUSAL_PASS`: Hostile/malformed corpus (truncated headers, oversized lengths, cycle violations, type violations) rejected fail-closed.
35612. `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
363Construct the computation:
364$$\text{ADD}(a = \text{U32}(7), b = \text{U32}(11)) \implies \text{U32}(18)$$
365via:
3661. Builder ordering A (create operands first, then operation, then binding)
3672. Builder ordering B (create operation first, insert operands in reverse order)
3683. Non-canonical human-readable textual notation
3694. 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
374Represent the Milestone 3 authority law:
375$$\text{child.bounds} \subseteq \text{parent.bounds} \quad \land \quad \text{child.rights} \subseteq \text{parent.rights}$$
376as an OMEGA constraint object. Prove that two independently constructed representations of this law canonicalize to the identical semantic identity.