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...=bis the range of elements greater than or equal toaand less than or equal tob.a...bora...<bis the range of elements greater than or equal toaand less thanb.a...*is the range of elements greater than or equal toa.a<...=bis the range of elements greater thanaand less than or equal tob.a<...bora<...<bis the range of elements greater thanaand less thanb.a<...*is the range of elements greater thana.*...=bis the range of elements less than or equal tob.*...bor*...<bis the range of elements less thanb.*...*contains all elements ofα.
The recommended spelling for these ranges can be found in the PRange.mk constructor's docstring.
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.
Conventions for notations in identifiers:
- The recommended spelling of
a...*in identifiers isRci.
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.
Conventions for notations in identifiers:
- The recommended spelling of
*...*in identifiers isRii.
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.
Conventions for notations in identifiers:
- The recommended spelling of
a<...*in identifiers isRoi.
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.
Conventions for notations in identifiers:
The recommended spelling of
a...bin identifiers isRco.The recommended spelling of
a...<bin identifiers isRco.
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.
Conventions for notations in identifiers:
- The recommended spelling of
a...bin identifiers isRco.
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.
Conventions for notations in identifiers:
The recommended spelling of
*...bin identifiers isRio.The recommended spelling of
*...<bin identifiers isRio.
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.
Conventions for notations in identifiers:
- The recommended spelling of
*...bin identifiers isRio.
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.
Conventions for notations in identifiers:
The recommended spelling of
a<...bin identifiers isRoo.The recommended spelling of
a<...<bin identifiers isRoo.
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.
Conventions for notations in identifiers:
- The recommended spelling of
a<...bin identifiers isRoo.
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.
Conventions for notations in identifiers:
- The recommended spelling of
a...=bin identifiers isRcc.
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.
Conventions for notations in identifiers:
- The recommended spelling of
*...=bin identifiers isRic.
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.
Conventions for notations in identifiers:
- The recommended spelling of
a<...=bin identifiers isRoc.
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:
shapeisopenand there is anLT αinstanceshapeisclosedand there is anLE αinstanceshapeis.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:
shapeisopenand there is anLT αinstanceshapeisclosedand there is anLE αinstanceshapeis.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:
lowerBoundShapeis.closedlowerBoundShapeis.openand there is anUpwardEnumerable αinstancelowerBoundShapeis.unboundedand 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 : α), init? l = some init ∧ UpwardEnumerable.LE init a
An element
asatisfies the lower boundlif and only if it isinit? lor 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
bis a transitive successor ofaandbsatisfies a certain upper bound, thenaalso 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
aif and only if it is greater than or equal toaaccording 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
aif and only if it is greater than toaaccording 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.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 shape αof two ranges contains exactly those elements that are contained in both ranges.