diff --git a/.github/workflows/p15-bipartite-overlap.yml b/.github/workflows/p15-bipartite-overlap.yml new file mode 100644 index 000000000..57266f07a --- /dev/null +++ b/.github/workflows/p15-bipartite-overlap.yml @@ -0,0 +1,30 @@ +name: P15 overlapping-block exact controls + +'on': + pull_request: + paths: + - 'frontiers/p15_bipartite_overlap_20260928/**' + - '.github/workflows/p15-bipartite-overlap.yml' + workflow_dispatch: + +permissions: + contents: read + +jobs: + exact-overlap: + 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: Verify exact sources and both-mode semantic controls + env: + PYTHONDONTWRITEBYTECODE: '1' + run: | + set -euo pipefail + python -B -S frontiers/p15_bipartite_overlap_20260928/run_validation.py + git diff --exit-code diff --git a/frontiers/p15_bipartite_overlap_20260928/EVEN_CAPACITY_EXTENSION.md b/frontiers/p15_bipartite_overlap_20260928/EVEN_CAPACITY_EXTENSION.md new file mode 100644 index 000000000..ce21e4244 --- /dev/null +++ b/frontiers/p15_bipartite_overlap_20260928/EVEN_CAPACITY_EXTENSION.md @@ -0,0 +1,150 @@ +# Even capacities: read-two overlap without bipartiteness + +Object: OA-P15-EVEN-READ-TWO-20260928-v1. +Author: OpenAI / ChatGPT, 28 September 2026. +Disposition: AUTHOR-SIDE CANDIDATE; independent analytic review required. +Scientific effect NONE. This is an explicit alternative to the bipartite +hypothesis of PROOF.md, not permission to omit that hypothesis for odd capacities. + +## E1. Exact coloring under the alternative structural hypothesis + +Keep the finite original ground set X, covering blocks X_i and capacity downset +D of (O1), but replace bipartiteness by: + + every original coordinate belongs to at most two blocks; + every capacity a_i is a POSITIVE EVEN integer. (E1) + +**Theorem E1.** For all U subset X, + + chi_D(U)=max_i ceil(|U intersect X_i|/a_i). (E2) + +*Proof.* Necessity is unchanged. Write k for the right side and assume U is +nonempty. Represent coordinates by edges of the possibly NONBIPARTITE block +incidence multigraph: a shared coordinate joins its two distinct block vertices; +a private coordinate joins its block to a private auxiliary vertex. + +At each real vertex i, split incident edges as evenly as possible among a_i/2 +auxiliary vertices. Each new vertex has degree at most +ceil(2|U intersect X_i|/a_i)<=2k. Private auxiliary vertices have degree one. +Each original edge keeps its one original-coordinate label. + +The number of odd-degree vertices is even. Pair them arbitrarily and add one +auxiliary edge per pair. Every odd degree was at most 2k-1, so every augmented +degree is even and at most 2k. Each component has an Euler orientation, with +indegree=outdegree=degree/2<=k at every vertex. Form the bipartite directed +incidence graph with one outgoing and one incoming copy of each vertex; an +oriented edge becomes one edge from its tail's outgoing copy to its head's +incoming copy. Maximum degree is at most k. The matching decomposition in the +proof of (O2) colors this bipartite graph with at most k colors. + +In the undirected split graph, a color has at most one outgoing and one incoming +edge at each split vertex, thus at most two incident edges. Remove the auxiliary +edges and combine the a_i/2 split vertices back into block i: at most a_i +original coordinates of each color lie in X_i. This is a coloring of ORIGINAL +coordinates, not independent copies of them. It proves (E2). QED. + +For |X_i|=a_i d_i+1, K=max_i d_i, the exact active-full-block obstruction (O4) +and chi_D(X)=K+1 follow from (E2) by the same elementary argument. This holds +even on an odd cycle of blocks. It does not extend to the odd-capacity triangle +counterexample of PROOF.md, where capacities are one. + +## E2. A self-contained read-q hazard inequality + +The two-sided Cauchy-Schwarz proof of (O9) used a bipartition. It cannot be +reused unchanged for an odd cycle. We prove the necessary replacement rather +than assuming independence of the overlapping events. + +**Lemma E2.** Let mu be a finite product probability measure. Let A_i be events +depending on coordinate sets S_i, each coordinate lying in at most q of those +sets. If D is contained in every A_i, then + + sum_i [-log mu(A_i)] <= q[-log mu(D)]. (E3) + +The inequality uses extended hazards; mu(D)=0 is immediate. + +*Proof for mu(D)>0.* Set nu=mu(.|D). Denote relative entropy by +D_KL(nu||mu), with the usual zero-mass conventions. Then +D_KL(nu||mu)=-log mu(D). Each marginal nu_{S_i} is supported on A_i, whence + + D_KL(nu_{S_i}||mu_{S_i}) + = D_KL(nu_{S_i}||mu_{S_i}(.|A_i)) - log mu(A_i) + >= -log mu(A_i). (E4) + +Order all coordinates. The chain rule and product form of mu give + + D_KL(nu_S||mu_S) + = sum_{v in S} E_nu D_KL(nu(v | earlier coordinates in S)||mu_v). + +Conditioning on only the earlier coordinates in S gives a mixture of the laws +conditioned on all earlier coordinates. Convexity of relative entropy in its +first argument (the finite log-sum inequality) therefore bounds each summand by + + c_v := E_nu D_KL(nu(v | all earlier coordinates)||mu_v) >= 0. + +Thus D_KL(nu_S||mu_S)<=sum_{v in S} c_v. Summing over S_i and using read-q +incidence gives + + sum_i D_KL(nu_{S_i}||mu_{S_i}) <= q sum_v c_v + = q D_KL(nu||mu). + +Combine with (E4). Deterministic coordinates (probability zero or one) have zero +conditional divergence and can also be removed from the finite product support. +No absolute-continuity problem arises because nu is a conditioning of mu. QED. + +This is the entropy form of a classical read-q/Finner-type inequality. Its proof +is included; no result about arbitrary dependent measures is asserted. It +applies to just the active blocks in (O4), as required for charging generators. + +## E3. Full transformed prices and a sub-2/3 factor + +Assume additionally |X_i|=a_i d_i+1, with d_i positive integers and K=max_i d_i>=4. +For an active block a_i is even, hence a_i>=2. The Chernoff calculation in Lemma +O3 gives its reference probability at p_*=1-exp(-1) at most 25/512, uniformly +in ALL such capacities. Hence its reference hazard is at least + + h_even=log(512/25)>3. (E5) + +The last inequality has a short rational certificate: + + e < 87/32, + 512/25 - (87/32)^3 = 314641/819200 > 0. + +The separate-concavity transfer (O5) yields price(X_i)<=h_i/h_even. Lemma E2 with +q=2 yields sum_active h_i<=2[-log mu_p(D)]. Since the active full-block cover is +proved by Theorem E1, summing and applying the price-one empty-generator cap gives + + covercost_c(O_K(D)) + <= min(1, [2/log(512/25)] [-log mu_p(D)]) + <= min(1, (2/3)[-log mu_p(D)]). (E6) + +Here 2/log(512/25)<2/3; neither factor is claimed optimal. Probabilities are the +original independent Bernoulli probabilities in [0,1], and all prices +0<=c_v<=min(1,-log(1-p_v)) are admitted. The zero/infinite-hazard cases are handled +as in PROOF.md. The global palette remains K, not 2K. + +This supplies a second justified structural class: arbitrary read-two block +incidence with EVEN capacities. The first class permits arbitrary positive +capacities but requires bipartiteness. Their hypotheses should not be mixed or +silently dropped. Inactive smaller demands, including demand one, are harmless +to the generator budget in both classes, but (E1) still requires their capacities +to be even for the displayed coloring proof. + +## E4. Verification and literature boundary + +The standard-library implementation follows the displayed construction: +capacity-two splitting, pairing odd vertices, Euler orientation, a bipartite +matching coloring, and one final color per original coordinate. It is checked +against an independent partition oracle on small nonbipartite examples with +heterogeneous even capacities. A triangle with four shared edges per side and +one private coordinate per block has K=4: the twelve shared coordinates are +4-colorable, while the full fifteen-coordinate set needs five colors. + +The read-two hazard inequality is tested on exact heterogeneous Bernoulli grids +on triangle incidence. Finite grids do not prove (E3); its entropy argument does. + +Aboulker-Aubian-Huang, arXiv:2201.11548, studies defective edge coloring and states +the uniform even-capacity phenomenon. This note does not claim invention of that +classical structural mechanism. The variable-capacity construction and the +original-coordinate price/cover assembly are written out here; no unpublished +original checker from another packet is used. Independent mathematical review +and any formalization are still separate obligations. diff --git a/frontiers/p15_bipartite_overlap_20260928/PROOF.md b/frontiers/p15_bipartite_overlap_20260928/PROOF.md new file mode 100644 index 000000000..8ad826ecb --- /dev/null +++ b/frontiers/p15_bipartite_overlap_20260928/PROOF.md @@ -0,0 +1,291 @@ +# P15: overlapping original-coordinate blocks with an exact palette and a sub-3/4 budget + +Object: OA-P15-BIPARTITE-OVERLAP-20260928-v1. +Author: OpenAI / ChatGPT, foreground continuation, 28 September 2026. +Disposition: AUTHOR-SIDE MATHEMATICAL CANDIDATE; NONAUTHOR REVIEW REQUIRED. +Scientific effect: NONE. No existing theorem body, verdict, graph or prize is modified. + +## 1. What changes, and what does not + +The existing `frontiers/full_price_20260924/PROOF.md` treats disjoint capacity +blocks, with an additional macro-clutter. Its full transformed-price theorem +uses independence of local restrictions on disjoint coordinate sets. That +independence is generally false once original coordinates are shared. + +This note proves a different structural extension: capacity blocks MAY OVERLAP, +provided their intersection graph is bipartite. We drop the additional +macro-clutter restriction. The new conclusion is therefore not a blanket +extension of every earlier realized family, nor an arbitrary-downset result. +Both its coloring assertion and its probability budget are proved below on the +actual original coordinates; it does not simply invoke P15-B with unverified +local covers. Auxiliary graph vertices do not duplicate random coordinates. + +Let X be a finite ground set, covered by nonempty blocks X_i (i in I). Fix positive +integer capacities a_i. Assume a partition I=L disjoint-union R such that +blocks on the SAME side are pairwise disjoint. Equivalently the graph joining +intersecting blocks is bipartite. A coordinate belongs to at most one block on +each side and thus to at most two blocks overall. Repeated equal blocks on +opposite sides cause no difficulty. + +Define the decreasing family + + D = {U subset X : |U intersect X_i| <= a_i for every i}. (O1) + +Let chi_D(U) be the least number of sets in D whose disjoint union is U, with +chi_D(empty)=0. Let O_k(D)={U:chi_D(U)>k}. A generator cover G means that every +U in O_k(D) contains some g in G; generators need not themselves be minimal. +Its price is sum_{g in G} product_{v in g} c_v. The empty generator costs one; +the empty FAMILY costs zero. Repeated generators are counted only once. + +## 2. Exact original-coordinate coloring + +**Theorem O1.** For every U subset X, + + chi_D(U) = max_i ceil(|U intersect X_i|/a_i). (O2) + +In particular the lower bounds from individual capacities are simultaneously +attainable despite overlaps. + +*Proof.* Write k for the right side. The lower bound follows because a union of +k members of D contains at most k a_i coordinates in each block. The empty U +case is immediate. Otherwise k>=1. + +Construct a bipartite multigraph whose original edges correspond ONE-TO-ONE to +coordinates of U. A coordinate in both X_l and X_r is an edge between l and r. +A coordinate in only one block is joined to its own auxiliary degree-one +vertex on the other side. Because X covers the ground set, no coordinate lacks +an endpoint. Parallel edges are retained with their distinct coordinate labels. + +At each real vertex i, split its incident edges among a_i auxiliary vertices, +with loads differing by at most one. Every such vertex has degree at most +ceil(|U intersect X_i|/a_i)<=k. An original edge retains both its assigned +endpoints and its SINGLE original label. Private auxiliary vertices have +degree one. + +For completeness, a bipartite multigraph of maximum degree at most k has a +proper edge coloring with at most k colors. Add isolated vertices to make its +two sides have the same size N. Their total degree deficits from k are equal, +namely kN minus the current edge count. Add auxiliary edges between vertices +with positive deficits until every vertex has degree k. Parallel auxiliary +edges are allowed. For S on the left, its k|S| incident edges end in N(S), whose +total degree is k|N(S)|, so |N(S)|>=|S|. Hall's condition gives a perfect +matching. Remove one perfect matching and repeat in the remaining regular +bipartite multigraph, using one new color each time. Discard all auxiliary +edges. This proves the asserted edge-coloring fact. + +Return each original coordinate to the color of its edge. At most one edge of +a given color uses any split vertex, so at most a_i coordinates of that color +lie in X_i. Each color class belongs to D. This proves (O2). The construction +uses independent Bernoulli variables only later: graph splitting has not +altered the ground set or introduced probabilistic independence. QED. + +## 3. The same palette and the exact obstruction + +Now assume + + |X_i| = a_i d_i+1, d_i positive integers, + K = max_i d_i >= 4. (O3) + +Only the maximal demand K must be at least four. Lower-demand blocks, including +demand one, are allowed. Set I_*={i:d_i=K} and let G_* be the distinct full +blocks X_i for i in I_*. + +**Corollary O2.** At the SAME palette K, + + O_K(D) = union_{i in I_*} {U subset X : X_i subset U}. (O4) + +Thus G_* is a genuine cover; its inclusion-minimal distinct members are exactly +the minimal K-obstructions. The whole ground set has chi_D(X)=K+1, so the +obstruction is nonempty. If k>K then O_k(D) is empty. + +*Proof.* By (O2), a K-obstruction must have |U intersect X_i|>Ka_i for some i. +If d_i0. + +The probability stays positive on this cube. With other coordinates fixed, +mu(A)=A_0+B_0 exp(-t_j), where A_0>=0 and B_0>=0 by decreasingness. Consequently + + partial_j^2 F = -A_0 B_0 exp(-t_j)/(A_0+B_0 exp(-t_j))^2 <= 0. + +Only separate, not joint, concavity is needed. Since F>=0, its chord bound +implies F(t)>=t_j F(t with t_j=1). Iterate over all coordinates: + + F(t) >= H_A product_j t_j. + +For arbitrary p_j, take t_j=phi(p_j) and p'_j=1-exp(-t_j)<=p_j. Monotonicity of +a decreasing event gives mu_p(A)<=mu_{p'}(A). Thus, as an extended inequality, + + product_j c_j <= [-log mu_p(A)]/H_A. (O5) + +No division by a zero coordinate probability is made. If mu_p(A)=0, its +hazard is infinite; if some c_j=0, the generator remains in the setwise cover. + +For A_i={|U intersect X_i|<=a_i}, let h_i=-log mu_p(A_i) and + + H_i=-log P(Bin(|X_i|,p_*)<=a_i), p_*=1-exp(-1). + +Equation (O5) gives price(X_i)<=h_i/H_i. We need this only for i in I_*. + +## 5. A uniform reference hazard for the active blocks + +Define + + q_5=P(Bin(5,p_*)<=1)=(5e-4)e^(-5), + h_5=-log q_5=5-log(5e-4), rho_bip=2/h_5. (O6) + +**Lemma O3.** If a>=1 and n>=4a+1, then + + P(Bin(n,p_*)<=a) <= q_5, hence H_(n,a)>=h_5. (O7) + +*Proof.* For a=1 this is monotonicity in n and the exact n=5 formula. For a>=2, +put s=E[5^(-Bernoulli(p_*))]=(e+4)/(5e). Since e>8/3, s<1/2. Markov's +inequality, applied in its valid direction to 5^(-Bin(n,p_*)), gives + + P(Bin(n,p_*)<=a) <= 5^a s^n + <= 5^a s^(4a+1) < (1/2)(5/16)^a <= 25/512. + +This is a bound uniform over ALL a>=2, not a finite-grid inference. The +inequalities 8/3 (28/3)(4/11)^5 > 25/512, + +where the difference in the final comparison is the positive rational +2601239/247374336. This proves (O7). QED. + +Every active block has n=a_i K+1>=4a_i+1, so H_i>=h_5. No estimate on the +reference hazard of inactive blocks is required. + +## 6. Replace false independence by two-sided Cauchy-Schwarz + +Let A_L=intersection_{i in I_* intersect L} A_i, and define A_R analogously. +Blocks within either side are disjoint original coordinate sets. Therefore + + mu_p(A_L)=product_{i in I_* intersect L} mu_p(A_i), + mu_p(A_R)=product_{i in I_* intersect R} mu_p(A_i). + +There is in general NO independence between A_L and A_R. Instead, + + mu_p(D) <= mu_p(A_L intersect A_R) + <= [mu_p(A_L) mu_p(A_R)]^(1/2), (O8) + +by Cauchy-Schwarz for the two indicators. Taking logarithms when probabilities +are positive, and treating zero cases by extended hazards, gives + + sum_{i in I_*} h_i <= 2[-log mu_p(D)]. (O9) + +Empty side intersections have probability one. Combining (O5), (O7), (O9), +and the possible removal of duplicate full-block generators proves + + price_c(G_*) <= sum_{i in I_*} h_i/h_5 + <= rho_bip[-log mu_p(D)]. (O10) + +**Theorem O4 (full-price overlapping-block budget).** Under (O1)-(O3), for every +independent probability vector and every transformed price vector, + + covercost_c(O_K(D)) <= min(1, rho_bip[-log mu_p(D)]), + rho_bip = 2/[5-log(5e-4)] < 3/4. (O11) + +If the uncapped bound is at least one, use the empty generator; otherwise use +G_*. If mu_p(D)=0 the empty generator deals with the infinite hazard. All-zero +prices or probability-one good events create no undefined operation. The +palette is K=max_i d_i, not a sum of palettes or a twofold inflation. + +This is an upper bound, NOT a claim that rho_bip is optimal. Setwise coloring +(O2) is exact; budget-factor sharpness is a different question. + +## 7. Short exact certificate and numerical enclosure + +The positive exponential series through degree six, with a geometric tail, +gives + + 8/3 < 1957/720 < e < 31967/11760 < 87/32 < 11/4. + +Thus 5e-4<307/32. The positive Taylor polynomial for exp(7/3) through degree six +satisfies + + sum_{j=0}^6 (7/3)^j/j! - 307/32 = 129055/209952 > 0. + +It follows that log(5e-4)<7/3, h_5>8/3, and rho_bip<3/4. This exact rational +certificate is sufficient for (O11); no decimal estimate is needed. + +A separate rational-series calculation gives the outward enclosure + + 0.73015826409534942932 < rho_bip < 0.73015826409534942934. (O12) + +The code encloses e by a positive series and its geometric tail. It encloses +logarithms by binary reduction and the positive atanh series with remainder +2t^(2m+1)/((2m+1)(1-t^2)), t=(x-1)/(x+1). Monotonic interval operations yield +(O12). Floating-point arithmetic is not used to choose its endpoints. + +The number is not directly comparable as an improvement on the old sharp +0.84548 factor: the old result allowed maximal demand two and disjoint blocks, +whereas this one uses maximal demand at least four and a different overlap +structure. The substantive advance is handling shared ORIGINAL coordinates. + +## 8. Two false extensions excluded by exact counterexamples + +**Read-two alone does not give the same coloring theorem.** Take nine original +coordinates and blocks + + X_0={0,1,4,5,6}, X_1={0,1,2,3,7}, X_2={2,3,4,5,8}, + a_i=1, d_i=4, K=4. + +Every coordinate belongs to at most two blocks. For U={0,1,2,3,4,5}, no full X_i +is contained in U, but every two distinct coordinates of U share a block. +Equivalently U is the six edges of a triangle with two parallel edges per +side; every matching has size at most one. Thus chi_D(U)=6>4, although the +individual capacity lower bound is four. The full-block family fails to +cover this K-obstruction. The intersection graph is the excluded odd triangle. +This example rules out omitting bipartiteness, not all possible covers on +non-bipartite systems. + +**Overlap invalidates multiplying all local good probabilities.** Take blocks +{0,1} and {1,2}, capacities one, and independent probabilities 1/2. Their good +probabilities are 3/4 each, while the joint good probability is 5/8>9/16. +The invalid disjoint-block inequality fails. The squared Cauchy-Schwarz +inequality (5/8)^2<= (3/4)^2 remains true. + +These are exact finite counterexamples, not asymptotic heuristics. Demand-one +counterexamples to older standalone budgets are also unchanged: allowing an +inactive demand-one block here is not accepting its standalone K=1 budget. + +## 9. Scope, attribution, and verification + +The new proof is self-contained apart from Hall's elementary matching theorem; +the regular bipartite edge-coloring reduction is displayed, not claimed as an +invention. Separate concavity and Cauchy-Schwarz are classical. This note makes +no novelty-priority claim. It closes an author-side overlapping-family route, +not a governing P15 prize, an arbitrary macro-clutter, arbitrary read-two +systems, or an unrestricted downset statement. + +`test_overlap.py` checks exact coloring against independent partition dynamic +programming, shared-edge consistency, parallel edges, heterogeneous capacities, +maximal-demand generator selection, all subsets of a nine-coordinate overlap +instance, rational probability grids, exact counterexamples, and rational +series bounds. The runner rejects semantic changes in both ordinary and +optimized Python. Such tests do not prove an analytic inequality for a +continuum of probabilities; Sections 4-7 supply that argument. No independent +review, Lean formalization, or theorem-status promotion is implied. + +Source identities and limited primary-source reconnaissance are in +SOURCE_MAP.json and RECONNAISSANCE.md. The prior interrupted 31/11 collision +test claim is NOT evidence for this distinct suite. All execution counts +reported here are recomputed for this packet. diff --git a/frontiers/p15_bipartite_overlap_20260928/README.md b/frontiers/p15_bipartite_overlap_20260928/README.md new file mode 100644 index 000000000..c832a76ff --- /dev/null +++ b/frontiers/p15_bipartite_overlap_20260928/README.md @@ -0,0 +1,29 @@ +# P15 bipartite-overlap capacity candidate + +Scientific effect NONE. Author-side theorem; nonauthor review required. + +[Full proof](PROOF.md): shared original coordinates, exact capacity coloring, +same global palette K=max d_i>=4, and transformed-price hazard factor +2/[5-log(5e-4)]<3/4. Inactive smaller demands are permitted. No arbitrary +macro-clutter, arbitrary read-two, sharp-factor, or unrestricted P15 claim. + +The triangle counterexample shows why read-two incidence alone is insufficient; +the overlap probability example shows why the old independence step is invalid. + +Run from this directory: + + python -B -S run_validation.py + python -B -O -S run_validation.py + +The self-contained standard-library runner verifies exact source membership, +checks the stored deterministic summary, runs the finite tests in both modes, +and rejects the semantic mutants. It is not a continuum or Lean proof checker. + +[Source map](SOURCE_MAP.json) and [reconnaissance](RECONNAISSANCE.md) distinguish +project inputs, classical facts, and neighboring literature. No blocked source +from the other mathematical packet has been republished or reconstructed here. + +[Even-capacity extension](EVEN_CAPACITY_EXTENSION.md): for arbitrary read-two +block incidence with all capacities even, the same exact palette and cover +formula holds without bipartiteness. A proved entropy hazard inequality gives +the stronger factor 2/log(512/25)<2/3. Neither factor is claimed optimal. diff --git a/frontiers/p15_bipartite_overlap_20260928/RECONNAISSANCE.md b/frontiers/p15_bipartite_overlap_20260928/RECONNAISSANCE.md new file mode 100644 index 000000000..f94388556 --- /dev/null +++ b/frontiers/p15_bipartite_overlap_20260928/RECONNAISSANCE.md @@ -0,0 +1,35 @@ +# Limited primary-source reconnaissance — 28 September 2026 + +Scientific effect NONE; this memo does not establish historical priority. + +The requested Consensus search for bipartite multigraph/capacity/downset work +returned its monthly-limit error (30 searches used, reset October 1). No +Consensus search result is represented as a read paper in this continuation. +The earlier interrupted search records are not treated as fresh verification. + +Primary-source records read through web search: + +1. Benjamin Gunby, Xiaoyu He, Bhargav Narayanan, *Down-set thresholds*, + arXiv:2112.08525; Random Structures & Algorithms 63 (2023), 442-456, + DOI 10.1002/rsa.21148. https://arxiv.org/abs/2112.08525 +2. Lutz Warnke, *Note on down-set thresholds*, arXiv:2310.11662; + Random Structures & Algorithms 64 (2024), 807-813, + DOI 10.1002/rsa.21194. https://arxiv.org/abs/2310.11662 +3. Pierre Aboulker, Guillaume Aubian, Chien-Chung Huang, *Vizing's and Shannon's + Theorems for defective edge colouring*, arXiv:2201.11548. + https://arxiv.org/abs/2201.11548 + +Read scope: abstracts and publisher metadata, not full-text theorem verification. +The first two establish why up-set threshold predictions cannot be transferred +uncritically to arbitrary downsets; neither supplies this generator-price +statement. The third treats defective edge coloring and confirms that bounded +capacity edge partitions are an established graph-theoretic subject. Its +non-bipartite bounds are NOT imported here. The exact bipartite result used by +this packet is proved from vertex splitting, regularization and Hall's theorem +in PROOF.md. No external abstract is used to justify an unproved continuum or +combinatorial step, and no novelty claim is made for this reduction. + +The present contribution is a scoped assembly on overlapping original +coordinates, with exact cover eligibility and a hazard comparison that does not +assume overlapping events are independent. Existing mathematical source and +review records remain unchanged. diff --git a/frontiers/p15_bipartite_overlap_20260928/RESULTS.json b/frontiers/p15_bipartite_overlap_20260928/RESULTS.json new file mode 100644 index 000000000..ef2558d7a --- /dev/null +++ b/frontiers/p15_bipartite_overlap_20260928/RESULTS.json @@ -0,0 +1,15 @@ +{ + "baseline": { + "errors": [], + "failures": [], + "passed": true, + "tests": 29 + }, + "scientific_effect": "NONE", + "scope": "Finite exact controls only; continuum probability inequality is the written proof.", + "rho_bip_outward_lower": "0.73015826409534942932", + "rho_bip_outward_upper": "0.73015826409534942934", + "rational_strict_upper": "3/4", + "nonauthor_acceptance": false, + "even_capacity_rational_upper": "2/3" +} diff --git a/frontiers/p15_bipartite_overlap_20260928/SOURCE_FILES.json b/frontiers/p15_bipartite_overlap_20260928/SOURCE_FILES.json new file mode 100644 index 000000000..2930e7e9b --- /dev/null +++ b/frontiers/p15_bipartite_overlap_20260928/SOURCE_FILES.json @@ -0,0 +1,51 @@ +{ + "schema": 1, + "scientific_effect": "NONE", + "files": [ + { + "path": "EVEN_CAPACITY_EXTENSION.md", + "bytes": 7620, + "sha256": "d28aa700ba83ca139b7b29b6ff06cc39c725470b710af10728867ec10c8ca985" + }, + { + "path": "PROOF.md", + "bytes": 13835, + "sha256": "21ce7a29ac0971919c0602f556f1aeba48bb14fffd4193864b3f482185bc1698" + }, + { + "path": "README.md", + "bytes": 1458, + "sha256": "5614ed403d5af1d21b36d78299db2a4cd3f01cc865e4a6a89d91a6cf9bce792f" + }, + { + "path": "RECONNAISSANCE.md", + "bytes": 2005, + "sha256": "311cc89850600da11d8391b168cb7d5a29dd98c9cd5fe9a1906701aaa4f47222" + }, + { + "path": "RESULTS.json", + "bytes": 440, + "sha256": "c8db2affadd641db7c64e04b6dc68ff5447230a8d9bd2805c9e300a66a459bee" + }, + { + "path": "SOURCE_MAP.json", + "bytes": 1141, + "sha256": "0c1a2c71c90ec6909acd5023a7977961172fbeb98a9063ada8d7331c69a57b89" + }, + { + "path": "overlap.py", + "bytes": 10684, + "sha256": "7fcc877b683f284d3489b25bdbfa8dfb75ba9deaf94c4ba63e0f8aee4cc7b355" + }, + { + "path": "run_validation.py", + "bytes": 6123, + "sha256": "96f3ae68052a8ea0e8a66a0803084aa264902e514c2ade5fd45ad89f48f5d0c6" + }, + { + "path": "test_overlap.py", + "bytes": 10555, + "sha256": "5f07ea9d1bd25bfe11382a0fe07f8e1e82c4e290dfb8171cb4658c8b77defe0c" + } + ] +} diff --git a/frontiers/p15_bipartite_overlap_20260928/SOURCE_MAP.json b/frontiers/p15_bipartite_overlap_20260928/SOURCE_MAP.json new file mode 100644 index 000000000..3da4b2e01 --- /dev/null +++ b/frontiers/p15_bipartite_overlap_20260928/SOURCE_MAP.json @@ -0,0 +1,28 @@ +{ + "scientific_effect": "NONE", + "source_repository": "d6g8k5htny-coder/Math-", + "source_commit": "5a5b97d2c518dd5c04c89d17029ec96e721d3b78", + "inputs": [ + { + "path": "frontiers/full_price_20260924/PROOF.md", + "git_blob": "582180e41dca0ad815ad0f18574df42040912149", + "use": "Separate-concavity hazard lemma rederived; disjoint-block global step explicitly NOT extended by independence." + }, + { + "path": "frontiers/three_fronts_20260924/P15_REALIZED_COVERS.md", + "git_blob": "173881916ccd0e738bdb41279e835e78e520fcbc", + "use": "Generator-cover terminology and realized capacity family; the new overlap coloring proof is direct, with no imported macro-clutter or assumed local P15-B premise." + } + ], + "external_facts": [ + "Hall matching theorem", + "classical bipartite multigraph edge coloring", + "separate coordinatewise concavity", + "Cauchy-Schwarz", + "Euler orientation of even-degree multigraphs", + "relative entropy chain rule and log-sum inequality" + ], + "governing_status_changed": false, + "nonauthor_acceptance": false, + "blocked_other_packet_republished": false +} diff --git a/frontiers/p15_bipartite_overlap_20260928/overlap.py b/frontiers/p15_bipartite_overlap_20260928/overlap.py new file mode 100644 index 000000000..f2d18543c --- /dev/null +++ b/frontiers/p15_bipartite_overlap_20260928/overlap.py @@ -0,0 +1,263 @@ +"""Finite exact helpers for the bipartite-overlap capacity theorem. + +Standard library only. Original coordinates are graph EDGES, never independent +clones. The analytic probability/hazard theorem is proved in PROOF.md. +""" +from fractions import Fraction +from itertools import product +from math import factorial + +F = Fraction + + +def _validate(blocks, capacities): + if not blocks or len(blocks) != len(capacities): + raise ValueError('nonempty blocks and one capacity per block required') + if any(not b for b in blocks): + raise ValueError('blocks must be nonempty') + if any(type(a) is not int or a < 1 for a in capacities): + raise ValueError('capacities must be positive integers') + + +def capacity_bound(vertices, blocks, capacities): + """Lower bound, exact when the block intersection graph is bipartite.""" + _validate(blocks, capacities) + vertices = set(vertices) + if not vertices <= set().union(*blocks): + raise ValueError('all coordinates must belong to a block') + return max((len(vertices & b) + a - 1) // a for b, a in zip(blocks, capacities)) + + +def color_capacity(vertices, blocks, capacities, sides): + """Construct an optimal coloring of ORIGINAL coordinates under bipartite overlap. + +sides[i] is 0 or 1. Blocks on the same side must be disjoint. Vertex +splitting is an auxiliary incidence-graph construction, not a change to the +probability space. Returns one integer color per original coordinate. + """ + _validate(blocks, capacities) + if len(sides) != len(blocks) or any(s not in (0, 1) for s in sides): + raise ValueError('one bipartition side per block required') + for i, b in enumerate(blocks): + for j in range(i): + if sides[i] == sides[j] and b & blocks[j]: + raise ValueError('same-side blocks intersect') + vertices = set(vertices) + k = capacity_bound(vertices, blocks, capacities) + if not vertices: + return {} + # Incidence slots: each block has a_i auxiliary vertices of degree <= k. + slots = {} + for i, (b, a) in enumerate(zip(blocks, capacities)): + for j, v in enumerate(sorted(b & vertices)): + slots[i, v] = (0, i, j % a) + edges = [] + for v in sorted(vertices): + incidence = [i for i, b in enumerate(blocks) if v in b] + left = next((slots[i, v] for i in incidence if sides[i] == 0), (1, v, 0)) + right = next((slots[i, v] for i in incidence if sides[i] == 1), (1, v, 0)) + edges.append((left, right, v)) + left_nodes = sorted({e[0] for e in edges}) + right_nodes = sorted({e[1] for e in edges}) + n = max(len(left_nodes), len(right_nodes)) + left_nodes += [(2, i, 0) for i in range(n-len(left_nodes))] + right_nodes += [(2, i, 0) for i in range(n-len(right_nodes))] + # Regularize by adding auxiliary edges between deficits; keep original tags. + dl = {v: k for v in left_nodes}; dr = {v: k for v in right_nodes} + for l, r, _ in edges: + dl[l] -= 1; dr[r] -= 1 + if min((*dl.values(), *dr.values())) < 0: + raise RuntimeError('capacity splitting exceeded palette') + for l in left_nodes: + for r in right_nodes: + count = min(dl[l], dr[r]) + edges.extend((l, r, None) for _ in range(count)) + dl[l] -= count; dr[r] -= count + if any(dl.values()) or any(dr.values()): + raise RuntimeError('regularization deficits did not balance') + colors = {} + # A k-regular bipartite multigraph has a perfect matching by Hall; repeat. + for color in range(k): + adjacency = {l: [] for l in left_nodes} + for index, (l, r, _) in enumerate(edges): + adjacency[l].append((r, index)) + match = {} + + def augment(l, seen): + for r, index in adjacency[l]: + if r in seen: + continue + seen.add(r) + if r not in match or augment(match[r][0], seen): + match[r] = (l, index) + return True + return False + + for l in left_nodes: + if not augment(l, set()): + raise RuntimeError('Hall matching failed') + chosen = {index for _, index in match.values()} + for index in chosen: + original = edges[index][2] + if original is not None: + if original in colors: + raise RuntimeError('original coordinate colored twice') + colors[original] = color + edges = [e for index, e in enumerate(edges) if index not in chosen] + if edges or set(colors) != vertices: + raise RuntimeError('incomplete original-coordinate coloring') + return colors + + +def active_generators(blocks, capacities, demands): + """Full blocks at maximal demand; remove duplicates, not zero prices.""" + _validate(blocks, capacities) + if len(demands) != len(blocks) or any(type(d) is not int or d < 1 for d in demands): + raise ValueError('one positive integer demand per block required') + if any(len(b) != a*d+1 for b, a, d in zip(blocks, capacities, demands)): + raise ValueError('block size must be a_i d_i + 1') + k = max(demands) + answer = [] + for b, d in zip(blocks, demands): + if d == k and b not in answer: + answer.append(b) + return answer + + +def good_probability(blocks, capacities, probabilities): + """Exact small-instance Bernoulli enumeration, NOT a large-instance algorithm.""" + _validate(blocks, capacities) + vertices = sorted(set().union(*blocks)) + if len(vertices) > 20: + raise ValueError('finite enumeration is limited to 20 coordinates') + if any(v not in probabilities or not F(0) <= probabilities[v] <= F(1) for v in vertices): + raise ValueError('probabilities in [0,1] required') + total = F(0) + for bits in product((0, 1), repeat=len(vertices)): + selected = {v for v, bit in zip(vertices, bits) if bit} + if not all(len(selected & b) <= a for b, a in zip(blocks, capacities)): + continue + weight = F(1) + for v, bit in zip(vertices, bits): + weight *= probabilities[v] if bit else 1-probabilities[v] + total += weight + return total + + +def cs_probability_bound(joint, left, right): + return joint**2 <= left*right + + +def exp_one_interval(n=40): + if type(n) is not int or n < 1: + raise ValueError('positive series length required') + lo = sum((F(1, factorial(j)) for j in range(n+1)), F(0)) + tail = F(1, factorial(n+1))/(1-F(1, n+2)) + return lo, lo+tail + + +def _log_unit_interval(x, terms): + t = (x-1)/(x+1) + lo = 2*sum((t**(2*j+1)/(2*j+1) for j in range(terms)), F(0)) + error = 2*t**(2*terms+1)/((2*terms+1)*(1-t*t)) + return lo, lo+error + + +def log_interval(x, terms=55): + x = F(x) + if x <= 0 or type(terms) is not int or terms < 1: + raise ValueError('positive logarithm argument and series length required') + if x < 1: + lo, hi = log_interval(1/x, terms) + return -hi, -lo + exponent = 0 + while x >= 2: + x /= 2; exponent += 1 + lo, hi = _log_unit_interval(x, terms) + l2, u2 = _log_unit_interval(F(2), terms) + return lo+exponent*l2, hi+exponent*u2 + + +def overlap_constant_interval(): + elo, ehi = exp_one_interval() + llo, _ = log_interval(5*elo-4) + _, lhi = log_interval(5*ehi-4) + hlo, hhi = 5-lhi, 5-llo + return 2/hhi, 2/hlo + + +def small_certificates(): + return { + 'exp_seven_thirds_margin': sum((F(7, 3)**j/factorial(j) for j in range(7)), F(0))-F(307, 32), + 'a_ge_two_tail_margin': F(28, 3)*F(4, 11)**5-F(25, 512), + 'e_upper_margin': F(87, 32)-exp_one_interval(6)[1], + 'chernoff_geometric_margin': 1-F(5, 16), + } + + +def color_even_capacity(vertices, blocks, capacities): + """Optimal original-coordinate coloring for read-two blocks with EVEN capacities. + +The incidence graph need not be bipartite. Split into capacity-two vertices, +Euler-orient after pairing odd vertices, then edge-color the bipartite +outgoing/incoming incidence graph. Auxiliary edges are discarded at the end. + """ + _validate(blocks, capacities) + if any(a % 2 for a in capacities): + raise ValueError('all capacities must be even') + ground = set().union(*blocks) + if any(sum(v in b for b in blocks) > 2 for v in ground): + raise ValueError('a coordinate may belong to at most two blocks') + vertices = set(vertices) + capacity_bound(vertices, blocks, capacities) + if not vertices: + return {} + slots = {} + for i, (block, capacity) in enumerate(zip(blocks, capacities)): + half_capacity = capacity // 2 + for j, v in enumerate(sorted(block & vertices)): + slots[i, v] = (0, i, j % half_capacity) + edges = [] + for v in sorted(vertices): + incident = [i for i, b in enumerate(blocks) if v in b] + left = slots[incident[0], v] + right = slots[incident[1], v] if len(incident) == 2 else (1, v, 0) + edges.append((left, right, v)) + adjacency = {} + for index, (left, right, _) in enumerate(edges): + adjacency.setdefault(left, []).append(index) + adjacency.setdefault(right, []).append(index) + odd = sorted(v for v, incident in adjacency.items() if len(incident) % 2) + for left, right in zip(odd[::2], odd[1::2]): + index = len(edges) + edges.append((left, right, None)) + adjacency[left].append(index) + adjacency[right].append(index) + unused = set(range(len(edges))) + oriented = {} + while unused: + start = edges[min(unused)][0] + current = start + while True: + while adjacency[current] and adjacency[current][-1] not in unused: + adjacency[current].pop() + if not adjacency[current]: + if current != start: + raise RuntimeError('Euler trail did not close') + break + index = adjacency[current].pop() + unused.remove(index) + left, right, _ = edges[index] + nxt = right if current == left else left + oriented[index] = (current, nxt) + current = nxt + out_blocks = {}; in_blocks = {} + for index, (tail, head) in oriented.items(): + out_blocks.setdefault(tail, set()).add(index) + in_blocks.setdefault(head, set()).add(index) + auxiliary_blocks = list(out_blocks.values()) + list(in_blocks.values()) + colors = color_capacity(set(range(len(edges))), auxiliary_blocks, + [1]*len(auxiliary_blocks), + [0]*len(out_blocks) + [1]*len(in_blocks)) + return {original: colors[index] for index, (_, _, original) in enumerate(edges) + if original is not None} diff --git a/frontiers/p15_bipartite_overlap_20260928/run_validation.py b/frontiers/p15_bipartite_overlap_20260928/run_validation.py new file mode 100644 index 000000000..314ae7a08 --- /dev/null +++ b/frontiers/p15_bipartite_overlap_20260928/run_validation.py @@ -0,0 +1,140 @@ +"""Source-bound finite replay. Standard library only; no network or repository writes.""" +import argparse +import hashlib +import importlib +import io +import json +from pathlib import Path +import shutil +import subprocess +import sys +import tempfile +import unittest + +MUTANTS = { + 'allow-odd-capacity': ( + 'if any(a % 2 for a in capacities):', 'if False:', + 'test_even_capacity_requires_even'), + 'wrong-even-splitting': ( + 'half_capacity = capacity // 2', 'half_capacity = capacity', + 'test_even_triangle_same_palette'), + 'floor-instead-of-ceiling': ( + '(len(vertices & b) + a - 1) // a', 'len(vertices & b) // a', + 'test_exact_coloring_against_partition_oracle'), + 'ignore-bipartition': ( + 'if sides[i] == sides[j] and b & blocks[j]:', 'if False:', + 'test_bipartition_validation'), + 'false-overlap-independence': ( + 'return joint**2 <= left*right', 'return joint <= left*right', + 'test_overlap_destroys_local_independence'), + 'lose-cauchy-schwarz-factor': ( + 'return 2/hhi, 2/hlo', 'return 1/hhi, 1/hlo', + 'test_overlap_constant'), + 'charge-inactive-blocks': ( + 'if d == k and b not in answer:', 'if d <= k and b not in answer:', + 'test_inactive_demand_one_is_not_a_generator'), + 'drop-active-generators': ( + 'if d == k and b not in answer:', 'if d < k and b not in answer:', + 'test_complete_active_block_needs_extra_color'), + 'omit-exponential-tail': ( + 'return lo, lo+tail', 'return lo, lo', + 'test_exp_rational_enclosure'), + 'strict-capacity-event': ( + 'if not all(len(selected & b) <= a for b, a in zip(blocks, capacities)):', + 'if not all(len(selected & b) < a for b, a in zip(blocks, capacities)):', + 'test_binomial_five_tail_identity'), +} + + +def decode_unique(text): + def pairs(items): + result = {} + for key, value in items: + if key in result: + raise ValueError('duplicate JSON key: '+key) + result[key] = value + return result + return json.loads(text, object_pairs_hook=pairs) + + +def child(root): + sys.path.insert(0, str(root)) + tests = importlib.import_module('test_overlap') + result = unittest.TextTestRunner(stream=io.StringIO(), verbosity=0).run( + unittest.defaultTestLoader.loadTestsFromModule(tests)) + output = { + 'tests': result.testsRun, + 'failures': sorted(t.id().rsplit('.', 1)[-1] for t, _ in result.failures), + 'errors': sorted(t.id().rsplit('.', 1)[-1] for t, _ in result.errors), + 'passed': result.wasSuccessful(), + } + print(json.dumps(output, sort_keys=True)) + return 0 if result.wasSuccessful() else 1 + + +def source_check(root): + manifest = decode_unique((root/'SOURCE_FILES.json').read_text()) + entries = manifest['files'] + names = [entry['path'] for entry in entries] + if len(names) != len(set(names)) or any(Path(p).name != p for p in names): + raise ValueError('unique flat manifest paths required') + present = sorted(p.name for p in root.iterdir()) + if present != sorted(names+['SOURCE_FILES.json']): + raise ValueError('source membership mismatch') + for entry in entries: + p = root/entry['path'] + if p.is_symlink() or not p.is_file(): + raise ValueError('regular source required') + data = p.read_bytes() + if len(data) != entry['bytes'] or hashlib.sha256(data).hexdigest() != entry['sha256']: + raise ValueError('source identity mismatch: '+p.name) + + +def replay(root): + source_check(root) + original = (root/'overlap.py').read_text() + expected = decode_unique((root/'RESULTS.json').read_text()) + records = [] + for name in ['baseline', *MUTANTS]: + with tempfile.TemporaryDirectory(prefix='p15-overlap-replay-') as tmp: + copy = Path(tmp) + shutil.copyfile(root/'overlap.py', copy/'overlap.py') + shutil.copyfile(root/'test_overlap.py', copy/'test_overlap.py') + if name != 'baseline': + old, new, _ = MUTANTS[name] + if original.count(old) != 1: + raise ValueError('mutation anchor is not unique: '+name) + (copy/'overlap.py').write_text(original.replace(old, new)) + outputs = [] + for flags in (['-B', '-S'], ['-B', '-O', '-S']): + process = subprocess.run([sys.executable, *flags, str(root/'run_validation.py'), + '--child', str(copy)], capture_output=True, timeout=45) + result = decode_unique(process.stdout.decode()) + if process.stderr or result['errors']: + raise ValueError('execution error, not a valid predicate test: '+name) + if name == 'baseline': + if process.returncode != 0 or result != expected['baseline']: + raise ValueError('baseline differs from frozen summary') + else: + if process.returncode != 1 or result['passed'] or MUTANTS[name][2] not in result['failures']: + raise ValueError('expected semantic assertion did not reject: '+name) + outputs.append(process.stdout) + if outputs[0] != outputs[1]: + raise ValueError('normal and optimized outputs differ: '+name) + records.append({'case': name, **decode_unique(outputs[0].decode())}) + source_check(root) + summary = {'scientific_effect':'NONE', 'nonauthor_acceptance':False, + 'tests_per_mode': expected['baseline']['tests'], + 'mutants_per_mode': len(MUTANTS), 'all_output_pairs_identical':True, + 'source_membership_and_hashes':'PASS', 'cases':records} + print(json.dumps(summary, indent=2, sort_keys=True)) + return 0 + + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument('--child', type=Path) + options = parser.parse_args() + if options.child is not None: + sys.exit(child(options.child.resolve())) + sys.exit(replay(Path(__file__).resolve().parent)) diff --git a/frontiers/p15_bipartite_overlap_20260928/test_overlap.py b/frontiers/p15_bipartite_overlap_20260928/test_overlap.py new file mode 100644 index 000000000..5db599b42 --- /dev/null +++ b/frontiers/p15_bipartite_overlap_20260928/test_overlap.py @@ -0,0 +1,227 @@ +"""Independent finite controls. These do not certify the continuum hazard proof.""" +import itertools +import unittest +from fractions import Fraction as F +from math import factorial +import overlap as m + + +def exact_chromatic_table(blocks, capacities): + vertices = sorted(set().union(*blocks)) + n = len(vertices) + sets = [{vertices[j] for j in range(n) if mask >> j & 1} for mask in range(1 << n)] + good = [all(len(s & b) <= a for b, a in zip(blocks, capacities)) for s in sets] + dp = [0] + [n + 1] * ((1 << n) - 1) + for mask in range(1, 1 << n): + first = mask & -mask + sub = mask + while sub: + if sub & first and good[sub]: + dp[mask] = min(dp[mask], 1 + dp[mask ^ sub]) + sub = (sub - 1) & mask + return sets, dp + + +def check_coloring(test, vertices, blocks, capacities, colors): + test.assertEqual(set(colors), set(vertices)) + for color in set(colors.values()): + test.assertTrue(all(sum(colors.get(v, -1) == color for v in block & set(vertices)) <= a + for block, a in zip(blocks, capacities))) + + +class OverlapTests(unittest.TestCase): + def test_minimum_palette(self): + self.assertEqual(m.capacity_bound(set(range(4)), [{0, 1, 2, 3, 4}], [1]), 4) + + def test_empty_configuration(self): + self.assertEqual(m.capacity_bound(set(), [{0, 1}], [1]), 0) + self.assertEqual(m.color_capacity(set(), [{0, 1}], [1], [0]), {}) + + def test_exact_coloring_against_partition_oracle(self): + instances = [([{0, 1, 2}, {2, 3, 4}], [1, 1], [0, 1]), + ([{0, 1, 2, 3}, {2, 3, 4}], [2, 1], [0, 1]), + ([{0, 1}, {2, 3}, {0, 2}, {1, 3}], [1]*4, [0, 0, 1, 1])] + for blocks, capacities, sides in instances: + sets, oracle = exact_chromatic_table(blocks, capacities) + for vertices, expected in zip(sets, oracle): + self.assertEqual(m.capacity_bound(vertices, blocks, capacities), expected) + colors = m.color_capacity(vertices, blocks, capacities, sides) + check_coloring(self, vertices, blocks, capacities, colors) + self.assertEqual(len(set(colors.values())), expected) + + def test_parallel_edges(self): + vertices = set(range(5)); blocks = [vertices, vertices] + colors = m.color_capacity(vertices, blocks, [1, 1], [0, 1]) + self.assertEqual(len(set(colors.values())), 5) + check_coloring(self, vertices, blocks, [1, 1], colors) + + def test_nonunit_capacities(self): + vertices = set(range(8)); blocks = [set(range(6)), set(range(3, 8))] + colors = m.color_capacity(vertices, blocks, [2, 3], [0, 1]) + check_coloring(self, vertices, blocks, [2, 3], colors) + self.assertEqual(len(set(colors.values())), 3) + + def test_one_original_coordinate_one_color(self): + blocks = [{0, 1, 2, 3}, {2, 3, 4, 5}] + colors = m.color_capacity(set(range(6)), blocks, [2, 2], [0, 1]) + self.assertEqual(len(colors), 6) + check_coloring(self, set(range(6)), blocks, [2, 2], colors) + + def test_bipartition_validation(self): + with self.assertRaises(ValueError): + m.color_capacity({0, 1, 2}, [{0, 1}, {1, 2}], [1, 1], [0, 0]) + + def test_read_two_is_not_enough(self): + # Triangle with two parallel edges per side; one private coordinate per block. + blocks = [{0, 1, 4, 5, 6}, {0, 1, 2, 3, 7}, {2, 3, 4, 5, 8}] + vertices = set(range(6)) + _, oracle = exact_chromatic_table([b & vertices for b in blocks], [1]*3) + self.assertEqual(oracle[-1], 6) + self.assertEqual(m.capacity_bound(vertices, blocks, [1]*3), 4) + self.assertTrue(all(not b <= vertices for b in blocks)) + with self.assertRaises(ValueError): + m.color_capacity(vertices, blocks, [1]*3, [0, 1, 0]) + + def test_complete_active_block_needs_extra_color(self): + blocks = [set(range(5)), set(range(4, 9))] + self.assertEqual(m.capacity_bound(blocks[0], blocks, [1, 1]), 5) + self.assertEqual(m.active_generators(blocks, [1, 1], [4, 4]), blocks) + + def test_inactive_demand_one_is_not_a_generator(self): + blocks = [set(range(5)), {4, 5}] + self.assertEqual(m.active_generators(blocks, [1, 1], [4, 1]), [blocks[0]]) + self.assertEqual(m.capacity_bound({4, 5}, blocks, [1, 1]), 2) + + def test_exact_obstruction_all_subsets(self): + blocks = [set(range(5)), set(range(4, 9))] + generators = m.active_generators(blocks, [1, 1], [4, 4]) + for bits in itertools.product((False, True), repeat=9): + vertices = {i for i, bit in enumerate(bits) if bit} + self.assertEqual(m.capacity_bound(vertices, blocks, [1, 1]) > 4, + any(g <= vertices for g in generators)) + + def test_shape_validation(self): + with self.assertRaises(ValueError): + m.active_generators([{0, 1, 2}], [1], [4]) + with self.assertRaises(ValueError): + m.color_capacity({9}, [{0, 1}], [1], [0]) + with self.assertRaises(ValueError): + m.color_capacity({0}, [{0}], [0], [0]) + + def test_overlap_destroys_local_independence(self): + blocks = [{0, 1}, {1, 2}]; p = {i: F(1, 2) for i in range(3)} + joint = m.good_probability(blocks, [1, 1], p) + marg = [m.good_probability([b], [1], p) for b in blocks] + self.assertEqual(joint, F(5, 8)) + self.assertGreater(joint, marg[0]*marg[1]) + self.assertTrue(m.cs_probability_bound(joint, marg[0], marg[1])) + + def test_cauchy_schwarz_on_heterogeneous_grid(self): + blocks = [{0, 1}, {1, 2}] + for values in itertools.product((F(0), F(1, 4), F(1, 2), F(3, 4), F(1)), repeat=3): + p = dict(enumerate(values)) + q = m.good_probability(blocks, [1, 1], p) + q0 = m.good_probability([blocks[0]], [1], p) + q1 = m.good_probability([blocks[1]], [1], p) + self.assertTrue(m.cs_probability_bound(q, q0, q1)) + + def test_probability_boundaries(self): + blocks = [{0, 1}, {1, 2}] + self.assertEqual(m.good_probability(blocks, [1, 1], {i: F(0) for i in range(3)}), 1) + self.assertEqual(m.good_probability(blocks, [1, 1], {i: F(1) for i in range(3)}), 0) + + def test_same_side_independence_exact(self): + p = {i: F(i+1, 7) for i in range(5)} + self.assertEqual(m.good_probability([{0, 1}, {2, 3, 4}], [1, 2], p), + m.good_probability([{0, 1}], [1], p)*m.good_probability([{2, 3, 4}], [2], p)) + + def test_binomial_five_tail_identity(self): + for q in (F(1, 4), F(1, 3), F(1, 2), F(3, 4)): + p = {i: 1-q for i in range(5)} + self.assertEqual(m.good_probability([set(range(5))], [1], p), 5*q**4-4*q**5) + + def test_exp_rational_enclosure(self): + lo, hi = m.exp_one_interval(6) + self.assertEqual(lo, F(1957, 720)) + self.assertEqual(hi, F(31967, 11760)) + self.assertGreater(lo, F(8, 3)) + self.assertLess(hi, F(87, 32)) + + def test_tail_and_constant_certificates(self): + cert = m.small_certificates() + self.assertTrue(all(v > 0 for v in cert.values())) + self.assertEqual(cert['exp_seven_thirds_margin'], F(129055, 209952)) + self.assertEqual(cert['a_ge_two_tail_margin'], F(2601239, 247374336)) + + def test_overlap_constant(self): + lo, hi = m.overlap_constant_interval() + self.assertGreater(lo, F(73015826409534942932, 10**20)) + self.assertLess(hi, F(73015826409534942934, 10**20)) + self.assertLess(hi, F(3, 4)) + + def test_demand_one_obstruction_preserved(self): + # At reference p*=1-1/e the two-point capacity-one good probability exceeds e^-1. + lo, hi = m.exp_one_interval(6) + # e>2 implies 2/e-1/e^2>1/e, i.e. e-1>0. + self.assertGreater(lo-1, 0) + self.assertEqual(m.capacity_bound({0, 1}, [{0, 1}], [1]), 2) + + def test_log_interval_contains_known_identity(self): + lo, hi = m.log_interval(F(1)) + self.assertEqual((lo, hi), (0, 0)) + l2, u2 = m.log_interval(F(2)) + l4, u4 = m.log_interval(F(4)) + self.assertEqual((l4, u4), (2*l2, 2*u2)) + + def test_even_triangle_same_palette(self): + blocks = [set(range(4)) | set(range(8, 12)) | {12}, + set(range(8)) | {13}, + set(range(4, 12)) | {14}] + vertices = set(range(12)) + colors = m.color_even_capacity(vertices, blocks, [2, 2, 2]) + check_coloring(self, vertices, blocks, [2, 2, 2], colors) + self.assertEqual(len(set(colors.values())), 4) + whole = set(range(15)) + colors = m.color_even_capacity(whole, blocks, [2, 2, 2]) + check_coloring(self, whole, blocks, [2, 2, 2], colors) + self.assertEqual(len(set(colors.values())), 5) + + def test_even_capacity_partition_oracle(self): + blocks = [{0, 1, 4, 5}, {0, 1, 2, 3}, {2, 3, 4, 5}] + for caps in ([2, 2, 2], [2, 4, 2]): + sets, oracle = exact_chromatic_table(blocks, caps) + for vertices, expected in zip(sets, oracle): + colors = m.color_even_capacity(vertices, blocks, caps) + check_coloring(self, vertices, blocks, caps, colors) + self.assertEqual(len(set(colors.values())), expected) + + def test_even_capacity_requires_even(self): + with self.assertRaises(ValueError): + m.color_even_capacity(set(range(4)), [set(range(4))], [3]) + + def test_even_capacity_rejects_read_three(self): + with self.assertRaises(ValueError): + m.color_even_capacity({0, 1, 2}, [{0, 1}, {0, 2}, {0}], [2, 2, 2]) + + def test_even_empty(self): + self.assertEqual(m.color_even_capacity(set(), [{0, 1}], [2]), {}) + + def test_nonbipartite_read_two_probability(self): + blocks = [{0, 1}, {1, 2}, {2, 0}] + for values in itertools.product((F(1, 4), F(1, 2), F(3, 4)), repeat=3): + p = dict(enumerate(values)) + q = m.good_probability(blocks, [1, 1, 1], p) + product_marginals = F(1) + for block in blocks: + product_marginals *= m.good_probability([block], [1], p) + self.assertLessEqual(q*q, product_marginals) + + def test_even_hazard_rational_certificate(self): + self.assertEqual(F(512, 25)-F(87, 32)**3, F(314641, 819200)) + self.assertGreater(F(512, 25)-F(87, 32)**3, 0) + lo, hi = m.log_interval(F(512, 25)) + self.assertGreater(lo, 3) + self.assertLess(2/lo, F(2, 3)) + +if __name__ == '__main__': + unittest.main()