Reference · Non-negative rationals
rainbow.math.rational.nnrat.map-sum-zero
Every term of a vanishing finite nonnegative sum vanishes -- the sum-level form of nonnegativity-forces-zero, stated membership-free by positional split: nnrat/map-sum-zero-at-split : map-sum f (append ps (cons e qs)) ~ 0 -> f e ~ 0 i.e. if a sum over a list is ~ 0, the term at ANY position (identified by writing the list as ps ++ (e :: qs)) is ~ 0. This is the sum-level complementary slackness fact: a zero gap = sum of nonnegative slack terms ~ 0 forces every individual slack to 0. Proof: map-sum-append rewrites the sum to (S ps) + ((f e) + (S qs)); two uses of add-zero-split (right then left) peel off (f e). Polymorphic in the element type. Native and axiom-free; chains nnrat-map-sum-append and nnrat-add-zero-split on d63.
nnrat/map-sum-zero-at-split
nnrat/map-sum-zero-at-split.{u} :
(A : Type u) (f : A → ℚ≥0) (ps : List A) (e : A) (qs : List A)
(h : nnrat/map-sum A f (list/append A ps (data/cons A e qs)) = 0)
→ f e = 00 = nnrat/zero= = nnrat/equivalent: equality of rational valuesList = data/Listℚ≥0 = nnrat/NonnegativeRational