This typeclass provides support for the size function for ranges with closed lower bound
(Rcc.size,
Rco.size and
Rci.size).
The returned size should be equal to the number of elements returned by toList. This
condition is captured by the typeclass
LawfulHasSize.
- size (lo hi : α) : Nat
Returns the number of elements starting from
lothat satisfy the given upper bound.
Instances
This typeclass ensures that a HasSize instance returns the correct size for all ranges.
If the smallest value in the range is beyond the upper bound, the size is zero.
- size_eq_one_of_succ?_eq_none (lo hi : α) (h : lo ≤ hi) (h' : PRange.succ? lo = none) : HasSize.size lo hi = 1
If the smallest value in the range satisfies the upper bound and has no successor, the size is one.
- size_eq_succ_of_succ?_eq_some (lo hi lo' : α) (h : lo ≤ hi) (h' : PRange.succ? lo = some lo') : HasSize.size lo hi = HasSize.size lo' hi + 1
If the smallest value in the range satisfies the upper bound and has a successor, the size is one larger than the size of the range starting at the successor.
Instances
This typeclass provides support for the size function for ranges with open lower bound
(Roc.size,
Roo.size and
Roi.size).
The returned size should be equal to the number of elements returned by toList. This
condition is captured by the typeclass
LawfulHasSize.
- size (lo hi : α) : Nat
Returns the number of elements starting from
lothat satisfy the given upper bound.
Instances
This typeclass ensures that a HasSize instance returns the correct size for all ranges.
If the smallest value in the range is beyond the upper bound, the size is zero.
- size_eq_one_of_succ?_eq_none (lo hi : α) (h : lo < hi) (h' : PRange.succ? lo = none) : HasSize.size lo hi = 1
If the smallest value in the range satisfies the upper bound and has no successor, the size is one.
- size_eq_succ_of_succ?_eq_some (lo hi lo' : α) (h : lo < hi) (h' : PRange.succ? lo = some lo') : HasSize.size lo hi = HasSize.size lo' hi + 1
If the smallest value in the range satisfies the upper bound and has a successor, the size is one larger than the size of the range starting at the successor.
Instances
This typeclass provides support for the size function for ranges with closed lower bound
(Ric.size,
Rio.size and
Rii.size).
The returned size should be equal to the number of elements returned by toList. This
condition is captured by the typeclass
LawfulHasSize.
- size (lo : α) : Nat
Returns the number of elements starting from
lothat satisfy the given upper bound.
Instances
This typeclass ensures that a HasSize instance returns the correct size for all ranges.
If the smallest value in the range satisfies the upper bound and has no successor, the size is one.
- size_eq_succ_of_succ?_eq_some (lo lo' : α) (h : PRange.succ? lo = some lo') : HasSize.size lo = HasSize.size lo' + 1
If the smallest value in the range satisfies the upper bound and has a successor, the size is one larger than the size of the range starting at the successor.
Instances
Checks whether the range contains any value.
This function returns a meaningful value given LawfulUpwardEnumerable and
LawfulUpwardEnumerableLE instances.
Instances For
Checks whether the range contains any value.
This function returns a meaningful value given LawfulUpwardEnumerable and
LawfulUpwardEnumerableLT instances.
Instances For
Checks whether the range contains any value. This function exists for completeness and always returns false: The closed lower bound is contained in the range, so left-closed right-unbounded ranges are never empty.
Instances For
Checks whether the range contains any value.
This function returns a meaningful value given LawfulUpwardEnumerable and
LawfulUpwardEnumerableLT instances.
Instances For
Checks whether the range contains any value.
This function returns a meaningful value given LawfulUpwardEnumerable and
LawfulUpwardEnumerableLT instances.
Instances For
Checks whether the range contains any value.
This function returns a meaningful value given a LawfulUpwardEnumerable instance.
Equations
- r.isEmpty = (Std.PRange.succ? r.lower).isNone
Instances For
Checks whether the range contains any value. This function exists for completeness and always returns false: The closed upper bound is contained in the range, so left-unbounded right-closed ranges are never empty.
Instances For
Checks whether the range contains any value.
This function returns a meaningful value given LawfulUpwardEnumerable,
LawfulUpwardEnumerableLT and LawfulUpwardEnumerableLeast? instances.
Instances For
Checks whether the range contains any value.
This function returns a meaningful value given LawfulUpwardEnumerable and
LawfulUpwardEnumerableLeast? instances.