Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Entropy, quartic integer switch, twelve costs and fixed-expansion model

Definition
ThreeSum1960614_Analysis

by Yuxuan Xu · Oct 14, 2026 · Mathlib 0df444a (Lean v4.33.1)

3sumentropyexact-certificatesword-ram

Defines binary entropy in bits H(t)H(t)H(t), Ec=(c/2)H(1/c)E_c=(c/2)H(1/c)Ec​=(c/2)H(1/c), κc=2cH(1/(2c))−cH(1/c)−1\kappa_c=2cH(1/(2c))-cH(1/c)-1κc​=2cH(1/(2c))−cH(1/c)−1, and γc(t)=cH(1/c)−cH((1−t)/c)\gamma_c(t)=cH(1/c)-cH((1-t)/c)γc​(t)=cH(1/c)−cH((1−t)/c) for natural expansion ccc. The quartic is P(t)=7.85174904t+0.72447023t2+0.24044466t3+0.12022459t4P(t)=7.85174904t+0.72447023t^2+0.24044466t^3+0.12022459t^4P(t)=7.85174904t+0.72447023t2+0.24044466t3+0.12022459t4, with its polynomial derivative. The fixed rational parameters are e=0.203889696e=0.203889696e=0.203889696, b=−0.062656016b=-0.062656016b=−0.062656016, S=0.193175570S=0.193175570S=0.193175570, θ=0.040409899\theta=0.040409899θ=0.040409899, τ=13/20\tau=13/20τ=13/20, ρ=0.27905030\rho=0.27905030ρ=0.27905030, and u=0.17200068185091493u=0.17200068185091493u=0.17200068185091493. The principal cost cap is 1.960613881.960613881.96061388 and the campaign target is the rational 1.9606141.9606141.960614.

The ledger lists all twelve source costs in their source order. costs instantiates them at the fixed parameters and c=232c=232c=232. The natural-number predicate clearedSwitch is the degree-four integer comparison of Section 4.2, with v=S−2b=159243801/500000000v=S-2b=159243801/500000000v=S−2b=159243801/500000000. ModelFeasible describes the relaxed fixed-expansion real cost model, including its whole-interval entropy inequality and all twelve charges. It is not a model of arbitrary 3SUM algorithms. Total logarithms, division and natural subtraction are unrestricted in these definitions; theorem hypotheses delimit the intended domains. The shared machine and decision-problem definitions are imported unchanged.

Definition code
import Mathlib

set_option autoImplicit false
set_option relaxedAutoImplicit false

noncomputable section

namespace ThreeSum1960614

noncomputable def entropy (t : ℝ) : ℝ := Real.binEntropy t / Real.log 2
noncomputable def E (c : ℕ) : ℝ := (c : ℝ) / 2 * entropy (1 / c)
noncomputable def kappa (c : ℕ) : ℝ :=
  2 * c * entropy (1 / (2 * c)) - c * entropy (1 / c) - 1
noncomputable def gamma (c : ℕ) (t : ℝ) : ℝ :=
  c * entropy (1 / c) - c * entropy ((1 - t) / c)
def phi (t : ℝ) : ℝ :=
  (785174904 * t + 72447023 * t ^ 2 + 24044466 * t ^ 3 + 12022459 * t ^ 4) / 100000000
def phiDeriv (t : ℝ) : ℝ :=
  (785174904 + 2 * 72447023 * t + 3 * 24044466 * t ^ 2 + 4 * 12022459 * t ^ 3) / 100000000
def epsilon : ℝ := 203889696 / 1000000000
def beta : ℝ := -(62656016 / 1000000000)
def saving : ℝ := 193175570 / 1000000000
def theta : ℝ := 40409899 / 1000000000
def tau : ℝ := 13 / 20
def rho : ℝ := 2790503 / 10000000
def tangentPoint : ℝ := 17200068185091493 / 100000000000000000
def principal : ℝ := 196061388 / 100000000
def target : ℚ := 1960614 / 1000000
def v : ℝ := saving - 2 * beta
def threshold (a : ℝ) : ℝ := (v + a) / (1 - a)
def ledger (e b S terminal ratio EE kk hh : ℝ) : List ℝ :=
  [2 * e * EE,
   1 + e * (EE - b),
   2 - e * S,
   2 - e * (1 / 2 + b - hh),
   2 - e * (1 / 2 - b - kk - ratio * (1 + S - 2 * b)),
   2 - e * (terminal - 1 / 2 - b - kk),
   e * (8 / 5) * (EE + 1 / 2),
   2 + e * (4 / 5 - (2 / 5) * EE - 2 * b),
   1 + e * (1 / 2 - b),
   2 - e * (EE + b),
   2 - 2 * e * (EE + b), 1]
