Expand description

Formal introduction to interval arithmetic

This article describes interval arithmetic (IA) implemented in the crate. The variation of IA is the one defined as the set-based flavor in the IEEE 1788 standards.

Intervals

An interval is a closed, convex subset of $\R$, the set of all real numbers. By definition, $βˆ…$, the empty set as well as $\R$ are also intervals. The notations of intervals are summarized below:

Interval notationDefinitionBounded in $\R$
$βˆ…$$βˆ…$, the empty setYes
$[a, b]$$\set{x ∈ \R ∣ a ≀ x ≀ b}$, where $a, b ∈ \R ∧ a ≀ b$Yes
$[a, +∞]$$\set{x ∈ \R ∣ a ≀ x}$, where $a ∈ \R$No
$[-∞, b]$$\set{x ∈ \R ∣ x ≀ b}$, where $b ∈ \R$No
$\R$ or $[-∞, +∞]$$\R$, the set of all real numbersNo

The notation above can be rationalized by introducing the extended real numbers $\XR$, which is a superset of $\R$ with two extra elements, $+∞$ and $-∞$:

$$ \XR = \R βˆͺ \set{+∞, -∞}. $$

$\XR$ is a totally ordered set extending the standard ordering of $\R$ with the following rule:

$$ βˆ€x ∈ \R : -∞ < x < +∞. $$

Every subset of $\XR$ has both an infimum and a supremum in $\XR$.

Now we can write $\IR βŠ† \powerset(\R)$, the set of all intervals as:

$$ \IR = \set βˆ… βˆͺ \set{[a, b] ∣ a ∈ \XR βˆ– \set{+∞} ∧ b ∈ \XR βˆ– \set{-∞} ∧ a ≀ b}, $$

where

$$ [a, b] = \set{x ∈ \R ∣ a ≀ x ≀ b}. $$

An interval is denoted by a bold letter such as $𝒙$ or $π’š$. An $n$-tuple of intervals $(𝒙_1, …, 𝒙_n) ∈ \IR^n$ is also denoted by $𝒙$.

Let $𝒙 ∈ \IR$. The infimum and the supremum of $𝒙$ in $\XR$ are called the lower bound and the upper bound of $𝒙$, respectively. In particular,

$$ \begin{align*} \inf 𝒙 &= \begin{cases} +∞ & \if 𝒙 = βˆ…, \\ a & \if 𝒙 = [a, b], \end{cases} \\ \sup 𝒙 &= \begin{cases} -∞ & \if 𝒙 = βˆ…, \\ b & \if 𝒙 = [a, b]. \end{cases} \end{align*} $$

Note that while the bounds of an interval are members of $\XR$, the interval itself is a subset of $\R$. Therefore, neither $+∞$ nor $-∞$ can belong to an interval.

Interval extensions of functions

Let $n β‰₯ 0$, $X βŠ† \R^n$ and $f : X β†’ \R$. A function $𝒇 : \IR^n β†’ \IR$ is said to be an interval extension of $f$ if and only if:

$$ βˆ€π’™ ∈ \IR^n : 𝒇(𝒙) βŠ‡ \Range(f, 𝒙), $$

where

$$ \Range(f, 𝒙) = \set{f(x_1, …, x_n) ∣ (βˆ€i ∈ \set{1, …, n} : x_i ∈ 𝒙_i) ∧ (x_1, …, x_n) ∈ X}. $$

Let $\hull : \powerset(\R) β†’ \IR$ be the function that maps every subset of $\R$ to its tightest enclosure in $\IR$:

$$ \begin{align*} \hull(X) &= \operatorname{min_βŠ†} \set{𝒙 ∈ \IR ∣ 𝒙 βŠ‡ X} \\ &= \begin{cases} βˆ… & \if X = βˆ…, \\ [\inf X, \sup X] & \otherwise. \end{cases} \end{align*} $$

The natural interval extension of $f$ is the interval extension of $f$ that maps every $𝒙 ∈ \IR^n$ to the tightest enclosure of $\Range(f, 𝒙)$ in $\IR$:

$$ 𝒇(𝒙) = \hull(\Range(f, 𝒙)). $$

Let $𝒇$ be the natural interval extension of $f$. The following holds:

