File: Mathlib/RingTheory/WittVector/InitTail.lean

full_name: _aux_Mathlib_RingTheory_WittVector_InitTail___unexpand_WittVector_1
code: local notation "𝕎" => WittVector p
goal: Lean.PrettyPrinter.Unexpander

full_name: _aux_Mathlib_RingTheory_WittVector_InitTail___macroRules_term𝕎_1
code: local notation "𝕎" => WittVector p
goal: Lean.Macro

full_name: WittVector.select
code: /-- `WittVector.select P x`, for a predicate `P : ℕ → Prop` is the Witt vector
whose `n`-th coefficient is `x.coeff n` if `P n` is true, and `0` otherwise.
-/
def select (P : ℕ → Prop) (x : 𝕎 R) : 𝕎 R 
goal: 𝕎 R

full_name: WittVector.selectPoly
code: /-- The polynomial that witnesses that `WittVector.select` is a polynomial function.
`selectPoly n` is `X n` if `P n` holds, and `0` otherwise. -/
def selectPoly (n : ℕ) : MvPolynomial ℕ ℤ 
goal: MvPolynomial ℕ ℤ

full_name: WittVector.coeff_select
code: theorem coeff_select (x : 𝕎 R) (n : ℕ) :
    (select P x).coeff n = aeval x.coeff (selectPoly P n) 
goal: (WittVector.select P x).coeff n = (MvPolynomial.aeval x.coeff) (WittVector.selectPoly P n)

full_name: WittVector.select_isPoly
code: instance select_isPoly {P : ℕ → Prop} : IsPoly p fun _ _ x => select P x 
goal: WittVector.IsPoly p fun x x_1 x_2 => WittVector.select P x_2

full_name: WittVector.select_add_select_not
code: theorem select_add_select_not : ∀ x : 𝕎 R, select P x + select (fun i => ¬P i) x = x 
goal: WittVector.select P x + WittVector.select (fun i => ¬P i) x = x

full_name: WittVector.coeff_add_of_disjoint
code: theorem coeff_add_of_disjoint (x y : 𝕎 R) (h : ∀ n, x.coeff n = 0 ∨ y.coeff n = 0) :
    (x + y).coeff n = x.coeff n + y.coeff n 
goal: (x + y).coeff n = x.coeff n + y.coeff n

full_name: WittVector.init
code: /-- `WittVector.init n x` is the Witt vector of which the first `n` coefficients are those from `x`
and all other coefficients are `0`.
See `WittVector.tail` for the complementary part.
-/
def init (n : ℕ) : 𝕎 R → 𝕎 R 
goal: 𝕎 R → 𝕎 R

full_name: WittVector.tail
code: /-- `WittVector.tail n x` is the Witt vector of which the first `n` coefficients are `0`
and all other coefficients are those from `x`.
See `WittVector.init` for the complementary part. -/
def tail (n : ℕ) : 𝕎 R → 𝕎 R 
goal: 𝕎 R → 𝕎 R

full_name: WittVector.init_add_tail
code: @[simp]
theorem init_add_tail (x : 𝕎 R) (n : ℕ) : init n x + tail n x = x 
goal: WittVector.init n x + WittVector.tail n x = x

full_name: WittVector.initRing
code: /--
`init_ring` is an auxiliary tactic that discharges goals factoring `init` over ring operations.
-/
syntax (name := initRing) "init_ring" (" using " term)? : tactic
goal: Lean.ParserDescr

full_name: WittVector._aux_Mathlib_RingTheory_WittVector_InitTail___elabRules_WittVector_initRing_1
code: elab_rules : tactic
| `(tactic| init_ring $[ using $a:term]?) => withMainContext <| set_option hygiene false in do
  evalTactic <|← `(tactic|(
    rw [WittVector.ext_iff]
    intro i
    simp only [WittVector.init, WittVector.select, WittVector.coeff_mk]
    split_ifs with hi <;> try {rfl}
    ))
  if let some e := a then
    evalTactic <|← `(tactic|(
      simp only [WittVector.add_coeff, WittVector.mul_coeff, WittVector.neg_coeff,
        WittVector.sub_coeff, WittVector.nsmul_coeff, WittVector.zsmul_coeff, WittVector.pow_coeff]
      apply MvPolynomial.eval₂Hom_congr' (RingHom.ext_int _ _) _ rfl
      rintro ⟨b, k⟩ h -
      replace h := $e:term p _ h
      simp only [Finset.mem_range, Finset.mem_product, true_and, Finset.mem_univ] at h
      have hk : k < n := by linarith
      fin_cases b <;> simp only [Function.uncurry, Matrix.cons_val_zero, Matrix.head_cons,
        WittVector.coeff_mk, Matrix.cons_val_one, WittVector.mk, Fin.mk_zero, Matrix.cons_val',
        Matrix.empty_val', Matrix.cons_val_fin_one, Matrix.cons_val_zero,
        hk, if_true]
    ))
goal: Lean.Elab.Tactic.Tactic

full_name: WittVector.init_init
code: @[simp]
theorem init_init (x : 𝕎 R) (n : ℕ) : init n (init n x) = init n x 
goal: WittVector.init n (WittVector.init n x) = WittVector.init n x

full_name: WittVector.init_add
code: theorem init_add (x y : 𝕎 R) (n : ℕ) : init n (x + y) = init n (init n x + init n y) 
goal: WittVector.init n (x + y) = WittVector.init n (WittVector.init n x + WittVector.init n y)

full_name: WittVector.init_mul
code: theorem init_mul (x y : 𝕎 R) (n : ℕ) : init n (x * y) = init n (init n x * init n y) 
goal: WittVector.init n (x * y) = WittVector.init n (WittVector.init n x * WittVector.init n y)

full_name: WittVector.init_neg
code: theorem init_neg (x : 𝕎 R) (n : ℕ) : init n (-x) = init n (-init n x) 
goal: WittVector.init n (-x) = WittVector.init n (-WittVector.init n x)

full_name: WittVector.init_sub
code: theorem init_sub (x y : 𝕎 R) (n : ℕ) : init n (x - y) = init n (init n x - init n y) 
goal: WittVector.init n (x - y) = WittVector.init n (WittVector.init n x - WittVector.init n y)

full_name: WittVector.init_nsmul
code: theorem init_nsmul (m : ℕ) (x : 𝕎 R) (n : ℕ) : init n (m • x) = init n (m • init n x) 
goal: WittVector.init n (m • x) = WittVector.init n (m • WittVector.init n x)

full_name: WittVector.init_zsmul
code: theorem init_zsmul (m : ℤ) (x : 𝕎 R) (n : ℕ) : init n (m • x) = init n (m • init n x) 
goal: WittVector.init n (m • x) = WittVector.init n (m • WittVector.init n x)

full_name: WittVector.init_pow
code: theorem init_pow (m : ℕ) (x : 𝕎 R) (n : ℕ) : init n (x ^ m) = init n (init n x ^ m) 
goal: WittVector.init n (x ^ m) = WittVector.init n (WittVector.init n x ^ m)

full_name: WittVector.init_isPoly
code: /-- `WittVector.init n x` is polynomial in the coefficients of `x`. -/
theorem init_isPoly (n : ℕ) : IsPoly p fun _ _ => init n 
goal: WittVector.IsPoly p fun x x_1 => WittVector.init n