noncomputable def costs : List ℝ :=
  ledger epsilon beta saving tau rho (E 232) (kappa 232) (entropy theta)
def clearedSwitch (J s j q : ℕ) : Prop :=
  let r := (J - j) * s
  500000000 * (J - j) *
    (785174904 * q * r ^ 3 + 72447023 * q ^ 2 * r ^ 2 +
     24044466 * q ^ 3 * r + 12022459 * q ^ 4) ≥
    100000000 * (159243801 * J + 500000000 * j) * r ^ 4
noncomputable def ModelFeasible (c : ℕ) (e b S th terminal ratio R : ℝ) : Prop :=
  0 < e ∧ e < 1 ∧ b < 0 ∧ 0 < S ∧
  0 ≤ th ∧ th ≤ 1 / 2 ∧ 0 ≤ terminal ∧ terminal < 1 ∧
  0 < ratio ∧ S - 2 * b ≤ gamma c th ∧
  (∀ t ∈ Set.Icc (0 : ℝ) (1 / 2), entropy t ≤ ratio * (1 + gamma c t)) ∧
  ∀ z ∈ ledger e b S terminal ratio (E c) (kappa c) (entropy th), z ≤ R

end ThreeSum1960614
Source
User-supplied 3sum_certificate_1p960614_v3/3sum_certificate_v3/PROOF.md (14 October 2026); Sections 1–5 and 7; upstream https://github.com/c0ldzy17/three-sum-lean/tree/2b639655e07421b9ac743de9090459bab473a7c0
Read-back

What the Lean code literally says, in plain math · GPT-6

Literal read-back

entropy. For every real number ttt, this definition returns the real number H(t)=(−tL(t)−(1−t)L(1−t))/ln⁡2H(t)=\bigl(-tL(t)-(1-t)L(1-t)\bigr)/\ln 2H(t)=(−tL(t)−(1−t)L(1−t))/ln2, where L(x)=ln⁡∣x∣L(x)=\ln|x|L(x)=ln∣x∣ for a nonzero real number xxx and L(0)=0L(0)=0L(0)=0. Thus the logarithm is a total real function, including negative arguments, and the formula is defined for every real ttt, with no restriction to the interval [0,1][0,1][0,1]. In particular, H(0)=H(1)=0H(0)=H(1)=0H(0)=H(1)=0 and H(1/2)=1H(1/2)=1H(1/2)=1; the denominator ln⁡2\ln 2ln2 is nonzero.

E. For every natural number ccc, including c=0c=0c=0, let CCC be the same number regarded as a real number. This definition returns C2H(1/C)\frac{C}{2}H(1/C)2C​H(1/C), where H(x)=(−xL(x)−(1−x)L(1−x))/ln⁡2H(x)=\bigl(-xL(x)-(1-x)L(1-x)\bigr)/\ln 2H(x)=(−xL(x)−(1−x)L(1−x))/ln2, L(y)=ln⁡∣y∣L(y)=\ln|y|L(y)=ln∣y∣ when y≠0y\ne0y=0, and L(0)=0L(0)=0L(0)=0. Real division is total and a real number divided by zero is zero, so when c=0c=0c=0 the argument 1/C1/C1/C is zero and the returned value is zero. The returned value is also zero when c=1c=1c=1.

kappa. For every natural number ccc, including zero, with CCC its value in the real numbers, this definition returns 2CH(1/(2C))−CH(1/C)−12C H\bigl(1/(2C)\bigr)-C H(1/C)-12CH(1/(2C))−CH(1/C)−1, where H(x)=(−xL(x)−(1−x)L(1−x))/ln⁡2H(x)=\bigl(-xL(x)-(1-x)L(1-x)\bigr)/\ln 2H(x)=(−xL(x)−(1−x)L(1−x))/ln2, L(y)=ln⁡∣y∣L(y)=\ln|y|L(y)=ln∣y∣ for y≠0y\ne0y=0, and L(0)=0L(0)=0L(0)=0. Every real division by zero has value zero. Consequently the returned value is −1-1−1 when c=0c=0c=0 and is 111 when c=1c=1c=1.

