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
90 changes: 90 additions & 0 deletions research/rank8-rup-signed-values/BENCHMARK.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"python": "3.12.15 (main, Oct 14 2026, 00:55:37) [Clang 23.1.3 ]",
"platform": "macOS-27.0.1-arm64-arm-64bit",
"timer": "perf_counter_ns around completed subprocess and output validation",
"runs_per_side_per_unit": 5,
"order": "baseline,candidate repeated five times",
"units": [
{
"unit": "P112",
"seconds": {
"baseline": [
14.258376833,
14.881683875,
14.733169458,
15.05273,
15.36443425
],
"candidate": [
9.883126333,
9.580750792,
10.003980833,
10.372319291,
10.272758542
]
},
"medians": {
"baseline": 14.881683875,
"candidate": 10.003980833
},
"ranges": {
"baseline": [
14.258376833,
15.36443425
],
"candidate": [
9.580750792,
10.372319291
]
},
"wall_time_reduction_percent": 32.776553264877094,
"errors": 0,
"scientific_checks_executed": 610,
"stdout_sha256": "5d259769ddf28097254546e6c368c1431bdafcbc31cad951a66a92b310dea41d",
"certificate_sha256": "a1f7ad167f54adef23f0e350732ce6fb5563a146d283284cfc30022fd7b9ef89"
},
{
"unit": "P120",
"seconds": {
"baseline": [
6.822026333,
7.03627825,
7.088361542,
6.766746167,
6.652103792
],
"candidate": [
5.061493,
5.050159959,
5.0374595,
4.933055375,
4.774791791
]
},
"medians": {
"baseline": 6.822026333,
"candidate": 5.0374595
},
"ranges": {
"baseline": [
6.652103792,
7.088361542
],
"candidate": [
4.774791791,
5.061493
]
},
"wall_time_reduction_percent": 26.158896871558003,
"errors": 0,
"scientific_checks_executed": 410,
"stdout_sha256": "4a5350bb9fd78ecd41b236742a642452b7688ce24931a0d468728cf44ed6ba53",
"certificate_sha256": "0b8615f6117ec3971ca8ead529e03e926fc010fc5f9db3868562066fd890dff6"
}
],
"files": {
"adapter.py": "d2c447166f60bd9246b282bca9fc67bbd4efbf5e9ff7cb3e763b7a9bbfc53957",
"benchmark.py": "46ec32047ec46f4140967638cd87e43923c562eda6c35a8d54ae432812140cf2",
"verify.py": "0672e429a4243d526ab3c84703fa9bb658777a13f79b730e5809563845ec4204"
}
}
65 changes: 65 additions & 0 deletions research/rank8-rup-signed-values/CHECKS.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"generated_from": "separately timed registered commands",
"checks": [
{
"command": [
"{python}",
"-I",
"-W",
"error",
"-B",
"{package}/verify.py"
],
"seconds": 0.10024058306589723,
"exit": 0
},
{
"command": [
"{python}",
"-I",
"-O",
"-W",
"error",
"-B",
"{package}/verify.py"
],
"seconds": 0.11422341596335173,
"exit": 0
},
{
"command": [
"{python}",
"-I",
"-W",
"error",
"-B",
"{package}/verify.py",
"--unit",
"P112"
],
"seconds": 24.499774541938677,
"exit": 0
},
{
"command": [
"{python}",
"-I",
"-W",
"error",
"-B",
"{package}/verify.py",
"--unit",
"P120"
],
"seconds": 11.581851250026375,
"exit": 0
}
],
"files": {
"adapter.py": "d2c447166f60bd9246b282bca9fc67bbd4efbf5e9ff7cb3e763b7a9bbfc53957",
"verify.py": "0672e429a4243d526ab3c84703fa9bb658777a13f79b730e5809563845ec4204",
"benchmark.py": "46ec32047ec46f4140967638cd87e43923c562eda6c35a8d54ae432812140cf2",
"SOURCES.json": "1acaac56b312a59d26601e1648c9f4e85dc8c509a5a92b55784f2480bf537c59",
"VERIFY.json": "3b54db95b97ab47382f8033336296e2c7f742eeb7865e931546e465aecff3e97"
}
}
131 changes: 131 additions & 0 deletions research/rank8-rup-signed-values/PROOF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Direct signed-literal replay equivalence

Claim type: scoped implementation-equivalence proof with exact finite conformance
and local performance evidence. This contribution was produced by Nick Petalas.
No new decoder theorem, supplier, kappa or multiplication theorem is claimed.

## State relation

The predecessor stores one ternary value `a[v]` per variable `1 <= v <= n`.
It evaluates a literal `l` as `a[abs(l)] * sign(l)`. Replace this by a list `s`
of length `2*n+1` satisfying

```
s[v] = a[v]
s[-v] = -a[v]
```

Python translates index `-v` to `2*n+1-v`. The positive slots are `1..n` and
the negative slots are `n+1..2*n`; they are disjoint and in bounds. Slot zero
is unused. Thus direct lookup `s[l]` equals the old literal value for both
signs, including the unassigned value zero.

To assign literal `l` true, set `s[l],s[-l] = 1,-1`. This preserves the state
relation whether `l` is positive or negative. To erase its trail entry, set
both slots to zero. The empty initial table satisfies the relation. The case
`n=0` has no legal nonzero literal and is unchanged.

