core/tests/test_relational_metric_lane.py
Shay 145d797196 feat(field-wedge): geometric field reader — relational-metric lane wrong=0 (Phase W.1)
Measurement #1 of the field-reasoner falsifiable experiment: does the CL(4,1) field,
given an honest metric encoding, read forward-substitutable quantitative-relational
problems from TEXT with wrong==0? It does — 14/15 correct, 0 wrong, 1 refused
(precision ceiling), scored against an independent arithmetic oracle.

- generate/relational_field_reader.py: reads problem text into conformal points on
  the e1 number line; additive/part-whole relations are conformal TRANSLATOR versors
  (versor_apply(T_delta, embed[x]) == embed[x+delta], exact); the answer reads back
  by projective dehomogenization. Refusal-first: fences multiplicative/ratio (the
  sign/orientation-blind cases), the precision ceiling, non-forward-substitutable
  references, negatives. A per-step exactness self-check turns any f64 translator
  drift into a refusal (precision_drift) — it NEVER commits a wrong integer. Its
  parser is an independent reimplementation importing no generate.derivation/math_*.
- evals/relational_metric/: independent arithmetic oracle (computes gold from the
  STRUCTURE, shares no code with the reader), 15-case fixture, and a runner that
  enforces gold integrity + wrong==0.
- INV-25: relational_metric registered in INDEPENDENT_GOLD_LANES (oracle proven
  code-disjoint from the field reader and the algebra engine). The independently
  golded panel is now three domains: deductive, dimensional, relational-metric.

Green: smoke 87, 53 architectural invariants, 16 new tests; deductive + dimensional
lanes unperturbed (wrong=0).
2026-06-04 19:34:43 -07:00

35 lines
1.5 KiB
Python

"""Relational-metric gold lane — the field reader is wrong==0 vs an independent gold.
This is measurement #1 of the field-reasoner wedge falsifiable experiment: does the
geometric field reader, reading problem TEXT, commit answers that match an
independent arithmetic oracle (computed from the STRUCTURE) with zero wrong? The
oracle shares no code with the reader (enforced structurally by INV-25's
INDEPENDENT_GOLD_LANES registration).
"""
from __future__ import annotations
from evals.relational_metric.runner import run
def test_lane_is_wrong_zero_with_independent_gold():
report = run()
# The committed gold is reproducible by the independent oracle (never field-derived).
assert report["gold_integrity_failures"] == [], report["gold_integrity_failures"]
# wrong==0 is the prime directive on this lane.
assert report["wrong"] == 0, report["wrong_detail"]
# Buckets account for every case.
assert report["total"] == report["correct"] + report["wrong"] + report["refused"]
def test_field_actually_commits_not_a_refusal_floor():
"""A refusal floor (refuse everything) would be wrong==0 too — and worthless.
The capability claim is COVERAGE with wrong==0: the field must commit real cases."""
report = run()
assert report["correct"] >= 10
def test_over_ceiling_is_refused_not_wrong():
"""The precision ceiling is honest coverage (a refusal), never a wrong commit."""
report = run()
assert any("over_ceiling" in r for r in report["refused_detail"])