Documentation

Provenance.Semirings.Interval

Intervals over linear orders #

This file defines closed/open intervals over a linear order and the operations needed to build the interval-union semiring.

Main definitions #

Main results #

structure Endpoint (α : Type) :

An endpoint of an interval: a value together with a boolean flag indicating whether the endpoint is included (closed = true) or excluded (closed = false).

  • val : α
  • closed : Bool
Instances For
    theorem Endpoint.ext {α : Type} {x y : Endpoint α} (val : x.val = y.val) (closed : x.closed = y.closed) :
    x = y
    theorem Endpoint.ext_iff {α : Type} {x y : Endpoint α} :
    x = y x.val = y.val x.closed = y.closed
    @[implicit_reducible]
    Equations
    • One or more equations did not get rendered due to their size.
    def Endpoint.minLo {α : Type} [LinearOrder α] (a b : Endpoint α) :
    Equations
    Instances For
      theorem Endpoint.minLo_or {α : Type} [LinearOrder α] (a b : Endpoint α) :
      a.minLo b = a a.minLo b = b
      theorem Endpoint.minLo_commutative {α : Type} [LinearOrder α] {a b : Endpoint α} :
      a.minLo b = b.minLo a
      theorem Endpoint.minLo_le_left {α : Type} [LinearOrder α] {a b : Endpoint α} :
      (a.minLo b).val a.val
      def Endpoint.maxHi {α : Type} [LinearOrder α] (a b : Endpoint α) :
      Equations
      Instances For
        theorem Endpoint.maxHi_or {α : Type} [LinearOrder α] (a b : Endpoint α) :
        a.maxHi b = a a.maxHi b = b
        theorem Endpoint.maxHi_commutative {α : Type} [LinearOrder α] {a b : Endpoint α} :
        a.maxHi b = b.maxHi a
        theorem Endpoint.le_maxHi_left {α : Type} [LinearOrder α] {a b : Endpoint α} :
        a.val (a.maxHi b).val
        def Endpoint.below {α : Type} [LinearOrder α] (x : α) (hi : Endpoint α) :

        below x hi holds when x is on the correct side of the upper endpoint hi, respecting its closedness: x ≤ hi.val if closed, x < hi.val if open.

        Equations
        Instances For
          def Endpoint.above {α : Type} [LinearOrder α] (x : α) (lo : Endpoint α) :

          above x lo holds when x is on the correct side of the lower endpoint lo, respecting its closedness: lo.val ≤ x if closed, lo.val < x if open.

          Equations
          Instances For
            theorem Endpoint.le_of_below {α : Type} [LinearOrder α] (x : α) (lo : Endpoint α) :
            below x lox lo.val
            theorem Endpoint.ge_of_above {α : Type} [LinearOrder α] (x : α) (hi : Endpoint α) :
            above x hix hi.val
            theorem Endpoint.below_of_below_of_lt {α : Type} [LinearOrder α] {hi hi' : Endpoint α} (h : hi.val < hi'.val) {x : α} :
            below x hibelow x hi'
            theorem Endpoint.below_of_below_of_le {α : Type} [LinearOrder α] {hi hi' : Endpoint α} (h : hi.val hi'.val) (hep : ¬hi.closed = true hi'.closed = true) {x : α} :
            below x hibelow x hi'
            theorem Endpoint.above_of_above_of_lt {α : Type} [LinearOrder α] {lo lo' : Endpoint α} (h : lo'.val < lo.val) {x : α} :
            above x loabove x lo'
            theorem Endpoint.above_of_above_of_le {α : Type} [LinearOrder α] {lo lo' : Endpoint α} (h : lo'.val lo.val) (hep : ¬lo.closed = true lo'.closed = true) {x : α} :
            above x loabove x lo'

            Endpoint operations for intersection and difference #

            def Endpoint.maxLo {α : Type} [LinearOrder α] (a b : Endpoint α) :

            Most restrictive (largest) lower endpoint: above x (maxLo a b) ↔ above x a ∧ above x b.

            Equations
            Instances For
              def Endpoint.minHi {α : Type} [LinearOrder α] (a b : Endpoint α) :

              Most restrictive (smallest) upper endpoint: below x (minHi a b) ↔ below x a ∧ below x b.

              Equations
              Instances For
                theorem Endpoint.above_maxLo {α : Type} [LinearOrder α] (x : α) (a b : Endpoint α) :
                above x (a.maxLo b) above x a above x b
                theorem Endpoint.below_minHi {α : Type} [LinearOrder α] (x : α) (a b : Endpoint α) :
                below x (a.minHi b) below x a below x b
                structure Interval (α : Type) [LinearOrder α] :

                An interval over a linear order, given by a lower endpoint lo and an upper endpoint hi satisfying lo.val < hi.val (strict) or lo.val = hi.val with both endpoints closed (degenerate point interval).

                Instances For
                  theorem Interval.ext_iff {α : Type} {inst✝ : LinearOrder α} {x y : Interval α} :
                  x = y x.lo = y.lo x.hi = y.hi
                  theorem Interval.ext {α : Type} {inst✝ : LinearOrder α} {x y : Interval α} (lo : x.lo = y.lo) (hi : x.hi = y.hi) :
                  x = y
                  @[simp]
                  theorem Interval.le_lo_hi {α : Type} [LinearOrder α] (I : Interval α) :
                  @[simp]
                  @[simp]
                  def Interval.toSet {α : Type} [LinearOrder α] (I : Interval α) :
                  Set α

                  The set of points belonging to an interval: those x that are above lo and below hi according to their respective closedness flags.

                  Equations
                  Instances For
                    theorem Interval.eq_closed_lo {α : Type} [LinearOrder α] [DenselyOrdered α] {I J : Interval α} (h : I.toSet = J.toSet) :
                    theorem Interval.eq_closed_hi {α : Type} [LinearOrder α] [DenselyOrdered α] {I J : Interval α} (h : I.toSet = J.toSet) :
                    theorem Interval.eq_closed {α : Type} [LinearOrder α] [DenselyOrdered α] {I J : Interval α} (h : I.toSet = J.toSet) :
                    theorem Interval.toSet_not_empty {α : Type} [LinearOrder α] [DenselyOrdered α] (I : Interval α) :
                    ∃ (x : α), x I.toSet
                    theorem Interval.ext_toSet {α : Type} [LinearOrder α] [DenselyOrdered α] {I J : Interval α} (h : I.toSet = J.toSet) :
                    I = J
                    theorem Interval.ext_toSet_iff {α : Type} [LinearOrder α] [DenselyOrdered α] {I J : Interval α} :
                    I = J I.toSet = J.toSet
                    @[simp]
                    theorem Interval.mem {α : Type} [LinearOrder α] (x : α) (I : Interval α) :
                    def Interval.disjoint {α : Type} [LinearOrder α] (I J : Interval α) :

                    Two intervals are disjoint when their point sets have empty intersection.

                    Equations
                    Instances For
                      theorem Interval.not_mem_of_disjoint_right {α : Type} [LinearOrder α] {I J : Interval α} (h : I.disjoint J) (x : α) :
                      x J.toSetxI.toSet
                      @[implicit_reducible]
                      Equations
                      • One or more equations did not get rendered due to their size.
                      def Interval.before {α : Type} [LinearOrder α] (I J : Interval α) :

                      I.before J means the intervals are strictly separated and cannot be merged: either I.hi.val < J.lo.val, or the endpoints meet at the same value but both are open.

                      Equations
                      Instances For
                        theorem Interval.disjoint_of_before {α : Type} [LinearOrder α] {I J : Interval α} :
                        I.before JI.disjoint J
                        @[implicit_reducible]
                        Equations
                        • One or more equations did not get rendered due to their size.
                        @[simp]
                        theorem Interval.le_of_before {α : Type} [LinearOrder α] {I J : Interval α} (h : I.before J) :
                        I J
                        theorem Interval.before_of_before_of_le {α : Type} [LinearOrder α] {I J K : Interval α} (hIJ : I.before J) (hJK : J K) :
                        I.before K

                        Interval intersection #

                        def Interval.inter {α : Type} [LinearOrder α] (I J : Interval α) :

                        Intersection of two intervals: empty or a single interval.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          theorem Interval.mem_inter {α : Type} [LinearOrder α] (I J : Interval α) (x : α) :
                          (∃ KI.inter J, x K.toSet) x I.toSet x J.toSet

                          Interval difference #

                          above x e is the negation of below x at the complemented endpoint.

                          below x e is the negation of above x at the complemented endpoint.

                          def Interval.diff {α : Type} [LinearOrder α] (I J : Interval α) :

                          Difference I \ J: the left piece (below J) and right piece (above J) of I.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            theorem Interval.mem_diff {α : Type} [LinearOrder α] (I J : Interval α) (x : α) :
                            (∃ KI.diff J, x K.toSet) x I.toSet xJ.toSet