l3lab/ntp-mathlib huggingface dataset:
@[to_additive gcd_nsmul_eq_zero]
theorem pow_gcd_eq_one {M : Type*} [Monoid M] (x : M) {m n : ℕ} (hm : x ^ m = 1) (hn : x ^ n = 1) :
    x ^ m.gcd n = 1 := by
  rcases m with (rfl | m); · simp [hn]
  obtain ⟨y, rfl⟩ := isUnit_ofPowEqOne hm m.succ_ne_zero
  simp only [← Units.val_pow_eq_pow_val] at *
  

Proof state:
case succ.intro
M : Type u_1
inst✝ : Monoid M
n m : ℕ
y : Mˣ
hn : ↑(y ^ n) = 1
hm : ↑(y ^ Nat.succ m) = 1
⊢ ↑(y ^ Nat.gcd (Nat.succ m) n) = 1

Next tactic:
rw [← Units.val_one, ← zpow_coe_nat, ← Units.ext_iff] at *
@[to_additive gcd_nsmul_eq_zero]
theorem pow_gcd_eq_one {M : Type*} [Monoid M] (x : M) {m n : ℕ} (hm : x ^ m = 1) (hn : x ^ n = 1) :
    x ^ m.gcd n = 1 := by
  rcases m with (rfl | m); · simp [hn]
  obtain ⟨y, rfl⟩ := isUnit_ofPowEqOne hm m.succ_ne_zero
  simp only [← Units.val_pow_eq_pow_val] at *
  rw [← Units.val_one, ← zpow_coe_nat, ← Units.ext_iff] at *
  

Proof state:
case succ.intro
M : Type u_1
inst✝ : Monoid M
n m : ℕ
y : Mˣ
hn : y ^ ↑n = 1
hm : y ^ ↑(Nat.succ m) = 1
⊢ y ^ ↑(Nat.gcd (Nat.succ m) n) = 1

Next tactic:
simp only [Nat.gcd_eq_gcd_ab, zpow_add, zpow_mul, hm, hn, one_zpow, one_mul]
/-- If `M` has a nonzero determinant, then `M` as a bilinear form on `n → A` is nondegenerate.

See also `BilinForm.nondegenerateOfDetNeZero'` and `BilinForm.nondegenerateOfDetNeZero`.
-/
theorem nondegenerate_of_det_ne_zero [DecidableEq m] {M : Matrix m m A} (hM : M.det ≠ 0) :
    Nondegenerate M := by
  

Proof state:
m : Type u_1
R : Type u_2
A : Type u_3
inst✝⁴ : Fintype m
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DecidableEq m
M : Matrix m m A
hM : det M ≠ 0
⊢ Nondegenerate M

Next tactic:
intro v hv
/-- If `M` has a nonzero determinant, then `M` as a bilinear form on `n → A` is nondegenerate.

See also `BilinForm.nondegenerateOfDetNeZero'` and `BilinForm.nondegenerateOfDetNeZero`.
-/
theorem nondegenerate_of_det_ne_zero [DecidableEq m] {M : Matrix m m A} (hM : M.det ≠ 0) :
    Nondegenerate M := by
  intro v hv
  

Proof state:
m : Type u_1
R : Type u_2
A : Type u_3
inst✝⁴ : Fintype m
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DecidableEq m
M : Matrix m m A
hM : det M ≠ 0
v : m → A
hv : ∀ (w : m → A), v ⬝ᵥ mulVec M w = 0
⊢ v = 0

Next tactic:
ext i
/-- If `M` has a nonzero determinant, then `M` as a bilinear form on `n → A` is nondegenerate.

See also `BilinForm.nondegenerateOfDetNeZero'` and `BilinForm.nondegenerateOfDetNeZero`.
-/
theorem nondegenerate_of_det_ne_zero [DecidableEq m] {M : Matrix m m A} (hM : M.det ≠ 0) :
    Nondegenerate M := by
  intro v hv
  ext i
  

Proof state:
case h
m : Type u_1
R : Type u_2
A : Type u_3
inst✝⁴ : Fintype m
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DecidableEq m
M : Matrix m m A
hM : det M ≠ 0
v : m → A
hv : ∀ (w : m → A), v ⬝ᵥ mulVec M w = 0
i : m
⊢ v i = OfNat.ofNat 0 i

