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
174 changes: 174 additions & 0 deletions research/two-capacity-direct-unranking/PROOF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# Direct unranking for two capacities without a prescribed injection

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

## Statement and premises

Let V and W have dimension n over F_q. Fix arbitrary subspaces A,B of V
and C,D of W. Define

`G = {g:V->W invertible : g(A) contained in C, g(B) contained in D}`.

There is a deterministic bijection from the integers 0 through |G|-1 to G
using O(1+n^5) field operations and O(1+n^4) exact integer arithmetic
operations on O(1+n^2 log q)-bit integers. Live working storage is O(1+n^2)
field elements and O(1+n^3 log q) bits. Fixed input and output matrices have
the same field-element bound. An empty G is detected before decoding.

This is the U=0 specialization of Ali Romman's PR6539 contract. Its count
and quotient/lift decomposition are cited premises. The new result makes
that decomposition an explicit direct unranking algorithm, with polynomial
resource bounds. The predecessor count, ToikY's PR6535 feasibility theorem,
and classical Gaussian, graph-map and basis-extension formulas are not new
claims. Nick Petalas's PR6607 already gives a general prescribed-injection
sampler through exponentially many candidate images. That self-reduction is
not used here. This proof leaves nonzero prescribed U open.

The field-operation bound assumes an exact finite-field arithmetic interface
and a fixed ordering of its elements. Bit cost of a chosen field representation
is additional. The executable supports prime orders at most 31 and F4, with
n at most 12. The proof has no such fixed dimension or field-order limit.

## Fixed decompositions and cardinality

All complements below are deterministic once the inputs are fixed. Extend
an ordered independent list by scanning a fixed basis of its containing
space, retaining exactly those vectors which increase rank.

Write J=A intersect B and T=C intersect D, of dimensions j and tau. Fix

`V = J direct-sum A0 direct-sum B0 direct-sum R`,
`C = T direct-sum C0`, `D = T direct-sum D0`,

where A=J direct-sum A0 and B=J direct-sum B0. Put
alpha=dim A0, beta=dim B0, c=dim C, d=dim D and s=j+alpha+beta.
The complement R concerns the whole domain V, not A+B alone.

Write Inj(m,k)=product_{r=0}^{k-1}(q^m-q^r), zero outside 0<=k<=m,
and use Gaussian coefficients with their usual zero convention. If j>tau
then G is empty. Otherwise set H=tau-j and

```text
w_i = [H choose i]_q [c-tau choose alpha-i]_q
q^((H-i)(alpha-i)) Inj(alpha,alpha)
Inj(d-j-i,beta) q^(i beta),

max(0,alpha-c+tau) <= i <= min(alpha,H),
S = sum_i w_i,
N = Inj(tau,j) S q^(j(alpha+beta))
product_{r=s}^{n-1}(q^n-q^r).
```

PR6539 supplies N=|G| in this specialization. Zero weights are omitted.
An empty sum means N=0. No negative-dimensional injection is decoded.

## Polynomial elementary decoders

An ordered injection from F_q^k into F_q^m is decoded one image at a time.
After r images, extend their ordered basis to a full deterministic basis.
Every vector outside their span has unique coordinates (a,b), where
a is arbitrary in F_q^r and b is nonzero in F_q^(m-r). Index a in base q
and b by the nonzero integers 1,...,q^(m-r)-1. This is a bijection of
q^m-q^r indices with the possible next images. Mixed radices decode the
complete injection. No ambient vector list or rejection trial is needed.

A k-subspace of F_q^m has a unique reduced row-echelon basis. Divide its
first-column cases into a zero column and a pivot column. The first has
[m-1 choose k]_q possibilities. In the second, the remaining rows form a
(k-1)-subspace of F_q^(m-1), and the first row has m-k free coordinates
in the nonpivot columns. Its count is q^(m-k)[m-1 choose k-1]_q.
This gives a weighted first-column decoder. Iterating at most m times records
the pivots and their free coordinates, and then fills their unique RREF.
The executable uses iteration rather than recursion.

