Documentation

Regex.Interval.Basic

Interval Set #

This file contains the definition of interval sets (IntervalSet), a sorted set of non-overlapping intervals (Interval.nonOverlapping).

structure NonemptyInterval (α : Type) [LE α] extends α × α :
  • fst : α
  • snd : α
  • fst_le_snd : self.fst ≤ self.snd

    The starting point of an interval is smaller than the endpoint.

Instances For
    theorem NonemptyInterval.ext_iff {α : Type} {inst✝ : LE α} {x y : NonemptyInterval α} :
    x = y ↔ x.toProd = y.toProd
    theorem NonemptyInterval.ext {α : Type} {inst✝ : LE α} {x y : NonemptyInterval α} (toProd : x.toProd = y.toProd) :
    x = y
    class BoundedOrder (α : Type) [LE α] :

    A bounded order describes an order (≤) with a top and bottom element, see Mathlib.Order.BoundedOrder

    • bot : α
    • bot_le (a : α) : bot ≤ a
    • top : α
    • le_top (a : α) : a ≤ top
    Instances
      @[instance_reducible]

      BoundedOrder is used to define negation of interval sets (IntervalSet.negate).

      theorem NonemptyInterval.eq_val_of_eq {α : Type} [LE α] {x y : NonemptyInterval α} (h : x = y) :
      x.fst = y.fst ∧ x.snd = y.snd
      @[instance_reducible]
      def Interval.nonOverlapping {α : Type} [LE α] [HSub α α Nat] (r1 r2 : NonemptyInterval α) :

      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).

      Instances For
        @[instance_reducible]
        def Interval.intersection {α : Type} [LE α] [(a b : α) → Decidable (a ≤ b)] (r1 r2 : NonemptyInterval α) :

        create intersection of intervals r1 and r2 if it exists.

        Instances For
          def Interval.Char.sub (c₁ c₂ : Char) :
          Instances For
            @[instance_reducible]
            theorem Interval.Char.sub_def {a b : Char} :
            sub a b = a - b

            create interval between intervals r1 and r2.

            Instances For

              remove duplicate

              Instances For
                def Intervals.dataIsNonOverlapping {α : Type} [LE α] [HSub α α Nat] (intervals : List (NonemptyInterval α)) :

                a list of intervals is non overlapping when intervals are sorted and no intervals are overlapping or adjacent

                Instances For
                  def Intervals.nonOverlapping {α : Type} [LE α] [HSub α α Nat] (intervals : Array (NonemptyInterval α)) :

                  an array of intervals is non overlapping when intervals.data is non overlapping

                  Instances For
                    structure IntervalSet (α : Type) [LT α] [LE α] [HSub α α Nat] [(a b : α) → Decidable (a < b)] [(a b : α) → Decidable (a = b)] :

                    A sorted set of non-overlapping intervals.

                    Instances For

                      last element of array intervals is non overlapping with NonemptyInterval next

                      Instances For
                        structure Interval.Acc :

                        Accumulator for loop in canonicalize

                        Instances For

                          is next.fst equal to n.fst

                          Instances For