-- ArkLib/Data/CodingTheory/BerlekampWelch/Condition.lean

import Init.Data.List.FinRange

import Mathlib.Algebra.Field.Basic

import Mathlib.Algebra.Polynomial.Basic

import Mathlib.Algebra.Polynomial.Degree.Definitions

import Mathlib.Algebra.Polynomial.FieldDivision

import Mathlib.Data.Finset.Insert

import Mathlib.Data.Fintype.Card

import Mathlib.Data.Matrix.Mul

import Mathlib.Data.Matrix.Reflection

import ArkLib.Data.CodingTheory.Basic

import ArkLib.Data.Polynomial.Interface

import ArkLib.Data.CodingTheory.BerlekampWelch.ElocPoly

import ArkLib.Data.CodingTheory.BerlekampWelch.Sorries

namespace BerlekampWelch

variable {α : Type} {F : Type} [Field F]
         {n e k : ℕ}
         {i : Fin n}
         {j : Fin (2 * e + k)}
         {ωs f : Fin n → F}
         {v : Fin (2 * e + k) → F}
         {E Q : Polynomial F}
         {p : Polynomial F}

section

open Polynomial Finset in

open Fin

open Polynomial

variable [DecidableEq F]

def solutionToQ (e k : ℕ) (v : Fin (2 * e + k) → F) : Polynomial F :=
  ⟨
    (Finset.range (e + k)).filter (fun x => liftF v (e + x) ≠ 0),
    fun i => if i < e + k then liftF v (e + i) else 0,
    by admit /- proof elided -/
  ⟩

-- Repository definitions used:
content: def liftF (f : Fin n → α) : ℕ → α :=
  fun m ↦ if h : m < n then f ⟨m, h⟩ else 0

-- Repository lemmas used:
content: theorem List.getElem_append_left{α : Type u_1} {l₁ l₂ : List α} {i : Nat} (hn : i < l₁.length) :\n(l₁ ++ l₂)[i] = l₁[i]

-- Local definitions used:
content: def solutionToQ (e k : ℕ) (v : Fin (2 * e + k) → F) : Polynomial F :=
  ⟨
    (Finset.range (e + k)).filter (fun x => liftF v (e + x) ≠ 0),
    fun i => if i < e + k then liftF v (e + i) else 0,
    by admit /- proof elided -/
  ⟩

-- Local lemmas used:

-- Target theorem and proof:
@[simp]
lemma solutionToQ_zero {v : Fin (2 * 0 + 0) → F} :
  solutionToQ (F := F) 0 0 v = 0 := rfl
:= rfl