EWECZKA-Xorilithry-Vexhyrration / docs /FORMAL_DERIVATIONS.md
PureOne's picture
Release EWECZKA specialist compression research prototype v3.1
297df1b verified
|
Raw History Blame Contribute Delete
22.8 kB

EWECZKA v3: rigorous fork-core theory and claim audit

Conventions and status

Let a file be split into m blocks of B bytes, using only complete blocks, recording the true original length, and encoding any remaining tail bytes independently. Set q=8B. Interpret the blocks as rows of X in GF(2)^(m x q), with bitwise XOR as addition. Let r=rank_GF(2)(X), with 0<=r<=min(m,q). The statements below are algebraic theorems and explicit conditional bit budgets. Their proofs do not establish worldwide novelty. Binary linear algebra, finite-field rank counts, matroid greedy optimization and enumerative source coding are classical. The concrete EWECZKA implementation and integration can be new as a research proposal, but historical priority requires broader investigation.

1. Systematic fork-core reconstruction

Theorem 1. Choose r independent original block rows at anchor positions P={p_0<...<p_(r-1)}. Let B be the r x q matrix containing those rows in this order. Every remaining row has a unique coordinate mask c_i in GF(2)^r, and X_i=c_i B. At an anchor p_j, its coordinate mask is the unit vector e_j and need not be stored. An exact self-contained representation consists of the anchor set, the r paid basis blocks, the (m-r) coordinate masks and dimensions/true original length. Any remaining tail bytes are encoded independently and paid separately.

Proof. The independent rows form a basis of the row space because its dimension is r. Spanning gives existence of each mask. If cB=dB, then (c-d)B=0; row independence implies c=d. Set the omitted anchor masks to the corresponding unit vectors, reconstruct every other row by XORing the selected basis rows, concatenate the complete blocks and append the independently stored tail. This reproduces the original file exactly. No outside model, remote seed or predecessor block is required.

An ideal raw bit budget is

L_sys = r q + (m-r) r + A + H = r(m+q-r) + A + H,

where A=ceil(log2 binom(m,r)) enumerates the anchor set and H pays dimensions, rank, original length, integrity and framing. For r=0, interpret every product as empty and A=0: all rows are zero. All basis records are paid; treating independent high-entropy seeds as free would invalidate the claim. Actual byte serialization adds its explicit rounding and record overhead, and a conventional compressor may reduce paid basis/mask size further.

Implementation-specific corollary (v3 RAW components). For m full blocks of B bytes, rank r, and T literal tail bytes, the offered systematic packed-mask candidate has exact upper bound

L_bytes <= 122 + rB + ceil(log2 binom(m,r)/8) + ceil(r(m-r)/8) + T.

The fixed 122 bytes include the 56-byte final header, 9-byte rank header, 6-byte tile header, and three 17-byte component frames. This upper bound uses RAW components; component compression can only improve the offered candidate after its mode byte and frame have been counted. The bound is conditional on the candidate being admitted by configured block/rank/search caps. Relative to the ideal systematic bit budget for full blocks (including A=ceil(log2 binom(m,r))), byte packing adds at most 14 bits, fixed framing adds 976 bits, and the literal tail adds 8T bits. The column-oriented mask candidate also remains available; its older r ceil((m-r)/8)-byte budget is a valid but weaker RAW bound and can still win when its bit planes compress better. The exact actual header and mode-selection implementation remain the authority; dimensions and small-file framing can dominate apparent density.

A decoder cannot generally infer omitted anchor masks without anchor markers or an index set. The fact that row-order greedy anchors could later be rediscovered from reconstructed bytes does not solve the initial parsing dependency. If anchors are fixed in advance by the source protocol, their positions may be side information; the comparison must explicitly condition on that protocol. Otherwise their bits are part of the archive.

The algebraic minimality statement is exact but narrow: r is the minimum number of q-bit linear generators that span all original blocks. This is not a lower bound on all possible compression descriptions. A polynomial or short program can generate data of large GF(2) row rank. Conversely, a rank-r file can have incompressible basis blocks and dense incompressible coefficient masks. EWECZKA therefore uses rank as one candidate representation rather than a universal complexity measure.

2. Finite rank-family boundary and near-minimax systematic coding

