File tree Expand file tree Collapse file tree 4 files changed +43
-1
lines changed
Expand file tree Collapse file tree 4 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 1+ /-
2+ Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
3+ Released under Apache 2.0 license as described in the file LICENSE.
4+ Authors: Paul Reichert
5+ -/
6+ prelude
7+ import Std.Data.Iterators.Producers.Range
8+
9+ namespace Std.PRange
10+
11+ theorem toList_iter_eq_toList [UpwardEnumerable α] [BoundedUpwardEnumerable sl α]
12+ [SupportsUpperBound su α] [HasFiniteRanges su α] [LawfulUpwardEnumerable α]
13+ (r : PRange ⟨sl, su⟩ α) :
14+ r.iter.toList = r.toList := by
15+ rfl
16+
17+ end Std.PRange
Original file line number Diff line number Diff line change @@ -8,4 +8,5 @@ import Std.Data.Iterators.Producers.Monadic
88import Std.Data.Iterators.Producers.Array
99import Std.Data.Iterators.Producers.Empty
1010import Std.Data.Iterators.Producers.List
11+ import Std.Data.Iterators.Producers.Range
1112import Std.Data.Iterators.Producers.Repeat
Original file line number Diff line number Diff line change 1+ /-
2+ Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
3+ Released under Apache 2.0 license as described in the file LICENSE.
4+ Authors: Paul Reichert
5+ -/
6+ prelude
7+ import Init.Data.Range.Polymorphic.Basic
8+
9+ /-!
10+ # Range iterator
11+
12+ This module provides iterators over ranges from `Std.PRange` via `Std.PRange.iter`.
13+ -/
14+
15+ open Std.PRange
16+
17+ /--
18+ Returns an iterator over the given range. This iterator will emit the elements of the range
19+ in increasing order.
20+ -/
21+ @[always_inline, inline]
22+ def Std.PRange.iter [UpwardEnumerable α] [BoundedUpwardEnumerable sl α]
23+ (r : PRange ⟨sl, su⟩ α) : Iter (α := RangeIterator su α) α :=
24+ ⟨⟨BoundedUpwardEnumerable.init? r.lower, r.upper⟩⟩
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import Init.Data.Range.Polymorphic.Nat
33import Init.Data.Range.Polymorphic.Basic
44import Init.System.IO
55import Init.Data.Iterators
6- import Init
6+ import Std.Data.Iterators
77
88def ex1 : IO Unit := do
99IO.println "example 1"
You can’t perform that action at this time.
0 commit comments