From 245f3d77c9d38f49d13affb9563a266eba92a47b Mon Sep 17 00:00:00 2001 From: Dylan Roy Date: Mon, 28 Sep 2026 16:33:27 -0500 Subject: [PATCH] Add sharper even-capacity P15 tail and actual-coordinate load candidate OpenAI/ChatGPT additive mathematics under current owner direction. Exact worst even reference tail q9 yields2/[9-log(36e^2-63e+28)]<1/2; weighted entropy retains actual coordinate sums. Same even/read-two capacity-only class and palette; no optimal cover-factor claim. Full written arguments, primary-source reconnaissance, standalone rational suite15 tests/mode and7 assertion-rejected mutants/mode, source identities and read-only targeted CI. No original proof or governing scientific-status edit; nonauthor review required. --- .github/workflows/p15-tail-load.yml | 33 +++ frontiers/p15_tail_load_20260928/PROOF.md | 262 ++++++++++++++++++ frontiers/p15_tail_load_20260928/README.md | 21 ++ .../p15_tail_load_20260928/RECONNAISSANCE.md | 30 ++ frontiers/p15_tail_load_20260928/RESULTS.json | 9 + .../p15_tail_load_20260928/SOURCE_FILES.json | 54 ++++ .../p15_tail_load_20260928/SOURCE_MAP.json | 24 ++ .../p15_tail_load_20260928/certificate.py | 152 ++++++++++ .../test_certificate.py | 119 ++++++++ frontiers/p15_tail_load_20260928/verify.py | 119 ++++++++ 10 files changed, 823 insertions(+) create mode 100644 .github/workflows/p15-tail-load.yml create mode 100644 frontiers/p15_tail_load_20260928/PROOF.md create mode 100644 frontiers/p15_tail_load_20260928/README.md create mode 100644 frontiers/p15_tail_load_20260928/RECONNAISSANCE.md create mode 100644 frontiers/p15_tail_load_20260928/RESULTS.json create mode 100644 frontiers/p15_tail_load_20260928/SOURCE_FILES.json create mode 100644 frontiers/p15_tail_load_20260928/SOURCE_MAP.json create mode 100644 frontiers/p15_tail_load_20260928/certificate.py create mode 100644 frontiers/p15_tail_load_20260928/test_certificate.py create mode 100644 frontiers/p15_tail_load_20260928/verify.py diff --git a/.github/workflows/p15-tail-load.yml b/.github/workflows/p15-tail-load.yml new file mode 100644 index 000000000..e55e456da --- /dev/null +++ b/.github/workflows/p15-tail-load.yml @@ -0,0 +1,33 @@ +name: P15 tail and weighted-load exact controls + +'on': + pull_request: + paths: + - 'frontiers/p15_tail_load_20260928/**' + - '.github/workflows/p15-tail-load.yml' + push: + branches: [main] + paths: + - 'frontiers/p15_tail_load_20260928/**' + - '.github/workflows/p15-tail-load.yml' + workflow_dispatch: + +permissions: + contents: read + +jobs: + finite-tail-load: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 + with: + persist-credentials: false + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 + with: + python-version: '3.11.16' + - name: Exact sources, both Python modes and seven semantic mutants + run: | + set -euo pipefail + python -B -S frontiers/p15_tail_load_20260928/verify.py --output "${RUNNER_TEMP}/tail-load-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" + git diff --exit-code diff --git a/frontiers/p15_tail_load_20260928/PROOF.md b/frontiers/p15_tail_load_20260928/PROOF.md new file mode 100644 index 000000000..8187908df --- /dev/null +++ b/frontiers/p15_tail_load_20260928/PROOF.md @@ -0,0 +1,262 @@ +# Even-capacity reference tails and instance-adaptive overlap budgets + +Object: OA-P15-TAIL-LOAD-20260928-v1. +Author: OpenAI / ChatGPT, foreground continuation, 28 September 2026. +Disposition: AUTHOR-SIDE MATHEMATICAL CANDIDATE; source-bound nonauthor review required. +Scientific effect: NONE. No existing proof, governing status, graph or prize changes. + +## 1. Results and exact scope + +This additive note sharpens two steps in the P15 overlap packet at Math- commit +`23b7558943f69a7f479251566b19ba58e75cfc26`. Its original proof documents are not +modified. The independent-provider review of that packet is not presumed complete. +The arguments used here are displayed below rather than imported as accepted +premises. SOURCE_MAP.json identifies the related source objects and their roles. + +Let X be a finite nonempty set covered by nonempty blocks X_i. Every coordinate +belongs to at most two blocks. Each capacity a_i is a positive EVEN integer, +including the capacities of inactive blocks. Define + + D = {U subset X: |U intersect X_i| <= a_i for every i}. + +Let chi_D(U) be the minimum number of members of D partitioning U, with +chi_D(empty)=0. Assume |X_i|=a_i d_i+1, with positive integer d_i, and put +K=max_i d_i >=4. Let O_K(D)={U:chi_D(U)>K}. For independent original Bernoulli +probabilities p_v in [0,1], put H_D=-log mu_p(D), possibly infinite. Admissible +prices satisfy 0<=c_v<=min(1,-log(1-p_v)), taking the upper bound to be one at +p_v=1. A generator family covers O_K(D) when every obstruction contains a member; +a generator g costs product_{v in g}c_v. The empty generator costs one. + +**Theorem 1 (same palette, tighter even-capacity factor).** In this class, + + covercost_c(O_K(D)) <= min(1, rho_9 H_D), (T1) + rho_9 = 2/[9-log(36e^2-63e+28)] < 1/2. + +A rational outward enclosure, not a floating-point fit, is + + 0.47734798895766998533 < rho_9 < 0.47734798895766998534. (T2) + +The former packet supplied 2/log(512/25)<2/3. The new bound has the SAME +structural hypotheses and K, with no restriction on the Bernoulli vector or +transformed prices. It is not a claim that rho_9 is the optimal COVER factor. +The reference-tail optimization used to obtain it is exact, as stated below. + +**Theorem 2 (actual-coordinate load).** More generally, suppose a nonempty family of +nonempty blocks indexed by J really covers an obstruction family, and D is +contained in each local event A_i={|U intersect X_i|<=a_i}. Put p_*=1-e^(-1) and + + H_i=-log P(Bin(|X_i|,p_*)<=a_i)>0, + beta_J=max_{v in X} sum_{i in J: v in X_i} 1/H_i. (T3) + +For independent original coordinates and the same prices, + + covercost_c(O) <= min(1, beta_J H_D). (T4) + +The statement presupposes a genuine setwise cover and positive reference +hazards; it does not assert the palette formula for an arbitrary downset. +It needs neither an even-capacity nor a bipartite hypothesis ONCE a cover has +been established. Section 2 establishes such a cover for Theorem 1. The earlier +bipartite class also has a displayed palette proof in the referenced packet. + +Choose J to contain one representative of each inclusion-minimal active block +(d_i=K). Repeated blocks and redundant strict supersets can be removed because +their containment events are covered by smaller retained generators. In the +even/read-two class beta_J<=2/(-log q_9)=rho_9. If the retained blocks are +disjoint, beta_J<=1/(-log q_9). Unequal reference hazards are retained separately; +a shared coordinate is charged the SUM of its incident weights, never their max. + +## 2. Why the even/read-two full-block family is a cover + +For every U subset X, + + chi_D(U)=max_i ceil(|U intersect X_i|/a_i). (T5) + +The lower bound is immediate. For the upper bound write k for the right side; +the empty set is trivial. Represent each ORIGINAL coordinate of U as one edge +of the block-incidence multigraph: a shared coordinate joins its two block +vertices, and a private coordinate joins its block to a private degree-one +vertex. Coordinates are never duplicated as independent random variables. + +Split the edges incident to block i among a_i/2 vertices as evenly as possible. +Every split degree is at most ceil(2|U intersect X_i|/a_i)<=2k. Pair odd-degree +vertices and add auxiliary edges. Each odd degree was at most 2k-1, so the +augmented degrees are even and at most 2k. Orient an Euler tour in each component. +Each vertex now has at most k incoming and k outgoing edges. Replace each vertex +by its outgoing and incoming copies. An oriented edge joins its tail's outgoing +copy to its head's incoming copy, producing a bipartite multigraph of maximum +degree at most k. + +A bipartite multigraph of maximum degree k can be regularized to a k-regular +one by adding isolated vertices to balance its two parts, then adding edges +between degree deficits. For a left vertex set S, its k|S| edges end in a set +of total degree at most k|N(S)|, proving Hall's condition. Remove a perfect +matching repeatedly to obtain k edge colors. Remove all added edges. In the +original split graph a color has at most one incoming and one outgoing edge +at each vertex, hence at most two. Combining the a_i/2 vertices permits at most +a_i original coordinates per color in X_i. This proves (T5). + +For an inactive i, d_ia_i K holds exactly when X_i subset U. Consequently + + O_K(D)=union_{i:d_i=K}{U:X_i subset U}. (T6) + +Thus J described above is a valid cover at the SAME K. This proves the needed +cover premise independently of a status label on the older packet. It does not +reintroduce that packet's excluded arbitrary macro-clutter or odd capacities. + +## 3. Local price-to-hazard transfer + +For a proper decreasing event A containing the empty configuration, on its +finite coordinate set S define p_v(t)=1-e^(-t_v), 0<=t_v<=1, and +F(t)=-log mu_{p(t)}(A). Since p_v(t)<1 and A contains the empty set, its probability +is positive. Holding other coordinates fixed gives mu(A)=A_0+B_0 e^(-t_v) with +A_0,B_0>=0, by decreasingness. Direct differentiation yields + + partial_v^2 F=-A_0 B_0 e^(-t_v)/(A_0+B_0 e^(-t_v))^2 <=0. + +F is nonnegative. Its one-coordinate chord inequality implies +F(t)>=t_v F(t with t_v=1). Iterating gives + + F(t)>=F(1,...,1) product_{v in S}t_v. (T7) + +For arbitrary probabilities set t_v=min(1,-log(1-p_v)); then p_v(t)<=p_v. +Decreasingness implies -log mu_p(A)>=F(t). Therefore + + product_{v in S}c_v <= [-log mu_p(A)]/F(1,...,1). (T8) + +This holds as an extended inequality at zero event probability. A zero price is +not a reason to delete a generator from the setwise cover. Applying (T8) to A_i +uses reference hazard H_i, not the hazard of the full-block containment event. + +## 4. Weighted entropy with actual coordinate loads + +We prove the needed finite product inequality rather than presume independence +of overlapping events. If H_D is finite, set nu=mu_p(.|D). Let KL denote relative +entropy. Then KL(nu||mu_p)=H_D. Since the S_i=X_i marginal of nu is supported on +A_i, + + KL(nu_{S_i}||mu_{S_i}) + =KL(nu_{S_i}||mu_{S_i}(.|A_i)) - log mu_p(A_i) + >= h_i, h_i=-log mu_p(A_i). (T9) + +All A_i have positive probability because D does. Order the original coordinates +and write + + b_v=E_nu KL(nu(v | all earlier coordinates)||mu_v)>=0. + +Product form of mu and the chain rule give sum_v b_v=H_D. For a subset S, the +law conditioned on earlier coordinates IN S is a mixture of laws conditioned +on all earlier coordinates. Convexity of KL in its first entry gives + + KL(nu_S||mu_S)<=sum_{v in S} b_v. (T10) + +For arbitrary nonnegative weights w_i, multiply (T9)-(T10), sum, and exchange +finite sums: + + sum_i w_i h_i + <=sum_v b_v sum_{i:v in S_i}w_i + <=[max_v sum_{i:v in S_i}w_i] H_D. (T11) + +This is a weighted read-incidence / Finner-type inequality, not a new claim about +arbitrary dependent measures. Deterministic original coordinates have zero +conditional divergence and can be removed from the product support. + +Take w_i=1/H_i on the genuine cover J. Equation (T8) followed by (T11) proves +price_c(J)<=beta_J H_D. Comparing with the unit-price empty-generator cover proves +(T4). If H_D=infinity use that empty generator directly; if H_D=0 the finite +argument gives a zero-price covering family. No infinity divided by infinity +or logarithm of a zero REFERENCE probability is involved. + +A sum, not a maximum, at each shared coordinate is necessary for (T11). Two +identical events depending on one Bernoulli(1/2) coordinate, both of probability +1/2 and both of weight one, have local hazard sum2log2 but global hazardlog2. +Their load is two. This is a counterexample to a max-instead-of-sum entropy step, +not a claim that keeping duplicate generators is optimal. + +## 5. Exact worst reference tail among positive even capacities + +Let + + q_9=P(Bin(9,1-e^(-1))<=2) + =e^(-9)[1+9(e-1)+36(e-1)^2] + =e^(-9)(36e^2-63e+28). (T12) + +**Lemma (sharp reference-tail maximum).** For every even a>=2 and integer K>=4, + + P(Bin(aK+1,1-e^(-1))<=a) <= q_9, (T13) + +and equality is attained at a=2,K=4. + +For a=2, monotonicity in the number of trials gives (T13). If a>=4 is even, put +s=E[5^(-Bernoulli(1-e^(-1)))]=(e+4)/(5e). The elementary inequality e>8/3 gives +s<1/2. Markov's inequality applied to 5^(-Bin(n,p_*)), with n=aK+1>=4a+1, yields + + P(Bin(n,p_*)<=a) <=5^a s^n + <(1/2)(5/16)^a <=625/131072. (T14) + +There is no omitted a=3 case: the theorem's capacity is EVEN. No assertion for +an odd-capacity nonbipartite graph is licensed by this estimate. + +We certify 625/1310720 on [l,u]. Thus + + P(l)/u^9 < q_9 < P(u)/l^9. (T15) + +The two strict margins are the exact positive rationals + + P(l)/u^9 - 625/131072 + =87187623163627321174969/8421039761612032386662400, + 1/64 - P(u)/l^9 + =12311490319341451572976881157/26946192308072632700222520394048. + +This proves the reference maximum and -log q_9>log64. Also e<11/4 implies +e^2<121/16<8, hence log2>2/3. Therefore + + rho_9=2/(-log q_9)<2/log64=1/(3log2)<1/2. (T16) + +Every active even block has H_i>=-log q_9. Every original coordinate belongs +to at most two retained blocks. Equations (T3)-(T4) now prove (T1). + +This is exact sharpness of the uniform REFERENCE tail over the displayed integer +parameter family. The entropy bound, local transfer and empty-generator choice +may lose slack, so optimality of the COVER factor does not follow. + +## 6. Certified numerical interval and operational use + +The executable certificate brackets e by its positive series and geometric tail. +It brackets log x using x=2^j y with 1<=y<2, and + + log y=2 sum_{n=0}^{m-1}t^(2n+1)/(2n+1)+R, + t=(y-1)/(y+1), + 0<=R<=2t^(2m+1)/[(2m+1)(1-t^2)]. + +The same formula gives log2. Monotonic interval operations on +2/[9-log P(e)] give (T2) without using floats to choose or certify endpoints. + +For an instance, first establish an exact palette theorem and identify its +active full-block cover. Remove duplicates and strict supersets. Evaluate each +positive reference H_i, using outward enclosures when numerical certification is +needed. Use a certified UPPER bound on 1/H_i in the load at every original +coordinate. The maximum load is a safe instance-specific factor. One may then +use the full-block cover or the empty-generator cap. An uncertified numerical +hazard is not substituted for a proved lower bound. + +## 7. Verification and acceptance limits + +The small standard-library suite checks the nine-trial polynomial identity, +strict rational margins, interval directions and tails, weight addition at shared +coordinates, inactive-block exclusion, duplicate/superset removal, and the integer- +weighted probability form of (T11) on a heterogeneous finite Bernoulli grid. +It includes the max-instead-of-sum counterexample. Finite tests do not prove +(T7)-(T11) for every probability vector; their analytic proofs are above. + +This is an additive author-side candidate, not a governing acceptance. It does +not modify either #118 source proof, revive #116's unrelated blocked executable, +claim an optimal cover factor, retain arbitrary macro-clutter constraints, or +permit odd capacities in the nonbipartite case. Read-only targeted CI checks +finite certificates and existing repository gates, not the truth of a new full +analytic theorem or organizational reviewer independence. diff --git a/frontiers/p15_tail_load_20260928/README.md b/frontiers/p15_tail_load_20260928/README.md new file mode 100644 index 000000000..2a8d963f9 --- /dev/null +++ b/frontiers/p15_tail_load_20260928/README.md @@ -0,0 +1,21 @@ +# P15: tighter even-capacity and weighted-incidence bounds + +Scientific effect NONE. Author-side candidate; nonauthor mathematical review required. + +Read PROOF.md. Under the SAME even-capacity/read-two assumptions as Math-#118, +the uniform factor is improved from 2/log(512/25)<2/3 to + + 2/[9-log(36e^2-63e+28)] < 1/2. + +The rational enclosure is (0.47734798895766998533,0.47734798895766998534). +The exact sharp reference-tail maximum is the Bin(9,1-e^-1) lower tail at2; +this is NOT a claim that the resulting cover factor is optimal. + +The additional weighted entropy bound uses each coordinate's actual sum of +inverse reference hazards. It applies only after a genuine cover is established. +No source proof or governing status is changed. + +Run `python3 -B -S verify.py --output /tmp/new-tail-load-replay` from this folder. +The output directory must be new and outside the packet. The runner verifies +source membership and hashes, executes both Python modes, and tests semantic +mutants. It is a finite certificate runner, not a continuum theorem checker. diff --git a/frontiers/p15_tail_load_20260928/RECONNAISSANCE.md b/frontiers/p15_tail_load_20260928/RECONNAISSANCE.md new file mode 100644 index 000000000..8bc61b156 --- /dev/null +++ b/frontiers/p15_tail_load_20260928/RECONNAISSANCE.md @@ -0,0 +1,30 @@ +# Primary-source reconnaissance and attribution + +OpenAI / ChatGPT, 28 September 2026. Scientific effect NONE. + +Primary abstract records opened in this session: + +1. Pierre Aboulker, Guillaume Aubian and Chien-Chung Huang, *Vizing's and Shannon's + Theorems for defective edge colouring*, arXiv:2201.11548v2 (3 February 2022), + https://arxiv.org/abs/2201.11548 . Its abstract explicitly describes the even- + defect ceil(Delta/d) multigraph phenomenon. We do not claim invention of that + mechanism. The variable-capacity original-coordinate construction needed here + is written in PROOF.md Section2, using the existing #118 construction. +2. Dmytro Gavinsky, Shachar Lovett, Michael Saks and Srikanth Srinivasan, + *A Tail Bound for Read-k Families of Functions*, arXiv:1205.1478 (25 April 2012), + https://arxiv.org/abs/1205.1478 . The abstract concerns Boolean functions of + independent coordinates, with each coordinate influencing at most k functions. + This confirms a classical related dependence framework, not the exact theorem + or weighted constant of this note. The required weighted entropy chain argument + is provided in full in PROOF.md Section4. + +These were abstract/metadata reads, not full-paper verifications or a comprehensive +novelty audit. No claim of priority, optimal cover constant, or literature absence +is made. The improvement is to this workspace's displayed bound for the same +structural class: the exact even-capacity reference-tail maximum q9 replaces a +coarse Chernoff constant, and actual weighted incidences replace a uniform load. + +The preceding #118 source and tests were read and exposed to this author. The +new rational-series code follows elementary interval estimates also used there. +Source exposure and shared provider/account remain disclosed; no independent +review is created by this note or its citations. diff --git a/frontiers/p15_tail_load_20260928/RESULTS.json b/frontiers/p15_tail_load_20260928/RESULTS.json new file mode 100644 index 000000000..28e13439f --- /dev/null +++ b/frontiers/p15_tail_load_20260928/RESULTS.json @@ -0,0 +1,9 @@ +{ + "all_mutants_assertion_rejected": true, + "baseline_passed": true, + "continuum_verified": false, + "output_pairs_identical": 8, + "scientific_effect": "NONE", + "semantic_mutants_per_mode": 7, + "tests_per_mode": 15 +} diff --git a/frontiers/p15_tail_load_20260928/SOURCE_FILES.json b/frontiers/p15_tail_load_20260928/SOURCE_FILES.json new file mode 100644 index 000000000..263e99df6 --- /dev/null +++ b/frontiers/p15_tail_load_20260928/SOURCE_FILES.json @@ -0,0 +1,54 @@ +{ + "files": [ + { + "bytes": 12828, + "git_blob": "8187908dfd220cb833b94f82c451ef4c0e45e367", + "path": "PROOF.md", + "sha256": "fbca462d4988a06754ded9415ceea6bb1385be5535656d643bdd48edbbee8a20" + }, + { + "bytes": 1056, + "git_blob": "2a8d963f925a769d629e45112983867870691bcf", + "path": "README.md", + "sha256": "830637948365dae801c4ec8382310c7bd69c0ac5735996d7854642e4d698a99d" + }, + { + "bytes": 1864, + "git_blob": "8bc61b1567dcd9b104fa6a361ae0e3efca8c3e4d", + "path": "RECONNAISSANCE.md", + "sha256": "a2741cd9751638916de3983e99ddc70c6363aeab26ef5f1f293d5a95fcfcc9b7" + }, + { + "bytes": 223, + "git_blob": "28e13439f86f0414a051460f36a48f53836f6771", + "path": "RESULTS.json", + "sha256": "e059e301bd6d4d106dfdfd957c538a11d658b149bdc4dcba068ef2f80ff10752" + }, + { + "bytes": 1133, + "git_blob": "294bebc1633f4bcae202569e832f99f5ca4447c8", + "path": "SOURCE_MAP.json", + "sha256": "9b0547968e91ddfbbd42c2d879df4e6d88cf4c1de20c12548b553d3687c15981" + }, + { + "bytes": 5482, + "git_blob": "c2a5b175e6444da578a6d8e1bbd97c36347f9fa0", + "path": "certificate.py", + "sha256": "ed786acea3839ede09a38d46f7425acd7dcfdbaa5f715834142a183aec4128f3" + }, + { + "bytes": 5189, + "git_blob": "9321541e8d5852cca24855244852f73e46db9448", + "path": "test_certificate.py", + "sha256": "6f64322ae77ff9c6fa905ab2e790d244836aa62597ee20b3ea6800f8836c7ebe" + }, + { + "bytes": 5900, + "git_blob": "e0b94703ee235beb115d9d736a0b8254048b08f4", + "path": "verify.py", + "sha256": "52bbaa19975c9be61abc0d6533c181c58cfdedaa2938dbd7efc928b076900a8a" + } + ], + "schema": 1, + "scientific_effect": "NONE" +} diff --git a/frontiers/p15_tail_load_20260928/SOURCE_MAP.json b/frontiers/p15_tail_load_20260928/SOURCE_MAP.json new file mode 100644 index 000000000..294bebc16 --- /dev/null +++ b/frontiers/p15_tail_load_20260928/SOURCE_MAP.json @@ -0,0 +1,24 @@ +{ + "scientific_effect": "NONE", + "repository": "d6g8k5htny-coder/Math-", + "related_sources": [ + { + "commit": "23b7558943f69a7f479251566b19ba58e75cfc26", + "path": "frontiers/p15_bipartite_overlap_20260928/PROOF.md", + "git_blob": "8ad826ecb374cc733e3a547bdba0ba63cad10c08", + "sha256": "21ce7a29ac0971919c0602f556f1aeba48bb14fffd4193864b3f482185bc1698", + "role": "exposed predecessor: exact palette, active generators, local transfer and coarse reference tail; required arguments displayed again here" + }, + { + "commit": "23b7558943f69a7f479251566b19ba58e75cfc26", + "path": "frontiers/p15_bipartite_overlap_20260928/EVEN_CAPACITY_EXTENSION.md", + "git_blob": "ce21e424433100d0307c49bc15cccc748f9438fc", + "sha256": "d28aa700ba83ca139b7b29b6ff06cc39c725470b710af10728867ec10c8ca985", + "role": "exposed predecessor: even-capacity construction and entropy proof; same class, no inherited acceptance" + } + ], + "runtime_dependency_on_predecessor": false, + "original_proofs_changed": false, + "nonauthor_acceptance": false, + "blocked_math116_code_consumed_or_retried": false +} diff --git a/frontiers/p15_tail_load_20260928/certificate.py b/frontiers/p15_tail_load_20260928/certificate.py new file mode 100644 index 000000000..c2a5b175e --- /dev/null +++ b/frontiers/p15_tail_load_20260928/certificate.py @@ -0,0 +1,152 @@ +"""Rational controls for a tighter reference tail and weighted coordinate loads. + +Standard library only; no network or repository writes. Finite calculations are +not a continuum theorem checker. See PROOF.md for the analytic argument. +""" +from fractions import Fraction as F +from itertools import product +from math import factorial + + +def exact(value): + if isinstance(value, bool) or not isinstance(value, (int, F)): + raise TypeError('integer or Fraction required; floats are not certificates') + return F(value) + + +def positive_integer(value): + if type(value) is not int or value < 1: + raise ValueError('positive integer required') + return value + + +def tail_polynomial(z): + z = exact(z) + if z < 1: + raise ValueError('z >= 1 required') + return 36*z*z - 63*z + 28 + + +def tail_nine(z): + """P(Bin(9,1-1/z)<=2) for rational z>=1; not an approximation to e.""" + z = exact(z) + return tail_polynomial(z)/z**9 + + +def exp_one_interval(n=40): + positive_integer(n) + lower = sum((F(1, factorial(j)) for j in range(n+1)), F(0)) + remainder = F(1, factorial(n+1))/(1-F(1, n+2)) + return lower, lower + remainder + + +def _unit_log(x, terms): + t = (x-1)/(x+1) + lower = 2*sum((t**(2*j+1)/(2*j+1) for j in range(terms)), F(0)) + remainder = 2*t**(2*terms+1)/((2*terms+1)*(1-t*t)) + return lower, lower+remainder + + +def log_interval(x, terms=50): + x = exact(x) + positive_integer(terms) + if x <= 0: + raise ValueError('positive logarithm argument required') + if x < 1: + lower, upper = log_interval(1/x, terms) + return -upper, -lower + exponent = 0 + while x >= 2: + x /= 2 + exponent += 1 + lower, upper = _unit_log(x, terms) + l2, u2 = _unit_log(F(2), terms) + return lower + exponent*l2, upper + exponent*u2 + + +def coarse_tail_interval(): + """Outward bounds from 1957/720=4 required') + return F(1, 2)*F(5, 16)**a + + +def factor_interval(): + """Outward bounds for 2/[9-log(36e^2-63e+28)], using rational series.""" + lower_e, upper_e = exp_one_interval() + lower_log, _ = log_interval(tail_polynomial(lower_e)) + _, upper_log = log_interval(tail_polynomial(upper_e)) + lower_h, upper_h = 9-upper_log, 9-lower_log + if lower_h <= 0: + raise ValueError('nonpositive certified hazard floor') + return 2/upper_h, 2/lower_h + + +def _blocks(blocks): + if any(not isinstance(b, (set, frozenset)) or not b or + any(type(v) is not int or v < 0 for v in b) for b in blocks): + raise ValueError('nonempty sets of nonnegative integer coordinates required') + + +def coordinate_load(blocks, weights): + """Maximum SUM of nonnegative weights over blocks sharing a coordinate.""" + _blocks(blocks) + if len(blocks) != len(weights): + raise ValueError('one weight per block required') + weights = [exact(w) for w in weights] + if any(w < 0 for w in weights): + raise ValueError('nonnegative weights required') + ground = set().union(*blocks) + return max((sum((w for b, w in zip(blocks, weights) if v in b), F(0)) + for v in ground), default=F(0)) + + +def minimal_active_indices(blocks, capacities, demands): + """Deduplicate and remove redundant supersets from maximal-demand blocks. + +This only constructs a proposed full-block cover. Its eligibility still requires +an exact palette theorem; it does not certify coloring of an arbitrary downset. + """ + _blocks(blocks) + if not blocks or len(blocks) != len(capacities) or len(blocks) != len(demands): + raise ValueError('one capacity and demand for each nonempty block required') + for a, d in zip(capacities, demands): + positive_integer(a) + positive_integer(d) + if any(len(b) != a*d+1 for b, a, d in zip(blocks, capacities, demands)): + raise ValueError('block size must equal a*d+1') + active = [i for i, d in enumerate(demands) if d == max(demands)] + return [i for i in active if not any( + blocks[j] < blocks[i] or (j < i and blocks[j] == blocks[i]) + for j in active if j != i)] + + +def good_probability(blocks, capacities, probabilities): + """Exact finite product enumeration, limited to 12 coordinates.""" + _blocks(blocks) + if len(blocks) != len(capacities) or any(type(a) is not int or a < 0 for a in capacities): + raise ValueError('nonnegative integer capacity per block required') + ground = sorted(set().union(*blocks)) + if len(ground) > 12: + raise ValueError('enumeration limit is 12 coordinates') + if any(v not in probabilities for v in ground): + raise ValueError('missing original-coordinate probability') + p = {v: exact(probabilities[v]) for v in ground} + if any(value < 0 or value > 1 for value in p.values()): + raise ValueError('probabilities must be in [0,1]') + total = F(0) + for bits in product((0, 1), repeat=len(ground)): + chosen = {v for v, bit in zip(ground, bits) if bit} + if not all(len(chosen & block) <= a for block, a in zip(blocks, capacities)): + continue + mass = F(1) + for v, bit in zip(ground, bits): + mass *= p[v] if bit else 1-p[v] + total += mass + return total diff --git a/frontiers/p15_tail_load_20260928/test_certificate.py b/frontiers/p15_tail_load_20260928/test_certificate.py new file mode 100644 index 000000000..9321541e8 --- /dev/null +++ b/frontiers/p15_tail_load_20260928/test_certificate.py @@ -0,0 +1,119 @@ +"""Exact finite controls, not a proof of a continuum probability theorem.""" +from fractions import Fraction as F +from itertools import product +from math import comb +import unittest +import certificate as c + + +class CertificateTests(unittest.TestCase): + def test_exact_nine_tail_identity(self): + for z in (F(2), F(5, 2), F(87, 32), F(3)): + q = 1/z + direct = sum(F(comb(9, j))*(1-q)**j*q**(9-j) for j in range(3)) + self.assertEqual(c.tail_nine(z), direct) + + def test_tail_domain(self): + for z in (F(0), F(1, 2), True, 2.7): + with self.assertRaises((ValueError, TypeError)): + c.tail_nine(z) + + def test_exponential_bracket(self): + lo, hi = c.exp_one_interval(6) + self.assertEqual(lo, F(1957, 720)) + self.assertEqual(hi, F(31967, 11760)) + self.assertLess(hi, F(87, 32)) + self.assertGreater(lo, F(8, 3)) + + def test_log_brackets_and_reciprocals(self): + self.assertEqual(c.log_interval(F(1)), (0, 0)) + lo, hi = c.log_interval(F(2)) + self.assertGreater(lo, F(2, 3)) + self.assertLess(hi, F(7, 10)) + self.assertEqual(c.log_interval(F(4)), (2*lo, 2*hi)) + self.assertEqual(c.log_interval(F(1, 2)), (-hi, -lo)) + + def test_logarithm_remainder_is_retained(self): + self.assertEqual(c.log_interval(F(2), 1), (F(2, 3), F(25, 36))) + + def test_exact_rational_tail_separation(self): + lo, hi = c.coarse_tail_interval() + self.assertEqual(lo, c.tail_polynomial(F(1957, 720))/F(87, 32)**9) + self.assertEqual(hi, c.tail_polynomial(F(87, 32))/F(1957, 720)**9) + self.assertGreater(lo, F(625, 131072)) + self.assertLess(hi, F(1, 64)) + self.assertGreater(F(8)-F(11, 4)**2, 0) + + def test_even_chernoff_envelope(self): + self.assertEqual(c.even_large_tail_bound(4), F(625, 131072)) + for a in range(4, 34, 2): + self.assertLessEqual(c.even_large_tail_bound(a), c.even_large_tail_bound(4)) + for a in (2, 3, 5, 0, True): + with self.assertRaises((ValueError, TypeError)): + c.even_large_tail_bound(a) + + def test_tight_factor_enclosure(self): + lo, hi = c.factor_interval() + self.assertGreater(lo, F(47734798895766998533, 10**20)) + self.assertLess(hi, F(47734798895766998534, 10**20)) + self.assertLess(hi, F(1, 2)) + self.assertGreater(hi, lo) + + def test_invalid_interval_arguments(self): + for n in (0, True, 1.5): + with self.assertRaises((ValueError, TypeError)): + c.exp_one_interval(n) + for x in (0, -1, True, 0.5): + with self.assertRaises((ValueError, TypeError)): + c.log_interval(x) + + def test_weighted_overlap_load_is_sum(self): + blocks = [{0, 1}, {1, 2}] + self.assertEqual(c.coordinate_load(blocks, [F(1, 3), F(1, 5)]), F(8, 15)) + self.assertEqual(c.coordinate_load([{0}, {1}], [F(1, 3), F(1, 5)]), F(1, 3)) + self.assertEqual(c.coordinate_load([{0}, {0}], [F(1, 3), F(1, 5)]), F(8, 15)) + + def test_active_minimal_cover_unchanged_scope(self): + blocks = [{0, 1, 2, 3, 4}, {0, 1, 2, 3, 4}, set(range(9)), {9, 10}] + self.assertEqual(c.minimal_active_indices(blocks, [1, 1, 2, 1], [4, 4, 4, 1]), [0]) + # Inactive demand-one is not charged, although it remains a constraint of D. + self.assertEqual(c.minimal_active_indices([set(range(5)), {4, 5}], [1, 1], [4, 1]), [0]) + + def test_cover_input_validation(self): + with self.assertRaises(ValueError): + c.minimal_active_indices([{0, 1}], [1], [4]) + with self.assertRaises(ValueError): + c.coordinate_load([{0}], [F(-1)]) + with self.assertRaises(ValueError): + c.coordinate_load([{0}], []) + + def test_integer_weighted_entropy_probability_form(self): + blocks = [{0, 1}, {1, 2}, {2, 0}] + weights = [1, 2, 3] + exponent = int(c.coordinate_load(blocks, list(map(F, weights)))) + self.assertEqual(exponent, 5) + for vals in product((F(0), F(1, 3), F(2, 3), F(1)), repeat=3): + p = dict(enumerate(vals)) + joint = c.good_probability(blocks, [1, 1, 1], p) + rhs = F(1) + for block, weight in zip(blocks, weights): + rhs *= c.good_probability([block], [1], p)**weight + self.assertLessEqual(joint**exponent, rhs) + + def test_shared_coordinate_max_instead_of_sum_is_false(self): + p = {0: F(1, 2)} + joint = c.good_probability([{0}], [0], p) + self.assertEqual(joint, F(1, 2)) + # Two identical local events, each with weight one, need load TWO. + self.assertGreater(joint, joint*joint) + self.assertEqual(joint**2, joint*joint) + + def test_exact_enumeration_endpoints(self): + blocks = [{0, 1}, {1, 2}] + self.assertEqual(c.good_probability(blocks, [1, 1], {v: F(0) for v in range(3)}), 1) + self.assertEqual(c.good_probability(blocks, [1, 1], {v: F(1) for v in range(3)}), 0) + self.assertEqual(c.good_probability(blocks, [1, 1], {v: F(1, 2) for v in range(3)}), F(5, 8)) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/frontiers/p15_tail_load_20260928/verify.py b/frontiers/p15_tail_load_20260928/verify.py new file mode 100644 index 000000000..e0b94703e --- /dev/null +++ b/frontiers/p15_tail_load_20260928/verify.py @@ -0,0 +1,119 @@ +"""Exact source and finite-control replay; no network or repository mutation.""" +import argparse +import hashlib +import importlib +import io +import json +from pathlib import Path +import shutil +import subprocess +import sys +import tempfile +import unittest + +ROOT=Path(__file__).resolve().parent +MUTANTS={ + 'wrong-nine-tail':('36*z*z - 63*z + 28','36*z*z - 62*z + 28','test_exact_nine_tail_identity'), + 'omit-exp-tail':('return lower, lower + remainder','return lower, lower','test_exponential_bracket'), + 'omit-log-tail':('return lower, lower+remainder','return lower, lower','test_logarithm_remainder_is_retained'), + 'lose-read-two':('return 2/upper_h, 2/lower_h','return 1/upper_h, 1/lower_h','test_tight_factor_enclosure'), + 'lose-chernoff-half':('return F(1, 2)*F(5, 16)**a','return F(5, 16)**a','test_even_chernoff_envelope'), + 'max-not-load-sum':('sum((w for b, w in zip(blocks, weights) if v in b), F(0))','max((w for b, w in zip(blocks, weights) if v in b), default=F(0))','test_weighted_overlap_load_is_sum'), + 'charge-inactive':('if d == max(demands)','if d <= max(demands)','test_active_minimal_cover_unchanged_scope'), +} + + +def require(condition,message): + if not condition: + raise ValueError(message) + + +def unique_json(text): + def pairs(rows): + result={} + for key,value in rows: + require(key not in result,'duplicate JSON key: '+key) + result[key]=value + return result + return json.loads(text,object_pairs_hook=pairs) + + +def identity(path): + require(path.is_file() and not path.is_symlink(),'regular source required: '+path.name) + data=path.read_bytes() + return {'bytes':len(data),'sha256':hashlib.sha256(data).hexdigest(), + 'git_blob':hashlib.sha1(f'blob {len(data)}\0'.encode()+data).hexdigest()} + + +def sources(): + identity(ROOT/'SOURCE_FILES.json') + rows=unique_json((ROOT/'SOURCE_FILES.json').read_text())['files'] + names=[row['path'] for row in rows] + require(len(names)==len(set(names)) and all(Path(n).name==n and n!='SOURCE_FILES.json' for n in names),'unique flat source paths required') + require(sorted(p.name for p in ROOT.iterdir())==sorted(names+['SOURCE_FILES.json']),'source membership mismatch') + for row in rows: + require(identity(ROOT/row['path'])=={k:row[k] for k in ['bytes','sha256','git_blob']},'source identity mismatch: '+row['path']) + return {p.name:identity(p) for p in sorted(ROOT.iterdir())} + + +def child(directory): + sys.path.insert(0,str(directory)) + module=importlib.import_module('test_certificate') + result=unittest.TextTestRunner(stream=io.StringIO()).run(unittest.defaultTestLoader.loadTestsFromModule(module)) + record={'tests':result.testsRun,'passed':result.wasSuccessful(), + 'failures':sorted(test.id().rsplit('.',1)[-1] for test,_ in result.failures), + 'errors':sorted(test.id().rsplit('.',1)[-1] for test,_ in result.errors)} + print(json.dumps(record,sort_keys=True)) + return 0 if result.wasSuccessful() else 1 + + +def replay(output): + output=output.resolve() + require(not output.exists() and not output.is_relative_to(ROOT),'new output outside source required') + before=sources() + output.mkdir(parents=True) + code=(ROOT/'certificate.py').read_text() + records={} + for name in ['baseline',*MUTANTS]: + with tempfile.TemporaryDirectory(prefix='p15-tail-load-') as temporary: + directory=Path(temporary) + shutil.copyfile(ROOT/'test_certificate.py',directory/'test_certificate.py') + text=code + if name!='baseline': + old,new,_=MUTANTS[name] + require(code.count(old)==1,'mutation anchor not unique: '+name) + text=code.replace(old,new) + (directory/'certificate.py').write_text(text) + pair=[] + for mode,flags in [('normal',[]),('optimized',['-O'])]: + process=subprocess.run([sys.executable,'-B',*flags,'-S',str(ROOT/'verify.py'),'--child',str(directory)],capture_output=True,timeout=30) + (output/(name+'_'+mode+'.stdout')).write_bytes(process.stdout) + (output/(name+'_'+mode+'.stderr')).write_bytes(process.stderr) + result=unique_json(process.stdout.decode()) + require(not process.stderr and not result['errors'],'execution error: '+name) + require(result['tests']==15,'wrong test count: '+name) + if name=='baseline': + require(process.returncode==0 and result['passed'] and not result['failures'],'baseline failed') + else: + require(process.returncode==1 and not result['passed'] and MUTANTS[name][2] in result['failures'],'intended assertion did not reject: '+name) + pair.append(process.stdout) + require(pair[0]==pair[1],'Python mode output mismatch: '+name) + records[name]=unique_json(pair[0].decode()) + summary={'tests_per_mode':15,'semantic_mutants_per_mode':7,'output_pairs_identical':8, + 'baseline_passed':True,'all_mutants_assertion_rejected':True, + 'scientific_effect':'NONE','continuum_verified':False} + require(summary==unique_json((ROOT/'RESULTS.json').read_text()),'stored summary differs') + require(sources()==before,'source mutation') + report={**summary,'source_identities':before,'sources_unchanged':True,'cases':records} + (output/'REPORT.json').write_text(json.dumps(report,sort_keys=True,indent=2)+'\n') + print(json.dumps(summary,sort_keys=True,indent=2)) + return 0 + + +if __name__=='__main__': + parser=argparse.ArgumentParser(description=__doc__) + group=parser.add_mutually_exclusive_group(required=True) + group.add_argument('--output',type=Path) + group.add_argument('--child',type=Path) + args=parser.parse_args() + raise SystemExit(child(args.child.resolve()) if args.child else replay(args.output))