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
171 changes: 171 additions & 0 deletions research/distinguished-echo-factor/PROOF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# Exact distinguished-factor invocation tariff

This scoped written proof concerns the static ordered, parent-reserved dirty
array grammar of Koroffstrogov's PR758. It does not claim optimality among
arbitrary reversible programs. The contribution was produced by Nick Petalas.

## Model and theorem

A leaf is one complete signed invocation of a fixed factor. Every internal
node has k>=2 nonempty consecutive children. Its complete echo invokes the
first and last child twice and each interior child four times, including all
inverses and restoration. Its reserved-array requirement is

S(leaf)=0,
S(node)=k-1+max_child S(child).

The invocation multiplicity of a leaf is the product of its child multipliers
along its path from the root. This is exactly the quantity multiplying that
factor's fixed positive invocation price. Factors retain their original order.

The complete echo identity, source preservation and arbitrary dirty-array
restoration are cited from PR758, Section 1, with androolloyd's PR673 credit
retained. For ideal linear factors, every admitted tree realizes the same
ordered product. No new assertion is made that different trees have identical
rounded nonlinear errors or dirt-dependent increments.

Let s>=0, 1<=n<=2^s, and 0<=i<n be integers. Put L=i and R=n-1-i. For d=0,...,s
set u_d=2^(s-d). Define d_* as the first depth satisfying

ceil(L/u_d)+ceil(R/u_d) <= 2^d-1. (1)

There is such a depth, since d=s gives L+R=n-1<=2^s-1.

**Theorem.** Among all admitted trees on n leaves with S<=s, the least complete
invocation multiplicity of factor i is exactly 2^d_*. A binary tree attains it.
Thus higher arities cannot improve this one-factor objective, even though
PR758 shows they can improve the sum of all factor prices.

The theorem gives at most s+1 integer tests, once the powers of two are
available. This is an arithmetic operation count, not a bit-complexity or
physical tape implementation bound. The bounded reference accepts s<=10.
The proof itself has no upper bound on s.

## Capacity and replacement along one path

We use PR758, Section 2, as a cited capacity lemma: a tree of requirement at
most t has at most 2^t leaves, and every positive number at most 2^t fits in a
binary tree of requirement at most t. The latter also follows by pruning a
complete height-t binary tree and suppressing unary vertices. This citation
is a premise, not a replay of the predecessor optimizer or its numerical table.

We first prove that every marked tree of budget s has a binary replacement,
with the same ordered leaves, budget at most s, and no greater multiplicity
at its marked leaf. Induct on the number of leaves. At a k-child root let
r=s-k+1>=0. Every child has at most 2^r leaves.

If the marked child is an endpoint, combine all other children into one
ordered group. That group has at most

(k-1)2^r <= 2^(s-1)

leaves, since k-1<=2^(k-2) for k>=2. A binary root can host this group and the
marked child, each with budget s-1. Replace the group by a fitting binary tree
and replace the marked child by induction. The marked multiplier at this root
is still two. The case k=2 is included.

If the marked child is interior then k>=3. Suppose p children precede it and
q=k-1-p follow it, with p,q>=1. Let A and B be the leaf counts in those two
ordered groups. Then

max(A,B) <= (k-2)2^r <= 2^(s-1),
min(A,B) <= floor((k-1)/2)2^r <= 2^(s-2). (2)

For the second inequality use floor((k-1)/2)<=2^(k-3), valid at k=3 and for
all larger k. The first uses k-2<=2^(k-2). Both are elementary integer
inequalities and can also be proved by induction on k.

Put the larger group in one child of a binary root. Its other child is a
binary node containing the smaller group and the marked child, in the order
required by the original factors. If the left group is larger the shape is
`(left,(marked,right))`; otherwise it is `((left,marked),right)`. The side
groups fit by (2), and the marked child fits at budget s-2 because r<=s-2.
Replace the marked child by induction, using that budget. The distinguished
path now has two binary edges, with multiplier four, equal to its old
interior-child multiplier. Its ordered factors and total budget are preserved.

