theorem
Intervals.single_isNonOverlapping
(ranges : Array (NonemptyInterval Char))
(h : ranges.size = 1)
:
Intervals.nonOverlapping ranges
instance
Intervals.instInhabitedIntervalSet
(α : Type)
[LT α]
[LE α]
[HSub α α Nat]
[(a b : α) → Decidable (a < b)]
[(a b : α) → Decidable (a = b)]
:
Inhabited (IntervalSet α)
Equations
- Intervals.instInhabitedIntervalSet α = { default := { intervals := #[], isNonOverlapping := ⋯ } }
Equations
- Intervals.singleton r = { intervals := #[r], isNonOverlapping := ⋯ }
Instances For
theorem
Intervals.isNonOverlapping
(l r : NonemptyInterval Char)
(h1 : ¬r.fst.toNat - l.snd.toNat = 1)
(h2 : ¬r.fst < l.snd)
(h3 : ¬l.snd = r.fst)
:
theorem
Intervals.nonOverlappingWithLast_of_empty
(ranges : Array (NonemptyInterval Char))
(next : Option (NonemptyInterval Char))
(h2 : ranges.size = 0)
:
Interval.nonOverlappingWithLast ranges next
theorem
Intervals.nonOverlappingWithLast_with_none_eq_empty
(acc : Interval.Acc)
(h : acc.next.isNone = true)
:
acc.set.intervals.size = 0
theorem
Intervals.nonOverlappingWithLast_of_none
(acc : Interval.Acc)
(n : NonemptyInterval Char)
(h : acc.next.isNone = true)
:
Interval.nonOverlappingWithLast acc.set.intervals (some n)
theorem
Intervals.nonOverlappingWithLast_of_val
(acc : Interval.Acc)
(n : NonemptyInterval Char)
(h : Interval.is_start_eq acc.next n)
:
Interval.nonOverlappingWithLast acc.set.intervals (some n)
theorem
Intervals.is_start_eq_of_val
{l : NonemptyInterval Char}
(next : Option (NonemptyInterval Char))
(n : NonemptyInterval Char)
(hm : next = some l)
(hx : l.fst = n.fst)
:
Interval.is_start_eq next n
theorem
Intervals.is_start_eq_of_none
(next : Option (NonemptyInterval Char))
(n : NonemptyInterval Char)
(hm : next = none)
:
Interval.is_start_eq next n
theorem
Intervals.nonOverlappingWithLast_of_singleton
(l r : NonemptyInterval Char)
(h : Interval.nonOverlapping l r)
:
Interval.nonOverlappingWithLast (Intervals.singleton l).intervals (some r)
theorem
Intervals.nonOverlapping_of_push
{last : NonemptyInterval Char}
(acc : Interval.Acc)
(next : NonemptyInterval Char)
(h1 : acc.set.intervals.last? = some last)
(h2 : acc.next = some next)
:
Intervals.nonOverlapping (acc.set.intervals.push next)
theorem
Intervals.nonOverlapping_of_nth
{head : NonemptyInterval Char}
{tail : List (NonemptyInterval Char)}
(ranges : Array (NonemptyInterval Char))
(n : Nat)
(h1 : 0 < n)
(h2 : n + 1 < ranges.size)
(h3 : ranges.toList = head :: tail)
(h4 : ∀ (i : Nat) (h : i < tail.length - 1), Interval.nonOverlapping (tail.get ⟨i, ⋯⟩) (tail.get ⟨i + 1, ⋯⟩))
:
Interval.nonOverlapping (ranges.get ⟨n, ⋯⟩) (ranges.get ⟨n + 1, h2⟩)
theorem
Intervals.nonOverlapping_of_pred
(ranges : Array (NonemptyInterval Char))
(i : Fin ranges.size)
(x y : NonemptyInterval Char)
(h : 0 < ↑i)
(hx : x = ranges.get ⟨↑i - 1, ⋯⟩)
(hy : y = ranges.get i)
(hr : Intervals.nonOverlapping ranges)
:
theorem
Intervals.nonOverlappingWithLast_of_push
{l r : NonemptyInterval Char}
(acc : Interval.Acc)
(h2 : Intervals.nonOverlapping (acc.set.intervals.push l))
(h3 : Interval.nonOverlapping l r)
:
Interval.nonOverlappingWithLast (acc.push l h2).intervals (some r)