Documentation

Projects.Kolakoski.Inverse

def Kolakoski.fInv {α : Type u_1} [ha : DecidableEq α] (xs : List α) :
Equations
Instances For
    @[simp]
    theorem Kolakoski.fInv_nil {α : Type u_1} [ha : DecidableEq α] :
    @[simp]
    theorem Kolakoski.fInv_singleton {α : Type u_1} [ha : DecidableEq α] {x : α} :
    @[simp]
    theorem Kolakoski.fInv_replicate {α : Type u_1} [ha : DecidableEq α] {n : ℕ} {x : α} :
    @[simp]
    theorem Kolakoski.fInv_eq_nil_iff {α : Type u_1} {xs : List α} [ha : DecidableEq α] :
    fInv xs = [] ↔ xs = []
    theorem Kolakoski.fInv_cons_cons_of_ne {α : Type u_1} {xs : List α} [ha : DecidableEq α] {x y : α} (h : x ≠ y) :
    fInv (x :: y :: xs) = 1 :: fInv (y :: xs)
    theorem Kolakoski.fInv_append {α : Type u_1} {xs ys : List α} [ha : DecidableEq α] (h : ∀ (h₁ : xs ≠ []) (h₂ : ys ≠ []), xs.getLast h₁ ≠ ys.head h₂) :
    fInv (xs ++ ys) = fInv xs ++ fInv ys
    theorem Kolakoski.fInv_map {α : Type u_1} {β : Type u_2} {xs : List α} [ha : DecidableEq α] [hb : DecidableEq β] {f : α → β} (h : ∀ x ∈ xs, ∀ y ∈ xs, f x = f y → x = y) :
    fInv (List.map f xs) = fInv xs
    theorem Kolakoski.map_add_range_eq_map_f₁ {xs : List ℕ} {n k : ℕ} :
    List.flatMap (fun (x : ℕ × ℕ) => List.replicate x.1 (if Even x.2 then 1 else 2)) (xs.zip (List.map (fun (x : ℕ) => x + k) (List.range n))) = List.map (if Even k then id else fun (x : ℕ) => 3 - x) (f₁ (List.take n xs))
    theorem Kolakoski.eq_or_eq_of_mem_f₁ {xs : List ℕ} {k : ℕ} (h : k ∈ f₁ xs) :
    k = 1 ∨ k = 2
    theorem Kolakoski.fInv_f₁ {xs : List ℕ} (h : 0 ∉ xs) :
    fInv (f₁ xs) = xs
    @[simp]
    theorem Kolakoski.fInv_f₁_of_kolIter {xs : List ℕ} [h : KolIter xs] :
    fInv (f₁ xs) = xs
    @[simp]
    theorem Kolakoski.f₁_cons_cons {x y : ℕ} {xs : List ℕ} :
    theorem Kolakoski.f₁_step {xs : List ℕ} :
    f₁ xs = match xs with | [] => [] | [x] => List.replicate x 1 | x :: y :: xs => List.replicate x 1 ++ List.replicate y 2 ++ f₁ xs
    theorem Kolakoski.f₁_eq_nil_iff {xs : List ℕ} (h : 0 ∉ xs) :
    f₁ xs = [] ↔ xs = []
    theorem Kolakoski.f₁_cons {x : ℕ} {xs : List ℕ} :
    f₁ (x :: xs) = List.replicate x 1 ++ List.map (fun (x : ℕ) => 3 - x) (f₁ xs)
    theorem Kolakoski.f₁_inj {xs ys : List ℕ} (hx : 0 ∉ xs) (hy : 0 ∉ ys) :
    f₁ xs = f₁ ys ↔ xs = ys
    @[simp]
    theorem Kolakoski.not_zero_mem_fInv {α : Type u_1} {xs : List α} [ha : DecidableEq α] :
    0 ∉ fInv xs
    @[simp]
    theorem Kolakoski.fInv_ne_zero_cons {α : Type u_1} {xs : List α} [ha : DecidableEq α] {ys : List ℕ} :
    fInv xs ≠ 0 :: ys
    @[simp]
    theorem Kolakoski.fInv_eq_singleton_iff {α : Type u_1} {xs : List α} [ha : DecidableEq α] {n : ℕ} :
    fInv xs = [n] ↔ ∃ (h : xs ≠ []), xs = List.replicate n (xs.head h)
    theorem Kolakoski.fInv_inj {α : Type u_1} {xs ys : List α} [ha : DecidableEq α] (c₁ c₂ : α) (h₁ : xs ++ ys ⊆ [c₁, c₂]) (h₂ : xs.head? = ys.head?) :
    fInv xs = fInv ys ↔ xs = ys
    @[simp]
    @[simp]
    theorem Kolakoski.f₁_map_three_sub_three_sub {xs : List ℕ} :
    List.map (fun (x : ℕ) => 3 - (3 - x)) (f₁ xs) = f₁ xs
    theorem Kolakoski.f₁_fInv {xs : List ℕ} (h₁ : xs ⊆ [1, 2]) (h₂ : xs.head? ≠ some 2) :
    f₁ (fInv xs) = xs
    theorem Kolakoski.getElem_f₁_zero {xs : List ℕ} {h₁ : 0 < (f₁ xs).length} (h : xs[0] ≠ 0) :
    (f₁ xs)[0] = 1
    @[simp]
    theorem Kolakoski.three_sub_three_sub_getElem_f₁ {xs : List ℕ} {i : ℕ} {h : i < (f₁ xs).length} :
    3 - (3 - (f₁ xs)[i]) = (f₁ xs)[i]
    theorem Kolakoski.f₁_append {xs ys : List ℕ} :
    f₁ (xs ++ ys) = f₁ xs ++ if Even xs.length then f₁ ys else List.map (fun (x : ℕ) => 3 - x) (f₁ ys)
    @[simp]
    theorem Kolakoski.getElem_f₁_take {xs : List ℕ} {n i : ℕ} {h : i < (f₁ (List.take n xs)).length} :
    (f₁ (List.take n xs))[i] = (f₁ xs)[i]
    theorem Kolakoski.head?_f₁ {xs : List ℕ} (h : 0 ∉ xs) :
    theorem Kolakoski.ne_zero_of_mem_fInv {α : Type u_1} {xs : List α} [ha : DecidableEq α] {k : ℕ} (h : k ∈ fInv xs) :
    k ≠ 0
    @[simp]
    theorem Kolakoski.head_fInv_ne_zero {α : Type u_1} {xs : List α} [ha : DecidableEq α] {h : fInv xs ≠ []} :
    (fInv xs).head h ≠ 0
    @[simp]
    theorem Kolakoski.head!_fInv_cons_ne_zero {α : Type u_1} {xs : List α} [ha : DecidableEq α] {x : α} :
    (fInv (x :: xs)).head! ≠ 0
    @[simp]
    theorem Kolakoski.forall_mem_fInv_imp_eq_zero_iff {α : Type u_1} {xs : List α} [ha : DecidableEq α] :
    (∀ x ∈ fInv xs, x = 0) ↔ xs = []
    theorem Kolakoski.cntrex₁ :
    ¬∀ (xs : List ℕ), mkList xs.sum kolakoski = f₁ xs → 0 ∉ xs → mkList xs.length kolakoski = xs
    theorem Kolakoski.getElem?_zero_f₁_eq_some_iff {xs : List ℕ} {k : ℕ} (h : 0 ∉ xs) :
    (f₁ xs)[0]? = some k ↔ xs ≠ [] ∧ k = 1
    theorem Kolakoski.changesNum_f₁ {xs : List ℕ} (h : 0 ∉ xs) :
    @[simp]
    @[simp]
    theorem Kolakoski.length_fInv {α : Type u_1} {xs : List α} [ha : DecidableEq α] :
    @[simp]
    theorem Kolakoski.sum_fInv {α : Type u_1} {xs : List α} [ha : DecidableEq α] :
    (fInv xs).sum = xs.length
    theorem Kolakoski.getElem_fInv_take {α : Type u_1} {xs : List α} [ha : DecidableEq α] {n i : ℕ} {h : i < (fInv (List.take n xs)).length} (h₁ : n < xs.length) (h₂ : n = 0 ∨ xs[n - 1] ≠ xs[n]) :
    (fInv (List.take n xs))[i] = (fInv xs)[i]
    theorem Kolakoski.cntrex₂ :
    ¬∀ (xs : List ℕ), mkList xs.sum kolakoski = f₁ xs → 0 ∉ xs → xs = [] ∨ kolakoski (xs.length - 1) ≠ kolakoski xs.length → mkList xs.length kolakoski = xs
    theorem Kolakoski.mkList_length_kolakoski_eq_of_mkList_sum_eq {xs : List ℕ} (h₁ : mkList xs.sum kolakoski = f₁ xs) (h₂ : 0 ∉ xs) (h₃ : xs = [] ∨ kolakoski (xs.sum - 1) ≠ kolakoski xs.sum) :
    theorem Kolakoski.seqPrefix_of_seqPrefix_f₁ {xs : List ℕ} (h₁ : SeqPrefix (f₁ xs) kolakoski) (h₂ : 0 ∉ xs) (h₃ : xs = [] ∨ kolakoski (xs.sum - 1) ≠ kolakoski xs.sum) :
    theorem Kolakoski.kolakoski_sub_one_eq_ite_of_sum_eq {n i : ℕ} (h : (mkList n kolakoski).sum = i) (h₀ : n ≠ 0) :
    kolakoski (i - 1) = if Even n then 2 else 1
    theorem Kolakoski.cntrex₃ :
    ¬∀ (xs : List ℕ), mkList xs.sum kolakoski = f₁ xs → 0 ∉ xs → (∀ x ∈ xs, x = 0) ∨ kolakoski (xs.sum - 1) ≠ kolakoski xs.sum