Documentation

Projects.Util.Data.Word.Part_001

theorem Word.coeList {α : Type u_1} {xs : List α} :
theorem Word.coeSeq {α : Type u_1} {a : ℕ → α} :
theorem Word.append_def {α : Type u_1} {xs ys : Word α} :
xs ++ ys = xs.append ys
@[simp]
theorem Word.default_eq_nil {α : Type u_1} :
@[simp]
theorem Word.get?_ofList {α : Type u_1} {xs : List α} {i : ℕ} :
(ofList xs).get? i = xs[i]?
@[simp]
theorem Word.get?_ofSeq {α : Type u_1} {a : ℕ → α} {i : ℕ} :
(ofSeq a).get? i = some (a i)
theorem Word.eq_iff_get? {α : Type u_1} {xs ys : Word α} :
xs = ys ↔ ∀ (i : ℕ), xs.get? i = ys.get? i
@[simp]
theorem Word.take_ofList {α : Type u_1} {xs : List α} {n : ℕ} :
take n (ofList xs) = List.take n xs
@[simp]
theorem Word.take_nil {α : Type u_1} {n : ℕ} :
@[simp]
theorem Word.get?_nil {α : Type u_1} {i : ℕ} :
@[simp]
instance Word.finite_ofList {α : Type u_1} {xs : List α} :
@[simp]
instance Word.infinite_ofSeq {α : Type u_1} {a : ℕ → α} :
@[simp]
theorem Word.length?_ofList {α : Type u_1} {xs : List α} :
@[simp]
theorem Word.length?_ofSeq {α : Type u_1} {a : ℕ → α} :
@[simp]
theorem Word.toList?_ofList {α : Type u_1} {xs : List α} :
@[simp]
theorem Word.toSeq?_ofSeq {α : Type u_1} {a : ℕ → α} :
@[simp]
theorem Word.toList?_nil {α : Type u_1} :
@[simp]
theorem Word.cycleList_nil {α : Type u_1} :
@[simp]
theorem Word.cycle_nil {α : Type u_1} :
@[simp]
theorem Word.ofList_nil {α : Type u_1} :
@[simp]
theorem Word.ofList_cons {α : Type u_1} {x : α} {xs : List α} :
ofList (x :: xs) = cons x (ofList xs)
@[simp]
theorem Word.toSeq?_ofList {α : Type u_1} {xs : List α} :
@[simp]
theorem Word.toList?_ofSeq {α : Type u_1} {a : ℕ → α} :
@[simp]
theorem Word.cases_ofList {α : Type u_1} {xs : List α} :
@[simp]
theorem Word.cases_ofSeq {α : Type u_1} {a : ℕ → α} :
theorem Word.Finite.exi_ofList {α : Type u_1} {xs : Word α} [h : xs.Finite] :
∃ (ys : List α), xs = ofList ys
theorem Word.Infinite.exi_ofSeq {α : Type u_1} {xs : Word α} [h : xs.Infinite] :
∃ (a : ℕ → α), xs = ofSeq a
@[simp]
theorem Word.ofList_ne_ofSeq {α : Type u_1} {xs : List α} {a : ℕ → α} :
@[simp]
theorem Word.ofSeq_ne_ofList {α : Type u_1} {xs : List α} {a : ℕ → α} :
@[simp]
theorem Word.ofList_eq_ofList_iff {α : Type u_1} {xs ys : List α} :
ofList xs = ofList ys ↔ xs = ys
@[simp]
theorem Word.ofSeq_eq_ofSeq_iff {α : Type u_1} {a b : ℕ → α} :
ofSeq a = ofSeq b ↔ a = b
theorem Word.Finite.iff_ofList {α : Type u_1} {xs : Word α} :
xs.Finite ↔ ∃ (ys : List α), xs = ofList ys
theorem Word.Infinite.iff_ofSeq {α : Type u_1} {xs : Word α} :
xs.Infinite ↔ ∃ (a : ℕ → α), xs = ofSeq a
theorem Word.exi_eq_ofList_or_ofSeq {α : Type u_1} {xs : Word α} :
(∃ (ys : List α), xs = ofList ys) ∨ ∃ (a : ℕ → α), xs = ofSeq a
theorem Word.ind {α : Type u_1} {p : Word α → Prop} (h₁ : ∀ (xs : List α), p (ofList xs)) (h₂ : ∀ (a : ℕ → α), p (ofSeq a)) (xs : Word α) :
p xs
theorem Word.ind' {α : Type u_1} {p : Word α → Prop} (h₁ : ∀ (a : ℕ → α), p (ofSeq a)) (h₂ : ∀ (xs : List α), p (ofList xs)) (xs : Word α) :
p xs
@[simp]
theorem Word.append'_zero {α : Type u_1} {f g : ℕ → Option α} :
append' f g 0 = (f 0).or (g 0)
theorem Word.append'_succ_none {α : Type u_1} {f g : ℕ → Option α} {i : ℕ} (h : f 0 = none) :
append' f g (i + 1) = g (i + 1)
theorem Word.append'_succ_some {α : Type u_1} {f g : ℕ → Option α} {i : ℕ} {x : α} (h : f 0 = some x) :
append' f g (i + 1) = append' (fun (x : ℕ) => f (x + 1)) g i
@[simp]
theorem Word.append'_ofList {α : Type u_1} {xs : List α} {g : ℕ → Option α} {i : ℕ} :
append' (ofList xs).get? g i = if i < xs.length then xs[i]? else g (i - xs.length)
@[simp]
theorem Word.append'_ofSeq {α : Type u_1} {a : ℕ → α} {g : ℕ → Option α} {i : ℕ} :
append' (ofSeq a).get? g i = some (a i)
@[simp]
theorem Word.Infinite.append_left {α : Type u_1} {xs ys : Word α} [h : xs.Infinite] :
xs ++ ys = xs
theorem Word.get?_append {α : Type u_1} {xs ys : Word α} {i : ℕ} :
(xs ++ ys).get? i = match xs.length? with | none => xs.get? i | some n => if i < n then xs.get? i else ys.get? (i - n)
@[simp]
theorem Word.drop_ofList {α : Type u_1} {xs : List α} {n : ℕ} :
drop n (ofList xs) = ofList (List.drop n xs)
theorem Word.ofList_append {α : Type u_1} {xs ys : List α} :
ofList (xs ++ ys) = ofList xs ++ ofList ys
@[simp]
theorem Word.ofList_append_ofList {α : Type u_1} {xs ys : List α} :
ofList xs ++ ofList ys = ofList (xs ++ ys)
@[simp]
theorem Word.take_ofSeq {α : Type u_1} {a : ℕ → α} {n : ℕ} :
take n (ofSeq a) = mkList n a
theorem Word.Infinite.nonempty {α : Type u_1} {xs : Word α} [h : xs.Infinite] :
theorem Word.ofList_append_infinite {α : Type u_1} {ys : Word α} {xs : List α} [h : ys.Infinite] {i : ℕ} :
(ofList xs ++ ys).get? i = if i < xs.length then xs[i]? else ys.get? (i - xs.length)
@[simp]
theorem Word.drop_ofSeq {α : Type u_1} {a : ℕ → α} {n : ℕ} :
drop n (ofSeq a) = ofSeq fun (x : ℕ) => a (x + n)
@[simp]
theorem Word.not_infinite_ofList {α : Type u_1} {xs : List α} :
@[simp]
theorem Word.not_finite_ofSeq {α : Type u_1} {a : ℕ → α} :
instance Word.infinite_drop {α : Type u_1} {xs : Word α} [h : xs.Infinite] {n : ℕ} :
(drop n xs).Infinite
@[simp]
theorem Word.infinite_drop_iff {α : Type u_1} {xs : Word α} {n : ℕ} :
@[simp]
theorem Word.get?_zero_cons {α : Type u_1} {xs : Word α} {x : α} :
(cons x xs).get? 0 = some x
@[simp]
theorem Word.get?_succ_cons {α : Type u_1} {xs : Word α} {x : α} {i : ℕ} :
(cons x xs).get? (i + 1) = xs.get? i
@[simp]
theorem Word.get?_map {α : Type u_1} {β : Type u_2} {xs : Word α} {f : α → β} {i : ℕ} :
(map f xs).get? i = Option.map f (xs.get? i)
@[simp]
theorem Word.map_ofList {α : Type u_1} {β : Type u_2} {xs : List α} {f : α → β} :
map f (ofList xs) = ofList (List.map f xs)
@[simp]
theorem Word.map_ofSeq {α : Type u_1} {β : Type u_2} {a : ℕ → α} {f : α → β} :
map f (ofSeq a) = ofSeq fun (x : ℕ) => f (a x)
@[simp]
theorem Word.map_nil {α : Type u_1} {β : Type u_2} {f : α → β} :
@[simp]
theorem Word.map_cons {α : Type u_1} {β : Type u_2} {xs : Word α} {f : α → β} {x : α} :
map f (cons x xs) = cons (f x) (map f xs)
theorem Word.get?_ofList_append_left {α : Type u_1} {ys : Word α} {xs : List α} {i : ℕ} (h : i < xs.length) :
(ofList xs ++ ys).get? i = some xs[i]
theorem Word.get?_ofList_append_right {α : Type u_1} {ys : Word α} {xs : List α} {i : ℕ} (h : xs.length ≤ i) :
(ofList xs ++ ys).get? i = ys.get? (i - xs.length)
@[simp]
theorem Word.get?_cycleList {α : Type u_1} {xs : List α} {i : ℕ} :
(cycleList xs).get? i = xs[i % xs.length]?
@[simp]
theorem Word.get?_cycle_ofList {α : Type u_1} {xs : List α} {i : ℕ} :
(ofList xs).cycle.get? i = xs[i % xs.length]?
@[simp]
theorem Word.get?_append_ofSeq {α : Type u_1} {xs : Word α} {a : ℕ → α} {i : ℕ} :
(ofSeq a ++ xs).get? i = some (a i)
@[simp]
theorem Word.take_zero {α : Type u_1} {xs : Word α} :
take 0 xs = []
@[simp]
theorem Word.take_succ_cons {α : Type u_1} {xs : Word α} {x : α} {n : ℕ} :
take (n + 1) (cons x xs) = x :: take n xs
@[simp]
theorem Word.length?_nil {α : Type u_1} :
theorem Word.length?_eq_none_of_ofSeq {α : Type u_1} {xs : Word α} (a : ℕ → α) (h : ofSeq a = xs) :
theorem Word.length?_eq_none_iff_exi_seq {α : Type u_1} {xs : Word α} :
xs.length? = none ↔ ∃ (a : ℕ → α), ofSeq a = xs
@[simp]
theorem Word.length?_cons {α : Type u_1} {xs : Word α} {x : α} :
(cons x xs).length? = Option.map (fun (x : ℕ) => x + 1) xs.length?
@[simp]
theorem Word.nil_append {α : Type u_1} {xs : Word α} :
nil ++ xs = xs
@[simp]
theorem Word.append_nil {α : Type u_1} {xs : Word α} :
xs ++ nil = xs
@[simp]
theorem Word.append_of_infinite_left {α : Type u_1} {xs ys : Word α} [h : xs.Infinite] :
xs ++ ys = xs
instance Word.infinite_cons {α : Type u_1} {xs : Word α} [h : xs.Infinite] {x : α} :
(cons x xs).Infinite
@[simp]
theorem Word.cons_append {α : Type u_1} {xs ys : Word α} {x : α} :
cons x xs ++ ys = cons x (xs ++ ys)
@[simp]
theorem Word.take_length_ofList_append {α : Type u_1} {ys : Word α} {xs : List α} :
take xs.length (ofList xs ++ ys) = xs
@[simp]
theorem Word.take_length_add_ofList_append {α : Type u_1} {ys : Word α} {xs : List α} {n : ℕ} :
take (xs.length + n) (ofList xs ++ ys) = xs ++ take n ys
@[simp]
theorem Word.cycle_of_infinite {α : Type u_1} {xs : Word α} [h : xs.Infinite] :
xs.cycle = xs
@[simp]
theorem Word.get?_cycle_zero {α : Type u_1} {xs : Word α} :
xs.cycle.get? 0 = xs.get? 0
theorem Word.length?_cycleList {α : Type u_1} {xs : List α} :
theorem Word.eq_nil_iff_get?_zero {α : Type u_1} {xs : Word α} :
xs = nil ↔ xs.get? 0 = none
@[instance_reducible]
instance Word.instDecidableEqNil {α : Type u_1} {xs : Word α} :
Equations
@[instance_reducible]
instance Word.instDecidableEqNil_1 {α : Type u_1} {xs : Word α} :
Equations
@[simp]
theorem Word.ofList_eq_nil_iff {α : Type u_1} {xs : List α} :
ofList xs = nil ↔ xs = []
@[simp]
theorem Word.nil_eq_ofList_iff {α : Type u_1} {xs : List α} :
nil = ofList xs ↔ xs = []
@[simp]
theorem Word.ne_nil_of_infinite {α : Type u_1} {xs : Word α} [h : xs.Infinite] :
xs ≠ nil
@[simp]
theorem Word.nil_ne_of_infinite {α : Type u_1} {xs : Word α} [h : xs.Infinite] :
nil ≠ xs
theorem Word.length?_cycle {α : Type u_1} {xs : Word α} :
@[simp]
theorem Word.toList?_append_of_finite {α : Type u_1} {xs ys : Word α} [h₁ : xs.Finite] [h₂ : ys.Finite] :
@[simp]
instance Word.finite_nil {α : Type u_1} :
instance Word.finite_cons {α : Type u_1} {xs : Word α} {x : α} [h : xs.Finite] :
(cons x xs).Finite
@[simp]
theorem Word.toList?_cons_of_finite {α : Type u_1} {xs : Word α} {x : α} [h : xs.Finite] :
(cons x xs).toList? = some (x :: xs.toList?.getd)
theorem Word.cycleList_cons {α : Type u_1} {xs : List α} {x : α} :
cycleList (x :: xs) = cons x (cycleList (xs ++ [x]))
theorem Word.cycle_cons {α : Type u_1} {xs : Word α} {x : α} :
(cons x xs).cycle = cons x (xs ++ ofList [x]).cycle
theorem Word.cycleList_step {α : Type u_1} {xs : List α} :
theorem Word.cycle_step {α : Type u_1} {xs : Word α} :
xs.cycle = xs ++ xs.cycle
@[simp]
theorem Word.take_length_cycleList {α : Type u_1} {xs : List α} :
take xs.length (cycleList xs) = xs
@[simp]
theorem Word.take_length_cycle_ofList {α : Type u_1} {xs : List α} :
take xs.length (ofList xs).cycle = xs
theorem Word.take_one_ofList_append_of_ne_nil {α : Type u_1} {ys : Word α} {xs : List α} (h : xs ≠ []) :
take 1 (ofList xs ++ ys) = [xs.head h]
theorem Word.append_assoc {α : Type u_1} {xs ys zs : Word α} :
xs ++ ys ++ zs = xs ++ (ys ++ zs)
theorem Word.take_ofList_append_left {α : Type u_1} {ys : Word α} {xs : List α} {n : ℕ} (h : n ≤ xs.length) :
take n (ofList xs ++ ys) = List.take n xs
theorem Word.take_ofList_append_right {α : Type u_1} {ys : Word α} {xs : List α} {n : ℕ} (h : xs.length ≤ n) :
take n (ofList xs ++ ys) = xs ++ take (n - xs.length) ys
theorem Word.ofSeq_step {α : Type u_1} {a : ℕ → α} :
ofSeq a = cons (a 0) (ofSeq fun (x : ℕ) => a (x + 1))
theorem Word.cases' {α : Type u_1} {p : Word α → Prop} (h₁ : p nil) (h₂ : ∀ (x : α) (xs : Word α), p (cons x xs)) (xs : Word α) :
p xs
@[simp]
theorem Word.cons_ne_nil {α : Type u_1} {xs : Word α} {x : α} :
cons x xs ≠ nil
@[simp]
theorem Word.nil_ne_cons {α : Type u_1} {xs : Word α} {x : α} :
nil ≠ cons x xs
@[simp]
theorem Word.take_eq_nil_iff {α : Type u_1} {xs : Word α} {n : ℕ} :
take n xs = [] ↔ xs = nil ∨ n = 0
@[simp]
theorem Word.cycle_eq_nil_iff {α : Type u_1} {xs : Word α} :
xs.cycle = nil ↔ xs = nil
@[simp]
theorem Word.drop_zero {α : Type u_1} {xs : Word α} :
drop 0 xs = xs
theorem Word.length?_eq_some_iff {α : Type u_1} {xs : Word α} {n : ℕ} :
xs.length? = some n ↔ ∃ (ys : List α), ys.length = n ∧ ofList ys = xs
theorem Word.drop_of_length_le' {α : Type u_1} {xs : Word α} {n : ℕ} (h : ∃ (k : ℕ), xs.length? = some k ∧ k ≤ n) :
drop n xs = nil
@[simp]
theorem Word.drop_nil {α : Type u_1} {n : ℕ} :
@[simp]
theorem Word.tail_nil {α : Type u_1} :
@[simp]
theorem Word.drop_succ_cons {α : Type u_1} {xs : Word α} {x : α} {n : ℕ} :
drop (n + 1) (cons x xs) = drop n xs
@[simp]
theorem Word.tail_cons {α : Type u_1} {xs : Word α} {x : α} :
(cons x xs).tail = xs
theorem Word.length?_tail {α : Type u_1} {xs : Word α} :
xs.tail.length? = Option.map (fun (x : ℕ) => x - 1) xs.length?
@[simp]
theorem Word.length?_eq_some_zero_off {α : Type u_1} {xs : Word α} :
xs.length? = some 0 ↔ xs = nil
theorem Word.length?_eq_none_iff {α : Type u_1} {xs : Word α} :
xs.length? = none ↔ ∃ (a : ℕ → α), ofSeq a = xs
theorem Word.length?_ne_none_iff {α : Type u_1} {xs : Word α} :
xs.length? ≠ none ↔ ∃ (ys : List α), ofList ys = xs
def Word.get {α : Type u_1} (xs : Word α) (i : ℕ) (h : ∀ (n : ℕ), xs.length? = some n → i < n) :
α
Equations
Instances For
    def Word.head {α : Type u_1} (xs : Word α) (h : xs ≠ nil) :
    α
    Equations
    Instances For
      @[irreducible]
      def Word.length {α : Type u_1} (xs : Word α) (h : xs.length? ≠ none) :
      Equations
      Instances For
        @[simp]
        theorem Word.get_zero_cons {α : Type u_1} {xs : Word α} {x : α} {h : ∀ (n : ℕ), (cons x xs).length? = some n → 0 < n} :
        (cons x xs).get 0 h = x
        @[simp]
        theorem Word.head_cons {α : Type u_1} {xs : Word α} {x : α} {h : cons x xs ≠ nil} :
        (cons x xs).head h = x
        @[simp]
        theorem Word.head_take {α : Type u_1} {xs : Word α} {n : ℕ} {h : take n xs ≠ []} :
        (take n xs).head h = xs.head ⋯
        @[simp]
        theorem Word.length_nil {α : Type u_1} {h : nil.length? ≠ none} :
        @[simp]
        theorem Word.length_cons {α : Type u_1} {xs : Word α} {x : α} {h : (cons x xs).length? ≠ none} :
        (cons x xs).length h = xs.length ⋯ + 1
        theorem Word.length_eq_get_length? {α : Type u_1} {xs : Word α} {h : xs.length? ≠ none} :
        xs.length h = xs.length?.get ⋯
        theorem Word.get_length? {α : Type u_1} {xs : Word α} {h : xs.length?.isSome = true} :
        xs.length?.get h = xs.length ⋯
        theorem Word.get?_isSome_iff_forall_length? {α : Type u_1} {xs : Word α} {i : ℕ} :
        (xs.get? i).isSome = true ↔ ∀ (n : ℕ), xs.length? = some n → i < n
        theorem Word.get_eq_get_get? {α : Type u_1} {xs : Word α} {i : ℕ} {h : ∀ (n : ℕ), xs.length? = some n → i < n} :
        xs.get i h = (xs.get? i).get ⋯
        theorem Word.get_get? {α : Type u_1} {xs : Word α} {i : ℕ} {h : (xs.get? i).isSome = true} :
        (xs.get? i).get h = xs.get i ⋯
        theorem Word.cycle_append {α : Type u_1} {xs ys : Word α} :
        (xs ++ ys).cycle = xs ++ (ys ++ xs).cycle
        @[simp]
        theorem Word.length?_cycle_eq_some_iff {α : Type u_1} {xs : Word α} {n : ℕ} :
        xs.cycle.length? = some n ↔ xs = nil ∧ n = 0
        @[simp]
        theorem Word.some_eq_length?_cycle_iff {α : Type u_1} {xs : Word α} {n : ℕ} :
        some n = xs.cycle.length? ↔ xs = nil ∧ n = 0
        @[simp]
        theorem Word.length?_cycle_eq_none_iff {α : Type u_1} {xs : Word α} :
        @[simp]
        theorem Word.none_eq_length?_cycle_iff {α : Type u_1} {xs : Word α} :
        @[simp]
        theorem Word.length_cycle {α : Type u_1} {xs : Word α} {h : xs.cycle.length? ≠ none} :
        xs.cycle.length h = 0
        @[simp]
        theorem Word.length_ofList {α : Type u_1} {xs : List α} {h : (ofList xs).length? ≠ none} :
        (ofList xs).length h = xs.length
        theorem Word.get_cycle_of_finite_proof₁ {α : Type u_1} {xs : Word α} [H : xs.Finite] {i : ℕ} (h : ∀ (n : ℕ), xs.cycle.length? = some n → i < n) :
        theorem Word.get_cycle_of_finite_proof₂ {α : Type u_1} {xs : Word α} [H : xs.Finite] {i : ℕ} (h : ∀ (n : ℕ), xs.cycle.length? = some n → i < n) (n : ℕ) :
        xs.length? = some n → i % xs.length ⋯ < n
        @[simp]
        theorem Word.get_cycle_of_finite {α : Type u_1} {xs : Word α} [H : xs.Finite] {i : ℕ} {h : ∀ (n : ℕ), xs.cycle.length? = some n → i < n} :
        xs.cycle.get i h = xs.get (i % xs.length ⋯) ⋯
        @[simp]
        theorem Word.head_cycle_of_finite {α : Type u_1} {xs : Word α} [H : xs.Finite] {h : xs.cycle ≠ nil} :
        xs.cycle.head h = xs.head ⋯
        @[simp]
        theorem Word.head_cycle {α : Type u_1} {xs : Word α} {h : xs.cycle ≠ nil} :
        xs.cycle.head h = xs.head ⋯
        @[simp]
        theorem Word.get_ofList {α : Type u_1} {xs : List α} {i : ℕ} {h : ∀ (n : ℕ), (ofList xs).length? = some n → i < n} :
        (ofList xs).get i h = xs[i]
        @[simp]
        theorem Word.head_ofList {α : Type u_1} {xs : List α} {h : ofList xs ≠ nil} :
        (ofList xs).head h = xs.head ⋯
        @[simp]
        theorem Word.get?_ofList_append_length_add {α : Type u_1} {ys : Word α} {xs : List α} {i : ℕ} :
        (ofList xs ++ ys).get? (xs.length + i) = ys.get? i
        @[simp]
        theorem Word.get?_ofList_append_length {α : Type u_1} {ys : Word α} {xs : List α} :
        (ofList xs ++ ys).get? xs.length = ys.get? 0
        @[simp]
        theorem Word.cons_inj {α : Type u_1} {xs ys : Word α} {x y : α} :
        cons x xs = cons y ys ↔ x = y ∧ xs = ys
        @[simp]
        theorem Word.append_eq_append_iff_right_of_finite {α : Type u_1} {xs ys zs : Word α} [H : xs.Finite] :
        xs ++ ys = xs ++ zs ↔ ys = zs
        @[simp]
        theorem Word.append_nil' {α : Type u_1} {xs : Word α} :
        xs.append nil = xs
        @[simp]
        theorem Word.append_of_infinite_left' {α : Type u_1} {xs ys : Word α} [h : xs.Infinite] :
        xs.append ys = xs
        @[simp]
        theorem Word.init_nil {α : Type u_1} :
        @[simp]
        theorem Word.init_cons_nil {α : Type u_1} {x : α} :
        @[simp]
        theorem Word.init_cons_cons {α : Type u_1} {xs : Word α} {x y : α} :
        (cons x (cons y xs)).init = cons x (cons y xs).init
        @[simp]
        theorem Word.init_of_infinite {α : Type u_1} {xs : Word α} [h : xs.Infinite] :
        xs.init = xs
        @[simp]
        theorem Word.init_append_cons {α : Type u_1} {xs ys : Word α} {x : α} :
        (xs ++ cons x ys).init = xs ++ (cons x ys).init
        @[simp]
        theorem Word.init_ofList {α : Type u_1} {xs : List α} :
        noncomputable def Word.ofGet?Alt₁ {α : Type u_1} (f : ℕ → Option α) :
        Word α
        Equations
        Instances For
          theorem Word.get?_ofGet? {α : Type u_1} {f : ℕ → Option α} {i : ℕ} :
          (ofGet? f).get? i = if ∀ k < i, f k ≠ none then f i else none
          @[simp]
          theorem Word.get?_ofGet?_eq_none_iff {α : Type u_1} {f : ℕ → Option α} {i : ℕ} :
          (ofGet? f).get? i = none ↔ ∃ k ≤ i, f k = none
          @[simp]
          theorem Word.get?_ofGet?_eq_some_iff {α : Type u_1} {f : ℕ → Option α} {i : ℕ} {x : α} :
          (ofGet? f).get? i = some x ↔ f i = some x ∧ ∀ k < i, f k ≠ none
          @[simp]
          theorem Word.flatten_nil {α : Type u_1} :
          theorem Word.flatten_cons_aux₁ {α : Type u_1} {L : Word (Word α)} {a : ℕ → α} {i : ℕ} :
          (cons (ofSeq a) L).flatten.get? i = (ofSeq a ++ L.flatten).get? i
          theorem Word.flatten_cons_aux₂ {α : Type u_1} {L : Word (Word α)} {xs : List α} {i : ℕ} (h₁ : i < xs.length) :
          (cons (ofList xs) L).flatten.get? i = (ofList xs ++ L.flatten).get? i
          theorem Word.flatten_cons_aux₃ {α : Type u_1} {L : Word (Word α)} {xs : List α} {i : ℕ} (h₁ : xs.length ≤ i) :
          (cons (ofList xs) L).flatten.get? i = (ofList xs ++ L.flatten).get? i
          @[simp]
          theorem Word.flatten_cons {α : Type u_1} {xs : Word α} {L : Word (Word α)} :
          (cons xs L).flatten = xs ++ L.flatten
          theorem Word.cycle_steps {α : Type u_1} {xs : Word α} (n : ℕ) :
          theorem Word.eq_iff_step {α : Type u_1} {xs ys : Word α} :
          xs = ys ↔ xs.get? 0 = ys.get? 0 ∧ xs.tail = ys.tail
          @[simp]
          theorem Word.get_ofSeq {α : Type u_1} {a : ℕ → α} {i : ℕ} {h : ∀ (n : ℕ), (ofSeq a).length? = some n → i < n} :
          (ofSeq a).get i h = a i
          theorem Word.getElem?_take_of_lt {α : Type u_1} {xs : Word α} {n i : ℕ} (h : i < n) :
          (take n xs)[i]? = xs.get? i
          theorem Word.getElem_take_proof₁ {α : Type u_1} {xs : Word α} {n i : ℕ} (h : i < (take n xs).length) (n✝ : ℕ) :
          xs.length? = some n✝ → i < n✝
          @[simp]
          theorem Word.getElem_take {α : Type u_1} {xs : Word α} {n i : ℕ} {h : i < (take n xs).length} :
          (take n xs)[i] = xs.get i ⋯
          theorem Word.ext_take {α : Type u_1} {xs ys : Word α} :
          xs = ys ↔ ∀ (n : ℕ), take n xs = take n ys
          theorem Word.length_take {α : Type u_1} {xs : Word α} {n : ℕ} :
          (take n xs).length = xs.length?.elim n (min n)
          theorem Word.get?_eq_none_of_le {α : Type u_1} {xs : Word α} {n k : ℕ} (h₁ : xs.get? k = none) (h₂ : k ≤ n) :
          xs.get? n = none
          @[simp]
          theorem Word.get?_zero_eq_none_iff {α : Type u_1} {xs : Word α} :
          xs.get? 0 = none ↔ xs = nil
          @[simp]
          theorem Word.none_eq_get?_zero_iff {α : Type u_1} {xs : Word α} :
          none = xs.get? 0 ↔ xs = nil
          theorem Word.take_eq_take_iff {α : Type u_1} {xs ys : Word α} {n : ℕ} :
          take n xs = take n ys ↔ ∀ k < n, xs.get? k = ys.get? k
          theorem Word.eq_of_take_imp_get? {α : Type u_1} {xs ys : Word α} (h : ∀ (n : ℕ), take n xs = take n ys → xs.get? n = ys.get? n) :
          xs = ys
          @[simp]
          theorem Word.wordFun_ofList {α : Type u_1} {β : Type u_2} {p : (ℕ → α) → Prop} {f : List α → List β} {xs : List α} :
          wordFun p f (ofList xs) = ofList (f xs)
          @[simp]
          theorem Word.wordFun_ofSeq {α : Type u_1} {β : Type u_2} [hb : Nonempty β] {p : (ℕ → α) → Prop} {f : List α → List β} {a : ℕ → α} :
          wordFun p f (ofSeq a) = ofSeq (seqFun p f a)
          theorem Word.mem_def {α : Type u_1} {xs : Word α} {x : α} :
          x ∈ xs ↔ xs.mem x
          @[simp]
          theorem Word.mem_ofList {α : Type u_1} {xs : List α} {x : α} :
          x ∈ ofList xs ↔ x ∈ xs
          @[simp]
          theorem Word.mem_ofSeq {α : Type u_1} {a : ℕ → α} {x : α} :
          x ∈ ofSeq a ↔ ∃ (i : ℕ), a i = x
          @[simp]
          theorem Word.get?_eq_some_get_iff {α : Type u_1} {xs : Word α} {n : ℕ} {h : ∀ (n_1 : ℕ), xs.length? = some n_1 → n < n_1} :
          xs.get? n = some (xs.get n h) ↔ ∀ (h : xs.length? ≠ none), n < xs.length h
          @[simp]
          theorem Word.some_get_eq_get?_iff {α : Type u_1} {xs : Word α} {n : ℕ} {h : ∀ (n_1 : ℕ), xs.length? = some n_1 → n < n_1} :
          some (xs.get n h) = xs.get? n ↔ ∀ (h : xs.length? ≠ none), n < xs.length h
          theorem Word.mem_iff_get? {α : Type u_1} {xs : Word α} {x : α} :
          x ∈ xs ↔ ∃ (n : ℕ), xs.get? n = some x
          theorem Word.mem_iff_get {α : Type u_1} {xs : Word α} {x : α} :
          x ∈ xs ↔ ∃ (n : ℕ) (h : ∀ (n_1 : ℕ), xs.length? = some n_1 → n < n_1), xs.get n h = x
          @[simp]
          theorem Word.not_mem_nil {α : Type u_1} {x : α} :
          x ∉ nil
          @[simp]
          theorem Word.mem_cons_iff {α : Type u_1} {xs : Word α} {x y : α} :
          y ∈ cons x xs ↔ y = x ∨ y ∈ xs
          theorem Word.get?_append_eq_get?_append_of_right {α : Type u_1} {xs ys zs : Word α} {n : ℕ} (h₁ : ∀ (k : ℕ) (h : xs.length? ≠ none), n = xs.length h + k → ys.get? k = zs.get? k) :
          (xs ++ ys).get? n = (xs ++ zs).get? n
          @[simp]
          theorem Word.map_append {α : Type u_1} {β : Type u_2} {xs ys : Word α} {f : α → β} :
          map f (xs ++ ys) = map f xs ++ map f ys
          @[simp]
          theorem Word.get_succ_cons {α : Type u_1} {xs : Word α} {x : α} {n : ℕ} {h : ∀ (n_1 : ℕ), (cons x xs).length? = some n_1 → n + 1 < n_1} :
          (cons x xs).get (n + 1) h = xs.get n ⋯
          theorem Word.get?_ofList_append_eq_ite {α : Type u_1} {ys : Word α} {xs : List α} {n : ℕ} :
          (ofList xs ++ ys).get? n = if h : n < xs.length then some xs[n] else ys.get? (n - xs.length)
          @[simp]
          theorem Word.get?_drop {α : Type u_1} {xs : Word α} {n k : ℕ} :
          (drop n xs).get? k = xs.get? (n + k)
          @[simp]
          theorem Word.get?_tail {α : Type u_1} {xs : Word α} {n : ℕ} :
          xs.tail.get? n = xs.get? (n + 1)
          @[simp]
          theorem Word.tail_ofSeq {α : Type u_1} {a : ℕ → α} :
          (ofSeq a).tail = ofSeq fun (x : ℕ) => a (x + 1)
          theorem Word.ofGet?_spec {α : Type u_1} {β : Type u_2} {xs : Word α} (f : Word α → ℕ → Option β) (h : ∀ (N n : ℕ), N < n → f xs N = none → f xs n = none) :
          (ofGet? (f xs)).get? = f xs
          theorem Word.drop_add {α : Type u_1} {xs : Word α} {n m : ℕ} :
          drop (n + m) xs = drop m (drop n xs)
          theorem Word.drop_add' {α : Type u_1} {xs : Word α} {n m : ℕ} :
          drop (n + m) xs = drop n (drop m xs)
          theorem Word.take_drop {α : Type u_1} {xs : Word α} {n k : ℕ} :
          take k (drop n xs) = List.drop n (take (n + k) xs)
          theorem Word.take_add {α : Type u_1} {xs : Word α} {n m : ℕ} :
          take (n + m) xs = take n xs ++ take m (drop n xs)
          theorem Word.take_add' {α : Type u_1} {xs : Word α} {n m : ℕ} :
          take (n + m) xs = take m xs ++ take n (drop m xs)
          @[simp]
          theorem Word.length_take_le {α : Type u_1} {xs : Word α} {n : ℕ} :
          (take n xs).length ≤ n
          theorem Word.le_length_take_iff_eq {α : Type u_1} {xs : Word α} {n : ℕ} :
          n ≤ (take n xs).length ↔ n = (take n xs).length
          @[simp]
          theorem Word.self_eq_length_take_iff {α : Type u_1} {xs : Word α} {n : ℕ} :
          n = (take n xs).length ↔ ∀ (h : xs.length? ≠ none), n ≤ xs.length h
          @[simp]
          theorem Word.length_take_eq_self_iff {α : Type u_1} {xs : Word α} {n : ℕ} :
          (take n xs).length = n ↔ ∀ (h : xs.length? ≠ none), n ≤ xs.length h
          @[simp]
          theorem Word.le_length_take_iff {α : Type u_1} {xs : Word α} {n : ℕ} :
          n ≤ (take n xs).length ↔ ∀ (h : xs.length? ≠ none), n ≤ xs.length h
          theorem Word.wf_batches' {α : Type u_1} {xs : Word α} {n : ℕ} (i : ℕ) :
          xs.batches' n i = none → ∀ (j : ℕ), i < j → xs.batches' n j = none
          theorem Word.get?_batches {α : Type u_1} {xs : Word α} {n : ℕ} :
          (xs.batches n).get? = xs.batches' n
          theorem Word.batches_eq {α : Type u_1} {xs : Word α} {n : ℕ} :
          xs.batches n = { get? := xs.batches' n, wf := ⋯ }
          @[simp]
          theorem Word.batches_ofList {α : Type u_1} {xs : List α} {n : ℕ} :
          (ofList xs).batches n = ofList (xs.batches n)
          theorem Word.batches_ofSeq {α : Type u_1} {a : ℕ → α} {n : ℕ} (hn : n ≠ 0) :
          (ofSeq a).batches n = ofSeq fun (k : ℕ) => mkList n fun (i : ℕ) => a (n * k + i)
          @[simp]
          theorem Word.batches_zero {α : Type u_1} {xs : Word α} :
          @[simp]
          theorem Word.batches_nil {α : Type u_1} {n : ℕ} :
          theorem Word.batches_of_length_lt {α : Type u_1} {xs : Word α} {n : ℕ} (h : ∃ (h₁ : xs.length? ≠ none), xs.length h₁ < n) :