Theorem 2. The number N(m,q,r) of binary m x q matrices of exact rank r is

N = product_(i=0)^(r-1) [(2^m-2^i)(2^q-2^i)/(2^r-2^i)].

Conditional on m,q,r, an injective fixed-length code for every such matrix needs at least ceil(log2 N) bits. There exists an enumerative code attaining this length.

Proof. Write X=C B, with C an m x r full-column-rank matrix and B an r x q full-row-rank matrix. Choosing independent columns of C successively gives product(2^m-2^i) possibilities; choosing independent rows of B gives product(2^q-2^i). Every rank-r X has exactly |GL(r,2)|=product(2^r-2^i) such ordered factorizations, since replacing (C,B) by (C S^(-1),S B), S invertible, enumerates all bases of its row space. Dividing gives the formula. There are N distinct outputs; a k-bit fixed-length code has at most 2^k words. Ranking the family and recording its integer index proves attainability.

Let eta=product_(j>=1)(1-2^(-j))=0.2887880950866... and gamma=-log2 eta=1.791916824662... . Put d=product_(i<r)(1-2^(i-r)), a=product_(i<r)(1-2^(i-m)), b=product_(i<r)(1-2^(i-q)). Since m,q>=r, eta<=d<=a,b<=1. Hence d<=ab/d<=1/d and

abs(log2 N-r(m+q-r)) <= gamma < 1.792.

Thus the ideal systematic representation differs from the finite-family entropy boundary by at most A+1.792 bits above, before H and packing. The unconditional paid-basis plus all m masks would have r^2 additional principal bits; omitting known unit masks removes that gauge redundancy. Systematic anchor coding has already captured the r^2 main-term saving, so do not claim that an additional RREF stage would save r^2 again.

The lower bound is worst-case over the rank family and the uniform-family entropy. It is not a pointwise lower bound on a particular matrix. The zero matrix, a periodic rank-r matrix or one generated by a short program can have a shorter specialized description. Uniform-family incompressibility says that arbitrary decoders cannot assign very short descriptions to most members of this finite family. It does not forbid a chosen structured member from being short.

This is an honest extreme-density certificate: a source protocol promising rank at most r restricts its admissible output family. The archive stores which member occurred. Algebra does not erase distinctions between arbitrary files; it identifies a family in which fewer independent distinctions existed in the first place.

3. Cost-optimal paid cores: exactly where greedy is valid

Theorem 3. Give each original block i a fixed standalone serialization cost w_i. Among all rank-r subsets of original rows, choose the independent set of total cost sum(w_i) minimum. If the anchor index is coded with a fixed A-bit field and every non-anchor mask has exactly r bits, the complete ideal representation is minimized by sorting blocks by nondecreasing w_i and greedily accepting a row exactly when it increases rank.

Proof. Independent subsets of vectors satisfy heredity and the augmentation axiom, so they form a vector matroid. To see augmentation directly, if independent I,J have |I|<|J| and every row of J lies in span(I), then dimension span(J)<=|I|, contradicting independence of J. Let the greedy basis be G. Compare with any optimal basis O. At a greedy choice g, if g is absent from O, adding g creates a dependence cycle. Some member o of that cycle is outside the already retained greedy prefix. Exchanging o for g preserves a basis. Since g was cheapest among candidates that could extend the prefix, w_g<=w_o. Repeat the exchanges to transform O into G without increasing cost. Therefore G is minimum weight.

For every basis P, the remainder of the ideal objective is constant: (m-r)r+A+H. The anchor rank field has the same width for every r-element subset, even though its actual value varies. Additive basis costs are therefore exactly the terms the greedy theorem optimizes. Ties can be resolved by original row index so the encoder is deterministic. Decoder output remains row-order independent because the anchor set specifies where each basis row belongs.

The theorem fails as a claim about arbitrary encoded total length if mask streams are compressed adaptively. Different bases can induce coefficient matrices with radically different sparsity, runs or entropy. If the objective is sum(w_i)+compressed_size(C_P)+variable_anchor_cost(P), it is no longer additive in selected rows. Greedy can remain a useful candidate generator but no global optimality theorem follows. Likewise, a basis synthesized by XORing original rows may have cheaper standalone records than every original-row basis. That candidate space is not covered by the finite vector-matroid ground set used here.

