Skip to content
Open
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
126 changes: 126 additions & 0 deletions research/independent-global-rank-replay/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Independent replay of two P104 native words

This package replays two existing native words, rebuilds their invoices, and checks them with one script.
The words are the one in #7000 (`research/shared-wire-split-composition`) and the one in #6030
(`research/p104-helper470-twin-rung-removal`). It adds no new construction, no new kappa and no supplier.
Python standard library only, 3.11 to 3.14. Base commit `e54523517d0f03e58352e647c403a5af3e525a57`.

```sh
python3 -I -B research/independent-global-rank-replay/replay.py
python3 -I -B tests/test_independent_global_rank_replay.py
```

Each run ends with `PASS` and takes about 40 seconds. The script compares its output with the committed
`RESULT.json`. Rerun with `--write` to regenerate it.

## What the script checks

1. Every input file matches its sha256 in `SOURCES.json`.
2. A forward replay of each word over exact fractions, with every public input a free symbol. It checks
frame continuity, that every scalar is nonzero, that every public MOVE goes strictly up in frame, that
all owned rows are cleared, and that every helper has a positive credit with nested frames.
3. The main rows equal the block the word declares: a unit shear on ordinary ports, the declared mix on the
other live ports, and the declared hosted pairs.
4. The double-credit test. Every helper row is the identity, no input appears in two helper rows, and no
helper row reads a main input. Nothing is inferred from a rank count.
5. The paid and target profiles (T and P) rebuilt from the replay and the caller data.
6. One crossing solver for both words. It proves the root is unique on [0, 0.01] by a derivative bound, and
it refuses empty profiles and rank 0.
7. For #7000: the root is at least the tested value in `FULL-RESULT.json` (checked at the root and by the sign
of the moment at the tested value).
8. For #6030: a known-answer test. T and P are rebuilt from the replay, including the query term
(15 query shears times 104 ports on P[1]), and must equal the record exactly. The solver sees only the
rebuilt profiles. The root must lie in the recorded interval.
9. Seven mutation controls.

## Results