$$ βˆ€π’™ ∈ \IR^n : [(βˆƒi ∈ \set{1, …, n} : 𝒙_i = βˆ…) ⟹ 𝒇(𝒙) = βˆ…]. $$

Examples

Here are some examples of the natural interval extensions of functions. The trivial cases where any of the arguments is $βˆ…$ are omitted.

  1. Square root $\sqrt{β‹…} : [0, ∞) β†’ \R$:

    $$ \sqrt{[a, b]} = \begin{cases} βˆ… & \if b < 0, \\ [0, \sqrt{b}] & \if a ≀ 0 ≀ b, \\ [\sqrt{a}, \sqrt{b}] & \otherwise, \end{cases} $$

    where $\sqrt{+∞} = +∞$.

  2. Addition $+ : \R Γ— \R β†’ \R$ and subtraction $- : \R Γ— \R β†’ \R$:

    $$ \begin{align*} [a, b] + [c, d] &= [a + c, b + d], \\ [a, b] - [c, d] &= [a - d, b - c] = [a + (-d), b + (-c)], \end{align*} $$

    where

    $$ \begin{gather*} βˆ€x ∈ \R βˆͺ \set{+∞} : x + (+∞) = +∞ + x = +∞, \\ βˆ€x ∈ \R βˆͺ \set{-∞} : x + (-∞) = -∞ + x = -∞, \\ -(±∞) = βˆ“βˆž. \end{gather*} $$

    Note that addition of extended real numbers is not defined for every pair. Specifically, $+∞ + (-∞)$ and $-∞ + (+∞)$ are left undefined.

  3. Multiplication $Γ— : \R Γ— \R β†’ \R$:

    $[a, b] Γ— [c, d] =$

    $d ≀ 0$$c < 0 < d$$0 ≀ c$
    $b ≀ 0$$[bd, ac]$$[ad, ac]$$[ad, bc]$
    $a < 0 < b$$[bc, ac]$$[\min \set{ad, bc}, \max \set{ac, bd}]$$[ad, bd]$
    $0 ≀ a$$[bc, ad]$$[bc, bd]$$[ac, bd]$

    where

    $$ βˆ€x ∈ \XR βˆ– \set 0 : x Γ— (±∞) = ±∞ Γ— x = \begin{cases} ±∞ & \if x > 0, \\ βˆ“βˆž & \if x < 0. \end{cases} $$

  4. Division $/ : \R Γ— \R βˆ– \set 0 β†’ \R$:

    $[a, b]/[c, d] =$

    $d < 0$$c < 0 ∧ d = 0$$c = d = 0$$c < 0 < d$$c = 0 ∧ 0 < d$$0 < c$
    $b ≀ 0$$[b/c, a/d]$$[b/c, +∞]$$βˆ…$$\R$$[-∞, b/d]$$[a/c, b/d]$
    $a = 0 = b$$[0, 0]$$[0, 0]$$βˆ…$$[0, 0]$$[0, 0]$$[0, 0]$
    $a < 0 < b$$[b/d, a/d]$$\R$$βˆ…$$\R$$\R$$[a/c, b/c]$
    $0 ≀ a$$[b/d, a/c]$$[-∞, a/c]$$βˆ…$$\R$$[a/d, +∞]$$[a/d, b/c]$

    where

    $$ \begin{gather*} βˆ€x ∈ \R : \frac{x}{±∞} = 0, \\ βˆ€x ∈ \R βˆ– \set 0 : \frac{±∞}{x} = \begin{cases} ±∞ & \if x > 0, \\ βˆ“βˆž & \if x < 0. \end{cases} \end{gather*} $$

Constants

Let’s consider the case of $n = 0$. A real-valued function whose domain is a subset of $\R^0$ is called a real constant. Note that $S^0 = \set βˆ…$ for any set $S$, thus $\R^0 = \set βˆ…$. Therefore, the domain of a real constant is either $\set βˆ…$ or $βˆ…$. In both cases, an interval extension of $f$ is of the form $𝒇 : \IR^0 β†’ \IR$.

  1. Let $c ∈ \R$, $X = \set βˆ… βŠ† \R^0$ and $f : X β†’ \R$ be the function that maps $βˆ…$ to $c$. The natural interval extension of $f$ is the function that maps $βˆ…$ to $[c, c]$.

    In the standard, $f$ is identified with the real number $c$. Following this convention, we may just say β€œ$𝒄 ∈ \IR$ is an interval extension of $c ∈ \R$” when we mean that the function that maps $βˆ…$ to $𝒄$ is an interval extension of the function that maps $βˆ…$ to $c$.

  2. Let $X = βˆ… βŠ† \R^0$ and $f : X β†’ \R$ be the empty function. The natural interval extension of $f$ is the function that maps $βˆ…$ to $βˆ…$.