Next tactic:
specialize hv (M.cramer (Pi.single i 1))
/-- If `M` has a nonzero determinant, then `M` as a bilinear form on `n → A` is nondegenerate.

See also `BilinForm.nondegenerateOfDetNeZero'` and `BilinForm.nondegenerateOfDetNeZero`.
-/
theorem nondegenerate_of_det_ne_zero [DecidableEq m] {M : Matrix m m A} (hM : M.det ≠ 0) :
    Nondegenerate M := by
  intro v hv
  ext i
  specialize hv (M.cramer (Pi.single i 1))
  

Proof state:
case h
m : Type u_1
R : Type u_2
A : Type u_3
inst✝⁴ : Fintype m
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DecidableEq m
M : Matrix m m A
hM : det M ≠ 0
v : m → A
i : m
hv : v ⬝ᵥ mulVec M ((cramer M) (Pi.single i 1)) = 0
⊢ v i = OfNat.ofNat 0 i

Next tactic:
refine' (mul_eq_zero.mp _).resolve_right hM
/-- If `M` has a nonzero determinant, then `M` as a bilinear form on `n → A` is nondegenerate.

See also `BilinForm.nondegenerateOfDetNeZero'` and `BilinForm.nondegenerateOfDetNeZero`.
-/
theorem nondegenerate_of_det_ne_zero [DecidableEq m] {M : Matrix m m A} (hM : M.det ≠ 0) :
    Nondegenerate M := by
  intro v hv
  ext i
  specialize hv (M.cramer (Pi.single i 1))
  refine' (mul_eq_zero.mp _).resolve_right hM
  

Proof state:
case h
m : Type u_1
R : Type u_2
A : Type u_3
inst✝⁴ : Fintype m
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DecidableEq m
M : Matrix m m A
hM : det M ≠ 0
v : m → A
i : m
hv : v ⬝ᵥ mulVec M ((cramer M) (Pi.single i 1)) = 0
⊢ v i * det M = 0

Next tactic:
convert hv
/-- If `M` has a nonzero determinant, then `M` as a bilinear form on `n → A` is nondegenerate.

See also `BilinForm.nondegenerateOfDetNeZero'` and `BilinForm.nondegenerateOfDetNeZero`.
-/
theorem nondegenerate_of_det_ne_zero [DecidableEq m] {M : Matrix m m A} (hM : M.det ≠ 0) :
    Nondegenerate M := by
  intro v hv
  ext i
  specialize hv (M.cramer (Pi.single i 1))
  refine' (mul_eq_zero.mp _).resolve_right hM
  convert hv
  

Proof state:
case h.e'_2
m : Type u_1
R : Type u_2
A : Type u_3
inst✝⁴ : Fintype m
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DecidableEq m
M : Matrix m m A
hM : det M ≠ 0
v : m → A
i : m
hv : v ⬝ᵥ mulVec M ((cramer M) (Pi.single i 1)) = 0
⊢ v i * det M = v ⬝ᵥ mulVec M ((cramer M) (Pi.single i 1))

Next tactic:
simp only [mulVec_cramer M (Pi.single i 1), dotProduct, Pi.smul_apply, smul_eq_mul]
/-- If `M` has a nonzero determinant, then `M` as a bilinear form on `n → A` is nondegenerate.

See also `BilinForm.nondegenerateOfDetNeZero'` and `BilinForm.nondegenerateOfDetNeZero`.
-/
theorem nondegenerate_of_det_ne_zero [DecidableEq m] {M : Matrix m m A} (hM : M.det ≠ 0) :
    Nondegenerate M := by
  intro v hv
  ext i
  specialize hv (M.cramer (Pi.single i 1))
  refine' (mul_eq_zero.mp _).resolve_right hM
  convert hv
  simp only [mulVec_cramer M (Pi.single i 1), dotProduct, Pi.smul_apply, smul_eq_mul]
  

