Entropy, quartic integer switch, twelve costs and fixed-expansion model
DefinitionThreeSum1960614_AnalysisDefines binary entropy in bits , , , and for natural expansion . The quartic is , with its polynomial derivative. The fixed rational parameters are , , , , , , and . The principal cost cap is and the campaign target is the rational .
The ledger lists all twelve source costs in their source order. costs instantiates them at the fixed parameters and . The natural-number predicate clearedSwitch is the degree-four integer comparison of Section 4.2, with . 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.
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
Read-back
What the Lean code literally says, in plain math · GPT-6
Literal read-back
entropy. For every real number , this definition returns the real number , where for a nonzero real number and . Thus the logarithm is a total real function, including negative arguments, and the formula is defined for every real , with no restriction to the interval . In particular, and ; the denominator is nonzero.
E. For every natural number , including , let be the same number regarded as a real number. This definition returns , where , when , and . Real division is total and a real number divided by zero is zero, so when the argument is zero and the returned value is zero. The returned value is also zero when .
kappa. For every natural number , including zero, with its value in the real numbers, this definition returns , where , for , and . Every real division by zero has value zero. Consequently the returned value is when and is when .
gamma. For every natural number and every real number , with the real value of , this definition returns , where , for , and . No interval restriction is imposed on . Division by zero is zero, so for the result is zero for every ; for it is . For every the result at is zero.
phi. For every real number , this definition returns the real polynomial value . All coefficients and the denominator are exact real values of the displayed integers, and there is no restriction on .
phiDeriv. For every real number , this definition returns the real polynomial value . 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 .
beta. This definition has no arguments and returns the exact real number .
saving. This definition has no arguments and returns the exact real number .
theta. This definition has no arguments and returns the exact real number .
tau. This definition has no arguments and returns the exact real number .
rho. This definition has no arguments and returns the exact real number .
tangentPoint. This definition has no arguments and returns the exact real number .
principal. This definition has no arguments and returns the exact real number .
target. This definition has no arguments and returns the exact rational number .
v. This definition has no arguments and returns the real number , equivalently .
threshold. For every real number , this definition returns . It includes the input : since real division by zero is defined to be zero, the returned value at that input is zero.
ledger. For every eight real arguments , corresponding in order to the parameters , this definition returns the ordered list of twelve real numbers . 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: , where , , , , , , , and . Here , with for and . 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 , including zero, this definition is the proposition , where is natural subtraction truncated at zero and ; all products, powers, additions, and the comparison in this formula are natural-number operations. There is no requirement that , or that or be positive. If , both sides are zero and the proposition is true, so in particular it is true for every when ; if , the right-hand side is zero and the left-hand side is nonnegative, so it is again true. If and but , the left-hand side is zero and the right-hand side is positive, so the proposition is false.
ModelFeasible. For every natural number and seven real numbers , corresponding in order to , this definition is a proposition that is true exactly when all the following conditions hold together: , , , , , , , for every real with one has , and every real number belonging to the twelve-entry list satisfies . In these conditions, is the real value of , , for and , , , , and . 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 on each of its twelve entries, including , regardless of repeated entries. The natural input is included but makes this proposition false, since then whereas under the other conditions; also makes it false, since then for .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.