$\IF$-interval extensions of functions

Floating-point arithmetic (FA) is an approximation of the extended real number arithmetic with a nice trade-off between magnitude and accuracy of numbers. The crate provides an efficient implementation of IA by using the binary64 floating-point numbers (the f64 type) for representing and computing with intervals. Consult the IEEE 754 standards for the details of FA.

We denote by $\F βŠ† \XR$ the set of all finite f64 numbers, $+∞$ and $-∞$. We refer to a member of $\F$ as a $\F$-number.

We denote by $\IF βŠ† \IR$ the set of intervals whose bounds are $\F$-numbers:

$$ \IF = \set βˆ… βˆͺ \set{[a, b] ∣ a ∈ \F βˆ– \set{+∞} ∧ b ∈ \F βˆ– \set{-∞} ∧ a ≀ b}. $$

Let $n β‰₯ 0$, $X βŠ† \R^n$ and $f : X β†’ \R$. A function $𝚏 : \IF^n β†’ \IF$ is said to be an $\IF$-interval extension of $f$ if and only if:

$$ βˆ€πš‘ ∈ \IF^n : 𝚏(𝚑) βŠ‡ \Range(f, 𝚑). $$

Let $\fldown$ and $\flup : \XR β†’ \F$ be the functions that maps every $x ∈ \XR$ to the closest $\F$-number toward $-∞$ and $+∞$ respectively:

$$ \begin{align*} \fldown(x) &= \max \set{y ∈ \F ∣ y ≀ x}, \\ \flup(x) &= \min \set{y ∈ \F ∣ x ≀ y}. \end{align*} $$

Let $\fhull : \powerset(\R) β†’ \IF$ be the function that maps every subset of $\R$ to its tightest enclosure in $\IF$:

$$ \begin{align*} \fhull(X) &= \operatorname{min_βŠ†} \set{𝚑 ∈ \IF ∣ 𝚑 βŠ‡ X} \\ &= \begin{cases} βˆ… & \if X = βˆ…, \\ [\fldown(\inf X), \flup(\sup X)] & \otherwise. \end{cases} \end{align*} $$

The tightest $\IF$-interval extension of $f$ is the $\IF$-interval extension of $f$ that maps every $𝚑 ∈ \IF^n$ to the tightest enclosure of $\Range(f, 𝚑)$ in $\IF$:

$$ 𝚏(𝚑) = \fhull(\Range(f, 𝚑)). $$

Examples

Here are some examples of the tightest $\IF$-interval extensions of functions.

  1. Addition $+ : \R Γ— \R β†’ \R$:

    $$ \operatorname{𝚊𝚍𝚍}([𝚊, πš‹], [𝚌, 𝚍]) = [\fldown(𝚊 + 𝚌), \flup(πš‹ + 𝚍)]. $$

  2. $Ο€ = 3.14159265358979323…$:

    $$ {πš™πš’} = [\mathtt{3.14159265358979311…}, \mathtt{3.14159265358979356…}]. $$

The decoration system

The decoration system gives us some additional information on the underlying function of an interval extension being evaluated, such as whether its value is defined or whether it is continuous on the input intervals.

We denote by $\D$ the set of decorations:

$$ \D = \set{\com, \dac, \def, \trv, \ill}. $$

Their names are abbreviations of common, defined and continuous, defined, trivial and ill-formed, respectively. $\D$ is a totally ordered set with the following ordering rules:

$$ \com > \dac > \def > \trv > \ill. $$

Let $n β‰₯ 0$, $X βŠ† \R^n$, $f : X β†’ \R$, $𝒙 ∈ \IR^n$ and $π’š ∈ \IR$. We define the following predicates:

