Skip to content
Rainbow docs menu

Reference · Signed rationals

rainbow.math.rational.signed.clamp

Signed rationalssrc/rainbow/math/rational/signed/clamp.clj1 definitions, 7 theorems

Projection of a signed rational into a closed interval. clamp lower upper value = min (max lower value) upper For every ordered interval lower <= upper, the result lies in the interval. Values already in the interval are preserved up to signed equivalence; values below or above it saturate at the corresponding endpoint. Clamp is monotone in its value argument without any interval hypothesis, and respects signed equivalence in all three inputs. These are structural lattice proofs over signed min/max. They do not unfold rational arithmetic and introduce no axiom, making the operator reusable by projected optimization, box constraints, trust regions, and bounded monitors. Native and axiom-free on D63.

Depends onmath.rational.signed.minmax-algebra

signed/clamp

DefinitionSource, line 76

signed/clamp :
  (x₁ x₂ x₃ : ℚ)
  → ℚ

ℚ = signed/SignedRational

signed/clamp-lower

TheoremFor all inputsNo axiomsSource, line 85

signed/clamp-lower :
  (lower upper value : ℚ)
  (ordered : lower ≤ upper)
  → lower ≤ signed/clamp lower upper value

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

signed/clamp-upper

TheoremFor all inputsNo axiomsSource, line 100

signed/clamp-upper :
  (lower upper value : ℚ)
  → signed/clamp lower upper value ≤ upper

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

signed/clamp-in-band

TheoremFor all inputsNo axiomsSource, line 111

signed/clamp-in-band :
  (lower upper value : ℚ)
  (above-lower : lower ≤ value)
  (below-upper : value ≤ upper)
  → signed/clamp lower upper value = value

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

signed/clamp-monotone

TheoremFor all inputsNo axiomsSource, line 138

signed/clamp-monotone :
  (lower upper left right : ℚ)
  (ordered : left ≤ right)
  → signed/clamp lower upper left ≤ signed/clamp lower upper right

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

signed/clamp-respects-equivalence

TheoremFor all inputsNo axiomsSource, line 160

signed/clamp-respects-equivalence :
  (lower lower-prime upper upper-prime value value-prime : ℚ)
  (lower-same : lower = lower-prime)
  (upper-same : upper = upper-prime)
  (value-same : value = value-prime)
  → signed/clamp lower upper value = signed/clamp lower-prime upper-prime value-prime

= = signed/equivalent: equality of rational valuesℚ = signed/SignedRational

signed/clamp-below

TheoremFor all inputsNo axiomsSource, line 214

signed/clamp-below :
  (lower upper value : ℚ)
  (ordered : lower ≤ upper)
  (below : value ≤ lower)
  → signed/clamp lower upper value = lower

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

signed/clamp-above

TheoremFor all inputsNo axiomsSource, line 241

signed/clamp-above :
  (lower upper value : ℚ)
  (ordered : lower ≤ upper)
  (above : upper ≤ value)
  → signed/clamp lower upper value = upper

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