Proof state:
case h.e'_2
m : Type u_1
R : Type u_2
A : Type u_3
inst✝⁴ : Fintype m
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DecidableEq m
M : Matrix m m A
hM : det M ≠ 0
v : m → A
i : m
hv : v ⬝ᵥ mulVec M ((cramer M) (Pi.single i 1)) = 0
⊢ v i * det M = Finset.sum Finset.univ fun x => v x * (det M * Pi.single i 1 x)

Next tactic:
rw [Finset.sum_eq_single i, Pi.single_eq_same, mul_one]
/-- If `M` has a nonzero determinant, then `M` as a bilinear form on `n → A` is nondegenerate.

See also `BilinForm.nondegenerateOfDetNeZero'` and `BilinForm.nondegenerateOfDetNeZero`.
-/
theorem nondegenerate_of_det_ne_zero [DecidableEq m] {M : Matrix m m A} (hM : M.det ≠ 0) :
    Nondegenerate M := by
  intro v hv
  ext i
  specialize hv (M.cramer (Pi.single i 1))
  refine' (mul_eq_zero.mp _).resolve_right hM
  convert hv
  simp only [mulVec_cramer M (Pi.single i 1), dotProduct, Pi.smul_apply, smul_eq_mul]
  rw [Finset.sum_eq_single i, Pi.single_eq_same, mul_one]
  · 

Proof state:
case h.e'_2.h₀
m : Type u_1
R : Type u_2
A : Type u_3
inst✝⁴ : Fintype m
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DecidableEq m
M : Matrix m m A
hM : det M ≠ 0
v : m → A
i : m
hv : v ⬝ᵥ mulVec M ((cramer M) (Pi.single i 1)) = 0
⊢ ∀ b ∈ Finset.univ, b ≠ i → v b * (det M * Pi.single i 1 b) = 0

Next tactic:
intro j _ hj
/-- If `M` has a nonzero determinant, then `M` as a bilinear form on `n → A` is nondegenerate.

See also `BilinForm.nondegenerateOfDetNeZero'` and `BilinForm.nondegenerateOfDetNeZero`.
-/
theorem nondegenerate_of_det_ne_zero [DecidableEq m] {M : Matrix m m A} (hM : M.det ≠ 0) :
    Nondegenerate M := by
  intro v hv
  ext i
  specialize hv (M.cramer (Pi.single i 1))
  refine' (mul_eq_zero.mp _).resolve_right hM
  convert hv
  simp only [mulVec_cramer M (Pi.single i 1), dotProduct, Pi.smul_apply, smul_eq_mul]
  rw [Finset.sum_eq_single i, Pi.single_eq_same, mul_one]
  · intro j _ hj
    

Proof state:
case h.e'_2.h₀
m : Type u_1
R : Type u_2
A : Type u_3
inst✝⁴ : Fintype m
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DecidableEq m
M : Matrix m m A
hM : det M ≠ 0
v : m → A
i : m
hv : v ⬝ᵥ mulVec M ((cramer M) (Pi.single i 1)) = 0
j : m
a✝ : j ∈ Finset.univ
hj : j ≠ i
⊢ v j * (det M * Pi.single i 1 j) = 0

Next tactic:
simp [hj]
/-- If `M` has a nonzero determinant, then `M` as a bilinear form on `n → A` is nondegenerate.

See also `BilinForm.nondegenerateOfDetNeZero'` and `BilinForm.nondegenerateOfDetNeZero`.
-/
theorem nondegenerate_of_det_ne_zero [DecidableEq m] {M : Matrix m m A} (hM : M.det ≠ 0) :
    Nondegenerate M := by
  intro v hv
  ext i
  specialize hv (M.cramer (Pi.single i 1))
  refine' (mul_eq_zero.mp _).resolve_right hM
  convert hv
  simp only [mulVec_cramer M (Pi.single i 1), dotProduct, Pi.smul_apply, smul_eq_mul]
  rw [Finset.sum_eq_single i, Pi.single_eq_same, mul_one]
  · intro j _ hj
    simp [hj]
  · 

Proof state:
case h.e'_2.h₁
m : Type u_1
R : Type u_2
A : Type u_3
inst✝⁴ : Fintype m
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DecidableEq m
M : Matrix m m A
hM : det M ≠ 0
v : m → A
i : m
hv : v ⬝ᵥ mulVec M ((cramer M) (Pi.single i 1)) = 0
⊢ i ∉ Finset.univ → v i * (det M * Pi.single i 1 i) = 0

