# Lemmas about ranges #

This file provides lemmas about `Std.PRange`.

source
theorem Std.PRange.UpwardEnumerable.exists_of_succ_le {α : Type u} [UpwardEnumerable α] [LawfulUpwardEnumerable α] [InfinitelyUpwardEnumerable α] {a b : α} (h : UpwardEnumerable.LE (succ a) b) :
∃ (b' : α), b = succ b' ∧ UpwardEnumerable.LE a b'
source
theorem Std.PRange.UpwardEnumerable.exists_of_succ_lt {α : Type u} [UpwardEnumerable α] [LawfulUpwardEnumerable α] [InfinitelyUpwardEnumerable α] {a b : α} (h : UpwardEnumerable.LT (succ a) b) :
∃ (b' : α), b = succ b' ∧ UpwardEnumerable.LT a b'
source
theorem Std.Rcc.forIn'_congr {α : Type u} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {m : Type u → Type w} [Monad m] {γ : Type u} {init init' : γ} {r r' : Rcc α} {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} {f' : (a : α) → a ∈ r' → γ → m (ForInStep γ)} (hr : r = r') (hi : init = init') (h : ∀ (a : α) (m_1 : a ∈ r') (b : γ), f a ⋯ b = f' a m_1 b) :
forIn' r init f = forIn' r' init' f'
source
theorem Std.Rco.forIn'_congr {α : Type u} [LE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {m : Type u → Type w} [Monad m] {γ : Type u} {init init' : γ} {r r' : Rco α} {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} {f' : (a : α) → a ∈ r' → γ → m (ForInStep γ)} (hr : r = r') (hi : init = init') (h : ∀ (a : α) (m_1 : a ∈ r') (b : γ), f a ⋯ b = f' a m_1 b) :
forIn' r init f = forIn' r' init' f'
source
theorem Std.Rci.forIn'_congr {α : Type u} [LE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {m : Type u → Type w} [Monad m] {γ : Type u} {init init' : γ} {r r' : Rci α} {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} {f' : (a : α) → a ∈ r' → γ → m (ForInStep γ)} (hr : r = r') (hi : init = init') (h : ∀ (a : α) (m_1 : a ∈ r') (b : γ), f a ⋯ b = f' a m_1 b) :
forIn' r init f = forIn' r' init' f'
source
theorem Std.Roc.forIn'_congr {α : Type u} [LE α] [LT α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {m : Type u → Type w} [Monad m] {γ : Type u} {init init' : γ} {r r' : Roc α} {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} {f' : (a : α) → a ∈ r' → γ → m (ForInStep γ)} (hr : r = r') (hi : init = init') (h : ∀ (a : α) (m_1 : a ∈ r') (b : γ), f a ⋯ b = f' a m_1 b) :
forIn' r init f = forIn' r' init' f'
source
theorem Std.Roo.forIn'_congr {α : Type u} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {m : Type u → Type w} [Monad m] {γ : Type u} {init init' : γ} {r r' : Roo α} {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} {f' : (a : α) → a ∈ r' → γ → m (ForInStep γ)} (hr : r = r') (hi : init = init') (h : ∀ (a : α) (m_1 : a ∈ r') (b : γ), f a ⋯ b = f' a m_1 b) :
forIn' r init f = forIn' r' init' f'
source
theorem Std.Roi.forIn'_congr {α : Type u} [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {m : Type u → Type w} [Monad m] {γ : Type u} {init init' : γ} {r r' : Roi α} {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} {f' : (a : α) → a ∈ r' → γ → m (ForInStep γ)} (hr : r = r') (hi : init = init') (h : ∀ (a : α) (m_1 : a ∈ r') (b : γ), f a ⋯ b = f' a m_1 b) :
forIn' r init f = forIn' r' init' f'
source
theorem Std.Ric.forIn'_congr {α : Type u} [LE α] [DecidableLE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {m : Type u → Type w} [Monad m] {γ : Type u} {init init' : γ} {r r' : Ric α} {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} {f' : (a : α) → a ∈ r' → γ → m (ForInStep γ)} (hr : r = r') (hi : init = init') (h : ∀ (a : α) (m_1 : a ∈ r') (b : γ), f a ⋯ b = f' a m_1 b) :
forIn' r init f = forIn' r' init' f'
source
theorem Std.Rio.forIn'_congr {α : Type u} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {m : Type u → Type w} [Monad m] {γ : Type u} {init init' : γ} {r r' : Rio α} {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} {f' : (a : α) → a ∈ r' → γ → m (ForInStep γ)} (hr : r = r') (hi : init = init') (h : ∀ (a : α) (m_1 : a ∈ r') (b : γ), f a ⋯ b = f' a m_1 b) :
forIn' r init f = forIn' r' init' f'
source
theorem Std.Rii.forIn'_congr {α : Type u} [PRange.UpwardEnumerable α] [PRange.Least? α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] {m : Type u → Type w} [Monad m] {γ : Type u} {init init' : γ} {r r' : Rii α} {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} {f' : (a : α) → a ∈ r' → γ → m (ForInStep γ)} (hr : r = r') (hi : init = init') (h : ∀ (a : α) (m_1 : a ∈ r') (b : γ), f a ⋯ b = f' a m_1 b) :
forIn' r init f = forIn' r' init' f'
source
theorem Std.Rxc.Iterator.toList_eq_match {α : Type u} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] {it : Iter α} :
it.toList = match it.internalState.next with | none => [] | some a => if a ≤ it.internalState.upperBound then a :: { internalState := { next := PRange.succ? a, upperBound := it.internalState.upperBound } }.toList else []
source
theorem Std.Rxc.Iterator.toArray_eq_match {α : Type u} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] {it : Iter α} :
it.toArray = match it.internalState.next with | none => #[] | some a => if a ≤ it.internalState.upperBound then #[a] ++ { internalState := { next := PRange.succ? a, upperBound := it.internalState.upperBound } }.toArray else #[]
source
theorem Std.Rxo.Iterator.toList_eq_match {α : Type u} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] {it : Iter α} :
it.toList = match it.internalState.next with | none => [] | some a => if a < it.internalState.upperBound then a :: { internalState := { next := PRange.succ? a, upperBound := it.internalState.upperBound } }.toList else []
source
theorem Std.Rxo.Iterator.toArray_eq_match {α : Type u} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] {it : Iter α} :
it.toArray = match it.internalState.next with | none => #[] | some a => if a < it.internalState.upperBound then #[a] ++ { internalState := { next := PRange.succ? a, upperBound := it.internalState.upperBound } }.toArray else #[]
source
theorem Std.Rxi.Iterator.toList_eq_match {α : Type u} [PRange.UpwardEnumerable α] [IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {it : Iter α} :
it.toList = match it.internalState.next with | none => [] | some a => a :: { internalState := { next := PRange.succ? a } }.toList
source
theorem Std.Rxi.Iterator.toArray_eq_match {α : Type u} [PRange.UpwardEnumerable α] [IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {it : Iter α} :
it.toArray = match it.internalState.next with | none => #[] | some a => #[a] ++ { internalState := { next := PRange.succ? a } }.toArray
source
theorem Std.Rxc.Iterator.pairwise_toList_upwardEnumerableLt {α : Type u} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] (it : Iter α) :
List.Pairwise (fun (a b : α) => PRange.UpwardEnumerable.LT a b) it.toList
source
theorem Std.Rxo.Iterator.pairwise_toList_upwardEnumerableLt {α : Type u} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] (it : Iter α) :
List.Pairwise (fun (a b : α) => PRange.UpwardEnumerable.LT a b) it.toList
source
theorem Std.Rxi.Iterator.pairwise_toList_upwardEnumerableLt {α : Type u} [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] (it : Iter α) :
List.Pairwise (fun (a b : α) => PRange.UpwardEnumerable.LT a b) it.toList
source
instance Std.instLawfulIteratorSizeIteratorOfLawfulHasSizeOfLawfulUpwardEnumerableLE {α : Type u} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [Rxc.HasSize α] [Rxc.LawfulHasSize α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
Iterators.LawfulIteratorSize (Rxc.Iterator α)
source
instance Std.instLawfulIteratorSizeIteratorOfLawfulHasSizeOfLawfulUpwardEnumerableLT {α : Type u} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [Rxo.HasSize α] [Rxo.LawfulHasSize α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
Iterators.LawfulIteratorSize (Rxo.Iterator α)
source
instance Std.instLawfulIteratorSizeIteratorOfLawfulHasSize {α : Type u} [PRange.UpwardEnumerable α] [Rxi.HasSize α] [Rxi.LawfulHasSize α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
Iterators.LawfulIteratorSize (Rxi.Iterator α)
source
theorem Std.Rcc.toList_eq_match {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toList = if r.lower ≤ r.upper then r.lower :: (r.lower<...=r.upper).toList else []
source
theorem Std.Rcc.toArray_eq_match {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toArray = if r.lower ≤ r.upper then #[r.lower] ++ (r.lower<...=r.upper).toArray else #[]
source
@[simp]
theorem Std.Rcc.toArray_toList {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxc.IsAlwaysFinite α] :
r.toList.toArray = r.toArray
source
@[simp]
theorem Std.Rcc.toList_toArray {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxc.IsAlwaysFinite α] :
r.toArray.toList = r.toList
source
theorem Std.Rcc.toList_eq_nil_iff {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toList = [] ↔ ¬r.lower ≤ r.upper
source
theorem Std.Rcc.toArray_eq_empty_iff {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toArray = #[] ↔ ¬r.lower ≤ r.upper
source
theorem Std.Rcc.mem_toList_iff_mem {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {a : α} :
a ∈ r.toList ↔ a ∈ r
source
theorem Std.Rcc.mem_toArray_iff_mem {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {a : α} :
a ∈ r.toArray ↔ a ∈ r
source
theorem Std.Rcc.pairwise_toList_upwardEnumerableLt {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => PRange.UpwardEnumerable.LT a b) r.toList
source
theorem Std.Rcc.pairwise_toList_ne {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => a ≠ b) r.toList
source
theorem Std.Rcc.pairwise_toList_lt {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => a < b) r.toList
source
theorem Std.Rcc.pairwise_toList_le {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => a ≤ b) r.toList
source
theorem Std.Rcc.mem_succ_succ_iff {α : Type u} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.InfinitelyUpwardEnumerable α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo hi a : α} :
(a ∈ (PRange.succ lo)...=PRange.succ hi) ↔ ∃ (a' : α), a = PRange.succ a' ∧ a' ∈ lo...=hi
source
theorem Std.Rcc.succ_mem_succ_succ_iff {α : Type u} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.InfinitelyUpwardEnumerable α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo hi a : α} :
(PRange.succ a ∈ (PRange.succ lo)...=PRange.succ hi) ↔ a ∈ lo...=hi
source
theorem Std.Rcc.toList_succ_succ_eq_map {α : Type u} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.InfinitelyUpwardEnumerable α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo hi : α} :
((PRange.succ lo)...=PRange.succ hi).toList = List.map PRange.succ (lo...=hi).toList
source
theorem Std.Rcc.toArray_succ_succ_eq_map {α : Type u} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.InfinitelyUpwardEnumerable α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo hi : α} :
((PRange.succ lo)...=PRange.succ hi).toArray = Array.map PRange.succ (lo...=hi).toArray
source
@[deprecated Std.Rcc.toList_succ_succ_eq_map (since := "2025-08-22")]
theorem Std.Rcc.ClosedOpen.toList_succ_succ_eq_map {α : Type u} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.InfinitelyUpwardEnumerable α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo hi : α} :
((PRange.succ lo)...=PRange.succ hi).toList = List.map PRange.succ (lo...=hi).toList
source
theorem Std.Rcc.forIn'_eq_forIn'_toList {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = forIn' r.toList init fun (a : α) (ha : a ∈ r.toList) (acc : γ) => f a ⋯ acc
source
theorem Std.Rcc.forIn'_eq_forIn'_toArray {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = forIn' r.toArray init fun (a : α) (ha : a ∈ r.toArray) (acc : γ) => f a ⋯ acc
source
theorem Std.Rcc.forIn'_toList_eq_forIn' {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r.toList → γ → m (ForInStep γ)} :
forIn' r.toList init f = forIn' r init fun (a : α) (ha : a ∈ r) (acc : γ) => f a ⋯ acc
source
theorem Std.Rcc.forIn'_toArray_eq_forIn' {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r.toArray → γ → m (ForInStep γ)} :
forIn' r.toArray init f = forIn' r init fun (a : α) (ha : a ∈ r) (acc : γ) => f a ⋯ acc
source
theorem Std.Rcc.mem_of_mem_Roc {α : Type u} {r : Rcc α} [LE α] [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {a b : α} (hrb : r.lower ≤ b) (hmem : a ∈ b<...=r.upper) :
a ∈ r
source
theorem Std.Rcc.forIn'_eq_if {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {m : Type u → Type w} [Monad m] [LawfulMonad m] {γ : Type u} {init : γ} {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = if hu : r.lower ≤ r.upper then have hle := ⋯; do let __do_lift ← f r.lower ⋯ init match __do_lift with | ForInStep.yield c => forIn' (r.lower<...=r.upper) c fun (a : α) (ha : a ∈ r.lower<...=r.upper) (acc : γ) => f a ⋯ acc | ForInStep.done c => pure c else pure init
source
theorem Std.Rcc.isEmpty_iff_forall_not_mem {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [Rxc.HasSize α] [Rxc.LawfulHasSize α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.isEmpty = true ↔ ∀ (a : α), ¬a ∈ r
source
theorem Std.Rco.toList_eq_if {α : Type u} {r : Rco α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toList = if r.lower < r.upper then r.lower :: (r.lower<...r.upper).toList else []
source
theorem Std.Rco.toArray_eq_if {α : Type u} {r : Rco α} [LE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toArray = if r.lower < r.upper then #[r.lower] ++ (r.lower<...r.upper).toArray else #[]
source
@[simp]
theorem Std.Rco.toArray_toList {α : Type u} {r : Rco α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxo.IsAlwaysFinite α] :
r.toList.toArray = r.toArray
source
@[simp]
theorem Std.Rco.toList_toArray {α : Type u} {r : Rco α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxo.IsAlwaysFinite α] :
r.toArray.toList = r.toList
source
theorem Std.Rco.toList_eq_nil_iff {α : Type u} {r : Rco α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toList = [] ↔ ¬r.lower < r.upper
source
theorem Std.Rco.toArray_eq_empty_iff {α : Type u} {r : Rco α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toArray = #[] ↔ ¬r.lower < r.upper
source
theorem Std.Rco.mem_toList_iff_mem {α : Type u} {r : Rco α} [LE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLE α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {a : α} :
a ∈ r.toList ↔ a ∈ r
source
theorem Std.Rco.mem_toArray_iff_mem {α : Type u} {r : Rco α} [LE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLE α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {a : α} :
a ∈ r.toArray ↔ a ∈ r
source
theorem Std.Rco.pairwise_toList_upwardEnumerableLt {α : Type u} {r : Rco α} [LE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => PRange.UpwardEnumerable.LT a b) r.toList
source
theorem Std.Rco.pairwise_toList_ne {α : Type u} {r : Rco α} [LE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => a ≠ b) r.toList
source
theorem Std.Rco.pairwise_toList_lt {α : Type u} {r : Rco α} [LE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => a < b) r.toList
source
theorem Std.Rco.pairwise_toList_le {α : Type u} {r : Rco α} [LE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLE α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => a ≤ b) r.toList
source
theorem Std.Rco.mem_succ_succ_iff {α : Type u} [LE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLE α] [PRange.InfinitelyUpwardEnumerable α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo hi a : α} :
(a ∈ (PRange.succ lo)...PRange.succ hi) ↔ ∃ (a' : α), a = PRange.succ a' ∧ a' ∈ lo...hi
source
theorem Std.Rco.succ_mem_succ_succ_iff {α : Type u} [LE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [PRange.InfinitelyUpwardEnumerable α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo hi a : α} :
(PRange.succ a ∈ (PRange.succ lo)...PRange.succ hi) ↔ a ∈ lo...hi
source
theorem Std.Rco.toList_succ_succ_eq_map {α : Type u} [LE α] [DecidableLE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [PRange.InfinitelyUpwardEnumerable α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo hi : α} :
((PRange.succ lo)...PRange.succ hi).toList = List.map PRange.succ (lo...hi).toList
source
theorem Std.Rco.toArray_succ_succ_eq_map {α : Type u} [LE α] [DecidableLE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [PRange.InfinitelyUpwardEnumerable α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo hi : α} :
((PRange.succ lo)...PRange.succ hi).toArray = Array.map PRange.succ (lo...hi).toArray
source
theorem Std.Rco.forIn'_eq_forIn'_toList {α : Type u} {r : Rco α} [LE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = forIn' r.toList init fun (a : α) (ha : a ∈ r.toList) (acc : γ) => f a ⋯ acc
source
theorem Std.Rco.forIn'_eq_forIn'_toArray {α : Type u} {r : Rco α} [LE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = forIn' r.toArray init fun (a : α) (ha : a ∈ r.toArray) (acc : γ) => f a ⋯ acc
source
theorem Std.Rco.forIn'_toList_eq_forIn' {α : Type u} {r : Rco α} [LE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r.toList → γ → m (ForInStep γ)} :
forIn' r.toList init f = forIn' r init fun (a : α) (ha : a ∈ r) (acc : γ) => f a ⋯ acc
source
theorem Std.Rco.forIn'_toArray_eq_forIn' {α : Type u} {r : Rco α} [LE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r.toArray → γ → m (ForInStep γ)} :
forIn' r.toArray init f = forIn' r init fun (a : α) (ha : a ∈ r) (acc : γ) => f a ⋯ acc
source
theorem Std.Rco.mem_of_mem_Roo {α : Type u} {r : Rco α} [LE α] [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {a b : α} (hrb : r.lower ≤ b) (hmem : a ∈ b<...r.upper) :
a ∈ r
source
theorem Std.Rco.forIn'_eq_if {α : Type u} {r : Rco α} [LE α] [DecidableLE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLE α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {m : Type u → Type w} [Monad m] [LawfulMonad m] {γ : Type u} {init : γ} {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = if hu : r.lower < r.upper then have hle := ⋯; do let __do_lift ← f r.lower ⋯ init match __do_lift with | ForInStep.yield c => forIn' (r.lower<...r.upper) c fun (a : α) (ha : a ∈ r.lower<...r.upper) (acc : γ) => f a ⋯ acc | ForInStep.done c => pure c else pure init
source
theorem Std.Rco.isEmpty_iff_forall_not_mem {α : Type u} {r : Rco α} [LE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [Rxo.HasSize α] [Rxo.LawfulHasSize α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.isEmpty = true ↔ ∀ (a : α), ¬a ∈ r
source
theorem Std.Rci.toList_eq_toList_Roi {α : Type u} {r : Rci α} [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toList = r.lower :: r.lower<...*.toList
source
theorem Std.Rci.toArray_eq_toArray_Roi {α : Type u} {r : Rci α} [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toArray = #[r.lower] ++ r.lower<...*.toArray
source
@[simp]
theorem Std.Rci.toArray_toList {α : Type u} {r : Rci α} [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] :
r.toList.toArray = r.toArray
source
@[simp]
theorem Std.Rci.toList_toArray {α : Type u} {r : Rci α} [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] :
r.toArray.toList = r.toList
source
theorem Std.Rci.toList_ne_nil {α : Type u} {r : Rci α} [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toList ≠ []
source
theorem Std.Rci.toArray_ne_nil {α : Type u} {r : Rci α} [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toArray ≠ #[]
source
theorem Std.Rci.mem_toList_iff_mem {α : Type u} {r : Rci α} [LE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {a : α} :
a ∈ r.toList ↔ a ∈ r
source
theorem Std.Rci.mem_toArray_iff_mem {α : Type u} {r : Rci α} [LE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {a : α} :
a ∈ r.toArray ↔ a ∈ r
source
theorem Std.Rci.pairwise_toList_upwardEnumerableLt {α : Type u} {r : Rci α} [LE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => PRange.UpwardEnumerable.LT a b) r.toList
source
theorem Std.Rci.pairwise_toList_ne {α : Type u} {r : Rci α} [LE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => a ≠ b) r.toList
source
theorem Std.Rci.pairwise_toList_lt {α : Type u} {r : Rci α} [LE α] [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => a < b) r.toList
source
theorem Std.Rci.pairwise_toList_le {α : Type u} {r : Rci α} [LE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => a ≤ b) r.toList
source
theorem Std.Rci.mem_succ_iff {α : Type u} [LE α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.InfinitelyUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo a : α} :
a ∈ (PRange.succ lo)...* ↔ ∃ (a' : α), a = PRange.succ a' ∧ a' ∈ lo...*
source
theorem Std.Rci.succ_mem_succ_succ_iff {α : Type u} [LE α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.InfinitelyUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo a : α} :
PRange.succ a ∈ (PRange.succ lo)...* ↔ a ∈ lo...*
source
theorem Std.Rci.toList_succ_succ_eq_map {α : Type u} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.InfinitelyUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo : α} :
(PRange.succ lo)...*.toList = List.map PRange.succ lo...*.toList
source
theorem Std.Rci.toArray_succ_succ_eq_map {α : Type u} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.InfinitelyUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo : α} :
(PRange.succ lo)...*.toArray = Array.map PRange.succ lo...*.toArray
source
theorem Std.Rci.forIn'_eq_forIn'_toList {α : Type u} {r : Rci α} [LE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = forIn' r.toList init fun (a : α) (ha : a ∈ r.toList) (acc : γ) => f a ⋯ acc
source
theorem Std.Rci.forIn'_eq_forIn'_toArray {α : Type u} {r : Rci α} [LE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = forIn' r.toArray init fun (a : α) (ha : a ∈ r.toArray) (acc : γ) => f a ⋯ acc
source
theorem Std.Rci.forIn'_toList_eq_forIn' {α : Type u} {r : Rci α} [LE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r.toList → γ → m (ForInStep γ)} :
forIn' r.toList init f = forIn' r init fun (a : α) (ha : a ∈ r) (acc : γ) => f a ⋯ acc
source
theorem Std.Rci.forIn'_toArray_eq_forIn' {α : Type u} {r : Rci α} [LE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r.toArray → γ → m (ForInStep γ)} :
forIn' r.toArray init f = forIn' r init fun (a : α) (ha : a ∈ r) (acc : γ) => f a ⋯ acc
source
theorem Std.Rci.mem_of_mem_Roi {α : Type u} {r : Rci α} [LE α] [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {a b : α} (hrb : r.lower ≤ b) (hmem : a ∈ b<...*) :
a ∈ r
source
theorem Std.Rci.forIn'_eq_match {α : Type u} {r : Rci α} [LE α] [DecidableLE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLE α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {m : Type u → Type w} [Monad m] [LawfulMonad m] {γ : Type u} {init : γ} {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = have hle := ⋯; do let __do_lift ← f r.lower hle init match __do_lift with | ForInStep.yield c => forIn' r.lower<...* c fun (a : α) (ha : a ∈ r.lower<...*) (acc : γ) => f a ⋯ acc | ForInStep.done c => pure c
source
theorem Std.Rci.isEmpty_iff_forall_not_mem {α : Type u} {r : Rci α} [LE α] [PRange.UpwardEnumerable α] [Rxi.HasSize α] [Rxi.LawfulHasSize α] [PRange.LawfulUpwardEnumerableLE α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.isEmpty = true ↔ ∀ (a : α), ¬a ∈ r
source
theorem Std.Roc.toList_eq_match {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toList = match PRange.succ? r.lower with | none => [] | some next => if next ≤ r.upper then next :: (next<...=r.upper).toList else []
source
theorem Std.Roc.toArray_eq_match {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toArray = match PRange.succ? r.lower with | none => #[] | some next => if next ≤ r.upper then #[next] ++ (next<...=r.upper).toArray else #[]
source
@[simp]
theorem Std.Roc.toArray_toList {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxc.IsAlwaysFinite α] :
r.toList.toArray = r.toArray
source
@[simp]
theorem Std.Roc.toList_toArray {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxc.IsAlwaysFinite α] :
r.toArray.toList = r.toList
source
theorem Std.Roc.toList_eq_nil_iff {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toList = [] ↔ ¬r.lower < r.upper
source
theorem Std.Roc.toArray_eq_empty_iff {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toArray = #[] ↔ ¬r.lower < r.upper
source
theorem Std.Roc.mem_toList_iff_mem {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {a : α} :
a ∈ r.toList ↔ a ∈ r
source
theorem Std.Roc.mem_toArray_iff_mem {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {a : α} :
a ∈ r.toArray ↔ a ∈ r
source
theorem Std.Roc.pairwise_toList_upwardEnumerableLt {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => PRange.UpwardEnumerable.LT a b) r.toList
source
theorem Std.Roc.pairwise_toList_ne {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => a ≠ b) r.toList
source
theorem Std.Roc.pairwise_toList_lt {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => a < b) r.toList
source
theorem Std.Roc.pairwise_toList_le {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => a ≤ b) r.toList
source
theorem Std.Roc.mem_succ_succ_iff {α : Type u} [LE α] [DecidableLE α] [LT α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [PRange.InfinitelyUpwardEnumerable α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo hi a : α} :
(a ∈ (PRange.succ lo)<...=PRange.succ hi) ↔ ∃ (a' : α), a = PRange.succ a' ∧ a' ∈ lo<...=hi
source
theorem Std.Roc.succ_mem_succ_succ_iff {α : Type u} [LE α] [DecidableLE α] [LT α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [PRange.InfinitelyUpwardEnumerable α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo hi a : α} :
(PRange.succ a ∈ (PRange.succ lo)<...=PRange.succ hi) ↔ a ∈ lo<...=hi
source
theorem Std.Roc.toList_succ_succ_eq_map {α : Type u} [LE α] [DecidableLE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [PRange.InfinitelyUpwardEnumerable α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo hi : α} :
((PRange.succ lo)<...=PRange.succ hi).toList = List.map PRange.succ (lo<...=hi).toList
source
theorem Std.Roc.toArray_succ_succ_eq_map {α : Type u} [LE α] [DecidableLE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [PRange.InfinitelyUpwardEnumerable α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo hi : α} :
((PRange.succ lo)<...=PRange.succ hi).toArray = Array.map PRange.succ (lo<...=hi).toArray
source
theorem Std.Roc.forIn'_eq_forIn'_toList {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = forIn' r.toList init fun (a : α) (ha : a ∈ r.toList) (acc : γ) => f a ⋯ acc
source
theorem Std.Roc.forIn'_eq_forIn'_toArray {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = forIn' r.toArray init fun (a : α) (ha : a ∈ r.toArray) (acc : γ) => f a ⋯ acc
source
theorem Std.Roc.forIn'_toList_eq_forIn' {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r.toList → γ → m (ForInStep γ)} :
forIn' r.toList init f = forIn' r init fun (a : α) (ha : a ∈ r) (acc : γ) => f a ⋯ acc
source
theorem Std.Roc.forIn'_toArray_eq_forIn' {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r.toArray → γ → m (ForInStep γ)} :
forIn' r.toArray init f = forIn' r init fun (a : α) (ha : a ∈ r) (acc : γ) => f a ⋯ acc
source
theorem Std.Roc.mem_of_mem_of_le {α : Type u} [LE α] [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] {lo lo' hi a : α} (h : lo ≤ lo') (hmem : a ∈ lo'<...=hi) :
a ∈ lo<...=hi
source
theorem Std.Roc.forIn'_eq_match {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {m : Type u → Type w} [Monad m] [LawfulMonad m] {γ : Type u} {init : γ} {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = match hs : PRange.succ? r.lower with | none => pure init | some next => if hu : next ≤ r.upper then have hlt := ⋯; do let __do_lift ← f next ⋯ init match __do_lift with | ForInStep.yield c => forIn' (next<...=r.upper) c fun (a : α) (ha : a ∈ next<...=r.upper) (acc : γ) => f a ⋯ acc | ForInStep.done c => pure c else pure init
source
theorem Std.Roo.toList_eq_match {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toList = match PRange.succ? r.lower with | none => [] | some next => if next < r.upper then next :: (next<...r.upper).toList else []
source
theorem Std.Roo.toArray_eq_match {α : Type u} {r : Roo α} [LE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toArray = match PRange.succ? r.lower with | none => #[] | some next => if next < r.upper then #[next] ++ (next<...r.upper).toArray else #[]
source
@[simp]
theorem Std.Roo.toArray_toList {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxo.IsAlwaysFinite α] :
r.toList.toArray = r.toArray
source
@[simp]
theorem Std.Roo.toList_toArray {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxo.IsAlwaysFinite α] :
r.toArray.toList = r.toList
source
theorem Std.Roo.toList_eq_nil_iff {α : Type u} {r : Roo α} [LE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toList = [] ↔ ∀ (a : α), PRange.succ? r.lower = some a → ¬a < r.upper
source
theorem Std.Roo.toArray_eq_empty_iff {α : Type u} {r : Roo α} [LE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toArray = #[] ↔ ∀ (a : α), PRange.succ? r.lower = some a → ¬a < r.upper
source
theorem Std.Roo.mem_toList_iff_mem {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {a : α} :
a ∈ r.toList ↔ a ∈ r
source
theorem Std.Roo.mem_toArray_iff_mem {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {a : α} :
a ∈ r.toArray ↔ a ∈ r
source
theorem Std.Roo.pairwise_toList_upwardEnumerableLt {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => PRange.UpwardEnumerable.LT a b) r.toList
source
theorem Std.Roo.pairwise_toList_ne {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => a ≠ b) r.toList
source
theorem Std.Roo.pairwise_toList_lt {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => a < b) r.toList
source
theorem Std.Roo.pairwise_toList_le {α : Type u} {r : Roo α} [LE α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLE α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => a ≤ b) r.toList
source
theorem Std.Roo.mem_succ_succ_iff {α : Type u} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.InfinitelyUpwardEnumerable α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo hi a : α} :
(a ∈ (PRange.succ lo)<...PRange.succ hi) ↔ ∃ (a' : α), a = PRange.succ a' ∧ a' ∈ lo<...hi
source
theorem Std.Roo.succ_mem_succ_succ_iff {α : Type u} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.InfinitelyUpwardEnumerable α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo hi a : α} :
(PRange.succ a ∈ (PRange.succ lo)<...PRange.succ hi) ↔ a ∈ lo<...hi
source
theorem Std.Roo.toList_succ_succ_eq_map {α : Type u} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.InfinitelyUpwardEnumerable α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo hi : α} :
((PRange.succ lo)<...PRange.succ hi).toList = List.map PRange.succ (lo<...hi).toList
source
theorem Std.Roo.toArray_succ_succ_eq_map {α : Type u} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.InfinitelyUpwardEnumerable α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo hi : α} :
((PRange.succ lo)<...PRange.succ hi).toArray = Array.map PRange.succ (lo<...hi).toArray
source
theorem Std.Roo.forIn'_eq_forIn'_toList {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = forIn' r.toList init fun (a : α) (ha : a ∈ r.toList) (acc : γ) => f a ⋯ acc
source
theorem Std.Roo.forIn'_eq_forIn'_toArray {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = forIn' r.toArray init fun (a : α) (ha : a ∈ r.toArray) (acc : γ) => f a ⋯ acc
source
theorem Std.Roo.forIn'_toList_eq_forIn' {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r.toList → γ → m (ForInStep γ)} :
forIn' r.toList init f = forIn' r init fun (a : α) (ha : a ∈ r) (acc : γ) => f a ⋯ acc
source
theorem Std.Roo.forIn'_toArray_eq_forIn' {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r.toArray → γ → m (ForInStep γ)} :
forIn' r.toArray init f = forIn' r init fun (a : α) (ha : a ∈ r) (acc : γ) => f a ⋯ acc
source
theorem Std.Roo.mem_of_mem_of_le {α : Type u} {r : Roo α} [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {a b : α} (hrb : PRange.UpwardEnumerable.LE r.lower b) (hmem : a ∈ b<...r.upper) :
a ∈ r
source
theorem Std.Roo.forIn'_eq_match {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {m : Type u → Type w} [Monad m] [LawfulMonad m] {γ : Type u} {init : γ} {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = match hs : PRange.succ? r.lower with | none => pure init | some next => if hu : next < r.upper then have hlt := ⋯; have hle := ⋯; do let __do_lift ← f next ⋯ init match __do_lift with | ForInStep.yield c => forIn' (next<...r.upper) c fun (a : α) (ha : a ∈ next<...r.upper) (acc : γ) => f a ⋯ acc | ForInStep.done c => pure c else pure init
source
theorem Std.Roo.isEmpty_iff_forall_not_mem {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [Rxo.HasSize α] [Rxo.LawfulHasSize α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.isEmpty = true ↔ ∀ (a : α), ¬a ∈ r
source
theorem Std.Roi.toList_eq_match {α : Type u} {r : Roi α} [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toList = match PRange.succ? r.lower with | none => [] | some next => next :: next<...*.toList
source
theorem Std.Roi.toArray_eq_match {α : Type u} {r : Roi α} [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toArray = match PRange.succ? r.lower with | none => #[] | some next => #[next] ++ next<...*.toArray
source
@[simp]
theorem Std.Roi.toArray_toList {α : Type u} {r : Roi α} [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] :
r.toList.toArray = r.toArray
source
@[simp]
theorem Std.Roi.toList_toArray {α : Type u} {r : Roi α} [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] :
r.toArray.toList = r.toList
source
theorem Std.Roi.toList_eq_nil_iff {α : Type u} {r : Roi α} [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toList = [] ↔ (PRange.succ? r.lower).isNone = true
source
theorem Std.Roi.toArray_eq_empty_iff {α : Type u} {r : Roi α} [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toArray = #[] ↔ (PRange.succ? r.lower).isNone = true
source
theorem Std.Roi.mem_toList_iff_mem {α : Type u} {r : Roi α} [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] {a : α} :
a ∈ r.toList ↔ a ∈ r
source
theorem Std.Roi.mem_toArray_iff_mem {α : Type u} {r : Roi α} [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] {a : α} :
a ∈ r.toArray ↔ a ∈ r
source
theorem Std.Roi.pairwise_toList_upwardEnumerableLt {α : Type u} {r : Roi α} [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] :
List.Pairwise (fun (a b : α) => PRange.UpwardEnumerable.LT a b) r.toList
source
theorem Std.Roi.pairwise_toList_ne {α : Type u} {r : Roi α} [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] :
List.Pairwise (fun (a b : α) => a ≠ b) r.toList
source
theorem Std.Roi.pairwise_toList_lt {α : Type u} {r : Roi α} [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] :
List.Pairwise (fun (a b : α) => a < b) r.toList
source
theorem Std.Roi.pairwise_toList_le {α : Type u} {r : Roi α} [LE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxi.IsAlwaysFinite α] :
List.Pairwise (fun (a b : α) => a ≤ b) r.toList
source
theorem Std.Roi.mem_succ_iff {α : Type u} [LT α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.InfinitelyUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo a : α} :
a ∈ (PRange.succ lo)<...* ↔ ∃ (a' : α), a = PRange.succ a' ∧ a' ∈ lo<...*
source
theorem Std.Roi.succ_mem_succ_succ_iff {α : Type u} [LT α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.InfinitelyUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo a : α} :
PRange.succ a ∈ (PRange.succ lo)<...* ↔ a ∈ lo<...*
source
theorem Std.Roi.toList_succ_succ_eq_map {α : Type u} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.InfinitelyUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] {lo : α} :
(PRange.succ lo)<...*.toList = List.map PRange.succ lo<...*.toList
source
theorem Std.Roi.toArray_succ_succ_eq_map {α : Type u} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.InfinitelyUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] {lo : α} :
(PRange.succ lo)<...*.toArray = Array.map PRange.succ lo<...*.toArray
source
theorem Std.Roi.forIn'_eq_forIn'_toList {α : Type u} {r : Roi α} [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = forIn' r.toList init fun (a : α) (ha : a ∈ r.toList) (acc : γ) => f a ⋯ acc
source
theorem Std.Roi.forIn'_eq_forIn'_toArray {α : Type u} {r : Roi α} [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = forIn' r.toArray init fun (a : α) (ha : a ∈ r.toArray) (acc : γ) => f a ⋯ acc
source
theorem Std.Roi.forIn'_toList_eq_forIn' {α : Type u} {r : Roi α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r.toList → γ → m (ForInStep γ)} :
forIn' r.toList init f = forIn' r init fun (a : α) (ha : a ∈ r) (acc : γ) => f a ⋯ acc
source
theorem Std.Roi.forIn'_toArray_eq_forIn' {α : Type u} {r : Roi α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r.toArray → γ → m (ForInStep γ)} :
forIn' r.toArray init f = forIn' r init fun (a : α) (ha : a ∈ r) (acc : γ) => f a ⋯ acc
source
theorem Std.Roi.mem_of_mem_of_le {α : Type u} {r : Roi α} [LT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {a b : α} (hrb : PRange.UpwardEnumerable.LE r.lower b) (hmem : a ∈ b<...*) :
a ∈ r
source
theorem Std.Roi.forIn'_eq_match {α : Type u} {r : Roi α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {m : Type u → Type w} [Monad m] [LawfulMonad m] {γ : Type u} {init : γ} {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = match hs : PRange.succ? r.lower with | none => pure init | some next => have hlt := ⋯; have hle := ⋯; do let __do_lift ← f next hlt init match __do_lift with | ForInStep.yield c => forIn' next<...* c fun (a : α) (ha : a ∈ next<...*) (acc : γ) => f a ⋯ acc | ForInStep.done c => pure c
source
theorem Std.Roi.isEmpty_iff_forall_not_mem {α : Type u} {r : Roi α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [Rxi.HasSize α] [Rxi.LawfulHasSize α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.isEmpty = true ↔ ∀ (a : α), ¬a ∈ r
source
@[simp]
theorem Std.Ric.toArray_toList {α : Type u} {r : Ric α} [PRange.Least? α] [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxc.IsAlwaysFinite α] :
r.toList.toArray = r.toArray
source
@[simp]
theorem Std.Ric.toList_toArray {α : Type u} {r : Ric α} [PRange.Least? α] [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxc.IsAlwaysFinite α] :
r.toArray.toList = r.toList
source
theorem Std.Ric.toList_eq_toList_Rcc {α : Type u} {r : Ric α} [LE α] [DecidableLE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] :
r.toList = (PRange.UpwardEnumerable.least...=r.upper).toList
source
theorem Std.Ric.toArray_eq_toArray_Rcc {α : Type u} {r : Ric α} [LE α] [DecidableLE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] :
r.toArray = (PRange.UpwardEnumerable.least...=r.upper).toArray
source
theorem Std.Ric.toList_eq_if {α : Type u} {r : Ric α} [LE α] [DecidableLE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toList = have init := PRange.UpwardEnumerable.least; if init ≤ r.upper then init :: (init<...=r.upper).toList else []
source
theorem Std.Ric.toArray_eq_if {α : Type u} {r : Ric α} [LE α] [DecidableLE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toArray = have init := PRange.UpwardEnumerable.least; if init ≤ r.upper then #[init] ++ (init<...=r.upper).toArray else #[]
source
theorem Std.Ric.toList_ne_nil {α : Type u} {r : Ric α} [LE α] [DecidableLE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toList ≠ []
source
theorem Std.Ric.toArray_ne_empty {α : Type u} {r : Ric α} [LE α] [DecidableLE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toArray ≠ #[]
source
theorem Std.Ric.mem_iff_mem_Rcc {α : Type u} {r : Ric α} [LE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] {a : α} :
a ∈ r ↔ a ∈ PRange.UpwardEnumerable.least...=r.upper
source
theorem Std.Ric.mem_toList_iff_mem {α : Type u} {r : Ric α} [LE α] [DecidableLE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {a : α} :
a ∈ r.toList ↔ a ∈ r
source
theorem Std.Ric.mem_toArray_iff_mem {α : Type u} {r : Ric α} [LE α] [DecidableLE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {a : α} :
a ∈ r.toArray ↔ a ∈ r
source
theorem Std.Ric.pairwise_toList_upwardEnumerableLt {α : Type u} {r : Ric α} [LE α] [DecidableLE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => PRange.UpwardEnumerable.LT a b) r.toList
source
theorem Std.Ric.pairwise_toList_ne {α : Type u} {r : Ric α} [LE α] [DecidableLE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => a ≠ b) r.toList
source
theorem Std.Ric.pairwise_toList_lt {α : Type u} {r : Ric α} [LE α] [DecidableLE α] [LT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] :
List.Pairwise (fun (a b : α) => a < b) r.toList
source
theorem Std.Ric.pairwise_toList_le {α : Type u} {r : Ric α} [LE α] [DecidableLE α] [LT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => a ≤ b) r.toList
source
theorem Std.Ric.mem_succ_iff {α : Type u} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.InfinitelyUpwardEnumerable α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {hi a : α} :
(a ∈ *...=PRange.succ hi) ↔ (a ∈ *...=hi) ∨ a = PRange.succ hi
source
theorem Std.Ric.succ_mem_succ_iff {α : Type u} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.InfinitelyUpwardEnumerable α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {hi a : α} :
(PRange.succ a ∈ *...=PRange.succ hi) ↔ a ∈ *...=hi
source
theorem Std.Ric.toList_succ_eq_map {α : Type u} [LE α] [DecidableLE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.InfinitelyUpwardEnumerable α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] {hi : α} :
(*...=PRange.succ hi).toList = PRange.UpwardEnumerable.least :: List.map PRange.succ (*...=hi).toList
source
theorem Std.Ric.toArray_succ_eq_map {α : Type u} {r : Ric α} [LE α] [DecidableLE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.InfinitelyUpwardEnumerable α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] {hi : α} :
(*...=PRange.succ hi).toArray = #[PRange.UpwardEnumerable.least] ++ Array.map PRange.succ (*...=hi).toArray
source
theorem Std.Ric.forIn'_eq_forIn'_toList {α : Type u} {r : Ric α} [LE α] [DecidableLE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = forIn' r.toList init fun (a : α) (ha : a ∈ r.toList) (acc : γ) => f a ⋯ acc
source
theorem Std.Ric.forIn'_eq_forIn'_toArray {α : Type u} {r : Ric α} [LE α] [DecidableLE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = forIn' r.toArray init fun (a : α) (ha : a ∈ r.toArray) (acc : γ) => f a ⋯ acc
source
theorem Std.Ric.forIn'_toList_eq_forIn' {α : Type u} {r : Ric α} [LE α] [DecidableLE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r.toList → γ → m (ForInStep γ)} :
forIn' r.toList init f = forIn' r init fun (a : α) (ha : a ∈ r) (acc : γ) => f a ⋯ acc
source
theorem Std.Ric.forIn'_toArray_eq_forIn' {α : Type u} {r : Ric α} [LE α] [DecidableLE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r.toArray → γ → m (ForInStep γ)} :
forIn' r.toArray init f = forIn' r init fun (a : α) (ha : a ∈ r) (acc : γ) => f a ⋯ acc
source
theorem Std.Ric.mem_of_mem_Rcc {α : Type u} [LE α] {lo hi a : α} (hmem : a ∈ lo...=hi) :
a ∈ *...=hi
source
theorem Std.Ric.mem_of_mem_Roc {α : Type u} [LE α] [LT α] {lo hi a : α} (hmem : a ∈ lo<...=hi) :
a ∈ *...=hi
source
theorem Std.Ric.forIn'_eq_forIn'_Rcc {α : Type u} {r : Ric α} [LE α] [DecidableLE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {m : Type u → Type w} [Monad m] [LawfulMonad m] {γ : Type u} {init : γ} {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = forIn' (PRange.UpwardEnumerable.least...=r.upper) init fun (a : α) (ha : a ∈ PRange.UpwardEnumerable.least...=r.upper) (acc : γ) => f a ⋯ acc
source
theorem Std.Ric.forIn'_eq_if {α : Type u} {r : Ric α} [LE α] [DecidableLE α] [LT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {m : Type u → Type w} [Monad m] [LawfulMonad m] {γ : Type u} {init : γ} {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = if hu : PRange.UpwardEnumerable.least ≤ r.upper then do let __do_lift ← f PRange.UpwardEnumerable.least hu init match __do_lift with | ForInStep.yield c => forIn' (PRange.UpwardEnumerable.least<...=r.upper) c fun (a : α) (ha : a ∈ PRange.UpwardEnumerable.least<...=r.upper) (acc : γ) => f a ⋯ acc | ForInStep.done c => pure c else pure init
source
theorem Std.Ric.isEmpty_iff_forall_not_mem {α : Type u} {r : Ric α} [LE α] [PRange.UpwardEnumerable α] [Rxc.HasSize α] [Rxc.LawfulHasSize α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.isEmpty = true ↔ ∀ (a : α), ¬a ∈ r
source
@[simp]
theorem Std.Rio.toArray_toList {α : Type u} {r : Rio α} [PRange.Least? α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxo.IsAlwaysFinite α] :
r.toList.toArray = r.toArray
source
@[simp]
theorem Std.Rio.toList_toArray {α : Type u} {r : Rio α} [PRange.Least? α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxo.IsAlwaysFinite α] :
r.toArray.toList = r.toList
source
theorem Std.Rio.toList_eq_toList_Rco {α : Type u} {r : Rio α} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] :
r.toList = (PRange.UpwardEnumerable.least...r.upper).toList
source
theorem Std.Rio.toArray_eq_toArray_Rco {α : Type u} {r : Rio α} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] :
r.toArray = (PRange.UpwardEnumerable.least...r.upper).toArray
source
theorem Std.Rio.toList_eq_if {α : Type u} {r : Rio α} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toList = have init := PRange.UpwardEnumerable.least; if init < r.upper then init :: (init<...r.upper).toList else []
source
theorem Std.Rio.toArray_eq_if {α : Type u} {r : Rio α} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toArray = have init := PRange.UpwardEnumerable.least; if init < r.upper then #[init] ++ (init<...r.upper).toArray else #[]
source
theorem Std.Rio.toList_eq_nil_iff {α : Type u} {r : Rio α} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toList = [] ↔ ¬PRange.UpwardEnumerable.least < r.upper
source
theorem Std.Rio.toArray_eq_nil_iff {α : Type u} {r : Rio α} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toArray = #[] ↔ ¬PRange.UpwardEnumerable.least < r.upper
source
theorem Std.Rio.mem_iff_mem_Rco {α : Type u} {r : Rio α} [LE α] [LT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] {a : α} :
a ∈ r ↔ a ∈ PRange.UpwardEnumerable.least...r.upper
source
theorem Std.Rio.mem_toList_iff_mem {α : Type u} {r : Rio α} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {a : α} :
a ∈ r.toList ↔ a ∈ r
source
theorem Std.Rio.mem_toArray_iff_mem {α : Type u} {r : Rio α} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {a : α} :
a ∈ r.toArray ↔ a ∈ r
source
theorem Std.Rio.pairwise_toList_upwardEnumerableLt {α : Type u} {r : Rio α} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => PRange.UpwardEnumerable.LT a b) r.toList
source
theorem Std.Rio.pairwise_toList_ne {α : Type u} {r : Rio α} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => a ≠ b) r.toList
source
theorem Std.Rio.pairwise_toList_lt {α : Type u} {r : Rio α} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] :
List.Pairwise (fun (a b : α) => a < b) r.toList
source
theorem Std.Rio.pairwise_toList_le {α : Type u} {r : Rio α} [LE α] [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => a ≤ b) r.toList
source
theorem Std.Rio.mem_succ_iff {α : Type u} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.InfinitelyUpwardEnumerable α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {hi a : α} :
(a ∈ *...PRange.succ hi) ↔ (a ∈ *...hi) ∨ a = hi
source
theorem Std.Rio.succ_mem_succ_iff {α : Type u} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.InfinitelyUpwardEnumerable α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {hi a : α} :
(PRange.succ a ∈ *...PRange.succ hi) ↔ a ∈ *...hi
source
theorem Std.Rio.toList_succ_eq_map {α : Type u} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.InfinitelyUpwardEnumerable α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] {hi : α} :
(*...PRange.succ hi).toList = PRange.UpwardEnumerable.least :: List.map PRange.succ (*...hi).toList
source
theorem Std.Rio.toArray_succ_eq_map {α : Type u} {r : Rio α} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LinearlyUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.InfinitelyUpwardEnumerable α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] {hi : α} :
(*...PRange.succ hi).toArray = #[PRange.UpwardEnumerable.least] ++ Array.map PRange.succ (*...hi).toArray
source
theorem Std.Rio.forIn'_eq_forIn'_toList {α : Type u} {r : Rio α} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = forIn' r.toList init fun (a : α) (ha : a ∈ r.toList) (acc : γ) => f a ⋯ acc
source
theorem Std.Rio.forIn'_eq_forIn'_toArray {α : Type u} {r : Rio α} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = forIn' r.toArray init fun (a : α) (ha : a ∈ r.toArray) (acc : γ) => f a ⋯ acc
source
theorem Std.Rio.forIn'_toList_eq_forIn' {α : Type u} {r : Rio α} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r.toList → γ → m (ForInStep γ)} :
forIn' r.toList init f = forIn' r init fun (a : α) (ha : a ∈ r) (acc : γ) => f a ⋯ acc
source
theorem Std.Rio.forIn'_toArray_eq_forIn' {α : Type u} {r : Rio α} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r.toArray → γ → m (ForInStep γ)} :
forIn' r.toArray init f = forIn' r init fun (a : α) (ha : a ∈ r) (acc : γ) => f a ⋯ acc
source
theorem Std.Rio.mem_of_mem_Rco {α : Type u} [LE α] [LT α] {lo hi a : α} (hmem : a ∈ lo...hi) :
a ∈ *...hi
source
theorem Std.Rio.mem_of_mem_Roo {α : Type u} [LT α] {lo hi a : α} (hmem : a ∈ lo<...hi) :
a ∈ *...hi
source
theorem Std.Rio.forIn'_eq_if {α : Type u} {r : Rio α} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {m : Type u → Type w} [Monad m] [LawfulMonad m] {γ : Type u} {init : γ} {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = if hu : PRange.UpwardEnumerable.least < r.upper then do let __do_lift ← f PRange.UpwardEnumerable.least hu init match __do_lift with | ForInStep.yield c => forIn' (PRange.UpwardEnumerable.least<...r.upper) c fun (a : α) (ha : a ∈ PRange.UpwardEnumerable.least<...r.upper) (acc : γ) => f a ⋯ acc | ForInStep.done c => pure c else pure init
source
theorem Std.Rio.forIn'_eq_forIn'_Rco {α : Type u} {r : Rio α} [LE α] [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {m : Type u → Type w} [Monad m] [LawfulMonad m] {γ : Type u} {init : γ} {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = forIn' (PRange.UpwardEnumerable.least...r.upper) init fun (a : α) (ha : a ∈ PRange.UpwardEnumerable.least...r.upper) (acc : γ) => f a ⋯ acc
source
theorem Std.Rio.isEmpty_iff_forall_not_mem {α : Type u} {r : Rio α} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [PRange.LawfulUpwardEnumerable α] :
r.isEmpty = true ↔ ∀ (a : α), ¬a ∈ r
source
@[simp]
theorem Std.Rii.toArray_toList {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] :
r.toList.toArray = r.toArray
source
@[simp]
theorem Std.Rii.toList_toArray {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] :
r.toArray.toList = r.toList
source
theorem Std.Rii.toList_eq_match_toList_Rci {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] :
r.toList = match PRange.least? with | none => [] | some init => init...*.toList
source
theorem Std.Rii.toArray_eq_match_toArray_Rci {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] :
r.toArray = match PRange.least? with | none => #[] | some init => init...*.toArray
source
theorem Std.Rii.toList_eq_match_toList_Roi {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toList = match PRange.least? with | none => [] | some init => init :: init<...*.toList
source
theorem Std.Rii.toArray_eq_toArray_Roi {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toArray = match PRange.least? with | none => #[] | some init => #[init] ++ init<...*.toArray
source
theorem Std.Rii.toList_eq_nil_iff {α : Type u} {r : Rii α} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toList = [] ↔ ¬Nonempty α
source
theorem Std.Rii.toArray_eq_empty_iff {α : Type u} {r : Rii α} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
r.toArray = #[] ↔ ¬Nonempty α
source
theorem Std.Rii.mem_iff_mem_Rci {α : Type u} {r : Rii α} [LE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] {a : α} :
a ∈ r ↔ a ∈ PRange.UpwardEnumerable.least...*
source
theorem Std.Rii.mem_toList {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {a : α} :
a ∈ r.toList
source
theorem Std.Rii.mem_toArray {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {a : α} :
a ∈ r.toArray
source
theorem Std.Rii.pairwise_toList_upwardEnumerableLt {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => PRange.UpwardEnumerable.LT a b) r.toList
source
theorem Std.Rii.pairwise_toList_ne {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => a ≠ b) r.toList
source
theorem Std.Rii.pairwise_toList_lt {α : Type u} {r : Rii α} [LT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] :
List.Pairwise (fun (a b : α) => a < b) r.toList
source
theorem Std.Rii.pairwise_toList_le {α : Type u} {r : Rii α} [LE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] :
List.Pairwise (fun (a b : α) => a ≤ b) r.toList
source
theorem Std.Rii.forIn'_eq_forIn'_toList {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = forIn' r.toList init fun (a : α) (x : a ∈ r.toList) (acc : γ) => f a ⋯ acc
source
theorem Std.Rii.forIn'_eq_forIn'_toArray {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = forIn' r.toArray init fun (a : α) (x : a ∈ r.toArray) (acc : γ) => f a ⋯ acc
source
theorem Std.Rii.forIn'_toList_eq_forIn' {α : Type u} {r : Rii α} [LT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r.toList → γ → m (ForInStep γ)} :
forIn' r.toList init f = forIn' r init fun (a : α) (x : a ∈ r) (acc : γ) => f a ⋯ acc
source
theorem Std.Rii.forIn'_toArray_eq_forIn' {α : Type u} {r : Rii α} [LT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {γ : Type u} {init : γ} {m : Type u → Type w} [Monad m] [LawfulMonad m] {f : (a : α) → a ∈ r.toArray → γ → m (ForInStep γ)} :
forIn' r.toArray init f = forIn' r init fun (a : α) (x : a ∈ r) (acc : γ) => f a ⋯ acc
source
theorem Std.Rii.forIn'_eq_match_forIn'_Rci {α : Type u} {r : Rii α} [LE α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {m : Type u → Type w} [Monad m] [LawfulMonad m] {γ : Type u} {init : γ} {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = match PRange.least? with | none => pure init | some next => forIn' next...* init fun (a : α) (x : a ∈ next...*) (acc : γ) => f a ⋯ acc
source
theorem Std.Rii.forIn'_eq_match_forIn'_Roi {α : Type u} {r : Rii α} {hu : True} [LT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {m : Type u → Type w} [Monad m] [LawfulMonad m] {γ : Type u} {init : γ} {f : (a : α) → a ∈ r → γ → m (ForInStep γ)} :
forIn' r init f = match PRange.least? with | none => pure init | some next => do let __do_lift ← f next hu init match __do_lift with | ForInStep.yield c => forIn' next<...* c fun (a : α) (x : a ∈ next<...*) (acc : γ) => f a ⋯ acc | ForInStep.done c => pure c
source
theorem Std.Rii.isEmpty_iff {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] :
r.isEmpty = true ↔ ¬Nonempty α
source
theorem Std.Rii.isEmpty_iff_forall_not_mem {α : Type u} {r : Rii α} [LT α] [DecidableLT α] [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [PRange.LawfulUpwardEnumerable α] :
r.isEmpty = true ↔ ∀ (a : α), ¬a ∈ r
source
theorem Std.toList_Roc_eq_toList_Rcc_of_isSome_succ? {α : Type u} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo hi : α} (h : (PRange.succ? lo).isSome = true) :
(lo<...=hi).toList = (((PRange.succ? lo).get h)...=hi).toList
source
theorem Std.toList_Roo_eq_toList_Rco_of_isSome_succ? {α : Type u} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo hi : α} (h : (PRange.succ? lo).isSome = true) :
(lo<...hi).toList = (((PRange.succ? lo).get h)...hi).toList
source
theorem Std.toList_Roi_eq_toList_Rci_of_isSome_succ? {α : Type u} [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [PRange.LawfulUpwardEnumerable α] {lo : α} (h : (PRange.succ? lo).isSome = true) :
lo<...*.toList = ((PRange.succ? lo).get h)...*.toList
source
theorem Std.Rcc.length_toList {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [Rxc.HasSize α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [Rxc.LawfulHasSize α] :
r.toList.length = r.size
source
theorem Std.Rcc.size_toArray {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [Rxc.HasSize α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [Rxc.LawfulHasSize α] :
r.toArray.size = r.size
source
theorem Std.Rcc.getElem?_toList_eq {α : Type u} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] {r : Rcc α} {i : Nat} :
r.toList[i]? = Option.filter (fun (x : α) => decide (x ≤ r.upper)) (PRange.succMany? i r.lower)
source
theorem Std.Rcc.getElem?_toArray_eq {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] {i : Nat} :
r.toArray[i]? = Option.filter (fun (x : α) => decide (x ≤ r.upper)) (PRange.succMany? i r.lower)
source
theorem Std.Rcc.isSome_succMany?_of_lt_length_toList {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] {i : Nat} (h : i < r.toList.length) :
(PRange.succMany? i r.lower).isSome = true
source
theorem Std.Rcc.isSome_succMany?_of_lt_size_toArray {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] {i : Nat} (h : i < r.toArray.size) :
(PRange.succMany? i r.lower).isSome = true
source
theorem Std.Rcc.getElem_toList_eq {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] {i : Nat} {h : i < r.toList.length} :
r.toList[i] = (PRange.succMany? i r.lower).get ⋯
source
theorem Std.Rcc.getElem_toArray_eq {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] {i : Nat} {h : i < r.toArray.size} :
r.toArray[i] = (PRange.succMany? i r.lower).get ⋯
source
theorem Std.Rcc.eq_succMany?_of_toList_eq_append_cons {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] {pref suff : List α} {cur : α} (h : r.toList = pref ++ cur :: suff) :
cur = (PRange.succMany? pref.length r.lower).get ⋯
source
theorem Std.Rcc.eq_succMany?_of_toArray_eq_append_append {α : Type u} {r : Rcc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] {pref suff : Array α} {cur : α} (h : r.toArray = pref ++ #[cur] ++ suff) :
cur = (PRange.succMany? pref.size r.lower).get ⋯
source
theorem Std.Roc.length_toList {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [Rxc.HasSize α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [Rxc.LawfulHasSize α] :
r.toList.length = r.size
source
theorem Std.Roc.size_toArray {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [Rxc.HasSize α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [Rxc.LawfulHasSize α] :
r.toArray.size = r.size
source
theorem Std.Roc.getElem?_toList_eq {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] {i : Nat} :
r.toList[i]? = Option.filter (fun (x : α) => decide (x ≤ r.upper)) (PRange.succMany? (i + 1) r.lower)
source
theorem Std.Roc.getElem?_toArray_eq {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] {i : Nat} :
r.toArray[i]? = Option.filter (fun (x : α) => decide (x ≤ r.upper)) (PRange.succMany? (i + 1) r.lower)
source
theorem Std.Roc.isSome_succMany?_of_lt_length_toList {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] {i : Nat} (h : i < r.toList.length) :
(PRange.succMany? (i + 1) r.lower).isSome = true
source
theorem Std.Roc.isSome_succMany?_of_lt_size_toArray {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] {i : Nat} (h : i < r.toArray.size) :
(PRange.succMany? (i + 1) r.lower).isSome = true
source
theorem Std.Roc.getElem_toList_eq {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] {i : Nat} {h : i < r.toList.length} :
r.toList[i] = (PRange.succMany? (i + 1) r.lower).get ⋯
source
theorem Std.Roc.getElem_toArray_eq {α : Type u} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] {r : Roc α} {i : Nat} {h : i < r.toArray.size} :
r.toArray[i] = (PRange.succMany? (i + 1) r.lower).get ⋯
source
theorem Std.Roc.eq_succMany?_of_toList_eq_append_cons {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] {pref suff : List α} {cur : α} (h : r.toList = pref ++ cur :: suff) :
cur = (PRange.succMany? (pref.length + 1) r.lower).get ⋯
source
theorem Std.Roc.eq_succMany?_of_toArray_eq_append_append {α : Type u} {r : Roc α} [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] {pref suff : Array α} {cur : α} (h : r.toArray = pref ++ #[cur] ++ suff) :
cur = (PRange.succMany? (pref.size + 1) r.lower).get ⋯
source
theorem Std.Ric.length_toList {α : Type u} {r : Ric α} [PRange.Least? α] [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [Rxc.HasSize α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [Rxc.LawfulHasSize α] :
r.toList.length = r.size
source
theorem Std.Ric.size_toArray {α : Type u} {r : Ric α} [PRange.Least? α] [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [Rxc.HasSize α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [Rxc.IsAlwaysFinite α] [Rxc.LawfulHasSize α] :
r.toArray.size = r.size
source
theorem Std.Ric.getElem?_toList_eq {α : Type u} {r : Ric α} [PRange.Least? α] [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] {i : Nat} :
r.toList[i]? = Option.filter (fun (x : α) => decide (x ≤ r.upper)) (PRange.succMany? i PRange.UpwardEnumerable.least)
source
theorem Std.Ric.getElem?_toArray_eq {α : Type u} {r : Ric α} [PRange.Least? α] [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] {i : Nat} :
r.toArray[i]? = Option.filter (fun (x : α) => decide (x ≤ r.upper)) (PRange.succMany? i PRange.UpwardEnumerable.least)
source
theorem Std.Ric.isSome_succMany?_of_lt_length_toList {α : Type u} {r : Ric α} [PRange.Least? α] [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] {i : Nat} (h : i < r.toList.length) :
(PRange.succMany? i PRange.UpwardEnumerable.least).isSome = true
source
theorem Std.Ric.isSome_succMany?_of_lt_size_toArray {α : Type u} {r : Ric α} [PRange.Least? α] [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] {i : Nat} (h : i < r.toArray.size) :
(PRange.succMany? i PRange.UpwardEnumerable.least).isSome = true
source
theorem Std.Ric.getElem_toList_eq {α : Type u} {r : Ric α} [PRange.Least? α] [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] {i : Nat} {h : i < r.toList.length} :
r.toList[i] = (PRange.succMany? i PRange.UpwardEnumerable.least).get ⋯
source
theorem Std.Ric.getElem_toArray_eq {α : Type u} [PRange.Least? α] [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] {r : Ric α} {i : Nat} {h : i < r.toArray.size} :
r.toArray[i] = (PRange.succMany? i PRange.UpwardEnumerable.least).get ⋯
source
theorem Std.Ric.eq_succMany?_of_toList_eq_append_cons {α : Type u} {r : Ric α} [PRange.Least? α] [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] {pref suff : List α} {cur : α} (h : r.toList = pref ++ cur :: suff) :
cur = (PRange.succMany? pref.length PRange.UpwardEnumerable.least).get ⋯
source
theorem Std.Ric.eq_succMany?_of_toArray_eq_append_append {α : Type u} {r : Ric α} [PRange.Least? α] [LE α] [DecidableLE α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxc.IsAlwaysFinite α] {pref suff : Array α} {cur : α} (h : r.toArray = pref ++ #[cur] ++ suff) :
cur = (PRange.succMany? pref.size PRange.UpwardEnumerable.least).get ⋯
source
theorem Std.Rco.length_toList {α : Type u} {r : Rco α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [Rxo.HasSize α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [Rxo.LawfulHasSize α] :
r.toList.length = r.size
source
theorem Std.Rco.size_toArray {α : Type u} {r : Rco α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [Rxo.HasSize α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [Rxo.LawfulHasSize α] :
r.toArray.size = r.size
source
theorem Std.Rco.getElem?_toList_eq {α : Type u} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] {r : Rco α} {i : Nat} :
r.toList[i]? = Option.filter (fun (x : α) => decide (x < r.upper)) (PRange.succMany? i r.lower)
source
theorem Std.Rco.getElem?_toArray_eq {α : Type u} {r : Rco α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] {i : Nat} :
r.toArray[i]? = Option.filter (fun (x : α) => decide (x < r.upper)) (PRange.succMany? i r.lower)
source
theorem Std.Rco.isSome_succMany?_of_lt_length_toList {α : Type u} {r : Rco α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] {i : Nat} (h : i < r.toList.length) :
(PRange.succMany? i r.lower).isSome = true
source
theorem Std.Rco.isSome_succMany?_of_lt_size_toArray {α : Type u} {r : Rco α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] {i : Nat} (h : i < r.toArray.size) :
(PRange.succMany? i r.lower).isSome = true
source
theorem Std.Rco.getElem_toList_eq {α : Type u} {r : Rco α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] {i : Nat} {h : i < r.toList.length} :
r.toList[i] = (PRange.succMany? i r.lower).get ⋯
source
theorem Std.Rco.getElem_toArray_eq {α : Type u} {r : Rco α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] {i : Nat} {h : i < r.toArray.size} :
r.toArray[i] = (PRange.succMany? i r.lower).get ⋯
source
theorem Std.Rco.eq_succMany?_of_toList_eq_append_cons {α : Type u} {r : Rco α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] {pref suff : List α} {cur : α} (h : r.toList = pref ++ cur :: suff) :
cur = (PRange.succMany? pref.length r.lower).get ⋯
source
theorem Std.Rco.eq_succMany?_of_toArray_eq_append_append {α : Type u} {r : Rco α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] {pref suff : Array α} {cur : α} (h : r.toArray = pref ++ #[cur] ++ suff) :
cur = (PRange.succMany? pref.size r.lower).get ⋯
source
theorem Std.Roo.length_toList {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [Rxo.HasSize α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [Rxo.LawfulHasSize α] :
r.toList.length = r.size
source
theorem Std.Roo.size_toArray {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [Rxo.HasSize α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [Rxo.LawfulHasSize α] :
r.toArray.size = r.size
source
theorem Std.Roo.getElem?_toList_eq {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] {i : Nat} :
r.toList[i]? = Option.filter (fun (x : α) => decide (x < r.upper)) (PRange.succMany? (i + 1) r.lower)
source
theorem Std.Roo.getElem?_toArray_eq {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] {i : Nat} :
r.toArray[i]? = Option.filter (fun (x : α) => decide (x < r.upper)) (PRange.succMany? (i + 1) r.lower)
source
theorem Std.Roo.isSome_succMany?_of_lt_length_toList {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] {i : Nat} (h : i < r.toList.length) :
(PRange.succMany? (i + 1) r.lower).isSome = true
source
theorem Std.Roo.isSome_succMany?_of_lt_size_toArray {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] {i : Nat} (h : i < r.toArray.size) :
(PRange.succMany? (i + 1) r.lower).isSome = true
source
theorem Std.Roo.getElem_toList_eq {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] {i : Nat} {h : i < r.toList.length} :
r.toList[i] = (PRange.succMany? (i + 1) r.lower).get ⋯
source
theorem Std.Roo.getElem_toArray_eq {α : Type u} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] {r : Roo α} {i : Nat} {h : i < r.toArray.size} :
r.toArray[i] = (PRange.succMany? (i + 1) r.lower).get ⋯
source
theorem Std.Roo.eq_succMany?_of_toList_eq_append_cons {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] {pref suff : List α} {cur : α} (h : r.toList = pref ++ cur :: suff) :
cur = (PRange.succMany? (pref.length + 1) r.lower).get ⋯
source
theorem Std.Roo.eq_succMany?_of_toArray_eq_append_append {α : Type u} {r : Roo α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] {pref suff : Array α} {cur : α} (h : r.toArray = pref ++ #[cur] ++ suff) :
cur = (PRange.succMany? (pref.size + 1) r.lower).get ⋯
source
theorem Std.Rio.length_toList {α : Type u} {r : Rio α} [PRange.Least? α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [Rxo.HasSize α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [Rxo.LawfulHasSize α] :
r.toList.length = r.size
source
theorem Std.Rio.size_toArray {α : Type u} {r : Rio α} [PRange.Least? α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [Rxo.HasSize α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxo.IsAlwaysFinite α] [Rxo.LawfulHasSize α] :
r.toArray.size = r.size
source
theorem Std.Rio.getElem?_toList_eq {α : Type u} {r : Rio α} [PRange.Least? α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] {i : Nat} :
r.toList[i]? = Option.filter (fun (x : α) => decide (x < r.upper)) (PRange.succMany? i PRange.UpwardEnumerable.least)
source
theorem Std.Rio.getElem?_toArray_eq {α : Type u} {r : Rio α} [PRange.Least? α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] {i : Nat} :
r.toArray[i]? = Option.filter (fun (x : α) => decide (x < r.upper)) (PRange.succMany? i PRange.UpwardEnumerable.least)
source
theorem Std.Rio.isSome_succMany?_of_lt_length_toList {α : Type u} {r : Rio α} [PRange.Least? α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] {i : Nat} (h : i < r.toList.length) :
(PRange.succMany? i PRange.UpwardEnumerable.least).isSome = true
source
theorem Std.Rio.isSome_succMany?_of_lt_size_toArray {α : Type u} {r : Rio α} [PRange.Least? α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] {i : Nat} (h : i < r.toArray.size) :
(PRange.succMany? i PRange.UpwardEnumerable.least).isSome = true
source
theorem Std.Rio.getElem_toList_eq {α : Type u} {r : Rio α} [PRange.Least? α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] {i : Nat} {h : i < r.toList.length} :
r.toList[i] = (PRange.succMany? i PRange.UpwardEnumerable.least).get ⋯
source
theorem Std.Rio.getElem_toArray_eq {α : Type u} [PRange.Least? α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] {r : Rio α} {i : Nat} {h : i < r.toArray.size} :
r.toArray[i] = (PRange.succMany? i PRange.UpwardEnumerable.least).get ⋯
source
theorem Std.Rio.eq_succMany?_of_toList_eq_append_cons {α : Type u} {r : Rio α} [PRange.Least? α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] {pref suff : List α} {cur : α} (h : r.toList = pref ++ cur :: suff) :
cur = (PRange.succMany? pref.length PRange.UpwardEnumerable.least).get ⋯
source
theorem Std.Rio.eq_succMany?_of_toArray_eq_append_append {α : Type u} {r : Rio α} [PRange.Least? α] [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxo.IsAlwaysFinite α] {pref suff : Array α} {cur : α} (h : r.toArray = pref ++ #[cur] ++ suff) :
cur = (PRange.succMany? pref.size PRange.UpwardEnumerable.least).get ⋯
source
theorem Std.Rci.length_toList {α : Type u} {r : Rci α} [PRange.UpwardEnumerable α] [Rxi.HasSize α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [Rxi.LawfulHasSize α] :
r.toList.length = r.size
source
theorem Std.Rci.size_toArray {α : Type u} {r : Rci α} [PRange.UpwardEnumerable α] [Rxi.HasSize α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [Rxi.LawfulHasSize α] :
r.toArray.size = r.size
source
theorem Std.Rci.getElem?_toList_eq {α : Type u} [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] {r : Rci α} {i : Nat} :
r.toList[i]? = PRange.succMany? i r.lower
source
theorem Std.Rci.getElem?_toArray_eq {α : Type u} {r : Rci α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] {i : Nat} :
r.toArray[i]? = PRange.succMany? i r.lower
source
theorem Std.Rci.isSome_succMany?_of_lt_length_toList {α : Type u} {r : Rci α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] {i : Nat} (h : i < r.toList.length) :
(PRange.succMany? i r.lower).isSome = true
source
theorem Std.Rci.isSome_succMany?_of_lt_size_toArray {α : Type u} {r : Rci α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] {i : Nat} (h : i < r.toArray.size) :
(PRange.succMany? i r.lower).isSome = true
source
theorem Std.Rci.getElem_toList_eq {α : Type u} {r : Rci α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] {i : Nat} {h : i < r.toList.length} :
r.toList[i] = (PRange.succMany? i r.lower).get ⋯
source
theorem Std.Rci.getElem_toArray_eq {α : Type u} {r : Rci α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] {i : Nat} {h : i < r.toArray.size} :
r.toArray[i] = (PRange.succMany? i r.lower).get ⋯
source
theorem Std.Rci.eq_succMany?_of_toList_eq_append_cons {α : Type u} {r : Rci α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] {pref suff : List α} {cur : α} (h : r.toList = pref ++ cur :: suff) :
cur = (PRange.succMany? pref.length r.lower).get ⋯
source
theorem Std.Rci.eq_succMany?_of_toArray_eq_append_append {α : Type u} {r : Rci α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] {pref suff : Array α} {cur : α} (h : r.toArray = pref ++ #[cur] ++ suff) :
cur = (PRange.succMany? pref.size r.lower).get ⋯
source
theorem Std.Roi.length_toList {α : Type u} {r : Roi α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [Rxi.HasSize α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] [Rxi.LawfulHasSize α] :
r.toList.length = r.size
source
theorem Std.Roi.size_toArray {α : Type u} {r : Roi α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [Rxi.HasSize α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] [Rxi.LawfulHasSize α] :
r.toArray.size = r.size
source
theorem Std.Roi.getElem?_toList_eq {α : Type u} {r : Roi α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] {i : Nat} :
r.toList[i]? = PRange.succMany? (i + 1) r.lower
source
theorem Std.Roi.getElem?_toArray_eq {α : Type u} {r : Roi α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] {i : Nat} :
r.toArray[i]? = PRange.succMany? (i + 1) r.lower
source
theorem Std.Roi.isSome_succMany?_of_lt_length_toList {α : Type u} {r : Roi α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] {i : Nat} (h : i < r.toList.length) :
(PRange.succMany? (i + 1) r.lower).isSome = true
source
theorem Std.Roi.isSome_succMany?_of_lt_size_toArray {α : Type u} {r : Roi α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] {i : Nat} (h : i < r.toArray.size) :
(PRange.succMany? (i + 1) r.lower).isSome = true
source
theorem Std.Roi.getElem_toList_eq {α : Type u} {r : Roi α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] {i : Nat} {h : i < r.toList.length} :
r.toList[i] = (PRange.succMany? (i + 1) r.lower).get ⋯
source
theorem Std.Roi.getElem_toArray_eq {α : Type u} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] {r : Roi α} {i : Nat} {h : i < r.toArray.size} :
r.toArray[i] = (PRange.succMany? (i + 1) r.lower).get ⋯
source
theorem Std.Roi.eq_succMany?_of_toList_eq_append_cons {α : Type u} {r : Roi α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] {pref suff : List α} {cur : α} (h : r.toList = pref ++ cur :: suff) :
cur = (PRange.succMany? (pref.length + 1) r.lower).get ⋯
source
theorem Std.Roi.eq_succMany?_of_toArray_eq_append_append {α : Type u} {r : Roi α} [LT α] [DecidableLT α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] [Rxi.IsAlwaysFinite α] {pref suff : Array α} {cur : α} (h : r.toArray = pref ++ #[cur] ++ suff) :
cur = (PRange.succMany? (pref.size + 1) r.lower).get ⋯
source
theorem Std.Rii.length_toList {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [Rxi.HasSize α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [Rxi.LawfulHasSize α] :
r.toList.length = r.size
source
theorem Std.Rii.size_toArray {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [Rxi.HasSize α] [PRange.LawfulUpwardEnumerable α] [Rxi.IsAlwaysFinite α] [Rxi.LawfulHasSize α] :
r.toArray.size = r.size
source
theorem Std.Rii.getElem?_toList_eq {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] {i : Nat} :
r.toList[i]? = PRange.least?.bind (PRange.succMany? i)
source
theorem Std.Rii.getElem?_toArray_eq {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] {i : Nat} :
r.toArray[i]? = PRange.least?.bind (PRange.succMany? i)
source
theorem Std.Rii.isSome_succMany?_of_lt_length_toList {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] {i : Nat} (h : i < r.toList.length) :
(PRange.least?.bind (PRange.succMany? i)).isSome = true
source
theorem Std.Rii.isSome_succMany?_of_lt_size_toArray {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] {i : Nat} (h : i < r.toArray.size) :
(PRange.least?.bind (PRange.succMany? i)).isSome = true
source
theorem Std.Rii.getElem_toList_eq {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] {i : Nat} {h : i < r.toList.length} :
r.toList[i] = (PRange.least?.bind (PRange.succMany? i)).get ⋯
source
theorem Std.Rii.getElem_toArray_eq {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] {i : Nat} {h : i < r.toArray.size} :
r.toArray[i] = (PRange.least?.bind (PRange.succMany? i)).get ⋯
source
theorem Std.Rii.eq_succMany?_of_toList_eq_append_cons {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] {pref suff : List α} {cur : α} (h : r.toList = pref ++ cur :: suff) :
cur = (PRange.least?.bind (PRange.succMany? pref.length)).get ⋯
source
theorem Std.Rii.eq_succMany?_of_toArray_eq_append_append {α : Type u} {r : Rii α} [PRange.Least? α] [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLeast? α] [Rxi.IsAlwaysFinite α] {pref suff : Array α} {cur : α} (h : r.toArray = pref ++ #[cur] ++ suff) :
cur = (PRange.least?.bind (PRange.succMany? pref.size)).get ⋯