@@ -19,16 +19,6 @@ namespace Rxc
1919
2020variable {α : Type u} {lo hi : α} {a : α}
2121
22- /--
23- This typeclass provides support for the size function for ranges with closed lower bound
24- ({name (scope := "Init.Data.Range.Polymorphic")}`Rcc.size`,
25- {name (scope := "Init.Data.Range.Polymorphic")}`Rco.size` and
26- {name (scope := "Init.Data.Range.Polymorphic")}`Rci.size`).
27-
28- The returned size should be equal to the number of elements returned by {lit}`toList`. This
29- condition is captured by the typeclass
30- {name (scope := "Init.Data.Range.Polymorphic")}`LawfulRangeSize`.
31- -/
3222class HasSize (α : Type u) where
3323 /-- Returns the number of elements starting from {name}`lo` that satisfy the given upper bound. -/
3424 size (lo hi : α) : Nat
@@ -54,6 +44,18 @@ class LawfulHasSize (α : Type u) [LE α] [UpwardEnumerable α] [HasSize α] whe
5444 (h' : UpwardEnumerable.succ? lo = some lo') :
5545 HasSize.size lo hi = HasSize.size lo' hi + 1
5646
47+ /--
48+ This typeclass provides support for the size function for ranges with closed lower bound
49+ ({name (scope := "Init.Data.Range.Polymorphic.Iterators")}`Rcc.size`,
50+ {name (scope := "Init.Data.Range.Polymorphic.Iterators")}`Rco.size` and
51+ {name (scope := "Init.Data.Range.Polymorphic.Iterators")}`Rci.size`).
52+
53+ The returned size should be equal to the number of elements returned by {lit}`toList`. This
54+ condition is captured by the typeclass
55+ {name}`LawfulHasSize`.
56+ -/
57+ add_decl_doc HasSize
58+
5759export LawfulHasSize (size_eq_zero_of_not_le size_eq_one_of_succ?_eq_none
5860 size_eq_succ_of_succ?_eq_some)
5961
@@ -92,16 +94,6 @@ namespace Rxo
9294
9395variable {α : Type u} {lo hi : α} {a : α}
9496
95- /--
96- This typeclass provides support for the size function for ranges with open lower bound
97- ({name (scope := "Init.Data.Range.Polymorphic")}`Roc.size`,
98- {name (scope := "Init.Data.Range.Polymorphic")}`Roo.size` and
99- {name (scope := "Init.Data.Range.Polymorphic")}`Roi.size`).
100-
101- The returned size should be equal to the number of elements returned by {lit}`toList`. This
102- condition is captured by the typeclass
103- {name (scope := "Init.Data.Range.Polymorphic")}`LawfulRangeSize`.
104- -/
10597class HasSize (α : Type u) where
10698 /-- Returns the number of elements starting from {name}`lo` that satisfy the given upper bound. -/
10799 size (lo hi : α) : Nat
@@ -127,6 +119,18 @@ class LawfulHasSize (α : Type u) [LT α] [UpwardEnumerable α] [HasSize α] whe
127119 (h' : UpwardEnumerable.succ? lo = some lo') :
128120 HasSize.size lo hi = HasSize.size lo' hi + 1
129121
122+ /--
123+ This typeclass provides support for the size function for ranges with open lower bound
124+ ({name (scope := "Init.Data.Range.Polymorphic.Iterators")}`Roc.size`,
125+ {name (scope := "Init.Data.Range.Polymorphic.Iterators")}`Roo.size` and
126+ {name (scope := "Init.Data.Range.Polymorphic.Iterators")}`Roi.size`).
127+
128+ The returned size should be equal to the number of elements returned by {lit}`toList`. This
129+ condition is captured by the typeclass
130+ {name}`LawfulHasSize`.
131+ -/
132+ add_decl_doc HasSize
133+
130134export LawfulHasSize (size_eq_zero_of_not_le size_eq_one_of_succ?_eq_none
131135 size_eq_succ_of_succ?_eq_some)
132136
@@ -165,16 +169,6 @@ namespace Rxi
165169
166170variable {α : Type u} {lo : α} {a : α}
167171
168- /--
169- This typeclass provides support for the size function for ranges with closed lower bound
170- ({name (scope := "Init.Data.Range.Polymorphic")}`Ric.size`,
171- {name (scope := "Init.Data.Range.Polymorphic")}`Rio.size` and
172- {name (scope := "Init.Data.Range.Polymorphic")}`Rii.size`).
173-
174- The returned size should be equal to the number of elements returned by {lit}`toList`. This
175- condition is captured by the typeclass
176- {name (scope := "Init.Data.Range.Polymorphic")}`LawfulRangeSize`.
177- -/
178172class HasSize (α : Type u) where
179173 /-- Returns the number of elements starting from {name}`lo` that satisfy the given upper bound. -/
180174 size (lo : α) : Nat
@@ -197,6 +191,18 @@ class LawfulHasSize (α : Type u) [UpwardEnumerable α] [HasSize α] where
197191 (h : UpwardEnumerable.succ? lo = some lo') :
198192 HasSize.size lo = HasSize.size lo' + 1
199193
194+ /--
195+ This typeclass provides support for the size function for ranges with closed lower bound
196+ ({name (scope := "Init.Data.Range.Polymorphic.Iterators")}`Ric.size`,
197+ {name (scope := "Init.Data.Range.Polymorphic.Iterators")}`Rio.size` and
198+ {name (scope := "Init.Data.Range.Polymorphic.Iterators")}`Rii.size`).
199+
200+ The returned size should be equal to the number of elements returned by {lit}`toList`. This
201+ condition is captured by the typeclass
202+ {name}`LawfulHasSize`.
203+ -/
204+ add_decl_doc HasSize
205+
200206export LawfulHasSize (size_eq_one_of_succ?_eq_none size_eq_succ_of_succ?_eq_some)
201207
202208theorem size_pos {α : Type u} [UpwardEnumerable α] [HasSize α] [LawfulHasSize α] {lo : α} :
0 commit comments