The induction decreases the size of the marked child. Unmarked groups use
only the cited fitting lemma. This proves binary replacement. No assertion
about the other factors' multiplicities is made or needed.

## The exact binary depth condition

In a binary tree S is its height and a leaf at depth d has multiplicity 2^d.
Consider a marked leaf at depth d<=s. At path level j=1,...,d, its sibling
has capacity at most 2^(s-j). It lies entirely before or entirely after the
marked leaf in the ordered factor list. Therefore the capacities on the two
sides have the form

u_d m, u_d(2^d-1-m)

for some integer m between zero and 2^d-1. Indeed the sibling capacities are
u_d times 2^(d-1),...,1, assigned to the two sides according to the path bits.
Every factor before the marked leaf belongs to a preceding sibling, and the
same holds for factors after it. Hence

L <= u_d m, R <= u_d(2^d-1-m),

which implies (1). Any binary marked leaf consequently has depth at least d_*.
The replacement result transfers this lower bound to every original arity:
its binary multiplicity is at least 2^d_* and at most the original multiplicity.

For attainment, choose d=d_* and m=ceil(L/u_d). By (1), there are at least L
positions in the first m dyadic blocks of size u_d and at least R positions in
the blocks strictly after block m. In a complete height-s ordered binary tree,
keep any L leaves in those preceding blocks, one leaf in block m, and any R
leaves in the following blocks. Delete all other leaves and suppress every
unary vertex. The resulting ordered tree has exactly n leaves and height at
most s. All branching inside the marked block disappears, so the marked leaf
has depth at most d. The already proved lower bound makes its depth exactly d.
This is a constructive proof for every permitted n,s,i, including n=1,s=0.
The reference chooses the leftmost available positions on each side and
constructs the compressed tree bottom up, without recursion.

## A sharp position effect and weighted consequence

For s>=2 and n=2^s-1, the theorem simplifies to

min multiplicity at i = 2^(s-1), if i is even,
2^s, if i is odd. (3)

For d<=s-2, u_d>=4. Even ignoring the separate ceilings, (1) would require
n-1<=2^s-u_d, but n-1=2^s-2, so it fails. At d=s-1, u_d=2 and L+R=2^s-2.
When i is even, both sides are even and the ceiling sum is 2^(s-1)-1. When
i is odd, both are odd and the sum is 2^(s-1). Only the former satisfies (1).
Depth s always works. This proves (3) without extrapolating from finite checks.
For seven factors and three arrays the exact vector of individual minima is

(4,8,4,8,4,8,4).

For any fixed positive prices c_0,...,c_(n-1), every complete schedule costs
at least sum_i c_i 2^d_*(n,s,i). This follows by applying the individual lower
bounds to the same tree and adding them. The bound need not be jointly
attainable. The theorem constructs an optimum for one designated factor at
a time; it does not solve arbitrary weighted total-cost optimization.

## Evidence boundary and credit

The universal result rests on the replacement and capacity proof above.
`verify.py` gives finite corroboration of this new quantity using a complete
all-arity marked recurrence, a separate enumeration of whole ordered trees,
and emitted binary witnesses. It does not import or replay any predecessor
executable, counts, supplier or scientific verifier.

Koroffstrogov / PR758 supplies the ordered all-arity weighted grammar and its
capacity lemma. androolloyd / PR673 supplies the multiway echo and restoration.
Dillon Amburgey / PR689, Sagar Thakrar / PR730, Ali Romman / PR744, Alexander
Schwartzman / PR784 and Gareth Davidson / PR887 retain their optimization,
budget and formalization credit, as does Chafik Boukhalfa / PR628 for the
rounded-leaf lineage. Nick Petalas / PR4862 concerns maximal equality of a
total-unit-cost bound; none of its results is used in this proof. Dyadic trees,
ordered prefix codes and unary suppression are classical. No general
literature priority is claimed for those methods.

