Documentation

Projects.Util.Data.Word.Part_002

theorem Word.limit_spec {α : Type u_1} {w : Word α} {a : ℕ → Word α} (h : ∀ (i : ℕ), ∃ (N : ℕ), ∀ (n : ℕ), N ≤ n → (a n).get? i = w.get? i) :
@[simp]
theorem Word.limit_eq_none_iff {α : Type u_1} {a : ℕ → Word α} :
limit a = none ↔ ∀ (w : Word α), ∃ (i : ℕ), ∀ (N : ℕ), ∃ (n : ℕ), N ≤ n ∧ (a n).get? i ≠ w.get? i
@[simp]
theorem Word.limit_eq_some_iff {α : Type u_1} {w : Word α} {a : ℕ → Word α} :
limit a = some w ↔ ∀ (i : ℕ), ∃ (N : ℕ), ∀ (n : ℕ), N ≤ n → (a n).get? i = w.get? i
@[simp]
theorem Word.limit_const {α : Type u_1} {w : Word α} :
(limit fun (x : ℕ) => w) = some w
theorem Word.limit_eq_seqFun {α : Type u_1} {β : Type u_2} [hb : Nonempty β] {p : (ℕ → α) → Prop} {f : List α → List β} {g : (ℕ → α) → ℕ → β} {a : ℕ → α} (ha : p a) (h : SeqFunCnd p f g) :
(limit fun (n : ℕ) => ofList (f (mkList n a))) = some (ofSeq (seqFun p f a))
@[simp]
theorem Word.finite_ne_infinite {α : Type u_1} {w₁ w₂ : Word α} [h₁ : w₁.Finite] [h₂ : w₂.Infinite] :
w₁ ≠ w₂
@[simp]
theorem Word.infinite_ne_finite {α : Type u_1} {w₁ w₂ : Word α} [h₁ : w₁.Infinite] [h₂ : w₂.Finite] :
w₁ ≠ w₂
instance Word.infinite_append_left {α : Type u_1} {w w₁ : Word α} [h : w.Infinite] :
(w₁ ++ w).Infinite
instance Word.infinite_append_right {α : Type u_1} {w w₁ : Word α} [h : w.Infinite] :
(w ++ w₁).Infinite
@[simp]
theorem Word.ofList_prefix_ofList_iff {α : Type u_1} {xs ys : List α} :
(ofList xs).IsPrefix (ofList ys) ↔ xs <+: ys
@[simp]
theorem Word.ofList_infix_ofList_iff {α : Type u_1} {xs ys : List α} :
(ofList xs).IsInfix (ofList ys) ↔ xs <:+: ys
theorem Word.get?_ofGet?_ext {α : Type u_1} {f : ℕ → Option α} :
(ofGet? f).get? = fun (i : ℕ) => if ∀ k < i, f k ≠ none then f i else none
theorem Word.get?_append_left {α : Type u_1} {w₁ w₂ : Word α} {n : ℕ} {x : α} (h : w₁.get? n = some x) :
(w₁ ++ w₂).get? n = some x
theorem Word.get?_of_prefix {α : Type u_1} {w₁ w₂ : Word α} {n : ℕ} {x : α} (h₁ : w₁.IsPrefix w₂) (h₂ : w₁.get? n = some x) :
w₂.get? n = some x
theorem Word.exi_get?_Of_le {α : Type u_1} {w : Word α} {k n : ℕ} {x : α} (h₁ : w.get? n = some x) (h₂ : k ≤ n) :
∃ (y : α), w.get? k = some y
theorem Word.limit_spec_of_prefix {α : Type u_1} {a : ℕ → Word α} (h : ∀ (k n : ℕ), k ≤ n → (a k).IsPrefix (a n)) :
∃ (w : Word α), limit a = some w ∧ ∀ (n : ℕ) (x : α), (∃ (k : ℕ), (a k).get? n = some x) → w.get? n = some x
theorem Word.limit_spec_of_prefix_list {α : Type u_1} {a : ℕ → List α} (h : ∀ (k n : ℕ), k ≤ n → a k <+: a n) :
∃ (w : Word α), (limit fun (x : ℕ) => ofList (a x)) = some w ∧ ∀ (n : ℕ) (x : α), (∃ (k : ℕ) (h : n < (a k).length), (a k)[n] = x) → w.get? n = some x
@[simp]
theorem Word.zipWith_cons {α : Type u_1} {β : Type u_2} {γ : Type u_3} {x : α} {y : β} {xs : Word α} {ys : Word β} {f : α → β → γ} :
zipWith f (cons x xs) (cons y ys) = cons (f x y) (zipWith f xs ys)
theorem Word.get_eq_of_get?_eq_some_proof₁ {α : Type u_1} {w : Word α} {i : ℕ} {x : α} (h : w.get? i = some x) (n : ℕ) :
w.length? = some n → i < n
theorem Word.get_eq_of_get?_eq_some {α : Type u_1} {w : Word α} {i : ℕ} {x : α} (h : w.get? i = some x) :
w.get i ⋯ = x
theorem Word.get_eq_getElem_take_proof₁ {α : Type u_1} {w : Word α} {i : ℕ} (h : ∀ (n : ℕ), w.length? = some n → i < n) :
i < (take (i + 1) w).length
theorem Word.get_eq_getElem_take {α : Type u_1} {w : Word α} {n : ℕ} {h : ∀ (n_1 : ℕ), w.length? = some n_1 → n < n_1} :
w.get n h = (take (n + 1) w)[n]
@[simp]
theorem Word.zipWith_nil_left {α : Type u_1} {β : Type u_2} {γ : Type u_3} {f : α → β → γ} {w : Word β} :
@[simp]
theorem Word.zipWith_nil_right {α : Type u_1} {β : Type u_2} {γ : Type u_3} {f : α → β → γ} {w : Word α} :
@[simp]
theorem Word.take_zipWith {α : Type u_1} {β : Type u_2} {γ : Type u_3} {f : α → β → γ} {w₁ : Word α} {w₂ : Word β} {n : ℕ} :
take n (zipWith f w₁ w₂) = List.zipWith f (take n w₁) (take n w₂)
theorem Word.zipWith_comm {α : Type u_1} {β : Type u_2} {γ : Type u_3} {f : α → β → γ} {w₁ : Word α} {w₂ : Word β} :
zipWith f w₁ w₂ = zipWith (fun (y : β) (x : α) => f x y) w₂ w₁
theorem Word.getElem?_take {α : Type u_1} {w : Word α} {n i : ℕ} :
(take n w)[i]? = if i < n then w.get? i else none
@[simp]
theorem Word.zipWith_ofList_left {α : Type u_1} {β : Type u_2} {γ : Type u_3} {f : α → β → γ} {xs : List α} {w : Word β} :
zipWith f (ofList xs) w = ofList (List.zipWith f xs (take xs.length w))
@[simp]
theorem Word.zipWith_ofList_right {α : Type u_1} {β : Type u_2} {γ : Type u_3} {f : α → β → γ} {w : Word α} {xs : List β} :
zipWith f w (ofList xs) = ofList (List.zipWith f (take xs.length w) xs)
theorem Word.take_cycleList_proof₁ {α : Type u_1} {xs : List α} {i : ℕ} (h₁ : xs ≠ []) :
i % xs.length < xs.length
@[simp]
@[simp]
theorem Word.length?_cycleList_eq_some_iff {α : Type u_1} {xs : List α} {n : ℕ} :
(cycleList xs).length? = some n ↔ xs = [] ∧ n = 0
theorem Word.get_cycleList_proof₁ {α : Type u_1} {xs : List α} {n : ℕ} (h : ∀ (k : ℕ), (cycleList xs).length? = some k → n < k) :
n % xs.length < xs.length
@[simp]
theorem Word.get_cycleList {α : Type u_1} {xs : List α} {n : ℕ} {h : ∀ (n_1 : ℕ), (cycleList xs).length? = some n_1 → n < n_1} :
(cycleList xs).get n h = xs[n % xs.length]
theorem Word.take_cycleList {α : Type u_1} {xs : List α} {n : ℕ} (h : xs ≠ []) :
take n (cycleList xs) = mkList n fun (i : ℕ) => xs[i % xs.length]
theorem Word.take_cycle_proof₁ {α : Type u_1} {w : Word α} {n i : ℕ} (h₁ : w ≠ nil) (h₂ : w.length? = some n) :
i % w.length?.getD (i + 1) < n
@[simp]
theorem Word.cycle_ofList {α : Type u_1} {xs : List α} :
theorem Word.take_cycle {α : Type u_1} {w : Word α} {n : ℕ} (h : w ≠ nil) :
take n w.cycle = mkList n fun (i : ℕ) => w.get (i % w.length?.getD (i + 1)) ⋯
theorem Word.get_cons_proof₁ {α : Type u_1} {w : Word α} {x : α} {i : ℕ} (h₁ : ∀ (n : ℕ), (cons x w).length? = some n → i < n) (h₂ : i ≠ 0) (n : ℕ) :
w.length? = some n → i - 1 < n
theorem Word.get_cons {α : Type u_1} {w : Word α} {x : α} {i : ℕ} {h : ∀ (n : ℕ), (cons x w).length? = some n → i < n} :
(cons x w).get i h = if h₁ : i = 0 then x else w.get (i - 1) ⋯
@[simp]
theorem Word.dite_get_nil_left {α : Type u_1} {p : Prop} [hp : Decidable p] {i : ℕ} {f : ¬p → α} (h : p → ∀ (n : ℕ), nil.length? = some n → i < n) :
(if h₁ : p then nil.get i ⋯ else f h₁) = f ⋯
@[simp]
theorem Word.dite_get_nil_right {α : Type u_1} {p : Prop} [hp : Decidable p] {i : ℕ} {f : p → α} (h : ¬p → ∀ (n : ℕ), nil.length? = some n → i < n) :
(if h₁ : p then f h₁ else nil.get i ⋯) = f ⋯
theorem Word.ext_get {α : Type u_1} {w₁ w₂ : Word α} :
w₁ = w₂ ↔ w₁.length? = w₂.length? ∧ ∀ (i : ℕ) (h₁ : ∀ (n : ℕ), w₁.length? = some n → i < n) (h₂ : ∀ (n : ℕ), w₂.length? = some n → i < n), w₁.get i h₁ = w₂.get i h₂
@[simp]
theorem Word.list_foldr_append_replicate_nil {α : Type u_1} {w : Word α} {n : ℕ} :
List.foldr (fun (x1 x2 : Word α) => x1 ++ x2) w (List.replicate n nil) = w
@[simp]
@[simp]
theorem Word.ofGet?_const_none {α : Type u_1} :
(ofGet? fun (x : ℕ) => none) = nil
@[simp]
theorem Word.flatten_ofSeq_const_nil {α : Type u_1} :
(ofSeq fun (x : ℕ) => nil).flatten = nil
theorem Word.cntrex₁ :
¬∀ (α : Type) (W₁ W₂ : Word (Word α)), (W₁ ++ W₂).flatten = W₁.flatten ++ W₂.flatten
@[simp]
theorem Word.flatten_append {α : Type u_1} {W₁ W₂ : Word (Word α)} [h : W₁.Finite] :
(W₁ ++ W₂).flatten = W₁.flatten ++ W₂.flatten
@[simp]
theorem Word.Infinite.length?_eq {α : Type u_1} {w : Word α} [h : w.Infinite] :
theorem Word.length?_append {α : Type u_1} {w₁ w₂ : Word α} :
(w₁ ++ w₂).length? = w₁.length?.bind fun (n : ℕ) => Option.map (fun (x : ℕ) => n + x) w₂.length?
theorem Word.length?_append' {α : Type u_1} {w₁ w₂ : Word α} :
(w₁ ++ w₂).length? = w₂.length?.bind fun (n : ℕ) => Option.map (fun (x : ℕ) => n + x) w₁.length?
theorem Word.length?_append_comm {α : Type u_1} {w₁ w₂ : Word α} :
(w₁ ++ w₂).length? = (w₂ ++ w₁).length?
theorem Word.length?_flatten_ofList_proof₁ {α : Type u_1} {ws : List (Word α)} {w : { w : Word α // w ∈ ws }} (h : ¬∃ w ∈ ws, w.Infinite) :
theorem Word.length?_flatten_ofList {α : Type u_1} {ws : List (Word α)} :
(ofList ws).flatten.length? = if h : ∃ w ∈ ws, w.Infinite then none else some (List.map (fun (w : { x : Word α // x ∈ ws }) => (↑w).length ⋯) ws.attach).sum
theorem Word.get_append_left {α : Type u_1} {w₁ w₂ : Word α} {i : ℕ} {h : ∀ (n : ℕ), (w₁ ++ w₂).length? = some n → i < n} (h₁ : ∀ (n : ℕ), w₁.length? = some n → i < n) :
(w₁ ++ w₂).get i h = w₁.get i h₁
theorem Word.get_ofList_append_left {α : Type u_1} {w : Word α} {xs : List α} {i : ℕ} {h : ∀ (n : ℕ), (ofList xs ++ w).length? = some n → i < n} (h₁ : i < xs.length) :
(ofList xs ++ w).get i h = xs[i]
theorem Word.get_ofList_append_right_proof₁ {α : Type u_1} {w : Word α} {xs : List α} {i : ℕ} (h₁ : ∀ (n : ℕ), (ofList xs ++ w).length? = some n → i < n) (h₂ : xs.length ≤ i) (n : ℕ) :
w.length? = some n → i - xs.length < n
theorem Word.get_ofList_append_right {α : Type u_1} {w : Word α} {xs : List α} {i : ℕ} {h : ∀ (n : ℕ), (ofList xs ++ w).length? = some n → i < n} (h₁ : xs.length ≤ i) :
(ofList xs ++ w).get i h = w.get (i - xs.length) ⋯
@[simp]
theorem Word.flatten_ofList_zipWith_ofList {α : Type u_1} {β : Type u_2} {γ : Type u_3} {xs : List α} {ys : List β} {f : α → β → List γ} :
(ofList (List.zipWith (fun (x1 : α) (x2 : β) => ofList (f x1 x2)) xs ys)).flatten = ofList (List.zipWith f xs ys).flatten
theorem Word.ext_toList? {α : Type u_1} {w₁ w₂ : Word α} [h₁ : w₁.Finite] [h₂ : w₂.Finite] :
w₁ = w₂ ↔ w₁.toList? = w₂.toList?
theorem Word.ofSeq_steps {α : Type u_1} {a : ℕ → α} (n : ℕ) :
ofSeq a = ofList (mkList n a) ++ ofSeq fun (x : ℕ) => a (x + n)
@[simp]
theorem Word.cons_prefix_cons_iff {α : Type u_1} {w₁ w₂ : Word α} {x y : α} :
(cons x w₁).IsPrefix (cons y w₂) ↔ x = y ∧ w₁.IsPrefix w₂
theorem Word.drop_ofList_append_left {α : Type u_1} {w : Word α} {xs : List α} {n : ℕ} (h : n ≤ xs.length) :
drop n (ofList xs ++ w) = ofList (List.drop n xs) ++ w
theorem Word.drop_ofList_append_right {α : Type u_1} {w : Word α} {xs : List α} {n : ℕ} (h : xs.length ≤ n) :
drop n (ofList xs ++ w) = drop (n - xs.length) w
@[simp]
theorem Word.drop_length_ofList_append {α : Type u_1} {w : Word α} {xs : List α} :
drop xs.length (ofList xs ++ w) = w
@[simp]
theorem Word.drop_length_add_ofList_append {α : Type u_1} {w : Word α} {xs : List α} {n : ℕ} :
drop (xs.length + n) (ofList xs ++ w) = drop n w
@[simp]
theorem Word.drop_add_length_ofList_append {α : Type u_1} {w : Word α} {xs : List α} {n : ℕ} :
drop (n + xs.length) (ofList xs ++ w) = drop n w
theorem Word.prefix_drop {α : Type u_1} {w₁ w₂ : Word α} {n : ℕ} (h : w₁.IsPrefix w₂) :
(drop n w₁).IsPrefix (drop n w₂)
@[simp]
theorem Word.prefix_refl {α : Type u_1} {w : Word α} :
@[simp]
theorem Word.infix_refl {α : Type u_1} {w : Word α} :
@[simp]
theorem Word.nil_prefix {α : Type u_1} {w : Word α} :
@[simp]
theorem Word.nil_infix {α : Type u_1} {w : Word α} :
@[simp]
theorem Word.zipWith_prefix_append_left {α : Type u_1} {β : Type u_2} {γ : Type u_3} {w₁ w₂ : Word α} {w₃ : Word β} {f : α → β → γ} :
(zipWith f w₁ w₃).IsPrefix (zipWith f (w₁ ++ w₂) w₃)
@[simp]
theorem Word.zipWith_prefix_append_right {α : Type u_1} {β : Type u_2} {γ : Type u_3} {w₁ : Word α} {w₂ w₃ : Word β} {f : α → β → γ} :
(zipWith f w₁ w₂).IsPrefix (zipWith f w₁ (w₂ ++ w₃))
@[simp]
theorem Word.prefix_append {α : Type u_1} {w₁ w₂ : Word α} :
w₁.IsPrefix (w₁ ++ w₂)
theorem Word.prefix_flatten {α : Type u_1} {W₁ W₂ : Word (Word α)} (h : W₁.IsPrefix W₂) :
theorem Word.get?_cons {α : Type u_1} {w : Word α} {x : α} {i : ℕ} :
(cons x w).get? i = if i = 0 then some x else w.get? (i - 1)
theorem Word.mem_of_get?_eq_some {α : Type u_1} {w : Word α} {i : ℕ} {x : α} (h : w.get? i = some x) :
x ∈ w
@[simp]
theorem Word.mem_ofList_iff {α : Type u_1} {xs : List α} {x : α} :
x ∈ ofList xs ↔ x ∈ xs
@[simp]
theorem Word.mem_append_iff {α : Type u_1} {w₁ w₂ : Word α} {x : α} :
x ∈ w₁ ++ w₂ ↔ x ∈ w₁ ∨ w₁.Finite ∧ x ∈ w₂
@[simp]
theorem Word.mem_append_iff' {α : Type u_1} {w₁ w₂ : Word α} {x : α} :
x ∈ w₁.append w₂ ↔ x ∈ w₁ ∨ w₁.Finite ∧ x ∈ w₂
theorem Word.mem_foldr_append_iff_of_finite {α : Type u_1} {L : List (Word α)} {x : α} (h : ∀ w ∈ L, w.Finite) :
x ∈ List.foldr append nil L ↔ ∃ w ∈ L, x ∈ w
theorem Word.mem_of_mem_take {α : Type u_1} {w : Word α} {x : α} {n : ℕ} (h : x ∈ take n w) :
x ∈ w
theorem Word.mem_iff_append {α : Type u_1} {w : Word α} {x : α} :
x ∈ w ↔ ∃ (xs : List α) (w₁ : Word α), ofList xs ++ cons x w₁ = w
@[simp]
instance Word.finite_append_of {α : Type u_1} {w₁ w₂ : Word α} [h₁ : w₁.Finite] [h₂ : w₂.Finite] :
(w₁ ++ w₂).Finite
@[simp]
instance Word.infinite_append_of_left {α : Type u_1} {w₁ w₂ : Word α} [h : w₁.Infinite] :
(w₁ ++ w₂).Infinite
@[simp]
instance Word.infinite_append_of_right {α : Type u_1} {w₁ w₂ : Word α} [h : w₂.Infinite] :
(w₁ ++ w₂).Infinite
@[simp]
theorem Word.finite_append_iff {α : Type u_1} {w₁ w₂ : Word α} :
(w₁ ++ w₂).Finite ↔ w₁.Finite ∧ w₂.Finite
@[simp]
theorem Word.infinite_append_iff {α : Type u_1} {w₁ w₂ : Word α} :
(w₁ ++ w₂).Infinite ↔ w₁.Infinite ∨ w₂.Infinite
@[simp]
theorem Word.finite_flatten_ofList_iff {α : Type u_1} {L : List (Word α)} :
(ofList L).flatten.Finite ↔ ∀ w ∈ L, w.Finite
theorem Word.mem_flatten_iff_of_finite {α : Type u_1} {W : Word (Word α)} {x : α} (h : ∀ w ∈ W, w.Finite) :
x ∈ W.flatten ↔ ∃ w ∈ W, x ∈ w
theorem Word.mem_of_mem_drop {α : Type u_1} {w : Word α} {x : α} {n : ℕ} (h : x ∈ drop n w) :
x ∈ w
theorem Word.mem_iff_mem_take {α : Type u_1} {w : Word α} {x : α} :
x ∈ w ↔ ∃ (n : ℕ), x ∈ take n w
@[simp]
theorem Word.mem_zipWith_iff {α : Type u_1} {β : Type u_2} {γ : Type u_3} {f : α → β → γ} {w₁ : Word α} {w₂ : Word β} {x : γ} :
x ∈ zipWith f w₁ w₂ ↔ ∃ (i : ℕ) (h₁ : ∀ (n : ℕ), w₁.length? = some n → i < n) (h₂ : ∀ (n : ℕ), w₂.length? = some n → i < n), f (w₁.get i h₁) (w₂.get i h₂) = x
@[simp]
theorem Word.get_mem {α : Type u_1} {w : Word α} {i : ℕ} {h : ∀ (n : ℕ), w.length? = some n → i < n} :
w.get i h ∈ w
theorem Word.mem_of_get_eq {α : Type u_1} {w : Word α} {i : ℕ} {x : α} {h₁ : ∀ (n : ℕ), w.length? = some n → i < n} (h : w.get i h₁ = x) :
x ∈ w
theorem Word.flatMap_eq_flatten_map {α : Type u_1} {β : Type u_2} {w : Word α} {f : α → Word β} :
w.flatMap f = (map f w).flatten
theorem Word.flatten_ofList_of_finite {α : Type u_1} {xs : List (Word α)} (h : ∀ w ∈ xs, w.Finite) :
(ofList xs).flatten = ofList (List.flatMap (fun (x : Word α) => x.toList?.get!) xs)
@[simp]
theorem Word.map_map {α : Type u_1} {β : Type u_2} {γ : Type u_3} {w : Word α} {f : α → β} {g : β → γ} :
map g (map f w) = map (fun (x : α) => g (f x)) w
@[simp]
theorem Word.flatMap_map {α : Type u_1} {β : Type u_2} {γ : Type u_3} {w : Word α} {f : α → β} {g : β → Word γ} :
(map f w).flatMap g = w.flatMap fun (x : α) => g (f x)
@[simp]
theorem Word.flatMap_ofList_fun_ofList {α : Type u_1} {β : Type u_2} {xs : List α} {f : α → List β} :
((ofList xs).flatMap fun (x : α) => ofList (f x)) = ofList (List.flatMap f xs)
@[simp]
theorem Word.ofList_prefix_ofSeq_iff {α : Type u_1} {xs : List α} {a : ℕ → α} :
@[simp]
theorem Word.not_ofSeq_prefix_ofList {α : Type u_1} {xs : List α} {a : ℕ → α} :
@[simp]
theorem Word.ofSeq_prefix_ofSeq_iff {α : Type u_1} {a b : ℕ → α} :
(ofSeq a).IsPrefix (ofSeq b) ↔ a = b
@[simp]
theorem Word.ofList_infix_ofSeq_iff {α : Type u_1} {xs : List α} {a : ℕ → α} :
@[simp]
theorem Word.not_ofSeq_infix_ofList {α : Type u_1} {xs : List α} {a : ℕ → α} :
@[simp]
theorem Word.ofSeq_infix_ofSeq_iff {α : Type u_1} {a b : ℕ → α} :
(ofSeq a).IsInfix (ofSeq b) ↔ ∃ (n : ℕ), a = fun (x : ℕ) => b (x + n)
theorem Word.batches_step {α : Type u_1} {w : Word α} {n : ℕ} :
w.batches n = if n = 0 ∨ ∃ (k : ℕ), w.length? = some k ∧ k < n then nil else cons (take n w) ((drop n w).batches n)
@[simp]
theorem Word.flatMap_nil {α : Type u_1} {β : Type u_2} {f : α → Word β} :
@[simp]
theorem Word.flatMap_cons {α : Type u_1} {β : Type u_2} {w : Word α} {f : α → Word β} {x : α} :
(cons x w).flatMap f = f x ++ w.flatMap f
@[simp]
theorem Word.mk_eq_ofGet?_self_simp {α : Type u_1} {f : ℕ → Option α} {wf : ∀ (i : ℕ), f i = none → ∀ (n : ℕ), i < n → f n = none} :
{ get? := f, wf := wf } = ofGet? f ↔ True
theorem Word.append_eq_ofGet? {α : Type u_1} {w₁ w₂ : Word α} :
w₁.append w₂ = ofGet? (append' w₁.get? w₂.get?)
theorem Word.zipWith_eq_ofGet? {α : Type u_1} {β : Type u_2} {γ : Type u_3} {f : α → β → γ} {w₁ : Word α} {w₂ : Word β} :
zipWith f w₁ w₂ = ofGet? fun (i : ℕ) => match w₁.get? i, w₂.get? i with | some x, some y => some (f x y) | x, x_1 => none