Definition of an Interval

410 Views Asked by At

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

There are 2 best solutions below

2
On

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.

1
On

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]$.