Theorem: WittVector.IsPoly₂.diag
File: Mathlib/RingTheory/WittVector/IsPoly.lean

tactic: obtain ⟨φ, hf⟩ := hf
state_before: p : ℕ
R S : Type u
σ : Type ?u.613386
idx : Type ?u.613389
inst✝¹ : CommRing R
inst✝ : CommRing S
f : ⦃R : Type u_1⦄ → [inst : CommRing R] → 𝕎 R → 𝕎 R → 𝕎 R
hf : IsPoly₂ p f
⊢ IsPoly p fun R _Rcr x => f x x

tactic: refine' ⟨⟨fun n => bind₁ (uncurry ![X, X]) (φ n), _⟩⟩
state_before: case mk'.intro
p : ℕ
R S : Type u
σ : Type ?u.613386
idx : Type ?u.613389
inst✝¹ : CommRing R
inst✝ : CommRing S
f : ⦃R : Type u_1⦄ → [inst : CommRing R] → 𝕎 R → 𝕎 R → 𝕎 R
φ : ℕ → MvPolynomial (Fin 2 × ℕ) ℤ
hf : ∀ ⦃R : Type u_1⦄ [inst : CommRing R] (x y : 𝕎 R), (f x y).coeff = fun n => peval (φ n) ![x.coeff, y.coeff]
⊢ IsPoly p fun R _Rcr x => f x x

tactic: intros
state_before: case mk'.intro
p : ℕ
R S : Type u
σ : Type ?u.613386
idx : Type ?u.613389
inst✝¹ : CommRing R
inst✝ : CommRing S
f : ⦃R : Type u_1⦄ → [inst : CommRing R] → 𝕎 R → 𝕎 R → 𝕎 R
φ : ℕ → MvPolynomial (Fin 2 × ℕ) ℤ
hf : ∀ ⦃R : Type u_1⦄ [inst : CommRing R] (x y : 𝕎 R), (f x y).coeff = fun n => peval (φ n) ![x.coeff, y.coeff]
⊢ ∀ ⦃R : Type u_1⦄ [inst : CommRing R] (x : 𝕎 R),
    (f x x).coeff = fun n => ↑(aeval x.coeff) ((fun n => ↑(bind₁ (uncurry ![X, X])) (φ n)) n)

tactic: funext n
state_before: case mk'.intro
p : ℕ
R S : Type u
σ : Type ?u.613386
idx : Type ?u.613389
inst✝² : CommRing R
inst✝¹ : CommRing S
f : ⦃R : Type u_1⦄ → [inst : CommRing R] → 𝕎 R → 𝕎 R → 𝕎 R
φ : ℕ → MvPolynomial (Fin 2 × ℕ) ℤ
hf : ∀ ⦃R : Type u_1⦄ [inst : CommRing R] (x y : 𝕎 R), (f x y).coeff = fun n => peval (φ n) ![x.coeff, y.coeff]
R✝ : Type u_1
inst✝ : CommRing R✝
x✝ : 𝕎 R✝
⊢ (f x✝ x✝).coeff = fun n => ↑(aeval x✝.coeff) ((fun n => ↑(bind₁ (uncurry ![X, X])) (φ n)) n)

tactic: simp only [hf, peval, uncurry, aeval_bind₁]
state_before: case mk'.intro.h
p : ℕ
R S : Type u
σ : Type ?u.613386
idx : Type ?u.613389
inst✝² : CommRing R
inst✝¹ : CommRing S
f : ⦃R : Type u_1⦄ → [inst : CommRing R] → 𝕎 R → 𝕎 R → 𝕎 R
φ : ℕ → MvPolynomial (Fin 2 × ℕ) ℤ
hf : ∀ ⦃R : Type u_1⦄ [inst : CommRing R] (x y : 𝕎 R), (f x y).coeff = fun n => peval (φ n) ![x.coeff, y.coeff]
R✝ : Type u_1
inst✝ : CommRing R✝
x✝ : 𝕎 R✝
n : ℕ
⊢ coeff (f x✝ x✝) n = ↑(aeval x✝.coeff) ((fun n => ↑(bind₁ (uncurry ![X, X])) (φ n)) n)

