Skip to content
Rainbow docs menu

Reference · Signed rationals

rainbow.math.rational.signed.list-sum

Signed rationalssrc/rainbow/math/rational/signed/list_sum.clj1 definitions, 5 theorems

Finite sums of signed rationals over a list, and their order laws. signed/map-sum A f xs = f x0 + f x1 + ... + f xn (empty sum = 0) signed/map-sum-monotone : (forall x, f x <= g x) -> sum f xs <= sum g xs signed/map-sum-nonpositive : (forall x, f x <= 0) -> sum f xs <= 0 signed/map-sum-nonnegative : (forall x, 0 <= f x) -> 0 <= sum f xs The nnrat side already had `nnrat/map-sum`; the signed side had nothing, so every aggregate over signed quantities -- a Lagrangian penalty, a dot product, a total reward with sign -- had to stay abstract. These are the same List.rec folds: nil is order-reflexivity at `signed/zero`, cons is `signed/add-monotone` against the induction hypothesis, and the two sign versions additionally collapse the `0 + 0` produced in the cons step with `signed/add-zero-right`. Polymorphic in the index type. Native and axiom-free; chains signed order monotonicity and signed limit uniqueness (for signed/add-zero-right) on D63.

Depends onmath.rational.signed.limit-uniquenessmath.rational.signed.order-monotone

signed/map-sum

DefinitionSource, line 62

signed/map-sum.{u} :
  (A : Type u) (f : A → ℚ) (x₁ : List A)
  → ℚ

List = data/Listℚ = signed/SignedRational

signed/map-sum-empty

TheoremHolds by unfolding a definitionNo axiomsSource, line 78

signed/map-sum-empty.{u} :
  (A : Type u) (f : A → ℚ)
  → Σ j∈[], f j = 0

0 = signed/zero= = equality/EqΣ = signed/map-sum: sum over the listed indicesℚ = signed/SignedRational

signed/map-sum-cons

TheoremHolds by unfolding a definitionNo axiomsSource, line 85

signed/map-sum-cons.{u} :
  (A : Type u) (f : A → ℚ) (head : A) (tail : List A)
  → Σ j∈data/cons A head tail, f j = f head + Σ j∈tail, f j

+ = signed/add= = equality/EqList = data/ListΣ = signed/map-sum: sum over the listed indicesℚ = signed/SignedRational

signed/map-sum-monotone

TheoremFor all inputsNo axiomsSource, line 97

signed/map-sum-monotone.{u} :
  (A : Type u) (f g : A → ℚ)
  (hfg : ∀ (x : A), f x ≤ g x)
  (xs : List A)
  → Σ j∈xs, f j ≤ Σ j∈xs, g j

List = data/ListΣ = signed/map-sum: sum over the listed indicesℚ = signed/SignedRational≤ = signed/at-most

signed/map-sum-nonpositive

TheoremFor all inputsNo axiomsSource, line 126

signed/map-sum-nonpositive.{u} :
  (A : Type u) (f : A → ℚ)
  (hf : ∀ (x : A), f x ≤ 0)
  (xs : List A)
  → Σ j∈xs, f j ≤ 0

0 = signed/zeroList = data/ListΣ = signed/map-sum: sum over the listed indicesℚ = signed/SignedRational≤ = signed/at-most

signed/map-sum-nonnegative

TheoremFor all inputsNo axiomsSource, line 157

signed/map-sum-nonnegative.{u} :
  (A : Type u) (f : A → ℚ)
  (hf : ∀ (x : A), 0 ≤ f x)
  (xs : List A)
  → 0 ≤ Σ j∈xs, f j

0 = signed/zeroList = data/ListΣ = signed/map-sum: sum over the listed indicesℚ = signed/SignedRational≤ = signed/at-most