Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions docs/retro/CLAIM_SELECTION_TRANSFER_20261023.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# DYN-CLAIM-SELECTION-01 — source-bound claim/selection transfer diagnostic

**Experimental engineering, NOT A RESULT.** Scientific effect **NONE**. Independence credit **0**, OBL **OPEN**, no flags changed. This is an *opt-in input diagnostic*, not a scientific-status register, a theorem prover, an adopted graph edge, a required gate, or an automatic validator of user-provided mathematical premises.

## Why the mathematical object matters to the architecture

A research dependency cannot be justified merely because two asymptotic expressions contain the same power of `r`. Their **observable, event, conditioning law, selection and count region** must agree. The original RN interface explicitly warns that the cubic event probability bound `P(E_r) <= C r^3` does *not* by itself establish the cubic event-weighted count bound `E[N_r 1_{E_r}] <= C' r^3`. This is a mathematical claim-identity problem that should stay visible when a research architecture displays source/implementation relationships.

The frozen, **existing** mathematics is in `d6g8k5htny-coder/Math-@9f3fb6918b28e6378c034ebc19e76d432f5391cb`, directory `frontiers/three_fronts_20260924/`:

| Original artifact | Git blob | Boundary |
|---|---|---|
| `RN_COUNT_INTERFACE.md` | `371fd6d17920f2eb3b1c5ec30297acf6daf1d385` | Section 2: Hölder N1/N2 and exact conditional identity N3; count integral not evaluated |
| `frontier_math.py` | `d64e119adad0dfb3da5ff033a81234129fccb253` | `holder_exponent` and `rare_count`, finite exact models; not an RN numerical certificate |
| `test_frontiers.py` | `283a469ab831daae537c7f37b36be9523750d1cd` | Tests p=2, p=4, growing moments and a rare-count counterexample |
| `RESULTS.json` | `f0cd87a8ca4f07164d73008667dfbe7e9aa3a016` | `rn.triple_integral_evaluated=false`, `scientific_acceptance=false` |

