Documentation

Projects.Kolakoski.SeqFun

noncomputable def Kolakoski.fSeq :
(ℕ → ℕ) → ℕ → ℕ
Equations
Instances For
    noncomputable def Kolakoski.fInvSeq {α : Type u_1} :
    (ℕ → α) → ℕ → ℕ
    Equations
    Instances For
      noncomputable def Kolakoski.fWord :
      Equations
      Instances For
        @[simp]
        theorem Kolakoski.getElem_f₁_mkList_eq_simp {a : ℕ → ℕ} {n m i : ℕ} {h₁ : i < (f₁ (mkList n a)).length} {h₂ : i < (f₁ (mkList m a)).length} :
        (f₁ (mkList n a))[i] = (f₁ (mkList m a))[i] ↔ True
        @[simp]
        theorem Kolakoski.Diverse.changesNum_mkList_runs {α : Type u_1} {a : ℕ → α} [ha : Diverse a] (k : ℕ) :
        (mkList (runs a k) a).changesNum = k
        theorem Kolakoski.Diverse.exi_changesNum {α : Type u_1} {a : ℕ → α} [ha : Diverse a] (k : ℕ) :
        ∃ (n : ℕ), (mkList n a).changesNum = k
        @[simp]
        theorem Kolakoski.seqFunCnd_fSeq :
        SeqFunCnd (fun (x : ℕ → ℕ) => ∀ (i : ℕ), x i ≠ 0) f₁ fSeq
        @[simp]
        @[simp]
        theorem Kolakoski.fInvWord_ofList {α : Type u_1} [ha : DecidableEq α] {xs : List α} :
        @[simp]
        theorem Kolakoski.fInvWord_ofSeq {α : Type u_1} {a : ℕ → α} :
        theorem Kolakoski.fSeq_eq_getElem_proof₁ {a : ℕ → ℕ} {n : ℕ} (h : ∀ (n : ℕ), a n ≠ 0) :
        n < (f₁ (mkList (n + 1) a)).length
        theorem Kolakoski.fSeq_eq_getElem {a : ℕ → ℕ} {n : ℕ} (h : ∀ (n : ℕ), a n ≠ 0) :
        fSeq a n = (f₁ (mkList (n + 1) a))[n]
        theorem Kolakoski.fWord_step {xs : Word ℕ} (h : 0 ∉ xs) :
        theorem Kolakoski.fInvSeq_eq_getElem {α : Type u_1} [ha₀ : DecidableEq α] {a : ℕ → α} {n : ℕ} [ha : Diverse a] :
        fInvSeq a n = (fInv (mkList (runs a (n + 1)) a))[n]
        theorem Kolakoski.fInvSeq_eq_getElem_fun {α : Type u_1} [ha₀ : DecidableEq α] {a : ℕ → α} [ha : Diverse a] :
        fInvSeq a = fun (n : ℕ) => (fInv (mkList (runs a (n + 1)) a))[n]
        @[simp]
        theorem Kolakoski.Diverse.runs_pred_ne_iff {α : Type u_1} {a : ℕ → α} {n : ℕ} [ha : Diverse a] :
        a (runs a n - 1) ≠ a (runs a n) ↔ n ≠ 0
        @[simp]
        theorem Kolakoski.Diverse.ne_runs_pred_iff {α : Type u_1} {a : ℕ → α} {n : ℕ} [ha : Diverse a] :
        a (runs a n) ≠ a (runs a n - 1) ↔ n ≠ 0
        @[simp]
        theorem Kolakoski.Diverse.fInv_mkList_runs_one {α : Type u_1} {a : ℕ → α} [ha₀ : DecidableEq α] [ha : Diverse a] :
        fInv (mkList (runs a 1) a) = [runs a 1]
        theorem Kolakoski.Diverse.fInv_mkList_runs {α : Type u_1} {a : ℕ → α} {n : ℕ} [ha₀ : DecidableEq α] [ha : Diverse a] :
        fInv (mkList (runs a n) a) = mkList n fun (n : ℕ) => runs a (n + 1) - runs a n
        theorem Kolakoski.Diverse.fInv_mkList_runs_succ' {α : Type u_1} {a : ℕ → α} {n : ℕ} [ha₀ : DecidableEq α] [ha : Diverse a] :
        fInv (mkList (runs a (n + 1)) a) = runs a 1 :: fInv (mkList (runs (fun (x : ℕ) => a (x + runs a 1)) n) fun (x : ℕ) => a (x + runs a 1))
        theorem Kolakoski.fInvWord_step {α : Type u_1} {a : ℕ → α} [ha : Diverse a] :
        fInvWord (Word.ofSeq a) = Word.cons (runs a 1) (fInvWord (Word.ofSeq fun (x : ℕ) => a (x + runs a 1)))
        theorem Kolakoski.fSeq_zero {a : ℕ → ℕ} (ha : ∀ (n : ℕ), a n ≠ 0) :
        fSeq a 0 = 1
        theorem Kolakoski.getElem_zero_f₁ {a : ℕ → ℕ} {n : ℕ} {h : 0 < (f₁ (mkList n a)).length} (ha : a 0 ≠ 0) :
        (f₁ (mkList n a))[0] = 1
        theorem Kolakoski.get?_fWord_eq_or_eq {xs : Word ℕ} {n c : ℕ} (h : 0 ∉ xs) (h₁ : (fWord xs).get? n = some c) :
        c = 1 ∨ c = 2
        theorem Kolakoski.fWord_cons {xs : Word ℕ} {x : ℕ} (h₁ : 0 ∉ xs) (h₂ : x ≠ 0) :
        fWord (Word.cons x xs) = Word.ofList (List.replicate x 1) ++ Word.map (fun (x : ℕ) => 3 - x) (fWord xs)
        @[simp]
        theorem Kolakoski.three_sub_getElem_f₁_eq_iff {xs ys : List ℕ} {n m : ℕ} {h₁ : n < (f₁ xs).length} {h₂ : m < (f₁ ys).length} :
        3 - (f₁ xs)[n] = 3 - (f₁ ys)[m] ↔ (f₁ xs)[n] = (f₁ ys)[m]
        theorem Kolakoski.diverse_fSeq {a : ℕ → ℕ} (ha : ∀ (n : ℕ), a n ≠ 0) :
        theorem Kolakoski.fSeq_eq_getElem_fun {a : ℕ → ℕ} (ha : ∀ (n : ℕ), a n ≠ 0) :
        fSeq a = fun (n : ℕ) => (f₁ (mkList (n + 1) a))[n]
        theorem Kolakoski.fSeq_seq_zero {a : ℕ → ℕ} (ha : ∀ (n : ℕ), a n ≠ 0) :
        fSeq a (a 0) = 2
        theorem Kolakoski.fSeq_of_lt_seq_zero {a : ℕ → ℕ} {n : ℕ} (ha : ∀ (n : ℕ), a n ≠ 0) (hn : n < a 0) :
        fSeq a n = 1
        theorem Kolakoski.fSeq_seq_zero_add {a : ℕ → ℕ} {n : ℕ} (ha : ∀ (n : ℕ), a n ≠ 0) :
        fSeq a (a 0 + n) = 3 - fSeq (fun (x : ℕ) => a (x + 1)) n
        theorem Kolakoski.diverse_map {α : Type u_1} {β : Type u_2} {a : ℕ → α} {f : α → β} [ha : Diverse a] (h : ∀ (n m : ℕ), f (a n) = f (a m) → a n = a m) :
        Diverse fun (x : ℕ) => f (a x)
        @[simp]
        theorem Kolakoski.Diverse.seq_runs_one_ne_seq_zero {α : Type u_1} {a : ℕ → α} [ha : Diverse a] :
        a (runs a 1) ≠ a 0
        theorem Kolakoski.Diverse.seq_runs_eq_of_lt_runs_one {α : Type u_1} {a : ℕ → α} {n : ℕ} [ha : Diverse a] (h : n < runs a 1) :
        a n = a 0
        theorem Kolakoski.Diverse.runs_eq_map {α : Type u_1} {β : Type u_2} {a : ℕ → α} [ha : Diverse a] (f : α → β) (h : ∀ (n m : ℕ), f (a n) = f (a m) → a n = a m) :
        runs a = runs fun (x : ℕ) => f (a x)
        theorem Kolakoski.three_sub_fSeq_eq_iff {a : ℕ → ℕ} {n m : ℕ} (ha : ∀ (n : ℕ), a n ≠ 0) :
        3 - fSeq a n = 3 - fSeq a m ↔ fSeq a n = fSeq a m
        theorem Kolakoski.runs_fSeq_succ {a : ℕ → ℕ} {n : ℕ} (ha : ∀ (n : ℕ), a n ≠ 0) :
        runs (fSeq a) n = (mkList n a).sum
        theorem Kolakoski.runs_fSeq_one {a : ℕ → ℕ} (ha : ∀ (n : ℕ), a n ≠ 0) :
        runs (fSeq a) 1 = a 0
        theorem Kolakoski.fInvSeq_eq_map {α : Type u_1} {β : Type u_2} {a : ℕ → α} [ha : Diverse a] (f : α → β) (h : ∀ (n m : ℕ), f (a n) = f (a m) → a n = a m) :
        fInvSeq a = fInvSeq fun (x : ℕ) => f (a x)
        @[simp]
        instance Kolakoski.diverse_id :
        Diverse fun (x : ℕ) => x
        theorem Kolakoski.diverse_three_sub_fSeq {a : ℕ → ℕ} (ha : ∀ (n : ℕ), a n ≠ 0) :
        Diverse (3 - fSeq a)
        theorem Kolakoski.fInvSeq_fSeq {a : ℕ → ℕ} (ha : ∀ (n : ℕ), a n ≠ 0) :
        fInvSeq (fSeq a) = a
        @[simp]
        theorem Kolakoski.Diverse.fInvSeq_ne_zero {α : Type u_1} {a : ℕ → α} {n : ℕ} [ha : Diverse a] :
        fInvSeq a n ≠ 0
        theorem Kolakoski.fInvSeq_eq_runs {α : Type u_1} {a : ℕ → α} {n : ℕ} [ha : Diverse a] :
        fInvSeq a n = runs a (n + 1) - runs a n
        theorem Kolakoski.fInvSeq_zero {α : Type u_1} {a : ℕ → α} [ha : Diverse a] :
        fInvSeq a 0 = runs a 1
        theorem Kolakoski.fSeq_fInvSeq {a : ℕ → ℕ} [ha : Diverse a] (h₁ : ∀ (n : ℕ), a n = 1 ∨ a n = 2) (h₂ : a 0 = 1) :
        fSeq (fInvSeq a) = a
        @[simp]
        theorem Kolakoski.f₁_eq_or_eq {xs : List ℕ} {n : ℕ} {h : n < (f₁ xs).length} :
        (f₁ xs)[n] = 1 ∨ (f₁ xs)[n] = 2
        theorem Kolakoski.fSeq_eq_or_eq {a : ℕ → ℕ} {n : ℕ} (ha : ∀ (n : ℕ), a n ≠ 0) :
        fSeq a n = 1 ∨ fSeq a n = 2
        theorem Kolakoski.fSeq_ne_zero {a : ℕ → ℕ} {n : ℕ} (ha : ∀ (n : ℕ), a n ≠ 0) :
        fSeq a n ≠ 0
        theorem Kolakoski.fSeq_eq_self_iff {a : ℕ → ℕ} (ha : ∀ (n : ℕ), a n ≠ 0) :
        theorem Kolakoski.three_sub_getElem_f₁_eq_ite_1 {xs : List ℕ} {n : ℕ} {h : n < (f₁ xs).length} :
        3 - (f₁ xs)[n] = if (f₁ xs)[n] = 1 then 2 else 1
        theorem Kolakoski.three_sub_getElem_f₁_eq_ite_2 {xs : List ℕ} {n : ℕ} {h : n < (f₁ xs).length} :
        3 - (f₁ xs)[n] = if (f₁ xs)[n] = 2 then 1 else 2
        theorem Kolakoski.getElem_f₁_sum {a : ℕ → ℕ} {n k : ℕ} {h₁ : (mkList k a).sum < (f₁ (mkList n a)).length} (h : a k ≠ 0) :
        (f₁ (mkList n a))[(mkList k a).sum] = if Even k then 1 else 2
        theorem Kolakoski.getElem_f₁_sum_of_lt {a : ℕ → ℕ} {n k c : ℕ} {h₁ : (mkList k a).sum + c < (f₁ (mkList n a)).length} (hc : c < a k) :
        (f₁ (mkList n a))[(mkList k a).sum + c] = if Even k then 1 else 2
        theorem Kolakoski.fSeq_inj {a b : ℕ → ℕ} (ha : ∀ (n : ℕ), a n ≠ 0) (hb : ∀ (n : ℕ), b n ≠ 0) :
        fSeq a = fSeq b ↔ a = b
        theorem Kolakoski.fInvSeq_inj {a b : ℕ → ℕ} [ha : Diverse a] [hb : Diverse b] (h₁ : ∀ (n : ℕ), a n = 1 ∨ a n = 2) (h₂ : ∀ (n : ℕ), b n = 1 ∨ b n = 2) (h₃ : a 0 = 1) (h₄ : b 0 = 1) :
        theorem Kolakoski.fInvSeq_eq_self_iff_1 {a : ℕ → ℕ} [ha : Diverse a] (h : ∀ (n : ℕ), a n = 1 ∨ a n = 2) (h₀ : a 0 = 1) :
        theorem Kolakoski.fInvSeq_eq_self_iff_2 {a : ℕ → ℕ} [ha : Diverse a] (h : ∀ (n : ℕ), a n = 1 ∨ a n = 2) (h₀ : a 0 = 2) :
        theorem Kolakoski.fInvSeq_eq_self_iff {a : ℕ → ℕ} [ha : Diverse a] (h : ∀ (n : ℕ), a n = 1 ∨ a n = 2) :
        theorem Kolakoski.fSeq_step {a : ℕ → ℕ} (h : ∀ (n : ℕ), a n ≠ 0) :
        fSeq a = fun (n : ℕ) => if h : n < a 0 + a 1 then (List.replicate (a 0) 1 ++ List.replicate (a 1) 2)[n] else fSeq (fun (x : ℕ) => a (x + 2)) (n - (a 0 + a 1))
        theorem Kolakoski.fSeq_step' {a : ℕ → ℕ} (h : ∀ (n : ℕ), a n ≠ 0) :
        fSeq a = fun (n : ℕ) => if n < a 0 then 1 else 3 - fSeq (fun (x : ℕ) => a (x + 1)) (n - a 0)
        theorem Kolakoski.fInvSeq_step {α : Type u_1} {a : ℕ → α} [ha : Diverse a] :
        fInvSeq a = fun (n : ℕ) => if n = 0 then runs a 1 else fInvSeq (fun (x : ℕ) => a (x + runs a 1)) (n - 1)