Both decoders have explicit inverse descriptions. Read the unique coordinates
or RREF, recover each mixed-radix digit, and reverse the branch decomposition.

## Decode a completion

1. Decode an arbitrary injection J->T, with Inj(tau,j) possibilities. Call
its ordered image L. Choose the deterministic complement H0 of L in T.
Thus H0 represents T/L and has dimension H.
2. Select i by its interval of length w_i within S. A subsequent local
index ranges over exactly w_i choices. Choose an i-subspace I of H0,
and an (alpha-i)-subspace K of C0, with the two Grassmann decoders.
Choose every entry of a graph map K->H0/I in base q. The complement of
I in H0 supplies fixed quotient representatives. The resulting subspace
P of H0+C0 has dimension alpha and satisfies P intersect H0=I.
3. Decode an arbitrary ordered alpha-basis of P, by an element of GL_alpha.
These are the images of the fixed basis of A0, modulo L.
4. In D/L=H0+D0, quotient by I. Decode an injection of the beta-dimensional
B0 into the fixed representative space of dimension d-j-i. Lift each
image through I by i arbitrary field entries. Its image Q is disjoint
from P: the intersection of P with D/L is exactly I, and Q projects
injectively modulo I. This accounts for Inj(d-j-i,beta)q^(i beta).
5. Independently lift every A0 and B0 basis image through L. These
j(alpha+beta) free entries give the displayed global q-power.
6. Extend the resulting ordered s-dimensional image basis to an image of
the fixed remaining domain basis R. Decode each next image outside the
previous span with the elementary decoder. Finally change from the
adapted domain basis back to the standard basis.

Steps 2 through 4 consume precisely the factors in w_i. Steps 1, 5 and 6
consume the other global factors of N. Integer division with remainder
therefore splits each index in [0,N) into one such sequence of choices.

## Bijection and uniformity

Every decoded image list is independent. The first j images lie in T.
The next alpha lie in C and the next beta in D; their quotient images
have zero intersection by step 4. Lifting through L preserves quotient
independence. The last images are independent by construction. The map
is thus in G, including all arbitrary input vectors by linearity.

Conversely, fix g in G. Its values on the fixed J basis determine the
injection and L. Project its A0 images modulo L. Their span is the unique P
in step 2, hence determines i, I, K and the graph. The ordered values
determine the GL_alpha choice in step 3. Projecting the B0 values modulo
L and then I determines the injection and lifts in step 4. The L-components
determine step 5. The values on R determine the outside-span digits in
step 6. All fixed complements are functions of earlier recovered choices.
Thus this inverse is unique, so the decoder is bijective.

A uniform integer index gives exactly the uniform distribution on G.
Put b=ceil(log2 N), with b=0 at N=1. Independent uniform b-bit integers,
accepted exactly when below N, give a uniform index at the first success.
With R attempts the exact exhaustion probability is
`(1-N/2^b)^R`; conditional on success, every map has probability 1/N.
The executable accepts at most 64 pre-supplied entropy blocks, validates
them all, and charges Rb provisioned bits. It returns the acceptance position
in bits separately. It has no hidden random source and no unbounded loop.
The abstract online version, generating blocks only until acceptance,
uses expected b*2^b/N<2b bits for N>1. This latter expectation is not a
measured cost of the pre-supplied-list API. At N=1 zero bits suffice.

## Resource bound

Row reduction of O(n) rows of length O(n) costs O(1+n^3) field operations.
A deterministic complement scans at most n vectors and performs at most n
such reductions, costing O(1+n^4). The injection and final extension
decoders make O(1+n) complement calls in total. All other operations are
linear combinations, a fixed number of complements, or the final n
coordinate solves. This proves O(1+n^5) field operations.

Gaussian products use O(1+n) factors each. The weighted branch sum and
the first-column decoders use polynomially many such products; including
integer powers by repeated squaring, O(1+n^4) arithmetic operations is a
conservative bound. All intermediate integers have O(1+n^2 log q) bits.
Rank comparisons and index arithmetic are included; no q^n candidate loop
is hidden. Space is bounded by a fixed number of O(n)-vector bases, O(n)
stored branch weights of O(1+n^2 log q) bits, and integer counters.
Zero-dimensional spaces use empty bases
and empty products, with one empty invertible map.

