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
intervalmultiple 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