gamma. For every natural number ccc and every real number ttt, with CCC the real value of ccc, this definition returns CH(1/C)−CH((1−t)/C)C H(1/C)-C H\bigl((1-t)/C\bigr)CH(1/C)−CH((1−t)/C), where H(x)=(−xL(x)−(1−x)L(1−x))/ln⁡2H(x)=\bigl(-xL(x)-(1-x)L(1-x)\bigr)/\ln 2H(x)=(−xL(x)−(1−x)L(1−x))/ln2, L(y)=ln⁡∣y∣L(y)=\ln|y|L(y)=ln∣y∣ for y≠0y\ne0y=0, and L(0)=0L(0)=0L(0)=0. No interval restriction is imposed on ttt. Division by zero is zero, so for c=0c=0c=0 the result is zero for every ttt; for c=1c=1c=1 it is −H(1−t)-H(1-t)−H(1−t). For every ccc the result at t=0t=0t=0 is zero.

phi. For every real number ttt, this definition returns the real polynomial value (785174904t+72447023t2+24044466t3+12022459t4)/100000000\bigl(785174904t+72447023t^2+24044466t^3+12022459t^4\bigr)/100000000(785174904t+72447023t2+24044466t3+12022459t4)/100000000. All coefficients and the denominator are exact real values of the displayed integers, and there is no restriction on ttt.

phiDeriv. For every real number ttt, this definition returns the real polynomial value (785174904+2⋅72447023t+3⋅24044466t2+4⋅12022459t3)/100000000\bigl(785174904+2\cdot72447023t+3\cdot24044466t^2+4\cdot12022459t^3\bigr)/100000000(785174904+2⋅72447023t+3⋅24044466t2+4⋅12022459t3)/100000000. This declaration specifies that formula for every real input; it contains no hypothesis or assertion about differentiation.

epsilon. This definition has no arguments and returns the exact real number 203889696/1000000000203889696/1000000000203889696/1000000000.

beta. This definition has no arguments and returns the exact real number −(62656016/1000000000)-(62656016/1000000000)−(62656016/1000000000).

saving. This definition has no arguments and returns the exact real number 193175570/1000000000193175570/1000000000193175570/1000000000.

theta. This definition has no arguments and returns the exact real number 40409899/100000000040409899/100000000040409899/1000000000.

tau. This definition has no arguments and returns the exact real number 13/2013/2013/20.

rho. This definition has no arguments and returns the exact real number 2790503/100000002790503/100000002790503/10000000.

tangentPoint. This definition has no arguments and returns the exact real number 17200068185091493/10000000000000000017200068185091493/10000000000000000017200068185091493/100000000000000000.

principal. This definition has no arguments and returns the exact real number 196061388/100000000196061388/100000000196061388/100000000.

target. This definition has no arguments and returns the exact rational number 1960614/10000001960614/10000001960614/1000000.

v. This definition has no arguments and returns the real number 193175570/1000000000−2(−(62656016/1000000000))193175570/1000000000-2\bigl(-(62656016/1000000000)\bigr)193175570/1000000000−2(−(62656016/1000000000)), equivalently 159243801/500000000159243801/500000000159243801/500000000.

threshold. For every real number aaa, this definition returns (159243801/500000000+a)/(1−a)\bigl(159243801/500000000+a\bigr)/(1-a)(159243801/500000000+a)/(1−a). It includes the input a=1a=1a=1: since real division by zero is defined to be zero, the returned value at that input is zero.