Next tactic:
intros
/-- If `M` has a nonzero determinant, then `M` as a bilinear form on `n → A` is nondegenerate.

See also `BilinForm.nondegenerateOfDetNeZero'` and `BilinForm.nondegenerateOfDetNeZero`.
-/
theorem nondegenerate_of_det_ne_zero [DecidableEq m] {M : Matrix m m A} (hM : M.det ≠ 0) :
    Nondegenerate M := by
  intro v hv
  ext i
  specialize hv (M.cramer (Pi.single i 1))
  refine' (mul_eq_zero.mp _).resolve_right hM
  convert hv
  simp only [mulVec_cramer M (Pi.single i 1), dotProduct, Pi.smul_apply, smul_eq_mul]
  rw [Finset.sum_eq_single i, Pi.single_eq_same, mul_one]
  · intro j _ hj
    simp [hj]
  · intros
    

Proof state:
case h.e'_2.h₁
m : Type u_1
R : Type u_2
A : Type u_3
inst✝⁴ : Fintype m
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DecidableEq m
M : Matrix m m A
hM : det M ≠ 0
v : m → A
i : m
hv : v ⬝ᵥ mulVec M ((cramer M) (Pi.single i 1)) = 0
a✝ : i ∉ Finset.univ
⊢ v i * (det M * Pi.single i 1 i) = 0

Next tactic:
have := Finset.mem_univ i
/-- If `M` has a nonzero determinant, then `M` as a bilinear form on `n → A` is nondegenerate.

See also `BilinForm.nondegenerateOfDetNeZero'` and `BilinForm.nondegenerateOfDetNeZero`.
-/
theorem nondegenerate_of_det_ne_zero [DecidableEq m] {M : Matrix m m A} (hM : M.det ≠ 0) :
    Nondegenerate M := by
  intro v hv
  ext i
  specialize hv (M.cramer (Pi.single i 1))
  refine' (mul_eq_zero.mp _).resolve_right hM
  convert hv
  simp only [mulVec_cramer M (Pi.single i 1), dotProduct, Pi.smul_apply, smul_eq_mul]
  rw [Finset.sum_eq_single i, Pi.single_eq_same, mul_one]
  · intro j _ hj
    simp [hj]
  · intros
    have := Finset.mem_univ i
    

Proof state:
case h.e'_2.h₁
m : Type u_1
R : Type u_2
A : Type u_3
inst✝⁴ : Fintype m
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DecidableEq m
M : Matrix m m A
hM : det M ≠ 0
v : m → A
i : m
hv : v ⬝ᵥ mulVec M ((cramer M) (Pi.single i 1)) = 0
a✝ : i ∉ Finset.univ
this : i ∈ Finset.univ
⊢ v i * (det M * Pi.single i 1 i) = 0

Next tactic:
contradiction
theorem eq_zero_of_vecMul_eq_zero [DecidableEq m] {M : Matrix m m A} (hM : M.det ≠ 0) {v : m → A}
    (hv : M.vecMul v = 0) : v = 0 :=
  (nondegenerate_of_det_ne_zero hM).eq_zero_of_ortho fun w => by
    

Proof state:
m : Type u_1
R : Type u_2
A : Type u_3
inst✝⁴ : Fintype m
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DecidableEq m
M : Matrix m m A
hM : det M ≠ 0
v : m → A
hv : vecMul v M = 0
w : m → A
⊢ v ⬝ᵥ mulVec M w = 0

