Relations between intervals #
This file defines the relations between two nonempty intervals of an ordered type that mathlib's
NonemptyInterval API leaves implicit, and their counterparts on Interval, the intervals with
a null element. Two intervals overlap when neither lies strictly beyond the other, i₁ precedes
i₂ when it ends strictly before i₂ starts, and IsBefore lets the endpoints touch. During
and FinalSubinterval refine containment, and IsPoint singles out the intervals with a single
element. In a linear order two intervals occupy exactly one of three positions, precedence either
way or overlap, and position records which as an Ordering, so that on point intervals it is
compare.
Containment, the subinterval order and point intervals are mathlib's own (t ∈ i, i₁ ≤ i₂,
pure t); lt_def unfolds strict containment to endpoints. On Interval α, where ≤ is
inclusion and ⊓ intersection, Interval.Precedes is precedence stated pointwise, a left
endpoint is IsLeast of the coerced set, NonemptyInterval.withTop embeds a bounded interval
into WithTop α, and Interval.Ici a is the ray [a, ⊤].
Main definitions #
NonemptyInterval.Overlaps,NonemptyInterval.Precedes,NonemptyInterval.IsBefore: the order of two intervals.NonemptyInterval.During,NonemptyInterval.FinalSubinterval: refinements of containment.NonemptyInterval.position: the position of two intervals in a linear order as anOrdering.Interval.Precedes,Interval.Ici: pointwise precedence and rays on intervals with a null element.
References #
Relations between intervals #
Two intervals overlap when neither lies strictly beyond the other.
Equations
- i₁.Overlaps i₂ = (i₁.toProd.1 ≤ i₂.toProd.2 ∧ i₂.toProd.1 ≤ i₁.toProd.2)
Instances For
An interval is a point when its endpoints coincide.
Equations
- i.IsPoint = (i.toProd.1 = i.toProd.2)
Instances For
i₁ is before i₂ when i₁ ends at or before i₂ starts.
Equations
- i₁.IsBefore i₂ = (i₁.toProd.2 ≤ i₂.toProd.1)
Instances For
i₁ is a final subinterval of i₂ when it lies within i₂ and shares its right endpoint.
Equations
- i₁.FinalSubinterval i₂ = (i₁ ≤ i₂ ∧ i₁.toProd.2 = i₂.toProd.2)
Instances For
Equations
- NonemptyInterval.instDecidableOverlaps = { decide := decide (i₁.toProd.1 ≤ i₂.toProd.2) && decide (i₂.toProd.1 ≤ i₁.toProd.2), reflects_decide := ⋯ }
Equations
- NonemptyInterval.instDecidableFinalSubinterval = { decide := decide (i₁ ≤ i₂) && decide (i₁.toProd.2 = i₂.toProd.2), reflects_decide := ⋯ }
Equations
- NonemptyInterval.instDecidableMemOfDecidableLE_linglib = decidable_of_iff' (s.toProd.1 ≤ a ∧ a ≤ s.toProd.2) ⋯
Equations
- NonemptyInterval.instDecidableLtOfDecidableLE_linglib = decidable_of_iff' (s ≤ t ∧ ¬t ≤ s) ⋯
i₁ precedes i₂ when i₁ ends strictly before i₂ starts.
Equations
- i₁.Precedes i₂ = (i₁.toProd.2 < i₂.toProd.1)
Instances For
i₁ lies during i₂ when it is strictly inside i₂ on both sides.
Equations
- i₁.During i₂ = (i₂.toProd.1 < i₁.toProd.1 ∧ i₁.toProd.2 < i₂.toProd.2)
Instances For
Equations
- NonemptyInterval.instDecidablePrecedesOfDecidableLE = decidable_of_iff' (i₁.toProd.2 ≤ i₂.toProd.1 ∧ ¬i₂.toProd.1 ≤ i₁.toProd.2) ⋯
Equations
- NonemptyInterval.instDecidableDuringOfDecidableLE = instDecidableAnd
Subintervals overlap their containing intervals.
A subinterval of an interval preceding i₃ precedes i₃.
Precedence and overlap are mutually exclusive.
Strict containment unfolded to endpoints, i₁ ≤ i₂ with a strictly interior endpoint.
An interval containing an overlapping interval overlaps.
Relative position #
In a linear order two intervals stand in exactly one of three positions: the first precedes the
second, the second precedes the first, or they overlap. position records which as an
Ordering, so that a set of admissible positions is a Finset Ordering, as a set of admissible
comparisons of points is; on point intervals it is compare.
The position of i₁ relative to i₂ is lt when i₁ precedes i₂, gt when i₂
precedes i₁, and eq when the two overlap.
Equations
Instances For
On point intervals the position is the comparison of the points.
An interval containing one that overlaps i₂ overlaps i₂.
Embedding into WithTop #
An interval of α as an interval of WithTop α.
Equations
- i.withTop = NonemptyInterval.map WithTop.coeOrderHom.toOrderHom i
Instances For
Intervals with a null element #
s precedes t when every element of s is below every element of t, Allen's before
stated pointwise, vacuously so at the null interval.
Equations
- s.Precedes t = ∀ ⦃x : α⦄, x ∈ s → ∀ ⦃y : α⦄, y ∈ t → x < y
Instances For
A nonempty interval lies within s exactly when its endpoints do.
The left endpoint is the least element.
Nonempty intervals precede exactly when the one ends before the other starts, the endpoint form of the relation.
Nonempty intervals meet exactly when they overlap, the endpoint form of the relation.
Rays #
An interval lies within the ray from a exactly when all its elements are at or above a.
A bounded interval lies within the ray from a exactly when it starts at or above a.
A bounded interval precedes the point a exactly when it ends below a.
A bounded interval meets the ray from a exactly when it ends at or above a.