Interval Set #
This file contains the definition of interval sets (IntervalSet
),
a sorted set of non-overlapping intervals (Interval.nonOverlapping
).
BoundedOrder is used to define negation of interval sets (IntervalSet.negate
).
Equations
- instBoundedOrderChar = { bot := Char.min, bot_le := Char.min_le, top := Char.max, le_top := Char.le_max }
Equations
- One or more equations did not get rendered due to their size.
Equations
- instInhabitedNonemptyIntervalChar = { default := { toProd := default, fst_le_snd := instInhabitedNonemptyIntervalChar.proof_1 } }
Nonempty intervals r1
and r2
are non overlapping when they are sorted and
they are not overlapping or adjacent, i.e. the difference of r2.fst
and r1.snd
is greater than one. Intervals with a difference of one are canonicalized
to a new NonemptyInterval (IntervalSet.canonicalize
).
Equations
- Interval.nonOverlapping r1 r2 = (1 < r2.fst - r1.snd)
Instances For
Equations
- Interval.instDecidableNonOverlapping r1 r2 = inferInstanceAs (Decidable (1 < r2.fst - r1.snd))
create intersection of intervals r1
and r2
if it exists.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Interval.Char.sub c₁ c₂ = c₁.toNat - c₂.toNat
Instances For
Equations
- Interval.instHSubCharNat_regex = { hSub := Interval.Char.sub }
create interval between intervals r1
and r2
.
Equations
- Interval.between r1 r2 h = { toProd := (r1.snd.increment, r2.fst.decrement), fst_le_snd := ⋯ }
Instances For
remove duplicate
Equations
- One or more equations did not get rendered due to their size.
Instances For
a list of intervals is non overlapping when intervals are sorted and no intervals are overlapping or adjacent
Equations
- Intervals.dataIsNonOverlapping [] = (true = true)
- Intervals.dataIsNonOverlapping [head] = (true = true)
- Intervals.dataIsNonOverlapping (head :: tail) = List.Chain Interval.nonOverlapping head tail
Instances For
an array of intervals is non overlapping when intervals.data
is non overlapping
Equations
- Intervals.nonOverlapping intervals = Intervals.dataIsNonOverlapping intervals.toList
Instances For
A sorted set of non-overlapping intervals.
- intervals : Array (NonemptyInterval α)
- isNonOverlapping : Intervals.nonOverlapping self.intervals
Instances For
Equations
- instToStringIntervalSetChar = { toString := fun (s : IntervalSet Char) => toString "" ++ toString s.intervals ++ toString "" }
last element of array intervals
is non overlapping with NonemptyInterval next
Equations
- Interval.nonOverlappingWithLast intervals (some next_2) = Interval.nonOverlapping last next_2
- Interval.nonOverlappingWithLast intervals (some val) = (true = true)
- Interval.nonOverlappingWithLast intervals none = (true = true)
- Interval.nonOverlappingWithLast intervals none = (false = true)
Instances For
Accumulator for loop in canonicalize
- next : Option (NonemptyInterval Char)
- set : IntervalSet Char
- nonOverlapping : Interval.nonOverlappingWithLast self.set.intervals self.next
Instances For
Equations
- acc.push next h = { intervals := acc.set.intervals.push next, isNonOverlapping := h }
Instances For
is next.fst
equal to n.fst
Equations
- Interval.is_start_eq (some next_2) n = (next_2.fst = n.fst)
- Interval.is_start_eq next n = (true = true)