Skip to content
Rainbow docs menu

Reference · Lemmas behind operations-research checks

rainbow.math.lemmas.weighted-median

Lemmas behind operations-research checkssrc/rainbow/math/lemmas/weighted_median.clj0 definitions, 11 theorems

General lemmas: weighted median. The mathematical facts the corresponding checks rest on, each checked by the kernel.

Depends onmath.sums.value-appendmath.nat.infinitemath.rational.nnrat.identitiesmath.nat.at-most-cancellationmath.rational.nnrat.order-equivalencemath.rational.nnrat.archimedeanmath.rational.nnrat.add-monotonemath.rational.nnrat.add-cancellationmath.rational.nnrat.additive-reassociationmath.rational.signed.order-transitivitymath.rational.signed.convergencemath.rational.signed.order-respectsmath.rational.signed.limit-uniquenessmath.rational.signed.strict-ordermath.rational.signed.multiplymath.rational.nnrat.multiply-commutemath.rational.nnrat.product-reassociationmath.rational.nnrat.distribute-rightmath.rational.nnrat.ringmath.rational.nnrat.multiply-monotonemath.rational.nnrat.order-differencemath.rational.signed.multiply-ordermath.rational.signed.equivalence-lawsmath.rational.nnrat.minmaxmath.rational.nnrat.farkas-elim-listmath.rational.signed.no-zero-divisorsmath.rational.signed.decide-ordermath.rational.signed.decide-reflexivemath.logic.boolean-andmath.rational.signed.decide-equivalencemath.rational.signed.decide-completenessmath.rational.signed.unit-lawsmath.nat.strict-below-splitmath.nat.strict-below-moremath.checksmath.nat.at-most-addmath.rational.nnrat.harmonic-convergencemath.nat.divmodmath.rational.signed.minmaxmath.rational.signed.minmax-algebramath.rational.signed.clampmath.rational.signed.deviation-rowsmath.rational.signed.absolutemath.rational.signed.absolute-algebramath.rational.signed.distancemath.nat.linear-ordermath.rational.signed.add-associativemath.nat.semiringmath.nat.multiply-zero-splitmath.rational.nnrat.multiply-zero-splitmath.nat.monusmath.rational.nnrat.monusmath.rational.nnrat.add-zero-splitmath.rational.nnrat.add-cancel-zeromath.finite.rational-argmaxmath.rational.nnrat.order-totalmath.rational.nnrat.multiply-difference-zeromath.linear.vector.norm-nonnegativemath.linear.vector.norm-zero-reflectionalgorithms.proofs.counterfactual-distance-separationalgorithms.proofs.counterfactual-distance-lawsmath.finite.matrixmath.linear.matrix.equivalencemath.linear.matrix.transposemath.linear.matrix.transpose-equivalencemath.linear.matrix.multiplymath.linear.matrix.multiply-shapemath.linear.matrix.composablemath.linear.matrix.composable-multiplymath.linear.vector.additive-unitsmath.linear.vector.shape-cancellationmath.linear.vector.shape-mapmath.linear.vector.shape-addmath.linear.vector.dot-additivemath.linear.vector.dot-bilinearmath.linear.vector.dot-negatemath.linear.vector.dot-subtractmath.linear.vector.dot-scalemath.linear.matrix.action-scalemath.rational.signed.multiply-nonzeromath.rational.signed.order-monotonemath.rational.signed.list-summath.rational.signed.multiply-monotonemath.rational.signed.map-sum-algebramath.rational.signed.negate-additivemath.rational.signed.lp-objective-negatemath.nat.pair-index-inversemath.sums.flow-cutmath.sums.nonneg-zeromath.rational.signed.multiply-ringmath.rational.signed.distributivemath.linear.matrix.row-length-shapemath.linear.matrix.row-length-decidermath.rational.signed.structural-equalitymath.linear.vector.equivalencemath.linear.vector.uniform-clampmath.linear.vector.pointwise-ordermath.linear.matrix.action-prependmath.linear.matrix.action-associativemath.linear.matrix.transpose-multiplymath.linear.matrix.transpose-shapemath.linear.matrix.transpose-involutionmath.linear.matrix.transpose-involution-positivemath.linear.matrix.transpose-multiply-reversemath.linear.matrix.composable-transposemath.linear.matrix.associativity-counterexamplemath.linear.matrix.signed-scalemath.linear.matrix.signed-scale-rightmath.linear.matrix.addmath.linear.matrix.add-shapemath.linear.matrix.prepend-addmath.linear.matrix.add-rightmath.linear.matrix.add-algebramath.linear.matrix.additive-groupmath.linear.matrix.negate-linearmath.linear.matrix.subtract-linearmath.linear.matrix.signed-scale-algebramath.linear.matrix.signed-scale-unitsmath.linear.matrix.signed-scale-congruencemath.linear.matrix.signed-scale-subtractmath.rational.signed.distance-multiply-nonnegativemath.rational.signed.vector-sup-distancealgorithms.proofs.inner-productmath.rational.signed.distance-trianglemath.rational.signed.distance-translationmath.rational.signed.distance-additivemath.linear.vector.dot-distance-boundmath.linear.vector.row-sum-lipschitzmath.linear.matrix.action-sup-boundmath.linear.matrix.signed-scale-ordermath.linear.matrix.pointwise-order-lawsmath.linear.matrix.signed-scale-antitonemath.linear.matrix.add-ordermath.linear.matrix.signed-scale-positivemath.linear.matrix.signed-scale-signmath.linear.matrix.positive-actionmath.linear.matrix.transpose-ordermath.linear.matrix.positive-multiplymath.linear.matrix.gram-positivemath.linear.matrix.gram-kernelmath.linear.matrix.row-grammath.linear.matrix.row-gram-kernelmath.linear.vector.norm-pythagoreanmath.linear.matrix.least-squares-normalmath.linear.matrix.least-squares-equalitymath.linear.matrix.mixed-sign-actionmath.linear.matrix.mixed-sign-multiplymath.linear.matrix.antitonemath.linear.matrix.interval-ordermath.linear.matrix.affine-ordermath.linear.matrix.linearmath.rational.signed.vector-sup-congruencemath.finite.vectormath.linear.vector.pointwise-order-lawsmath.linear.vector.add-ordermath.rational.signed.vector-sup-translationmath.linear.matrix.affine-sup-distancemath.linear.matrix.row-sum-lipschitzmath.linear.matrix.row-sum-fixed-point-uniquenessmath.linear.matrix.half-row-sum-fixed-point-uniquenessmath.linear.matrix.affine-half-iterate-contractionmath.linear.matrix.affine-half-iterate-ratemath.rational.signed.geometric-bridgemath.linear.matrix.affine-half-iterate-convergesmath.linear.matrix.affine-strong-row-contractionmath.linear.matrix.affine-residual-certificatemath.linear.matrix.affine-inverse-gap-certificatemath.linear.matrix.affine-general-rate-certificatemath.sums.of-natmath.lemmas.one-centermath.rational.signed.multiply-associative

