@@ -467,6 +467,23 @@ public theorem Rxo.Iterator.toArray_eq_match [LT α] [DecidableLT α]
467467 · rfl
468468 · split <;> simp
469469
470+ public theorem Rxc.Iterator.toList_eq_toList_rxoIterator [LE α] [DecidableLE α] [LT α] [DecidableLT α]
471+ [UpwardEnumerable α] [Rxc.IsAlwaysFinite α] [Rxo.IsAlwaysFinite α] [LawfulUpwardEnumerable α]
472+ [LawfulUpwardEnumerableLE α] [LawfulUpwardEnumerableLT α]
473+ [InfinitelyUpwardEnumerable α] [LinearlyUpwardEnumerable α] {it : Iter (α := Rxc.Iterator α) α}:
474+ it.toList = (⟨⟨it.internalState.next, succ it.internalState.upperBound⟩⟩ : Iter (α := Rxo.Iterator α) α).toList := by
475+ induction it using Iter.inductSteps with | step it ihy ihs
476+ rw [Rxc.Iterator.toList_eq_match, Rxo.Iterator.toList_eq_match]
477+ split
478+ · simp [*]
479+ · simp only [UpwardEnumerable.le_iff, UpwardEnumerable.lt_iff, *]
480+ split <;> rename_i h
481+ · rw [ihy]; rotate_left
482+ · simp [Iter.IsPlausibleStep, IterM.IsPlausibleStep, Iterator.IsPlausibleStep,
483+ Iterator.Monadic.step, Iter.toIterM, *]; rfl
484+ · simpa [UpwardEnumerable.lt_iff, UpwardEnumerable.le_iff, UpwardEnumerable.lt_succ_iff] using h
485+ · simpa [UpwardEnumerable.lt_iff, UpwardEnumerable.le_iff, UpwardEnumerable.lt_succ_iff] using h
486+
470487public theorem Rxi.Iterator.toList_eq_match
471488 [UpwardEnumerable α] [Rxi.IsAlwaysFinite α] [LawfulUpwardEnumerable α]
472489 {it : Iter (α := Rxi.Iterator α) α} :
@@ -561,22 +578,6 @@ namespace Rcc
561578
562579variable {r : Rcc α}
563580
564- public theorem toList_eq_if_roo [UpwardEnumerable α] [LE α] [DecidableLE α]
565- [LawfulUpwardEnumerable α] [Rxc.IsAlwaysFinite α] [LawfulUpwardEnumerableLE α] :
566- r.toList = if r.lower ≤ r.upper then r.lower :: (r.lower<...=r.upper).toList else [] := by
567- rw [Internal.toList_eq_toList_iter, Rxc.Iterator.toList_eq_match]; rfl
568-
569- @[deprecated toList_eq_if_roo (since := " 2025-10-29" )]
570- def toList_eq_if_Roo := @toList_eq_if_roo
571-
572- public theorem toArray_eq_if_roo [UpwardEnumerable α] [LE α] [DecidableLE α]
573- [LawfulUpwardEnumerable α] [Rxc.IsAlwaysFinite α] [LawfulUpwardEnumerableLE α] :
574- r.toArray = if r.lower ≤ r.upper then #[r.lower] ++ (r.lower<...=r.upper).toArray else #[] := by
575- rw [Internal.toArray_eq_toArray_iter, Rxc.Iterator.toArray_eq_match]; rfl
576-
577- @[deprecated toArray_eq_if_roo (since := " 2025-10-29" )]
578- def toArray_eq_if_Roo := @toArray_eq_if_roo
579-
580581public theorem toList_eq_if_roc [LE α] [DecidableLE α] [UpwardEnumerable α]
581582 [LawfulUpwardEnumerable α] [LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] :
582583 r.toList = if r.lower ≤ r.upper then
@@ -585,6 +586,16 @@ public theorem toList_eq_if_roc [LE α] [DecidableLE α] [UpwardEnumerable α]
585586 [] := by
586587 rw [Internal.toList_eq_toList_iter, Rxc.Iterator.toList_eq_match]; rfl
587588
589+ @[simp]
590+ public theorem toList_eq_toList_rco [LE α] [DecidableLE α] [LT α] [DecidableLT α]
591+ [UpwardEnumerable α] [LawfulUpwardEnumerable α]
592+ [LawfulUpwardEnumerableLE α] [LawfulUpwardEnumerableLT α]
593+ [Rxc.IsAlwaysFinite α] [Rxo.IsAlwaysFinite α]
594+ [InfinitelyUpwardEnumerable α] [LinearlyUpwardEnumerable α] :
595+ r.toList = (r.lower...(succ r.upper)).toList := by
596+ simp [Internal.toList_eq_toList_iter, Rco.Internal.toList_eq_toList_iter,
597+ Internal.iter, Rco.Internal.iter, Rxc.Iterator.toList_eq_toList_rxoIterator]
598+
588599@[deprecated toList_eq_if_roc (since := " 2025-10-29" )]
589600def toList_eq_match := @toList_eq_if_roc
590601
@@ -816,6 +827,23 @@ public theorem toArray_eq_if_roo [UpwardEnumerable α] [LT α] [DecidableLT α]
816827 #[] := by
817828 rw [Internal.toArray_eq_toArray_iter, Rxo.Iterator.toArray_eq_match]; rfl
818829
830+ public theorem toList_eq_if_rco [UpwardEnumerable α] [LT α] [DecidableLT α]
831+ [LawfulUpwardEnumerable α] [Rxo.IsAlwaysFinite α] [LawfulUpwardEnumerableLT α] :
832+ r.toList = if r.lower < r.upper then
833+ match UpwardEnumerable.succ? r.lower with
834+ | none => [r.lower]
835+ | some next => r.lower :: (next...r.upper).toList
836+ else
837+ [] := by
838+ rw [Internal.toList_eq_toList_iter, Rxo.Iterator.toList_eq_match]
839+ simp only [Internal.iter]
840+ split
841+ · split
842+ · simp [Rxo.Iterator.toList_eq_match, *]
843+ · simp only [*]
844+ rfl
845+ · rfl
846+
819847public theorem toArray_eq_if_rco [UpwardEnumerable α] [LT α] [DecidableLT α]
820848 [LawfulUpwardEnumerable α] [Rxo.IsAlwaysFinite α] [LawfulUpwardEnumerableLT α] :
821849 r.toArray = if r.lower < r.upper then
@@ -1272,6 +1300,16 @@ public theorem toArray_eq_match_rcc [LE α] [DecidableLE α] [UpwardEnumerable
12721300 simp only [← Internal.toList_eq_toList_iter, toList_eq_match_rcc]
12731301 split <;> simp
12741302
1303+ @[simp]
1304+ public theorem toList_eq_toList_roo [LE α] [DecidableLE α] [LT α] [DecidableLT α]
1305+ [UpwardEnumerable α] [LawfulUpwardEnumerable α]
1306+ [LawfulUpwardEnumerableLE α] [LawfulUpwardEnumerableLT α]
1307+ [Rxc.IsAlwaysFinite α] [Rxo.IsAlwaysFinite α]
1308+ [InfinitelyUpwardEnumerable α] [LinearlyUpwardEnumerable α] :
1309+ r.toList = (r.lower<...(succ r.upper)).toList := by
1310+ simp [Internal.toList_eq_toList_iter, Roo.Internal.toList_eq_toList_iter,
1311+ Internal.iter, Roo.Internal.iter, Rxc.Iterator.toList_eq_toList_rxoIterator]
1312+
12751313@[simp]
12761314public theorem toArray_toList [LE α] [DecidableLE α] [UpwardEnumerable α] [LawfulUpwardEnumerable α]
12771315 [Rxc.IsAlwaysFinite α] :
@@ -2856,7 +2894,7 @@ public theorem length_toList [LE α] [DecidableLE α] [UpwardEnumerable α]
28562894 · simpa [toList_eq_nil_iff, size_eq_if_roc] using h
28572895 · rename_i n ih
28582896 rw [size_eq_if_rcc] at h
2859- simp only [toList_eq_if_roo , ← h]
2897+ simp only [toList_eq_if_roc , ← h]
28602898 simp only [Roc.toList_eq_match_rcc]
28612899 split
28622900 · split
0 commit comments