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 / physics0 / LEARNER.md

153 lines · 9891 bytes Raw Blame History Rendered
1# PD-0 learner (Physics-0 Discovery Engine, Direction 4)
2
3The first genuine Physics-0 learner. It never sees the generators, the world
4source, the oracle, the constants or the evidence files. It receives the
5describe record and the PD0REC1 observation records of FIT and SELECT
6episodes only (the harness withholds HOLDOUT, TRIAL and REP records, and the
7learner refuses them if offered), and it emits evidence for the independent
8ladder checker of `src/physics0/ladder`. It never declares a ladder state.
9
10Spec: aien-spark/physics `docs/PD0_HIDDEN_EQUATION_BENCHMARK.md` rev 2
11(2f881b1); world parameters follow rev 3 (omega #248, merged); the rev 5 rules
12(requested-reset preregistration hash, no T2 self pairs) and the rev 6 rules
13(rollout error over the pooled FIT sd, EPISODE_END records count as
14observations) and the rev 7 rule (a TRIAL or REP episode ended OUT_OF_BOUNDS
15before the horizon is void, replaced from the same stream, never in p or f;
16a fourth void in a batch voids the batch) are implemented in the checker
17and the harness.
18
19## Layout
20
21| path | role |
22|---|---|
23| `src/physics0/learner/pd0_learner.{h,c}` | the learner library (C11, no file I/O, no process calls) |
24| `src/physics0/learner/pd0_learner_main.c` | `pd0-learner`: deterministic offline fit over a raw PD0REC1 stream |
25| `tests/physics0/learner/pd0_harness.c` | development harness: drives `pd0-world`, tags the split, builds the PD0LEDG1 ledger, runs the checker and the scorer |
26| `tests/physics0/learner/pd0_truth_main.c` | test-only truth process (the only binary here that links `pd0_gen.c`) |
27| `tests/physics0/learner/test_pd0_learner.c` | unit tests |
28| `mk/physics0-learner.mk` | `test-physics0-learner`, `physics0-learner-dev`, `physics0-learner-evidence`, `p0l-isolation` |
29
30The substrate headers (`src/physics0/pd0_wire.h` family) and the verifier
31headers (`src/physics0/ladder/pd0_fmt.h`) define the same names with
32different limits, so one binary cannot include both. The learner and the
33harness are built on the verifier side only; the world and the truth run as
34separate processes over pipes. The harness reads the describe record itself
35(PD0DESC2 with per-variable reset bounds; PD0DESC1 is refused).
36
37## Mechanisms
38
391. **Numerical prediction.** One-step change of every observed variable is
40 regressed on a monomial vocabulary of total degree at most 3 over the
41 observed variables and the intervention channels (constant included, 20
42 monomials for two variables and one channel). Per target: forward
43 selection with backward pruning under a description-length score, least
44 squares by normal equations in doubles on unit values. Floats live only
45 here; coefficients are rounded to micro-units and every evaluation after
46 that uses the checker's integer `pd0_rel_step`.
472. **Symbolic sparse search and description length.** Score per equation =
48 residual code length `n * log2(max(rmse_micro, 1))` plus the spec 6.2
49 term bits `8 * (n_vars + n_channels) + 24` per term. The candidate set is
50 the MDL-best relation, plus one alternative per target (its runner-up
51 equation), re-ranked on SELECT by residual bits plus description bits.
52 Candidates serialise as PDLAW1 with `description_bits` from the spec rule.
533. **Model comparison.** Up to 8 candidates, always including the explicit
54 null (no change) and at least one rival. The harness registers the best as
55 CANDIDATE, the next two as RIVAL, the null as NULL, and the falsifier names
56 them all. A lag-1 residual autocorrelation per variable flags suspected
57 hidden state (`hidden_state_suspected`).
58
59Also in the library: the T2 correlation evidence (strongest pair over
60visible OK step records with a seeded 2000-shuffle permutation test,
61Bonferroni over all pairs), seeded exploration schedules, a planner stand-in
62(Direction 5 owns the real one: among 256 seeded schedules inside the bounds
63and not in the forbidden hash list, the one where the hypotheses disagree
64most in units of pooled residual sd; `-1` below 3 sd), and `rollout` /
65`onestep_nrmse` prediction interfaces. Everything is deterministic from the
66seed; the determinism test compares bytes.
67
68## Harness protocol (development, seeds 1..20 allowed, 1..5 run)
69
70Episodes are 20 steps. Exploration tags per five episodes: FIT FIT FIT
71SELECT HOLDOUT (60/20/20). After exploration: CORR, RELATION entries,
72FALSIFIER (eps = the level's in-box bound, 5 trials), five PREREG + TRIAL
73episodes, then three BATCH entries of ten REP episodes (planner and random
74halves alternate). On a refutation the trial records become FIT and the
75learner refits (at most three attempts). The checker runs after each stage;
76the harness never proceeds to trials without a HYPOTHESIS state. The scorer
77runs on 20 noise-free truth episodes (10 in the reset box, 10 at 1.5x).
78
79## Development results (seeds 1..5, rev 3 world, rev 7 checker rules)
80
81Learner never saw HOLDOUT/TRIAL/REP. "state" is the checker's verdict;
82"scorer" is `pd0_score` against the truth. Earlier receipts (rev 2 world;
83rev 5 rules) are kept beside the new one.
84
85| level | state reached (seeds) | scorer | size / bound | bits | notes |
86|---|---|---|---|---|---|
87| L0 | PROVISIONAL_LAW 5/5 | PASS 5/5 (exact) | 2 / 4 | 96 | seed 5: one replication episode left the box, void and replaced (rev 7) |
88| L1 | PROVISIONAL_LAW 5/5 | PASS 5/5 | 3 / 5 | 144 | exact, one-step error 0 |
89| L2 | PROVISIONAL_LAW 5/5 | PASS 5/5 | 4 / 6 | 192 | exact |
90| L3 | PROVISIONAL_LAW 5/5 | PASS 5/5 | 8 / 10 | 576 | four variables, two channels, exact |
91| L4 | PROVISIONAL_LAW 5/5 | PASS 5/5 (in-box 0.008 to 0.023) | 4 / 6 | 192 | cubic term found |
92| L5 | PROVISIONAL_LAW 5/5 | PASS 5/5 (in-box 0.004 to 0.018, constants within 10%) | 4 / 6 | 192 | no refutations once the trial error is pooled-sd normalised |
93| L6 | CANDIDATE 5/5 (3 refutations each) | FAIL 5/5 (307 latent missing, 308 reference too good) | 5 to 6 / 9 | 240 to 288 | reported, not claimed: no latent mechanism |
94| null | OBSERVATION 5/5 | not scored | 2 / 6 | 96 | no correlation evidence, no candidate; NC-1 holds |
95
96Numbers per instance: `evidence/physics0/learner/pd0-learner-dev-<commit>.txt`.
97
98## Failure analysis
99
100- **L5 (noise).** Reaches PROVISIONAL_LAW on every seed with the rev 6
101 normalisation; the rev 5 failure (quiet trials judged against their own
102 spread) is gone.
103- **L6 (hidden variable).** Candidates are latent-free fits; on 1 of 5
104 seeds the ladder still replicates one (the checker has no latent
105 requirement; the scorer does and rejects all five). On the other seeds the
106 trials or batches exceed eps, which is the honest outcome for a wrong
107 model class. `hidden_state_suspected` did not fire on L6 because the
108 latent-free fit's one-step residuals are small (0.001 to 0.005); the flag
109 needs a rollout-based test, left for the next cut.
110- **L0.** PROVISIONAL_LAW on four seeds. Seed 5 lost one replication
111 episode to an out-of-bounds step from a random schedule, leaving that batch
112 at nine episodes; the harness does not top batches up (next cut).
113- **Null world.** With self pairs excluded (rev 5) no correlation evidence
114 exists and the ladder stays at OBSERVATION. The MDL ranking still puts
115 "pull to the mean" above the empty relation, which is the correct
116 predictor of an i.i.d. world; its one-step error is 1.0 sd, far above eps.
117
118## Spec items that proved unimplementable or ambiguous as written
119
1201. **L6 pass rule** (factor-3 reference margin) is still open with Drake;
121 the learner reports L6 and claims nothing.
1222. **Requested reset on noisy levels** (rev 5 rule as implemented): the
123 ledger record does not carry the requested reset vector, so on noisy
124 levels the checker binds the reset through the PD0EXP1 entry and the
125 steps only; the trial error bound covers a mismatched reset. A reset
126 record that carries the requested values would close this.
127Resolved by rev 5, rev 6 and rev 7: noisy-reset preregistration hash, T2
128self pairs, within-trial error normalisation, EPISODE_END outcomes, void
129out-of-bounds trial and replication episodes (replaced from the same
130stream; at most three voids per batch, a fourth voids and redraws the
131batch; voids never count toward p or f).
132
133## Not implemented
134
135Latent-variable fitting, local refinement in the planner (Direction 5),
136multi-step consistency in candidate ranking, PD0DESC2 parsing beyond the
137assumed per-variable layout.
138
139## Running against an external world (PD-0b harness)
140
141The harness has an external-world mode: `pd0-harness <world> - <level|null> <seed> <out-dir>`
142takes play AND truth (relation shape, noise-free scoring trajectories) from the one world
143binary over protocol v2; no `pd0-truth` process. Protocol: `docs/physics0/PD0_PROTOCOL_V2.md`.
144
145- `make physics0-pd0b-run PD0_WORLD_BIN=<world> PD0B_SEEDS=<file>`: seeds file has lines
146 `level_index seed` (0..6 or `null`), exactly five per level listed. Runs the real ladder
147 checker and scorer, writes one new receipt `evidence/physics0/pd0b/PD0B_RUN-<commit>-<world sha12>.txt`
148 and refuses to overwrite. A dirty worktree is refused. Revision 2: the harness sends `final` before it asks for shape or score; the receipt records the final hash and the world's refusal counters per instance and says VALID or INVALID.
149 The receipt also carries `law` and `law_sha256` per instance; a REPLICATED instance without an accepted law record makes the run INVALID; the ledger, law and json files are kept in `<receipt name>-laws/`; the ledgers are large and go to `$PD0B_LEDGER_ARCHIVE` (default `~/workspace/evidence-archive/omega/physics0/pd0b/<receipt name>-ledgers/`), listed by hash in `<receipt name>-laws/LEDGERS.sha256`.
150- `make physics0-pd0b-freeze`: prints the git tree hash of the four frozen directories, the
151 sha256 of every file under them and of the harness binary (print only).
152
153Runs with the omega `pd0-world` are stand-in verification, not PD-0b results.