work done towards furthering comprehension, contemplation, learning, and also began working on fixing some failing tests
This commit is contained in:
parent
ba05ebb0cd
commit
b30a1cf538
12 changed files with 1427 additions and 0 deletions
74
docs/analysis/AGI-spine-refined-sequencing-2026-06-06.md
Normal file
74
docs/analysis/AGI-spine-refined-sequencing-2026-06-06.md
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
# Refined sequencing — from where we actually are to AGI-candidacy (2026-06-06)
|
||||
|
||||
**Status:** PLAN (refines [AGI-candidacy-autonomous-improvement-roadmap-2026-06-05](./AGI-candidacy-autonomous-improvement-roadmap-2026-06-05.md), grounded in a 7-layer ground-truth audit of the real tree at main + #596).
|
||||
**Telos:** [[project-core-is-one-continuous-life]] — `listen → comprehend → recall → think → articulate → learn → replay`, as one continuous, ever-improving life, deployable at the edge (offline, CPU-only, deterministic, never fabricating).
|
||||
|
||||
## The finding that reorders everything
|
||||
|
||||
The 2026-06-05 roadmap (`MEASURE → COMPREHEND → REALIZE → DETERMINE → LOOP`) assumed the work was *building* each organ. The audit shows otherwise: **the organs are built; they are disconnected libraries.** Each is correct in isolation and callable only from its own tests.
|
||||
|
||||
| Layer | Built? | The real gap (verified) |
|
||||
|-------|--------|--------------------------|
|
||||
| **MEASURE** | ✅ real composed capability index — `evals/capability_index/`, frozen baseline `0.937258`, breadth 8, `wrong_total=0`, deterministic digest reproduces live | #596's relational reader is **inert** — no adapter; the curve won't register the capability we just shipped |
|
||||
| **COMPREHEND** | ⚠️ template matcher, not a general reader — coverage *is* the template list; only 51/794 index cases exercise general comprehension | not language-general; #596 reader **inert** (no lane) |
|
||||
| **REALIZE** | ✅ write/recall/persist correct (R0/R1/R1c, OOV, Shape B+) | **not wired into the live turn loop** — "a library, not a lived organ"; no conversation accrues knowledge |
|
||||
| **DETERMINE** | ✅ sound one-hop, same-predicate, positive-only, as-told over 17 predicates | **callable only from tests**; no transitive hop (though `proof_chain` ROBDD exists to reuse); not wired |
|
||||
| **LOOP** | ⚠️ `idle_tick` runs, but only advances **intentionally-partial** discovery chains | does **not learn from lived determined facts**; `determine` not wired in |
|
||||
| **ESTIMATION** | ✅ calibration machinery (`reliability_gate`, Wilson floors) built | no likelihood→serving path — **correctly gated off** until DETERMINE+MEASURE solid |
|
||||
| **EDGE-RUNTIME** | ⚠️ runs CPU-only/offline/deterministic today (verified) | offline-readiness **asserted, not proven**; per-turn persistence **O(n²) cliff** bites when `persist_session_state=True`; no budget gate |
|
||||
|
||||
**So the remaining critical path is integration + measurement, not open-ended organ-building.** The one genuinely open-ended risk (a *general* COMPREHEND reader) we grow incrementally **on the yardstick**, so generalization is proven, not claimed. #596's wrong=0 hazard — fabricating `sibling_of(carol, dan_during_school)` — is the proof of why: a capability off the yardstick hides its own breaches. (Found by post-merge lookback, fixed in #597.)
|
||||
|
||||
## Refined critical path
|
||||
|
||||
```
|
||||
INSTRUMENT ──► WIRE ──► DEEPEN ──► CLOSE ──► [later] ESTIMATION
|
||||
(put it on (organs (transitive (loop learns
|
||||
the yardstick into one determine from determined
|
||||
+ edge gate) live loop) via proof_chain) facts)
|
||||
```
|
||||
|
||||
### Step A — INSTRUMENT (two cheap, independent instruments; parallel-safe)
|
||||
|
||||
**A1 · Put #596 on the yardstick.** Add a `comprehension_relational_predicate` capability lane: binary-relation prose → gold `(predicate, subject, object)` triples authored by a source **independent** of `generate/meaning_graph/relational.py` (a small relation-table oracle over the closed predicate vocab), scored through `comprehend_relational → determine`. Append the adapter, **re-freeze `baseline.json`**, watch breadth 8→9 and the digest change deliberately.
|
||||
- *Falsification:* independent gold (INV-25); reader must not share code with the gold producer (INV-27 disjointness). A genuine climb = breadth 8→9 with `wrong_total` still 0.
|
||||
- *Edge:* +negligible (<tens of cases; index runs ~0.55s CPU-only).
|
||||
- *Why first:* it's the only thing that makes "we added a capability" falsifiable — and it would have caught the #596 fabrication as `wrong>0`.
|
||||
|
||||
**A2 · Edge budget gate (mission-critical, uncharted by the old roadmap).** Add `evals/edge_budget/`: a fixed-length real chat session with `persist_session_state=True`, Python backend, that **fails on breach** of pinned ceilings — per-turn p95 latency, per-turn checkpoint bytes-written, total session bytes. This converts "edge-deployable" from asserted to **proven**, and instruments the O(n²) persistence cliff before it blocks a clinic/disaster-center deployment.
|
||||
- *Falsification:* a constrained-device budget the session must stay under across N turns; fails loudly when persistence cost grows superlinearly.
|
||||
- *Why now:* the mission (disaster center, rural clinic, village school) *is* the edge axis; it must be a gate, not a hope.
|
||||
|
||||
### Step B — WIRE: realize + determine into the live turn loop (highest-leverage capability move)
|
||||
|
||||
After a declarative (query-free) user turn is comprehended, call `realize_comprehension(comprehension, ctx)` on the **same `SessionContext` the runtime already holds**; answer a later question turn via `determine(...)` over `recall_realized`. This is the first time a **conversation actually accrues knowledge** — the library becomes a lived organ. Directly serves the "one continuous life" telos.
|
||||
- *Falsification:* a multi-turn replay where turn N+1 answers from turn N's told fact, `wrong=0`, and the fact survives reboot (Shape B+).
|
||||
- *Edge:* realize write is O(1) + an O(n) linear vault scan (no ANN); fine on a constrained box — but this is what makes A2's persistence gate load-bearing.
|
||||
- *Depends on:* A1 (so the gain is measured), COMPREHEND coverage (grow incrementally).
|
||||
|
||||
### Step C — DEEPEN: transitive determination via the existing prover
|
||||
|
||||
When `member(a,c)` isn't directly grounded, collect realized `member` facts reachable from `a` via `recall_realized`, hand them as opaque Boolean atoms to the **existing sound+complete `proof_chain` ROBDD entailment decider** — reuse, don't build new inference. First multi-hop reasoning over realized knowledge.
|
||||
- *Falsification:* an independent transitive-closure oracle; `wrong=0` preserved; every committed conclusion independently checkable.
|
||||
- *Depends on:* B (facts must be live in the loop first).
|
||||
|
||||
### Step D — CLOSE: the loop learns from determined facts
|
||||
|
||||
In `contemplate`/`idle_tick`, promote a **grounded** sub-question (concrete `(connective, object)` + determined polarity) into a *complete* candidate, so the flywheel proposes from what it **determined**, not just the intentionally-partial discovery chains it emits today. This is the step that makes "forever improving" real and falsifiable.
|
||||
- *Falsification:* a frozen replay shows the capability index (Step A) climbing across loop iterations, autonomously, under HITL ratification — monotonic, junk-free.
|
||||
- *Depends on:* B + C.
|
||||
|
||||
### Step E — ESTIMATION (deliberately last, unchanged from the roadmap)
|
||||
|
||||
Only after the assert/refuse floor (B–D) and calibration measurement (A) are solid: wire one `LicenseDecision` from a committed `ClassTally` to gate one served answer on the safest action. Never a designed-in default; HITL-ratified.
|
||||
|
||||
## Invariants (unchanged, non-negotiable at every step)
|
||||
|
||||
`wrong=0` structural · reviewed learning stays HITL · deterministic replay · identity continuity (L11) · `versor_condition < 1e-6` · no forbidden-site normalization · exact CGA recall · **every step on the yardstick before it counts** · **every step under the edge budget**.
|
||||
|
||||
## What changed vs the 2026-06-05 roadmap
|
||||
|
||||
- The bottleneck is **integration, not construction** — the organs exist, disconnected. Sequencing is now *wire + measure*, not *build*.
|
||||
- **EDGE-RUNTIME is promoted to a first-class, gated axis** (A2). The old roadmap had no edge gate; the mission requires one.
|
||||
- **DETERMINE deepening reuses `proof_chain`** rather than building inference (Step C).
|
||||
- The single highest-risk item remains a *general* COMPREHEND reader; we de-risk it by growing it **on the yardstick**, incrementally, so generalization is proven.
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
# Brief pack — DETERMINE independent gold + relational reader (2026-06-06)
|
||||
|
||||
Two parallel-safe briefs extending the comprehend→realize→determine spine.
|
||||
|
||||
## DAG
|
||||
|
||||
```mermaid
|
||||
graph LR
|
||||
A[Brief 1: ProofWriter-OWA gold lane] -->|independent| M1[merge]
|
||||
P595[#595 relational-predicates pack merged] --> B[Brief 2: relational reader]
|
||||
B --> M2[merge]
|
||||
```
|
||||
|
||||
- **Brief 1** depends on nothing new (uses the `member` predicate already in the reader). Dispatch now.
|
||||
- **Brief 2** depends on **#595 merged** (it consumes that pack's lemmas).
|
||||
- Files are disjoint (`evals/proofwriter_owa/` vs `generate/meaning_graph/` + relation realize/determine) → the two can run concurrently once #595 lands.
|
||||
|
||||
---
|
||||
|
||||
## Brief 1 — ProofWriter-OWA gold lane (independent oracle for DETERMINE's refusal floor)
|
||||
|
||||
**Open with:**
|
||||
```bash
|
||||
git fetch origin main
|
||||
git worktree add ../core-pw-owa origin/main -b feat/proofwriter-owa-gold-lane
|
||||
```
|
||||
|
||||
**Why.** DETERMINE asserts `answer=True` only on direct entailment of a non-negated `member` relation, else `Undetermined`, and never asserts False (open-world). ProofWriter's **OWA split** has a genuine `Unknown` label — the only dataset label semantics that match open-world soundness. An item DETERMINE asserts that gold marks `Unknown`/`False` is a **wrong=0 breach**. This lane makes that breach *findable* against an independent symbolic oracle (INV-25 fit). It is **measure-only: no engine code, no reader tuning.**
|
||||
|
||||
**Scope (do exactly this, nothing more):**
|
||||
1. **Curate a SMALL OWA fixture** — a few dozen items, NOT the corpus (CLAUDE.md: no bulk-ingest). Select **only** items expressible as DETERMINE input: a set of `X is a Y` / type-attribute facts + a single `Is X a Y?`-shaped query, gold ∈ {True, Unknown}. Deterministic selection (sort by ProofWriter id, fixed slice). Commit as `fixtures.jsonl` + a pinned SHA.
|
||||
2. **Provenance** (`provenance.md`): cite source (AllenAI ProofWriter V2020.12.3, arXiv:2012.13048) and record the deterministic selection rule so the fixture is reproducible. Attribution only — no relicensing/redistribution handling; this is a dev gold fixture in a public repo.
|
||||
3. **Scorer** (`score.py`): for each item run `comprehend` → `realize` each fact → `determine(query)`; tally `{correct: asserted-True ∧ gold-True, refused: Undetermined, wrong: asserted ∧ contradicts gold}`.
|
||||
4. **Test** (`test_proofwriter_owa_lane.py`): assert **`wrong == 0`**; pin the fixture SHA; print coverage (`correct / total`).
|
||||
|
||||
**Expected result — state it up front so it isn't read as failure:** DETERMINE has no rule engine, so depth≥1 Trues will **refuse** (coverage miss, NOT wrong). High refusal + **wrong=0** is the pass. The lane's job is to prove no curated OWA item can make DETERMINE assert an `Unknown`.
|
||||
|
||||
**Do NOT:** tune the reader to ProofWriter templates (overfitting trap — coverage is measured, not chased), assert False, add any inference/rule step, or import `generate.derivation`/`core.reliability_gate` (keep it off the GSM8K serving path).
|
||||
|
||||
**Files:** `evals/proofwriter_owa/{fixtures.jsonl, provenance.md, score.py}`, `tests/test_proofwriter_owa_lane.py`. **Tool budget:** ~12–18 calls. Verify with the new test + `core test --suite smoke -q`.
|
||||
|
||||
---
|
||||
|
||||
## Brief 2 — relational reader (first consumer of `en_core_relational_predicates_v1`)
|
||||
|
||||
**Precondition:** #595 merged to main. **Open with:**
|
||||
```bash
|
||||
git fetch origin main
|
||||
git worktree add ../core-rel-reader origin/main -b feat/relational-reader
|
||||
```
|
||||
|
||||
**Why.** #595 added the predicate lexemes (`parent_of`, `less_than`, `left_of`, `before_event`, …) but they are **inert — zero consumers.** This brief builds the deterministic reader that maps NL binary-relation statements onto those predicates, realizes them, and lets DETERMINE answer direct relational queries — the substrate CLUTRR (kinship) and FOLIO/ProofWriter (order/spatial/temporal) need before they can be scored at all.
|
||||
|
||||
**Scope:**
|
||||
1. **Relational comprehension** (extend `generate/meaning_graph/reader.py` or a sibling module): recognize binary-predicate templates (`A is the parent of B`, `A is less than B`, `A is left of B`, `event A is before event B`) → `Relation(predicate=<pack lemma>, arguments=(A,B), negated=False)`. **Fail-closed:** emit a predicate ONLY when both the template and a mounted pack lemma match; otherwise refuse (no guessing, no field vote). Entities may be OOV (the #591/#593 substrate handles arbitrary names).
|
||||
2. **Pack access without default-mount:** load `en_core_relational_predicates_v1` explicitly for the reader; do **not** flip `gate_engaged` / default-mount (that's a separate ratification). Resolve lemmas from the loaded pack.
|
||||
3. **Realize + DETERMINE for relations:** extend the realize path to store realized binary-relation facts (reuse `_realize_structured`; new `structure_kind`), and extend `determine` to answer a non-negated binary-relation query by **direct entailment only** — mirror the `member` path exactly: assert `answer=True, basis="as_told"` on a direct hit, else `Undetermined`. **No transitive/symmetric/rule inference** (later slice); never assert False.
|
||||
|
||||
**wrong=0 obligation (must bite):** a test that introduces one violation — reader emitting a predicate on a non-matching template, or DETERMINE asserting a relation never realized — and confirms an existing test FAILS. Schema-defined-proof-obligation discipline: no vacuous tests.
|
||||
|
||||
**Do NOT:** add transitive/symmetric closure, negation handling, or any predicate not in the mounted pack; mutate identity/runtime; touch the GSM8K serving path; default-mount the pack.
|
||||
|
||||
**Files:** relational reader module + tests under `generate/meaning_graph/`, relation extensions in `generate/realize/` + `generate/determine/`, dedicated tests. **Tool budget:** ~25–35 calls. Verify with new tests + `core test --suite smoke -q` + `core test --suite cognition -q`.
|
||||
|
||||
---
|
||||
|
||||
### Sequencing note
|
||||
Brief 1 falsifies the refusal floor on an independent oracle (no new capability). Brief 2 turns #595 from terminology into a parser and is the prerequisite for kinship/order/spatial/temporal datasets. **DETERMINE-deepening** (entailed-negation → assert-False, unlocking FOLIO's two-sided labels and ProofWriter CWA) is a *third* brief, gated behind Brief 2.
|
||||
|
|
@ -0,0 +1 @@
|
|||
54774
|
||||
File diff suppressed because one or more lines are too long
7
engine_state/_life_backup_c6d0e2a_f5c6914d/manifest.json
Normal file
7
engine_state/_life_backup_c6d0e2a_f5c6914d/manifest.json
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"engine_identity": "75f3bb75649dc5506ca596ffcd7acb6d728bb0ed2a749dcf86ff51e637a29fee",
|
||||
"parent_engine_identity": "75f3bb75649dc5506ca596ffcd7acb6d728bb0ed2a749dcf86ff51e637a29fee",
|
||||
"schema_version": 2,
|
||||
"turn_count": 26396,
|
||||
"written_at_revision": "c6d0e2a92004"
|
||||
}
|
||||
2
evals/field_incidence/__init__.py
Normal file
2
evals/field_incidence/__init__.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
"""Field-incidence probe (option A) — does the field's incidence reading add signal
|
||||
over a fair, same-grammar rational control, or is it reducible (decoration/servant)?"""
|
||||
98
evals/field_incidence/ablation.py
Normal file
98
evals/field_incidence/ablation.py
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
"""The option-A verdict: does the field's incidence reading add independent signal
|
||||
over a FAIR same-grammar rational control, or is it reducible (decoration / servant)?
|
||||
|
||||
For each over-determined incidence case it runs three deciders:
|
||||
- the independent GOLD (rational cross-product),
|
||||
- the FAIR CONTROL (rational line-equation — a same-grammar symbolic reader),
|
||||
- the FIELD reader (conformal incidence via graded_wedge + is_incident).
|
||||
|
||||
The only question that decides the verdict:
|
||||
- ``field_caught`` — cases where the field refuses/flags an inconsistency the fair
|
||||
control admits as consistent (a real independent catch). >0 ⇒ STRONG_PASS.
|
||||
- ``field_worse`` — cases where the field is WRONG vs gold while the control is right
|
||||
(a liability — e.g. f64 incidence drift the exact arithmetic does not have).
|
||||
If field_caught == 0 and field never disagrees with the control, the field is a
|
||||
correct-but-REDUCIBLE coherence check: a useful servant at best, not independent
|
||||
reasoning. That is the honest, expected outcome to confirm or refute.
|
||||
|
||||
Run: PYTHONPATH=. .venv/bin/python -m evals.field_incidence.ablation
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from evals.field_incidence.gold import control_consistency, gold_consistency
|
||||
from generate.field_incidence_reader import read_incidence
|
||||
|
||||
_CASES = Path(__file__).resolve().parent / "cases.jsonl"
|
||||
|
||||
|
||||
def run() -> dict[str, Any]:
|
||||
cases = [json.loads(l) for l in _CASES.read_text().splitlines() if l.strip()]
|
||||
gold_integrity: list[str] = []
|
||||
field_correct = control_correct = 0
|
||||
field_caught: list[str] = [] # field flags an inconsistency the control admits
|
||||
field_worse: list[dict] = [] # field wrong vs gold where control is right
|
||||
field_vs_control_disagree: list[str] = []
|
||||
rows = []
|
||||
|
||||
for c in cases:
|
||||
cid, pts, inc = c["id"], c["points"], c["incidences"]
|
||||
gold = gold_consistency(pts, inc)
|
||||
if gold != c["class"]:
|
||||
gold_integrity.append(f"{cid}: gold={gold} != class={c['class']}")
|
||||
continue
|
||||
control = control_consistency(pts, inc)
|
||||
fr = read_incidence(pts, inc)
|
||||
field = "refused" if fr.refused else fr.verdict
|
||||
|
||||
if control == gold:
|
||||
control_correct += 1
|
||||
if field == gold:
|
||||
field_correct += 1
|
||||
if field != control:
|
||||
field_vs_control_disagree.append(cid)
|
||||
# field catches what control misses: control says consistent, truth is inconsistent,
|
||||
# field does NOT say consistent.
|
||||
if control == "consistent" and gold == "inconsistent" and field != "consistent":
|
||||
field_caught.append(cid)
|
||||
# field is a liability: field wrong vs gold, control right.
|
||||
if field != gold and control == gold:
|
||||
field_worse.append({"id": cid, "field": field, "gold": gold})
|
||||
rows.append({"id": cid, "gold": gold, "control": control, "field": field})
|
||||
|
||||
n = len(rows)
|
||||
reducible = (not field_vs_control_disagree) and (not field_caught)
|
||||
if field_caught and not field_worse:
|
||||
verdict = "STRONG_PASS_field_adds_independent_signal"
|
||||
elif field_worse:
|
||||
verdict = "LIABILITY_field_worse_than_arithmetic"
|
||||
elif reducible:
|
||||
verdict = "REDUCIBLE_servant_no_independent_signal"
|
||||
else:
|
||||
verdict = "INCONCLUSIVE"
|
||||
|
||||
return {
|
||||
"total": n,
|
||||
"verdict": verdict,
|
||||
"field_correct": field_correct,
|
||||
"control_correct": control_correct,
|
||||
"field_caught_what_control_missed": field_caught,
|
||||
"field_worse_than_arithmetic": field_worse,
|
||||
"field_vs_control_disagreements": field_vs_control_disagree,
|
||||
"gold_integrity_failures": gold_integrity,
|
||||
"rows": rows,
|
||||
}
|
||||
|
||||
|
||||
def main() -> int:
|
||||
rep = run()
|
||||
print(json.dumps({k: v for k, v in rep.items() if k != "rows"}, indent=2))
|
||||
return 1 if rep["gold_integrity_failures"] else 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
12
evals/field_incidence/cases.jsonl
Normal file
12
evals/field_incidence/cases.jsonl
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{"id": "fi-0001", "points": {"a": [0,0], "b": [4,0], "c": [2,-3], "d": [2,3], "p": [2,0]}, "incidences": [["p","a","b"],["p","c","d"]], "class": "consistent"}
|
||||
{"id": "fi-0002", "points": {"a": [0,0], "b": [4,0], "c": [2,-3], "d": [2,3], "p": [3,0]}, "incidences": [["p","a","b"],["p","c","d"]], "class": "inconsistent"}
|
||||
{"id": "fi-0003", "points": {"o1a": [0,0], "o1b": [2,2], "o2a": [1,0], "o2b": [1,2], "o3a": [0,1], "o3b": [2,1], "p": [1,1]}, "incidences": [["p","o1a","o1b"],["p","o2a","o2b"],["p","o3a","o3b"]], "class": "consistent"}
|
||||
{"id": "fi-0004", "points": {"o1a": [0,0], "o1b": [2,2], "o2a": [1,0], "o2b": [1,2], "o3a": [0,2], "o3b": [2,2], "p": [1,1]}, "incidences": [["p","o1a","o1b"],["p","o2a","o2b"],["p","o3a","o3b"]], "class": "inconsistent"}
|
||||
{"id": "fi-0005", "points": {"a": [0,0], "b": [5,5], "p": [1,1], "q": [2,2]}, "incidences": [["p","a","b"],["q","a","b"]], "class": "consistent"}
|
||||
{"id": "fi-0006", "points": {"a": [0,0], "b": [3,6], "c": [0,1], "d": [4,1], "p": [1,2]}, "incidences": [["p","a","b"],["p","c","d"]], "class": "inconsistent"}
|
||||
{"id": "fi-0007", "points": {"a": [0,0], "b": [100000,100000], "p": [50000,50000]}, "incidences": [["p","a","b"]], "class": "consistent"}
|
||||
{"id": "fi-0008", "points": {"a": [0,0], "b": [100000,100000], "p": [50000,50001]}, "incidences": [["p","a","b"]], "class": "inconsistent"}
|
||||
{"id": "fi-0009", "points": {"a": [1,1], "b": [3,3], "p": [2,2]}, "incidences": [["p","a","b"]], "class": "consistent"}
|
||||
{"id": "fi-0010", "points": {"a": [1,1], "b": [3,3], "p": [2,3]}, "incidences": [["p","a","b"]], "class": "inconsistent"}
|
||||
{"id": "fi-0011", "points": {"a": [0,0], "b": [4,4], "c": [2,0], "d": [2,4], "e": [0,2], "f": [4,2], "g": [0,4], "h": [4,0], "p": [2,2]}, "incidences": [["p","a","b"],["p","c","d"],["p","e","f"],["p","g","h"]], "class": "consistent"}
|
||||
{"id": "fi-0012", "points": {"a": [0,0], "b": [4,4], "c": [2,0], "d": [2,4], "g": [0,0], "h": [4,0], "p": [2,2]}, "incidences": [["p","a","b"],["p","c","d"],["p","g","h"]], "class": "inconsistent"}
|
||||
46
evals/field_incidence/gold.py
Normal file
46
evals/field_incidence/gold.py
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
"""Independent gold + a fair, same-grammar symbolic control for the incidence probe.
|
||||
|
||||
Both are EXACT integer/rational arithmetic and share NO code with the field reader
|
||||
(no ``algebra`` import). Two structurally-distinct rational methods are used so the
|
||||
ablation is honest:
|
||||
|
||||
- ``gold_consistency`` — the ground truth, via the cross-product collinearity test
|
||||
``(B-A) x (P-A) == 0``.
|
||||
- ``control_consistency`` — the FAIR same-grammar control a symbolic reader would run,
|
||||
via a different rational method (the line-equation residual), to show that even two
|
||||
independent *arithmetic* readers agree — so any field "win" must be over a strawman,
|
||||
not a fair control.
|
||||
|
||||
Coordinates are integers, so every check is exact (no tolerance).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
def _collinear_crossproduct(p, a, b) -> bool:
|
||||
# (B-A) x (P-A) == 0 (z-component of the 2-D cross product)
|
||||
return (b[0] - a[0]) * (p[1] - a[1]) - (b[1] - a[1]) * (p[0] - a[0]) == 0
|
||||
|
||||
|
||||
def _collinear_line_equation(p, a, b) -> bool:
|
||||
# Line through A,B: (y-a_y)*(b_x-a_x) - (x-a_x)*(b_y-a_y) == 0, evaluated at P.
|
||||
# Algebraically equal to the cross product, but written independently.
|
||||
dx, dy = b[0] - a[0], b[1] - a[1]
|
||||
return (p[1] - a[1]) * dx - (p[0] - a[0]) * dy == 0
|
||||
|
||||
|
||||
def _decide(points: dict, incidences: list, collinear) -> str:
|
||||
for p_name, a_name, b_name in incidences:
|
||||
if not collinear(points[p_name], points[a_name], points[b_name]):
|
||||
return "inconsistent"
|
||||
return "consistent"
|
||||
|
||||
|
||||
def gold_consistency(points: dict, incidences: list) -> str:
|
||||
"""Ground truth (cross-product method)."""
|
||||
return _decide(points, incidences, _collinear_crossproduct)
|
||||
|
||||
|
||||
def control_consistency(points: dict, incidences: list) -> str:
|
||||
"""The fair same-grammar symbolic control (line-equation method)."""
|
||||
return _decide(points, incidences, _collinear_line_equation)
|
||||
71
generate/field_incidence_reader.py
Normal file
71
generate/field_incidence_reader.py
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
"""Field incidence reader — the SUT for the section-level coherence probe (option A).
|
||||
|
||||
Reads an over-determined 2-D incidence configuration (named points + claims of the
|
||||
form "point P lies on the line through A and B") and decides whether the configuration
|
||||
is jointly CONSISTENT, using ONLY the field's incidence algebra: each point embeds as a
|
||||
conformal null vector, each line is the grade-3 OPNS flat ``A ^ B ^ n_inf``
|
||||
(`graded_wedge`), and incidence is the EXACT ``P ^ line == 0`` zero-test
|
||||
(`is_incident`). No float tolerance to admit (per wrong=0): a point off a line is
|
||||
refused, never accepted as on it.
|
||||
|
||||
This is deliberately the FIELD doing the read geometrically. The probe
|
||||
(`evals/field_incidence/ablation.py`) measures whether that read is independent of —
|
||||
or merely reducible to — a fair rational-arithmetic incidence control over the same
|
||||
grammar.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
import numpy as np
|
||||
|
||||
from algebra.cga import EMBED_EXACT_MAX, embed_point, graded_wedge, is_incident
|
||||
from algebra.cl41 import N_COMPONENTS
|
||||
|
||||
READER_LINEAGE = "field.incidence_2d"
|
||||
_F64 = np.float64
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class IncidenceReading:
|
||||
refused: bool
|
||||
verdict: str | None = None # "consistent" | "inconsistent"
|
||||
refusal_reason: str | None = None
|
||||
reader_lineage: str = READER_LINEAGE
|
||||
|
||||
|
||||
def _n_inf() -> np.ndarray:
|
||||
v = np.zeros(N_COMPONENTS, dtype=_F64)
|
||||
v[4] = 1.0
|
||||
v[5] = 1.0
|
||||
return v
|
||||
|
||||
|
||||
def _embed2d(xy: list) -> np.ndarray:
|
||||
return embed_point(np.array([float(xy[0]), float(xy[1]), 0.0], dtype=_F64), dtype=_F64)
|
||||
|
||||
|
||||
def read_incidence(points: dict, incidences: list) -> IncidenceReading:
|
||||
"""Decide joint incidence consistency geometrically, or refuse out-of-regime."""
|
||||
if not points or not incidences:
|
||||
return IncidenceReading(refused=True, refusal_reason="empty_case")
|
||||
for xy in points.values():
|
||||
if not (isinstance(xy, list) and len(xy) == 2):
|
||||
return IncidenceReading(refused=True, refusal_reason="malformed_point")
|
||||
if max(abs(float(xy[0])), abs(float(xy[1]))) > EMBED_EXACT_MAX:
|
||||
return IncidenceReading(refused=True, refusal_reason="over_ceiling")
|
||||
|
||||
embedded = {name: _embed2d(xy) for name, xy in points.items()}
|
||||
n_inf = _n_inf()
|
||||
|
||||
for inc in incidences:
|
||||
if len(inc) != 3 or any(n not in embedded for n in inc):
|
||||
return IncidenceReading(refused=True, refusal_reason="malformed_incidence")
|
||||
p, a, b = inc
|
||||
if a == b:
|
||||
return IncidenceReading(refused=True, refusal_reason="degenerate_line")
|
||||
line = graded_wedge(graded_wedge(embedded[a], embedded[b]), n_inf)
|
||||
if not is_incident(embedded[p], line):
|
||||
return IncidenceReading(refused=False, verdict="inconsistent")
|
||||
return IncidenceReading(refused=False, verdict="consistent")
|
||||
17
patch_nodes.py
Normal file
17
patch_nodes.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import json
|
||||
|
||||
with open('/Users/kaizenpro/Projects/core/.system-map/raw_nodes.json', 'r') as f:
|
||||
data = json.load(f)
|
||||
|
||||
for node in data.get('nodes', []):
|
||||
if node['zone_id'] == 'L6-chat-runtime':
|
||||
if "inline realization" not in node['what_it_does']:
|
||||
node['what_it_does'] += " Additionally, handles inline realization (Step B-1), surface determination (Step B-2), and enforces edge-deployment budget gates per-turn."
|
||||
if node['zone_id'] == 'L5-cognition':
|
||||
if "ASK serving" not in node['what_it_does']:
|
||||
node['what_it_does'] += " Integrating ASK serving scope and Q1-B missing_* reclassification carve-outs."
|
||||
|
||||
with open('/Users/kaizenpro/Projects/core/.system-map/raw_nodes.json', 'w') as f:
|
||||
json.dump(data, f, indent=2)
|
||||
|
||||
print("Patched raw_nodes.json successfully.")
|
||||
Loading…
Reference in a new issue