The existing [two-node source trace on board #539](https://github.com/d6g8k5htny-coder/main/issues/539#issuecomment-6374115953) records this source→program→tests chain. This addition **consumes** that existing trace; it does not claim to independently review/replay the original mathematical proof or add a `math.rn-count-interface` binding. The original graph classification remains `AUTHOR_SIDE_CANDIDATE` at the pinned graph source, with no modification.

## Exact algebra (no generalized or new theorem)

This tool uses only the original source's specific **cubic** setting. Given separately declared estimates

- `P(E_r) <= C r^3`, and
- `E[N_r^p] <= A r^(-beta)`, where integer `2 <= p <= 64` and `beta >= 0`,

the cited finite Hölder algebra gives the exact rational power `gamma=(3(p-1)-beta)/p` for the **event-weighted** count `E[N_r 1_{E_r}]`. Under a separately declared **uniform conditional count-mean** premise, the source's identity `E[N_r 1_{E_r}] = P(E_r) E[N_r|E_r]` gives `gamma=3`. The constants, source hypotheses and validity of any premise are **not** verified by this tool. Rate comparison uses the small-radius convention `0 < r <= 1`: `gamma >= requested_power` is only an algebraic exponent comparison under those asserted premises.

| Declared route | Diagnostic derived rate | Requested cubic count-rate assessment |
|---|---|---|
| Event probability *alone* | none | **Not implied** |
| Uniform second moment, p=2, beta=0 | `3/2` | **Insufficient** |
| Uniform fourth moment, p=4, beta=0 | `9/4` | **Insufficient** |
| Fourth moment grows as `r^-2` | `7/4` | **Insufficient** |
| Event probability plus **actual uniform conditional count mean** | `3` | Exponent comparison meets target **if** both assertions hold |

A source-provided rare-count counterexample has `r=2^-n`, `P(E_r)=r^3`, and `N_r=n` on the event, giving `E[N_r 1_E]/r^3=n`. Finite test values demonstrate the bookkeeping but do not constitute a new all-small-`r` proof or Gaussian model calculation.

## Interface and deliberate refusal boundary

The opt-in command reads **only bounded standard input** (at most 16,384 bytes) and emits deterministic JSON. It performs no disk writes, network activity, remote Git reads, Math module execution, or mutations. The canonical proposed command is:

```sh
python -B -S tools/claim_selection_transfer.py <<'JSON'
{"schema":"claim-selection-transfer.v1","target":{"identity":{"law":"Q_r_weighted_palm","conditioning":"six_pin","event":"E_r","count":"N_B","region":"fixed_B","selection":"event_weighted"},"observable":"event_weighted_count_expectation","requested_power":"3"},"event_bound":{"identity":{"law":"Q_r_weighted_palm","conditioning":"six_pin","event":"E_r","count":"N_B","region":"fixed_B","selection":"event_weighted"},"rate":"r^3"},"count_information":{"kind":"unconditional_p_moment","identity":{"law":"Q_r_weighted_palm","conditioning":"six_pin","event":"E_r","count":"N_B","region":"fixed_B","selection":"event_weighted"},"order":2,"beta":"0"}}
JSON
```

The six identity fields are exact **caller-declared strings**; there is no fuzzy compatibility inference. Only target observable `event_weighted_count_expectation` is supported. The **unconditional whole count** `E N_r`, a different population, conditioning, selected law, event, region, or statistic is refused, not patched with a guessed support relation. The count-information choice is precisely `none`, `unconditional_p_moment` or `uniform_conditional_mean`; a missing count premise cannot silently become a positive theorem. Unknown fields, duplicate JSON keys, float and boolean numerics, malformed/oversize input and unsupported powers yield exit code `2`, zero stdout and the fixed opaque error `CLAIM_SELECTION_TRANSFER_REFUSED` on stderr. No offending private values are echoed.

**Output always reports** `premises_independently_verified=false`, `source_identity_runtime_verified=false`, `scientific_acceptance=false`, `scientific_effect=NONE`, `graph_binding_created=false`, and the immutable source references above. In particular `exponent_comparison=meets_declared_target` is *not* a grade, proof, independent review, adopted graph relation, or discharge of RN's still-open numerical/continuum obligations.

## Verification and promotion firewall

The isolated engineering tests, `tests/test_architecture_claim_selection_transfer.py`, cover event-only refusal, exact finite p powers, growing moments, event/selection/population/scope mismatch, whole-count mismatch, strict input parsing, bounded CLI, source flag, deterministic output and a synthetic rare-count witness. Author-side isolated local execution ran **21/21 methods with normal `-B -S` and 21/21 with `-B -O -S`**, no skips/errors, before publication. A deliberately weakened exponent formula is checked as a negative control separately; any result is recorded on the source PR rather than implied here. The test's `test_architecture_*.py` name makes it eligible for **existing** architecture test discovery; no CI workflow or required-check is changed.

**Integration is separate.** A different source-exposed engineering reviewer must confirm the typed premises, exact N1/N2/N3 algebra, negative controls, source pins, limitations and CLI behavior. A separate integrator then reconciles current default-branch composition, exact-head tested checks, outstanding review findings and protected merge rules. Only later, through a separately reviewed architecture decision, might a consumer opt into this experimental diagnostic. It **never** becomes a mathematical acceptance gate automatically.

[Architecture discussion #275](https://github.com/d6g8k5htny-coder/main/issues/275) · [Current coordination #539](https://github.com/d6g8k5htny-coder/main/issues/539) · [Complete owner mandate](https://github.com/d6g8k5htny-coder/main/blob/main/governance/OWNER_MANDATE_20261015.md) · [Standing delegation](https://github.com/d6g8k5htny-coder/main/blob/main/governance/OP-AUTONOMY-20260923-v2.1.md). Link delivery is not agent acknowledgement.

credit 0 · sci NONE · eng ≠ discharge · no flags · OBL OPEN · NOT A RESULT
173 changes: 173 additions & 0 deletions tests/test_architecture_claim_selection_transfer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
"""Synthetic engineering controls for the opt-in, nonauthoritative interlock."""
from __future__ import annotations

import copy
import importlib.util
import json
import subprocess
import sys
import unittest
from fractions import Fraction
from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
TOOL = ROOT / "tools" / "claim_selection_transfer.py"
SPEC = importlib.util.spec_from_file_location("claim_selection_transfer", TOOL)
assert SPEC and SPEC.loader
M = importlib.util.module_from_spec(SPEC)
SPEC.loader.exec_module(M)

ID = {
"law": "Q_r_weighted_palm", "conditioning": "six_pin",
"event": "E_r", "count": "N_B", "region": "fixed_B",
"selection": "event_weighted",
}


def sample(kind="none", order=2, beta="0", target="3"):
info = {"kind": kind, "identity": copy.deepcopy(ID)}
if kind == "unconditional_p_moment":
info.update(order=order, beta=beta)
return {
"schema": M.SCHEMA,
"target": {"identity": copy.deepcopy(ID), "observable": "event_weighted_count_expectation", "requested_power": target},
"event_bound": {"identity": copy.deepcopy(ID), "rate": "r^3"},
"count_information": info,
}


class ClaimSelectionEngineering(unittest.TestCase):
def test_event_probability_alone_does_not_control_expected_count(self):
d = M.evaluate(sample())
self.assertIsNone(d["derived_power"])
self.assertEqual(d["exponent_comparison"], "no_count_rate_implied")

def test_holder_p2_is_three_halves_not_three(self):
d = M.evaluate(sample("unconditional_p_moment", 2))
self.assertEqual((d["derived_power"], d["exponent_comparison"]),
("3/2", "insufficient_for_declared_target"))

def test_holder_p4_is_nine_quarters(self):
d = M.evaluate(sample("unconditional_p_moment", 4))
self.assertEqual(d["derived_power"], "9/4")

def test_holder_growing_moment_has_beta_penalty(self):
d = M.evaluate(sample("unconditional_p_moment", 4, "2"))
self.assertEqual(d["derived_power"], "7/4")

def test_holder_inequality_comparison_only(self):
d = M.evaluate(sample("unconditional_p_moment", 4, target="2"))
self.assertEqual(d["exponent_comparison"], "meets_declared_target")
self.assertFalse(d["premises_independently_verified"])
self.assertFalse(d["scientific_acceptance"])
self.assertFalse(d["graph_binding_created"])

def test_conditional_mean_requires_explicit_premise(self):
d = M.evaluate(sample("uniform_conditional_mean"))
self.assertEqual(d["derived_power"], "3")
self.assertEqual(d["route"], "explicit_uniform_conditional_mean")
self.assertFalse(d["source_identity_runtime_verified"])

def test_finite_moment_cannot_satisfy_cubic_goal_without_more(self):
for p in range(2, 65):
self.assertLess(Fraction(M.evaluate(sample("unconditional_p_moment", p))["derived_power"]), 3)

def test_rare_count_exact_counterexample(self):
# Existing Math- source rare_count(n): r=2^-n, P(E)=r^3, N=n on E.
# The ratio E[N 1_E]/r^3 is n; finite samples are NOT a theorem replay.
for n in (1, 2, 8, 32):
r = Fraction(1, 2**n)
probability = r**3
self.assertEqual((n * probability) / probability, n)
self.assertGreaterEqual((n * probability) / r**3, 1)

def test_scope_dimensions_reject_cross_population(self):
for name in M.IDENTITY:
t = sample("unconditional_p_moment", 2)
t["count_information"]["identity"][name] = "other_scope"
with self.subTest(name=name), self.assertRaises(M.Refused):
M.evaluate(t)

def test_event_scope_mismatch_refuses(self):
t = sample("uniform_conditional_mean")
t["event_bound"]["identity"]["conditioning"] = "unconditioned"
with self.assertRaises(M.Refused):
M.evaluate(t)

def test_unconditional_count_not_supported(self):
t = sample("uniform_conditional_mean")
t["target"]["observable"] = "whole_count_expectation"
with self.assertRaises(M.Refused):
M.evaluate(t)

def test_float_and_boolean_moment_orders_refuse(self):
for bad in (1, 0, 2.0, True, -1, 65, "2"):
t = sample("unconditional_p_moment", bad)
with self.subTest(bad=bad), self.assertRaises(M.Refused):
M.evaluate(t)

def test_nonexact_or_out_of_scope_exponents_refuse(self):
for bad in (1.0, True, "3.0", "-1", "65", "1/0", "1e3", "1/100000", "01"):
t = sample("unconditional_p_moment", 2, bad)
with self.subTest(bad=bad), self.assertRaises(M.Refused):
M.evaluate(t)

def test_invalid_identity_value_refuses(self):
for bad in ("", "x y", "a" * 81, 7, True, "secret\nabc"):
t = sample()
t["target"]["identity"]["selection"] = bad
with self.subTest(bad=bad), self.assertRaises(M.Refused):
M.evaluate(t)

def test_wrong_source_rate_refuses(self):
t = sample()
t["event_bound"]["rate"] = "r^2"
with self.assertRaises(M.Refused):
M.evaluate(t)

def test_unknown_key_and_extra_count_premise_refuse(self):
t = sample()
t["new_acceptance_flag"] = True
with self.assertRaises(M.Refused):
M.evaluate(t)
t = sample("none")
t["count_information"]["order"] = 2
with self.assertRaises(M.Refused):
M.evaluate(t)

def test_source_pins_are_fixed_but_not_implicitly_verified(self):
d = M.evaluate(sample())
self.assertEqual(d["source"]["program_blob"], "d64e119adad0dfb3da5ff033a81234129fccb253")
self.assertFalse(d["source_identity_runtime_verified"])

def test_duplicate_json_keys_and_scientific_claim_injection_refuse(self):
text = json.dumps(sample()).replace('"schema": ', '"schema": "false", "schema": ', 1)
with self.assertRaises(M.Refused):
M.parse(text.encode("utf-8"))

def test_json_float_constant_and_length_refuse(self):
for raw in (b'{"x":1.0}', b'{"x":NaN}', b'{"x":Infinity}', b'', b'[' + b' ' * M.LIMIT + b']'):
with self.subTest(raw=raw[:20]), self.assertRaises(M.Refused):
M.parse(raw)

def test_cli_success_is_deterministic_and_nonadmitting(self):
raw = json.dumps(sample("unconditional_p_moment", 2)).encode()
runs = [subprocess.run([sys.executable, "-B", "-S", str(TOOL)], input=raw, capture_output=True)
for _ in range(2)]
for run in runs:
self.assertEqual((run.returncode, run.stderr), (0, b""))
data = json.loads(run.stdout)
self.assertFalse(data["scientific_acceptance"])
self.assertEqual(data["derived_power"], "3/2")
self.assertEqual(runs[0].stdout, runs[1].stdout)

def test_cli_refusal_opaque_and_no_stdout(self):
raw = b'{"personal_secret":"this must not echo","personal_secret":42}'
run = subprocess.run([sys.executable, "-B", "-S", str(TOOL)], input=raw, capture_output=True)
self.assertEqual(run.returncode, 2)
self.assertEqual(run.stdout, b"")
self.assertEqual(run.stderr, b"CLAIM_SELECTION_TRANSFER_REFUSED\n")


if __name__ == "__main__":
unittest.main()
Loading
Loading