File: .lake/packages/lean4/src/lean/Init/Omega/IntList.lean

full_name: Lean.Omega.IntList
code: /--
A type synonym for `List Int`, used by `omega` for dense representation of coefficients.

We define algebraic operations,
interpreting `List Int` as a finitely supported function `Nat → Int`.
-/
abbrev IntList 
goal: Type

full_name: Lean.Omega.IntList.get
code: /-- Get the `i`-th element (interpreted as `0` if the list is not long enough). -/
def get (xs : IntList) (i : Nat) : Int 
goal: Int

full_name: Lean.Omega.IntList.get_nil
code: @[simp] theorem get_nil : get ([] : IntList) i = 0 
goal: Lean.Omega.IntList.get [] i = 0

full_name: Lean.Omega.IntList.get_cons_zero
code: @[simp] theorem get_cons_zero : get (x :: xs) 0 = x 
goal: Lean.Omega.IntList.get (x :: xs) 0 = x

full_name: Lean.Omega.IntList.get_cons_succ
code: @[simp] theorem get_cons_succ : get (x :: xs) (i+1) = get xs i 
goal: Lean.Omega.IntList.get (x :: xs) (i + 1) = Lean.Omega.IntList.get xs i

full_name: Lean.Omega.IntList.get_map
code: theorem get_map {xs : IntList} (h : f 0 = 0) : get (xs.map f) i = f (xs.get i) 
goal: Lean.Omega.IntList.get (List.map f xs) i = f (xs.get i)

full_name: Lean.Omega.IntList.get_of_length_le
code: theorem get_of_length_le {xs : IntList} (h : xs.length ≤ i) : xs.get i = 0 
goal: xs.get i = 0

full_name: Lean.Omega.IntList.set
code: /-- Like `List.set`, but right-pad with zeroes as necessary first. -/
def set (xs : IntList) (i : Nat) (y : Int) : IntList 
goal: Lean.Omega.IntList

full_name: Lean.Omega.IntList.set_nil_zero
code: @[simp] theorem set_nil_zero : set [] 0 y = [y] 
goal: Lean.Omega.IntList.set [] 0 y = [y]

full_name: Lean.Omega.IntList.set_nil_succ
code: @[simp] theorem set_nil_succ : set [] (i+1) y = 0 :: set [] i y 
goal: Lean.Omega.IntList.set [] (i + 1) y = 0 :: Lean.Omega.IntList.set [] i y

full_name: Lean.Omega.IntList.set_cons_zero
code: @[simp] theorem set_cons_zero : set (x :: xs) 0 y = y :: xs 
goal: Lean.Omega.IntList.set (x :: xs) 0 y = y :: xs

full_name: Lean.Omega.IntList.set_cons_succ
code: @[simp] theorem set_cons_succ : set (x :: xs) (i+1) y = x :: set xs i y 
goal: Lean.Omega.IntList.set (x :: xs) (i + 1) y = x :: Lean.Omega.IntList.set xs i y

full_name: Lean.Omega.IntList.leading
code: /-- Returns the leading coefficient, i.e. the first non-zero entry. -/
def leading (xs : IntList) : Int 
goal: Int

full_name: Lean.Omega.IntList.add
code: /-- Implementation of `+` on `IntList`. -/
def add (xs ys : IntList) : IntList 
goal: Lean.Omega.IntList

full_name: Lean.Omega.IntList.instAdd
code: instance : Add IntList 
goal: Add Lean.Omega.IntList

full_name: Lean.Omega.IntList.add_def
code: theorem add_def (xs ys : IntList) :
    xs + ys = List.zipWithAll (fun x y => x.getD 0 + y.getD 0) xs ys 
goal: xs + ys = List.zipWithAll (fun x y => x.getD 0 + y.getD 0) xs ys

full_name: Lean.Omega.IntList.add_get
code: @[simp] theorem add_get (xs ys : IntList) (i : Nat) : (xs + ys).get i = xs.get i + ys.get i 
goal: (xs + ys).get i = xs.get i + ys.get i

