l3lab/ntp-mathlib huggingface dataset:
instance [Full F] [Faithful F] : Full F.mapTriangle where
  preimage {X Y} f :=
    { hom₁ := F.preimage f.hom₁
      hom₂ := F.preimage f.hom₂
      hom₃ := F.preimage f.hom₃
      comm₁ := F.map_injective
        (by simpa only [mapTriangle_obj, map_comp, image_preimage] using f.comm₁)
      comm₂ := F.map_injective
        (by 

Proof state:
C : Type u_1
D : Type u_2
inst✝⁶ : Category.{?u.11156, u_1} C
inst✝⁵ : Category.{?u.11160, u_2} D
inst✝⁴ : HasShift C ℤ
inst✝³ : HasShift D ℤ
F : C ⥤ D
inst✝² : CommShift F ℤ
inst✝¹ : Full F
inst✝ : Faithful F
X Y : Triangle C
f : (mapTriangle F).obj X ⟶ (mapTriangle F).obj Y
⊢ F.map (X.mor₂ ≫ F.preimage f.hom₃) = F.map (F.preimage f.hom₂ ≫ Y.mor₂)

Next tactic:
simpa only [mapTriangle_obj, map_comp, image_preimage] using f.comm₂
instance [Full F] [Faithful F] : Full F.mapTriangle where
  preimage {X Y} f :=
    { hom₁ := F.preimage f.hom₁
      hom₂ := F.preimage f.hom₂
      hom₃ := F.preimage f.hom₃
      comm₁ := F.map_injective
        (by simpa only [mapTriangle_obj, map_comp, image_preimage] using f.comm₁)
      comm₂ := F.map_injective
        (by simpa only [mapTriangle_obj, map_comp, image_preimage] using f.comm₂)
      comm₃ := F.map_injective (by
        

Proof state:
C : Type u_1
D : Type u_2
inst✝⁶ : Category.{?u.11156, u_1} C
inst✝⁵ : Category.{?u.11160, u_2} D
inst✝⁴ : HasShift C ℤ
inst✝³ : HasShift D ℤ
F : C ⥤ D
inst✝² : CommShift F ℤ
inst✝¹ : Full F
inst✝ : Faithful F
X Y : Triangle C
f : (mapTriangle F).obj X ⟶ (mapTriangle F).obj Y
⊢ F.map (X.mor₃ ≫ (shiftFunctor C 1).map (F.preimage f.hom₁)) = F.map (F.preimage f.hom₃ ≫ Y.mor₃)

Next tactic:
rw [← cancel_mono ((F.commShiftIso (1 : ℤ)).hom.app Y.obj₁)]
instance [Full F] [Faithful F] : Full F.mapTriangle where
  preimage {X Y} f :=
    { hom₁ := F.preimage f.hom₁
      hom₂ := F.preimage f.hom₂
      hom₃ := F.preimage f.hom₃
      comm₁ := F.map_injective
        (by simpa only [mapTriangle_obj, map_comp, image_preimage] using f.comm₁)
      comm₂ := F.map_injective
        (by simpa only [mapTriangle_obj, map_comp, image_preimage] using f.comm₂)
      comm₃ := F.map_injective (by
        rw [← cancel_mono ((F.commShiftIso (1 : ℤ)).hom.app Y.obj₁)]
        

Proof state:
C : Type u_1
D : Type u_2
inst✝⁶ : Category.{?u.11156, u_1} C
inst✝⁵ : Category.{?u.11160, u_2} D
inst✝⁴ : HasShift C ℤ
inst✝³ : HasShift D ℤ
F : C ⥤ D
inst✝² : CommShift F ℤ
inst✝¹ : Full F
inst✝ : Faithful F
X Y : Triangle C
f : (mapTriangle F).obj X ⟶ (mapTriangle F).obj Y
⊢ F.map (X.mor₃ ≫ (shiftFunctor C 1).map (F.preimage f.hom₁)) ≫ (commShiftIso F 1).hom.app Y.obj₁ =
    F.map (F.preimage f.hom₃ ≫ Y.mor₃) ≫ (commShiftIso F 1).hom.app Y.obj₁

Next tactic:
simpa only [mapTriangle_obj, map_comp, assoc, commShiftIso_hom_naturality,
          image_preimage, Triangle.mk_mor₃] using f.comm₃
theorem IsPoly.neg {f : (α → ℕ) → ℤ} : IsPoly f → IsPoly (-f) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f : (α → ℕ) → ℤ
⊢ IsPoly f → IsPoly (-f)

Next tactic:
rw [← zero_sub]
theorem IsPoly.neg {f : (α → ℕ) → ℤ} : IsPoly f → IsPoly (-f) := by
  rw [← zero_sub]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f : (α → ℕ) → ℤ
⊢ IsPoly f → IsPoly (0 - f)

Next tactic:
exact (IsPoly.const 0).sub
theorem IsPoly.add {f g : (α → ℕ) → ℤ} (hf : IsPoly f) (hg : IsPoly g) : IsPoly (f + g) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f g : (α → ℕ) → ℤ
hf : IsPoly f
hg : IsPoly g
⊢ IsPoly (f + g)

Next tactic:
rw [← sub_neg_eq_add]
theorem IsPoly.add {f g : (α → ℕ) → ℤ} (hf : IsPoly f) (hg : IsPoly g) : IsPoly (f + g) := by
  rw [← sub_neg_eq_add]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f g : (α → ℕ) → ℤ
hf : IsPoly f
hg : IsPoly g
⊢ IsPoly (f - -g)

Next tactic:
exact hf.sub hg.neg
instance : AddCommGroup (Poly α) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
⊢ AddCommGroup (Poly α)

Next tactic:
refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  

Proof state:
case refine'_1
α : Type u_1
β : Type u_2
γ : Type u_3
⊢ ∀ (a b c : Poly α), a + b + c = a + (b + c)
case refine'_2
α : Type u_1
β : Type u_2
γ : Type u_3
⊢ ∀ (a : Poly α), 0 + a = a
case refine'_3
α : Type u_1
β : Type u_2
γ : Type u_3
⊢ ∀ (a : Poly α), a + 0 = a
case refine'_4
α : Type u_1
β : Type u_2
γ : Type u_3
⊢ ∀ (x : Poly α), nsmulRec 0 x = 0
case refine'_5
α : Type u_1
β : Type u_2
γ : Type u_3
⊢ ∀ (n : ℕ) (x : Poly α), nsmulRec (n + 1) x = x + nsmulRec n x
case refine'_6
α : Type u_1
β : Type u_2
γ : Type u_3
⊢ ∀ (a b : Poly α), a - b = a + -b
case refine'_7
α : Type u_1
β : Type u_2
γ : Type u_3
⊢ ∀ (a : Poly α), zsmulRec 0 a = 0
case refine'_8
α : Type u_1
β : Type u_2
γ : Type u_3
⊢ ∀ (n : ℕ) (a : Poly α), zsmulRec (Int.ofNat (succ n)) a = a + zsmulRec (Int.ofNat n) a
case refine'_9
α : Type u_1
β : Type u_2
γ : Type u_3
⊢ ∀ (n : ℕ) (a : Poly α), zsmulRec (Int.negSucc n) a = -zsmulRec (↑(succ n)) a
case refine'_10
α : Type u_1
β : Type u_2
γ : Type u_3
⊢ ∀ (a : Poly α), -a + a = 0
case refine'_11 α : Type u_1 β : Type u_2 γ : Type u_3 ⊢ ∀ (a b : Poly α), a + b = b + a

Next tactic:
all_goals
    intros
    first
      | rfl
      | ext; simp_rw [add_apply]
        first
          | rw [← add_assoc]
          | rw [zero_apply, zero_add]
          | rw [zero_apply, add_zero]
          | rw [neg_apply, add_left_neg, zero_apply]
          | rw [add_comm]
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    

Proof state:
case refine'_1
α : Type u_1
β : Type u_2
γ : Type u_3
⊢ ∀ (a b c : Poly α), a + b + c = a + (b + c)

Next tactic:
intros
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    

Proof state:
case refine'_1
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ b✝ c✝ : Poly α
⊢ a✝ + b✝ + c✝ = a✝ + (b✝ + c✝)

Next tactic:
first
      | rfl
      | ext; simp_rw [add_apply]
        first
          | rw [← add_assoc]
          | rw [zero_apply, zero_add]
          | rw [zero_apply, add_zero]
          | rw [neg_apply, add_left_neg, zero_apply]
          | rw [add_comm]
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    first
      | 

Proof state:
case refine'_1
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ b✝ c✝ : Poly α
⊢ a✝ + b✝ + c✝ = a✝ + (b✝ + c✝)

Next tactic:
rfl
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    first
      | rfl
      | 

Proof state:
case refine'_1
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ b✝ c✝ : Poly α
⊢ a✝ + b✝ + c✝ = a✝ + (b✝ + c✝)

Next tactic:
ext
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    first
      | rfl
      | ext; 

Proof state:
case refine'_1.a
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ b✝ c✝ : Poly α
x✝ : α → ℕ
⊢ (a✝ + b✝ + c✝) x✝ = (a✝ + (b✝ + c✝)) x✝

Next tactic:
simp_rw [add_apply]
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    first
      | rfl
      | ext; simp_rw [add_apply]
        

Proof state:
case refine'_1.a
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ b✝ c✝ : Poly α
x✝ : α → ℕ
⊢ a✝ x✝ + b✝ x✝ + c✝ x✝ = a✝ x✝ + (b✝ x✝ + c✝ x✝)

Next tactic:
first
          | rw [← add_assoc]
          | rw [zero_apply, zero_add]
          | rw [zero_apply, add_zero]
          | rw [neg_apply, add_left_neg, zero_apply]
          | rw [add_comm]
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    first
      | rfl
      | ext; simp_rw [add_apply]
        first
          | 

Proof state:
case refine'_1.a
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ b✝ c✝ : Poly α
x✝ : α → ℕ
⊢ a✝ x✝ + b✝ x✝ + c✝ x✝ = a✝ x✝ + (b✝ x✝ + c✝ x✝)

Next tactic:
rw [← add_assoc]
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
γ : Type u_3
⊢ ∀ (a : Poly α), 0 + a = a

Next tactic:
intros
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ : Poly α
⊢ 0 + a✝ = a✝

Next tactic:
first
      | rfl
      | ext; simp_rw [add_apply]
        first
          | rw [← add_assoc]
          | rw [zero_apply, zero_add]
          | rw [zero_apply, add_zero]
          | rw [neg_apply, add_left_neg, zero_apply]
          | rw [add_comm]
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    first
      | 

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ : Poly α
⊢ 0 + a✝ = a✝

Next tactic:
rfl
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    first
      | rfl
      | 

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ : Poly α
⊢ 0 + a✝ = a✝

Next tactic:
ext
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    first
      | rfl
      | ext; 

Proof state:
case refine'_2.a
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ : Poly α
x✝ : α → ℕ
⊢ (0 + a✝) x✝ = a✝ x✝

Next tactic:
simp_rw [add_apply]
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    first
      | rfl
      | ext; simp_rw [add_apply]
        

Proof state:
case refine'_2.a
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ : Poly α
x✝ : α → ℕ
⊢ 0 x✝ + a✝ x✝ = a✝ x✝

Next tactic:
first
          | rw [← add_assoc]
          | rw [zero_apply, zero_add]
          | rw [zero_apply, add_zero]
          | rw [neg_apply, add_left_neg, zero_apply]
          | rw [add_comm]
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    first
      | rfl
      | ext; simp_rw [add_apply]
        first
          | 

Proof state:
case refine'_2.a
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ : Poly α
x✝ : α → ℕ
⊢ 0 x✝ + a✝ x✝ = a✝ x✝

Next tactic:
rw [← add_assoc]
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    first
      | rfl
      | ext; simp_rw [add_apply]
        first
          | rw [← add_assoc]
          | 

Proof state:
case refine'_2.a
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ : Poly α
x✝ : α → ℕ
⊢ 0 x✝ + a✝ x✝ = a✝ x✝

Next tactic:
rw [zero_apply, zero_add]
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    

Proof state:
case refine'_3
α : Type u_1
β : Type u_2
γ : Type u_3
⊢ ∀ (a : Poly α), a + 0 = a

Next tactic:
intros
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    

Proof state:
case refine'_3
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ : Poly α
⊢ a✝ + 0 = a✝

Next tactic:
first
      | rfl
      | ext; simp_rw [add_apply]
        first
          | rw [← add_assoc]
          | rw [zero_apply, zero_add]
          | rw [zero_apply, add_zero]
          | rw [neg_apply, add_left_neg, zero_apply]
          | rw [add_comm]
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    first
      | 

Proof state:
case refine'_3
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ : Poly α
⊢ a✝ + 0 = a✝

Next tactic:
rfl
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    first
      | rfl
      | 

Proof state:
case refine'_3
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ : Poly α
⊢ a✝ + 0 = a✝

Next tactic:
ext
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    first
      | rfl
      | ext; 

Proof state:
case refine'_3.a
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ : Poly α
x✝ : α → ℕ
⊢ (a✝ + 0) x✝ = a✝ x✝

Next tactic:
simp_rw [add_apply]
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    first
      | rfl
      | ext; simp_rw [add_apply]
        

Proof state:
case refine'_3.a
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ : Poly α
x✝ : α → ℕ
⊢ a✝ x✝ + 0 x✝ = a✝ x✝

Next tactic:
first
          | rw [← add_assoc]
          | rw [zero_apply, zero_add]
          | rw [zero_apply, add_zero]
          | rw [neg_apply, add_left_neg, zero_apply]
          | rw [add_comm]
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    first
      | rfl
      | ext; simp_rw [add_apply]
        first
          | 

Proof state:
case refine'_3.a
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ : Poly α
x✝ : α → ℕ
⊢ a✝ x✝ + 0 x✝ = a✝ x✝

Next tactic:
rw [← add_assoc]
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    first
      | rfl
      | ext; simp_rw [add_apply]
        first
          | rw [← add_assoc]
          | 

Proof state:
case refine'_3.a
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ : Poly α
x✝ : α → ℕ
⊢ a✝ x✝ + 0 x✝ = a✝ x✝

Next tactic:
rw [zero_apply, zero_add]
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    first
      | rfl
      | ext; simp_rw [add_apply]
        first
          | rw [← add_assoc]
          | rw [zero_apply, zero_add]
          | 

Proof state:
case refine'_3.a
α : Type u_1
β : Type u_2
γ : Type u_3
a✝ : Poly α
x✝ : α → ℕ
⊢ a✝ x✝ + 0 x✝ = a✝ x✝

Next tactic:
rw [zero_apply, add_zero]
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    

Proof state:
case refine'_4
α : Type u_1
β : Type u_2
γ : Type u_3
⊢ ∀ (x : Poly α), nsmulRec 0 x = 0

Next tactic:
intros
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    

Proof state:
case refine'_4
α : Type u_1
β : Type u_2
γ : Type u_3
x✝ : Poly α
⊢ nsmulRec 0 x✝ = 0

Next tactic:
first
      | rfl
      | ext; simp_rw [add_apply]
        first
          | rw [← add_assoc]
          | rw [zero_apply, zero_add]
          | rw [zero_apply, add_zero]
          | rw [neg_apply, add_left_neg, zero_apply]
          | rw [add_comm]
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    first
      | 

Proof state:
case refine'_4
α : Type u_1
β : Type u_2
γ : Type u_3
x✝ : Poly α
⊢ nsmulRec 0 x✝ = 0

Next tactic:
rfl
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    

Proof state:
case refine'_5
α : Type u_1
β : Type u_2
γ : Type u_3
⊢ ∀ (n : ℕ) (x : Poly α), nsmulRec (n + 1) x = x + nsmulRec n x

Next tactic:
intros
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    

Proof state:
case refine'_5
α : Type u_1
β : Type u_2
γ : Type u_3
n✝ : ℕ
x✝ : Poly α
⊢ nsmulRec (n✝ + 1) x✝ = x✝ + nsmulRec n✝ x✝

Next tactic:
first
      | rfl
      | ext; simp_rw [add_apply]
        first
          | rw [← add_assoc]
          | rw [zero_apply, zero_add]
          | rw [zero_apply, add_zero]
          | rw [neg_apply, add_left_neg, zero_apply]
          | rw [add_comm]
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    intros
    first
      | 

Proof state:
case refine'_5
α : Type u_1
β : Type u_2
γ : Type u_3
n✝ : ℕ
x✝ : Poly α
⊢ nsmulRec (n✝ + 1) x✝ = x✝ + nsmulRec n✝ x✝

Next tactic:
rfl
instance : AddCommGroup (Poly α) := by
  refine' { add := ((· + ·) : Poly α → Poly α → Poly α)
            neg := (Neg.neg : Poly α → Poly α)
            sub := Sub.sub
            zero := 0
            zsmul := @zsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩ ⟨Neg.neg⟩
            nsmul := @nsmulRec _ ⟨(0 : Poly α)⟩ ⟨(· + ·)⟩
            .. }
  all_goals
    

Proof state:
case refine'_6
α : Type u_1
β : Type u_2
γ : Type u_3
⊢ ∀ (a b : Poly α), a - b = a + -b

Next tactic:
intros