A safe implementation evaluates several deterministic bases or orientations and selects the smallest fully serialized archive. An exact portfolio certificate is only over evaluated candidates: the chosen length is at most each of those candidate lengths, with any common wrapper paid once. It does not certify the best possible basis or shortest program. Exhaustive basis search is finite but can be combinatorially expensive. The v3 work should distinguish the proved fixed-mask optimum, the heuristic compressed-mask search, and measured final byte counts.

The optimization principle is classical (Rado-Edmonds), while its application to the paid-core byte budget is a useful system derivation. Calling the whole process Xorilithry or Vexhyrration gives a project vocabulary; it does not replace the mathematical provenance.

4. Canonical quotient coding: explicit enumerative extension

Theorem 4. Conditional on m,q,r, a canonical row-space index and a full-rank coefficient index give a computable exact code of ceil(log2 N(m,q,r)) bits. This is a proposed mathematical extension; it must not be described as implemented unless its rank/unrank routines exist and have passed tests.

Construction. Every r-dimensional row space W in GF(2)^q has one reduced row echelon basis B(W). Every X with row space W has one coefficient matrix C such that X=C B(W), and C has full column rank. Let G(q,r) count r-dimensional subspaces and Q(m,r)=product_(i<r)(2^m-2^i) count full-rank coefficient matrices. Then N=GQ. Encode I_X=I_W Q+I_C, where 0<=I_W<G and 0<=I_C<Q.

For a reduced basis with zero-based pivot positions p_0<...<p_(r-1), the number of unconstrained entries is

z(P)=r(q-r)-sum_(i=0)^(r-1)(p_i-i).

All pivot columns are known unit columns; entries left of a row pivot are zero; the z remaining entries are arbitrary. Thus G(q,r)=sum_P 2^z(P). Splitting according to whether the first column is a pivot proves

G(q,r)=G(q-1,r)+2^(q-r) G(q-1,r-1),

with G(q,0)=G(q,q)=1 and out-of-range terms zero. Nonpivot-first row spaces are indexed by their q-1 column suffix. Pivot-first row spaces have a residual (r-1)-dimensional suffix space and q-r free entries in the first basis row. Recursing ranks and unranks these finite objects.

To enumerate C, encode its independent columns successively. At stage j, the column must lie outside the span S_j of previous columns; there are exactly 2^m-2^j valid choices. Give it its ordered index among that complement, and combine the resulting digits in these mixed radices. Complement rank is int(v)-#{s in S_j:s<int(v)}. The subspace count can be computed without listing all 2^j elements: scan a binary prefix and solve the corresponding linear constraints on the j coordinates. A consistent prefix fixes rank a of those constraints and therefore contains 2^(j-a) subspace vectors. The same prefix counts support inverse selection. All arithmetic is finite integer arithmetic.

This removes representation multiplicity without hiding basis data. RREF entries, subspace index and coefficient index together still identify one exact X. Computation and large-integer arithmetic may be expensive, so the near-minimax existence statement is distinct from a high-throughput implementation. The systematic practical codec already has principal term r(m+q-r); canonical quotient coding chiefly removes the paid anchor-profile overhead and remaining finite packing inefficiency. It does not create an additional unlimited compression gain.

5. Sparse innovations, rank inflation and a robust exact certificate

Theorem 5. Suppose X=F XOR E, rank(F)=r and E has exactly k nonzero bit positions among M=mq bits. An exact description exists with

L <= ceil(log2 N(m,q,r)) + ceil(log2 binom(M,k)) + H',

where H' records dimensions, rank, k, lengths and integrity. A systematic implementation replaces the first term by its measured core representation length. There are no residual-value bits for a bit residual: each supported bit is flipped. A byte residual instead has s positions among mB bytes and nonzero byte values, costing at most ceil(log2 binom(mB,s))+8s+metadata (or an enumerative 255^s value index).