ledger. For every eight real arguments e,b,S,d,p,A,K,Be,b,S,d,p,A,K,Be,b,S,d,p,A,K,B, corresponding in order to the parameters e,b,S,terminal,ratio,EE,kk,hhe,b,S,\mathit{terminal},\mathit{ratio},EE,kk,hhe,b,S,terminal,ratio,EE,kk,hh, this definition returns the ordered list of twelve real numbers [ 2eA, 1+e(A−b), 2−eS, 2−e(1/2+b−B), 2−e(1/2−b−K−p(1+S−2b)), 2−e(d−1/2−b−K), e(8/5)(A+1/2), 2+e(4/5−(2/5)A−2b), 1+e(1/2−b), 2−e(A+b), 2−2e(A+b), 1 ][\,2eA,\ 1+e(A-b),\ 2-eS,\ 2-e(1/2+b-B),\ 2-e\bigl(1/2-b-K-p(1+S-2b)\bigr),\ 2-e(d-1/2-b-K),\ e(8/5)(A+1/2),\ 2+e\bigl(4/5-(2/5)A-2b\bigr),\ 1+e(1/2-b),\ 2-e(A+b),\ 2-2e(A+b),\ 1\,][2eA, 1+e(A−b), 2−eS, 2−e(1/2+b−B), 2−e(1/2−b−K−p(1+S−2b)), 2−e(d−1/2−b−K), e(8/5)(A+1/2), 2+e(4/5−(2/5)A−2b), 1+e(1/2−b), 2−e(A+b), 2−2e(A+b), 1]. No positivity, sign, distinctness, or interval conditions are imposed on any argument; the list always has twelve entries, with its final entry equal to one, even when some entries coincide.

costs. This definition has no arguments and returns the following ordered list of twelve real numbers: [ 2eA, 1+e(A−b), 2−eS, 2−e(1/2+b−B), 2−e(1/2−b−K−p(1+S−2b)), 2−e(d−1/2−b−K), e(8/5)(A+1/2), 2+e(4/5−(2/5)A−2b), 1+e(1/2−b), 2−e(A+b), 2−2e(A+b), 1 ][\,2eA,\ 1+e(A-b),\ 2-eS,\ 2-e(1/2+b-B),\ 2-e\bigl(1/2-b-K-p(1+S-2b)\bigr),\ 2-e(d-1/2-b-K),\ e(8/5)(A+1/2),\ 2+e\bigl(4/5-(2/5)A-2b\bigr),\ 1+e(1/2-b),\ 2-e(A+b),\ 2-2e(A+b),\ 1\,][2eA, 1+e(A−b), 2−eS, 2−e(1/2+b−B), 2−e(1/2−b−K−p(1+S−2b)), 2−e(d−1/2−b−K), e(8/5)(A+1/2), 2+e(4/5−(2/5)A−2b), 1+e(1/2−b), 2−e(A+b), 2−2e(A+b), 1], where e=203889696/1000000000e=203889696/1000000000e=203889696/1000000000, b=−(62656016/1000000000)b=-(62656016/1000000000)b=−(62656016/1000000000), S=193175570/1000000000S=193175570/1000000000S=193175570/1000000000, d=13/20d=13/20d=13/20, p=2790503/10000000p=2790503/10000000p=2790503/10000000, A=116H(1/232)A=116H(1/232)A=116H(1/232), K=464H(1/464)−232H(1/232)−1K=464H(1/464)-232H(1/232)-1K=464H(1/464)−232H(1/232)−1, and B=H(40409899/1000000000)B=H(40409899/1000000000)B=H(40409899/1000000000). Here H(x)=(−xL(x)−(1−x)L(1−x))/ln⁡2H(x)=\bigl(-xL(x)-(1-x)L(1-x)\bigr)/\ln2H(x)=(−xL(x)−(1−x)L(1−x))/ln2, with L(y)=ln⁡∣y∣L(y)=\ln|y|L(y)=ln∣y∣ for y≠0y\ne0y=0 and L(0)=0L(0)=0L(0)=0. The displayed fractions and all arithmetic are exact real arithmetic, and the order of the twelve entries is part of the returned list.

clearedSwitch. For every four natural numbers J,s,j,qJ,s,j,qJ,s,j,q, including zero, this definition is the proposition 500000000d(785174904qr3+72447023q2r2+24044466q3r+12022459q4)≥100000000(159243801J+500000000j)r4500000000d\bigl(785174904qr^3+72447023q^2r^2+24044466q^3r+12022459q^4\bigr)\ge100000000(159243801J+500000000j)r^4500000000d(785174904qr3+72447023q2r2+24044466q3r+12022459q4)≥100000000(159243801J+500000000j)r4, where d=max⁡{J−j,0}d=\max\{J-j,0\}d=max{J−j,0} is natural subtraction truncated at zero and r=dsr=dsr=ds; all products, powers, additions, and the comparison in this formula are natural-number operations. There is no requirement that j<Jj<Jj<J, or that sss or qqq be positive. If j≥Jj\ge Jj≥J, both sides are zero and the proposition is true, so in particular it is true for every s,j,qs,j,qs,j,q when J=0J=0J=0; if s=0s=0s=0, the right-hand side is zero and the left-hand side is nonnegative, so it is again true. If j<Jj<Jj<J and s>0s>0s>0 but q=0q=0q=0, the left-hand side is zero and the right-hand side is positive, so the proposition is false.

