diff --git a/research/proper-terminal-sign-criterion/PROOF.md b/research/proper-terminal-sign-criterion/PROOF.md new file mode 100644 index 0000000000..a04a0ae4d3 --- /dev/null +++ b/research/proper-terminal-sign-criterion/PROOF.md @@ -0,0 +1,279 @@ +# A sign criterion for fully crossing helper rank bills + +## Scope and provenance + +Fix a real exponent $00$, and a nonempty +finite list of paths with real endpoints + +$$ +0\le a_i\le T\le b_i,\qquad 1\le i\le m. +$$ + +Set $A=\max_i a_i$. For $A\le x\le T$, define + +$$ +\begin{aligned} +H_{a,b}(x)&=(x-a)^t+(b-x)^t-(b-a)^t,\\ +H_0(x)&=H_{0,T}(x)=x^t+(T-x)^t-T^t,\\ +G(x)&=H_0(x)-\sum_{i=1}^m H_{a_i,b_i}(x). +\end{aligned} +$$ + +We use $0^t=0$. Every paid path reaches the helper terminal: +**$b_i\ge T$ is essential to the stated domain.** A path may end exactly +at $T$; proper crossing $b_i>T$ is not required. The endpoints need not +be integers, so the theorem includes the integer-rank instances. + +The rank-bill formula and its zero-to-ambient endpoint question come from +unpaidmoon's PR #7283, retaining CubeJerry's helper-split work and +DreamingOfClouds's two-chain word in PR #6902. Nick Petalas's PR #7331, +at `e5383f5c2973c9520918cbe6ebe9c6e6867e5771`, proves the proper-terminal +one-path result and supplies a four-path counterexample to an endpoint +**maximum**. Its first open question asks whether an interior positive bill +can be hidden by nonpositive endpoint bills. We answer that sign question +for every finite number of fully crossing paths. The proof below is +self-contained; it uses classical concavity and tangent-line inequalities. + +This is a result about the abstract rank bill. It does not construct a legal +helper split, change a caller, price ordinary work, discharge native, +ownership or restoration obligations, or improve the selected conditional +$\kappa$. + +## 1. Ordered-endpoint ratio theorem + +**Theorem 1.** Suppose $0\le a0$ or +$b>T$. If $a=0,b=T$, it is identically one. + +**Proof.** Strict subadditivity of $z^t$ on positive arguments gives +$H_{a,T}(x)>0$, $H_0(x)>0$, and $H_{a,b}(x)>0$ in this open interval. +Write + +$$ +\begin{aligned} +H(x)&=H_{a,T}(x),\\ +\Delta(x)&=H_{a,b}(x)-H(x)\\ + &=(b-x)^t-(T-x)^t-(b-a)^t+(T-a)^t,\\ +E(x)&=H_0(x)-H(x)\\ + &=x^t-(x-a)^t-T^t+(T-a)^t. +\end{aligned} +$$ + +The function $H$ is strictly concave on $(a,T)$, is continuous on +$[a,T]$, and vanishes at both endpoints. In particular, + +$$ +H''(x)=t(t-1)\big((x-a)^{t-2}+(T-x)^{t-2}\big)<0. +$$ + +If $b=T$, then $\Delta=0$. If $b>T$, then + +$$ +\begin{aligned} +\Delta(a)&=0,\\ +\Delta'(x)&=t\big((T-x)^{t-1}-(b-x)^{t-1}\big)>0,\\ +\Delta''(x)&=t(1-t)\big((T-x)^{t-2}-(b-x)^{t-2}\big)>0. +\end{aligned} +$$ + +Thus $\Delta$ is nonnegative and convex, and it is positive and strictly +convex when $b>T$. Tangent-line inequalities at an interior point $x$, +evaluated at $a$, give + +$$ +\Delta'(x)\ge\frac{\Delta(x)}{x-a},\qquad +H'(x)\le\frac{H(x)}{x-a}. +$$ + +Consequently + +$$ +\left(\frac{\Delta}{H}\right)'(x) +=\frac{\Delta'H-\Delta H'}{H^2}\ge0. +$$ + +For $b>T$, the first tangent inequality is strict, so this derivative is +strictly positive. + +If $a=0$, then $E=0$. If $a>0$, then + +$$ +\begin{aligned} +E(T)&=0,\\ +E'(x)&=t\big(x^{t-1}-(x-a)^{t-1}\big)<0,\\ +E''(x)&=t(1-t)\big((x-a)^{t-2}-x^{t-2}\big)>0. +\end{aligned} +$$ + +Thus $E$ is nonnegative and convex, and it is positive and strictly convex +when $a>0$. The tangent-line inequalities evaluated at $T$ give + +$$ +E'(x)\le-\frac{E(x)}{T-x},\qquad +H'(x)\ge-\frac{H(x)}{T-x}. +$$ + +It follows that + +$$ +\left(\frac{E}{H}\right)'(x) +=\frac{E'H-EH'}{H^2}\le0, +$$ + +strictly when $a>0$. The endpoint derivatives of $H$ need not be finite: +only derivatives at $x\in(a,T)$ and continuity at the endpoints were used. + +Finally, + +$$ +R_{a,b}(x) +=\frac{H(x)+\Delta(x)}{H(x)+E(x)} +=\frac{1+\Delta(x)/H(x)}{1+E(x)/H(x)}. +$$ + +Its numerator is positive and nondecreasing, and its denominator is positive +and nonincreasing. At least one changes strictly if $a>0$ or $b>T$. +This proves all assertions. $\square$ + +## 2. No positive bill can hide behind a nonpositive left endpoint + +**Theorem 2.** For the nonempty finite path list above, + +$$ +\big(\exists x\in[A,T]:G(x)>0\big)\quad\Longleftrightarrow\quad G(A)>0. +$$ + +If $A0$, then $H_0(A)>0$. Continuity extends this normalized identity +to $A$, even for paths with $a_i=A$. Thus $G(A)\le0$ implies +$S(A)\ge1$, hence $S(x)\ge1$ and $G(x)\le0$ throughout $(A,T)$. +In fact $S$ is strictly increasing because at least one $a_i=A>0$, +so $G(x)<0$ for every $A0$. +The nonnegative remainder $\Delta$ from Theorem 1, now with $a=0$, gives +$H_{0,b_i}(x)\ge H_0(x)$. Therefore every ratio is at least one and +$S(x)\ge m\ge1$, so again $G(x)\le0$ throughout the interior. +Here $G(A)=G(0)=0$. The unweighted nonempty-list hypothesis is used in +the inequality $m\ge1$. + +We have proved that $G(A)\le0$ rules out positive values everywhere. +Conversely, if $G(A)>0$, the lower endpoint itself is a positive value; +continuity gives positive values immediately to its right whenever $A0\big)\quad\Longleftrightarrow\quad G(L)>0. +$$ + +If $L>0$, this follows by applying the same nondecreasing sum $S$ from +$L$ onward. If $L=0$, then $A=0$ and the special endpoint argument in +Theorem 2 applies. Positive $G(L)$ gives a positive interior neighborhood +by continuity. Thus the criterion applies even when additional constraints +restrict the allowed split dimension to a smaller interval. + +**Corollary 4 (sign structure).** On $(A,T)$, the normalized bill +$G/H_0$ is nonincreasing. It is strictly decreasing unless every path is +exactly $[0,T]$. Consequently the positive set, when nonempty, is an +initial interval of the permitted domain. There is at most one interior +zero, except in the constant normalized case. In that exceptional case +$G=(1-m)H_0$, which is nonpositive and vanishes throughout the interior +only when $m=1$. + +The monotonicity is for **$G/H_0$**. It does not assert that $G$ itself +is monotone or that $G$ attains its maximum at an endpoint. + +## 3. Compatibility with the predecessor's counterexample + +PR #7331 gives $t=1/2$, $T=24$, ambient $D=26$, and four paths + +$$ +(a_i,b_i)\in\{(3,25),(17,26),(0,25),(6,25)\}. +$$ + +Its rational interior point $x=3819/160$ has a larger bill than both +endpoints $A=17$ and $T=24$, with all three bills negative. Theorem 2 +does not contradict that example: it excludes a **positive** interior bill +when $G(17)\le0$, while allowing an interior maximum below zero. +Multiplication by the positive, nonconstant factor $H_0(x)$ need not +preserve monotonicity of the normalized bill. + +## 4. Unit path charges matter at the zero endpoint + +Theorem 2 does not assert the same endpoint criterion for arbitrary positive +fractional path weights. For example, take $t=1/2$, $T=2$, one path +$(a,b)=(0,3)$, and weight $w=1/2$. Its weighted bill is + +$$ +G_w(x)=\sqrt{x}+\sqrt{2-x}-\sqrt2 + -\frac12\big(\sqrt{x}+\sqrt{3-x}-\sqrt3\big). +$$ + +At the endpoints, + +$$ +G_w(0)=0,\qquad +G_w(2)=-\frac12(\sqrt2+1-\sqrt3)<0. +$$ + +Nevertheless, + +$$ +G_w(1)=\frac{3+\sqrt3-3\sqrt2}{2}>0. +$$ + +The last comparison is exact: both sides of $3+\sqrt3>3\sqrt2$ are +positive, and squaring reduces it to $12+6\sqrt3>18$, or $\sqrt3>1$. +The ratio monotonicity still holds, but at $A=0$ a fractional weighted sum +need not be at least one. The proof's use of the unweighted nonempty list +cannot be dropped. + +No theorem here covers a path ending before $T$, fractional or negative +path charges, ordinary implementation costs, or the legality of a proposed +word. A useful next application must first verify the endpoint inequalities +for every charged path in its actual rank bill. + +Prepared by apoursh with substantial OpenAI Codex and subagent assistance. +The predecessor research and contributor lineage retain their attribution. +New work is Apache-2.0; no independent human or formal-kernel proof acceptance +is claimed. diff --git a/research/proper-terminal-sign-criterion/README.md b/research/proper-terminal-sign-criterion/README.md new file mode 100644 index 0000000000..75fcfffb1c --- /dev/null +++ b/research/proper-terminal-sign-criterion/README.md @@ -0,0 +1,106 @@ +# No hidden positive bill for fully crossing helper paths + +For the proper-terminal helper rank bill of Nick Petalas's +[PR #7331](https://github.com/CrocSwap/integer-mult-bounds/pull/7331), a positive +interior bill cannot hide behind a nonpositive left endpoint, for **any finite +number of unit-charged paths reaching the terminal**. This resolves its first +open question on that domain. It does not improve κ. + +For real `00`, a nonempty list `0<=a_i<=T<=b_i`, and `A=max a_i`, set + +```text +H_ab(x) = (x-a)^t + (b-x)^t - (b-a)^t +G(x) = H_0T(x) - sum_i H_ai,bi(x), A <= x <= T. +``` + +Then `G` is positive somewhere on `[A,T]` **if and only if `G(A)>0`**. +The same criterion applies at the left endpoint of any permitted closed +subinterval. The proof establishes that each ratio `H_ab/H_0T` is nondecreasing in +`x`: convex endpoint remainders divided by a positive concave bridge have the +required monotonicity. Thus `G/H_0T` is nonincreasing, even when `G` itself is not. +See [PROOF.md](PROOF.md) for the all-real argument and zero-length boundaries. + +The predecessor's four-path example still has a negative interior maximum +above both endpoint values. The new result decides the **sign**, not the +maximizing dimension. Paths ending before `T`, signed or arbitrary fractional +charges, native legality and a complete implementation invoice are outside the +claim. A positive fractional-weight counterexample shows why the unit-charge +hypothesis cannot simply be dropped at the zero endpoint. + +## Reproduction and evidence + +Python 3.12, standard library, from the repository root: + +```sh +python3.12 -W error -I -B research/proper-terminal-sign-criterion/verify.py +python3.12 -W error -I -B research/proper-terminal-sign-criterion/independent_check.py +python3.12 -B scripts/research_package.py --package research/proper-terminal-sign-criterion +python3.12 -B scripts/check_research_commit.py --package research/proper-terminal-sign-criterion --check-modes --check-source-history +``` + +The registered manifest repeats both direct commands with `-O`; explicit +exceptions keep every acceptance check active. The primary checker uses integer +nth-root enclosures at exponents `1/4,1/3,1/2,2/3,3/4`: 1,440 ratio comparisons, +450 normalized-bill comparisons, 225 zero-start bills, 90 endpoint checks, +342 root controls and eight rejecting domain/direction controls. The separate +checker imports neither it nor predecessor code. At `t=1/2`, integer square-root +bounds cover 1,050 ratio comparisons, all 2,900 multisets of one to three paths +in the stated grid (`T=2..6`, `a=0..T-1`, `b=T..T+2`), 11,600 normalized-bill +comparisons and 11,275 interior signs for 2,255 nonpositive-left fixtures. +It also verifies the four-path counterexample and six scope/direction controls. +These finite checks corroborate the proof; they do not establish its quantified +claim by extrapolation. + +The baseline source-binding check passed after materializing 147 missing +tracked files, covering 221 selected inputs/pointers. It is not a scientific +replay of selected PR7000. No selected-family cold replay, native execution, +Lean, Docker, supplier admission or human/kernel proof review is claimed. + +## Sources, overlap and task scope + +Base: `e54523517d0f03e58352e647c403a5af3e525a57`, fetched and pulled from canonical +CrocSwap main. Revision 8's catalogue still references PR5599; the contextual +picker correctly reports that mismatch against selected PR7000 and conditional +κ `363005817/100000000000`. The full original `p104-side-correction` card is +preserved in [TASK.json](TASK.json); the actual scope is explicitly changed to +this abstract sign lemma. A useful fully charged split still needs its own +word, legality, ownership, restoration and ordinary-cost evidence. + +PR7331 is pinned at `e5383f5c2973c9520918cbe6ebe9c6e6867e5771`. +[Its retained proof](sources/pr7331-PROOF.md) is byte-equal to the immutable +published source; [SOURCE-PINS.json](SOURCE-PINS.json) records the URL and digest. +This retains the question, formula and witness, not an assertion that every +predecessor proof step was audited. No predecessor executable is imported. +The pending head is not represented as an ancestor; only the base catalogue +and selected record are Git provenance in [SOURCES.json](SOURCES.json). +All scientific runtime inputs are package-local. + +The live handoff board and start-here conventions were read. The all-state +`7331` title/body search found #7331, #7332 and #7396: the latter two concern +literal helper cuts/quiet lifts, not this all-path sign theorem. The latest 20 +PR titles were inspected through #7459. This bounded coverage is not proof of +novelty and does not cover every diff or unpublished result. The local sparse +overlap helper searched 41 of 10,178 HEAD note paths; 10,139 were omitted, and +its offline remote cache was not treated as current. Browser access +was signed out, so no advance public claim was posted. The repository permits +an unclaimed bounded session; this package supplies the public finding. + +## Open next questions + +1. **Mixed paths ending before the terminal.** Characterize the sign of the + bill on `[max a_i, min(T,min b_i)]` when some `b_i0.", + "scope_change_reason": "The catalogue asks for an actual legal P104 split and complete invoice. This source-specific analytic side result resolves a published abstract sign question and provides a pruning criterion; it does not construct or admit a supplier.", + "bottleneck_link": "Reject all interior split dimensions of an applicable fully crossing rank bill from a single nonpositive lower-endpoint value; actual path applicability and complete charges remain separate.", + "budget_minutes": 60, + "stop_rule": "Stop after proof, independent exact controls and portable package; no expansion into a native implementation or a census of new caller cuts.", + "outcome": "completed", + "evidence": "PROOF.md gives all-real theorem. verify.py and independent_check.py provide distinct finite exact corroboration and counterexamples to weakened premises; VERIFY.json registers normal and optimized checks.", + "author": "apoursh", + "ai_assistance": "Substantial OpenAI Codex and subagent assistance in proof discovery/audit, code, exact verification and packaging.", + "open_questions": [ + { + "question": "Extend sign screening to mixed paths with b_i= 0, "negative radicand") + floor = isqrt(value.numerator * SCALE * SCALE // value.denominator) + low = Q(floor, SCALE) + high = low if low * low == value else Q(floor + 1, SCALE) + require(low * low <= value <= high * high, "invalid root enclosure") + return low, high + + +def interval_product(left, right): + values = [a * b for a in left for b in right] + return min(values), max(values) + + +def subtract(left, right): + return left[0] - right[1], left[1] - right[0] + + +def radical_terms(a, b, x): + require(a <= x <= b, "query outside path") + terms = Counter() + for coefficient, value in ((1, x-a), (1, b-x), (-1, b-a)): + terms[Q(value)] += coefficient + return terms + + +def evaluate(terms): + low = high = Q(0) + for radicand, coefficient in terms.items(): + if not coefficient or not radicand: + continue + lo, hi = root_bounds(radicand) + if coefficient >= 0: + low += coefficient * lo + high += coefficient * hi + else: + low += coefficient * hi + high += coefficient * lo + return low, high + + +def h(a, b, x): + return evaluate(radical_terms(Q(a), Q(b), Q(x))) + + +def bill_terms(T, paths, x, weights=None): + terms = radical_terms(Q(0), Q(T), Q(x)) + if weights is None: + weights = [1] * len(paths) + require(len(weights) == len(paths), "weight count") + for (a, b), weight in zip(paths, weights): + for radicand, coefficient in radical_terms(Q(a), Q(b), Q(x)).items(): + terms[radicand] -= weight * coefficient + return terms + + +def g(T, paths, x, weights=None): + return evaluate(bill_terms(T, paths, x, weights)) + + +def sign(bounds): + low, high = bounds + if high < 0: + return -1 + if low > 0: + return 1 + if low == high == 0: + return 0 + raise ValueError("interval insufficient to certify sign") + + +def check_ratio_grid(): + comparisons = strict = identical = 0 + for T in range(2, 9): + for a in range(T): + for b in range(T, T + 5): + points = [Q(a) + Q((T-a)*j, 8) for j in range(1, 8)] + for x, y in zip(points, points[1:]): + # R(y)-R(x) has this numerator; denominators are positive. + hx, hy = h(0, T, x), h(0, T, y) + require(sign(hx) == sign(hy) == 1, "nonpositive baseline") + if a == 0 and b == T: + require(h(a, b, x) == hx and h(a, b, y) == hy, + "identity ratio") + identical += 1 + else: + determinant = subtract(interval_product(h(a, b, y), hx), + interval_product(h(a, b, x), hy)) + require(sign(determinant) == 1, "ratio not strictly increasing") + strict += 1 + comparisons += 1 + return dict(ratio_comparisons=comparisons, + strict_ratios=strict, identical_ratios=identical) + + +def check_bills(): + bills = normalized_pairs = endpoint_premises = interior_checks = 0 + constant_normalized = positive_left_endpoints = zero_bills = 0 + for T in range(2, 7): + alphabet = [(a, b) for a in range(T) for b in range(T, T+3)] + for m in range(1, 4): + for paths in combinations_with_replacement(alphabet, m): + A = max(a for a, _ in paths) + left_sign = sign(g(T, paths, A)) + require(sign(g(T, paths, T)) <= 0, "positive terminal bill") + points = [Q(A) + Q((T-A)*j, 6) for j in range(1, 6)] + values = [g(T, paths, x) for x in points] + all_original = all(pair == (0, T) for pair in paths) + exceptional_zero = m == 1 and all_original + if left_sign <= 0: + endpoint_premises += 1 + for value in values: + require(sign(value) == (0 if exceptional_zero else -1), + "endpoint sign criterion") + interior_checks += 1 + zero_bills += int(exceptional_zero) + else: + positive_left_endpoints += 1 + for x, y, gx, gy in zip(points, points[1:], values, values[1:]): + if all_original: + # Exact cancellation: G/H = 1-m throughout the interval. + remainder = bill_terms(T, paths, x) + for radicand, coefficient in radical_terms(Q(0),Q(T),x).items(): + remainder[radicand] -= (1-m) * coefficient + require(not any(remainder.values()), "constant normalized bill") + constant_normalized += 1 + else: + difference = subtract(interval_product(gy, h(0,T,x)), + interval_product(gx, h(0,T,y))) + require(sign(difference) == -1, + "normalized bill not strictly decreasing") + normalized_pairs += 1 + bills += 1 + return dict(bills=bills, normalized_pairs=normalized_pairs, + constant_normalized_pairs=constant_normalized, + nonpositive_left_endpoint_bills=endpoint_premises, + positive_left_endpoint_bills=positive_left_endpoints, + certified_interior_signs=interior_checks, + exceptional_zero_bills=zero_bills) + + +def check_predecessor_witness(): + paths = ((3,25), (17,26), (0,25), (6,25)) + left, inside, right = (g(24, paths, x) for x in (17,Q(3819,160),24)) + require(sign(subtract(inside,left)) == 1, "predecessor left maximum gap") + require(sign(subtract(inside,right)) == 1, "predecessor right maximum gap") + require(sign(inside) == sign(left) == sign(right) == -1, + "predecessor sign control") + return dict(predecessor_witness_checks=3) + + +def check_failure_controls(): + # Dropping b>=T makes the unit-weight endpoint implication false. + require(sign(g(4, ((0,3),), 0)) == 0, "short-path left endpoint") + require(sign(g(4, ((0,3),), 1)) == 1, "short-path interior counterexample") + # With a negative coefficient, the original path cancels the target and + # the remaining positive H_(1,8) gives a positive interior after a zero start. + paths = ((0,4),(1,8)) + require(sign(g(4, paths, 1, (1,-1))) == 0, "signed-weight left endpoint") + require(sign(g(4, paths, 2, (1,-1))) == 1, "signed-weight counterexample") + # Even a positive fractional weight invalidates the raw endpoint test at 0. + fractional = ((0,3),) + require(sign(g(2, fractional, 0, (Q(1,2),))) == 0, "fractional left endpoint") + require(sign(g(2, fractional, 2, (Q(1,2),))) == -1, "fractional terminal") + require(sign(g(2, fractional, 1, (Q(1,2),))) == 1, "fractional counterexample") + # The exponent range is load bearing: at t=1 the normalizer vanishes; + # at t=2 it is negative, so the positive-denominator comparison is invalid. + require(1 + 3 - 4 == 0, "linear exponent control") + require(1**2 + 3**2 - 4**2 < 0, "convex exponent control") + # Flip the proposed monotonic direction on a strict valid fixture. + numerator = subtract(interval_product(h(1,5,3),h(0,4,2)), + interval_product(h(1,5,2),h(0,4,3))) + require(sign(numerator) == 1, "reversed-inequality control") + return dict(failure_controls=6) + + +def main(): + results = {} + for check in (check_ratio_grid, check_bills, check_predecessor_witness, + check_failure_controls): + results.update(check()) + print("PASS_INDEPENDENT_SIGN_CRITERION " + json.dumps(results, sort_keys=True)) + + +if __name__ == "__main__": + main() diff --git a/research/proper-terminal-sign-criterion/sources/pr7331-PROOF.md b/research/proper-terminal-sign-criterion/sources/pr7331-PROOF.md new file mode 100644 index 0000000000..8c3f6075c9 --- /dev/null +++ b/research/proper-terminal-sign-criterion/sources/pr7331-PROOF.md @@ -0,0 +1,186 @@ +# Proof: proper helper terminals and the rank bill + +**Proof. No new κ.** The selected conditional exponent stays +`363005817/100000000000`. No word is emitted and no cut is declared legal. + +## Hypotheses + +Fix a real exponent `0 < t < 1` and integers `0 < T < D`. A helper boundary +runs from the zero subspace to a proper terminal of dimension `T`, strictly +inside the ambient `D`-dimensional space. The helper 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 old charge `(b_i - a_i)^t`. A path with +`b_i > T` leaves the boundary. + +Write `h(u) = u^t` for `u > 0` and `h(0) = 0`. On the closed feasible interval +`[A, B]`, with `A = max a_i` and `B = min(T, min b_i)`, every leg length is +nonnegative and the rank bill is + +```text +G(x) = h(x) + h(T-x) - h(T) + - Σ_i ( h(x-a_i) + h(b_i-x) - h(b_i-a_i) ). +``` + +This is the #7283 formula with the helper dimension `D` replaced by the +terminal `T`. A zero leg is omitted from a physical word; the formula keeps +`h(0) = 0`. The value `G` is the rank-bill factor only. It is not an ordinary +cost, a legality test or a supplier invoice. + +The interval endpoints are feasible dimensions. `A` is the largest path start, +and `B` is the terminal when at least one path crosses it, otherwise the +smallest path end. Joins or meets can only shrink `[A, B]`, and the argument +below applies to every closed subinterval on which all legs are nonnegative. + +## Lemma 1 (concavity and its derivative) + +For `0 < u < v`, + +```text +h'(u) = t u^(t-1) > t v^(t-1) = h'(v). +``` + +Both sides are positive because `0 < t < 1`, and `u^(t-1) > v^(t-1)` +because `u < v` and `t - 1 < 0`. Hence `h` is strictly concave and `h'` is +strictly decreasing on `(0, ∞)`. The verifier checks the equivalent integer +form: for `t = p/q` in lowest terms, `s = q - p > 0`, and `u ≤ v` implies +`u^s ≤ v^s`. + +The same strict monotonicity gives the increment form used below. For +`0 ≤ y < z` and `x > 0`, + +```text +h(z) - h(z-x) < h(y+x) - h(y) + if and only if z-x > y, +``` + +because both increments are `∫_0^x h'(base + s) ds` and `h'` is strictly +decreasing. We use the case `y = T-x`, `z = b` with `b > T`. + +## Lemma 2 (subadditivity) + +For `u, v ≥ 0`, + +```text +h(u+v) ≤ h(u) + h(v). +``` + +For positive `u, v` this is the strict concavity inequality +`h(u) ≥ h(u+v) + h'(u+v)(u - (u+v))`, together with the symmetric bound for +`h(v)`; the boundary cases follow from `h(0) = 0`. Equality holds only when +`u = 0` or `v = 0`. + +## Lemma 3 (the terminal is not a positive bill) + +Suppose every path has `a_i ≤ T ≤ b_i`. Then + +```text +G(T) = - Σ_i ( h(T-a_i) + h(b_i-T) - h(b_i-a_i) ) ≤ 0. +``` + +The helper terms vanish because `h(T) - h(T) = 0` and `h(0) = 0`. Each summand +is nonnegative by Lemma 2, applied to `u = T - a_i` and `v = b_i - T` whose sum +is `b_i - a_i`. A summand is zero exactly when `T` equals `a_i` or `b_i`. +Therefore `G(T) ≤ 0`, with equality exactly when `T` is an endpoint of every +path. + +## Lemma 4 (no path starts inside the boundary) + +Suppose every `a_i = 0`, at least one path crosses (`b_i > T`), and +`0 < x < T`. Then `G(x) < 0`. + +Proof. Substitute `a_i = 0`: + +```text +G(x) = - (h(T) - h(T-x)) + Σ_i ( h(b_i) - h(b_i-x) ) - (m-1) h(x). +``` + +For a crossing path, `b_i > T`, so `b_i - x > T - x`. Lemma 1 with +`y = T-x`, `z = b_i` gives + +```text +h(b_i) - h(b_i-x) < h(T) - h(T-x). +``` + +Summing over the `m` paths, + +```text +Σ_i ( h(b_i) - h(b_i-x) ) < m ( h(T) - h(T-x) ), +``` + +so + +```text +G(x) < (m-1) ( h(T) - h(T-x) ) - (m-1) h(x) + = -(m-1) ( h(x) + h(T) - h(T-x) ). +``` + +For `m ≥ 2` the right side is negative because `h(x) > 0` and +`h(T) > h(T-x)`. For `m = 1` the strict increment inequality alone gives +`G(x) < 0` without the last line. At `x = 0` every term vanishes, so +`G(0) = 0` and the maximum is attained only at the left endpoint. + +## Theorem 1 (one crossing path) + +Suppose `m = 1` and `b > T`. Then `G` is strictly decreasing on `[a, T]`, so +its maximum on the feasible interval is `G(a)`. + +Proof. For `a < x < T` the legs are positive and + +```text +G'(x) = h'(x) - h'(T-x) - h'(x-a) + h'(b-x) + = [h'(x) - h'(x-a)] + [h'(b-x) - h'(T-x)]. +``` + +Since `a ≥ 0`, we have `x - a ≤ x`, and Lemma 1 gives +`h'(x-a) ≥ h'(x)`, with equality only if `a = 0`. Since `b > T`, we have +`b - x > T - x`, and Lemma 1 gives `h'(b-x) < h'(T-x)`. The second bracket is +strictly negative, so `G'(x) < 0` on `(a, T)`. A differentiable function with +a strictly negative derivative on an open interval is strictly decreasing +there; `G` is continuous on the closed interval because `h(0) = 0`. Hence the +maximum is `G(a)`. When `a = 0`, Lemma 4 gives `G(x) < 0` on `(0, T)` directly. + +Consequently one path that leaves a proper helper boundary can never justify a +new intermediate dimension: the candidate is the path's own lower endpoint, +which is already a boundary dimension. This is the first step requested in +#7283's Open next question 1. + +## Proposition (the endpoint maximum fails for four crossing paths) + +Take `t = 1/2`, `D = 26`, `T = 24`, and the four paths + +```text +(3, 25), (17, 26), (0, 25), (6, 25). +``` + +Every path starts in `[0, T]` and crosses the terminal, and every endpoint is +in `[0, D]`. The feasible interval is `[A, T] = [17, 24]`. At +`x0 = 3819/160` the exact integer square-root certificate gives + +```text +G(17) - G(x0) < 0, G(24) - G(x0) < 0. +``` + +The decimal displays are `G(17) = -3.747477...`, `G(24) = -3.734846...` and +`G(x0) = -3.554274...`. Thus `x0` strictly beats both endpoints. The endpoint +maximum of #7283 therefore does not extend to four boundary-crossing paths. + +The witness has a negative interior value, so it does not exhibit a profitable +rank bill. It shows that the two-endpoint comparison can understate the +maximum. The sign question is left as an open next question. + +## What this does not prove + +The proper-terminal bill is a rank-bill factor. This package does not prove a +legal cut, an arbitrary-input identity, a native realization, an ordinary +cost, ownership, restoration or a paid-profile improvement. It does not change +the selected exponent. The two-path and three-path cases are not proved; only +the stated finite grids are censused. The sign of an interior maximum with +nonpositive endpoints is not proved. + +## Dependencies + +The rank-bill formula, its zero-to-`D` endpoint theorem and the proper-terminal +question are unpaidmoon's #7283. That package credits CubeJerry's shared-native +helper-split exploration and the two-chain word from DreamingOfClouds in #6902. +No part of #7283 is replayed or re-audited here. This package was produced by Nick Petalas. +Apache-2.0. diff --git a/research/proper-terminal-sign-criterion/verify.py b/research/proper-terminal-sign-criterion/verify.py new file mode 100644 index 0000000000..816a37eb1d --- /dev/null +++ b/research/proper-terminal-sign-criterion/verify.py @@ -0,0 +1,162 @@ +#!/usr/bin/env python3 +"""Exact rational-power corroboration; the all-real theorem is in PROOF.md. + +apoursh, with substantial OpenAI Codex assistance. Apache-2.0. +""" +from fractions import Fraction as F +from functools import lru_cache +from hashlib import sha256 +import json +from pathlib import Path + +ROOT = Path(__file__).resolve().parent + + +def require(ok, message): + if not ok: + raise ValueError(message) + + +def nthroot(n, q): + """Floor n**(1/q), by integer bisection only.""" + lo, hi = 0, 1 << ((n.bit_length() + q - 1) // q) + while lo + 1 < hi: + mid = (lo + hi) // 2 + if mid ** q <= n: + lo = mid + else: + hi = mid + return hi if hi ** q <= n else lo + + +@lru_cache(None) +def power(x, t): + require(x >= 0 and 0 < t < 1, 'power domain') + p, q = t.numerator, t.denominator + scale = 1 << 100 + value = x ** p + n = value.numerator * scale ** q // value.denominator + k = nthroot(n, q) + lo = F(k, scale) + if k ** q * value.denominator == value.numerator * scale ** q: + return lo, lo + return lo, F(k + 1, scale) + + +def add(a, b): + return a[0] + b[0], a[1] + b[1] + + +def sub(a, b): + return a[0] - b[1], a[1] - b[0] + + +def mul(a, b): + v = [x * y for x in a for y in b] + return min(v), max(v) + + +def h(a, b, x, t): + return sub(add(power(x-a,t), power(b-x,t)), power(b-a,t)) + + +def bill(T, paths, x, t): + total = h(F(0),T,x,t) + for a,b in paths: + total = sub(total,h(a,b,x,t)) + return total + + +def positive(interval, label): + require(interval[0] > 0, label + ': not certified strictly positive') + + +def valid(T, paths, t): + require(T > 0 and 0 < t < 1 and len(paths) >= 1, 'bill domain') + require(all(0 <= a <= T <= b for a,b in paths), 'terminal order') + + +def normalized_difference(T, paths, x, y, t): + # G(x)/H0T(x) > G(y)/H0T(y), without interval division. + return sub(mul(bill(T,paths,x,t),h(0,T,y,t)), + mul(bill(T,paths,y,t),h(0,T,x,t))) + + +def main(): + counts = dict(root_controls=0, ratio_comparisons=0, + normalized_bill_comparisons=0, zero_start_bills=0, + endpoint_bills=0, domain_rejections=0) + for q in range(2,8): + for k in range(1,20): + for n in [k**q-1,k**q,k**q+1]: + v=nthroot(n,q) + require(v**q <= n < (v+1)**q,'integer root bracket') + counts['root_controls'] += 1 + exponents = [F(1,4),F(1,3),F(1,2),F(2,3),F(3,4)] + for t in exponents: + for T in map(F,[1,2,5]): + for a in [0,T/4,T/2,3*T/4]: + for b in [T,5*T/4,2*T,4*T]: + points=[a+(T-a)*F(j,8) for j in range(1,8)] + for x,y in zip(points,points[1:]): + delta=sub(mul(h(a,b,y,t),h(0,T,x,t)), + mul(h(a,b,x,t),h(0,T,y,t))) + if a == 0 and b == T: + require(delta[0] <= 0 <= delta[1], 'identity ratio') + else: + positive(delta, 'ordered interval ratio') + counts['ratio_comparisons'] += 1 + for m in range(1,6): + paths=[(T*F(i+1,2*m+2),T*(1+F(i+1,4))) for i in range(m)] + valid(T,paths,t) + A=max(a for a,b in paths) + points=[A+(T-A)*F(j,8) for j in range(1,8)] + for x,y in zip(points,points[1:]): + positive(normalized_difference(T,paths,x,y,t), 'normalized bill order') + counts['normalized_bill_comparisons']+=1 + positive((-bill(T,paths,T,t)[1],-bill(T,paths,T,t)[0]), 'crossing terminal negative') + counts['endpoint_bills']+=1 + zeros=[(F(0),b) for a,b in paths] + for x in [T/4,T/2,3*T/4]: + require(bill(T,zeros,x,t)[1] < 0,'zero-start exclusion') + counts['zero_start_bills']+=1 + # Positive bill at left, crossing to negative before terminal. + paths=[(T/2,2*T)] + positive(bill(T,paths,T/2,t),'positive left endpoint') + counts['endpoint_bills']+=1 + # Exact zero family and degenerate feasible interval. + for x in [F(0),T/3,T]: + z=bill(T,[(F(0),T)],x,t) + require(z[0]<=0<=z[1], 'zero family') + z=bill(T,[(T,T)],T,t) + require(z[0] <= 0 <= z[1], 'singleton interval enclosure') + bad=[(F(0),[(0,1)],F(1,2)),(F(1),[],F(1,2)), + (F(1),[(0,1)],F(0)),(F(1),[(0,1)],F(1)), + (F(1),[(F(-1),F(2))],F(1,2)), + (F(1),[(0,F(1,2))],F(1,2)), + (F(1),[(F(2),F(3))],F(1,2))] + for args in bad: + try: + valid(*args) + except ValueError: + counts['domain_rejections']+=1 + else: + raise ValueError('invalid domain admitted') + # Test the strict inequality gate itself with a reversed exact interval. + try: + positive((F(-2),F(-1)), 'reversed inequality control') + except ValueError: + counts['domain_rejections']+=1 + else: + raise ValueError('reversed inequality admitted') + pins=json.loads((ROOT/'SOURCE-PINS.json').read_text(encoding='utf-8')) + require(pins['predecessor_head']=='e5383f5c2973c9520918cbe6ebe9c6e6867e5771','source head') + raw=(ROOT/'sources/pr7331-PROOF.md').read_bytes() + require(sha256(raw).hexdigest()==pins['proof_sha256'],'retained predecessor bytes') + print(json.dumps({'status':'PASS_PROPER_TERMINAL_SIGN_CRITERION', + 'counts':counts,'exponents':[str(t) for t in exponents], + 'scope':'finite exact corroboration, not the universal proof'},sort_keys=True)) + + +if __name__=='__main__': + main()