Module inari::_docs::formal_intro
source Β· [−]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 notation | Definition | Bounded in $\R$ |
---|---|---|
$β $ | $β $, the empty set | Yes |
$[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 numbers | No |
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.
-
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{+β} = +β$.
-
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.
-
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} $$
-
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$.
-
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$.
-
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.
-
Addition $+ : \R Γ \R β \R$:
$$ \operatorname{πππ}([π, π], [π, π]) = [\fldown(π + π), \flup(π + π)]. $$
-
$Ο = 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
-
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 $π$.
-
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*} $$
-
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$.
-
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 article | The 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 β£ π)$ |