## Limits and next obligations

This supplies unrestricted linear completions. A nonzero prescribed
injection introduces the compatible quotient discrepancy of PR6539 and
is deliberately outside this proof. An actual native shared contact still
requires its signed or symplectic constraints, physical basis changes,
randomness generation, causal access, dirty restoration, precision, stock,
tapes, compiler and complete outer costs. No selected assumption is
discharged and no kappa is changed. The proof is written mathematics with
finite executable corroboration; independent human and proof-kernel
acceptance are unclaimed.
129 changes: 129 additions & 0 deletions research/two-capacity-direct-unranking/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Polynomial direct generation of two-capacity completions

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

Claim type: scoped constructive proof with exact finite corroboration.
For arbitrary subspaces A,B,C,D in n-dimensional finite-field spaces, the
package constructs every invertible map g satisfying g(A) contained in C
and g(B) contained in D exactly once from an integer index. It decodes
one index with O(1+n^5) field operations and O(1+n^4) integer arithmetic
operations. Uniform indices therefore give exactly uniform completions.
No injection is prescribed. Nonzero prescribed images remain open here.

The construction makes the quotient factors in
[Ali Romman's PR6539](https://github.com/CrocSwap/integer-mult-bounds/pull/6539)
directly executable for this subclass. Its count theorem is a cited input,
not a result re-audited by this package. The older
[PR6607](https://github.com/CrocSwap/integer-mult-bounds/pull/6607) samples
the more general prescribed-injection contract through an exponential
candidate-image scan. Its self-reduction and code are not used here.
Classical subspace, graph-map and basis-extension methods retain credit;
no general literature-priority claim is made.

[PROOF.md](PROOF.md) proves the bijection, uniformity and resource bounds.
[unrank.py](unrank.py) implements the direct decoder and a bounded entropy
interface. [linear.py](linear.py) supplies exact row reduction and canonical
complements. The executable accepts n<=12, prime q<=31, and F4 represented
by F2[t]/(t^2+t+1). The written construction applies to every finite field
with an exact arithmetic interface and a fixed element ordering.

For N>0 completions, set b=ceil(log2 N). A batch of R independent uniform
b-bit blocks has exact exhaustion probability (1-N/2^b)^R. Conditional on
success, each completion has probability 1/N. The finite API accepts R<=64,
validates the whole batch and provisions Rb bits. It reports the acceptance
position separately. There is no hidden random source. The corresponding
online method uses fewer than 2b expected fair bits when N>1. At N=1, no
random bits are needed. Empty sets are rejected for sampling.

## Evidence and reproduction

The verifier compares complete decoded endpoint sets and collision counts
with literal matrix enumeration. It covers every ordered quadruple of
subspaces over F2 at n=0,1,2, and over F3/F4 at n=1. Further selected
fixtures cover F3/F4/F5 at n=2 and F2 at n=3, including a two-branch
crossed-plane contract. Component checks enumerate all Grassmann and
ordered-injection indices through dimension three over F2/F3/F4.
Sixteen selected indices in dimensions 8,10,12 satisfy their full endpoints.
These are selected large examples, not large exhaustive censuses.

For GL2(F2), all 64 pairs of three-bit blocks produce ten occurrences of
each of six matrices and four exhausted pairs. Singleton and zero-attempt
cases are checked. Invalid field orders, dimensions, vectors, indices,
empty sampling and entropy limits are rejected. Checks use ordinary
exceptions and remain enabled under optimized Python.

From the worktree root, using CPython 3.12 and the standard library:

```sh
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -B scripts/research_package.py --package research/two-capacity-direct-unranking
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -B scripts/check_research_commit.py --package research/two-capacity-direct-unranking --check-source-history
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -I -W error -B research/two-capacity-direct-unranking/verify.py
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -I -W error -O -B research/two-capacity-direct-unranking/verify.py
```

Another CPython 3.12 installation may replace the absolute interpreter path.
Expected marker: `PASS_TWO_CAPACITY_DIRECT_UNRANKING`. Each registered
command has a 240-second timeout. Default execution writes only stdout.
Optional `--receipt /absolute/scratch/result.json` writes a generated
receipt outside the checkout, bound to package and predecessor-input hashes.
No receipt is handwritten or committed.

For an API example, put this package on the Python import path:

```python
from unrank import Contract

contract = Contract(2, 2, (), (), (), ())
matrix = contract.decode(4)
sample, acceptance_position_bits = contract.sample((7, 4))
assert sample == matrix and acceptance_position_bits == 6
```

Maps are tuples of their standard-domain column vectors. Inputs are ordered
lists of canonical coordinate vectors; redundant rows are reduced. The API
normalizes input subspaces and fixes all later complements deterministically.

## Sources and limits

The immediate mathematical predecessor is Ali Romman's PR6539 and its
quotient/lift count. Its proof at canonical base
e54523517d0f03e58352e647c403a5af3e525a57 is a hash-bound declared input in
[SOURCES.json](SOURCES.json). It is read for attribution and hypotheses;
no predecessor scientific executable is imported or replayed. Credit ToikY
PR6535 for coupled quotient feasibility; Ali Romman PR6533 for general
capacity rank counts; Nick Petalas PR6489/4919 and PR6607 for the prior
nested/general sampling work; Brian/JoyboyBrian PR5020, Cao Yifan/intqwq
PR4610, codyw912 PR4735, and the retained Cinna Davis, Dugongue, zxv and
Jacob Alan Sussman lineage. Existing predecessor notices remain unchanged.

The code has no recursion and no function longer than 60 lines.
All production loops are bounded by the enforced dimensions or 64 entropy
blocks. Python managed allocation and bigint/field arithmetic are explicit
deviations from fixed-allocation low-level rules. Production working memory
is O(1+n^2) field elements plus O(1+n^3 log q) bits, including stored branch
weights. The verifier separately enumerates finite endpoint sets and retains
them for collision checks. Its largest component class has 181,440 members.
Ordinary Python method dispatch has the fixed visible targets in these three
files. Warning-strict ordinary and optimized execution are the diagnostics.

This is unrestricted GL generation. There is no actual native contact,
symplectic or signed-phase constraint, physical randomness source, legal
access schedule, dirty restoration, precision, stock, tape, compiler or
outer invoice. The five selected framework assumptions remain. No new
kappa, supplier admission or complete multiplication theorem follows.
Independent human and formal proof-kernel review are unclaimed.

The formal-interface-lemma card changes scope to this finite-field
construction. Selected #7000 and its kappa are unchanged. The current
selected-baseline binding check passed; no selected scientific cold replay,
Lean, Docker or predecessor verification suite ran.

## Open next questions

1. Can the direct polynomial decoder handle a nonzero prescribed injection?
Start with the common lift subject to the quotient discrepancy in PR6539.
Compatible affine representatives and their unique inverse decomposition
are the missing step. The exponential general sampler remains available.
2. Can one actual shared native contact use these samples with a favorable
complete bill? Extract its two capacities and chronological bases first.
Signed/symplectic realization and physical costs remain blockers.
24 changes: 24 additions & 0 deletions research/two-capacity-direct-unranking/SOURCES.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"schema_version": 1,
"base_commit": "e54523517d0f03e58352e647c403a5af3e525a57",
"files": [
{
"path": "certificates/selected-result.json",
"usage": "provenance",
"git_blob": "75d77b328ea02ded535e7f23aee5b1e55d0bb1a8",
"sha256": "154c3d30455d778fd3343b6b4851f0fa4665f0f7625b0adb3675e2bafbbf6bf1"
},
{
"path": "docs/research/agent-task-catalog.json",
"usage": "provenance",
"git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec",
"sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81"
},
{
"path": "research/two-capacity-completion-count/PROOF.md",
"usage": "input",
"git_blob": "0a835ca8de78befc93e61b72d18a471a1e1df344",
"sha256": "66ab99f0c3b13999325523378ae3f9ade8c0341cd194cc8ad5580916bc9144c4"
}
]
}
Loading
Loading