Next tactic:
rw [dotProduct_mulVec, hv, zero_dotProduct]
theorem eq_zero_of_mulVec_eq_zero [DecidableEq m] {M : Matrix m m A} (hM : M.det ≠ 0) {v : m → A}
    (hv : M.mulVec v = 0) : v = 0 :=
  eq_zero_of_vecMul_eq_zero (by 

Proof state:
m : Type u_1
R : Type u_2
A : Type u_3
inst✝⁴ : Fintype m
inst✝³ : CommRing R
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DecidableEq m
M : Matrix m m A
hM : det M ≠ 0
v : m → A
hv : mulVec M v = 0
⊢ det Mᵀ ≠ 0

Next tactic:
rwa [det_transpose]
/-- The shift functor by `n : ℤ` on `CochainComplex C ℤ` which sends a cochain
complex `K` to the complex which is `K.X (i + n)` in degree `i`, and which
multiplies the differentials by `(-1)^n`. -/
@[simps]
def shiftFunctor (n : ℤ) : CochainComplex C ℤ ⥤ CochainComplex C ℤ where
  obj K :=
    { X := fun i => K.X (i + n)
      d := fun i j => n.negOnePow • K.d _ _
      d_comp_d' := by
        intros
        simp only [Linear.comp_units_smul, Linear.units_smul_comp, d_comp_d, smul_zero]
      shape := fun i j hij => by
        

Proof state:
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : Preadditive C
D : Type u'
inst✝¹ : Category.{v', u'} D
inst✝ : Preadditive D
n : ℤ
K : CochainComplex C ℤ
i j : ℤ
hij : ¬ComplexShape.Rel (ComplexShape.up ℤ) i j
⊢ (fun i j => n.negOnePow • d K (i + n) (j + n)) i j = 0

Next tactic:
dsimp
/-- The shift functor by `n : ℤ` on `CochainComplex C ℤ` which sends a cochain
complex `K` to the complex which is `K.X (i + n)` in degree `i`, and which
multiplies the differentials by `(-1)^n`. -/
@[simps]
def shiftFunctor (n : ℤ) : CochainComplex C ℤ ⥤ CochainComplex C ℤ where
  obj K :=
    { X := fun i => K.X (i + n)
      d := fun i j => n.negOnePow • K.d _ _
      d_comp_d' := by
        intros
        simp only [Linear.comp_units_smul, Linear.units_smul_comp, d_comp_d, smul_zero]
      shape := fun i j hij => by
        dsimp
        

Proof state:
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : Preadditive C
D : Type u'
inst✝¹ : Category.{v', u'} D
inst✝ : Preadditive D
n : ℤ
K : CochainComplex C ℤ
i j : ℤ
hij : ¬ComplexShape.Rel (ComplexShape.up ℤ) i j
⊢ n.negOnePow • d K (i + n) (j + n) = 0

Next tactic:
rw [K.shape, smul_zero]
/-- The shift functor by `n : ℤ` on `CochainComplex C ℤ` which sends a cochain
complex `K` to the complex which is `K.X (i + n)` in degree `i`, and which
multiplies the differentials by `(-1)^n`. -/
@[simps]
def shiftFunctor (n : ℤ) : CochainComplex C ℤ ⥤ CochainComplex C ℤ where
  obj K :=
    { X := fun i => K.X (i + n)
      d := fun i j => n.negOnePow • K.d _ _
      d_comp_d' := by
        intros
        simp only [Linear.comp_units_smul, Linear.units_smul_comp, d_comp_d, smul_zero]
      shape := fun i j hij => by
        dsimp
        rw [K.shape, smul_zero]
        

Proof state:
case a
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : Preadditive C
D : Type u'
inst✝¹ : Category.{v', u'} D
inst✝ : Preadditive D
n : ℤ
K : CochainComplex C ℤ
i j : ℤ
hij : ¬ComplexShape.Rel (ComplexShape.up ℤ) i j
⊢ ¬ComplexShape.Rel (ComplexShape.up ℤ) (i + n) (j + n)

Next tactic:
intro hij'
/-- The shift functor by `n : ℤ` on `CochainComplex C ℤ` which sends a cochain
complex `K` to the complex which is `K.X (i + n)` in degree `i`, and which
multiplies the differentials by `(-1)^n`. -/
@[simps]
def shiftFunctor (n : ℤ) : CochainComplex C ℤ ⥤ CochainComplex C ℤ where
  obj K :=
    { X := fun i => K.X (i + n)
      d := fun i j => n.negOnePow • K.d _ _
      d_comp_d' := by
        intros
        simp only [Linear.comp_units_smul, Linear.units_smul_comp, d_comp_d, smul_zero]
      shape := fun i j hij => by
        dsimp
        rw [K.shape, smul_zero]
        intro hij'
        

Proof state:
case a
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : Preadditive C
D : Type u'
inst✝¹ : Category.{v', u'} D
inst✝ : Preadditive D
n : ℤ
K : CochainComplex C ℤ
i j : ℤ
hij : ¬ComplexShape.Rel (ComplexShape.up ℤ) i j
hij' : ComplexShape.Rel (ComplexShape.up ℤ) (i + n) (j + n)
⊢ False

Next tactic:
apply hij
/-- The shift functor by `n : ℤ` on `CochainComplex C ℤ` which sends a cochain
complex `K` to the complex which is `K.X (i + n)` in degree `i`, and which
multiplies the differentials by `(-1)^n`. -/
@[simps]
def shiftFunctor (n : ℤ) : CochainComplex C ℤ ⥤ CochainComplex C ℤ where
  obj K :=
    { X := fun i => K.X (i + n)
      d := fun i j => n.negOnePow • K.d _ _
      d_comp_d' := by
        intros
        simp only [Linear.comp_units_smul, Linear.units_smul_comp, d_comp_d, smul_zero]
      shape := fun i j hij => by
        dsimp
        rw [K.shape, smul_zero]
        intro hij'
        apply hij
        

Proof state:
case a
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : Preadditive C
D : Type u'
inst✝¹ : Category.{v', u'} D
inst✝ : Preadditive D
n : ℤ
K : CochainComplex C ℤ
i j : ℤ
hij : ¬ComplexShape.Rel (ComplexShape.up ℤ) i j
hij' : ComplexShape.Rel (ComplexShape.up ℤ) (i + n) (j + n)
⊢ ComplexShape.Rel (ComplexShape.up ℤ) i j

Next tactic:
dsimp at hij' ⊢
/-- The shift functor by `n : ℤ` on `CochainComplex C ℤ` which sends a cochain
complex `K` to the complex which is `K.X (i + n)` in degree `i`, and which
multiplies the differentials by `(-1)^n`. -/
@[simps]
def shiftFunctor (n : ℤ) : CochainComplex C ℤ ⥤ CochainComplex C ℤ where
  obj K :=
    { X := fun i => K.X (i + n)
      d := fun i j => n.negOnePow • K.d _ _
      d_comp_d' := by
        intros
        simp only [Linear.comp_units_smul, Linear.units_smul_comp, d_comp_d, smul_zero]
      shape := fun i j hij => by
        dsimp
        rw [K.shape, smul_zero]
        intro hij'
        apply hij
        dsimp at hij' ⊢
        

Proof state:
case a
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : Preadditive C
D : Type u'
inst✝¹ : Category.{v', u'} D
inst✝ : Preadditive D
n : ℤ
K : CochainComplex C ℤ
i j : ℤ
hij : ¬ComplexShape.Rel (ComplexShape.up ℤ) i j
hij' : i + n + 1 = j + n
⊢ i + 1 = j

Next tactic:
linarith
/-- The shift functor by `n : ℤ` on `CochainComplex C ℤ` which sends a cochain
complex `K` to the complex which is `K.X (i + n)` in degree `i`, and which
multiplies the differentials by `(-1)^n`. -/
@[simps]
def shiftFunctor (n : ℤ) : CochainComplex C ℤ ⥤ CochainComplex C ℤ where
  obj K :=
    { X := fun i => K.X (i + n)
      d := fun i j => n.negOnePow • K.d _ _
      d_comp_d' := by
        

Proof state:
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : Preadditive C
D : Type u'
inst✝¹ : Category.{v', u'} D
inst✝ : Preadditive D
n : ℤ
K : CochainComplex C ℤ
⊢ ∀ (i j k : ℤ),
    ComplexShape.Rel (ComplexShape.up ℤ) i j →
      ComplexShape.Rel (ComplexShape.up ℤ) j k →
        (fun i j => n.negOnePow • d K (i + n) (j + n)) i j ≫ (fun i j => n.negOnePow • d K (i + n) (j + n)) j k = 0

Next tactic:
intros
/-- The shift functor by `n : ℤ` on `CochainComplex C ℤ` which sends a cochain
complex `K` to the complex which is `K.X (i + n)` in degree `i`, and which
multiplies the differentials by `(-1)^n`. -/
@[simps]
def shiftFunctor (n : ℤ) : CochainComplex C ℤ ⥤ CochainComplex C ℤ where
  obj K :=
    { X := fun i => K.X (i + n)
      d := fun i j => n.negOnePow • K.d _ _
      d_comp_d' := by
        intros
        

Proof state:
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : Preadditive C
D : Type u'
inst✝¹ : Category.{v', u'} D
inst✝ : Preadditive D
n : ℤ
K : CochainComplex C ℤ
i✝ j✝ k✝ : ℤ
a✝¹ : ComplexShape.Rel (ComplexShape.up ℤ) i✝ j✝
a✝ : ComplexShape.Rel (ComplexShape.up ℤ) j✝ k✝
⊢ (fun i j => n.negOnePow • d K (i + n) (j + n)) i✝ j✝ ≫ (fun i j => n.negOnePow • d K (i + n) (j + n)) j✝ k✝ = 0

Next tactic:
simp only [Linear.comp_units_smul, Linear.units_smul_comp, d_comp_d, smul_zero]
/-- The shift functor by `n : ℤ` on `CochainComplex C ℤ` which sends a cochain
complex `K` to the complex which is `K.X (i + n)` in degree `i`, and which
multiplies the differentials by `(-1)^n`. -/
@[simps]
def shiftFunctor (n : ℤ) : CochainComplex C ℤ ⥤ CochainComplex C ℤ where
  obj K :=
    { X := fun i => K.X (i + n)
      d := fun i j => n.negOnePow • K.d _ _
      d_comp_d' := by
        intros
        simp only [Linear.comp_units_smul, Linear.units_smul_comp, d_comp_d, smul_zero]
      shape := fun i j hij => by
        dsimp
        rw [K.shape, smul_zero]
        intro hij'
        apply hij
        dsimp at hij' ⊢
        linarith }
  map φ :=
    { f := fun i => φ.f _
      comm' := by
        

Proof state:
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : Preadditive C
D : Type u'
inst✝¹ : Category.{v', u'} D
inst✝ : Preadditive D
n : ℤ
X✝ Y✝ : CochainComplex C ℤ
φ : X✝ ⟶ Y✝
⊢ ∀ (i j : ℤ),
    ComplexShape.Rel (ComplexShape.up ℤ) i j →
      (fun i => Hom.f φ (i + n)) i ≫
          d ((fun K => HomologicalComplex.mk (fun i => X K (i + n)) fun i j => n.negOnePow • d K (i + n) (j + n)) Y✝) i
            j =
        d ((fun K => HomologicalComplex.mk (fun i => X K (i + n)) fun i j => n.negOnePow • d K (i + n) (j + n)) X✝) i
            j ≫
          (fun i => Hom.f φ (i + n)) j

Next tactic:
intros
/-- The shift functor by `n : ℤ` on `CochainComplex C ℤ` which sends a cochain
complex `K` to the complex which is `K.X (i + n)` in degree `i`, and which
multiplies the differentials by `(-1)^n`. -/
@[simps]
def shiftFunctor (n : ℤ) : CochainComplex C ℤ ⥤ CochainComplex C ℤ where
  obj K :=
    { X := fun i => K.X (i + n)
      d := fun i j => n.negOnePow • K.d _ _
      d_comp_d' := by
        intros
        simp only [Linear.comp_units_smul, Linear.units_smul_comp, d_comp_d, smul_zero]
      shape := fun i j hij => by
        dsimp
        rw [K.shape, smul_zero]
        intro hij'
        apply hij
        dsimp at hij' ⊢
        linarith }
  map φ :=
    { f := fun i => φ.f _
      comm' := by
        intros
        

Proof state:
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : Preadditive C
D : Type u'
inst✝¹ : Category.{v', u'} D
inst✝ : Preadditive D
n : ℤ
X✝ Y✝ : CochainComplex C ℤ
φ : X✝ ⟶ Y✝
i✝ j✝ : ℤ
a✝ : ComplexShape.Rel (ComplexShape.up ℤ) i✝ j✝
⊢ (fun i => Hom.f φ (i + n)) i✝ ≫
      d ((fun K => HomologicalComplex.mk (fun i => X K (i + n)) fun i j => n.negOnePow • d K (i + n) (j + n)) Y✝) i✝
        j✝ =
    d ((fun K => HomologicalComplex.mk (fun i => X K (i + n)) fun i j => n.negOnePow • d K (i + n) (j + n)) X✝) i✝ j✝ ≫
      (fun i => Hom.f φ (i + n)) j✝

Next tactic:
dsimp
/-- The shift functor by `n : ℤ` on `CochainComplex C ℤ` which sends a cochain
complex `K` to the complex which is `K.X (i + n)` in degree `i`, and which
multiplies the differentials by `(-1)^n`. -/
@[simps]
def shiftFunctor (n : ℤ) : CochainComplex C ℤ ⥤ CochainComplex C ℤ where
  obj K :=
    { X := fun i => K.X (i + n)
      d := fun i j => n.negOnePow • K.d _ _
      d_comp_d' := by
        intros
        simp only [Linear.comp_units_smul, Linear.units_smul_comp, d_comp_d, smul_zero]
      shape := fun i j hij => by
        dsimp
        rw [K.shape, smul_zero]
        intro hij'
        apply hij
        dsimp at hij' ⊢
        linarith }
  map φ :=
    { f := fun i => φ.f _
      comm' := by
        intros
        dsimp
        

Proof state:
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : Preadditive C
D : Type u'
inst✝¹ : Category.{v', u'} D
inst✝ : Preadditive D
n : ℤ
X✝ Y✝ : CochainComplex C ℤ
φ : X✝ ⟶ Y✝
i✝ j✝ : ℤ
a✝ : ComplexShape.Rel (ComplexShape.up ℤ) i✝ j✝
⊢ Hom.f φ (i✝ + n) ≫ (n.negOnePow • d Y✝ (i✝ + n) (j✝ + n)) = (n.negOnePow • d X✝ (i✝ + n) (j✝ + n)) ≫ Hom.f φ (j✝ + n)

Next tactic:
simp only [Linear.comp_units_smul, Hom.comm, Linear.units_smul_comp]
/-- The shift functor by `n : ℤ` on `CochainComplex C ℤ` which sends a cochain
complex `K` to the complex which is `K.X (i + n)` in degree `i`, and which
multiplies the differentials by `(-1)^n`. -/
@[simps]
def shiftFunctor (n : ℤ) : CochainComplex C ℤ ⥤ CochainComplex C ℤ where
  obj K :=
    { X := fun i => K.X (i + n)
      d := fun i j => n.negOnePow • K.d _ _
      d_comp_d' := by
        intros
        simp only [Linear.comp_units_smul, Linear.units_smul_comp, d_comp_d, smul_zero]
      shape := fun i j hij => by
        dsimp
        rw [K.shape, smul_zero]
        intro hij'
        apply hij
        dsimp at hij' ⊢
        linarith }
  map φ :=
    { f := fun i => φ.f _
      comm' := by
        intros
        dsimp
        simp only [Linear.comp_units_smul, Hom.comm, Linear.units_smul_comp] }
  map_id := by 

Proof state:
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : Preadditive C
D : Type u'
inst✝¹ : Category.{v', u'} D
inst✝ : Preadditive D
n : ℤ
⊢ ∀ (X : CochainComplex C ℤ),
    {
            obj := fun K =>
              HomologicalComplex.mk (fun i => HomologicalComplex.X K (i + n)) fun i j =>
                n.negOnePow • d K (i + n) (j + n),
            map := fun {X Y} φ => Hom.mk fun i => Hom.f φ (i + n) }.map
        (𝟙 X) =
      𝟙
        ({
              obj := fun K =>
                HomologicalComplex.mk (fun i => HomologicalComplex.X K (i + n)) fun i j =>
                  n.negOnePow • d K (i + n) (j + n),
              map := fun {X Y} φ => Hom.mk fun i => Hom.f φ (i + n) }.obj
          X)

Next tactic:
intros