Article Submitted to Journal of Symbolic Computation

The meaning of infinity in calculus and computer algebra systems

Michael Beeson^{1} and Freek Wiedijk^{2}

1San José State University 2University of Nijmegen

Abstract

We use filters of open sets to provide a semantics justifying the use of infinity in informal limit calculations in calculus, and in the same kind of calculations in computer algebra. We compare the behavior of these filters to the way Mathematica behaves when calculating with infinity. We stress the need to have a proper semantics for computer algebra expressions, especially if one wants to use results and methods from computer algebra in theorem provers. The computer algebra method under discussion in this paper is the use of rewrite rules to evaluate limits involving infinity.

1. Introduction

1.1. Problem

In calculus, when calculating limits, one often first uses the heuristic of ‘calculating with infinity’ before trying to evaluate the limit in a more formal way. For instance one ‘calculates’:

lim_{x→∞} \frac{1}{x + 1} = \frac{1}{∞ + 1} = \frac{1}{∞} = 0

which indeed gives the correct answer. However, it is not clear what the meaning of this use of the symbol ‘∞’ is, and why this method works. This problem arises in calculus textbooks, which usually avoid examples of such calculations for fear of ‘lack of rigor’, although students are taught these methods at the blackboard. It arose in the design of the first author’s software, MathXpert (1; 2; 3). This software, which is designed to assist a student in producing step-by-step solutions to calculus problems, had to be able to produce ‘ideal’ step-by-step solutions of limit problems. Are such ‘ideal solutions’ allowed to use calculations involving infinity? Or are those calculations just private preliminary considerations intended

Beeson and Wiedijk: The meaning of infinity 2

to guide a rigorous proof? MathXpert does allow calculations involving infinity, but not the full system justified in this paper, since that goes beyond what one finds in calculus textbooks.

In the Mathematica system (9) the approach of calculating with infinity is used. Since Mathematica gives answers, rather than step-by-step solutions, one will not notice the calculations with infinity, in cases where the limit turns out to exist (and be a finite number). But in fact, in Mathematica there is a complete ‘calculus of infinity’ (and some related symbols):

In[1]:= 1/(Infinity + 1)
Out[1]= 0
In[2]:= Sqrt[Infinity]
Out[2]= Infinity
In[3]:= Infinity - Infinity
Infinity::indet:
   Indeterminate expression (-Infinity) + (Infinity) encountered.
Out[3]= Indeterminate
In[4]:= Indeterminate + Infinity
Out[4]= Indeterminate
In[5]:= Sin[Infinity]
Out[5]= Interval[{-1, 1}]
In[6]:= 1/Interval[{-1, 1}]
Out[6]= Interval[{-Infinity, -1}, {1, Infinity}]
In[7]:= Interval[{-1, 1}]*Interval[{-1, 1}]
Out[7]= Interval[{-1, 1}]
In[8]:= Interval[{-1, 1}]^2
Out[8]= Interval[{0, 1}]
In[9]:= 0*Sin[Infinity]
Out[9]= Interval[{0, 0}]
In[10]:= Infinity/Sin[Infinity]
Out[10]= Interval[{-Infinity, -Infinity}, {Infinity, Infinity}]
In[11]:= Infinity/Sin[Infinity]^2
Out[11]= Interval[{Infinity, Infinity}]

Other computer algebra systems implement similar calculi. For instance, the Maple system (6) uses the symbols infinity and undefined in answers to limit problems.^{∗}

∗There is also some notion of interval in Maple, written as 1 .. 2, but our attempts to calculate with these terms led only to error messages. These terms seem primarily to be used for generating integer sequences, although the answer to lim_{x→∞} sin x comes out as -1 .. 1.

It is well known that many computer algebra packages make errors. One of the reasons for that is that they fail to check the pre-conditions or ‘side conditions’ that must be satisfied for a simplification rule to be applicable. For example, before applying \sqrt{x^{2}} = x we need to check that x ≥ 0. Systematically keeping track of such assumptions is difficult. The errors in computer algebra systems sometimes give the impression that those systems place a higher priority on performing as many simplifications as possible than on ensuring that only correct computations are performed. Generally, ‘evaluation errors’ which users complain about are taken care of on an ad hoc basis only, to get rid of the most embarrassing ones.

Related to these errors is the fact that these systems have no unified semantics for their expression language. In this paper we focus on the apparatus for limits and offer a solution: a semantics explaining and supporting the use of infinities in limit calculations. We will present a formal semantics of limits, which not only explains the calculations usually performed with infinities, but offers some extensions by introducing some other symbols for common ways in which a function can fail to have a limit. Thus, we will be able to get an answer by calculation for such a limit as lim_{x→∞} 1/(2 + sin x) which will be ‘oscillations through the interval [\frac{1}{3}, 1]’. We then compare the resulting semantics to the behavior of Mathematica as illustrated above. There is a rough general correspondence, and our semantics agrees with some of the examples above, but in some instances Mathematica does give incorrect answers, and in some cases we are able to distinguish between identical Mathematica expressions which are different in our semantics.

1.2. Approach

We will represent ∞ and its cousins indeterminate and interval by filters over some underlying topological space (which in calculus textbooks and Mathematica is the space of real numbers, but could also be the complex numbers or more general spaces). For each point of the space there will be a filter associated with it, which is called the principal filter of the point. For each function on the space there will be a lifted version that works on the filters instead of on the points.