Proof. Encode F by any exact rank-r representation. Encode the sorted residual support by its combinatorial rank among k-subsets. Decode F, unrank the support, and flip those positions. This reproduces X exactly. Multiple pairs (F,E) may give the same X; that does not harm decodability because the chosen pair is explicit. The count N*binom(M,k) is an upper bound on the admissible output family rather than necessarily its exact size. Neither minimum-rank F nor the minimum full description is assumed to be found efficiently.

The familiar support bound log2 binom(M,k)<=k log2(eM/k), for 1<=k<=M, gives a usable finite prediction. If r/m, r/q and k log2(eM/k)/M all approach zero, the relative bit length can approach zero, provided H'/M also approaches zero. For a fixed error fraction k/M approaching epsilon>0, the support term approaches h_2(epsilon) bits per output bit; it does not vanish. If residual values are high entropy, their paid values add their own floor.

Sparse perturbation does not imply low rank of the perturbed matrix. Since rank(A+B)<=rank(A)+rank(B), and a single supported bit is one rank-one elementary matrix, rank(X)<=r+min(k,m,q). This bound can be attained: take F=0 and let E have k diagonal ones with k<=min(m,q). There are only k bit errors, yet rank(X)=k. In a square m=q matrix, m errors out of m^2 bits can therefore raise rank from zero to full while the error fraction tends to zero. The raw global-rank budget can therefore become uninformative on nearly low-rank data. This does not imply that the complete codec fails: compressed echelon basis records can remain inexpensive even when exact rank is high.

More generally, for any S in GL(r,2), the gauge change (B,C) -> (SB,C S^(-1)) preserves X exactly. Raw factor sizes are invariant, but conventional encoded lengths of the two factors are not. The valid measured objective is min_S [L_basis(SB)+L_coordinates(C S^(-1))]+metadata over the gauges actually tried. Cancellation can turn seed-dominated rows into sparse echelon innovations, while redistributing their dependence into the coordinate factor. High rank may coexist with a short selected archive because this is a smaller structured subfamily of the full rank family; it contradicts no uniform-family counting bound. A short measured archive establishes exact source-specific compression, not recovery of an unknown planted clean factor F or global gauge optimality.

A robust residual mode is consequently a separate modelling task. Using adjacent or sampled anchor rows as noisy cores does not automatically locate F. The approximation literature already studies low-GF(2)-rank matrices with Hamming errors, including hard instances. Claiming a polynomial-time global optimum would require a separate theorem. The defensible engineering step is to try bounded candidates, retain exact residuals, pay the candidate description, and select only when total bytes improve. Tiling may also contain rank inflation locally, at the price of repeated basis and framing costs.

6. Predictable density, invariance and physical accounting

Theorem 6. For the ideal systematic rank representation,

L_sys/(mq) = r/m + r/q - r^2/(mq) + (A+H)/(mq).

Consequently a rank-bounded source family can have near-vanishing relative length as both m/r and q/r grow, with sublinear metadata. This is a family guarantee, not a universal guarantee over all files. With fixed q and growing m, dense arbitrary coefficient masks retain the floor r/q; eliminating that floor needs additional demonstrable structure in the coefficient sequence.

Balanced fork frontier. Hold the full-block size S=mq bits and rank r fixed while varying the matrix aspect ratio. By the arithmetic-geometric mean inequality, m+q>=2sqrt(S), so the principal family description satisfies

r(m+q-r) >= 2r sqrt(S)-r^2.

Equality occurs at m=q=sqrt(S) in the continuous relaxation. If q=alpha sqrt(S), the excess principal cost is exactly r sqrt(S)(alpha+alpha^(-1)-2), a nonnegative measurable aspect-ratio penalty. Under balanced scaling and r=o(sqrt(S)), the principal density 2r/sqrt(S)-r^2/S tends to zero. The combinatorial anchor term is at most r log2(em/r)+1 bits; it also becomes negligible under that scaling. With N full-block bytes, the continuous balanced target is B=sqrt(N/8) bytes. This is a conditional source-family design rule, not a universal file reblocking rule: changing B may change r radically. A real encoder should measure the rank spectrum r(B), pay each complete candidate, and choose its shortest actual archive. Fixed B leaves q fixed and therefore retains an r/q coefficient floor for arbitrary dense masks.