Static parent reservation, nonempty ordered children and complete signed calls
are essential. Connector reuse, clean checkpoints, changed restoration words,
opened child bodies, reordered or commuting factors and general reversible
circuits have different contracts. Physical data movement, actual coefficient
prices, precision, stock, compiler/native admission, analytic recovery and all
five selected framework assumptions remain separate. No new kappa, completed
supplier or complete multiplication theorem follows. Independent human and
formal proof-kernel review are unclaimed.
124 changes: 124 additions & 0 deletions research/distinguished-echo-factor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# Exact invocation prices for a distinguished dirty-echo factor

This contribution was produced by Nick Petalas. Apache-2.0.

Claim type: scoped written proof with exact finite corroboration. In the
ordered parent-reserved dirty-echo tree grammar of Koroffstrogov's
[PR758](https://github.com/CrocSwap/integer-mult-bounds/pull/758), the exact
minimum completed invocation multiplicity of factor i among n factors, with
at most s arbitrary dirty arrays, is

```text
2^d, where d is the first integer in 0..s satisfying
ceil(i / 2^(s-d)) + ceil((n-1-i) / 2^(s-d)) <= 2^d - 1.
```

The domain is `s>=0`, `1<=n<=2^s`, `0<=i<n`. A binary tree attains the minimum,
even though higher arities can improve the total cost. This is an exact new
individual-factor price law, not another replay of a predecessor total-cost
table. All inverses and dirty restoration calls remain in the multipliers.

For `n=2^s-1`, `s>=2`, even-position factors have minimum `2^(s-1)` and
odd-position factors have minimum `2^s`. For seven factors and three arrays,
the individual minima are `(4,8,4,8,4,8,4)`. A position-free capacity bound
misses this factor-of-two difference. Multiplying each individual minimum by
its fixed invocation price and adding gives a necessary weighted bill; these
individual optima need not share an attaining tree.

[PROOF.md](PROOF.md) proves the all-size theorem by binary replacement along
the distinguished path and separate dyadic prefix/suffix capacities.
`verify.py` supplies a bounded constructor and exact corroboration of the new
quantity. No predecessor executable, optimizer, count or scientific suite is
replayed. The source contract and capacity lemma are cited premises.

## Reproduce

From the worktree root with CPython 3.12 and the standard library:

```sh
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -I -W error -B research/distinguished-echo-factor/verify.py
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -I -O -W error -B research/distinguished-echo-factor/verify.py
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -B scripts/research_package.py --package research/distinguished-echo-factor
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -B scripts/check_research_commit.py --package research/distinguished-echo-factor --check-source-history --check-modes
```

Substitute another CPython 3.12 executable on other machines. The direct check
prints `PASS_DISTINGUISHED_ECHO_FACTOR` inside a generated JSON receipt with
computed coverage and SHA256 hashes of all six package files and the one
source proof. It writes nothing. No receipt is handwritten. Both registered
commands have a 120-second timeout. The universal theorem rests on the written
proof; finite execution is not formal proof-kernel acceptance.

The finite checks cover 2,794 all-arity marked optima through space six,
5,440 whole ordered trees through eight leaves with 93,266 factor comparisons,
and 43,946 emitted binary witnesses containing 6,435,096 leaf occurrences
through space eight. The separate parity specialization checks 2,035 positions
through space ten. Thirteen invalid inputs/trees are rejected and four semantic
controls pass. Explicit input/tree rejection and semantic controls distinguish
ceilings from floors, positional from total capacity, and the singleton and
saturated endpoints. All checks remain active with optimized Python.

## Scope, provenance and credit

The original `joint-query-controller` card is changed to a static composition
side theorem. It does not fulfill the complete native caller acceptance gate.
The baseline binding-only check passed; selected PR6030 remains unchanged.
[SOURCES.json](SOURCES.json) pins canonical main
`7c49fe32c55de02c2c873655c804b16e4c3fef0a`, priority revision eight, and the
unchanged source proof used as a live text input. The
[advance CLAIM](https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19362439)
was posted before substantial work. Current main, open/merged/account PR
searches, active Discussions, handoffs and local reservations were checked.
Sparse notes, arbitrary historical diffs and unpublished work remain coverage
limits; these checks do not establish global novelty. The cached card scan
covered 394 open PRs and 6,334 Discussion records with complete remote paging,
but only 112 of 8,917 tracked notes were locally materialized at scan time.

Credit Koroffstrogov / PR758 for the ordered all-arity weighted grammar and
capacity lemma; androolloyd / PR673 for the multiway echo and restoration;
Dillon Amburgey / PR689, Sagar Thakrar / PR730, Ali Romman / PR744, Alexander
Schwartzman / PR784, Gareth Davidson / PR887 and Chafik Boukhalfa / PR628 for
the retained optimization, budget, formalization and rounded-leaf lineage.
Nick Petalas / PR4862 concerns total-unit-cost equality and is related context,
without being a theorem used or extended here. Dyadic trees and prefix coding
are classical. The new contribution is the exact individual multiplicity law,
its universal replacement/attainment proof and its standalone checker.

The result keeps static parent-reserved arrays, nonempty ordered factors,
fixed signed invocation prices and complete restoration words. It does not
cover connector reuse, clean checkpoints, interleaved lifetimes, alternative
echo identities, opened children, factor reordering or arbitrary reversible
programs. It does not assert identical rounded errors for different trees.
The predecessor's unfavorable full-transform adapter remains unfavorable;
this local theorem does not reopen that unchanged supplier.

No actual native caller, physical movement/storage bill, precision/stock proof,
compiler admission, analytic recovery or new kappa is supplied. The five
selected framework assumptions remain. Independent human and formal proof-kernel
review, predecessor or selected cold replay, Lean and Docker are unrun.

## Open next questions

When can several expensive factors attain their individual minima in one tree?
Start with two positions and their dyadic path capacities, retaining every
parent reservation. This theorem supplies no joint-attainment classification
or complete weighted optimum. The structured question and blocker are in
[TASK.json](TASK.json). A physical application also needs a distinct favorable
complete supplier contract before any expansion.

## Verifier bounds

The verifier uses bounded iterative traversals and no recursion, subprocesses,
network, dynamic code evaluation or file writes. Public constructor inputs are
capped at 1024 leaves and ten arrays. Witnesses have at most 2047 nodes. The
all-arity oracle stops at six arrays; whole-tree enumeration stops at eight
leaves. Every function is below sixty physical lines. Exceptions keep the
mathematical invariants active under optimization. Each receipt input is a
regular nonsymlink file of at most 256 KiB.

Power of Ten rules 3 and 9 have managed-runtime deviations: CPython allocates
integers, tuples, dictionaries and lists, and uses standard-library dispatch.
Fixed finite domains bound algorithmic live data; no allocation instrumenter
or separate static type analyzer is claimed. Warning-strict ordinary and
optimized execution, source inspection and the rejection controls provide the
available diagnostics. There is no production deployment or fixed-storage claim.
24 changes: 24 additions & 0 deletions research/distinguished-echo-factor/SOURCES.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"schema_version": 1,
"base_commit": "7c49fe32c55de02c2c873655c804b16e4c3fef0a",
"files": [
{
"path": "certificates/selected-result.json",
"usage": "provenance",
"git_blob": "d59b5035e7b4cbaa9d688a1d32dd0d6eb79c466a",
"sha256": "9b8d0eea95b3bf0dfcb7938a732a6439b87a2685dec2a5ab9e525b3b34debbfa"
},
{
"path": "docs/research/agent-task-catalog.json",
"usage": "provenance",
"git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec",
"sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81"
},
{
"path": "research/space-capped-dirty-echo/PROOF.md",
"usage": "input",
"git_blob": "e256de5db9bb947aa15ba5f6c60f3f7927cbcf63",
"sha256": "14c90c13b171d3e137560b550b61938e3fdc1a618e69b739d64f862d57bacf09"
}
]
}
Loading