Furthermore we will define classes of filters called the interval filters and the connected filters. It will turn out that those two classes coincide and that connectedness of filters is preserved under continuous mappings. Also we will define the join and the meet of two filters.

It turns out that the calculus used in Mathematica corresponds directly to the set of finite joins of interval filters.

1.3. Related work

First, in topology, the two standard approaches for defining limits in topological spaces make use of nets or filters. There is therefore nothing original in the use of filters to analyze the notion of limits. However, our focus to use them in an applied setting, and identify specific filters associated with ‘extra-mathematical’ symbols such as ∞, seems to be new.

Second, the interval filters are directly related to the active field of interval arithmetic. We throw a new light on the calculations with intervals by looking at them as filters.

Third, justifying ‘calculations with infinite objects’ rigorously is close to doing the same with ‘calculations with infinitesimal objects’, which is the domain of nonstandard analysis. In nonstandard analysis one also has infinity as a first class citizen, but in nonstandard analysis there is not one, designated, infinity; instead there are many infinite nonstandard numbers, without a ‘canonical’ one. In our case there is a canonical infinity. To illustrate this difference concretely, let ω be the infinity of nonstandard analysis and let ∞ be the infinity of our filter calculus. Then we have ω + 1 ≠ ω, but ∞ + 1 = ∞.

The simplest way to get non-standard objects also employs a filter, but this has to be a special kind of filter called an ultrafilter. Also this filter contains arbitrary sets instead of only open sets (as is the case for the filters that are studied in this paper). Another important difference is that, in contrast to our approach, in this construction there is only one filter involved. The non-standard objects in this construction are not filters themselves.

Nonstandard analysis has been used in (4) to help in the computation of limits in a computer algebra system.

2. Filters, lifting, refinement and limits

Definition: Let X be a topological space. Denote the open sets of X by O(X). A filter on X is a set A ⊆ O(X) that satisfies:

\begin{matrix}∀U ∈ A. ∀V ∈ O(X). U ⊆ V ⇒ V ∈ A \\ ∀U ∈ A. ∀V ∈ A. U ∩ V ∈ A \end{matrix}

In words: a filter is a set of open sets that is closed under supersets and finite intersections. The collection of filters on X is written X̄.

A filter that does not contain the empty set is called proper. A filter that does not contain any set at all is called empty.

Often the property of being proper is made part of the definition of a filter. We did not do this, because then we would be unable to define the notion of meet on page 11 below. Sometimes the property of being non-empty is made part of the definition of a filter too. However the empty filter, which is called domainerror below, is essential to our application. We found variants of the definition of filter in the literature, both allowing for improper (5) and for empty (7) filters. Therefore we feel free to define the concept of filter to suit our purposes.

In the topological literature a filter is generally not defined on a topological space but on an arbitrary set. In that case the restriction to open sets is not present. However, for our application it is more natural to restrict ourselves to filters of open sets.

Definition: Here are some common filters on the real numbers, where a ∈ ℝ is an arbitrary real number:

improper ≡ † ≡ O(ℝ)
domain-error ≡ ⊥ ≡ ∅
indeterminate ≡ ↔ ≡ {ℝ}
principal(a) ≡ ā ≡ {U ∈ O(ℝ) | a ∈ U}
= {U ∈ O(ℝ) | ∃ε ∈ ℝ_{>0}. (a − ε, a + ε) ⊆ U}
left(a) ≡ a^{−} ≡ {U ∈ O(ℝ) | ∃ε ∈ ℝ_{>0}. (a − ε, a) ⊆ U}
right(a) ≡ a^{+} ≡ {U ∈ O(ℝ) | ∃ε ∈ ℝ_{>0}. (a, a + ε) ⊆ U}
punctured(a) ≡ a^{±} ≡ {U ∈ O(ℝ) | ∃ε ∈ ℝ_{>0}. (a − ε, a) ∪ (a, a + ε) ⊆ U}
infinity ≡ ∞ ≡ {U ∈ O(ℝ) | ∃ε ∈ ℝ_{>0}. (1/ε, ∞) ⊆ U}
minus-infinity ≡ −∞ ≡ {U ∈ O(ℝ) | ∃ε ∈ ℝ_{>0}. (−∞, −1/ε) ⊆ U}
bi-infinity ≡ ±∞ ≡ {U ∈ O(ℝ) | ∃ε ∈ ℝ_{>0}. (−∞, −1/ε) ∪ (1/ε, ∞) ⊆ U}
positive ≡ → ≡ {U ∈ O(ℝ) | (0, ∞) ⊆ U}
negative ≡ ← ≡ {U ∈ O(ℝ) | (−∞, 0) ⊆ U}
non-zero ≡ ±→ ≡ {U ∈ O(ℝ) | (−∞, 0) ∪ (0, ∞) ⊆ U}

For each of these filters we have a ‘long’ and a ‘short’ notation. The first four filters can be defined for any topological space. The other filters have analogues in any order topology.

Definition: Let again X be a topological space. Let A be a collection of subsets of X (not necessarily open) that satisfies:

∀U ∈ A. ∀V ∈ A. ∃W ∈ A. W ⊆ U ∩ V  (∗)

