3

I want to define both real intervals and integer intervals, and I want to avoid duplication of effort. As such, I put together the following definitions. I wanted to share and get feedback/critiques from the community. Are there any problems with my definitions or opportunities to simplify? Thanks!

NOTE: in the base definition for an interval I use the term object rather than number for the left and right endpoints as I want to allow them to be $\pm\infty$; not sure if there is a better term.


An interval is a subset of a set of numbers S that has an ordered pair of endpoints $(l, r)$ where $l \leq r$. $l$ is called the left endpoint of the interval, while $r$ is called the right endpoint of the interval. An interval contains no members which are less than its left endpoint, and no members which are greater than its right endpoint. Furthermore, $\{ x \mid (x \in S) \land (l < x < r) \}$ is a subset of an interval. The endpoints themselves may or may not be members of the interval. If an interval I is defined to be a subset of a set S, then we say I is an interval over S.


An interval is said to be a left bounded interval if the left endpoint is a finite value.


An interval is said to be a right bounded interval if the right endpoint is a finite value.


An interval is said to be a bounded interval if it is both left bounded and right-bounded.


An interval is said to be a closed interval if it contains both of its endpoints $(l, r)$. A closed interval is denoted by writing $[l, r]$.


An interval is said to be an open interval if it contains neither of its endpoints $(l, r)$. An open interval is denoted by writing $(l, r)$.


An interval is said to be half open or half closed if the interval contains either its left endpoint $l$ or its right endpoint $r$, but not both. If a half open interval contains its left endpoint, then it is denoted by writing $[l, r)$. On the other hand, if a half open interval contains its right endpoint then it is denoted by writing $(l, r]$.


A real interval is an interval over the reals ($\mathbf{R}$).


An integer interval is an interval over the integers ($\mathbf{Z}$).


EDIT1: As per @MartinR, I made it more explicit that an interval always has two endpoints.

EDIT2: As per @Dominique, I revised the inequality $\alpha < \beta$ to be $\alpha \leq \beta$ in the initial definition of an interval.

EDIT3: As per @Izaak van Dongen, I added the constraint that the set $\{ x \mid x \in S \land l < x < r \}$ is a subset of an interval (where $l$ is the left endpoint and $r$ is the right endpoint).