Proof and limits. Divide the exact budget from Theorem 1 by the original mq bits. The term rq pays independent seed bits, while (m-r)r pays membership information for non-anchor blocks. Neither may be silently removed. For uniform rank-r sources, Theorem 2 confirms these principal terms match the counting boundary. A deterministic decoder with a p-bit fixed seed and fixed side information can generate at most 2^p distinct outputs. It cannot distinguish a family of more than 2^p files. With arbitrary variable-length injective codes, fewer than 2^n binary words have length below n, whereas 2^n distinct n-bit inputs exist. At least one n-bit input therefore cannot be shortened. A practical universal input handler must include raw fallback; universal superiority does not follow.

A common invertible XOR-linear transform T within all rows preserves rank because rank(XT)=rank(X). Uniform byte permutation, rotation or triangular XOR lifting can improve literal compressor behaviour but cannot decrease fork-core dimension. Individually aligning each row can change the measured rank, but its alignment instructions must be paid. The v2 modulo-256 difference lift is reversible yet generally not linear over GF(2), so the XOR-rank invariance theorem is inapplicable to that operation. Bit-column and block-row conventions must stay explicit throughout comparisons.

Compression makes fewer physical storage symbols necessary for members of the restricted family. It does not allow an analog state with unspecified infinite precision to store arbitrary digital information. A p-bit finite-precision state has no more than 2^p distinguishable messages. Any decoder, dictionary or source-specific model counted as free side information changes the conditional problem and must be stated. A source-family generator can trade computation for stored bytes; it cannot avoid output work when every reconstructed byte is required.

At output bandwidth R_out bytes/s, fully materializing an N-byte file takes at least N/R_out seconds, irrespective of archive length. A streamed core decoder can retain rB seed bytes, a B-byte working block and the current coordinate mask, rather than the whole decoded file. The current bytes-in/bytes-out Python API may still allocate O(N) memory; the architecture's possible streaming bound must not be reported as measured prototype peak memory. A bandwidth-only benefit prediction is T_core=L_core/R_in+T_decode and T_raw=N/R_in, so time improves only if T_decode<(N-L_core)/R_in under those stated assumptions. Actual energy, latency and memory require measured experiments; logical losslessness alone proves no thermodynamic hardware advantage.

Reference provenance and novelty caution

  1. T. M. Cover, Enumerative Source Encoding, IEEE Transactions on Information Theory 19(1), 73-77 (1973). DOI: 10.1109/TIT.1973.1054929. Author-hosted PDF: https://isl.stanford.edu/~cover/papers/transIT/0073cove.pdf . Classical enumerative indexing precedent.
  2. J. Edmonds, Matroids and the Greedy Algorithm, Mathematical Programming 1, 127-136 (1971). DOI: 10.1007/BF01584082. Publisher: https://link.springer.com/article/10.1007/BF01584082 . Classical weighted basis optimization.
  3. R. Kumar, R. Panigrahy, A. Rahimi, D. P. Woodruff, Faster Algorithms for Binary Matrix Factorization, ICML/PMLR 97, 3551-3559 (2019). Primary proceedings: https://proceedings.mlr.press/v97/kumar19a.html . GF(2) factorization is an established subject.
  4. F. V. Fomin et al., Parameterized Low-Rank Binary Matrix Approximation, ICALP 2018. DOI/primary proceedings: https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.ICALP.2018.53 . Low-rank-with-Hamming-error approximation precedent and algorithmic complexity context.
  5. C. H. Bennett, Logical Reversibility of Computation, IBM Journal of Research and Development 17(6), 525-532 (1973). Primary paper hosted at UCSD: https://mathweb.ucsd.edu/~sbuss/CourseWeb/Math268_2013W/Bennett_Reversibiity.pdf . Logical reversibility and thermodynamic reversibility are distinct from current Python execution.
  6. C. H. Bennett, Notes on Landauer's Principle, Reversible Computation and Maxwell's Demon (2002 preprint, later 2003). https://arxiv.org/abs/physics/0210005 . Erasure accounting and reversible computation context.

The algebraic identities here are independently derived and checked, not offered as historically new theorems. Useful original work may reside in the precise paid-core architecture, its archive language, its measured portfolio behaviour and its source-family prediction certificates. That is a defensible research outcome; global historical novelty and a universally unbeatable compressor are not established.