$$ \begin{align*} p_\com(f, 𝒙, π’š) &:⟺ p_\def(f, 𝒙, π’š) ∧ [βˆ€i ∈ \set{1, …, n} : (𝒙_i \text{ is bounded})] ∧ (f \text{ is continuous on } 𝒙) ∧ (π’š \text{ is bounded}), \\ p_\dac(f, 𝒙, π’š) &:⟺ p_\def(f, 𝒙, π’š) ∧ (f{β†Ύ_𝒙} \text{ is continuous on } 𝒙), \\ p_\def(f, 𝒙, π’š) &:⟺ X β‰  βˆ… ∧ 𝒙 βŠ† X ∧ βˆ€i ∈ \set{1, …, n} : 𝒙_i β‰  βˆ…, \\ p_\trv(f, 𝒙, π’š) &:⟺ (\text{always true}), \\ p_\ill(f, 𝒙, π’š) &:⟺ X = βˆ…, \end{align*} $$

where $f{β†Ύ_𝒙}$ is the restriction of $f$ to $𝒙$. The following implications hold:

$$ \begin{gather*} p_\com(f, 𝒙, π’š) ⟹ p_\dac(f, 𝒙, π’š) ⟹ p_\def(f, 𝒙, π’š) ⟹ p_\trv(f, 𝒙, π’š), \\ p_\ill(f, 𝒙, π’š) ⟹ p_\trv(f, 𝒙, π’š). \end{gather*} $$

$d$ is said to be the strongest decoration of $(f, 𝒙, π’š)$ if and only if:

$$ d = \begin{cases} \com & \if p_\com(f, 𝒙, π’š), \\ \dac & \if p_\dac(f, 𝒙, π’š) ∧ Β¬p_\com(f, 𝒙, π’š), \\ \def & \if p_\def(f, 𝒙, π’š) ∧ Β¬p_\dac(f, 𝒙, π’š), \\ \ill & \if p_\ill(f, 𝒙, π’š), \\ \trv & \otherwise. \end{cases} $$

Let $𝒙 ∈ \IR, d ∈ \D$. A decorated interval is a pair $(𝒙, d)$ of the following combinations:

Interval $𝒙$Decoration $d$
Nonempty and bounded$\com, \dac, \def, \trv$ or $\ill$
Unbounded$\dac, \def, \trv$ or $\ill$
Empty$\trv$ or $\ill$

We denote by $\DIR$ the set of all decorated intervals.

  • [Advanced] Fundamentally, $\DIR$ is defined as the set of pairs $(π’š, dy)$ that satisfies:

    $$ βˆƒn β‰₯ 0, X βŠ† \R^n, f ∈ \R^X, 𝒙 ∈ \IR^n : [π’š βŠ‡ \Range(f, 𝒙) ∧ p_{dy}(f, 𝒙, π’š)]. $$

    By substituting $n = 0$, $X = βˆ…$, $f : βˆ… β†’ \R$ (the empty function) and $𝒙 = βˆ…$ into the above statement, we see that for any $π’š ∈ \IR$, $(π’š, \ill)$ is a decorated interval.

A decorated interval $(𝒙, d) ∈ \DIR$ is alternatively written as $𝒙_d$, thus $[1, 2]_\com = ([1, 2], \com)$. We also write an $n$-tuple of decorated intervals $({𝒙_1}_{d_1}, …, {𝒙_n}_{d_n}) ∈ \DIR^n$ as $𝒙_d$.

Let $Ο€_I^{(n)} : \DIR^n βˆ‹ 𝒙_d ↦ 𝒙 ∈ \IR^n$ and $Ο€_D^{(n)} : \DIR^n βˆ‹ 𝒙_d ↦ d ∈ \D^n$ be the functions that maps a decorated interval (or a tuple of them) to its interval part and decoration part, respectively. Let $Ο€_I = Ο€_I^{(1)}$ and $Ο€_D = Ο€_D^{(1)}$.

Let $n β‰₯ 0$, $X βŠ† \R^n$ and $f : X β†’ \R$. A function $𝒇 : \DIR^n β†’ \DIR$ is said to be a decorated interval extension of $f$ if and only if there exists $𝒇_I : \IR^n β†’ \IR$ such that $𝒇_I$ is an interval extension of $f$ and $𝒇_I ∘ Ο€_I^{(n)} = Ο€_I ∘ 𝒇$ holds, and the following also holds:

$$ βˆ€π’™_{dx} ∈ \DIR^n, βˆƒd ∈ \D : [p_d(f, 𝒙, π’š) ∧ dy = \min \set{d, dx_1, …, dx_n}], $$

where $π’š$ and $dy$ represents $Ο€_I(𝒇(𝒙_{dx}))$ and $Ο€_D(𝒇(𝒙_{dx}))$, respectively.

Let $𝒇$ be a decorated interval extension of $f$. The following holds:

$$ βˆ€π’™_d ∈ \DIR^n : [(βˆƒi ∈ \set{1, …, n} : d_i = \ill) ⟹ Ο€_D(𝒇(𝒙_d)) = \ill]. $$

Any interval decorated with $\ill$ is said to be NaI (Not an Interval). A NaI is produced by an invalid construction of a (decorated) interval, and it is propagated through evaluation.

$\DIF$, the decorated version of $\IF$ and relevant properties are derived in the same manner as we did in the previous section.

Examples

  1. Let $\ffloor : \DIF β†’ \DIF$ be the tightest, strongest-decorated interval extension of the floor function $⌊{β‹…}βŒ‹ : \R β†’ \R$. Then,

    $$ \tag{a} \ffloor([\mathtt{1.25}, \mathtt{1.5}]_\com) = [\mathtt{1}, \mathtt{1}]_\com, $$

    $$ \tag{b} \ffloor([\mathtt{0.5}, \mathtt{1.5}]_\com) = [\mathtt{0}, \mathtt{1}]_\def, $$

    $$ \tag{c} \ffloor([\mathtt{1}, \mathtt{1.5}]_\com) = [\mathtt{1}, \mathtt{1}]_\dac. $$

    In (a), the result is decorated with $\com$ because $⌊{β‹…}βŒ‹$ is continuous on $[1.25, 1.75]$.

    In (b), the result is decorated with $\def$ because $⌊{β‹…}βŒ‹$ is discontinuous at 1.

    In (c), the result is decorated with $\dac$ because while $⌊{β‹…}βŒ‹$ is discontinuous at 1, the restriction of the function to $𝒙 = [1, 1.5]$ is continuous on $𝒙$.

  2. Let $\fsqrt : \DIF β†’ \DIF$ be the tightest, strongest-decorated interval extension of $\sqrt{β‹…} : [0, ∞) β†’ \R$. Then,

    $$ \begin{align*} \fsqrt([\mathtt{0}, \mathtt{1}]_\com) &= [\mathtt{0}, \mathtt{1}]_\com, \\ \fsqrt([\mathtt{-1}, \mathtt{1}]_\com) &= [\mathtt{0}, \mathtt{1}]_\trv, \\ \fsqrt([\mathtt{-2}, \mathtt{-1}]_\com) &= βˆ…_\trv. \end{align*} $$

  3. Let $X = \set βˆ… βŠ† \R^0$ and $f : X β†’ \R$ be the function that maps $βˆ…$ to $Ο€$. The tightest, strongest-decorated interval extension of $f$ is the function $\ff : \DIF^0 β†’ \DIF$ that maps $βˆ…$ to $[\mathtt{3.14159265358979311…}, \mathtt{3.14159265358979356…}]_\com$.

  4. Let $X = βˆ… βŠ† \R^0$ and $f : X β†’ \R$ be the empty function. The tightest, strongest-decorated interval extension of $f$ is the function $\ff : \DIF^0 β†’ \DIF$ that maps $βˆ…$ to $βˆ…_\ill$.

Notation

Some of the symbols used in this article is different from the IEEE 1788 standards. The differences are summarized below:

This articleThe IEEE 1788 standards
$𝒙 = [a, b]$$𝒙 = [\underline x, \overline x]$
$\IR$$\overline{𝕀ℝ}$
$\DIR$$\overline{𝔻𝕀ℝ}$
β€”$𝔽$ (as a generic number format)
$\F$$\operatorname{Val}(𝔽)$
$\IF$$𝕋$ (as a generic interval type)
$\DIF$$𝔻𝕋$ (as a generic decorated interval type)
$\Range(f, 𝒙)$$\operatorname{Rge}(f ∣ 𝒙)$
$p_d(f,𝒙,π’š)$$p_d(f ∣ 𝒙)$
The strongest decoration for $(f, 𝒙, π’š)$$\operatorname{Dec}(f ∣ 𝒙)$