tactic: apply eval₂Hom_congr rfl _ rfl
state_before: case mk'.intro.h
p : ℕ
R S : Type u
σ : Type ?u.613386
idx : Type ?u.613389
inst✝² : CommRing R
inst✝¹ : CommRing S
f : ⦃R : Type u_1⦄ → [inst : CommRing R] → 𝕎 R → 𝕎 R → 𝕎 R
φ : ℕ → MvPolynomial (Fin 2 × ℕ) ℤ
hf : ∀ ⦃R : Type u_1⦄ [inst : CommRing R] (x y : 𝕎 R), (f x y).coeff = fun n => peval (φ n) ![x.coeff, y.coeff]
R✝ : Type u_1
inst✝ : CommRing R✝
x✝ : 𝕎 R✝
n : ℕ
⊢ ↑(aeval fun a => Matrix.vecCons x✝.coeff ![x✝.coeff] a.fst a.snd) (φ n) =
    ↑(aeval fun i => ↑(aeval x✝.coeff) (Matrix.vecCons X ![X] i.fst i.snd)) (φ n)

tactic: ext ⟨i, k⟩
state_before: p : ℕ
R S : Type u
σ : Type ?u.613386
idx : Type ?u.613389
inst✝² : CommRing R
inst✝¹ : CommRing S
f : ⦃R : Type u_1⦄ → [inst : CommRing R] → 𝕎 R → 𝕎 R → 𝕎 R
φ : ℕ → MvPolynomial (Fin 2 × ℕ) ℤ
hf : ∀ ⦃R : Type u_1⦄ [inst : CommRing R] (x y : 𝕎 R), (f x y).coeff = fun n => peval (φ n) ![x.coeff, y.coeff]
R✝ : Type u_1
inst✝ : CommRing R✝
x✝ : 𝕎 R✝
n : ℕ
⊢ (fun a => Matrix.vecCons x✝.coeff ![x✝.coeff] a.fst a.snd) = fun i =>
    ↑(aeval x✝.coeff) (Matrix.vecCons X ![X] i.fst i.snd)

tactic: fin_cases i <;> simp only [Matrix.head_cons, aeval_X, Matrix.cons_val_zero, Matrix.cons_val_one]
  <;>
  open Matrix in
  simp only [Fin.mk_zero, Fin.mk_one, cons_val', empty_val', cons_val_fin_one, cons_val_zero,
    aeval_X, head_fin_const, cons_val_one]
state_before: case h.mk
p : ℕ
R S : Type u
σ : Type ?u.613386
idx : Type ?u.613389
inst✝² : CommRing R
inst✝¹ : CommRing S
f : ⦃R : Type u_1⦄ → [inst : CommRing R] → 𝕎 R → 𝕎 R → 𝕎 R
φ : ℕ → MvPolynomial (Fin 2 × ℕ) ℤ
hf : ∀ ⦃R : Type u_1⦄ [inst : CommRing R] (x y : 𝕎 R), (f x y).coeff = fun n => peval (φ n) ![x.coeff, y.coeff]
R✝ : Type u_1
inst✝ : CommRing R✝
x✝ : 𝕎 R✝
n : ℕ
i : Fin 2
k : ℕ
⊢ Matrix.vecCons x✝.coeff ![x✝.coeff] (i, k).fst (i, k).snd =
    ↑(aeval x✝.coeff) (Matrix.vecCons X ![X] (i, k).fst (i, k).snd)

tactic: simp only [Fin.mk_zero, Fin.mk_one, cons_val', empty_val', cons_val_fin_one, cons_val_zero,
  aeval_X, head_fin_const, cons_val_one]
state_before: case h.mk.tail.head
p : ℕ
R S : Type u
σ : Type ?u.613386
idx : Type ?u.613389
inst✝² : CommRing R
inst✝¹ : CommRing S
f : ⦃R : Type u_1⦄ → [inst : CommRing R] → 𝕎 R → 𝕎 R → 𝕎 R
φ : ℕ → MvPolynomial (Fin 2 × ℕ) ℤ
hf : ∀ ⦃R : Type u_1⦄ [inst : CommRing R] (x y : 𝕎 R), (f x y).coeff = fun n => peval (φ n) ![x.coeff, y.coeff]
R✝ : Type u_1
inst✝ : CommRing R✝
x✝ : 𝕎 R✝
n k : ℕ
⊢ Matrix.vecCons x✝.coeff ![x✝.coeff] { val := 1, isLt := (_ : (fun a => a < 2) 1) } k =
    ↑(aeval x✝.coeff) (Matrix.vecCons X ![X] { val := 1, isLt := (_ : (fun a => a < 2) 1) } k)