Interval arithmetic #
This file defines arithmetic operations on intervals and prove their correctness. Note that this is
full precision operations. The essentials of float operations can be found
in Data.FP.Basic
. We have not yet integrated these with the rest of the library.
One/zero #
Equations
- instZeroNonemptyIntervalToLE = { zero := NonemptyInterval.pure 0 }
Equations
- instOneNonemptyIntervalToLE = { one := NonemptyInterval.pure 1 }
Addition/multiplication #
Note that this multiplication does not apply to ℚ
or ℝ
.
Equations
- instAddIntervalToLE = { add := Option.map₂ fun (x x_1 : NonemptyInterval α) => x + x_1 }
Equations
- instMulIntervalToLE = { mul := Option.map₂ fun (x x_1 : NonemptyInterval α) => x * x_1 }
Powers #
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Subtraction #
Subtraction is defined more generally than division so that it applies to ℕ
(and OrderedDiv
is not a thing and probably should not become one).
Equations
- One or more equations did not get rendered due to their size.
Equations
- instSubIntervalToLE = { sub := Option.map₂ Sub.sub }
Division in ordered groups #
Note that this division does not apply to ℚ
or ℝ
.
Equations
- One or more equations did not get rendered due to their size.
Equations
- instDivIntervalToLE = { div := Option.map₂ fun (x x_1 : NonemptyInterval α) => x / x_1 }
Negation/inversion #
Equations
- One or more equations did not get rendered due to their size.
Equations
- instNegIntervalToLEToPreorderToPartialOrder = { neg := Option.map Neg.neg }
Equations
- instInvIntervalToLEToPreorderToPartialOrder = { inv := Option.map Inv.inv }
Equations
- NonemptyInterval.subtractionCommMonoid = let src := NonemptyInterval.addCommMonoid; SubtractionCommMonoid.mk (_ : ∀ (a b : NonemptyInterval α), a + b = b + a)
Equations
- NonemptyInterval.divisionCommMonoid = let src := NonemptyInterval.commMonoid; DivisionCommMonoid.mk (_ : ∀ (a b : NonemptyInterval α), a * b = b * a)
The length of an interval is its first component minus its second component. This measures the accuracy of the approximation by an interval.
Equations
- NonemptyInterval.length s = s.toProd.2 - s.toProd.1
Instances For
The length of an interval is its first component minus its second component. This measures the accuracy of the approximation by an interval.
Equations
- Interval.length x = match x with | none => 0 | some s => NonemptyInterval.length s
Instances For
Extension for the positivity
tactic: The length of an interval is always nonnegative.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Extension for the positivity
tactic: The length of an interval is always nonnegative.
Equations
- One or more equations did not get rendered due to their size.