full_name: Lean.Omega.IntList.add_nil
code: @[simp] theorem add_nil (xs : IntList) : xs + [] = xs 
goal: xs + [] = xs

full_name: Lean.Omega.IntList.nil_add
code: @[simp] theorem nil_add (xs : IntList) : [] + xs = xs 
goal: [] + xs = xs

full_name: Lean.Omega.IntList.cons_add_cons
code: @[simp] theorem cons_add_cons (x) (xs : IntList) (y) (ys : IntList) :
    (x :: xs) + (y :: ys) = (x + y) :: (xs + ys) 
goal: x :: xs + y :: ys = (x + y) :: (xs + ys)

full_name: Lean.Omega.IntList.mul
code: /-- Implementation of `*` on `IntList`. -/
def mul (xs ys : IntList) : IntList 
goal: Lean.Omega.IntList

full_name: Lean.Omega.IntList.instMul
code: instance : Mul IntList 
goal: Mul Lean.Omega.IntList

full_name: Lean.Omega.IntList.mul_def
code: theorem mul_def (xs ys : IntList) : xs * ys = List.zipWith (· * ·) xs ys 
goal: xs * ys = List.zipWith (fun x x_1 => x * x_1) xs ys

full_name: Lean.Omega.IntList.mul_get
code: @[simp] theorem mul_get (xs ys : IntList) (i : Nat) : (xs * ys).get i = xs.get i * ys.get i 
goal: (xs * ys).get i = xs.get i * ys.get i

full_name: Lean.Omega.IntList.mul_nil_left
code: @[simp] theorem mul_nil_left : ([] : IntList) * ys = [] 
goal: [] * ys = []

full_name: Lean.Omega.IntList.mul_nil_right
code: @[simp] theorem mul_nil_right : xs * ([] : IntList) = [] 
goal: xs * [] = []

full_name: Lean.Omega.IntList.mul_cons₂
code: @[simp] theorem mul_cons₂ : (x::xs : IntList) * (y::ys) = (x * y) :: (xs * ys) 
goal: (x :: xs) * (y :: ys) = x * y :: xs * ys

full_name: Lean.Omega.IntList.neg
code: /-- Implementation of negation on `IntList`. -/
def neg (xs : IntList) : IntList 
goal: Lean.Omega.IntList

full_name: Lean.Omega.IntList.instNeg
code: instance : Neg IntList 
goal: Neg Lean.Omega.IntList

full_name: Lean.Omega.IntList.neg_def
code: theorem neg_def (xs : IntList) : - xs = xs.map fun x => -x 
goal: -xs = List.map (fun x => -x) xs

full_name: Lean.Omega.IntList.neg_get
code: @[simp] theorem neg_get (xs : IntList) (i : Nat) : (- xs).get i = - xs.get i 
goal: (-xs).get i = -xs.get i

full_name: Lean.Omega.IntList.neg_nil
code: @[simp] theorem neg_nil : (- ([] : IntList)) = [] 
goal: -[] = []

full_name: Lean.Omega.IntList.neg_cons
code: @[simp] theorem neg_cons : (- (x::xs : IntList)) = -x :: -xs 
goal: -(x :: xs) = -x :: -xs

full_name: Lean.Omega.IntList.sub
code: /-- Implementation of subtraction on `IntList`. -/
def sub (xs ys : IntList) : IntList 
goal: Lean.Omega.IntList

full_name: Lean.Omega.IntList.instSub
code: instance : Sub IntList 
goal: Sub Lean.Omega.IntList

full_name: Lean.Omega.IntList.sub_def
code: theorem sub_def (xs ys : IntList) :
    xs - ys = List.zipWithAll (fun x y => x.getD 0 - y.getD 0) xs ys 
goal: xs - ys = List.zipWithAll (fun x y => x.getD 0 - y.getD 0) xs ys

full_name: Lean.Omega.IntList.smul
code: /-- Implementation of scalar multiplication by an integer on `IntList`. -/
def smul (xs : IntList) (i : Int) : IntList 
goal: Lean.Omega.IntList