## Trace induction

`adapter.signed_source` changes exactly one authenticated function. It makes
seven bounded text replacements with checked occurrence counts: allocation,
removal of the old value helper, its two read sites, all three trail-reset
sites, and the two assignment sites. All source outside that function remains
byte-identical. Missing or changed replacement sites fail before execution.

Induct over the original propagation trace. Corresponding seed literals have
the same value by the state relation. A conflict takes the same early exit
and clears the same trail. A new assignment updates both representations
consistently and appends the same literal to the same queue and trail. Each
clause visit therefore sees the same sequence of literal values. It takes
the same satisfied, multiple-unassigned, unit or conflict branch. Unit updates
and all normal-exit resets preserve the state relation. Consequently each
propagation call returns the same conflict decision and resets to the same
empty assignment.

The parser, clause database, occurrence lists, top-level units, proof order,
deletions, duplicate handling, checked count, limit handling and error strings
are unchanged. Induction over proof lines gives identical complete return
triples. Every accepted and rejected RUP call is identical. The complete main
program therefore takes the same later branches, constructs the same certificate
and emits the same stdout. This argument covers the legal input contract,
not only the finite certificate fixtures used in the measurements.

This is a representation improvement to the existing occurrence-list
algorithm. RUP soundness and the predecessor's mathematical decoder arguments
are cited premises. Neither is claimed as new or independently audited here.
The two-watched-literal algorithms in the P108/P110 successors and PR4360 are
prior alternative checkers; this change keeps PR1212's original visit order.

## Cost and finite evidence

The original complete P112 profile executes 205,432,164 `value` calls. The new
function has no value helper, so every one of those calls and their `abs`/sign
operations disappears on the equivalent trace. Parser range checks still use
`abs`; the claim does not remove every absolute-value operation. Assignment
and reset sites now write two slots. The ternary table grows from `n+1` to
`2*n+1` slots, an increase of exactly `n` list slots. The largest retained unit
has 4,032 variables, so the increase is 32,256 list-slot bytes on the measured
64-bit CPython host. No claim about total process memory reduction is made.

The exact small-domain checks compare the real original and transformed
functions, including parser errors, comments, deletions, duplicates, empty
clauses, proof limits and repeated propagation resets. The complete checks
compare every stdout byte and every certificate field for P112 and P120.
Across those two commands all eight pinned proof files and all 61/41 retained
check lines remain reached. All live inputs are hash-checked before loading;
corruption of each of the nine live files and a missing proof fail admission.
A changed adapter replacement site also fails admission. Counts are emitted by
the checker, rather than handwritten as a receipt.

Five alternating fresh-process measurements per side and live unit measure
complete CLI execution, including source authentication, geometry, every RUP
proof, rational calculations, existing rejection controls and output validation.
The benchmark refuses unequal stdout, unequal certificate objects, nonzero
exits, stderr or scientific failures. BENCHMARK.json contains the measured
samples, environment, source hashes and check counts. Profiling is separate
from the timed samples. No individual RUP microbenchmark is used as the
headline improvement.

## Engineering scope

All new loops range over pinned manifest entries, bounded source AST nodes,
fixed replacement sites or explicit finite test domains. Production replay
uses the predecessor's existing bounded files and variable domains. Each new
subprocess has a 150-second timeout and all registered checks have a
240-second outer limit or less. Source files are not mutated. Scratch is
owned by temporary directories or the benchmark's explicitly new output
folder. The verifier writes only stdout after temporary cleanup.

Power of Ten rule 3 has a managed-runtime deviation: Python lists, AST nodes,
strings and exact integers allocate dynamically. The changed ternary table has
an explicit `2*n+1` capacity; the original clause and proof storage are unchanged.
Rule 8 has a constrained source-adapter deviation: exact SHA256-bound source,
one AST-selected function, seven checked replacement entries and unchanged
surrounding bytes. No supplied code is evaluated beyond the pinned predecessor
and these replacements. Existing predecessor recursion and large main function
are retained unchanged, not claimed as Power of Ten compliant. New functions
stay below 60 physical lines. Warning-strict normal/optimized checks provide
the available Python diagnostics; no external static analyzer or proof kernel
is claimed.

## Limits and next question

Timings are local performance evidence and are not portable runtime guarantees.
Default adoption, complete Linux workflow timing, scientific supplier admission,
selected cold replay, native all-columns, ownership, compiler, precision/tape
and analytic recovery obligations remain outside scope. Independent human and
formal proof-kernel review are unclaimed. The exact next adoption question is
recorded in TASK.json. Frozen predecessor files and the selected frontier stay
unchanged.

## Credit

Brett Halligan / burntout76's PR1212, head
`57099cb5684f38877f31d149d598801671a633db`, supplies the complete verifier,
proof certificates, theorem and failure controls. Its DreamingOfClouds / PR717,
themilkman216 / PR968, GamingPuzzled / PR620, Mihir Srivastava / PR845,
woklerx / PR998 and related decoder lineage retain full predecessor credit.
Classical signed arrays, induction and RUP are not claimed as novel algorithms.
The new adapter, equivalence argument, conformance and complete-command
performance measurements were produced by Nick Petalas. Apache-2.0.
Loading