From 7442594d23a351624b20417684afdb31590a2ce9 Mon Sep 17 00:00:00 2001 From: Nick Petalas Date: Mon, 2 Nov 2026 21:23:03 +0000 Subject: [PATCH] feat(research): classify four-stage pure shear tariffs --- .../four-stage-pure-shear-tariff/PROOF.md | 156 ++++++++++++ .../four-stage-pure-shear-tariff/README.md | 128 ++++++++++ .../four-stage-pure-shear-tariff/SOURCES.json | 30 +++ .../four-stage-pure-shear-tariff/TASK.json | 86 +++++++ .../four-stage-pure-shear-tariff/VERIFY.json | 34 +++ .../four-stage-pure-shear-tariff/verify.py | 236 ++++++++++++++++++ 6 files changed, 670 insertions(+) create mode 100644 research/four-stage-pure-shear-tariff/PROOF.md create mode 100644 research/four-stage-pure-shear-tariff/README.md create mode 100644 research/four-stage-pure-shear-tariff/SOURCES.json create mode 100644 research/four-stage-pure-shear-tariff/TASK.json create mode 100644 research/four-stage-pure-shear-tariff/VERIFY.json create mode 100644 research/four-stage-pure-shear-tariff/verify.py diff --git a/research/four-stage-pure-shear-tariff/PROOF.md b/research/four-stage-pure-shear-tariff/PROOF.md new file mode 100644 index 0000000000..b381f0c2ea --- /dev/null +++ b/research/four-stage-pure-shear-tariff/PROOF.md @@ -0,0 +1,156 @@ +# Exact four-stage pure-shear tariffs + +This contribution was produced by Nick Petalas. Apache-2.0. + +## Boundary and charge + +Let F be any field and K a positive integer. Both data banks contain K +arbitrary independent field coordinates. A pure stage has one direction: + +```text +U(A) = [I A; 0 I], L(B) = [I 0; B I]. +``` + +A stage may have any rank from zero to K. Zero means an unused stage. The +required complete endpoint is block antidiagonal with both off-diagonal +blocks invertible. There is no auxiliary data bank, promised input subspace, +or free cross-bank exchange. Arbitrary invertible block-diagonal bridges +may occur before, between and after stages. Their physical price is outside +this rank-tariff relaxation. Pure means the entire stage has one direction; +it may act on many independent pairs at once. + +This is the one-direction-per-stage subclass of themilkman216's PR2052 +multi-pair model. A simultaneous stage with both off-diagonal blocks +nonzero is outside this theorem. PR2052's general lower bound and its +finite searches are cited, not reproved or replayed. + +## 1. Remove bridges without changing stage ranks + +For G=diag(S,T) with S,T invertible, + +```text +G U(A) G^-1 = U(S A T^-1), +G L(B) G^-1 = L(T B S^-1). +``` + +Move every bridge to the left using these identities. Invertible left and +right factors preserve each stage's rank. The remaining exterior bridge +preserves the zero diagonal blocks and invertibility of the off-diagonal +blocks of the required endpoint. Thus it suffices to study shear words +with no bridges. No assumption of one common port basis was added. + +## 2. Complete alternating four-stage classification + +Write the chronological directions as U,L,U,L, so the endpoint is + +```text +M = L(D) U(C) L(B) U(A). +``` + +Ordinary block multiplication, without commuting any coefficients, gives + +```text +M11 = I + C B, +M12 = (I + C B) A + C, +M21 = D (I + C B) + B, +M22 = D ((I + C B) A + C) + I + B A. +``` + +Consequently M is block antidiagonal if and only if + +```text +B is invertible, C = -B^-1, D = B + B A B. (1) +``` + +Indeed M11=0 forces CB=-I, hence B and C are invertible. Then M12=C, +M21=B and M22=DC+I+BA, which is zero precisely at the stated D. +Conversely (1) yields M=[0,-B^-1;B,0], including both invertible +off-diagonal blocks. This works in characteristic two as well. + +Put P=-AB. The complete rank profile is + +```text +(rank P, K, K, rank(I-P)). (2) +``` + +The rank inequality for I=P+(I-P) implies total rank at least 3K. +Equality holds exactly when P is idempotent. To see necessity, equality +makes Im(P) and Im(I-P) complementary. For any vector x, + +```text +P(I-P)x = (I-P)Px +``` + +belongs to both images, hence is zero. Thus P^2=P. Conversely an +idempotent gives the direct sum Im(P) plus Ker(P), so its two ranks sum +to K. Every equality profile (r,K,K,K-r), 0<=r<=K, is attained by B=I, +P=diag(I_r,0), A=-P, C=-I and D=I-P. + +At the first named instance K=4, r=1 gives the complete rank profile +(1,4,4,3), total 12. Therefore an 11-unit four-stage swap, if it exists +in PR2052's larger model, must use a genuinely simultaneous mixed-direction +stage. Unpaidmoon's fork PR125 already reports a finite exclusion of the full +mixed model at K=4 over F2. That result is cited without replay. The present +all-field pure-stage argument leaves the mixed question open over other +fields, including Q, rather than reopening that finite F2 instance. + +## 3. Exact directional tariffs + +Let f_U,f_L be nondecreasing functions on {0,...,K} with f_U(0)=f_L(0)=0. +Among alternating four-stage words, the exact minimum tariff is + +```text +f_U(K) + f_L(K) + min_(0<=r<=K) (f_U(r) + f_L(K-r)). (3) +``` + +For an arbitrary endpoint word let a=rank P and d=rank(I-P). Since a+d>=K, +choose r=K-d. Then 0<=r<=a and K-r=d. Monotonicity and (2) prove the lower +bound (3). Every r is attained by the displayed idempotent construction. +Swapping the bank names gives the same formula for L,U,L,U. + +If each directional tariff is also subadditive, formula (3) is the exact +minimum over all words of at most four pure stages. Adjacent stages with +the same direction merge by U(A2)U(A1)=U(A1+A2), or the analogous lower +identity. Rank subadditivity, monotonicity and tariff subadditivity show +that merging cannot increase the bill. If the two ranks sum to more than K, +choose smaller nonnegative ranks summing to K, apply subadditivity there, +then use monotonicity. The reduced directions alternate. +Pad a shorter word with zero stages to reach four alternating positions; +zero stages cost nothing. The construction in section 2 attains (3). + +For one common nondecreasing subadditive tariff f, the minimum is exactly +3f(K): subadditivity forces f(r)+f(K-r)>=f(K), with equality available at +r=0 or K. In particular no fourth pure stage improves any common concave +power tariff r^theta, 0= 3 * n, "rank floor") + projector = neg(mul(a, b, p), p) + idempotent = mul(projector, projector, p) == projector + require((total == 3 * n) == idempotent, "equality classification") + equality += int(total == 3 * n) + best_linear = min(best_linear, total) + squared = sum(x * x for x in profile) + if squared < best_square: + best_square, square_profile = squared, profile + require(best_linear == 3 * n, "attained minimum") + return {"dimension": n, "prime": p, "words": words, "endpoints": endpoints, + "rank_optima": equality, "minimum_rank": best_linear, + "minimum_square_tariff": best_square, "square_profile": square_profile, + "monotone_tariff_pairs": tariff_oracle(profiles, n)} + + +def attaining_words(): + count = bridged = 0 + named = None + for n in range(1, 9): + for p in (2, 3, 5, 7): + eye = identity(n) + rotation = tuple(tuple(int(j == (i + 1) % n) for j in range(n)) + for i in range(n)) + inverse = tuple(zip(*rotation, strict=True)) + transport = block_diagonal(rotation, eye) + return_map = block_diagonal(inverse, eye) + for r in range(n + 1): + projector = tuple(tuple(int(i == j and i < r) for j in range(n)) + for i in range(n)) + a, b = neg(projector, p), eye + c, d = neg(eye, p), add(eye, neg(projector, p), p) + word = (shear(a, True), shear(b, False), shear(c, True), shear(d, False)) + endpoint = identity(2 * n) + for gate in word: + endpoint = mul(gate, endpoint, p) + expected = tuple((0,) * n + neg(eye, p)[i] for i in range(n)) + expected += tuple(eye[i] + (0,) * n for i in range(n)) + require(endpoint == expected, "all arbitrary-data columns") + profile = tuple(rank(x, p) for x in (a, b, c, d)) + require(profile == (r, n, n, n - r), "attaining rank profile") + transformed = tuple(mul(mul(transport, g, p), return_map, p) for g in word) + with_bridges = identity(2 * n) + for gate in transformed: + with_bridges = mul(gate, with_bridges, p) + require(with_bridges == mul(mul(transport, expected, p), return_map, p), + "invertible within-bank transport") + count += 1 + bridged += 1 + if (n, p, r) == (4, 3, 1): + named = {"dimension": n, "prime": p, "profile": profile, + "total_rank": sum(profile), "endpoint": endpoint} + require(named is not None, "named first fixture") + return {"attaining_words": count, "bridged_words": bridged, "first_fixture": named} + + +def tariff_checks(): + count = 0 + for n in range(1, 33): + for upper_price, lower_price in itertools.product(range(1, 6), repeat=2): + values = tuple(upper_price * r + lower_price * (n - r) for r in range(n + 1)) + require(min(values) == min(upper_price, lower_price) * n, "linear tariff") + square_values = tuple(r * r + (n - r) ** 2 for r in range(n + 1)) + require(min(square_values) == (n * n + 1) // 2, "convex tariff control") + count += 1 + return {"integer_tariffs": count} + + +def controls(): + eye = identity(2) + nil = zero(2) + swap = mul(shear(neg(eye, 3), True), + mul(shear(eye, False), shear(neg(eye, 3), True), 3), 3) + altered = mul(shear(neg(eye, 3), True), shear(eye, False), 3) + jordan = ((1, 1), (0, 1)) + checks = { + "three-stage positive": antidiagonal(swap), + "omitted middle shear": not antidiagonal(altered), + "zero matrix is singular": antidiagonal(zero(2)) and rank(zero(2), 3) == 0, + "nonprojector equality": rank(jordan, 2) == 2 and mul(jordan, jordan, 2) != jordan, + "identity is not a swap": not antidiagonal(shear(nil, True)), + "field-sensitive rank": rank(((1, 1), (1, -1)), 3) != rank(((1, 1), (1, 1)), 2), + "complementary supports": rank(((1, 0), (0, 0)), 2) + rank(((0, 0), (0, 1)), 2) == 2, + } + for name, passes in checks.items(): + require(passes, name) + return {"checks": tuple(checks), "count": len(checks)} + + +def main(): + require(len(sys.argv) == 1, "no command-line arguments supported") + package = Path(__file__).resolve().parent + report = {"status": "PASS_FOUR_STAGE_PURE_SHEAR_TARIFF"} + report["exhaustive"] = [exhaustive(1, p) for p in (2, 3, 5, 7)] + report["exhaustive"].append(exhaustive(2, 2)) + report["constructions"] = attaining_words() + report["tariffs"] = tariff_checks() + report["controls"] = controls() + names = ("README.md", "PROOF.md", "TASK.json", "SOURCES.json", "VERIFY.json", "verify.py") + report["sha256"] = {} + for name in names: + source = package / name + require(source.stat().st_size <= 1_000_000, "package file size limit") + report["sha256"][name] = hashlib.sha256(source.read_bytes()).hexdigest() + print(json.dumps(report, sort_keys=True)) + + +if __name__ == "__main__": + main()