The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V33. Data structures and computation

Mathlib.Data.Seq.Basic

153 declarations. Mathlib docs · Source

theorem Stream'.Seq.join.match_3.congr_eq_2 E1 #

∀ {α : Type u_1} (motive : Option (Stream'.Seq1 (Stream'.Seq1 α)) → Sort u_2)
  (x : Option (Stream'.Seq1 (Stream'.Seq1 α))) (h_1 : Unit → motive none)
  (h_2 : (a : α) → (s : Stream'.Seq α) → (S' : Stream'.Seq (Stream'.Seq1 α)) → motive (some ((a, s), S'))) (a : α)
  (s : Stream'.Seq α) (S' : Stream'.Seq (Stream'.Seq1 α)),
  x = some ((a, s), S') →
    (match x with
      | none => h_1 ()
      | some ((a, s), S') => h_2 a s S') ≍
      h_2 a s S'

theorem Stream'.Seq.toMLList.match_1.congr_eq_1 E1 #

∀ {α : Type u_1} (motive : Option (Stream'.Seq1 α) → Sort u_2) (x : Option (Stream'.Seq1 α)) (h_1 : Unit → motive none)
  (h_2 : (a : α) → (s' : Stream'.Seq α) → motive (some (a, s'))),
  x = none →
    (match x with
      | none => h_1 ()
      | some (a, s') => h_2 a s') ≍
      h_1 ()

theorem Stream'.Seq.length.congr_simp E1 #

∀ {α : Type u} (s s_1 : Stream'.Seq α) (e_s : s = s_1) (h : s.Terminates), s.length h = s_1.length ⋯

theorem Stream'.Seq.toMLList.match_1.congr_eq_2 E1 #

∀ {α : Type u_1} (motive : Option (Stream'.Seq1 α) → Sort u_2) (x : Option (Stream'.Seq1 α)) (h_1 : Unit → motive none)
  (h_2 : (a : α) → (s' : Stream'.Seq α) → motive (some (a, s'))) (a : α) (s' : Stream'.Seq α),
  x = some (a, s') →
    (match x with
      | none => h_1 ()
      | some (a, s') => h_2 a s') ≍
      h_2 a s'

theorem Stream'.Seq.take.match_1.congr_eq_1 E1 #

∀ {α : Type u_1} (motive : ℕ → Stream'.Seq α → Sort u_2) (x : ℕ) (x_1 : Stream'.Seq α)
  (h_1 : (x : Stream'.Seq α) → motive 0 x) (h_2 : (n : ℕ) → (s : Stream'.Seq α) → motive n.succ s)
  (x_2 : Stream'.Seq α),
  x = 0 →
    x_1 = x_2 →
      (match x, x_1 with
        | 0, x => h_1 x
        | n.succ, s => h_2 n s) ≍
        h_1 x_2

theorem Stream'.Seq.fold.match_1.congr_eq_1 E1 #

∀ {α : Type u_2} {β : Type u_1} (motive : β × Stream'.Seq α → Sort u_3) (x : β × Stream'.Seq α)
  (h_1 : (acc : β) → (x : Stream'.Seq α) → motive (acc, x)) (acc : β) (x_1 : Stream'.Seq α),
  x = (acc, x_1) →
    (match x with
      | (acc, x) => h_1 acc x) ≍
      h_1 acc x_1

theorem Stream'.Seq.drop.match_1.congr_eq_1 E1 #

∀ (motive : ℕ → Sort u_1) (x : ℕ) (h_1 : Unit → motive 0) (h_2 : (n : ℕ) → motive n.succ),
  x = 0 →
    (match x with
      | 0 => h_1 ()
      | n.succ => h_2 n) ≍
      h_1 ()

theorem Stream'.Seq.join.match_1.congr_eq_2 E1 #

∀ {α : Type u_1} (motive : Option (Stream'.Seq1 α) → Sort u_2) (x : Option (Stream'.Seq1 α)) (h_1 : Unit → motive none)
  (h_2 : (s' : Stream'.Seq1 α) → motive (some s')) (s' : Stream'.Seq1 α),
  x = some s' →
    (match x with
      | none => h_1 ()
      | some s' => h_2 s') ≍
      h_2 s'

theorem Stream'.Seq.join.match_1.congr_eq_1 E1 #

∀ {α : Type u_1} (motive : Option (Stream'.Seq1 α) → Sort u_2) (x : Option (Stream'.Seq1 α)) (h_1 : Unit → motive none)
  (h_2 : (s' : Stream'.Seq1 α) → motive (some s')),
  x = none →
    (match x with
      | none => h_1 ()
      | some s' => h_2 s') ≍
      h_1 ()

theorem Stream'.Seq.toList.congr_simp E1 #

∀ {α : Type u} (s s_1 : Stream'.Seq α) (e_s : s = s_1) (h : s.Terminates), s.toList h = s_1.toList ⋯

theorem Stream'.Seq.take.match_1.congr_eq_2 E1 #

∀ {α : Type u_1} (motive : ℕ → Stream'.Seq α → Sort u_2) (x : ℕ) (x_1 : Stream'.Seq α)
  (h_1 : (x : Stream'.Seq α) → motive 0 x) (h_2 : (n : ℕ) → (s : Stream'.Seq α) → motive n.succ s) (n : ℕ)
  (s : Stream'.Seq α),
  x = n.succ →
    x_1 = s →
      (match x, x_1 with
        | 0, x => h_1 x
        | n.succ, s => h_2 n s) ≍
        h_2 n s

theorem Stream'.Seq.drop.match_1.congr_eq_2 E1 #

∀ (motive : ℕ → Sort u_1) (x : ℕ) (h_1 : Unit → motive 0) (h_2 : (n : ℕ) → motive n.succ) (n : ℕ),
  x = n.succ →
    (match x with
      | 0 => h_1 ()
      | n.succ => h_2 n) ≍
      h_2 n

theorem Stream'.Seq1.toSeq.match_1.congr_eq_1 E1 #

∀ {α : Type u_1} (motive : Stream'.Seq1 α → Sort u_2) (x : Stream'.Seq1 α)
  (h_1 : (a : α) → (s : Stream'.Seq α) → motive (a, s)) (a : α) (s : Stream'.Seq α),
  x = (a, s) →
    (match x with
      | (a, s) => h_1 a s) ≍
      h_1 a s

theorem Stream'.Seq.join.match_3.congr_eq_1 E1 #

∀ {α : Type u_1} (motive : Option (Stream'.Seq1 (Stream'.Seq1 α)) → Sort u_2)
  (x : Option (Stream'.Seq1 (Stream'.Seq1 α))) (h_1 : Unit → motive none)
  (h_2 : (a : α) → (s : Stream'.Seq α) → (S' : Stream'.Seq (Stream'.Seq1 α)) → motive (some ((a, s), S'))),
  x = none →
    (match x with
      | none => h_1 ()
      | some ((a, s), S') => h_2 a s S') ≍
      h_1 ()

theorem Stream'.Seq.length'_of_terminates E1 #

∀ {α : Type u} {s : Stream'.Seq α} (h : s.Terminates), s.length' = ↑(s.length h)

theorem Stream'.Seq.length'_of_not_terminates E1 #

∀ {α : Type u} {s : Stream'.Seq α}, ¬s.Terminates → s.length' = ⊤

theorem Stream'.Seq.length_nil E0 #

∀ {α : Type u}, Stream'.Seq.nil.length ⋯ = 0

theorem Stream'.Seq.length'_nil E0 #

∀ {α : Type u}, Stream'.Seq.nil.length' = 0

theorem Stream'.Seq.length_cons E1 #

∀ {α : Type u} {x : α} {s : Stream'.Seq α} (h : s.Terminates), (Stream'.Seq.cons x s).length ⋯ = s.length h + 1

theorem Stream'.Seq.length'_cons E0 #

∀ {α : Type u} (x : α) (s : Stream'.Seq α), (Stream'.Seq.cons x s).length' = s.length' + 1

theorem Stream'.Seq.length_eq_zero E0 #

∀ {α : Type u} {s : Stream'.Seq α} {h : s.Terminates}, s.length h = 0 ↔ s = Stream'.Seq.nil

theorem Stream'.Seq.length'_eq_zero_iff_nil E0 #

∀ {α : Type u} (s : Stream'.Seq α), s.length' = 0 ↔ s = Stream'.Seq.nil

theorem Stream'.Seq.length'_ne_zero_iff_cons E1 #

∀ {α : Type u} (s : Stream'.Seq α), s.length' ≠ 0 ↔ ∃ x s', s = Stream'.Seq.cons x s'

theorem Stream'.Seq.length_le_iff' E1 #

∀ {α : Type u} {s : Stream'.Seq α} {n : ℕ}, (∃ (h : s.Terminates), s.length h ≤ n) ↔ s.TerminatedAt n

The statement of length_le_iff' does not assume that the sequence terminates. For a simpler statement of the theorem where the sequence is known to terminate see length_le_iff.

theorem Stream'.Seq.length_le_iff E0 #

∀ {α : Type u} {s : Stream'.Seq α} {n : ℕ} {h : s.Terminates}, s.length h ≤ n ↔ s.TerminatedAt n

The statement of length_le_iff assumes that the sequence terminates. For a statement of the where the sequence is not known to terminate see length_le_iff'.

theorem Stream'.Seq.length'_le_iff E0 #

∀ {α : Type u} {s : Stream'.Seq α} {n : ℕ}, s.length' ≤ ↑n ↔ s.TerminatedAt n

theorem Stream'.Seq.lt_length_iff' E1 #

∀ {α : Type u} {s : Stream'.Seq α} {n : ℕ}, (∀ (h : s.Terminates), n < s.length h) ↔ ∃ a, a ∈ s.get? n

The statement of lt_length_iff' does not assume that the sequence terminates. For a simpler statement of the theorem where the sequence is known to terminate see lt_length_iff.

theorem Stream'.Seq.lt_length_iff E0 #

∀ {α : Type u} {s : Stream'.Seq α} {n : ℕ} {h : s.Terminates}, n < s.length h ↔ ∃ a, a ∈ s.get? n

The statement of length_le_iff assumes that the sequence terminates. For a statement of the where the sequence is not known to terminate see length_le_iff'.

theorem Stream'.Seq.lt_length'_iff E0 #

∀ {α : Type u} {s : Stream'.Seq α} {n : ℕ}, ↑n < s.length' ↔ ∃ a, a ∈ s.get? n

theorem Stream'.Seq.ofStream_cons E0 #

∀ {α : Type u} (a : α) (s : Stream' α), ↑(Stream'.cons a s) = Stream'.Seq.cons a ↑s

theorem Stream'.Seq.terminatedAt_ofList E1 #

∀ {α : Type u} (l : List α), (↑l).TerminatedAt l.length

theorem Stream'.Seq.terminates_ofList E1 #

∀ {α : Type u} (l : List α), (↑l).Terminates

theorem Stream'.Seq.take_nil E0 #

∀ {α : Type u} {n : ℕ}, Stream'.Seq.take n Stream'.Seq.nil = []

theorem Stream'.Seq.take_zero E0 #

∀ {α : Type u} {s : Stream'.Seq α}, Stream'.Seq.take 0 s = []

theorem Stream'.Seq.take_succ_cons E0 #

∀ {α : Type u} {n : ℕ} {x : α} {s : Stream'.Seq α},
  Stream'.Seq.take (n + 1) (Stream'.Seq.cons x s) = x :: Stream'.Seq.take n s

theorem Stream'.Seq.getElem?_take E0 #

∀ {α : Type u} (n k : ℕ) (s : Stream'.Seq α), (Stream'.Seq.take k s)[n]? = if n < k then s.get? n else none

theorem Stream'.Seq.get?_mem_take E1 #

∀ {α : Type u} {s : Stream'.Seq α} {m n : ℕ}, m < n → ∀ {x : α}, s.get? m = some x → x ∈ Stream'.Seq.take n s

theorem Stream'.Seq.length_take_le E1 #

∀ {α : Type u} {s : Stream'.Seq α} {n : ℕ}, (Stream'.Seq.take n s).length ≤ n

theorem Stream'.Seq.length_take_of_le_length E1 #

∀ {α : Type u} {s : Stream'.Seq α} {n : ℕ}, (∀ (h : s.Terminates), n ≤ s.length h) → (Stream'.Seq.take n s).length = n

theorem Stream'.Seq.length_toList E0 #

∀ {α : Type u} (s : Stream'.Seq α) (h : s.Terminates), (s.toList h).length = s.length h

theorem Stream'.Seq.getElem?_toList E0 #

∀ {α : Type u} (s : Stream'.Seq α) (h : s.Terminates) (n : ℕ), (s.toList h)[n]? = s.get? n

theorem Stream'.Seq.ofList_toList E0 #

∀ {α : Type u} (s : Stream'.Seq α) (h : s.Terminates), ↑(s.toList h) = s

theorem Stream'.Seq.toList_ofList E0 #

∀ {α : Type u} (l : List α), (↑l).toList ⋯ = l

theorem Stream'.Seq.toList_nil E0 #

∀ {α : Type u}, Stream'.Seq.nil.toList ⋯ = []

theorem Stream'.Seq.getLast?_toList E1 #

∀ {α : Type u} (s : Stream'.Seq α) (h : s.Terminates), (s.toList h).getLast? = s.get? (s.length h - 1)

theorem Stream'.Seq.cons_append E0 #

∀ {α : Type u} (a : α) (s t : Stream'.Seq α), (Stream'.Seq.cons a s).append t = Stream'.Seq.cons a (s.append t)

theorem Stream'.Seq.nil_append E0 #

∀ {α : Type u} (s : Stream'.Seq α), Stream'.Seq.nil.append s = s

theorem Stream'.Seq.append_nil E0 #

∀ {α : Type u} (s : Stream'.Seq α), s.append Stream'.Seq.nil = s

theorem Stream'.Seq.append_assoc E0 #

∀ {α : Type u} (s t u : Stream'.Seq α), (s.append t).append u = s.append (t.append u)

theorem Stream'.Seq.of_mem_append E1 #

∀ {α : Type u} {s₁ s₂ : Stream'.Seq α} {a : α}, a ∈ s₁.append s₂ → a ∈ s₁ ∨ a ∈ s₂

theorem Stream'.Seq.mem_append_left E0 #

∀ {α : Type u} {s₁ s₂ : Stream'.Seq α} {a : α}, a ∈ s₁ → a ∈ s₁.append s₂

theorem Stream'.Seq.ofList_append E0 #

∀ {α : Type u} (l l' : List α), ↑(l ++ l') = (↑l).append ↑l'

theorem Stream'.Seq.ofStream_append E0 #

∀ {α : Type u} (l : List α) (s : Stream' α), ↑(l ++ₛ s) = (↑l).append ↑s

theorem Stream'.Seq.map_get? E0 #

∀ {α : Type u} {β : Type v} (f : α → β) (s : Stream'.Seq α) (n : ℕ),
  (Stream'.Seq.map f s).get? n = Option.map f (s.get? n)

theorem Stream'.Seq.map_nil E0 #

∀ {α : Type u} {β : Type v} (f : α → β), Stream'.Seq.map f Stream'.Seq.nil = Stream'.Seq.nil

theorem Stream'.Seq.map_cons E0 #

∀ {α : Type u} {β : Type v} (f : α → β) (a : α) (s : Stream'.Seq α),
  Stream'.Seq.map f (Stream'.Seq.cons a s) = Stream'.Seq.cons (f a) (Stream'.Seq.map f s)

theorem Stream'.Seq.map_id E0 #

∀ {α : Type u} (s : Stream'.Seq α), Stream'.Seq.map id s = s

theorem Stream'.Seq.map_tail E0 #

∀ {α : Type u} {β : Type v} (f : α → β) (s : Stream'.Seq α), Stream'.Seq.map f s.tail = (Stream'.Seq.map f s).tail

theorem Stream'.Seq.map_comp E0 #

∀ {α : Type u} {β : Type v} {γ : Type w} (f : α → β) (g : β → γ) (s : Stream'.Seq α),
  Stream'.Seq.map (g ∘ f) s = Stream'.Seq.map g (Stream'.Seq.map f s)

theorem Stream'.Seq.terminatedAt_map_iff E0 #

∀ {α : Type u} {β : Type v} {f : α → β} {s : Stream'.Seq α} {n : ℕ},
  (Stream'.Seq.map f s).TerminatedAt n ↔ s.TerminatedAt n

theorem Stream'.Seq.terminates_map_iff E0 #

∀ {α : Type u} {β : Type v} {f : α → β} {s : Stream'.Seq α}, (Stream'.Seq.map f s).Terminates ↔ s.Terminates

theorem Stream'.Seq.length_map E0 #

∀ {α : Type u} {β : Type v} {s : Stream'.Seq α} {f : α → β} (h : (Stream'.Seq.map f s).Terminates),
  (Stream'.Seq.map f s).length h = s.length ⋯

theorem Stream'.Seq.length'_map E0 #

∀ {α : Type u} {β : Type v} {s : Stream'.Seq α} {f : α → β}, (Stream'.Seq.map f s).length' = s.length'

theorem Stream'.Seq.mem_map E0 #

∀ {α : Type u} {β : Type v} (f : α → β) {a : α} {s : Stream'.Seq α}, a ∈ s → f a ∈ Stream'.Seq.map f s

theorem Stream'.Seq.exists_of_mem_map E1 #

∀ {α : Type u} {β : Type v} {f : α → β} {b : β} {s : Stream'.Seq α}, b ∈ Stream'.Seq.map f s → ∃ a ∈ s, f a = b

theorem Stream'.Seq.map_append E0 #

∀ {α : Type u} {β : Type v} (f : α → β) (s t : Stream'.Seq α),
  Stream'.Seq.map f (s.append t) = (Stream'.Seq.map f s).append (Stream'.Seq.map f t)

theorem Stream'.Seq.join_nil E0 #

∀ {α : Type u}, Stream'.Seq.nil.join = Stream'.Seq.nil

theorem Stream'.Seq.join_cons_nil E1 #

∀ {α : Type u} (a : α) (S : Stream'.Seq (Stream'.Seq1 α)),
  (Stream'.Seq.cons (a, Stream'.Seq.nil) S).join = Stream'.Seq.cons a S.join

theorem Stream'.Seq.join_cons_cons E1 #

∀ {α : Type u} (a b : α) (s : Stream'.Seq α) (S : Stream'.Seq (Stream'.Seq1 α)),
  (Stream'.Seq.cons (a, Stream'.Seq.cons b s) S).join = Stream'.Seq.cons a (Stream'.Seq.cons (b, s) S).join

theorem Stream'.Seq.join_cons E0 #

∀ {α : Type u} (a : α) (s : Stream'.Seq α) (S : Stream'.Seq (Stream'.Seq1 α)),
  (Stream'.Seq.cons (a, s) S).join = Stream'.Seq.cons a (s.append S.join)

theorem Stream'.Seq.join_append E0 #

∀ {α : Type u} (S T : Stream'.Seq (Stream'.Seq1 α)), (S.append T).join = S.join.append T.join

theorem Stream'.Seq.drop_get? E0 #

∀ {α : Type u} {n m : ℕ} {s : Stream'.Seq α}, (s.drop n).get? m = s.get? (n + m)

theorem Stream'.Seq.dropn_add E1 #

∀ {α : Type u} (s : Stream'.Seq α) (m n : ℕ), s.drop (m + n) = (s.drop m).drop n

theorem Stream'.Seq.dropn_tail E1 #

∀ {α : Type u} (s : Stream'.Seq α) (n : ℕ), s.tail.drop n = s.drop (n + 1)

theorem Stream'.Seq.head_dropn E0 #

∀ {α : Type u} (s : Stream'.Seq α) (n : ℕ), (s.drop n).head = s.get? n

theorem Stream'.Seq.drop_zero E0 #

∀ {α : Type u} {s : Stream'.Seq α}, s.drop 0 = s

theorem Stream'.Seq.drop_succ_cons E0 #

∀ {α : Type u} {x : α} {s : Stream'.Seq α} {n : ℕ}, (Stream'.Seq.cons x s).drop (n + 1) = s.drop n

theorem Stream'.Seq.drop_nil E0 #

∀ {α : Type u} {n : ℕ}, Stream'.Seq.nil.drop n = Stream'.Seq.nil

theorem Stream'.Seq.drop_length' E0 #

∀ {α : Type u} {n : ℕ} {s : Stream'.Seq α}, (s.drop n).length' = s.length' - ↑n

theorem Stream'.Seq.take_drop E1 #

∀ {α : Type u} {s : Stream'.Seq α} {n m : ℕ}, List.drop m (Stream'.Seq.take n s) = Stream'.Seq.take (n - m) (s.drop m)

theorem Stream'.Seq.get?_zipWith E0 #

∀ {α : Type u} {β : Type v} {γ : Type w} (f : α → β → γ) (s : Stream'.Seq α) (s' : Stream'.Seq β) (n : ℕ),
  (Stream'.Seq.zipWith f s s').get? n = Option.map₂ f (s.get? n) (s'.get? n)

theorem Stream'.Seq.get?_zip E0 #

∀ {α : Type u} {β : Type v} (s : Stream'.Seq α) (t : Stream'.Seq β) (n : ℕ),
  (s.zip t).get? n = Option.map₂ Prod.mk (s.get? n) (t.get? n)

theorem Stream'.Seq.nats_get? E0 #

∀ (n : ℕ), Stream'.Seq.nats.get? n = some n

theorem Stream'.Seq.get?_enum E0 #

∀ {α : Type u} (s : Stream'.Seq α) (n : ℕ), s.enum.get? n = Option.map (Prod.mk n) (s.get? n)

theorem Stream'.Seq.zipWith_nil_left E0 #

∀ {α : Type u} {β : Type v} {γ : Type w} {f : α → β → γ} {s : Stream'.Seq β},
  Stream'.Seq.zipWith f Stream'.Seq.nil s = Stream'.Seq.nil

theorem Stream'.Seq.zipWith_nil_right E0 #

∀ {α : Type u} {β : Type v} {γ : Type w} {f : α → β → γ} {s : Stream'.Seq α},
  Stream'.Seq.zipWith f s Stream'.Seq.nil = Stream'.Seq.nil

theorem Stream'.Seq.zipWith_cons_cons E0 #

∀ {α : Type u} {β : Type v} {γ : Type w} {f : α → β → γ} {x : α} {s : Stream'.Seq α} {x' : β} {s' : Stream'.Seq β},
  Stream'.Seq.zipWith f (Stream'.Seq.cons x s) (Stream'.Seq.cons x' s') =
    Stream'.Seq.cons (f x x') (Stream'.Seq.zipWith f s s')

theorem Stream'.Seq.zip_nil_left E0 #

∀ {α : Type u} {s : Stream'.Seq α}, Stream'.Seq.nil.zip s = Stream'.Seq.nil

theorem Stream'.Seq.zip_nil_right E0 #

∀ {α : Type u} {s : Stream'.Seq α}, s.zip Stream'.Seq.nil = Stream'.Seq.nil

theorem Stream'.Seq.zip_cons_cons E0 #

∀ {α : Type u} {s s' : Stream'.Seq α} {x x' : α},
  (Stream'.Seq.cons x s).zip (Stream'.Seq.cons x' s') = Stream'.Seq.cons (x, x') (s.zip s')

theorem Stream'.Seq.enum_nil E0 #

∀ {α : Type u}, Stream'.Seq.nil.enum = Stream'.Seq.nil

theorem Stream'.Seq.enum_cons E0 #

∀ {α : Type u} (s : Stream'.Seq α) (x : α),
  (Stream'.Seq.cons x s).enum = Stream'.Seq.cons (0, x) (Stream'.Seq.map (Prod.map Nat.succ id) s.enum)

theorem Stream'.Seq.zipWith_map E1 #

∀ {α : Type u} {β : Type v} {γ : Type w} {α' : Type u'} {β' : Type v'} (s₁ : Stream'.Seq α) (s₂ : Stream'.Seq β)
  (f₁ : α → α') (f₂ : β → β') (g : α' → β' → γ),
  Stream'.Seq.zipWith g (Stream'.Seq.map f₁ s₁) (Stream'.Seq.map f₂ s₂) =
    Stream'.Seq.zipWith (fun a b ↦ g (f₁ a) (f₂ b)) s₁ s₂

theorem Stream'.Seq.zipWith_map_left E1 #

∀ {α : Type u} {β : Type v} {γ : Type w} {α' : Type u'} (s₁ : Stream'.Seq α) (s₂ : Stream'.Seq β) (f : α → α')
  (g : α' → β → γ), Stream'.Seq.zipWith g (Stream'.Seq.map f s₁) s₂ = Stream'.Seq.zipWith (fun a b ↦ g (f a) b) s₁ s₂

theorem Stream'.Seq.zipWith_map_right E1 #

∀ {α : Type u} {β : Type v} {γ : Type w} {β' : Type v'} (s₁ : Stream'.Seq α) (s₂ : Stream'.Seq β) (f : β → β')
  (g : α → β' → γ), Stream'.Seq.zipWith g s₁ (Stream'.Seq.map f s₂) = Stream'.Seq.zipWith (fun a b ↦ g a (f b)) s₁ s₂

theorem Stream'.Seq.zip_map E1 #

∀ {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} (s₁ : Stream'.Seq α) (s₂ : Stream'.Seq β) (f₁ : α → α')
  (f₂ : β → β'), (Stream'.Seq.map f₁ s₁).zip (Stream'.Seq.map f₂ s₂) = Stream'.Seq.map (Prod.map f₁ f₂) (s₁.zip s₂)

theorem Stream'.Seq.zip_map_left E1 #

∀ {α : Type u} {β : Type v} {α' : Type u'} (s₁ : Stream'.Seq α) (s₂ : Stream'.Seq β) (f : α → α'),
  (Stream'.Seq.map f s₁).zip s₂ = Stream'.Seq.map (Prod.map f id) (s₁.zip s₂)

theorem Stream'.Seq.zip_map_right E1 #

∀ {α : Type u} {β : Type v} {β' : Type v'} (s₁ : Stream'.Seq α) (s₂ : Stream'.Seq β) (f : β → β'),
  s₁.zip (Stream'.Seq.map f s₂) = Stream'.Seq.map (Prod.map id f) (s₁.zip s₂)

theorem Stream'.Seq.fold_nil E0 #

∀ {α : Type u} {β : Type v} (init : β) (f : β → α → β),
  Stream'.Seq.nil.fold init f = Stream'.Seq.cons init Stream'.Seq.nil

theorem Stream'.Seq.fold_cons E0 #

∀ {α : Type u} {β : Type v} (init : β) (f : β → α → β) (x : α) (s : Stream'.Seq α),
  (Stream'.Seq.cons x s).fold init f = Stream'.Seq.cons init (s.fold (f init x) f)

theorem Stream'.Seq.fold_head E0 #

∀ {α : Type u} {β : Type v} (init : β) (f : β → α → β) (s : Stream'.Seq α), (s.fold init f).head = some init

theorem Stream'.Seq.get?_update E1 #

∀ {α : Type u} (f : α → α) (s : Stream'.Seq α) (n m : ℕ),
  (s.update n f).get? m = if m = n then Option.map f (s.get? m) else s.get? m

theorem Stream'.Seq.update_nil E0 #

∀ {α : Type u} (f : α → α) (n : ℕ), Stream'.Seq.nil.update n f = Stream'.Seq.nil

theorem Stream'.Seq.set_nil E0 #

∀ {α : Type u} (n : ℕ) (x : α), Stream'.Seq.nil.set n x = Stream'.Seq.nil

theorem Stream'.Seq.update_cons_zero E0 #

∀ {α : Type u} (hd : α) (tl : Stream'.Seq α) (f : α → α),
  (Stream'.Seq.cons hd tl).update 0 f = Stream'.Seq.cons (f hd) tl

theorem Stream'.Seq.set_cons_zero E0 #

∀ {α : Type u} (hd : α) (tl : Stream'.Seq α) (hd' : α), (Stream'.Seq.cons hd tl).set 0 hd' = Stream'.Seq.cons hd' tl

theorem Stream'.Seq.update_cons_succ E0 #

∀ {α : Type u} (hd : α) (tl : Stream'.Seq α) (f : α → α) (n : ℕ),
  (Stream'.Seq.cons hd tl).update (n + 1) f = Stream'.Seq.cons hd (tl.update n f)

theorem Stream'.Seq.set_cons_succ E0 #

∀ {α : Type u} (hd x : α) (tl : Stream'.Seq α) (n : ℕ),
  (Stream'.Seq.cons hd tl).set (n + 1) x = Stream'.Seq.cons hd (tl.set n x)

theorem Stream'.Seq.get?_set_of_not_terminatedAt E1 #

∀ {α : Type u} (x : α) {s : Stream'.Seq α} {n : ℕ}, ¬s.TerminatedAt n → (s.set n x).get? n = some x

theorem Stream'.Seq.get?_set_of_terminatedAt E1 #

∀ {α : Type u} (x : α) {s : Stream'.Seq α} {n : ℕ}, s.TerminatedAt n → (s.set n x).get? n = none

theorem Stream'.Seq.get?_set_of_ne E1 #

∀ {α : Type u} (x : α) (s : Stream'.Seq α) {m n : ℕ}, n ≠ m → (s.set m x).get? n = s.get? n

theorem Stream'.Seq.drop_set_of_lt E1 #

∀ {α : Type u} (x : α) (s : Stream'.Seq α) {m n : ℕ}, m < n → (s.set m x).drop n = s.drop n

theorem Stream'.Seq.all_cons E1 #

∀ {α : Type u} {p : α → Prop} {hd : α} {tl : Stream'.Seq α}, p hd → (∀ x ∈ tl, p x) → ∀ x ∈ Stream'.Seq.cons hd tl, p x

theorem Stream'.Seq.all_get E1 #

∀ {α : Type u} {p : α → Prop} {s : Stream'.Seq α}, (∀ x ∈ s, p x) → ∀ {n : ℕ} {x : α}, s.get? n = some x → p x

theorem Stream'.Seq.all_of_get E1 #

∀ {α : Type u} {p : α → Prop} {s : Stream'.Seq α}, (∀ (n : ℕ) (x : α), s.get? n = some x → p x) → ∀ x ∈ s, p x

theorem Stream'.Seq.all_coind_drop_motive E1 #

∀ {α : Type u} {s : Stream'.Seq α} (motive : Stream'.Seq α → Prop),
  motive s →
    (∀ (hd : α) (tl : Stream'.Seq α), motive (Stream'.Seq.cons hd tl) → motive tl) → ∀ (n : ℕ), motive (s.drop n)

theorem Stream'.Seq.all_coind E2 #

∀ {α : Type u} {s : Stream'.Seq α} {p : α → Prop} (motive : Stream'.Seq α → Prop),
  motive s → (∀ (hd : α) (tl : Stream'.Seq α), motive (Stream'.Seq.cons hd tl) → p hd ∧ motive tl) → ∀ x ∈ s, p x

Coinductive principle for All.

theorem Stream'.Seq.map_all_iff E0 #

∀ {α β : Type u} {f : α → β} {p : β → Prop} {s : Stream'.Seq α}, (∀ x ∈ Stream'.Seq.map f s, p x) ↔ ∀ x ∈ s, (p ∘ f) x

theorem Stream'.Seq.take_all E1 #

∀ {α : Type u} {s : Stream'.Seq α} {p : α → Prop}, (∀ x ∈ s, p x) → ∀ {n : ℕ} {x : α}, x ∈ Stream'.Seq.take n s → p x

theorem Stream'.Seq.set_all E1 #

∀ {α : Type u} {p : α → Prop} {s : Stream'.Seq α}, (∀ x ∈ s, p x) → ∀ {n : ℕ} {x : α}, p x → ∀ y ∈ s.set n x, p y

theorem Stream'.Seq.Pairwise.nil E0 #

∀ {α : Type u} {R : α → α → Prop}, Stream'.Seq.Pairwise R Stream'.Seq.nil

theorem Stream'.Seq.Pairwise.cons E1 #

∀ {α : Type u} {R : α → α → Prop} {hd : α} {tl : Stream'.Seq α},
  (∀ x ∈ tl, R hd x) → Stream'.Seq.Pairwise R tl → Stream'.Seq.Pairwise R (Stream'.Seq.cons hd tl)

theorem Stream'.Seq.Pairwise.cons_elim E1 #

∀ {α : Type u} {R : α → α → Prop} {hd : α} {tl : Stream'.Seq α},
  Stream'.Seq.Pairwise R (Stream'.Seq.cons hd tl) → (∀ x ∈ tl, R hd x) ∧ Stream'.Seq.Pairwise R tl

theorem Stream'.Seq.Pairwise_cons_nil E0 #

∀ {α : Type u} {R : α → α → Prop} {hd : α}, Stream'.Seq.Pairwise R (Stream'.Seq.cons hd Stream'.Seq.nil)

theorem Stream'.Seq.Pairwise_cons_cons_head E1 #

∀ {α : Type u} {R : α → α → Prop} {hd tl_hd : α} {tl_tl : Stream'.Seq α},
  Stream'.Seq.Pairwise R (Stream'.Seq.cons hd (Stream'.Seq.cons tl_hd tl_tl)) → R hd tl_hd

theorem Stream'.Seq.Pairwise.cons_cons_of_trans E1 #

∀ {α : Type u} {R : α → α → Prop} [IsTrans α R] {hd tl_hd : α} {tl_tl : Stream'.Seq α},
  R hd tl_hd →
    Stream'.Seq.Pairwise R (Stream'.Seq.cons tl_hd tl_tl) →
      Stream'.Seq.Pairwise R (Stream'.Seq.cons hd (Stream'.Seq.cons tl_hd tl_tl))

theorem Stream'.Seq.Pairwise.coind E2 #

∀ {α : Type u} {R : α → α → Prop} {s : Stream'.Seq α} (motive : Stream'.Seq α → Prop),
  motive s →
    (∀ (hd : α) (tl : Stream'.Seq α), motive (Stream'.Seq.cons hd tl) → (∀ x ∈ tl, R hd x) ∧ motive tl) →
      Stream'.Seq.Pairwise R s

Coinductive principle for Pairwise.

theorem Stream'.Seq.Pairwise.coind_trans E2 #

∀ {α : Type u} {R : α → α → Prop} [IsTrans α R] {s : Stream'.Seq α} (motive : Stream'.Seq α → Prop),
  motive s →
    (∀ (hd : α) (tl : Stream'.Seq α), motive (Stream'.Seq.cons hd tl) → (∀ x ∈ tl.head, R hd x) ∧ motive tl) →
      Stream'.Seq.Pairwise R s

Coinductive principle for Pairwise that assumes that R is transitive. Compared to Pairwise.coind, this allows you to prove R hd tl.head instead of tl.All (R hd ·) in step.

theorem Stream'.Seq.Pairwise_tail E1 #

∀ {α : Type u} {R : α → α → Prop} {s : Stream'.Seq α}, Stream'.Seq.Pairwise R s → Stream'.Seq.Pairwise R s.tail

theorem Stream'.Seq.Pairwise_drop E1 #

∀ {α : Type u} {R : α → α → Prop} {s : Stream'.Seq α},
  Stream'.Seq.Pairwise R s → ∀ {n : ℕ}, Stream'.Seq.Pairwise R (s.drop n)

theorem Stream'.Seq.at_least_as_long_as_coind E2 #

∀ {α : Type u} {β : Type v} {a : Stream'.Seq α} {b : Stream'.Seq β} (motive : Stream'.Seq α → Stream'.Seq β → Prop),
  motive a b →
    (∀ (a : Stream'.Seq α) (b : Stream'.Seq β),
        motive a b →
          ∀ (b_hd : β) (b_tl : Stream'.Seq β),
            b = Stream'.Seq.cons b_hd b_tl → ∃ a_hd a_tl, a = Stream'.Seq.cons a_hd a_tl ∧ motive a_tl b_tl) →
      b.length' ≤ a.length'

Coinductive principle for proving b.length' ≤ a.length' for two sequences a and b.

instance Stream'.Seq.instFunctor E0 #

Functor Stream'.Seq

instance Stream'.Seq.instLawfulFunctor E0 #

LawfulFunctor Stream'.Seq

def Stream'.Seq1.toSeq E1 #

{α : Type u} → Stream'.Seq1 α → Stream'.Seq α

Convert a Seq1 to a sequence.

instance Stream'.Seq1.coeSeq E0 #

{α : Type u} → Coe (Stream'.Seq1 α) (Stream'.Seq α)

def Stream'.Seq1.map E1 #

{α : Type u} → {β : Type v} → (α → β) → Stream'.Seq1 α → Stream'.Seq1 β

Map a function on a Seq1

theorem Stream'.Seq1.map_pair E0 #

∀ {α : Type u} {β : Type v} {f : α → β} {a : α} {s : Stream'.Seq α},
  Stream'.Seq1.map f (a, s) = (f a, Stream'.Seq.map f s)

theorem Stream'.Seq1.map_id E0 #

∀ {α : Type u} (s : Stream'.Seq1 α), Stream'.Seq1.map id s = s

def Stream'.Seq1.join E1 #

{α : Type u} → Stream'.Seq1 (Stream'.Seq1 α) → Stream'.Seq1 α

Flatten a nonempty sequence of nonempty sequences

theorem Stream'.Seq1.join_nil E0 #

∀ {α : Type u} (a : α) (S : Stream'.Seq (Stream'.Seq1 α)), Stream'.Seq1.join ((a, Stream'.Seq.nil), S) = (a, S.join)

theorem Stream'.Seq1.join_cons E0 #

∀ {α : Type u} (a b : α) (s : Stream'.Seq α) (S : Stream'.Seq (Stream'.Seq1 α)),
  Stream'.Seq1.join ((a, Stream'.Seq.cons b s), S) = (a, (Stream'.Seq.cons (b, s) S).join)

def Stream'.Seq1.ret E1 #

{α : Type u} → α → Stream'.Seq1 α

The return operator for the Seq1 monad, which produces a singleton sequence.

instance Stream'.Seq1.instInhabited E0 #

{α : Type u} → [Inhabited α] → Inhabited (Stream'.Seq1 α)

def Stream'.Seq1.bind E1 #

{α : Type u} → {β : Type v} → Stream'.Seq1 α → (α → Stream'.Seq1 β) → Stream'.Seq1 β

The bind operator for the Seq1 monad, which maps f on each element of s and appends the results together. (Not all of s may be evaluated, because the first few elements of s may already produce an infinite result.)

theorem Stream'.Seq1.join_map_ret E0 #

∀ {α : Type u} (s : Stream'.Seq α), (Stream'.Seq.map Stream'.Seq1.ret s).join = s

theorem Stream'.Seq1.bind_ret E0 #

∀ {α : Type u} {β : Type v} (f : α → β) (s : Stream'.Seq1 α), s.bind (Stream'.Seq1.ret ∘ f) = Stream'.Seq1.map f s

theorem Stream'.Seq1.ret_bind E0 #

∀ {α : Type u} {β : Type v} (a : α) (f : α → Stream'.Seq1 β), (Stream'.Seq1.ret a).bind f = f a

theorem Stream'.Seq1.map_join' E0 #

∀ {α : Type u} {β : Type v} (f : α → β) (S : Stream'.Seq (Stream'.Seq1 α)),
  Stream'.Seq.map f S.join = (Stream'.Seq.map (Stream'.Seq1.map f) S).join

theorem Stream'.Seq1.map_join E0 #

∀ {α : Type u} {β : Type v} (f : α → β) (S : Stream'.Seq1 (Stream'.Seq1 α)),
  Stream'.Seq1.map f S.join = (Stream'.Seq1.map (Stream'.Seq1.map f) S).join

theorem Stream'.Seq1.join_join E0 #

∀ {α : Type u} (SS : Stream'.Seq (Stream'.Seq1 (Stream'.Seq1 α))),
  SS.join.join = (Stream'.Seq.map Stream'.Seq1.join SS).join

theorem Stream'.Seq1.bind_assoc E0 #

∀ {α : Type u} {β : Type v} {γ : Type w} (s : Stream'.Seq1 α) (f : α → Stream'.Seq1 β) (g : β → Stream'.Seq1 γ),
  (s.bind f).bind g = s.bind fun x ↦ (f x).bind g

instance Stream'.Seq1.monad E0 #

Monad Stream'.Seq1

instance Stream'.Seq1.lawfulMonad E0 #

LawfulMonad Stream'.Seq1