|
1 | | -Disjoint Interval Set |
2 | | -===================== |
| 1 | +# Disjoint Interval Set |
3 | 2 |
|
4 | 3 | The Disjoint Interval Set (DIS) equipped with a few operations |
5 | 4 | satisfies the concept of a Boolean algebra over sets of disjoint |
6 | 5 | intervals equipped with all the standard set-theoretic operations, |
7 | 6 | like intersection (*), union (+), and complement (~). |
8 | 7 |
|
9 | | -### Boolean Algebra |
| 8 | +## Concept: Boolean Algebra |
| 9 | + |
10 | 10 | A Boolean algebra provides a powerful conceptual and mathematical framework. |
11 | 11 | It is a set of elements equipped with a few operations that satisfy |
12 | 12 | a few axioms. The operations are usually called union (+), intersection (*), |
13 | 13 | and complement (~). The axioms are usually called the Boolean laws. |
14 | 14 |
|
15 | | -## DIS Operations |
16 | | -The DIS supports the following operations: |
| 15 | +## Constructors |
| 16 | + |
| 17 | +The DIS supports the following constructors: |
| 18 | + |
| 19 | +- **Empty Constructor**: `disjoint_interval_set()` |
| 20 | + |
| 21 | + Create an empty DIS. |
| 22 | + |
| 23 | +- **Constructor From Iterable**: `disjoint_interval_set(intervals)` |
| 24 | + |
| 25 | + Create a DIS from an iterable of intervals. |
| 26 | + |
| 27 | +- **Copy Constructor**: `disjoint_interval_set(disjoint_interval_set)` |
| 28 | + |
| 29 | + Create a copy of a DIS. |
| 30 | + |
| 31 | +## Set-Theoretic Operations |
| 32 | + |
| 33 | +The DIS supports the following set-theoretic operations: |
| 34 | + |
| 35 | +- **Union**: `operator+(disjoint_interval_set, disjoint_interval_set)` |
17 | 36 |
|
18 | | -1. `disjoint_interval_set()`: Create an empty DIS. |
19 | | -2. `disjoint_interval_set(intervals)`: Create a DIS from an iterable of intervals. |
20 | | -3. `disjoint_interval_set(disjoint_interval_set)`: Create a copy of a DIS. |
21 | | -4. `operator+(disjoint_interval_set, disjoint_interval_set)`: Union of two DIS. |
22 | | -5. `operator*(disjoint_interval_set, disjoint_interval_set)`: Intersection of two DIS. |
23 | | -6. `operator~(disjoint_interval_set)`: Complement of a DIS. |
| 37 | + Create a DIS that is the union of two DIS. |
| 38 | + |
| 39 | +- **Intersection**: `operator*(disjoint_interval_set, disjoint_interval_set)` |
| 40 | + |
| 41 | + Create a DIS that is the intersection of two DIS. |
| 42 | + |
| 43 | +- **Complement**: `operator~(disjoint_interval_set)` |
| 44 | + |
| 45 | + Create a DIS that is the complement of a DIS. |
| 46 | + |
| 47 | +- **Set-Difference**: `operator-(disjoint_interval_set, disjoint_interval_set)` |
| 48 | + |
| 49 | + Create a DIS that is the set difference of two DIS. |
| 50 | + |
| 51 | +- **Symmetric Difference**: `operator^(disjoint_interval_set, disjoint_interval_set)` |
| 52 | + |
| 53 | + Create a DIS that is the symmetric difference of two DIS. |
| 54 | + |
| 55 | +## Predicates |
24 | 56 |
|
25 | | -## DIS Predicates |
26 | 57 | The DIS supports the following predicates: |
27 | 58 |
|
28 | | -1. `is_empty(disjoint_interval_set)`: Check if a DIS is empty. |
| 59 | +- **Empty**: `is_empty(disjoint_interval_set)`: Check if a DIS is empty. |
29 | 60 |
|
30 | | -2. relational predicates `==`, `!=`, `<`, `<=`, `>`, `>=`: |
| 61 | +- **Relational Predicates**: `==`, `!=`, `<`, `<=`, `>`, `>=`: |
31 | 62 |
|
32 | | - Compare two DIS for equality, inequality, subset, proper subset, superset, |
33 | | - and proper superset. |
| 63 | + Compare two DIS for equality, inequality, subset, proper subset, superset, |
| 64 | + and proper superset. |
34 | 65 |
|
35 | | - These also work with intervals and values. For example, `DIS == interval`, |
36 | | - since an interval can be considered a DIS with a single interval and a |
37 | | - value can be considered an interval with a single value, `[value, value]`. |
| 66 | + These also work with intervals and values. For example, `DIS == interval`, |
| 67 | + since an interval can be considered a DIS with a single interval and a |
| 68 | + value can be considered an interval with a single value, `[value, value]`. |
38 | 69 |
|
39 | | -3. `contains(disjoint_interval_set, value)`: Check if a DIS contains a value. |
| 70 | +- **Set Membership**: `contains(disjoint_interval_set, value)` |
40 | 71 |
|
| 72 | + Check if a DIS contains a value. |
41 | 73 |
|
42 | | -## Generic Programming |
| 74 | +## Interval Type |
43 | 75 |
|
44 | 76 | The DIS is parameterized by the interval type. The interval type must |
45 | | -satisfy the concept of an interval: |
46 | | - |
| 77 | +satisfy the concept of an interval. |
47 | 78 |
|
48 | 79 | ### Interval Concept |
| 80 | + |
49 | 81 | An interval is a pair of values that satisfy the following axioms: |
50 | 82 |
|
51 | | -1. `lower(interval)`: Return the lower bound of the interval. |
52 | | -2. `upper(interval)`: Return the upper bound of the interval. |
53 | | -3. `contains(interval, value)`: Check if the interval contains a value. |
| 83 | +- `infimum(interval)`: Return the infimum of the interval. |
| 84 | +- `supremum(interval)`: Return the supremum of the interval. |
| 85 | +- `contains(interval, value)`: Check if the interval contains a value. |
0 commit comments