full_name: Lean.Omega.IntList.instHMulInt
code: instance : HMul Int IntList IntList 
goal: HMul Int Lean.Omega.IntList Lean.Omega.IntList

full_name: Lean.Omega.IntList.smul_def
code: theorem smul_def (xs : IntList) (i : Int) : i * xs = xs.map fun x => i * x 
goal: i * xs = List.map (fun x => i * x) xs

full_name: Lean.Omega.IntList.smul_get
code: @[simp] theorem smul_get (xs : IntList) (a : Int) (i : Nat) : (a * xs).get i = a * xs.get i 
goal: (a * xs).get i = a * xs.get i

full_name: Lean.Omega.IntList.smul_nil
code: @[simp] theorem smul_nil {i : Int} : i * ([] : IntList) = [] 
goal: i * [] = []

full_name: Lean.Omega.IntList.smul_cons
code: @[simp] theorem smul_cons {i : Int} : i * (x::xs : IntList) = i * x :: i * xs 
goal: i * (x :: xs) = i * x :: i * xs

full_name: Lean.Omega.IntList.combo
code: /-- A linear combination of two `IntList`s. -/
def combo (a : Int) (xs : IntList) (b : Int) (ys : IntList) : IntList 
goal: Lean.Omega.IntList

full_name: Lean.Omega.IntList.combo_eq_smul_add_smul
code: theorem combo_eq_smul_add_smul (a : Int) (xs : IntList) (b : Int) (ys : IntList) :
    combo a xs b ys = a * xs + b * ys 
goal: Lean.Omega.IntList.combo a xs b ys = a * xs + b * ys

full_name: Lean.Omega.IntList.mul_distrib_left
code: theorem mul_distrib_left (xs ys zs : IntList) : (xs + ys) * zs = xs * zs + ys * zs 
goal: (xs + ys) * zs = xs * zs + ys * zs

full_name: Lean.Omega.IntList.mul_neg_left
code: theorem mul_neg_left (xs ys : IntList) : (-xs) * ys = -(xs * ys) 
goal: -xs * ys = -(xs * ys)

full_name: Lean.Omega.IntList.sub_eq_add_neg
code: theorem sub_eq_add_neg (xs ys : IntList) : xs - ys = xs + (-ys) 
goal: xs - ys = xs + -ys

full_name: Lean.Omega.IntList.mul_smul_left
code: @[simp] theorem mul_smul_left {i : Int} {xs ys : IntList} : (i * xs) * ys = i * (xs * ys) 
goal: i * xs * ys = i * (xs * ys)

full_name: Lean.Omega.IntList.sum
code: /-- The sum of the entries of an `IntList`. -/
def sum (xs : IntList) : Int 
goal: Int

full_name: Lean.Omega.IntList.sum_nil
code: @[simp] theorem sum_nil : sum ([] : IntList) = 0 
goal: Lean.Omega.IntList.sum [] = 0

full_name: Lean.Omega.IntList.sum_cons
code: @[simp] theorem sum_cons : sum (x::xs : IntList) = x + sum xs 
goal: Lean.Omega.IntList.sum (x :: xs) = x + Lean.Omega.IntList.sum xs

full_name: Lean.Omega.IntList.sum_add
code: theorem sum_add (xs ys : IntList) : (xs + ys).sum = xs.sum + ys.sum 
goal: (xs + ys).sum = xs.sum + ys.sum

full_name: Lean.Omega.IntList.sum_neg
code: @[simp]
theorem sum_neg (xs : IntList) : (-xs).sum = -(xs.sum) 
goal: (-xs).sum = -xs.sum

full_name: Lean.Omega.IntList.sum_smul
code: @[simp]
theorem sum_smul (i : Int) (xs : IntList) : (i * xs).sum = i * (xs.sum) 
goal: (i * xs).sum = i * xs.sum

full_name: Lean.Omega.IntList.dot
code: /-- The dot product of two `IntList`s. -/
def dot (xs ys : IntList) : Int 
goal: Int

