diff --git a/research/helper-split-endpoint-rank-bill/PROOF.md b/research/helper-split-endpoint-rank-bill/PROOF.md new file mode 100644 index 0000000000..0cefff16b9 --- /dev/null +++ b/research/helper-split-endpoint-rank-bill/PROOF.md @@ -0,0 +1,186 @@ +# Endpoint maximum of one contact-free helper split + +**Proof. No new κ.** The selected conditional exponent stays +`363005817/100000000000`. No word is emitted and no cut is declared legal. + +## Hypotheses + +Fix an integer `D ≥ 1` and a real exponent `0 < t < 1`. A helper whose boundary +runs from the zero subspace to a `D`-dimensional space is cut at an intermediate +dimension `x`, using `m ≥ 1` contact-free transport paths. Path `i` has integer +endpoints `0 ≤ a_i ≤ b_i ≤ D` and a constant old paid-rank charge `c_i`. On the +open interval where every leg length is positive, + +```text +G(x) = x^t + (D-x)^t - D^t + - Σ_i ( (x-a_i)^t + (b_i-x)^t - c_i ). +``` + +Set `0^t = 0`, so `G` extends continuously to a closed interval on which every +leg length is nonnegative. A zero leg is omitted from a physical word; the +formula still uses `0^t = 0`. The feasible dimensions coming from the paths +alone lie in `[A0, B0]` with `A0 = max a_i` and `B0 = min b_i`, when `A0 ≤ B0`. +A geometric join or meet may shrink that interval to a closed subinterval +`[A, B]`. + +This is the rank bill in +`research/p104-shared-native-helper-splits/EXPLORATION.md`. It is not an +ordinary-cost bill, a native legality test, or a supplier invoice. + +## Lemma 1 + +Let `h(u) = u^t` for `u > 0`. Then `h''(u) = t(t-1) u^{t-2} < 0`. For +`0 < u ≤ v`, + +```text +h''(u) ≤ h''(v). +``` + +Write `t = p/q` in lowest terms, `1 ≤ p < q`. Then `t-2 = (p-2q)/q` and +`s = 2q-p > q ≥ 1`. For positive `u, v`, + +```text +u^{t-2} ≥ v^{t-2} ⟺ u^s ≤ v^s, +``` + +because `x ↦ x^{s/q}` is increasing on the positive reals and taking +reciprocals reverses the inequality. The integer form `u ≤ v ⟹ u^s ≤ v^s` +is the comparison the verifier exhausts. Since `t(t-1) < 0`, the inequality +on `u^{t-2}` reverses when it is multiplied into `h''`. + +## Lemma 2 + +On every open interval where `0 < x < D` and `a_i < x < b_i` for every path, + +```text +G''(x) ≥ 0. +``` + +If `m ≥ 2`, or if `m = 1` and that unique path is not `(a, b) = (0, D)`, the +inequality is strict. + +Proof. Differentiate termwise: + +```text +G''(x) = h''(x) + h''(D-x) + - Σ_i ( h''(x-a_i) + h''(b_i-x) ). +``` + +For each `i`, `x-a_i ≤ x` and `b_i-x ≤ D-x`. Lemma 1 gives + +```text +h''(x-a_i) ≤ h''(x), h''(b_i-x) ≤ h''(D-x), +``` + +so each path contributes at most `h''(x)+h''(D-x)`. Therefore + +```text +G''(x) ≥ (1-m) ( h''(x) + h''(D-x) ). +``` + +The sum of second derivatives is negative, and `1-m ≤ 0`, so the product is +nonnegative. Equality in a path bound holds if and only if `a_i = 0` and +`b_i = D`. For `m = 1` that is the full-span path. For `m ≥ 2` the factor +`1-m` is at most `-1` and the second-derivative sum is strictly negative, so +`G''` is strictly positive. + +## Theorem + +Let `[A, B] ⊆ [0, D]` be a closed interval on which every leg length is +nonnegative, with `A ≤ B`. Then + +```text +max_{x ∈ [A, B]} G(x) = max( G(A), G(B) ). +``` + +The identity includes the cases `A = 0` and `B = D`. An interior point of +`[A, B]` is never a separate rank-bill case. + +Proof. If `A = B` there is nothing to prove. Assume `A < B`. Every path +satisfying `a_i ≤ A` and `b_i ≥ B` has positive leg lengths on `(A, B)`. +Lemma 2 therefore gives `G'' ≥ 0` on `(A, B)`, so `G` is convex there. +A convex function on an open interval that extends continuously to the +closure remains convex: for endpoints `x, y` and a weight `λ`, approach +`x` and `y` by interior points and pass to the limit. A continuous convex +function on a compact interval attains its maximum at an endpoint. + +When `m ≥ 2`, or when `m = 1` and the unique path is not `(0, D)`, Lemma 2 +gives `G'' > 0` on `(A, B)`. Then `G` is strictly convex on the open +interval. An interior point cannot attain the maximum of the continuous +extension: if `G(x0)` equalled that maximum for `x0 ∈ (A, B)`, writing +`x0` as a convex combination of two other interior points would put +`G(x0)` strictly below the maximum. Thus every interior dimension is +strictly below `max(G(A), G(B))`. In particular, two or more full-span +paths are strictly convex, not constant. Only the one-path full span is +the constant function in the next section, and only there does every +dimension tie the endpoints. + +Thus every interior dimension, including the dimension of a join or meet of +three or four paths, satisfies `G(x) ≤ max(G(A), G(B))` for the interval of +that same path subset. Evaluating the two endpoint dimensions decides the +rank bill. No intermediate subspace can raise it. + +## What 0 and D are + +A dimension `0` or `D` is an existing boundary chart, not a new intermediate +chart. The theorem still prices it. + +- If `A = 0`, every proper dimension `x ∈ (0, B]` satisfies + `G(x) ≤ max(G(0), G(B))`. When `G(B) ≥ G(0)`, the maximum on the proper + dimensions is `G(B)`, attained at `B`. When `G(B) ≤ G(0)`, no proper + dimension beats the existing boundary value `G(0)`. +- If `B = D`, the symmetric statement holds with the candidate `A`. + +This is the separate treatment named in `EXPLORATION.md` for an extremum at +`0` or `D`. It collapses to the same endpoint comparison. It does not require +a search over the integers strictly between the endpoints. + +## One-path normalization + +Specialize to `m = 1`, endpoints `0 ≤ a ≤ b ≤ D`, and the single old charge +`c = (b-a)^t`. Then, for `x ∈ [a, b]`, + +```text +G(x) = x^t + (D-x)^t - D^t - (x-a)^t - (b-x)^t + (b-a)^t. +``` + +At the endpoints the new legs reproduce the old charge: + +```text +G(a) = a^t + (D-a)^t - D^t, +G(b) = b^t + (D-b)^t - D^t. +``` + +Let `k(u) = u^t + (D-u)^t - D^t` for `u ∈ [0, D]`. Then `k(0) = k(D) = 0` and +`k(u) = k(D-u)`. The derivative `k'(u) = t u^{t-1} - t (D-u)^{t-1}` is +positive on `(0, D/2)` and negative on `(D/2, D)`, because `u ↦ u^{t-1}` is +strictly decreasing. Therefore `k(u) > 0` for every `u ∈ (0, D)`. + +Consequences, still only for this charge: + +- If `0 < a < b < D`, then `G(a) > 0` and `G(b) > 0`. The better rank-bill + dimension on `[a, b]` is whichever endpoint has the larger `k` value. +- If `a = 0` and `b < D`, then `G(0) = 0 < G(b)`. The unique maximizing + dimension is the proper endpoint `b`. Every `x ∈ (0, b)` is strictly + smaller, by the strict-convexity paragraph in the theorem. +- At `t = 1/2` the same sign has an algebraic form. For `u ∈ [0, D]`, + `(sqrt(u) + sqrt(D-u))^2 = D + 2 sqrt(u(D-u))`, so + `sqrt(u) + sqrt(D-u) > sqrt(D)` if and only if `u(D-u) > 0`. +- If `b = D` and `a > 0`, the unique maximizing dimension is `a`, and + `G(D) = 0`. +- If `a = 0` and `b = D`, then `G(x) = 0` for every `x`. The full-span path + cancels the helper split exactly. + +A positive value of `G` is a rank-bill signal under these hypotheses. It is +not a legal kernel cut, not a paid-profile improvement, and not a change in +the selected exponent. + +## What this does not prove + +The curvature comparison uses a boundary that runs from dimension `0` to +dimension `D`. A proper helper boundary, a path that leaves that boundary, a +paid ordinary bill, ownership, and native legality are outside the argument. +`EXPLORATION.md` already records that limitation. Constants `c_i` other than +`(b_i-a_i)^t` stay inside the theorem and outside the one-path sign +corollary. No finite grid in the verifier is the proof; the proof is the +differentiation above. diff --git a/research/helper-split-endpoint-rank-bill/README.md b/research/helper-split-endpoint-rank-bill/README.md new file mode 100644 index 0000000000..69d9da983d --- /dev/null +++ b/research/helper-split-endpoint-rank-bill/README.md @@ -0,0 +1,61 @@ +# Endpoint maximum for one zero-to-D helper split + +**Proof, with a finite exact corroboration. Selected κ stays `363005817/100000000000`.** + +On a helper boundary from the zero subspace to a `D`-dimensional space, the contact-free rank bill `G` of `m ≥ 1` paths is convex in the intermediate dimension. Its maximum on every closed feasible interval `[A, B]` is `max(G(A), G(B))`, including when `A = 0` or `B = D`. An interior dimension, including a join or meet of three or four paths, cannot raise that bill. The argument is [PROOF.md](PROOF.md). + +## Scope and evidence + +Original card: `p104-side-correction`. Scope status: **changed**. The card asks whether a legal causal split improves the complete productive/paid invoice. This package prices only the rank-bill factor in `research/p104-shared-native-helper-splits/EXPLORATION.md` and closes the sentence that an extremum at `0` or `D` still needs a separate integer search. A positive value of `G` is a rank-bill signal under the stated charge. Legality, ownership, ordinary cost and the selected exponent stay where the selected record left them. The actual question, the reason for the scope change and the stop rule are in [TASK.json](TASK.json). Pins are in [SOURCES.json](SOURCES.json). Base commit `e54523517d0f03e58352e647c403a5af3e525a57`, priority revision 8. + +Evidence classes: + +1. **Proof.** Lemmas 1 and 2 and the theorem in [PROOF.md](PROOF.md), for every real exponent `0 < t < 1`, every `D ≥ 1` and every constant old charges `c_i`. The one-path sign corollary uses the charge `c = (b - a)^t`. +2. **Exhaustive finite census**, only on the domains named here. At `t = 1/2`, integer square roots are compared with a certified `isqrt` truncation whose error is strictly less than one unit per combined term. The domains are every `1 ≤ D ≤ 12` and every one-path window `0 ≤ a ≤ b ≤ D`; every ordered pair of windows for `1 ≤ D ≤ 6`; and every integer power `u^s` with `s = 2q - p`, `2 ≤ q ≤ 5`, `1 ≤ p < q` and `1 ≤ u ≤ v ≤ 40`. +3. The predecessor new-frame screens in `EXPLORATION.md` are a different, incomplete search. This package does not rerun them and does not use them as evidence. + +`EXPLORATION.md` is cited, not vendored. Its bytes are outside [VERIFY.json](VERIFY.json) inputs. + +This is session r271, item 4 of the ordered eligible list read on 2026-11-11. Open handoffs whose later post completes them, whose canonical artifact is an open pull request, or which say that no target was taken, are dropped, as are the delivered 19 October index, the H25 chain, and the 2 November review artifacts. Updated notes are one request. Three open handoffs remain, then the revision-8 next-decision rows, then unnamed catalogue cards: + +1. Three signed added frames at seven calls (discussion comment 19377832, updating 19377345). The 11 November record still leaves the other profiles open. #6942 character-excludes only the all-old-once profile. +2. Eight-source singleton existence (comment 19537798, updating 19377982). The 11 November search is still inconclusive, and `28 ≤ f(8) ≤ 32` is unchanged. +3. Six-source depth-two block at `c = 7` (comment 19537594, updating 19384981). The 11 November search still leaves `c = 7` open. +4. **This package.** Complex helpers (`p104-side-correction`, `coverage-law-change`): the endpoint rank bill. +5. BIT (`bit-helper-contract`). +6. New decoders and interfaces. +7. Supplier audit (`supplier-boundary-audit`). +8. All-size audit (`uniform-transfer-audit`). +9. Verification tooling (`replay-runtime`). +10. `bit-new-register-model`. + +Later conditional-κ review requests on #1166, including #7148, #7158, #7161 and #7244, ask maintainers to select a new exponent. Their canonical artifacts are open pull requests, so they are outside this list. Overlap search on 2026-11-11, with complete pagination of 566 open upstream PR records and 7234 discussion records, found no match for `contact-free transport` or `endpoint rank bill`. Closed work was searched through local notes and ledgers only. That report is a lead, not a novelty certificate. + +## Reproduce + +Python 3.12 and the standard library, from the repository root: + +```sh +python3 -B research/helper-split-endpoint-rank-bill/verify.py +python3 -O -B research/helper-split-endpoint-rank-bill/verify.py +python3 -I -B research/helper-split-endpoint-rank-bill/verify.py +python3 -B scripts/research_package.py --package research/helper-split-endpoint-rank-bill --check-only +python3 -B scripts/research_package.py --package research/helper-split-endpoint-rank-bill +``` + +Expected direct marker: + +```text +PASS_HELPER_SPLIT_ENDPOINT_RANK_BILL powers=8200 half_rows=1729 positive_boundary_paths=132 full_span_zeros=90 two_path_rows=2057 two_path_strict_interior=406 kappa=363005817/100000000000 no_new_kappa=true +``` + +The registered replay is the first command. `make frontier7000-verify`, Lean, Docker and the 68-split discovery screens were not run. + +## Open next questions + +1. **Proper boundaries.** Does the same endpoint maximum survive when a paid path extends outside a helper boundary whose terminal dimension lies strictly between `0` and `D`? The curvature comparison in the proof uses both helper legs against the full dimension `D`. The smallest next step is one proper terminal together with one path whose upper end passes that terminal, then a direct comparison of `G` at the allowed endpoints and at one interior dimension. The zero-to-`D` formula does not apply. +2. **Published charges.** For the published 68-split word, is every remaining unsplit helper's feasible interval already nonpositive at both endpoints under its actual old charges `c_i`? The smallest next step is to evaluate `G(A)` and `G(B)` from the pinned witnesses, without a new geometry search. That payload is outside this package. A positive rank bill would still leave legality and the paid profile open. + +## Credit + +The rank-bill formula and the open endpoint sentence are from @CubeJerry's shared-native helper-split exploration, on the shared two-chain word from DreamingOfClouds in #6902. The basis-splitting lineage is Ali Romman's #5599. Retained native and compiler authors of that construction stay credited there. Prepared by unpaidmoon with substantial Cursor Grok assistance. No formal-kernel review and no independent human review are claimed. New work is Apache-2.0. diff --git a/research/helper-split-endpoint-rank-bill/SOURCES.json b/research/helper-split-endpoint-rank-bill/SOURCES.json new file mode 100644 index 0000000000..5335fa97d9 --- /dev/null +++ b/research/helper-split-endpoint-rank-bill/SOURCES.json @@ -0,0 +1,18 @@ +{ + "schema_version": 1, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "75d77b328ea02ded535e7f23aee5b1e55d0bb1a8", + "sha256": "154c3d30455d778fd3343b6b4851f0fa4665f0f7625b0adb3675e2bafbbf6bf1" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81" + } + ] +} diff --git a/research/helper-split-endpoint-rank-bill/TASK.json b/research/helper-split-endpoint-rank-bill/TASK.json new file mode 100644 index 0000000000..e9c4d5406b --- /dev/null +++ b/research/helper-split-endpoint-rank-bill/TASK.json @@ -0,0 +1,123 @@ +{ + "schema_version": 1, + "task_id": "p104-side-correction", + "priority_revision": 8, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "original_card": { + "id": "p104-side-correction", + "question": "Can joint helper bases and a legal causal split improve the complete P104 productive/paid invoice?", + "starting_points": [ + "docs/research/current-priorities.md", + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "research/p104-helper-subspace-splits/README.md", + "research/dyadic-helper-channel-capacity/README.md" + ], + "methods": [ + "Construct and independently check one source-bound instance of the stated first experiment.", + "Seek an exact counterexample or target-specific complete-budget obstruction to that same proposed change." + ], + "acceptance_gate": "An exact arbitrary-input identity, source/target frame availability and restoration at the chosen cut, plus the complete channel+correction+idle/hosting bill or an explicit favorable bound. The native channel alone is not a supplier. A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_selected_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read revision 8, the selected review and live exact-source handoffs. Then follow this card's bounded first_experiment.", + "scope": "Source-bound orientation only, not a supplier replay or theorem proof." + }, + "first_experiment": "Start with the selected #5599 emitted word and review pending #5718 distinct input/output bases plus #5717/#5719 coverage before claiming work. Pick one uncovered source word, helper group and cut region. Prove the arbitrary-input relation and legal entry/exit corrections, then compare full target and paid profiles. Reject if completion, owned lifetimes or consumer costs repay the gain. A static pairing rank alone is not a physical split.", + "bottleneck_link": "Judge the actual current supplier contract and complete signed target/paid bill; frozen-profile ceilings require an applicability proof.", + "allowed_variations": [ + "One exact source head, helper/cut region or quantified proposition and changed hypothesis; check live handoffs first. Different seeds are not different scopes." + ], + "scope_change_triggers": [ + "Changing source head, helper/cut domain, operation alphabet or caller boundary without recording the new scope.", + "Treating an archived proposal or local numerical pass as complete supplier admission." + ], + "overlap_terms": [ + "P104", + "helper basis", + "helper split", + "5718", + "dyadic capacity" + ], + "existing_checks": [ + { + "scope": "PR #4133: literal-slot defect", + "evidence": "research/p104-literal-slot-defect/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "88666f1dee93fbd85b31fd5d6f91a219e111b5f4", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4136: uniform commutation gap", + "evidence": "research/p104-uniform-commutation-gap/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "281ce601a8be9db470de630759179c23e1dfaa88", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4140: uniform encoding gap", + "evidence": "research/p104-uniform-encoding-gap/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "de25c6525aa866962309df5d107b32d55e6e5628", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4153: source-chart shortcut exhausts its optimistic allowance", + "evidence": "research/p104-source-chart-shortcut/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "9123241fea53df77e51ffe30d9aca1625d4bf3a8", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4154: fiber-tag seam mismatch", + "evidence": "research/p104-fiber-tag-seam/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "4ffcdaee5d6255a9cea1fe53a5424435068089d0", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "Selected PR5599: complete helper-subspace construction and independent caller replay; five framework assumptions remain.", + "evidence": "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "remaining": "The next experiment must identify uncovered source-specific work. Successor archive intake does not transfer this admission.", + "status": "reviewed", + "source_commit": "09dd0965711ca7eeb169057a420abab1c9052137", + "selected_record_sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5" + } + ] + }, + "scope_status": "changed", + "actual_scope": "For a zero-to-D helper boundary and m>=1 contact-free paths, prove that the rank bill G on every closed feasible dimension interval is maximized at an endpoint, including when that endpoint is 0 or D.", + "scope_change_reason": "The card asks whether a legal causal split improves the complete P104 productive/paid invoice. The predecessor exploration already shows convexity of G on a zero-to-D boundary and leaves the 0 and D endpoints as a separate integer case. This package closes that case. It does not emit a cut, price an ordinary bill, or change the selected exponent, so the invoice question stays open.", + "bottleneck_link": "Side result on the rank-bill factor of a helper split. The complete signed target/paid bill remains the card bottleneck. Endpoint evaluation removes an intermediate-dimension search from that factor only; a positive G is still short of a legal paid-profile improvement.", + "budget_minutes": 60, + "stop_rule": "Stop after the endpoint theorem and the exact t=1/2 census on the stated finite domains. Do not search the 68-split word, emit a chart, or rerun frontier7000.", + "outcome": "partial", + "evidence": "PROOF.md is the general argument for 0 current: + fail(f"power increase failed at u={u} v={v} s={s}") + previous = current + checked += 1 + # The opposite direction is false for a strict increase. + if not (2 ** s > 1 ** s): + fail("unit power was not strict") + return checked + + +def certified_sign(terms, bits=64): + """Sign of sum coef*sqrt(radicand). Error < 1 per term in units of 2^bits.""" + combined = {} + for coef, rad in terms: + if coef == 0 or rad == 0: + continue + if rad < 0: + fail("negative radicand") + combined[rad] = combined.get(rad, 0) + coef + scale = 1 << bits + acc = 0 + err = 0 + for rad, coef in combined.items(): + if coef == 0: + continue + approx = math.isqrt(rad * scale * scale) + acc += coef * approx + err += abs(coef) + if acc > err: + return 1 + if -acc > err: + return -1 + if err == 0: + return 0 + if bits >= 4096: + fail("sign unresolved: " + repr(terms)) + return certified_sign(terms, bits * 2) + + +def g_terms(d, a, b, x): + """One path, t = 1/2, c = sqrt(b-a).""" + return [ + (1, x), + (1, d - x), + (-1, d), + (-1, x - a), + (-1, b - x), + (1, b - a), + ] + + +def g_sign_against(d, a, b, x, endpoint): + """Sign of G(endpoint) - G(x) at t = 1/2.""" + left = g_terms(d, a, b, endpoint) + right = [(-coef, rad) for coef, rad in g_terms(d, a, b, x)] + return certified_sign(left + right) + + +def half_endpoint_census(max_d): + """Interior dimensions lose to an endpoint. Boundary endpoints match k.""" + rows = 0 + positive_proper = 0 + cancelled = 0 + for d in range(1, max_d + 1): + for a in range(0, d + 1): + for b in range(a, d + 1): + # Endpoint formulas: G(a) = k(a), G(b) = k(b), k(0) = k(D) = 0. + if a == 0: + if certified_sign(g_terms(d, a, b, 0)) != 0: + fail(f"G(0) identity failed at D={d} b={b}") + elif a == d: + if certified_sign([(1, a), (1, 0), (-1, d)]) != 0: + fail(f"k(D) from a failed at D={d}") + elif certified_sign([(1, a), (1, d - a), (-1, d)]) <= 0: + fail(f"k(a) was not positive at D={d} a={a}") + if b == 0 or b == d: + if certified_sign([(1, b), (1, d - b), (-1, d)]) != 0: + fail(f"k boundary was not zero at D={d} b={b}") + elif certified_sign([(1, b), (1, d - b), (-1, d)]) <= 0: + fail(f"k(b) was not positive at D={d} b={b}") + if a == 0 and b == d: + for x in range(0, d + 1): + if certified_sign(g_terms(d, a, b, x)) != 0: + fail(f"full-span path was not identically zero at x={x}") + cancelled += 1 + continue + for x in range(a, b + 1): + left = g_sign_against(d, a, b, x, a) + right = g_sign_against(d, a, b, x, b) + if x not in (a, b) and left <= 0 and right <= 0: + fail( + f"interior was not strictly below an endpoint" + f" D={d} a={a} b={b} x={x}" + ) + rows += 1 + if a == 0 and 0 < b < d: + if g_sign_against(d, a, b, 0, b) <= 0: + fail(f"upper endpoint did not beat 0 at D={d} b={b}") + positive_proper += 1 + if b == d and 0 < a < d: + if g_sign_against(d, a, b, d, a) <= 0: + fail(f"lower endpoint did not beat D at D={d} a={a}") + positive_proper += 1 + return rows, positive_proper, cancelled + + +def multi_terms(d, paths, x): + terms = [(1, x), (1, d - x), (-1, d)] + for a, b in paths: + terms.extend(((-1, x - a), (-1, b - x), (1, b - a))) + return terms + + +def difference_sign(d, paths, x, endpoint): + left = multi_terms(d, paths, endpoint) + right = [(-coef, rad) for coef, rad in multi_terms(d, paths, x)] + return certified_sign(left + right) + + +def path_pairs(max_d): + """Every ordered pair of integer windows on 1 <= D <= max_d.""" + rows = 0 + strict_interior = 0 + for d in range(1, max_d + 1): + windows = [(a, b) for a in range(d + 1) for b in range(a, d + 1)] + for first in windows: + for second in windows: + lower = max(first[0], second[0]) + upper = min(first[1], second[1]) + if lower > upper: + continue + for x in range(lower, upper + 1): + left = difference_sign(d, (first, second), x, lower) + right = difference_sign(d, (first, second), x, upper) + if x not in (lower, upper) and left <= 0 and right <= 0: + fail( + "two-path interior was not strictly below an endpoint" + f" D={d} paths={first},{second} x={x}" + ) + if x not in (lower, upper): + strict_interior += 1 + rows += 1 + return rows, strict_interior + + +def reject_forged_claims(): + """Three claims outside the theorem must fail on a fixed instance.""" + if 2 ** 3 <= 1 ** 3: + fail("accepted the reversed power comparison") + if g_sign_against(4, 0, 2, 1, 0) < 0 and g_sign_against(4, 0, 2, 1, 2) < 0: + fail("forged interior win was accepted") + if g_sign_against(4, 0, 2, 1, 2) <= 0: + fail("the D=4 upper endpoint did not beat the interior") + # Dropping 0^t = 0 on only the retired lower leg invents a charge. + forged = [(1, 0), (1, 2), (-1, 2), (-1, 1), (-1, 1), (1, 1)] + if certified_sign(forged) == 0: + fail("a dropped zero-leg convention reproduced G(0)") + + +def main(): + powers = power_monotone(40, 5) + rows, positive_proper, cancelled = half_endpoint_census(12) + pair_rows, strict_interior = path_pairs(6) + reject_forged_claims() + print( + MARKER + + f" powers={powers} half_rows={rows}" + + f" positive_boundary_paths={positive_proper}" + + f" full_span_zeros={cancelled}" + + f" two_path_rows={pair_rows} two_path_strict_interior={strict_interior}" + + f" kappa={KAPPA} no_new_kappa=true" + ) + + +if __name__ == "__main__": + main()