ModelFeasible. For every natural number ccc and seven real numbers e,b,S,u,d,p,Re,b,S,u,d,p,Re,b,S,u,d,p,R, corresponding in order to e,b,S,th,terminal,ratio,Re,b,S,\mathit{th},\mathit{terminal},\mathit{ratio},Re,b,S,th,terminal,ratio,R, this definition is a proposition that is true exactly when all the following conditions hold together: 0<e<10<e<10<e<1, b<0b<0b<0, S>0S>0S>0, 0≤u≤1/20\le u\le1/20≤u≤1/2, 0≤d<10\le d<10≤d<1, p>0p>0p>0, S−2b≤G(u)S-2b\le G(u)S−2b≤G(u), for every real ttt with 0≤t≤1/20\le t\le1/20≤t≤1/2 one has H(t)≤p(1+G(t))H(t)\le p(1+G(t))H(t)≤p(1+G(t)), and every real number zzz belonging to the twelve-entry list [ 2eA, 1+e(A−b), 2−eS, 2−e(1/2+b−B), 2−e(1/2−b−K−p(1+S−2b)), 2−e(d−1/2−b−K), e(8/5)(A+1/2), 2+e(4/5−(2/5)A−2b), 1+e(1/2−b), 2−e(A+b), 2−2e(A+b), 1 ][\,2eA,\ 1+e(A-b),\ 2-eS,\ 2-e(1/2+b-B),\ 2-e\bigl(1/2-b-K-p(1+S-2b)\bigr),\ 2-e(d-1/2-b-K),\ e(8/5)(A+1/2),\ 2+e\bigl(4/5-(2/5)A-2b\bigr),\ 1+e(1/2-b),\ 2-e(A+b),\ 2-2e(A+b),\ 1\,][2eA, 1+e(A−b), 2−eS, 2−e(1/2+b−B), 2−e(1/2−b−K−p(1+S−2b)), 2−e(d−1/2−b−K), e(8/5)(A+1/2), 2+e(4/5−(2/5)A−2b), 1+e(1/2−b), 2−e(A+b), 2−2e(A+b), 1] satisfies z≤Rz\le Rz≤R. In these conditions, CCC is the real value of ccc, H(x)=(−xL(x)−(1−x)L(1−x))/ln⁡2H(x)=\bigl(-xL(x)-(1-x)L(1-x)\bigr)/\ln2H(x)=(−xL(x)−(1−x)L(1−x))/ln2, L(y)=ln⁡∣y∣L(y)=\ln|y|L(y)=ln∣y∣ for y≠0y\ne0y=0 and L(0)=0L(0)=0L(0)=0, G(t)=CH(1/C)−CH((1−t)/C)G(t)=C H(1/C)-C H((1-t)/C)G(t)=CH(1/C)−CH((1−t)/C), A=(C/2)H(1/C)A=(C/2)H(1/C)A=(C/2)H(1/C), K=2CH(1/(2C))−CH(1/C)−1K=2C H(1/(2C))-C H(1/C)-1K=2CH(1/(2C))−CH(1/C)−1, and B=H(u)B=H(u)B=H(u). All real divisions by zero have value zero. The interval in the universal condition includes both endpoints and is nonempty; the list condition is equivalently the simultaneous upper bound by RRR on each of its twelve entries, including 1≤R1\le R1≤R, regardless of repeated entries. The natural input c=0c=0c=0 is included but makes this proposition false, since then G(u)=0G(u)=0G(u)=0 whereas S−2b>0S-2b>0S−2b>0 under the other conditions; c=1c=1c=1 also makes it false, since then G(u)=−H(1−u)≤0G(u)=-H(1-u)\le0G(u)=−H(1−u)≤0 for 0≤u≤1/20\le u\le1/20≤u≤1/2.

Human review
  • Endorsed by Shuze Chen · Oct 14, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Yuxuan Xu · Oct 14, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me