full_name: Lean.Omega.IntList.dot_nil_left
code: @[local simp] theorem dot_nil_left : dot ([] : IntList) ys = 0 
goal: Lean.Omega.IntList.dot [] ys = 0

full_name: Lean.Omega.IntList.dot_nil_right
code: @[simp] theorem dot_nil_right : dot xs ([] : IntList) = 0 
goal: xs.dot [] = 0

full_name: Lean.Omega.IntList.dot_cons₂
code: @[simp] theorem dot_cons₂ : dot (x::xs) (y::ys) = x * y + dot xs ys 
goal: Lean.Omega.IntList.dot (x :: xs) (y :: ys) = x * y + Lean.Omega.IntList.dot xs ys

full_name: Lean.Omega.IntList.dot_set_left
code: @[simp] theorem dot_set_left (xs ys : IntList) (i : Nat) (z : Int) :
    dot (xs.set i z) ys = dot xs ys + (z - xs.get i) * ys.get i 
goal: (xs.set i z).dot ys = xs.dot ys + (z - xs.get i) * ys.get i

full_name: Lean.Omega.IntList.dot_distrib_left
code: theorem dot_distrib_left (xs ys zs : IntList) : (xs + ys).dot zs = xs.dot zs + ys.dot zs 
goal: (xs + ys).dot zs = xs.dot zs + ys.dot zs

full_name: Lean.Omega.IntList.dot_neg_left
code: @[simp] theorem dot_neg_left (xs ys : IntList) : (-xs).dot ys = -(xs.dot ys) 
goal: (-xs).dot ys = -xs.dot ys

full_name: Lean.Omega.IntList.dot_smul_left
code: @[simp] theorem dot_smul_left (xs ys : IntList) (i : Int) : (i * xs).dot ys = i * xs.dot ys 
goal: (i * xs).dot ys = i * xs.dot ys

full_name: Lean.Omega.IntList.dot_of_left_zero
code: theorem dot_of_left_zero (w : ∀ x, x ∈ xs → x = 0) : dot xs ys = 0 
goal: xs.dot ys = 0

full_name: Lean.Omega.IntList.sdiv
code: /-- Division of an `IntList` by a integer. -/
def sdiv (xs : IntList) (g : Int) : IntList 
goal: Lean.Omega.IntList

full_name: Lean.Omega.IntList.sdiv_nil
code: @[simp] theorem sdiv_nil : sdiv [] g = [] 
goal: Lean.Omega.IntList.sdiv [] g = []

full_name: Lean.Omega.IntList.sdiv_cons
code: @[simp] theorem sdiv_cons : sdiv (x::xs) g = (x / g) :: sdiv xs g 
goal: Lean.Omega.IntList.sdiv (x :: xs) g = x / g :: Lean.Omega.IntList.sdiv xs g

full_name: Lean.Omega.IntList.gcd
code: /-- The gcd of the absolute values of the entries of an `IntList`. -/
def gcd (xs : IntList) : Nat 
goal: Nat

full_name: Lean.Omega.IntList.gcd_nil
code: @[simp] theorem gcd_nil : gcd [] = 0 
goal: Lean.Omega.IntList.gcd [] = 0

full_name: Lean.Omega.IntList.gcd_cons
code: @[simp] theorem gcd_cons : gcd (x :: xs) = Nat.gcd x.natAbs (gcd xs) 
goal: Lean.Omega.IntList.gcd (x :: xs) = x.natAbs.gcd (Lean.Omega.IntList.gcd xs)

full_name: Lean.Omega.IntList.gcd_cons_div_left
code: theorem gcd_cons_div_left : (gcd (x::xs) : Int) ∣ x 
goal: ↑(Lean.Omega.IntList.gcd (x :: xs)) ∣ x

full_name: Lean.Omega.IntList.gcd_cons_div_right
code: theorem gcd_cons_div_right : gcd (x::xs) ∣ gcd xs 
goal: Lean.Omega.IntList.gcd (x :: xs) ∣ Lean.Omega.IntList.gcd xs

