Skip to content

Commit 840c675

Browse files
committed
extrinsic toList and toArray
1 parent 65315a6 commit 840c675

File tree

24 files changed

+198
-249
lines changed

24 files changed

+198
-249
lines changed

src/Init/Data/Iterators/Combinators/Monadic/Attach.lean

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,6 @@ instance Attach.instIteratorCollect {α β : Type w} {m : Type w → Type w'} [M
9393
IteratorCollect (Attach α m P) m n :=
9494
.defaultImplementation
9595

96-
instance Attach.instIteratorCollectPartial {α β : Type w} {m : Type w → Type w'} [Monad m]
97-
[Monad n] {P : β → Prop} [Iterator α m β] :
98-
IteratorCollectPartial (Attach α m P) m n :=
99-
.defaultImplementation
100-
10196
instance Attach.instIteratorLoop {α β : Type w} {m : Type w → Type w'} [Monad m]
10297
{n : Type x → Type x'} [Monad n] {P : β → Prop} [Iterator α m β] :
10398
IteratorLoop (Attach α m P) m n :=

src/Init/Data/Iterators/Combinators/Monadic/FilterMap.lean

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,6 @@ instance {α β γ : Type w} {m : Type w → Type w'}
223223
IteratorCollect (FilterMap α m n lift f) n o :=
224224
.defaultImplementation
225225

226-
instance {α β γ : Type w} {m : Type w → Type w'}
227-
{n : Type w → Type w''} {o : Type w → Type x} [Monad n] [Monad o] [Iterator α m β]
228-
{lift : ⦃α : Type w⦄ → m α → n α}
229-
{f : β → PostconditionT n (Option γ)} [Finite α m] :
230-
IteratorCollectPartial (FilterMap α m n lift f) n o :=
231-
.defaultImplementation
232-
233226
instance FilterMap.instIteratorLoop {α β γ : Type w} {m : Type w → Type w'}
234227
{n : Type w → Type w''} {o : Type x → Type x'}
235228
[Monad n] [Monad o] [Iterator α m β] {lift : ⦃α : Type w⦄ → m α → n α}
@@ -251,7 +244,7 @@ instance FilterMap.instIteratorLoopPartial {α β γ : Type w} {m : Type w → T
251244
instance Map.instIteratorCollect {α β γ : Type w} {m : Type w → Type w'}
252245
{n : Type w → Type w''} {o : Type w → Type x} [Monad n] [Monad o] [Iterator α m β]
253246
{lift₁ : ⦃α : Type w⦄ → m α → n α}
254-
{f : β → PostconditionT n γ} [IteratorCollect α m o] [Finite α m] :
247+
{f : β → PostconditionT n γ} [IteratorCollect α m o] :
255248
IteratorCollect (Map α m n lift₁ f) n o where
256249
toArrayMapped lift₂ _ g it :=
257250
letI : MonadLift m n := ⟨lift₁ (α := _)⟩
@@ -261,18 +254,6 @@ instance Map.instIteratorCollect {α β γ : Type w} {m : Type w → Type w'}
261254
(fun x => do g (← (f x).operation))
262255
it.internalState.inner (m := m)
263256

264-
@[no_expose]
265-
instance Map.instIteratorCollectPartial {α β γ : Type w} {m : Type w → Type w'}
266-
{n : Type w → Type w''} {o : Type w → Type x} [Monad n] [Monad o] [Iterator α m β]
267-
{lift₁ : ⦃α : Type w⦄ → m α → n α}
268-
{f : β → PostconditionT n γ} [IteratorCollectPartial α m o] :
269-
IteratorCollectPartial (Map α m n lift₁ f) n o where
270-
toArrayMappedPartial lift₂ _ g it :=
271-
IteratorCollectPartial.toArrayMappedPartial
272-
(lift := fun ⦃_⦄ a => lift₂ (lift₁ a))
273-
(fun x => do g (← lift₂ (f x).operation))
274-
it.internalState.inner (m := m)
275-
276257
instance Map.instIteratorLoop {α β γ : Type w} {m : Type w → Type w'}
277258
{n : Type w → Type w''} {o : Type x → Type x'} [Monad n] [Monad o] [Iterator α m β]
278259
{lift : ⦃α : Type w⦄ → m α → n α}

src/Init/Data/Iterators/Combinators/Monadic/FlatMap.lean

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,6 @@ public instance Flatten.instIteratorCollect [Monad m] [Monad n] [Iterator α m (
370370
[Iterator α₂ m β] : IteratorCollect (Flatten α α₂ β m) m n :=
371371
.defaultImplementation
372372

373-
public instance Flatten.instIteratorCollectPartial [Monad m] [Monad n] [Iterator α m (IterM (α := α₂) m β)]
374-
[Iterator α₂ m β] : IteratorCollectPartial (Flatten α α₂ β m) m n :=
375-
.defaultImplementation
376-
377373
public instance Flatten.instIteratorLoop [Monad m] [Monad n] [Iterator α m (IterM (α := α₂) m β)]
378374
[Iterator α₂ m β] : IteratorLoop (Flatten α α₂ β m) m n :=
379375
.defaultImplementation

src/Init/Data/Iterators/Combinators/Monadic/ULift.lean

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,6 @@ instance Types.ULiftIterator.instIteratorCollect [Monad n] [Monad o] [Iterator
137137
IteratorCollect (ULiftIterator α m n β lift) n o :=
138138
.defaultImplementation
139139

140-
instance Types.ULiftIterator.instIteratorCollectPartial {o} [Monad n] [Monad o] [Iterator α m β] :
141-
IteratorCollectPartial (ULiftIterator α m n β lift) n o :=
142-
.defaultImplementation
143-
144140
instance Types.ULiftIterator.instIteratorSize [Monad n] [Iterator α m β] [IteratorSize α m]
145141
[Finite (ULiftIterator α m n β lift) n] :
146142
IteratorSize (ULiftIterator α m n β lift) n :=

src/Init/Data/Iterators/Consumers/Collect.lean

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@ namespace Std.Iterators
3030

3131
@[always_inline, inline, inherit_doc IterM.toArray]
3232
def Iter.toArray {α : Type w} {β : Type w}
33-
[Iterator α Id β] [Finite α Id] [IteratorCollect α Id Id] (it : Iter (α := α) β) : Array β :=
33+
[Iterator α Id β] [IteratorCollect α Id Id] (it : Iter (α := α) β) : Array β :=
3434
it.toIterM.toArray.run
3535

36-
@[always_inline, inline, inherit_doc IterM.Partial.toArray]
36+
@[always_inline, inline, inherit_doc IterM.Partial.toArray, deprecated Iter.toArray (since := "2025-10-15")]
3737
def Iter.Partial.toArray {α : Type w} {β : Type w}
38-
[Iterator α Id β] [IteratorCollectPartial α Id Id] (it : Iter.Partial (α := α) β) : Array β :=
39-
it.it.toIterM.allowNontermination.toArray.run
38+
[Iterator α Id β] [IteratorCollect α Id Id] (it : Iter.Partial (α := α) β) : Array β :=
39+
it.it.toIterM.toArray.run
4040

41+
-- TODO:
4142
@[always_inline, inline, inherit_doc IterM.toListRev]
4243
def Iter.toListRev {α : Type w} {β : Type w}
4344
[Iterator α Id β] [Finite α Id] (it : Iter (α := α) β) : List β :=
@@ -50,12 +51,12 @@ def Iter.Partial.toListRev {α : Type w} {β : Type w}
5051

5152
@[always_inline, inline, inherit_doc IterM.toList]
5253
def Iter.toList {α : Type w} {β : Type w}
53-
[Iterator α Id β] [Finite α Id] [IteratorCollect α Id Id] (it : Iter (α := α) β) : List β :=
54+
[Iterator α Id β] [IteratorCollect α Id Id] (it : Iter (α := α) β) : List β :=
5455
it.toIterM.toList.run
5556

56-
@[always_inline, inline, inherit_doc IterM.Partial.toList]
57+
@[always_inline, inline, inherit_doc IterM.Partial.toList, deprecated Iter.toList (since := "2025-10-15")]
5758
def Iter.Partial.toList {α : Type w} {β : Type w}
58-
[Iterator α Id β] [IteratorCollectPartial α Id Id] (it : Iter.Partial (α := α) β) : List β :=
59-
it.it.toIterM.allowNontermination.toList.run
59+
[Iterator α Id β] [IteratorCollect α Id Id] (it : Iter.Partial (α := α) β) : List β :=
60+
it.it.toIterM.toList.run
6061

6162
end Std.Iterators

src/Init/Data/Iterators/Consumers/Monadic/Collect.lean

Lines changed: 26 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module
88
prelude
99
public import Init.Data.Iterators.Consumers.Monadic.Partial
1010
public import Init.Data.Iterators.Internal.LawfulMonadLiftFunction
11+
public import Init.Internal.ExtrinsicTermination
1112

1213
@[expose] public section
1314

@@ -51,25 +52,7 @@ class IteratorCollect (α : Type w) (m : Type w → Type w') (n : Type w → Typ
5152
Maps the emitted values of an iterator using the given function and collects the results in an
5253
`Array`. This is an internal implementation detail. Consider using `it.map f |>.toArray` instead.
5354
-/
54-
toArrayMapped [Finite α m] :
55-
(lift : ⦃δ : Type w⦄ → m δ → n δ) → {γ : Type w} → (β → n γ) → IterM (α := α) m β → n (Array γ)
56-
57-
/--
58-
`IteratorCollectPartial α m` provides efficient implementations of collectors for `α`-based
59-
iterators. Right now, it is limited to a potentially optimized partial `toArray` implementation.
60-
61-
This class is experimental and users of the iterator API should not explicitly depend on it.
62-
They can, however, assume that consumers that require an instance will work for all iterators
63-
provided by the standard library.
64-
-/
65-
class IteratorCollectPartial (α : Type w) (m : Type w → Type w') (n : Type w → Type w'')
66-
{β : Type w} [Iterator α m β] where
67-
/--
68-
Maps the emitted values of an iterator using the given function and collects the results in an
69-
`Array`. This is an internal implementation detail.
70-
Consider using `it.map f |>.allowNontermination.toArray` instead.
71-
-/
72-
toArrayMappedPartial :
55+
toArrayMapped :
7356
(lift : ⦃δ : Type w⦄ → m δ → n δ) → {γ : Type w} → (β → n γ) → IterM (α := α) m β → n (Array γ)
7457

7558
end Typeclasses
@@ -82,20 +65,21 @@ This is an internal function used in `IteratorCollect.defaultImplementation`.
8265
It iterates over an iterator and applies `f` whenever a value is emitted before inserting the result
8366
of `f` into an array.
8467
-/
85-
@[always_inline, inline]
68+
@[always_inline, inline, no_expose]
8669
def IterM.DefaultConsumers.toArrayMapped {α β : Type w} {m : Type w → Type w'}
87-
{n : Type w → Type w''} [Monad n] [Iterator α m β] [Finite α m]
70+
{n : Type w → Type w''} [Monad n] [Iterator α m β]
8871
(lift : ⦃α : Type w⦄ → m α → n α) {γ : Type w} (f : β → n γ)
8972
(it : IterM (α := α) m β) : n (Array γ) :=
73+
letI : MonadLift m n := ⟨lift (α := _)⟩
9074
go it #[]
9175
where
92-
@[specialize]
93-
go [Monad n] [Finite α m] (it : IterM (α := α) m β) a := letI : MonadLift m n := ⟨lift (α := _)⟩; do
94-
match (← it.step).inflate with
95-
| .yield it' b _ => go it' (a.push (← f b))
96-
| .skip it' _ => go it' a
97-
| .done _ => return a
98-
termination_by it.finitelyManySteps
76+
go it (acc : Array γ) : n (Array γ) :=
77+
letI : MonadLift m n := ⟨lift (α := _)⟩
78+
extrinsicFix₂ (C₂ := fun _ _ => n (Array γ)) (fun it acc recur => do
79+
match (← it.step).inflate.val with
80+
| .yield it' out => recur it' (acc.push (← f out))
81+
| .skip it' => recur it' acc
82+
| .done => return acc) it acc
9983

10084
/--
10185
This is the default implementation of the `IteratorLoop` class.
@@ -110,7 +94,8 @@ def IteratorCollect.defaultImplementation {α β : Type w} {m : Type w → Type
11094
toArrayMapped := IterM.DefaultConsumers.toArrayMapped
11195

11296
/--
113-
Asserts that a given `IteratorCollect` instance is equal to `IteratorCollect.defaultImplementation`.
97+
Asserts that a given `IteratorCollect` instance is equal to `IteratorCollect.defaultImplementation`
98+
*if the underlying iterator is finite*.
11499
(Even though equal, the given instance might be vastly more efficient.)
115100
-/
116101
class LawfulIteratorCollect (α : Type w) (m : Type w → Type w') (n : Type w → Type w'')
@@ -135,65 +120,27 @@ instance (α β : Type w) (m : Type w → Type w') (n : Type w → Type w'') [Mo
135120
letI : IteratorCollect α m n := .defaultImplementation
136121
fun _ => rfl⟩
137122

138-
/--
139-
This is an internal function used in `IteratorCollectPartial.defaultImplementation`.
140-
141-
It iterates over an iterator and applies `f` whenever a value is emitted before inserting the result
142-
of `f` into an array.
143-
-/
144-
@[always_inline, inline]
145-
partial def IterM.DefaultConsumers.toArrayMappedPartial {α β : Type w} {m : Type w → Type w'}
146-
{n : Type w → Type w''} [Monad n] [Iterator α m β]
147-
(lift : {α : Type w} → m α → n α) {γ : Type w} (f : β → n γ)
148-
(it : IterM (α := α) m β) : n (Array γ) :=
149-
go it #[]
150-
where
151-
@[specialize]
152-
go [Monad n] (it : IterM (α := α) m β) a := letI : MonadLift m n := ⟨lift⟩; do
153-
match (← it.step).inflate with
154-
| .yield it' b _ => go it' (a.push (← f b))
155-
| .skip it' _ => go it' a
156-
| .done _ => return a
157-
158-
/--
159-
This is the default implementation of the `IteratorLoopPartial` class.
160-
It simply iterates through the iterator using `IterM.step`, incrementally building up the desired
161-
data structure. For certain iterators, more efficient implementations are possible and should be
162-
used instead.
163-
-/
164-
@[always_inline, inline]
165-
def IteratorCollectPartial.defaultImplementation {α β : Type w} {m : Type w → Type w'}
166-
{n : Type w → Type w''} [Monad n] [Iterator α m β] :
167-
IteratorCollectPartial α m n where
168-
toArrayMappedPartial := IterM.DefaultConsumers.toArrayMappedPartial
169-
170123
/--
171124
Traverses the given iterator and stores the emitted values in an array.
172-
173-
This function requires a `Finite` instance proving that the iterator will finish after a finite
174-
number of steps. If the iterator is not finite or such an instance is not available, consider using
175-
`it.allowNontermination.toArray` instead of `it.toArray`. However, it is not possible to formally
176-
verify the behavior of the partial variant.
177125
-/
178126
@[always_inline, inline]
179-
def IterM.toArray {α β : Type w} {m : Type w → Type w'} [Monad m]
180-
[Iterator α m β] [Finite α m] [IteratorCollect α m m]
181-
(it : IterM (α := α) m β) : m (Array β) :=
127+
def IterM.toArray {α β : Type w} {m : Type w → Type w'} [Monad m] [Iterator α m β]
128+
[IteratorCollect α m m] (it : IterM (α := α) m β) : m (Array β) :=
182129
IteratorCollect.toArrayMapped (fun ⦃_⦄ => id) pure it
183130

184131
/--
185132
Traverses the given iterator and stores the emitted values in an array.
186133
187-
This is a partial, potentially nonterminating, function. It is not possible to formally verify
188-
its behavior. If the iterator has a `Finite` instance, consider using `IterM.toArray` instead.
134+
This function is deprecated. Instead of `it.allowNontermination.toArray`, use `it.toArray`.
189135
-/
190-
@[always_inline, inline]
136+
@[always_inline, inline, deprecated IterM.toArray (since := "2025-10-15")]
191137
def IterM.Partial.toArray {α : Type w} {m : Type w → Type w'} {β : Type w} [Monad m]
192-
[Iterator α m β] (it : IterM.Partial (α := α) m β) [IteratorCollectPartial α m m] : m (Array β) :=
193-
IteratorCollectPartial.toArrayMappedPartial (fun ⦃_⦄ => id) pure it.it
138+
[Iterator α m β] (it : IterM.Partial (α := α) m β) [IteratorCollect α m m] : m (Array β) :=
139+
it.it.toArray
194140

195141
end ToArray
196142

143+
-- TODO:
197144
/--
198145
Traverses the given iterator and stores the emitted values in reverse order in a list. Because
199146
lists are prepend-only, this `toListRev` is usually more efficient that `toList`.
@@ -237,28 +184,22 @@ where
237184
/--
238185
Traverses the given iterator and stores the emitted values in a list. Because
239186
lists are prepend-only, `toListRev` is usually more efficient that `toList`.
240-
241-
This function requires a `Finite` instance proving that the iterator will finish after a finite
242-
number of steps. If the iterator is not finite or such an instance is not available, consider using
243-
`it.allowNontermination.toList` instead of `it.toList`. However, it is not possible to
244-
formally verify the behavior of the partial variant.
245187
-/
246188
@[always_inline, inline]
247189
def IterM.toList {α : Type w} {m : Type w → Type w'} [Monad m] {β : Type w}
248-
[Iterator α m β] [Finite α m] [IteratorCollect α m m] (it : IterM (α := α) m β) : m (List β) :=
190+
[Iterator α m β] [IteratorCollect α m m] (it : IterM (α := α) m β) : m (List β) :=
249191
Array.toList <$> IterM.toArray it
250192

251193
/--
252194
Traverses the given iterator and stores the emitted values in a list. Because
253195
lists are prepend-only, `toListRev` is usually more efficient that `toList`.
254196
255-
This is a partial, potentially nonterminating, function. It is not possible to formally verify
256-
its behavior. If the iterator has a `Finite` instance, consider using `IterM.toList` instead.
197+
This function is deprecated. Instead of `it.allowNontermination.toList`, use `it.toList`.
257198
-/
258-
@[always_inline, inline]
199+
@[always_inline, inline, deprecated IterM.toList (since := "2025-10-15")]
259200
def IterM.Partial.toList {α : Type w} {m : Type w → Type w'} [Monad m] {β : Type w}
260-
[Iterator α m β] (it : IterM.Partial (α := α) m β) [IteratorCollectPartial α m m] :
201+
[Iterator α m β] (it : IterM.Partial (α := α) m β) [IteratorCollect α m m] :
261202
m (List β) :=
262-
Array.toList <$> it.toArray
203+
Array.toList <$> it.it.toArray
263204

264205
end Std.Iterators

src/Init/Data/Iterators/Lemmas/Combinators/Monadic/FilterMap.lean

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -489,13 +489,8 @@ theorem IterM.toList_map {α β β' : Type w} {m : Type w → Type w'} [Monad m]
489489
· simp [instIteratorMap, inferInstanceAs]
490490
congr
491491
simp
492-
· refine heq_of_eqRec_eq ?_ rfl
493-
congr
492+
· congr
494493
simp only [Map, PostconditionT.map_pure, Function.comp_apply]
495-
simp only [instIteratorMap, inferInstanceAs, Function.comp_apply]
496-
congr
497-
simp
498-
· simp [Map]
499494
· simp only [instIteratorMap, inferInstanceAs, Function.comp_apply]
500495
congr
501496
simp

src/Init/Data/Iterators/Lemmas/Consumers/Monadic/Collect.lean

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,53 @@ import all Init.Data.Iterators.Consumers.Monadic.Collect
1414
public section
1515

1616
namespace Std.Iterators
17+
open Std.Internal
1718

1819
variable {α β γ : Type w} {m : Type w → Type w'} {n : Type w → Type w''}
1920
{lift : ⦃δ : Type w⦄ → m δ → n δ} {f : β → n γ} {it : IterM (α := α) m β}
2021

21-
theorem IterM.DefaultConsumers.toArrayMapped.go.aux₁ [Monad n] [LawfulMonad n] [Iterator α m β]
22-
[Finite α m] {b : γ} {bs : Array γ} :
22+
private theorem IterM.DefaultConsumers.toArrayMapped.go_eq [Monad n] [Iterator α m β]
23+
[Finite α m] {acc : Array γ} :
24+
letI : MonadLift m n := ⟨lift (δ := _)⟩
25+
go lift f it acc (m := m) = (do
26+
match (← it.step).inflate.val with
27+
| .yield it' out => go lift f it' (acc.push (← f out))
28+
| .skip it' => go lift f it' acc
29+
| .done => return acc) := by
30+
letI : MonadLift m n := ⟨lift (δ := _)⟩
31+
rw [toArrayMapped.go, extrinsicFix₂_eq]
32+
· apply bind_congr; intro step
33+
cases step.inflate using PlausibleIterStep.casesOn
34+
· simp only
35+
apply bind_congr; intro fx
36+
simp [go]
37+
· simp [go]
38+
· simp
39+
· refine ⟨?r, ?F, ?wf, ?h⟩
40+
· exact InvImage WellFoundedRelation.rel (fun x => x.1.finitelyManySteps)
41+
· exact fun it acc G => (do
42+
match (← it.step).inflate with
43+
| .yield it' out h => G it' (acc.push (← f out)) (TerminationMeasures.Finite.rel_of_yield h)
44+
| .skip it' h => G it' acc (TerminationMeasures.Finite.rel_of_skip h)
45+
| .done _ => return acc)
46+
· apply InvImage.wf
47+
exact WellFoundedRelation.wf
48+
· intro it acc G
49+
simp only
50+
apply bind_congr; intro step
51+
cases step.inflate using PlausibleIterStep.casesOn <;> simp
52+
53+
private theorem IterM.DefaultConsumers.toArrayMapped.go.aux₁ [Monad n] [LawfulMonad n]
54+
[Iterator α m β] [Finite α m] {b : γ} {bs : Array γ} :
2355
IterM.DefaultConsumers.toArrayMapped.go lift f it (#[b] ++ bs) (m := m) =
2456
(#[b] ++ ·) <$> IterM.DefaultConsumers.toArrayMapped.go lift f it bs (m := m) := by
25-
induction it, bs using IterM.DefaultConsumers.toArrayMapped.go.induct with | _ it bs ih₁ ih₂
26-
rw [go, map_eq_pure_bind, go, bind_assoc]
27-
apply bind_congr
28-
intro step
29-
split
30-
· simp [ih₁ _ _ ‹_›]
31-
· simp [ih₂ _ ‹_›]
32-
· simp
57+
induction it using IterM.inductSteps generalizing bs with | step it ihy ihs
58+
rw [go_eq, map_eq_pure_bind, go_eq, bind_assoc]
59+
apply bind_congr; intro step
60+
cases step.inflate using PlausibleIterStep.casesOn <;> simp (discharger := assumption) [ihy, ihs]
3361

34-
theorem IterM.DefaultConsumers.toArrayMapped.go.aux₂ [Monad n] [LawfulMonad n] [Iterator α m β]
35-
[Finite α m] {acc : Array γ} :
62+
private theorem IterM.DefaultConsumers.toArrayMapped.go.aux₂ [Monad n] [LawfulMonad n]
63+
[Iterator α m β] [Finite α m] {acc : Array γ} :
3664
IterM.DefaultConsumers.toArrayMapped.go lift f it acc (m := m) =
3765
(acc ++ ·) <$> IterM.DefaultConsumers.toArrayMapped lift f it (m := m) := by
3866
rw [← Array.toArray_toList (xs := acc)]
@@ -51,7 +79,7 @@ theorem IterM.DefaultConsumers.toArrayMapped_eq_match_step [Monad n] [LawfulMona
5179
return #[← f out] ++ (← IterM.DefaultConsumers.toArrayMapped lift f it' (m := m))
5280
| .skip it' => IterM.DefaultConsumers.toArrayMapped lift f it' (m := m)
5381
| .done => return #[]) := by
54-
rw [IterM.DefaultConsumers.toArrayMapped, IterM.DefaultConsumers.toArrayMapped.go]
82+
rw [IterM.DefaultConsumers.toArrayMapped, IterM.DefaultConsumers.toArrayMapped.go_eq]
5583
apply bind_congr
5684
intro step
5785
cases step.inflate using PlausibleIterStep.casesOn <;>

src/Init/Data/Iterators/ToIterator.lean

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,6 @@ instance {x : γ} {State : Type w} {iter}
9090
IteratorCollect (α := i.State) m n :=
9191
inferInstanceAs <| IteratorCollect (α := State) m n
9292

93-
instance {x : γ} {State : Type w} {iter}
94-
[Iterator (α := State) m β] [IteratorCollectPartial State m n] :
95-
letI i : ToIterator x m β := .ofM State iter
96-
IteratorCollectPartial (α := i.State) m n :=
97-
inferInstanceAs <| IteratorCollectPartial (α := State) m n
98-
9993
instance {x : γ} {State : Type w} {iter}
10094
[Iterator (α := State) m β] [IteratorLoop State m n] :
10195
letI i : ToIterator x m β := .ofM State iter

0 commit comments

Comments
 (0)