Documentation

Std.Data.Iterators.Lemmas.Combinators.Monadic.DropWhile

theorem Std.Iterators.IterM.Intermediate.dropWhileM_eq_dropWhileWithPostcondition {α : Type u_1} {m : Type u_1 → Type u_2} {β : Type u_1} [Monad m] [Iterator α m β] {it : IterM m β} {P : β → m (ULift Bool)} {dropping : Bool} :
theorem Std.Iterators.IterM.Intermediate.dropWhile_eq_dropWhileM {dropping : Bool} {α : Type u_1} {m : Type u_1 → Type u_2} {β : Type u_1} [Monad m] [Iterator α m β] {it : IterM m β} {P : β → Bool} :
dropWhile P dropping it = dropWhileM (pure ∘ ULift.up ∘ P) dropping it
theorem Std.Iterators.IterM.dropWhileM_eq_intermediateDropWhileM {α : Type u_1} {m : Type u_1 → Type u_2} {β : Type u_1} [Monad m] [Iterator α m β] {it : IterM m β} {P : β → m (ULift Bool)} :
theorem Std.Iterators.IterM.dropWhile_eq_intermediateDropWhile {α : Type u_1} {m : Type u_1 → Type u_2} {β : Type u_1} [Monad m] [Iterator α m β] {it : IterM m β} {P : β → Bool} :
theorem Std.Iterators.IterM.step_intermediateDropWhileWithPostcondition {α : Type u_1} {m : Type u_1 → Type u_2} {β : Type u_1} [Monad m] [Iterator α m β] {it : IterM m β} {P : β → PostconditionT m (ULift Bool)} {dropping : Bool} :
theorem Std.Iterators.IterM.step_dropWhileWithPostcondition {α : Type u_1} {m : Type u_1 → Type u_2} {β : Type u_1} [Monad m] [Iterator α m β] {it : IterM m β} {P : β → PostconditionT m (ULift Bool)} :
theorem Std.Iterators.IterM.step_intermediateDropWhileM {α : Type u_1} {m : Type u_1 → Type u_2} {β : Type u_1} [Monad m] [LawfulMonad m] [Iterator α m β] {it : IterM m β} {P : β → m (ULift Bool)} {dropping : Bool} :
(Intermediate.dropWhileM P dropping it).step = do let __do_lift ← it.step match __do_lift.inflate with | ⟨IterStep.yield it' out, h⟩ => if h' : dropping = true then do let __do_lift ← P out match __do_lift with | { down := true } => pure (Shrink.deflate (PlausibleIterStep.skip (Intermediate.dropWhileM P true it') ⋯)) | { down := false } => pure (Shrink.deflate (PlausibleIterStep.yield (Intermediate.dropWhileM P false it') out ⋯)) else pure (Shrink.deflate (PlausibleIterStep.yield (Intermediate.dropWhileM P false it') out ⋯)) | ⟨IterStep.skip it', h⟩ => pure (Shrink.deflate (PlausibleIterStep.skip (Intermediate.dropWhileM P dropping it') ⋯)) | ⟨IterStep.done, h⟩ => pure (Shrink.deflate (PlausibleIterStep.done ⋯))
theorem Std.Iterators.IterM.step_dropWhileM {α : Type u_1} {m : Type u_1 → Type u_2} {β : Type u_1} [Monad m] [LawfulMonad m] [Iterator α m β] {it : IterM m β} {P : β → m (ULift Bool)} :
(dropWhileM P it).step = do let __do_lift ← it.step match __do_lift.inflate with | ⟨IterStep.yield it' out, h⟩ => do let __do_lift ← P out match __do_lift with | { down := true } => pure (Shrink.deflate (PlausibleIterStep.skip (Intermediate.dropWhileM P true it') ⋯)) | { down := false } => pure (Shrink.deflate (PlausibleIterStep.yield (Intermediate.dropWhileM P false it') out ⋯)) | ⟨IterStep.skip it', h⟩ => pure (Shrink.deflate (PlausibleIterStep.skip (Intermediate.dropWhileM P true it') ⋯)) | ⟨IterStep.done, h⟩ => pure (Shrink.deflate (PlausibleIterStep.done ⋯))
theorem Std.Iterators.IterM.step_intermediateDropWhile {α : Type u_1} {m : Type u_1 → Type u_2} {β : Type u_1} [Monad m] [LawfulMonad m] [Iterator α m β] {it : IterM m β} {P : β → Bool} {dropping : Bool} :
theorem Std.Iterators.IterM.step_dropWhile {α : Type u_1} {m : Type u_1 → Type u_2} {β : Type u_1} [Monad m] [LawfulMonad m] [Iterator α m β] {it : IterM m β} {P : β → Bool} :