EDIT4: Refined the definition of an interval so that it is less verbose

  • 2
    Note that it is not obvious that an interval (with your definition) has a left and right endpoint. For this you need the “least upper bound property” or “completeness” of the underlying ordered set. – Martin R Mar 24 '23 at 10:42
  • @MartinR If it is a non-empty interval, then I believe the above implies the existence of left and right endpoints; but not necessarily so when it is empty. Let me think of how to revise to fix that... – Ryan Pierce Williams Mar 24 '23 at 10:46
  • 1
    In some countries, open intervals are not written as $(1,2)$ but as $]1,2[$. In top of that, you mention that $\alpha < \beta$, what's wrong with $\alpha \leq \beta$? – Dominique Mar 24 '23 at 10:46
  • 1
    @Dominique oh, interesting. I wasn't aware of that alternative notation. I kind of like it as it helps to differentiate it from an ordered pair. I might adopt that myself. I will also revise to take account of the case where $\alpha \leq \beta$. Thanks :) – Ryan Pierce Williams Mar 24 '23 at 10:50
  • As an example, the set ${ x \mid 2 < x^2 < 3 }$ is (with your definition) an interval in $S = \Bbb Q$, the set of rational numbers. But it has no endpoints (in $\Bbb Q$). – Martin R Mar 24 '23 at 11:07
  • @MartinR I revised to make it explicit that an interval has two endpoints. Or was my revision insufficient? – Ryan Pierce Williams Mar 24 '23 at 11:11
  • 1
    Your definition of "left endpoint" should be "the largest $l$ which is a lower bound for the interval", not just any $l$. This is exactly why you need completeness in the underlying total order for this to make sense. (Unless your definition of interval is just "some set with a left endpoint and a right endpoint", which kind of defeats the point.) I think it's more natural to define a lot of this terminology in a general total order first, and then remark that there is nice behaviour in the complete case. For instance "left bounded" can just be defined as "is bounded below by some $l$". – Izaak van Dongen Mar 24 '23 at 11:36
  • 1
    I'm not sure how much your "objects"/"numbers" distinction is helping you here. If you develop all the intervals terminology in a total order, then there's a standard embedding of any total order $X$ into a bounded total order $X \cup {\pm \infty}$, and a "left unbounded interval in $X$" becomes "an left-open interval with left endpoint $-\infty$ in $X \cup {\pm \infty}$", for example. Also, technically there's no need to even require $\alpha \le \beta$ - you can just say "for any $\alpha, \beta$". – Izaak van Dongen Mar 24 '23 at 11:43
  • @IzaakvanDongen can you provide an example of where the current definition would run into trouble? I haven't taken a proofs class, and I've been picking up Number Theory on my own - so I maybe missing some context that justifies the stricter definition. And I used the "object" vs "number" distinction only to account for infinity - but I do appreciate the idea that we might define things differently to avoid this complexity altogether. Do you have any good references on defining things in a total order? I will of course do some googling as well :) – Ryan Pierce Williams Mar 24 '23 at 11:51
  • 1
    You said "The left endpoint is an object $l$ with the property that all members of the interval are greater than or equal to $l$." According to this definition, $-1$ is "the" left endpoint of the interval $(0, 1)$ and so is $0$ and so is $-\infty$! This is why you should stipulate that it's the largest such point. Then eg in $\Bbb Q$, the set ${x: x^2 < 2}$ is an interval, but it does not have a left endpoint, illustrating why it's not automatic that the first definition of interval implies that every interval has a left endpoint (unless you wish to require this in the definition) – Izaak van Dongen Mar 24 '23 at 13:08
  • @IzaakvanDongen Ah, I see your point. I don’t necessarily think that is a bad thing per se that you can define an interval with bounds that are strictly larger than the members of the interval - that’s why we have open intervals. However! You shouldn’t be able to specify an interval endpoint such that it is large enough to include more members of the superset than intended. I shall revise – Ryan Pierce Williams Mar 24 '23 at 14:02
  • @IzaakvanDongen based upon your feedback, I added the constraint that ${ x \mid x \in S \land l < x < r }$ is a subset of the interval. I believe that solves the issue. – Ryan Pierce Williams Mar 24 '23 at 14:41
  • You assume to work in ordered sets with infinities, isn't this a bit restrictive, as $\mathbf{Z}$, $\mathbf{R}$, etc. contain no infinities? I would just state the property of being a left/right endpoint and then say an interval is left/right bounded if there exists a left/right endpoint. Of course, this doesn't capture the intention in case there are infinite values. But if you are more concerned with sets of finite numbers, I'd go this way. – fweth Mar 24 '23 at 14:48
  • @fweth I may very well need to examine intervals where one or both endpoints are $\pm\infty$. Not because $\infty$ is a member of either $\mathbf{Z}$ or $\mathbf{R}$, but because I want to examine all of the integers, for instance, and thus can't supply an integer as an endpoint to do this. – Ryan Pierce Williams Mar 24 '23 at 14:54
  • 1
    Sure, but why do you need an endpoint in that case? You can give an abstract definition of interval, which you already did and which captures intervals with infinite endpoints as well as intervals with finite endpoints, and then you can describe a given interval as left-unbounded/right-unbounded, instead of saying it has an infinite endpoint. The notation e.g $[a,\infty)$ is just shorthand for the right-unbounded interval with left endpoint $a$. – fweth Mar 24 '23 at 14:57
  • @fweth Of course there are many ways to go about it. I'm intending to use an interval as a building block for other data structures. Defining an interval in a flexible manner like this means that I can easily re-use it in a variety of contexts without re-making the wheel. I'm a Software Engineer by trade, so I tend to prefer generic solutions that avoid duplication of effort. – Ryan Pierce Williams Mar 24 '23 at 15:10
  • 1
    I see, guess it helps to clarify which kind of linear orders you want to work with. Personally, I think having infinities creates a bit of an awkward situation, where you have both, $[a,\infty)$ and $[a,\infty]$ as an interval and saying the interval is right-unbounded isn't enough to define its shape. Giving a definition which works for linear orders with or without infinities would imo avoid some duplication of effort. – fweth Mar 24 '23 at 15:37
  • 1
    But thinking about a bit more, bounded and unbounded are hard to define for arbitrary orders. E.g. the interval $[0,1]$ is unbounded w.r.t. to the base set $[0,1]$. On the other hand, the interval $[a,\infty)$ is bounded w.r.t. the base set $\bar{\mathbf{R}}$. – fweth Mar 24 '23 at 15:51
  • @RyanPierceWilliams: Two aspects, both are related to the definition of the term interval given in the first paragraph after the starting note. The term interval is defined using the term interval twice in the definition, which is not admissible. It seems that e.g. $S=((0,1)\cap\mathbb{Q})\setminus(\frac{1}{2},\frac{1}{3})$ counts as interval, which is presumably not intended. – Markus Scheuer Mar 24 '23 at 19:20
  • @epi163sqrt why wouldn't using the term interval multiple times be allowed? But I will try to think of how to rephrase so as to avoid this. Also, why shouldn't an interval be allowed over such a set? Granted I'm not sure where an interval over that particular set would be useful - but I don't necessarily see a conflict either. – Ryan Pierce Williams Mar 24 '23 at 22:23

2 Answers2

3

Here's a one-shot definition, that works simultaneously in $\mathbb R$, or in $\mathbb Z$, or indeed in any ordered set:

For any ordered set $X$, an interval is a subset $I \subset X$ with the property that for all $x,y,z \in X$, if $x < y < z$, and if $x,z \in I$, then $y \in I$.

It is now a theorem that every interval in $\mathbb R$ has one of nine types: three types of left endpoint $(\infty$ or $(a$ or $[a$ and three types of right endpoint $\infty)$ or $b)$ or $b]$

Lee Mosher
  • 135,265
1

Let $a,b \in \mathbb R$ with $a\le b$. Define $[a,b]=\{x\in \mathbb R:a\le x\le b\}$, $(a,b]=\{x\in \mathbb R:a< x\le b\}$, $[a,b)=\{x\in \mathbb R:a\le x< b\}$, $(a,b)=\{x\in \mathbb R:a< x< b\}$.

Now in contrast to your approach, I'd make separate definitions for those cases where at least one of the endpoints is $-\infty$ or $\infty$: $(-\infty,a]=\{x\in \mathbb R:x\le a\}$, $(-\infty,a)=\{x\in \mathbb R:x< a\}$, $[a,\infty)=\{x\in \mathbb R:x\ge a\}$, $(a,\infty)=\{x\in \mathbb R:x> a\}$, $(-\infty,\infty)=\mathbb R$. I think this is simpler than having to talk about whether the endpoints are finite or not.

A real interval is any one of the nine sets just defined.

An integer interval is the intersection of $\mathbb Z$ with a real interval: i.e. $[a,b]\cap \mathbb Z$, $(a,b]\cap \mathbb Z$, etc.