signed/difference-at-most-reverse

TheoremFor all inputsNo axiomsSource

signed/difference-at-most-reverse :
  (u v : ℚ)
  (h : u ≤ v)
  → u + signed/negate v ≤ v + signed/negate u

+ = signed/addℚ = signed/SignedRational≤ = signed/at-most

signed/decided-abs-at-least-difference

TheoremFor all inputsNo axiomsSource

signed/decided-abs-at-least-difference :
  (p x : ℚ)
  → p + signed/negate x ≤ data/Bool.rec (fun x₄ => ℚ) (p + signed/negate x) (x + signed/negate p) (signed/decide-at-most p x)

+ = signed/addℚ = signed/SignedRational≤ = signed/at-most

signed/decided-abs-at-least-reverse-difference

TheoremFor all inputsNo axiomsSource

signed/decided-abs-at-least-reverse-difference :
  (p x : ℚ)
  → x + signed/negate p ≤ data/Bool.rec (fun x₄ => ℚ) (p + signed/negate x) (x + signed/negate p) (signed/decide-at-most p x)

+ = signed/addℚ = signed/SignedRational≤ = signed/at-most

signed/decided-abs-when-left

TheoremFor all inputsNo axiomsSource

signed/decided-abs-when-left :
  (p x : ℚ)
  (h : p ≤ x)
  → data/Bool.rec (fun x₄ => ℚ) (p + signed/negate x) (x + signed/negate p) (signed/decide-at-most p x) = x + signed/negate p

+ = signed/add= = signed/equivalent: equality of rational valuesℚ = signed/SignedRational≤ = signed/at-most

signed/decided-abs-when-right

TheoremFor all inputsNo axiomsSource

signed/decided-abs-when-right :
  (p x : ℚ)
  (h : x ≤ p)
  → data/Bool.rec (fun x₄ => ℚ) (p + signed/negate x) (x + signed/negate p) (signed/decide-at-most p x) = p + signed/negate x

+ = signed/add= = signed/equivalent: equality of rational valuesℚ = signed/SignedRational≤ = signed/at-most

signed/abs-shift-right

TheoremFor all inputsNo axiomsSource

signed/abs-shift-right :
  (p x y : ℚ)
  → data/Bool.rec (fun x₄ => ℚ) (p + signed/negate x) (x + signed/negate p) (signed/decide-at-most p x) + (y + signed/negate x) + signed/negate (data/Bool.rec (fun x₈ => ℚ) 1 0 (signed/decide-at-most p x) · (y + signed/negate x + (y + signed/negate x))) ≤ data/Bool.rec (fun x₁₂ => ℚ) (p + signed/negate y) (y + signed/negate p) (signed/decide-at-most p y)

