Skip to content

Commit 5dd283e

Browse files
committed
toArray lemmas and more
1 parent 2a74c51 commit 5dd283e

File tree

2 files changed

+1338
-451
lines changed

2 files changed

+1338
-451
lines changed

src/Init/Data/Range/Polymorphic/Lemmas.lean

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,23 @@ public theorem toArray_eq_if_roo [UpwardEnumerable α] [LT α] [DecidableLT α]
828828
#[] := by
829829
rw [Internal.toArray_eq_toArray_iter, Rxo.Iterator.toArray_eq_match]; rfl
830830

831+
public theorem toList_eq_if_rco [UpwardEnumerable α] [LT α] [DecidableLT α]
832+
[LawfulUpwardEnumerable α] [Rxo.IsAlwaysFinite α] [LawfulUpwardEnumerableLT α] :
833+
r.toList = if r.lower < r.upper then
834+
match UpwardEnumerable.succ? r.lower with
835+
| none => [r.lower]
836+
| some next => r.lower :: (next...r.upper).toList
837+
else
838+
[] := by
839+
rw [Internal.toList_eq_toList_iter, Rxo.Iterator.toList_eq_match]
840+
simp only [Internal.iter]
841+
split
842+
· split
843+
· simp [Rxo.Iterator.toList_eq_match, *]
844+
· simp only [*]
845+
rfl
846+
· rfl
847+
831848
public theorem toArray_eq_if_rco [UpwardEnumerable α] [LT α] [DecidableLT α]
832849
[LawfulUpwardEnumerable α] [Rxo.IsAlwaysFinite α] [LawfulUpwardEnumerableLT α] :
833850
r.toArray = if r.lower < r.upper then

0 commit comments

Comments
 (0)