The filter generated by A is defined to be:

generated-by(A) ≡ {U ∈ O(X) | ∃V ∈ A. V ⊆ U}

The collection of sets A is called the basis of the filter generated-by(A).

Being closed under finite intersections implies (∗). If all elements of A are open sets, the filter generated by A is the intersection of all filters that contain A as a subset.

The filters defined on page 5 can be defined more naturally using the notion of a generated filter. For instance, we have:

improper = generated-by({∅})
principal(a) = generated-by({{a}})
right(a) = generated-by({(a, a + ε) | ε ∈ ℝ_{>0}}
infinity = generated-by({(1/ε, ∞) | ε ∈ ℝ_{>0}}

All other filters that are introduced on page 5 can be defined in a similar way.

Definition: Let f : X → X be some (possibly partial) function with domain dom(f). The lift of f is a function f̄: X̄ → X̄, defined by:

f̄(A) ≡ generated-by({f[U] | U ⊆ dom(f) ∧ U ∈ A})

This definition can be generalized to arbitrary arities. The function f̄: X̄ × X̄ × … × X̄ → X̄ is defined by:

f̄(A_{1}, A_{2}, …, A_{n}) ≡

generated-by({f[U] | U ⊆ dom(f) ∧ U = U_{1} × U_{2} × … × U_{n} ∧
U_{1} ∈ A_{1} ∧ U_{2} ∈ A_{2} ∧ … ∧ U_{n} ∈ A_{n}})

Although f can be a partial function, the lift of f is always total. One can get rid of the problems of partial functions in calculus by lifting the whole theory to filters. In some sense by going to filters we are adding a ‘bottom element’ ⊥ to the values of the theory. Looked at in this way, we have a strict partial logic, because a function applied to ⊥ will always give ⊥ again.

Note also that the definitions of ā as a principal filter and as lift of a 0-ary constant function coincide. This justifies using one notation for both.

From now on we will often write f instead of f̄ when one or more of the arguments of f are filters. So we will write sin(A) instead of \overline{sin}(A). This will allow us to write things like \sqrt{A}, and mean the lift of the square root function.

To state this convention more precisely: if t[x_{1}, …, x_{n}] is a term that does not involve filters (so x_{1}, …, x_{n} are variables ranging over the ordinary reals) then t[A_{1}, …, A_{n}] will mean the lift of the function λx_{1} ⋯ x_{n}. t[x_{1}, …, x_{n}] applied to the filters A_{1}, …, A_{n}. Note that with this convention 1/A means something different from ¯1/A. The first is the lift of the unary function λx. 1/x applied to A. The second is the lift of the binary function λx y. x/y applied to ¯1 and A. Those are not necessarily equal: 1/1^{+} = 1^{−} but ¯1/1^{+} = ¯1.

Definition: The filter limit of the function f : X → X when taking the limit to the filter A is defined to be:

Lim_{x→A} f(x) ≡ f̄(A)

We distinguish a filter limit from an ordinary limit by writing ‘Lim’ with a capital letter L. Note that the filter limit is always defined, even for non-continuous f. It might seem silly to introduce a new notation for this when we already have defined lifting, as it is the same operation. However, now we can write:

Lim_{x→0^{+}} x/x

which is something different from

0^{+}/ 0^{+}

The first is the lift of the unary function λx. x/x applied to 0^{+} and has as value ¯1. The second is the lift of the binary function λx y. x/y applied to the pair (0^{+}, 0^{+}) and has as value →.

Definition: A filter A refines a filter B, notation A ⊑ B when A ⊇ B as collections of open sets. When the two filters A and B differ we write A ⊏ B.

Here are some refinement relations between the filters defined on page 5. For any proper and non-empty filter A we have:

† ⊏ A ⊑ ↔ ⊏ ⊥

At any real number a ∈ ℝ we have:

a^{−}, a^{+} ⊏ a^{±} ⊏ ā

and the ‘infinite’ filters are related by:

−∞, ∞ ⊏ ±∞ ⊏ ↔, −∞ ⊏ ← ⊏ ±→ ⊏ ↔, ∞ ⊏ → ⊏ ±→ ⊏ ↔

Note that the filters defined on page 5 are not the only ones. There are many ‘wild’ filters refining ā and ∞. For instance the filter generated by the sets {2πn | n > N} is a filter which refines ∞. It has the property that the filter limit of sin to this filter is ¯0.

We can now state the first theorem, which lists some of the many calculation rules that one needs for arithmetic on filters:

Theorem 2.1: Let a ∈ ℝ_{>0} be some positive real number. Then:

\begin{aligned}∞ + ā & = & ∞ \\ ∞ − ā & = & ∞ \\ ∞ + ∞ & = & ∞ \\ ∞ − ∞ & = & ↔ \end{aligned} \begin{aligned}ā/¯0 & = & ⊥ \\ ā/0^{+} & = & ∞ \\ ā/0^{±} & = & ±∞ \\ 0^{+}/0^{+} & = & → \end{aligned} \begin{aligned}ā/∞ & = & 0^{+} \\ ā/±∞ & = & 0^{±} \\ ā/→ & = & → \\ ā/↔ & = & ⊥ \end{aligned} \begin{aligned}¯0 ∞ & = & ↔ \\ 0^{+}∞ & = & → \\ 0^{±}∞ & = & ±→ \\ ∞ ∞ & = & ∞ \end{aligned}

Proof: We will show only the proof for the next to last calculation rule, 0^{±}∞ = ±→. The other proofs are similar. To prove this rule, we need to show that both 0^{±}∞ ⊆ ±→ and 0^{±}∞ ⊇ ±→.

So suppose that we have V ∈ 0^{±}∞. Then by the definition of lift of the multiplication function there are U_{1} ∈ 0^{±} and U_{2} ∈ ∞ such that U_{1}U_{2} ⊆ V. By the definitions of 0^{±} and ∞ we have for some positive ε_{1} and ε_{2} that (−ε_{1}, 0) ∪ (0, ε_{1}) ⊆ U_{1} and (1/ε_{2}, ∞) ⊆ U_{2}. Now to show that V ∈ ±→, we need to show that for any x ≠ 0 we have that x ∈ V. Consider some positive ε smaller than ε_{1} and ε_{2}/x. Then x ∈ V follows, because we have that ε ∈ U_{1}, and because by x/ε > x/(ε_{2}/x) = 1/ε_{2} we have that x/ε ∈ U_{2}.

For the other inclusion, suppose that V ∈ ±→, which by definition means that (−∞, 0) ∪ (0, ∞) ⊆ V. Take for U_{1} and U_{2} both (−∞, 0) ∪ (0, ∞) too, then U_{1} ∈ 0^{±} and U_{2} ∈ ∞. Clearly U_{1}U_{2} = (−∞, 0) ∪ (0, ∞) as well, so U_{1}U_{2} ⊆ V, and therefore V ∈ 0^{±}∞. □

Note that, although the lift of division is a total function, ‘division by zero’ is still not allowed in a sense, because the result of ā/¯0 is domain-error. This is essentially different from the way that Mathematica behaves. We will come back to this in Section 4

The next theorem tells us how to evaluate the lift of a continuous function in a point:

Theorem 2.2: Let f be a function that is continuous and monotonically increasing in a neighborhood of a. Then:

f̄(ā) = \overline{f(a)}, f̄(a^{±}) = f(a)^{±}, f̄(a^{−}) = f(a)^{−}, f̄(a^{+}) = f(a)^{+}

Proof: We will show only the proof of the last equality. The other proofs are similar. To prove that f̄(a^{+}) = f(a)^{+} we need to show that both f̄(a^{+}) ⊆ f(a)^{+} and f̄(a^{+}) ⊇ f(a)^{+}.

So suppose that V ∈ f̄(a^{+}). Then there is a U ∈ a^{+} such that f[U] ⊆ V, and because U ∈ a^{+} there is a positive ε with (a, a+ε) ⊆ U. We may assume that ε is small enough that f is continuous and monotonically increasing on [a, a+ε], and this implies f[(a, a + ε)] = (f(a), f(a) + δ) with δ = f(a + ε) − f(a). Therefore (f(a), f(a) + δ) ⊆ f[U] ⊆ V, and hence V ∈ f(a)^{+}.

For the other inclusion, suppose that V ∈ f(a)^{+}, so for some positive δ it holds that (f(a), f(a) + δ) ⊆ V. Because f is continuous in a there is a positive ε such that f[(a − ε, a + ε)] ⊆ (f(a) − δ, f(a) + δ). Again we may assume that ε is small enough that f is monotonically increasing on [a − ε, a + ε], which gives f[(a, a + ε)] ⊆ (f(a), f(a) + δ), and therefore f[(a, a + ε)] ⊆ V. Because (a, a + ε) ∈ a^{+}, this implies that V ∈ f̄(a^{+}). □

Similar theorems hold for decreasing functions and functions at a local maximum or minimum.

The next theorems show how to evaluate filter limits:

Theorem 2.3: Bringing filter limits inside expressions:

Lim_{x→A} f(g_{1}(x), g_{2}(x), …, g_{n}(x)) ⊑ f̄(Lim_{x→A} g_{1}(x), Lim_{x→A} g_{2}(x), …, Lim_{x→A} g_{n}(x))

Proof: Define h(x) = f(g_{1}(x), …, g_{n}(x)). To prove the statement we need to show that h̄(A) ⊑ f̄(ḡ_{1}(A), …, ḡ_{n}(A)), which amounts to f̄(ḡ_{1}(A), …, ḡ_{n}(A)) ⊆ h̄(A)

So suppose W ∈ f̄(ḡ_{1}(A), …, ḡ_{n}(A)). That means that there are V_{i} ∈ ḡ_{i}(A) with V_{1} × ⋯ × V_{n} ⊆ dom(f) and f[V_{1} × ⋯ × V_{n}] ⊆ W. This implies that there are U_{i} ∈ A with U_{i} ⊆ dom(g_{i}) and g_{i}[U_{i}] ⊆ V_{i}. Now define U = U_{1} ∩ ⋯ ∩ U_{n}, then U ∈ A, U ⊆ dom(g_{i}) and g_{i}[U] ⊆ V_{i}, which then implies that U ⊆ dom(h) and h[U] ⊆ W. Therefore W ∈ h̄(A). □

Note that this theorem also holds for non-continuous f.

As an example of the fact that we do not always have equality here, not even when all functions are continuous, consider:

Lim_{x→∞}(x − x) = Lim_{x→∞} 0 = ¯0
(Lim_{x→∞} x) − (Lim_{x→∞} x) = ∞ − ∞ = ↔

This agrees with the theorem, since ¯0 ⊑ ↔.

Theorem 2.4: Monotonicity with respect to refinement:

A_{1} ⊑ B_{1}, A_{2} ⊑ B_{2}, …, A_{n} ⊑ B_{n} ⇒ f̄(A_{1}, A_{2}, …, A_{n}) ⊑ f̄(B_{1}, B_{2}, …, B_{n})

Proof: Let V be given with V ∈ f̄(B_{1}, …, B_{n}). Then there are U_{i} ∈ B_{i} with U_{1} × ⋯ × U_{n} ⊆ dom(f) and f[U_{1} × ⋯ × U_{n}] ⊆ W. Because A_{i} ⊑ B_{i}, also U_{i} ∈ A_{i}, which implies that also V ∈ f̄(A_{1}, …, A_{n}). □

Together these two theorems allow one to evaluate a filter limit ‘up to refinement’ by substituting the filter inside the expression. Often this refinement does not hurt, because the right hand side will be a refinement of ā or ∞ anyway, allowing us to apply the next theorem, which gives the relation between filter limits and the usual kind of limits:

Theorem 2.5: Limit correspondence theorem:

lim_{x→a} f(x) = b ⇔ Lim_{x→a^{±}} f(x) ⊑ b̄
lim_{x→a^{+}} f(x) = b ⇔ Lim_{x→a^{+}} f(x) ⊑ b̄
lim_{x→∞} f(x) = b ⇔ Lim_{x→∞} f(x) ⊑ b̄

Proof: We will show only the proof of the first equivalence. The other proofs are similar.

(⇒) Let be given that lim_{x→a} f(x) = b: we have to show that f̄(a^{±}) ⊑ b̄. So suppose that V ∈ b̄, which means that for some ϵ > 0 we have that (b−ϵ, b+ϵ) ⊆ V. Because of the limit, there is a δ > 0 such that for all x ∈ (a−δ, a)∪(a, a+δ) (call this set U) we have that f(x) is defined and f(x) ∈ (b − ϵ, b + ϵ), or, in other words, U ⊆ dom(f) and f[U] ⊆ (b − ϵ, b + ϵ). Clearly U satisfies U ∈ a^{±} and f[U] ⊆ V, and therefore V ∈ f̄(a^{±}).

(⇐) Now assume that f̄(a^{±}) ⊑ b̄. For a given ϵ > 0, let V = (b − ϵ, b + ϵ). Then V ∈ b̄, so V ∈ f̄(a^{±}), and therefore there is some U ∈ a^{±} with U ⊆ dom(f) and f[U] ⊆ V. Because U ∈ a^{±}, for some δ > 0 we have that (a−δ, a)∪(a, a+δ) ⊆ U. Now this implies that if x ∈ (a − δ, a) ∪ (a, a + δ) then f(x) is defined and f(x) ∈ (b − ϵ, b + ϵ). Because for each ϵ > 0 there is a δ > 0 with this property, lim_{x→a} f(x) = b. □

Similar theorems hold at a^{−} and −∞ and for limits to plus or minus infinity.

In Europe lim_{x→a^{+}} is sometimes written as lim_{x↓a}. The ∞ and a^{+} in the ‘ordinary’ limits on the left are not filters: those are just the customary notations for limits from the right and to infinity. The a^{±}, a^{+} and ∞ on the right are filters.

Together these theorems now give us a method to rigorously evaluate ordinary limits using filters:

1. Replace the limit by the corresponding filter limit.

2. ‘Evaluate’ the filter limit using filter calculations, leading to a refinement.

3. If the right hand side of the refinement refines ā, −∞ or ∞ then we have succeeded and can use Theorem 2.5 (or its analogue for infinite limits) to find the answer to the original question. If not, the method failed.

As an example, we use this method to evaluate lim_{x→∞} 1/(x + 1):

Lim_{x→∞} \frac{1}{x + 1} ⊑ \frac{¯1}{Lim_{x→∞}(x + 1)} ⊑ \frac{¯1}{∞ + ¯1} = \frac{¯1}{∞} = 0^{+}

(The refinements here are really equalities, but the theorems that we have do not give that, and in fact we do not need it.) Now 0^{+} ⊑ ¯0 and so from Theorem 2.5 we find that:

lim_{x→∞} \frac{1}{x + 1} = 0

Here is another example of a limit evaluated using this method:

Lim_{x→0^{±}} x sin \frac{1}{x} ⊑ 0^{±} sin \frac{1}{0^{±}} = 0^{±} sin(±∞) = 0^{±}[−1, 1] = ¯0

(in this calculation ‘[−1, 1]’ is the filter generated by the closed interval [−1, 1], cf. the notation introduced in Section 3 below), which implies that:

lim_{x→0} x sin \frac{1}{x} = 0

Note that we rigorously established this limit by calculation, and did not need the ‘squeeze theorem’ which is usually used to evaluate this limit.

3. Interval filters and connected filters

Definition: We will define a class of filters on ℝ called the interval filters. Consider the set:

R = {−∞^{+}} ∪ {a^{−} | a ∈ ℝ} ∪ {a^{+} | a ∈ ℝ} ∪ {∞^{−}}

For each pair of elements α and β from R for which α ≤ β in the natural order on R, we will define a filter interval(α, β). We map the elements of R to formulas as:

\begin{matrix}α & ϕ_{l}(x, α, ε) & ϕ_{r}(x, α, ε) \\ −∞^{+} & ⊤ & x < −1/ε \\ a^{−} & a − ε < x & x < a \\ a^{+} & a < x & x < a + ε \\ ∞^{−} & 1/ε < x & ⊤ \end{matrix}

and then we define:

interval(α, β) ≡ {U ∈ O(ℝ) | ∃ε ∈ ℝ_{>0}. ∀x ∈ ℝ. ϕ_{l}(x, α, ε) ∧ ϕ_{r}(x, β, ε) ⇒ x ∈ U}

We will write interval filters using interval notation:

[a, b) ≡ interval(a^{−}, b^{−})
[a, b] ≡ interval(a^{−}, b^{+})

(a, b) ≡ interval(a^{+}, b^{−})
(a, b] ≡ interval(a^{+}, b^{+})

We suppose that it will be clear from the context when we mean an interval as a set of real numbers and when we mean an interval as an interval filter. Generally, for finite a and b they are related like:

(a, b] = generated-by({(a, b]})

but not always. If a = b, then the left hand side is a^{+} but the right hand side is improper because the set (a, a] is empty.

When we analyze a two-sided limit into two one-sided limits, and then want to put the results back together, we need the concept of the ‘join’ of two filters, which we write A ∨ B. For example, 0^{−} ∨ 0^{+} = 0^{±}. This concept is defined as follows:

Definition: The operations join and meet on filters are defined by:

\begin{aligned}A ∨ B & = & A ∩ B \\ A ∧ B & = & \{U ∩ V | U ∈ A ∧ V ∈ B\} \end{aligned}

We can now write the filters defined on page 5 as interval filters or as joins of interval filters:

\begin{aligned}ā & = & [a, a] \\ a^{−} & = & [a, a) \\ a^{+} & = & (a, a] \\ a^{±} & = & [a, a) ∨ (a, a] \\ ∞ & = & [∞, ∞) \\ −∞ & = & (−∞, −∞] \\ ±∞ & = & (−∞, −∞] ∨ [∞, ∞) \end{aligned} \begin{aligned}↔ & = & (−∞, ∞) \\ → & = & (0, ∞) \\ ← & = & (−∞, 0) \\ ±→ & = & (−∞, 0) ∨ (0, ∞) \end{aligned}

Now that we have the class of interval filters, we will define the class of connected filters. This definition is much simpler:

Definition: A filter A is called connected when:

∀U ∈ A. ∃U′ ∈ A. U′ ⊆ U ∧ U′ is a connected set

Note that each of improper, domain-error and indeterminate is a connected filter.

The next three theorems give the relevant properties of the connected filters. Together they ‘explain’ why in practice one encounters only joins of interval filters: the filters one starts with are of that kind, and the operations that one applies to them conserve the property.

Theorem 3.1: The interval filters are the proper non-empty connected filters.

Proof: It is easy to verify that every interval filter is proper, non-empty and connected. Therefore all that is needed is to show that if a proper non-empty filter is connected, then it is an interval filter.

Assume A is a proper non-empty connected filter. Define:

\begin{aligned}L & = & \{l ∈ \{−∞\} ∪ ℝ | (l, ∞) ∈ A\} \\ R & = & \{r ∈ ℝ ∪ \{∞\} | (−∞, r) ∈ A\} \end{aligned}

Both sets are non-empty, because the filter A is non-empty and so (−∞, ∞) ∈ A. The set L will be closed to the left (if l ∈ L and l′ < l then also l′ ∈ L), so L has to have the form {−∞}, [−∞, a), [−∞, a] or [−∞, ∞). Depending on this, define α to be respectively −∞^{+}, a^{−}, a^{+} or ∞^{−}. Similarly R will be of the form (−∞, ∞], [b, ∞], (b, ∞] or {∞}, which gives β being −∞^{+}, b^{−}, b^{+} or ∞^{−}. We have that L ∩ R = ∅ (because else A would be improper), so α ≤ β. We are now going to show that A = interval(α, β).

(⊆) Suppose that U ∈ A. The filter A is proper and connected, so there is a non-empty connected U′ ∈ A with U′ ⊆ U. A non-empty connected open set U′ is always an open interval (l, r), and because U′ ∈ A, we have that l ∈ L and r ∈ R. With the definitions of ϕ_{l} and ϕ_{r} it then follows that (l, r) ∈ interval(α, β). Therefore also U ∈ interval(α, β).

(⊇) Suppose that U ∈ interval(α, β). Then from the definition of interval it is clear that there is an open interval (l, r) with (l, r) ⊆ U and (l, r) ∈ interval(α, β). With the definitions of ϕ_{l} and ϕ_{r} it then follows that l ∈ L and r ∈ R. Therefore (l, r) = (l, ∞) ∩ (−∞, r) ∈ A, and so also U ∈ A. □

So all interval filters are connected, and the only connected filters which are not an interval filter are the ‘error filters’ improper and domain-error.

Theorem 3.2: If f is a function that is continuous on its domain, and A is a connected filter, then f̄(A) is also connected.

Proof: Suppose that V ∈ f̄(A), so there is a U ∈ A with U ⊆ dom(f) and f[U] ⊆ V. We need to find a connected V′ ∈ f̄(A) with V′ ⊆ V.

Because A is connected, there is a connected U′ ∈ A with U′ ⊆ U. Take V′ = f[U′]. The image of a connected set under a continuous function is connected, so V′ is connected too. Furthermore, V′ has the required properties: U′ ⊆ dom(f) from which follows that V′ ∈ f̄(A), and V′ = f[U′] ⊆ f[U] ⊆ V. □

Theorem 3.3:

f̄(A ∨ B) = f̄(A) ∨ f̄(B)

Proof: (⊑) Suppose V ∈ f̄(A) ∨ f̄(B), then both V ∈ f̄(A) and V ∈ f̄(B), so there are U ∈ A and U′ ∈ B such that U, U′ ⊆ dom(f) and f[U], f[U′] ⊆ V. Then U ∪ U′ ∈ A ∨ B, and furthermore U ∪ U′ ⊆ dom(f) and f[U ∪ U′] ⊆ V, so V ∈ f̄(A ∨ B).

(⊒) If V ∈ f̄(A ∨ B), there is a U ∈ A ∨ B (and so U ∈ A and U ∈ B) with U ⊆ dom(f) and f[U] ⊆ V. This same U shows that V ∈ f̄(A) and V ∈ f̄(A), which means that V ∈ f̄(A) ∨ f̄(B). □

Together, these theorems show that if one applies functions that are continuous on their domain to finite joins of interval filters, one always will end up with finite joins of interval filters again.

The final theorem is not needed for actual limit calculations, but it is included for completeness.

Theorem 3.4:

f̄(A ∧ B) ⊑ f̄(A) ∧ f̄(B)

Proof: Let V ∈ f̄(A) ∧ f̄(B), so there are V′ ∈ f̄(A) and V′ ∈ f̄(B) with V = V′ ∩ V′. Then there are U′ ∈ A and U′ ∈ B with U′, U′ ⊆ dom(f) and f[U′] ⊆ V′, f[U′] ⊆ V′. From this U′ ∩ U′ ∈ A ∧ B, U′ ∩ U′ ⊆ dom(f) and f[U′ ∩ U′] ⊆ V′ ∩ V′, and so V′ ∩ V′ ∈ f̄(A ∧ B). □

Note that for ∧ the reverse refinement does not hold. If we take f(x) = x^{2}, then f̄(← ∧ →) = f̄(†) = †, but f̄(←) ∧ f̄(→) = → ∧ → = →, and although † ⊑ →, it is not the case that → ⊑ †.

4. Mathematica revisited

Now that we have given a calculus of filters that resembles the way Mathematica calculates with infinity, we will compare the behavior of our calculus and that of Mathematica in detail. This is what the calculations in the example Mathematica from Section 1.1 become when we redo them in our filter calculus:

1/(∞ + 1) = 0^{+}_{\sqrt{∞} = ∞}_{∞ − ∞ = ↔}_{↔ + ∞ = ↔}_{sin ∞ = [−1, 1]} 1/[−1, 1] = ⊥

[−1, 1] · [−1, 1] = [−1, 1]
[−1, 1]^{2} = [0, 1]
¯0 sin ∞ = ¯0
∞/ sin ∞ = ∞/(sin ∞)^{2} = ⊥

Here are some differences with Mathematica:

• Mathematica does not like to give ‘no’ for an answer. So it prefers not to complain about undefinedness of a function. According to Mathematica:

\frac{1}{[−1, 1]} = (−∞, −1] ∨ [1, ∞)

instead of ⊥. Our definitions have different behavior because we want the correspondence theorem about limits, Theorem 2.5, to hold. As an example of this difference in attitude consider the limit:

lim_{x→0^{+}} x arctan(tan \frac{1}{x})

The graph of x arctan(tan(1/x)) looks like a ‘saw tooth’ converging to 0, and it is undefined infinitely often in each neighborhood of 0. Still Mathematica says^{†}:

In[12]:= Limit[x*ArcTan[Tan[1/x]], x->0, Direction->-1]
Out[12]= 0

If you ask MathXpert to evaluate this limit, you get the message: This function is undefined for certain values arbitrarily close to the limit point, so the limit is undefined.

• Mathematica does not identify as many expressions as it might. For instance, in the example session it might have simplified:

                     Interval[{0, 0}] = 0
       Interval[{Infinity, Infinity}] = Infinity
      Interval[{-Infinity, Infinity}] = Indeterminate

• Mathematica does not distinguish between open and closed intervals, nor does it have the concept of left and right filters to a point. In order to add this subtlety to its Interval calculus all that would be needed is to mark all the endpoints of the intervals with a + or a −.

• We have two kinds of ‘undefined’ in our filter calculus: domain-error = ⊥ and indeterminate = ↔. (The third filter, improper = †, only occurs as the meet of two disjoint interval filters, and never occurs in practice.) Mathematica only has Indeterminate, and does not distinguish between these two kinds of undefinedness.

• Mathematica issues a ‘warning’ message like:

Power::infy: Infinite expression \frac{1}{0} encountered.

†In version 3.0. In version 4.1 it leaves the expression unevaluated.

when it gets infinite or indeterminate results. This seems to imply that such results are errors. However, in our theory those results are not errors at all but the correct answers, and they should not generate such a message.

• We gave the details of the filter theory for the space of real numbers. However, the expression language of Mathematica is about the complex numbers. This is clear, for example, from the results of applying Sqrt and Log to negative numbers. It is therefore strange that Mathematica gives answers involving intervals to limit questions, since such answers are appropriate to real limits.

In any case, our filter theory can be adapted to the complex numbers. For example, complex infinity is represented by the filter generated by the exteriors of disks centered at 0 (i.e., ‘neighborhoods of infinity’). The ‘one-sided’ filters a^{+} and a^{−} are replaced by a wide variety of other filters representing different ways in which a complex number z can ‘approach’ a limit point a: for example, in complex analysis it is common to consider a limit restricted to an angular sector, such as |θ| < π/4. It is easy to define a ‘sector filter’ generated by such a sector. Our theorems that do not involve interval filters carry over to the complex setting: pushing filter limits inside functions, the method of limit evaluation by refinement, etc. We have not given a characterization of the connected filters in the complex case. For example, there are more than just the sector filters: the filter generated by |θ| < r^{2} is not refined by any sector filter.

5. Conclusion and future directions

We have presented the filter approach to evaluating limits involving infinity. The usual way of calculating with infinities is not rigorous; indeed the central concept infinity is never defined in calculus textbooks. The issue is skirted by such statements as: ‘The symbol ∞ does not represent a real number and we cannot use it in arithmetic in the usual way.’ (8), p. 112.

Consider a student who says that lim_{x→0^{+}} 1/x is ‘undefined’, while the teacher says that ∞ is a better answer. ‘But’, says the student, ‘you said ∞ is undefined.’ Such dialogues do occur regularly in classrooms and teachers are unable to answer these questions on any rigorous basis. We have now, at least in principle, provided a remedy for this situation, since our theory of infinite limits is completely rigorous. Questions at the student level in our theory can usually be proved or refuted.

When computer algebra systems make use of a set of calculation rules, there should ideally be a semantics according to which these calculation rules are correct. Even for ordinary algebra, this is not usually the case. But it is usually the case that the rules are correct except that the system fails to check the preconditions. That is, the semantics of algebra is understood – but systems fail to implement the rules in a semantically correct way. Up until now, the semantics of limits has not been properly understood, and so the behavior of computer algebra systems did not even have a standard against which implementations could be measured. In using intervals as answers to limits, Mathematica has ventured into uncharted territory. We are now providing maps.

Our work, being completely rigorous, and based on simple set theory, is also completely formal.^{‡} Therefore computer-checking the theory from this paper is possible, and the resulting formalization would not only be an interesting exercise, but also probably could be used to make the prover automatically evaluate more limits. In another direction, this material is suitable for inclusion in an undergraduate real-analysis course, and the distinctions between different types of limits that it makes are suitable for inclusion in calculus books. In particular, calculus books need no longer steer away from calculations involving infinity. Simple rules for manipulating infinity can be given and the justifications omitted, as is usually the case now when the justifications involve epsilon-delta arguments.

References

[1] Beeson, M., Mathpert Calculus Assistant. This software program (now known as MathXpert) was published in July, 1997 by Mathpert Systems, Santa Clara, CA, and is commercially available from <http://www.mathxpert.

   com/>.

[2] Beeson, M., Design Principles of Mathpert: Software to support education in algebra and calculus, in: Kajler, N. (ed.) Computer-Human Interaction in Symbolic Computation, Texts and Monographs in Symbolic Computation, Springer-Verlag, Berlin/Heidelberg/New York (1998), pp. 89-115.

[3] Beeson, M. Beeson, M. MathXpert: un logiciel pour aider les élèves à apprendre les mathématiques par l’action, Sciences et techniques éducatives, 9 (1) 37-62, 2002. An English translation of this article under the title MathXpert: learning mathematics in the twenty-first century is available at

   <http://www.mathcs.sjsu.edu/faculty/beeson/Pubs/pubs.html>.

[4] Beeson, M., Using nonstandard analysis to verify the correctness of computations, International Journal of Foundations of Computer Science, 6 (3) (1995), pp. 299-338.

[5] K. Kuratowski. Topology, volume 1. Academic Press, New York, London, 1966.

[6] M. Monagan, K. Geddes, K. Heal, G. Labahn, and S. Vorkoetter. Maple V Programming Guide for Release 5. Springer-Verlag, Berlin/Heidelberg, 1997.

‡Rigorous implies that the concepts and theorems have a clear meaning and the theorems can be correctly proved. Formal implies that the concepts can be defined and the theorems proved in terms of set theory (or some other foundational theory of mathematics).

Beeson and Wiedijk: The meaning of infinity 17

[7] B. Sims. Fundamentals of Topology. MacMillan, New York, 1976.

[8] Stewart. Calculus, 3rd edition, Brooks-Cole, Pacific Grove, CA 1995.

[9] S. Wolfram. The Mathematica book. Cambridge University Press, Cambridge,