Documentation

Regex.Interval.Basic

Interval Set #

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

theorem NonemptyInterval.ext {α : Type} :
∀ {inst : LE α} {x y : NonemptyInterval α}, x.toProd = y.toProdx = y
theorem NonemptyInterval.ext_iff {α : Type} :
∀ {inst : LE α} {x y : NonemptyInterval α}, x = y x.toProd = y.toProd
structure NonemptyInterval (α : Type) [LE α] extends Prod :
  • fst : α
  • snd : α
  • fst_le_snd : self.fst self.snd

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

Instances For
    theorem NonemptyInterval.fst_le_snd {α : Type} [LE α] (self : NonemptyInterval α) :
    self.fst self.snd

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

    class BoundedOrder (α : Type) [LE α] :

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

    • bot : α
    • bot_le : ∀ (a : α), BoundedOrder.bot a
    • top : α
    • le_top : ∀ (a : α), a BoundedOrder.top
    Instances
      theorem BoundedOrder.bot_le {α : Type} [LE α] [self : BoundedOrder α] (a : α) :
      BoundedOrder.bot a
      theorem BoundedOrder.le_top {α : Type} [LE α] [self : BoundedOrder α] (a : α) :
      a BoundedOrder.top

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

      Equations
      theorem NonemptyInterval.eq_val_of_eq {α : Type} [LE α] {x : NonemptyInterval α} {y : NonemptyInterval α} (h : x = y) :
      x.fst = y.fst x.snd = y.snd
      Equations
      • One or more equations did not get rendered due to their size.
      def Interval.nonOverlapping {α : Type} [LE α] [HSub α α Nat] (r1 : NonemptyInterval α) (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).

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

        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
          def Interval.Char.sub (c₁ : Char) (c₂ : Char) :
          Equations
          Instances For

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

                Equations
                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

                  Equations
                  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
                      theorem IntervalSet.isNonOverlapping {α : Type} [LT α] [LE α] [HSub α α Nat] [(a b : α) → Decidable (a < b)] [(a b : α) → Decidable (a = b)] (self : IntervalSet α) :

                      last element of array intervals is non overlapping with NonemptyInterval next

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        structure Interval.Acc :

                        Accumulator for loop in canonicalize

                        Instances For
                          def Interval.Acc.push (acc : Interval.Acc) (next : NonemptyInterval Char) (h : Intervals.nonOverlapping (acc.set.intervals.push next)) :
                          Equations
                          • acc.push next h = { intervals := acc.set.intervals.push next, isNonOverlapping := h }
                          Instances For

                            is next.fst equal to n.fst

                            Equations
                            Instances For