| Item | Value |
|---|---|
| #7000 credit mass per call / paid mass per call | 7650 / 10962 |
| #7000 rank surplus (18 calls) | 1520 |
| #7000 crossing | 0.00363005817468836708593357676489... |
| #7000 tested value / margin | 0.00363005817007, root is 4.6e-12 above |
| #6030 productive / paid / surplus | 13444 / 66834 / 760 |
| #6030 root | 0.00312581155791189724625134438... |
| #6030 recorded interval | (0.00312581155791, 0.00312581155792) |
| Derivative bound on [0, 0.01] | -387072 (#7000), -214612 (#6030), both below 0 |
| Owned erasures of a nonzero field | 53 (#7000), 30 (#6030). Allowed, reported as information. |

Both words pass every check. Both moments change sign many times when ordered by rank (15 and 19 changes),
so Descartes' rule of signs would only bound the number of roots by 15 and 19. Uniqueness comes from the
derivative bound instead: the moment falls strictly on the whole interval, so it has at most one root there.

## Mutation controls

Each control edits the word, or the rebuild, and must be rejected by its target check. The unmutated input
passes that same check in the same run. A control passes only if the target check fails and nothing outside
its listed side effects fails.

| Control | Target check | Also fails |
|---|---|---|
| Insert `ADD 1478 += 759` at event 40637 (frame 660) | double credit | none |
| Flip the scalar of one main-row ADD | main rows | none |
| Insert an ADD with scalar 0 | nonzero scalars | none |
| A public MOVE goes down and back up | public moves up | record profiles |
| Delete a public MOVE | frame chain | record profiles |
| Rebuild #6030 without the query term | P equals record | paid calls, surplus, interval |
| Remove one rank-8 credit per call from #7000 | root at least tested | none |

The first control is the leak that a symbol-renaming alias test missed: with it the per-field credit and the
paid mass do not change, but a helper row stops being the identity and one input is shared.

## What is independent and what is not

Independent of the audited packages: the forward replay, the check list above, the profile rebuild from the
replay, the #6030 known-answer test and the mutation controls. No code from the audited packages is imported.
Their JSON files are read as data.

Not independent:

- The crossing uses the repository's own invoice formula (the sum of (T - P)(r) r^(1-k)). Matching the
#7000 record is a reproduction of that formula, not a second derivation of it.
- The caller tables are read from the records: `caller.json` for #7000, and for #6030 the main targets,
idle jobs, port count and the 15 query shears in `RESULT.json`.
- The main-row block is read from the word's own declared parameters (alpha, beta, alpha2, beta2, Dports).
It catches edits to the word, not a wrong declaration.
- The #7000 record is also used for comparison: its T, P, surplus, bracket and tested value. These are read
after the solve and never enter it.

## What is not covered

- No claim about kappa, the supplier, the caller identity or the outer gate. Those checks are in the audited
packages.
- Split tails are not identified from the word. The two proof files name the pivot helper and the cut
frame. The tail rank is derived from the frames. For helper 450 two helpers (496 and 1479) have the same
frames and rank, so the unsplit sensitivity in `RESULT.json` uses ranks only.
- The derivative bound uses 70-digit decimal arithmetic with a margin above 2e5, not interval arithmetic.
- Nothing here checks the public/owned MOVE costs against the physical model, only the replayed counts
against the records.

## Sensitivities (information)

`RESULT.json` lists the #7000 crossing if one field of rank r lost its credit in every call, for each r
from 1 to 9 (rank 2: 0.0035437, rank 8: 0.0032862), and if the two named splits were valued as unsplit
rank-9 helpers (0.0036288). They are derived from the replay output, not from a fixed rank or fixed tuples.
The rank that an aliased tail would lose depends on field order, so all ranks are listed.

## Files

- `replay.py`: the script.
- `RESULT.json`: its output, regenerated with `--write`.
- `SOURCES.json`, `VERIFY.json`, `TASK.json`: inputs and their hashes, replay commands, task record.
- `../../tests/test_independent_global_rank_replay.py`: unit tests plus the full replay with the controls.

## Open next questions

- Can the main-row block be checked against the symbolic caller identity instead of the word's own
declaration? It would catch a wrong declaration. First step: compare the expected main matrix with
`data/caller.json` in #7000. No blocker.
- Can split tails be identified from the word alone? The 450 split has two tail candidates. First step:
trace which tail reads the cut vectors in `data/split759_450.proof.json`. No blocker.

## Credit

Audited work: the #7000 package and the #6030 package, with their predecessors credited there. An independent reviewer found the weaknesses in the first version of these checks, and this version fixes them. This package was
written and run by Claude models (Anthropic) under human oversight. Apache-2.0.
263 changes: 263 additions & 0 deletions research/independent-global-rank-replay/RESULT.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
{
"base_commit": "e54523517d0f03e58352e647c403a5af3e525a57",
"controls": {
"6030_without_query_term": {
"crossing": "0.009676180745500276582762388438236732630932236421317766647159",
"edit": "leave the query shears (15 x 104 on P[1]) out of the rebuild",
"failed_checks": [
"P_equals_record",
"paid_calls_equal_expect",
"root_in_recorded_interval",
"surplus_equals_expect"
],
"rejected": true,
"target_check": "P_equals_record"
},
"7000_one_rank8_credit_lost_per_call": {
"crossing": "0.003286164009629317532936715259",
"edit": "remove one rank-8 credit in each of the 18 calls from T",
"failed_checks": [
"root_at_least_tested"
],
"rejected": true,
"target_check": "root_at_least_tested"
},
"main_row_sign_flip": {
"edit": "flip the scalar of the ADD at event 3030 (main row 152)",
"failed_checks": [
"main_rows"
],
"rejected": true,
"target_check": "main_rows"
},
"public_move_down_and_up": {
"edit": "after the public MOVE at event 24472 insert MOVE 415 99->3 and back",
"failed_checks": [
"public_moves_up",
"record_profiles"
],
"rejected": true,
"target_check": "public_moves_up"
},
"public_move_removed": {
"edit": "delete the public MOVE at event 24472",
"failed_checks": [
"frame_chain",
"record_profiles"
],
"rejected": true,
"target_check": "frame_chain"
},
"shared_input_between_split_tails": {
"edit": "insert ADD 1478 += 759 at event 40637 (frame 660)",
"failed_checks": [
"double_credit"
],
"rejected": true,
"target_check": "double_credit"
},
"zero_scalar_add": {
"edit": "insert a copy of the ADD at event 0 with scalar 0",
"failed_checks": [
"nonzero_scalars"
],
"rejected": true,
"target_check": "nonzero_scalars"
}
},
"failures": [],
"input_sha256": {
"research/p104-helper470-twin-rung-removal/EXPECT.json": "1300b39981c7e1a6edafe677f8d606b5be51a658c3516bd70467800674991338",
"research/p104-helper470-twin-rung-removal/RESULT.json": "84fcbe2a0b64307b5703c363408042bdd91555b0419509aa50daa43b3b1924ad",
"research/p104-helper470-twin-rung-removal/WORD.json.gz": "7834725d9e34ee846a9ccc615221ea81e0201613938afa185d2eda0c9a6c232f",
"research/shared-wire-split-composition/FULL-RESULT.json": "d9ba709fa5dcefffe3f3abdcf34600ce188224703cfd743e6db8b58ba4816cb7",
"research/shared-wire-split-composition/data/caller.json": "3828d53e80ea97e8b866320f081af20b6b93bfebd58b95b56b85a7afe151af5e",
"research/shared-wire-split-composition/data/final.json.gz": "2b94953dc14a122e3ef089633f05b58ec689ec5156feb7c784ed3e137dc01883",
"research/shared-wire-split-composition/data/split759.proof.json": "35f8b64110957b6f51fd8dd0e53326c466e2ffeecf9254012f0e55a5275bea81",
"research/shared-wire-split-composition/data/split759_450.proof.json": "78b25749911131b50bb4565b17a06d08ccf4b511ec05e598e7f146c96aed4174"
},
"invoice_7000": {
"calls": 18,
"checks": {
"P_equals_record": true,
"T_equals_record": true,
"claim_at_most_tested": true,
"declared_splits_chain_ok": true,
"moment_positive_at_tested": true,
"root_at_least_tested": true,
"root_in_recorded_bracket": true,
"root_matches_record_digits": true,
"root_unique_on_interval": true,
"surplus_equals_record": true
},
"claim": "363005817/100000000000",
"credit_hist_per_call": {
"1": 13,
"2": 18,
"3": 44,
"4": 215,
"5": 68,
"6": 42,
"7": 18,
"8": 67,
"9": 595
},
"credit_mass_per_call": 7650,
"crossing": "0.003630058174688367085933576764896899672679313338856263091621",
"declared_splits": [
{
"chain_ok": true,
"cut_frame": 660,
"head_rank": 7,
"pivot": 759,
"source": "data/split759.proof.json",
"tail_candidates": [
1478
],
"tail_rank": 2,
"unsplit_rank": 9
},
{
"chain_ok": true,
"cut_frame": 595,
"head_rank": 1,
"pivot": 450,
"source": "data/split759_450.proof.json",
"tail_candidates": [
496,
1479
],
"tail_rank": 8,
"unsplit_rank": 9
}
],
"derivative_upper_bound_on_interval": "-387072.479",
"paid_hist_per_call": {
"1": 4075,
"2": 828,
"3": 811,
"4": 241,
"5": 320,
"6": 17,
"7": 12,
"8": 6
},
"paid_mass_per_call": 10962,
"rank_surplus": 1520,
"recorded_crossing": "0.0036300581746883670859335767648968996726793133388562630916210931832",
"sensitivities": {
"one_field_of_rank_loses_credit_each_call": {
"1": "0.003586749696251990608144038528",
"2": "0.003543661422881519511374557908",
"3": "0.003500654532686239312573542229",
"4": "0.003457698728768232317378358026",
"5": "0.003414779304180724795925519611",
"6": "0.003371887413163687878871135603",
"7": "0.003329017090158370710761658702",
"8": "0.003286164009629317532936715259",
"9": "0.003243324873369088487634938483"
},
"splits_valued_as_unsplit": {
"crossing": "0.003628822497358640906859281697",
"crossing_minus_base": "-0.000001235677",
"rank_mass_change": 0
}
},
"sign_changes_by_rank": 15,
"tested": "363005817007/100000000000000"
},
"known_answer_6030": {
"calls": 18,
"checks": {
"P_equals_record": true,
"T_equals_record": true,
"paid_calls_equal_expect": true,
"ports_equal_record": true,
"productive_equals_expect": true,
"root_in_recorded_interval": true,
"root_unique_on_interval": true,
"surplus_equals_expect": true
},
"credit_mass_per_call": 4232,
"crossing": "0.003125811557911897246251344381357396646615240473377728538430",
"derivative_upper_bound_on_interval": "-214612.957",
"interval": [
"312581155791/100000000000000",
"19536322237/6250000000000"
],
"paid": 66834,
"paid_mass_per_call": 5952,
"ports": 104,
"productive": 13444,
"query_term": 1560,
"rank_surplus": 760,
"sign_changes_by_rank": 19
},
"status": "PASS",
"word_6030": {
"checks": {
"double_credit": true,
"frame_chain": true,
"helper_credit_positive_nested": true,
"main_rows": true,
"nonzero_scalars": true,
"owned_rows_cleared": true,
"public_moves_up": true,
"record_profiles": true
},
"double_credit": {
"first_non_identity": [],
"first_shared": [],
"helper_rows_reading_main": 0,
"non_identity_helper_rows": 0,
"shared_inputs": 0
},
"events": 22803,
"faults": {},
"helpers": 562,
"information": {
"owned_erasures_nonzero": 30,
"owned_moves_down": 20
},
"main": {
"first_wrong": [],
"main_rows": 208,
"main_rows_wrong": 0
},
"mains": 208,
"public": 770
},
"word_7000": {
"checks": {
"double_credit": true,
"frame_chain": true,
"helper_credit_positive_nested": true,
"main_rows": true,
"nonzero_scalars": true,
"owned_rows_cleared": true,
"public_moves_up": true,
"record_profiles": true
},
"double_credit": {
"first_non_identity": [],
"first_shared": [],
"helper_rows_reading_main": 0,
"non_identity_helper_rows": 0,
"shared_inputs": 0
},
"events": 71261,
"faults": {},
"helpers": 1080,
"information": {
"owned_erasures_nonzero": 53,
"owned_moves_down": 24
},
"main": {
"first_wrong": [],
"main_rows": 400,
"main_rows_wrong": 0
},
"mains": 400,
"public": 1480
}
}
Loading
Loading