The shape of a range's upper or lower bound: open
, closed
or unbounded
.
- open : BoundShape
An open upper (or lower) bound of this shape requires elements of a range to be less than (or greater than) the bound, excluding the bound itself.
- closed : BoundShape
A closed upper (or lower) bound of this shape requires elements of a range to be less than or equal (or greater than or equal) to the bound.
- unbounded : BoundShape
This bound shape signifies the absence of a range bound, so that the range is unbounded in at least one direction.
Instances For
The shape of a range, consisting of the shape of its upper and lower bounds.
- lower : BoundShape
The shape of the range's lower bound.
- upper : BoundShape
The shape of the range's upper bound.
Instances For
An upper or lower bound in α
of the given shape.
Equations
Instances For
A range of elements of some type α
. It is characterized by its upper and lower bounds, which
may be inclusive, exclusive or absent.
a...=b
is the range of elements greater than or equal toa
and less than or equal tob
.a<...=b
is the range of elements greater thana
and less than or equal tob
.a...b
ora...<b
is the range of elements greater than or equal toa
and less thanb
.a<...b
ora<...<b
is the range of elements greater thana
and less thanb
.*...=b
is the range of elements less than or equal tob
.*...b
or*...<b
is the range of elements less thanb
.a...*
is the range of elements greater than or equal toa
.a<...*
is the range of elements greater thana
.*...*
contains all elements ofα
.
The lower bound of the range.
The upper bound of the range.
Instances For
a...*
is the range of elements greater than or equal to a
. See also Std.PRange
.
Equations
- Std.PRange.«term_...*» = Lean.ParserDescr.trailingNode `Std.PRange.«term_...*» 1024 0 (Lean.ParserDescr.symbol "...*")
Instances For
*...*
is the range that is unbounded in both directions. See also Std.PRange
.
Equations
- Std.PRange.«term*...*» = Lean.ParserDescr.node `Std.PRange.«term*...*» 1024 (Lean.ParserDescr.symbol "*...*")
Instances For
a<...*
is the range of elements greater than a
. See also Std.PRange
.
Equations
- Std.PRange.«term_<...*» = Lean.ParserDescr.trailingNode `Std.PRange.«term_<...*» 1024 0 (Lean.ParserDescr.symbol "<...*")
Instances For
a...<b
is the range of elements greater than or equal to a
and less than b
.
See also Std.PRange
.
Equations
- Std.PRange.«term_...<_» = Lean.ParserDescr.trailingNode `Std.PRange.«term_...<_» 1024 0 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "...<") (Lean.ParserDescr.cat `term 0))
Instances For
a...b
is the range of elements greater than or equal to a
and less than b
.
See also Std.PRange
.
Equations
- Std.PRange.«term_..._» = Lean.ParserDescr.trailingNode `Std.PRange.«term_..._» 1024 0 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "...") (Lean.ParserDescr.cat `term 0))
Instances For
*...<b
is the range of elements less than b
. See also Std.PRange
.
Equations
- Std.PRange.«term*...<_» = Lean.ParserDescr.node `Std.PRange.«term*...<_» 1024 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "*...<") (Lean.ParserDescr.cat `term 0))
Instances For
*...b
is the range of elements less than b
. See also Std.PRange
.
Equations
- Std.PRange.«term*..._» = Lean.ParserDescr.node `Std.PRange.«term*..._» 1024 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "*...") (Lean.ParserDescr.cat `term 0))
Instances For
a<...<b
is the range of elements greater than a
and less than b
.
See also Std.PRange
.
Equations
- Std.PRange.«term_<...<_» = Lean.ParserDescr.trailingNode `Std.PRange.«term_<...<_» 1024 0 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "<...<") (Lean.ParserDescr.cat `term 0))
Instances For
a<...b
is the range of elements greater than a
and less than b
.
See also Std.PRange
.
Equations
- Std.PRange.«term_<..._» = Lean.ParserDescr.trailingNode `Std.PRange.«term_<..._» 1024 0 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "<...") (Lean.ParserDescr.cat `term 0))
Instances For
a...=b
is the range of elements greater than or equal to a
and less than or equal to b
.
See also Std.PRange
.
Equations
- Std.PRange.«term_...=_» = Lean.ParserDescr.trailingNode `Std.PRange.«term_...=_» 1024 0 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "...=") (Lean.ParserDescr.cat `term 0))
Instances For
*...=b
is the range of elements less than or equal to b
. See also Std.PRange
.
Equations
- Std.PRange.«term*...=_» = Lean.ParserDescr.node `Std.PRange.«term*...=_» 1024 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "*...=") (Lean.ParserDescr.cat `term 0))
Instances For
a<...=b
is the range of elements greater than a
and less than or equal to b
.
See also Std.PRange
.
Equations
- Std.PRange.«term_<...=_» = Lean.ParserDescr.trailingNode `Std.PRange.«term_<...=_» 1024 0 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "<...=") (Lean.ParserDescr.cat `term 0))
Instances For
This typeclass provides decidable lower bound checks of the given shape.
Instances are automatically provided in the following cases:
shape
isopen
and there is anLT α
instanceshape
isclosed
and there is anLE α
instanceshape
is.unbounded
- decidableSatisfiesLowerBound : DecidableRel IsSatisfied
Instances
Equations
- Std.PRange.instSupportsLowerBoundUnbounded = { IsSatisfied := fun (x : Std.PRange.Bound Std.PRange.BoundShape.unbounded α) (x : α) => True, decidableSatisfiesLowerBound := inferInstance }
This typeclass provides decidable upper bound checks of the given shape.
Instances are automatically provided in the following cases:
shape
isopen
and there is anLT α
instanceshape
isclosed
and there is anLE α
instanceshape
is.unbounded
- decidableSatisfiesUpperBound : DecidableRel IsSatisfied
Instances
Equations
- Std.PRange.instSupportsUpperBoundUnbounded = { IsSatisfied := fun (x : Std.PRange.Bound Std.PRange.BoundShape.unbounded α) (x : α) => True, decidableSatisfiesUpperBound := inferInstance }
Equations
- One or more equations did not get rendered due to their size.
This typeclass ensures that ranges with the given shape of upper bounds are always finite.
This is a prerequisite for many functions and instances, such as PRange.toList
or ForIn'
.
Instances
This typeclass will usually be used together with UpwardEnumerable α
. It provides the starting
point from which to enumerate all the values above the given lower bound.
Instances are automatically generated in the following cases:
lowerBoundShape
is.closed
lowerBoundShape
is.open
and there is anUpwardEnumerable α
instancelowerBoundShape
is.unbounded
and there is aLeast? α
instance
Instances
This typeclass ensures that the lower bound predicate from SupportsLowerBound sl α
can be characterized in terms of UpwardEnumerable α
and BoundedUpwardEnumerable sl α
.
- isSatisfied_iff (a : α) (l : Bound sl α) : SupportsLowerBound.IsSatisfied l a ↔ ∃ (init : α), BoundedUpwardEnumerable.init? l = some init ∧ UpwardEnumerable.LE init a
An element
a
satisfies the lower boundl
if and only if it isBoundedUpwardEnumerable.init? l
or one of its transitive successors.
Instances
This typeclass ensures that if b
is a transitive successor of a
and b
satisfies an upper bound
of the given shape, then a
also satisfies the upper bound.
- isSatisfied_of_le (u : Bound su α) (a b : α) : SupportsUpperBound.IsSatisfied u b → UpwardEnumerable.LE a b → SupportsUpperBound.IsSatisfied u a
If
b
is a transitive successor ofa
andb
satisfies a certain upper bound, thena
also satisfies the upper bound.
Instances
This typeclass ensures that SupportsUpperBound .closed α
and UpwardEnumerable α
instances
are compatible.
- isSatisfied_iff_le (u : Bound BoundShape.closed α) (a : α) : SupportsUpperBound.IsSatisfied u a ↔ UpwardEnumerable.LE a u
A closed upper bound is satisfied for
a
if and only if it is greater than or equal toa
according toUpwardEnumerable.LE
.
Instances
This typeclass ensures that SupportsUpperBound .open α
and UpwardEnumerable α
instances
are compatible.
- isSatisfied_iff_le (u : Bound BoundShape.open α) (a : α) : SupportsUpperBound.IsSatisfied u a ↔ UpwardEnumerable.LT a u
An open upper bound is satisfied for
a
if and only if it is greater than toa
according toUpwardEnumerable.LT
.
Instances
This typeclass ensures that according to SupportsUpperBound .unbounded α
, every element is
in bounds.
An unbounded upper bound is satisfied for every element.
Instances
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
Equations
- Std.PRange.instBoundedUpwardEnumerableOpenOfUpwardEnumerable = { init? := fun (lower : Std.PRange.Bound Std.PRange.BoundShape.open α) => Std.PRange.UpwardEnumerable.succ? lower }
Equations
- Std.PRange.instBoundedUpwardEnumerableClosed = { init? := fun (lower : Std.PRange.Bound Std.PRange.BoundShape.closed α) => some lower }
This typeclass allows taking the intersection of ranges of the given shape and half-open ranges.
An element should be contained in the intersection if and only if it is contained in both ranges.
This is encoded in LawfulClosedOpenIntersection
.
- intersection : PRange shape α → PRange { lower := BoundShape.closed, upper := BoundShape.open } α → PRange { lower := BoundShape.closed, upper := BoundShape.open } α
Instances
This typeclass ensures that the intersection according to ClosedOpenIntersection shape α
of two ranges contains exactly those elements that are contained in both ranges.
- mem_intersection_iff {a : α} {r : PRange { lower := shape.lower, upper := shape.upper } α} {s : PRange { lower := BoundShape.closed, upper := BoundShape.open } α} : a ∈ ClosedOpenIntersection.intersection r s ↔ a ∈ r ∧ a ∈ s
The intersection according to
ClosedOpenIntersection shapee α
of two ranges contains exactly those elements that are contained in both ranges.