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 / docs / ans / INERTIAL_ALIGNMENT_SPEC_V1.md

147 lines · 8190 bytes Raw Blame History Rendered
1# Inertial Alignment v1 (ANS, the Alignment Navigation System)
2
3Status: implemented in `src/ans/`, tested by `make test-inertial-alignment`.
4Cites: ARCH-0020 (estimation, EST-0/EST-1), ARCH-0017 (ARGUS observes, never
5authorizes), `EVOLUTION_ARENA_SPEC_V1` section 5 (promotion contract), and
6ARCH-0032 (the ADR for this module, written in parallel in aien-architecture).
7
8## Idea
9
10An inertial navigation system keeps a position estimate by integrating motion
11and goes stale as error accumulates, until an outside fix corrects it. ANS
12treats alignment the same way. An agent's drift from its goal, intent,
13provenance and scope is a small state estimated by the EST-1 Kalman filter.
14Every action is a step that adds uncertainty. Sensors of three trust classes
15pull the estimate back. A control law turns the estimate into an autonomy
16tier. A promotion gate keeps self-improvement from touching the compass.
17
18## What ANS is NOT
19
20- Not an authority. ANS measures and recommends. It never grants, revokes or
21 promotes. A verdict is data for the authority to consult (ARCH-0017 shape).
22- Not a promotion path. The right to promote stays with the operator-held
23 principal (Arena spec section 5.1). ANS never calls `rx_gen_promote`; the
24 purity check forbids any reference to `rx_`.
25- Not a new filter. It links `est_kf` and does not reimplement it.
26- Not a proof of alignment. Drift is an estimate with declared noise.
27- Not wired into the resident runtime, `all` or `test`.
28
29## What is frozen
30
31The reference (the compass) is frozen. `ans_reference_freeze` validates it,
32sets `frozen = 1` and returns its SHA-256 digest. Every other API takes a
33`const ans_reference *` plus the expected digest and refuses
34`ANS_ERR_REFERENCE` if the reference is unfrozen, invalid, or its recomputed
35digest differs. The candidate under test never receives a mutable reference.
36Atoms (10): AUTHORITY, CONSENT, SCOPE, PROVENANCE, REVERSIBILITY,
37RESOURCE_LIMITS, INFORMATION_BOUNDARIES, GOAL_IDENTITY, DELEGATION_LIMITS,
38SELF_MODIFICATION_LIMITS. Reference fields: `version` (non-zero), `limit[10]`
39(max tolerated drift per atom, finite, > 0), `q[5]` (process noise per action
40kind, > 0), `r[3]` (noise per sensor class, > 0, `r[FIX] < r[REFERENCE] <
41r[IMU]`), `tier_sigma[3]` (0 < t1 < t2 < t3), `nis_limit` (> 0),
42`promote_limit` (> 0). The digest covers all of these and not `frozen`.
43
44## State A_t
45
46`ans_state`: goal, constraints (== reference digest), intent, evidence_root,
47drift (an `est_belief`, n = 4, components GOAL, INTENT, PROVENANCE, SCOPE,
48dimensionless; x = estimated drift, P = covariance), risk (0..1,
49reversibility risk of the pending action), provenance (hash chain over every
50record that shaped the state), generation, since_fix, last reference digest
51seen, last_nis, disagreement, self_mod_steps, self_mod_unfixed.
52Filter model: n = m = 4, F = I, H = I, Q = q[kind] I per step, R = r[class] I
53per measurement, `step_ns` = 1. The prior is x = 0, P = r[FIX] I.
54Components map to atom limits: GOAL to GOAL_IDENTITY, INTENT to CONSENT,
55PROVENANCE to PROVENANCE, SCOPE to SCOPE.
56
57## Actions (the inertial step)
58
59Kinds: OBSERVE, EFFECT, DELEGATE, INGEST_UNTRUSTED, SELF_MODIFY.
60`ans_step` predicts one step with Q = q[kind] I, sets risk to the action's
61reversibility risk, increments since_fix and generation, and chains the action
62digest into provenance. Refused: non-finite input, zero action id, kind or
63risk out of range, touches not 0/1, unfrozen or mismatched reference. An action
64that touches SELF_MODIFICATION_LIMITS with reversibility risk above
65`limit[SELF_MODIFICATION_LIMITS]` returns `ANS_ERR_ATOM`. The output state is
66then the input with the refusal chained into provenance and generation
67advanced and the drift unchanged: a record of the refusal, never a repair. A
68SELF_MODIFY action, or one touching that atom, increments `self_mod_steps` and
69`self_mod_unfixed`.
70
71## Sensors (the fusion)
72
73Classes: IMU (least trusted), REFERENCE, FIX (most trusted).
74`ans_measure` runs `est_kf_predict` (one tick, Q = 1e-9 I) then `est_kf_update`
75with R = r[class] I. A FIX sets since_fix to 0 and self_mod_unfixed to 0.
76REFERENCE and FIX record last_nis; a reading with nis above `nis_limit` sets
77`disagreement = 1` and is still fused: the disagreement is the signal and is
78never hidden. The flag is sticky; only a FIX within the limit clears it.
79Refused: zero evidence or source (`ANS_ERR_EVIDENCE`); IMU carrying a
80reference digest, or REFERENCE/FIX whose reference digest is zero or not the
81frozen one (`ANS_ERR_SENSOR`); non-finite values; an EST refusal
82(`ANS_ERR_EST`, with the `est_status` in the out parameter), for example
83evidence equal to a belief digest. The filter clock is the state's;
84`t_ns` and `seq` are bound into the measurement digest.
85
86## Drift and the control law
87
88`ans_drift`: mean_norm = ||x||2, sigma = sqrt(trace P), D = sqrt(mean_norm^2 +
89sigma^2). `ans_autonomy` returns an `ans_verdict` with tier FULL
90(sigma < t1), REVERSIBLE_ONLY (t1 <= sigma < t2), SIMULATE_ONLY
91(t2 <= sigma < t3), HALT_REQUEST_FIX (sigma >= t3). Any component whose |x|
92exceeds its mapped atom limit raises the tier to at least REVERSIBLE_ONLY.
93`disagreement == 1` forces HALT_REQUEST_FIX regardless of sigma. The verdict
94carries D, mean_norm, sigma, since_fix, disagreement, the state digest, the
95reference digest and its own digest. It is advisory.
96
97## Promotion gate (RSI may not touch the compass)
98
99`ans_promotion_check` takes a request (candidate digest, reference at birth,
100tests at birth, tests now, candidate state) and writes a digested
101`ans_promotion_record` whose `result` is, in this precedence order:
102REFUSED_REFERENCE (reference at birth is not the frozen digest: the compass
103changed during the candidate's life), REFUSED_TESTS (tests now differ from
104tests at birth: the instrument changed in the same transaction),
105REFUSED_DISAGREEMENT, REFUSED_DRIFT (D above `promote_limit`),
106REFUSED_SELF_MOD (`self_mod_unfixed > 0`: self-modification without a FIX
107after it), else OK. The return value is a status; a refusal is a successful
108record. The record is data for the holder of the promotion right.
109
110## Status codes
111
112`ans_status`: OK, ERR_NULL, ERR_REFERENCE, ERR_NONFINITE, ERR_EVIDENCE,
113ERR_SENSOR, ERR_ATOM, ERR_RANGE, ERR_EST, ERR_ENCODING. Promotion results are
114the separate `ans_promo` enum.
115
116## Encoding and digests
117
118Digest = SHA-256(domain || 0x00 || encoding), domains `omega.ans.<record>.v1`
119(reference, state, action, measurement, verdict, promotion). Fixed
120little-endian layout, doubles as binary64 bits with -0.0 as +0.0, header
121`OANS`, kind, version. Verdict and promotion record digests are computed with
122their own digest field zeroed. Provenance chain: SHA-256(`omega.ans.provenance.v1`
123|| 0x00 || prev || tag || record digest). Deterministic (`-ffp-contract=off
124-fno-fast-math`), bounded, no allocation, no globals, no I/O.
125
126## Tests (`tests/ans/test_ans.c`, plain and ASan/UBSan)
127
1281. Freeze and digest determinism; any field change changes the digest; unfrozen refused.
1292. Hostile: a mutated copy of the frozen reference with the old digest is refused by every API.
1303. Drift grows: 50 EFFECT steps, sigma strictly increasing, tier non-decreasing, reaches HALT_REQUEST_FIX.
1314. A FIX restores: sigma below t1, since_fix 0, tier FULL.
1325. IMU alone cannot restore FULL from SIMULATE_ONLY (chosen r and q below).
1336. Disagreement: a REFERENCE with nis above the limit forces HALT with small sigma.
1347. Refusals: zero evidence, IMU with a reference digest, FIX with a wrong digest, non-finite z, action refusals.
1358. Promotion: the OK path and each of the five refusals.
1369. Encodings round trip; golden digests are checked.
13710. Self-modification: promotion refused without a FIX, allowed after one.
138
139Numbers used in the tests: q 0.001/0.01/0.02/0.03/0.05, r IMU 1.0, REFERENCE 0.1,
140FIX 0.01, tier_sigma 0.25/0.5/1.0, nis_limit 13.28, promote_limit 0.6. With
141alternating EFFECT and IMU the steady sigma is 0.617, inside the SIMULATE_ONLY band.
142
143## Build
144
145`make test-inertial-alignment` (purity plus unit suite); `make ans-purity`
146(`nm -u` on each ans object against the estimation forbidden list and
147`rx_gen_promote`); `make test-ans`. CI: `.github/workflows/host-suites.yml`.