+ = signed/add0 = signed/zero1 = signed/one· = signed/multiplyℚ = signed/SignedRational≤ = signed/at-most

signed/abs-shift-left

TheoremFor all inputsNo axiomsSource

signed/abs-shift-left :
  (p x y : ℚ)
  → data/Bool.rec (fun x₄ => ℚ) (p + signed/negate x) (x + signed/negate p) (signed/decide-at-most p x) + (x + signed/negate y) + signed/negate (data/Bool.rec (fun x₈ => ℚ) 1 0 (signed/decide-at-most x p) · (x + signed/negate y + (x + signed/negate y))) ≤ data/Bool.rec (fun x₁₂ => ℚ) (p + signed/negate y) (y + signed/negate p) (signed/decide-at-most p y)

+ = signed/add0 = signed/zero1 = signed/one· = signed/multiplyℚ = signed/SignedRational≤ = signed/at-most

signed/weighted-shift-expand

TheoremFor all inputsNo axiomsSource

signed/weighted-shift-expand :
  (w ab d i : ℚ)
  → w · (ab + d + signed/negate (i · (d + d))) = w · ab + w · d + signed/negate (i · w · (d + d))

+ = signed/add= = signed/equivalent: equality of rational values· = signed/multiplyℚ = signed/SignedRational

signed/median-gain

TheoremFor all inputsNo axiomsSource

signed/median-gain :
  (C W S d : ℚ)
  (hd : 0 ≤ d)
  (hs : signed/from-nnrat 2 · S ≤ W)
  → C ≤ C + W · d + signed/negate (S · (d + d))

+ = signed/add0 = signed/zero· = signed/multiplyℚ = signed/SignedRational≤ = signed/at-most

signed/weighted-abs-shift-sum

TheoremFor all inputsNo axiomsSource

signed/weighted-abs-shift-sum :
  (a w I : ℕ → ℚ) (x y d : ℚ) (n : ℕ)
  (hw : ∀ (idx : ℕ), ∀ (bound : nat/strict-below idx n), 0 ≤ w idx)
  (hpt : ∀ (idx : ℕ), ∀ (bound : nat/strict-below idx n), data/Bool.rec (fun x₁ => ℚ) (a idx + signed/negate x) (x + signed/negate (a idx)) (signed/decide-at-most (a idx) x) + d + signed/negate (I idx · (d + d)) ≤ data/Bool.rec (fun x₂ => ℚ) (a idx + signed/negate y) (y + signed/negate (a idx)) (signed/decide-at-most (a idx) y))
  (hd : 0 ≤ d)
  (hside : signed/from-nnrat 2 · signed/expr-sum-value (fun si => I si · w si) n ≤ signed/expr-sum-value (fun tw => w tw) n)
  → signed/expr-sum-value (fun sa => w sa · data/Bool.rec (fun x₄ => ℚ) (a sa + signed/negate x) (x + signed/negate (a sa)) (signed/decide-at-most (a sa) x)) n ≤ signed/expr-sum-value (fun sy => w sy · data/Bool.rec (fun x₆ => ℚ) (a sy + signed/negate y) (y + signed/negate (a sy)) (signed/decide-at-most (a sy) y)) n

+ = signed/add0 = signed/zero· = signed/multiplyℕ = data/Natℚ = signed/SignedRational≤ = signed/at-most

signed/weighted-median-optimal

TheoremFor all inputsNo axiomsSource

signed/weighted-median-optimal :
  (a w : ℕ → ℚ) (x y C : ℚ) (n : ℕ)
  (hw : ∀ (idx : ℕ), ∀ (bound : nat/strict-below idx n), 0 ≤ w idx)
  (hL : signed/from-nnrat 2 · signed/expr-sum-value (fun sw => data/Bool.rec (fun x₆ => ℚ) 1 0 (signed/decide-at-most x (a sw)) · w sw) n ≤ value)
  (hR : signed/from-nnrat 2 · signed/expr-sum-value (fun sw => data/Bool.rec (fun x₁₂ => ℚ) 1 0 (signed/decide-at-most (a sw) x) · w sw) n ≤ value)
  (hC : C = signed/expr-sum-value (fun cs => w cs · data/Bool.rec (fun x₁₄ => ℚ) (a cs + signed/negate x) (x + signed/negate (a cs)) (signed/decide-at-most (a cs) x)) n)
  → C ≤ signed/expr-sum-value (fun cs => w cs · data/Bool.rec (fun x₁₆ => ℚ) (a cs + signed/negate y) (y + signed/negate (a cs)) (signed/decide-at-most (a cs) y)) n
  where value := signed/expr-sum-value (fun tw => w tw) n

+ = signed/add0 = signed/zero1 = signed/one= = signed/equivalent: equality of rational values· = signed/multiplyℕ = data/Natℚ = signed/SignedRational≤ = signed/at-most