full_name: Lean.Omega.IntList.gcd_cons_div_right'
code: theorem gcd_cons_div_right' : (gcd (x::xs) : Int) ∣ (gcd xs : Int) 
goal: ↑(Lean.Omega.IntList.gcd (x :: xs)) ∣ ↑(Lean.Omega.IntList.gcd xs)

full_name: Lean.Omega.IntList.gcd_dvd
code: theorem gcd_dvd (xs : IntList) {a : Int} (m : a ∈ xs) : (xs.gcd : Int) ∣ a 
goal: ↑xs.gcd ∣ a

full_name: Lean.Omega.IntList.dvd_gcd
code: theorem dvd_gcd (xs : IntList) (c : Nat) (w : ∀ {a : Int}, a ∈ xs → (c : Int) ∣ a) :
    c ∣ xs.gcd 
goal: c ∣ xs.gcd

full_name: Lean.Omega.IntList.gcd_eq_iff
code: theorem gcd_eq_iff (xs : IntList) (g : Nat) :
    xs.gcd = g ↔
      (∀ {a : Int}, a ∈ xs → (g : Int) ∣ a) ∧
        (∀ (c : Nat), (∀ {a : Int}, a ∈ xs → (c : Int) ∣ a) → c ∣ g) 
goal: xs.gcd = g ↔ (∀ {a : Int}, a ∈ xs → ↑g ∣ a) ∧ ∀ (c : Nat), (∀ {a : Int}, a ∈ xs → ↑c ∣ a) → c ∣ g

full_name: Lean.Omega.IntList.gcd_eq_zero
code: @[simp] theorem gcd_eq_zero (xs : IntList) : xs.gcd = 0 ↔ ∀ x, x ∈ xs → x = 0 
goal: xs.gcd = 0 ↔ ∀ (x : Int), x ∈ xs → x = 0

full_name: Lean.Omega.IntList.dot_mod_gcd_left
code: @[simp] theorem dot_mod_gcd_left (xs ys : IntList) : dot xs ys % xs.gcd = 0 
goal: xs.dot ys % ↑xs.gcd = 0

full_name: Lean.Omega.IntList.gcd_dvd_dot_left
code: theorem gcd_dvd_dot_left (xs ys : IntList) : (xs.gcd : Int) ∣ dot xs ys 
goal: ↑xs.gcd ∣ xs.dot ys

full_name: Lean.Omega.IntList.dot_eq_zero_of_left_eq_zero
code: @[simp]
theorem dot_eq_zero_of_left_eq_zero {xs ys : IntList} (h : ∀ x, x ∈ xs → x = 0) : dot xs ys = 0 
goal: xs.dot ys = 0

full_name: Lean.Omega.IntList.dot_sdiv_left
code: theorem dot_sdiv_left (xs ys : IntList) {d : Int} (h : d ∣ xs.gcd) :
    dot (xs.sdiv d) ys = (dot xs ys) / d 
goal: (xs.sdiv d).dot ys = xs.dot ys / d

full_name: Lean.Omega.IntList.bmod
code: /-- Apply "balanced mod" to each entry in an `IntList`. -/
abbrev bmod (x : IntList) (m : Nat) : IntList 
goal: Lean.Omega.IntList

full_name: Lean.Omega.IntList.bmod_length
code: theorem bmod_length (x : IntList) (m) : (bmod x m).length ≤ x.length 
goal: List.length (x.bmod m) ≤ List.length x

full_name: Lean.Omega.IntList.bmod_dot_sub_dot_bmod
code: /--
The difference between the balanced mod of a dot product,
and the dot product with balanced mod applied to each entry of the left factor.
-/
abbrev bmod_dot_sub_dot_bmod (m : Nat) (a b : IntList) : Int 
goal: Int

full_name: Lean.Omega.IntList.dvd_bmod_dot_sub_dot_bmod
code: theorem dvd_bmod_dot_sub_dot_bmod (m : Nat) (xs ys : IntList) :
    (m : Int) ∣ bmod_dot_sub_dot_bmod m xs ys 
goal: ↑m ∣ Lean.Omega.IntList.bmod_dot_sub_dot_bmod m xs ys