l3lab/ntp-mathlib huggingface dataset:
/-- Construct an `α`-indexed chain complex from a dependently-typed differential.
-/
def of (X : α → V) (d : ∀ n, X (n + 1) ⟶ X n) (sq : ∀ n, d (n + 1) ≫ d n = 0) : ChainComplex V α :=
  { X := X
    d := fun i j => if h : i = j + 1 then eqToHom (by rw [h]) ≫ d j else 0
    shape := fun i j w => by
      dsimp
      rw [dif_neg (Ne.symm w)]
    d_comp_d' := fun i j k hij hjk => by
      

Proof state:
ι : Type u_1
V : Type u
inst✝⁴ : Category.{v, u} V
inst✝³ : HasZeroMorphisms V
α : Type u_2
inst✝² : AddRightCancelSemigroup α
inst✝¹ : One α
inst✝ : DecidableEq α
X : α → V
d : (n : α) → X (n + 1) ⟶ X n
sq : ∀ (n : α), d (n + 1) ≫ d n = 0
i j k : α
hij : ComplexShape.Rel (ComplexShape.down α) i j
hjk : ComplexShape.Rel (ComplexShape.down α) j k
⊢ (fun i j => if h : i = j + 1 then eqToHom (_ : X i = X (j + 1)) ≫ d j else 0) i j ≫
      (fun i j => if h : i = j + 1 then eqToHom (_ : X i = X (j + 1)) ≫ d j else 0) j k =
    0

Next tactic:
dsimp at hij hjk
/-- Construct an `α`-indexed chain complex from a dependently-typed differential.
-/
def of (X : α → V) (d : ∀ n, X (n + 1) ⟶ X n) (sq : ∀ n, d (n + 1) ≫ d n = 0) : ChainComplex V α :=
  { X := X
    d := fun i j => if h : i = j + 1 then eqToHom (by rw [h]) ≫ d j else 0
    shape := fun i j w => by
      dsimp
      rw [dif_neg (Ne.symm w)]
    d_comp_d' := fun i j k hij hjk => by
      dsimp at hij hjk
      

Proof state:
ι : Type u_1
V : Type u
inst✝⁴ : Category.{v, u} V
inst✝³ : HasZeroMorphisms V
α : Type u_2
inst✝² : AddRightCancelSemigroup α
inst✝¹ : One α
inst✝ : DecidableEq α
X : α → V
d : (n : α) → X (n + 1) ⟶ X n
sq : ∀ (n : α), d (n + 1) ≫ d n = 0
i j k : α
hij : j + 1 = i
hjk : k + 1 = j
⊢ (fun i j => if h : i = j + 1 then eqToHom (_ : X i = X (j + 1)) ≫ d j else 0) i j ≫
      (fun i j => if h : i = j + 1 then eqToHom (_ : X i = X (j + 1)) ≫ d j else 0) j k =
    0

Next tactic:
substs hij hjk
/-- Construct an `α`-indexed chain complex from a dependently-typed differential.
-/
def of (X : α → V) (d : ∀ n, X (n + 1) ⟶ X n) (sq : ∀ n, d (n + 1) ≫ d n = 0) : ChainComplex V α :=
  { X := X
    d := fun i j => if h : i = j + 1 then eqToHom (by rw [h]) ≫ d j else 0
    shape := fun i j w => by
      dsimp
      rw [dif_neg (Ne.symm w)]
    d_comp_d' := fun i j k hij hjk => by
      dsimp at hij hjk
      substs hij hjk
      

Proof state:
ι : Type u_1
V : Type u
inst✝⁴ : Category.{v, u} V
inst✝³ : HasZeroMorphisms V
α : Type u_2
inst✝² : AddRightCancelSemigroup α
inst✝¹ : One α
inst✝ : DecidableEq α
X : α → V
d : (n : α) → X (n + 1) ⟶ X n
sq : ∀ (n : α), d (n + 1) ≫ d n = 0
k : α
⊢ (fun i j => if h : i = j + 1 then eqToHom (_ : X i = X (j + 1)) ≫ d j else 0) (k + 1 + 1) (k + 1) ≫
      (fun i j => if h : i = j + 1 then eqToHom (_ : X i = X (j + 1)) ≫ d j else 0) (k + 1) k =
    0

Next tactic:
simp only [eqToHom_refl, id_comp, dite_eq_ite, ite_true, sq]
@[simp]
theorem of_d (j : α) : (of X d sq).d (j + 1) j = d j := by
  

Proof state:
ι : Type u_1
V : Type u
inst✝⁴ : Category.{v, u} V
inst✝³ : HasZeroMorphisms V
α : Type u_2
inst✝² : AddRightCancelSemigroup α
inst✝¹ : One α
inst✝ : DecidableEq α
X : α → V
d : (n : α) → X (n + 1) ⟶ X n
sq : ∀ (n : α), d (n + 1) ≫ d n = 0
j : α
⊢ HomologicalComplex.d (of X d sq) (j + 1) j = d j

Next tactic:
dsimp [of]
@[simp]
theorem of_d (j : α) : (of X d sq).d (j + 1) j = d j := by
  dsimp [of]
  

Proof state:
ι : Type u_1
V : Type u
inst✝⁴ : Category.{v, u} V
inst✝³ : HasZeroMorphisms V
α : Type u_2
inst✝² : AddRightCancelSemigroup α
inst✝¹ : One α
inst✝ : DecidableEq α
X : α → V
d : (n : α) → X (n + 1) ⟶ X n
sq : ∀ (n : α), d (n + 1) ≫ d n = 0
j : α
⊢ (if j + 1 = j + 1 then 𝟙 (X (j + 1)) ≫ d j else 0) = d j

Next tactic:
rw [if_pos rfl, Category.id_comp]
theorem of_d_ne {i j : α} (h : i ≠ j + 1) : (of X d sq).d i j = 0 := by
  

Proof state:
ι : Type u_1
V : Type u
inst✝⁴ : Category.{v, u} V
inst✝³ : HasZeroMorphisms V
α : Type u_2
inst✝² : AddRightCancelSemigroup α
inst✝¹ : One α
inst✝ : DecidableEq α
X : α → V
d : (n : α) → X (n + 1) ⟶ X n
sq : ∀ (n : α), d (n + 1) ≫ d n = 0
i j : α
h : i ≠ j + 1
⊢ HomologicalComplex.d (of X d sq) i j = 0

Next tactic:
dsimp [of]
theorem of_d_ne {i j : α} (h : i ≠ j + 1) : (of X d sq).d i j = 0 := by
  dsimp [of]
  

Proof state:
ι : Type u_1
V : Type u
inst✝⁴ : Category.{v, u} V
inst✝³ : HasZeroMorphisms V
α : Type u_2
inst✝² : AddRightCancelSemigroup α
inst✝¹ : One α
inst✝ : DecidableEq α
X : α → V
d : (n : α) → X (n + 1) ⟶ X n
sq : ∀ (n : α), d (n + 1) ≫ d n = 0
i j : α
h : i ≠ j + 1
⊢ (if h : i = j + 1 then eqToHom (_ : X i = X (j + 1)) ≫ d j else 0) = 0

Next tactic:
rw [dif_neg h]
/-- A constructor for chain maps between `α`-indexed chain complexes built using `ChainComplex.of`,
from a dependently typed collection of morphisms.
-/
@[simps]
def ofHom (f : ∀ i : α, X i ⟶ Y i) (comm : ∀ i : α, f (i + 1) ≫ d_Y i = d_X i ≫ f i) :
    of X d_X sq_X ⟶ of Y d_Y sq_Y :=
  { f
    comm' := fun n m => by
      

Proof state:
ι : Type u_1
V : Type u
inst✝⁴ : Category.{v, u} V
inst✝³ : HasZeroMorphisms V
α : Type u_2
inst✝² : AddRightCancelSemigroup α
inst✝¹ : One α
inst✝ : DecidableEq α
X : α → V
d_X : (n : α) → X (n + 1) ⟶ X n
sq_X : ∀ (n : α), d_X (n + 1) ≫ d_X n = 0
Y : α → V
d_Y : (n : α) → Y (n + 1) ⟶ Y n
sq_Y : ∀ (n : α), d_Y (n + 1) ≫ d_Y n = 0
f : (i : α) → X i ⟶ Y i
comm : ∀ (i : α), f (i + 1) ≫ d_Y i = d_X i ≫ f i
n m : α
⊢ ComplexShape.Rel (ComplexShape.down α) n m →
    f n ≫ HomologicalComplex.d (of Y d_Y sq_Y) n m = HomologicalComplex.d (of X d_X sq_X) n m ≫ f m

Next tactic:
by_cases h : n = m + 1
/-- A constructor for chain maps between `α`-indexed chain complexes built using `ChainComplex.of`,
from a dependently typed collection of morphisms.
-/
@[simps]
def ofHom (f : ∀ i : α, X i ⟶ Y i) (comm : ∀ i : α, f (i + 1) ≫ d_Y i = d_X i ≫ f i) :
    of X d_X sq_X ⟶ of Y d_Y sq_Y :=
  { f
    comm' := fun n m => by
      by_cases h : n = m + 1
      · 

Proof state:
case pos
ι : Type u_1
V : Type u
inst✝⁴ : Category.{v, u} V
inst✝³ : HasZeroMorphisms V
α : Type u_2
inst✝² : AddRightCancelSemigroup α
inst✝¹ : One α
inst✝ : DecidableEq α
X : α → V
d_X : (n : α) → X (n + 1) ⟶ X n
sq_X : ∀ (n : α), d_X (n + 1) ≫ d_X n = 0
Y : α → V
d_Y : (n : α) → Y (n + 1) ⟶ Y n
sq_Y : ∀ (n : α), d_Y (n + 1) ≫ d_Y n = 0
f : (i : α) → X i ⟶ Y i
comm : ∀ (i : α), f (i + 1) ≫ d_Y i = d_X i ≫ f i
n m : α
h : n = m + 1
⊢ ComplexShape.Rel (ComplexShape.down α) n m →
    f n ≫ HomologicalComplex.d (of Y d_Y sq_Y) n m = HomologicalComplex.d (of X d_X sq_X) n m ≫ f m

Next tactic:
subst h
/-- A constructor for chain maps between `α`-indexed chain complexes built using `ChainComplex.of`,
from a dependently typed collection of morphisms.
-/
@[simps]
def ofHom (f : ∀ i : α, X i ⟶ Y i) (comm : ∀ i : α, f (i + 1) ≫ d_Y i = d_X i ≫ f i) :
    of X d_X sq_X ⟶ of Y d_Y sq_Y :=
  { f
    comm' := fun n m => by
      by_cases h : n = m + 1
      · subst h
        

Proof state:
case pos
ι : Type u_1
V : Type u
inst✝⁴ : Category.{v, u} V
inst✝³ : HasZeroMorphisms V
α : Type u_2
inst✝² : AddRightCancelSemigroup α
inst✝¹ : One α
inst✝ : DecidableEq α
X : α → V
d_X : (n : α) → X (n + 1) ⟶ X n
sq_X : ∀ (n : α), d_X (n + 1) ≫ d_X n = 0
Y : α → V
d_Y : (n : α) → Y (n + 1) ⟶ Y n
sq_Y : ∀ (n : α), d_Y (n + 1) ≫ d_Y n = 0
f : (i : α) → X i ⟶ Y i
comm : ∀ (i : α), f (i + 1) ≫ d_Y i = d_X i ≫ f i
m : α
⊢ ComplexShape.Rel (ComplexShape.down α) (m + 1) m →
    f (m + 1) ≫ HomologicalComplex.d (of Y d_Y sq_Y) (m + 1) m = HomologicalComplex.d (of X d_X sq_X) (m + 1) m ≫ f m

Next tactic:
simpa using comm m
/-- A constructor for chain maps between `α`-indexed chain complexes built using `ChainComplex.of`,
from a dependently typed collection of morphisms.
-/
@[simps]
def ofHom (f : ∀ i : α, X i ⟶ Y i) (comm : ∀ i : α, f (i + 1) ≫ d_Y i = d_X i ≫ f i) :
    of X d_X sq_X ⟶ of Y d_Y sq_Y :=
  { f
    comm' := fun n m => by
      by_cases h : n = m + 1
      · subst h
        simpa using comm m
      · 

Proof state:
case neg
ι : Type u_1
V : Type u
inst✝⁴ : Category.{v, u} V
inst✝³ : HasZeroMorphisms V
α : Type u_2
inst✝² : AddRightCancelSemigroup α
inst✝¹ : One α
inst✝ : DecidableEq α
X : α → V
d_X : (n : α) → X (n + 1) ⟶ X n
sq_X : ∀ (n : α), d_X (n + 1) ≫ d_X n = 0
Y : α → V
d_Y : (n : α) → Y (n + 1) ⟶ Y n
sq_Y : ∀ (n : α), d_Y (n + 1) ≫ d_Y n = 0
f : (i : α) → X i ⟶ Y i
comm : ∀ (i : α), f (i + 1) ≫ d_Y i = d_X i ≫ f i
n m : α
h : ¬n = m + 1
⊢ ComplexShape.Rel (ComplexShape.down α) n m →
    f n ≫ HomologicalComplex.d (of Y d_Y sq_Y) n m = HomologicalComplex.d (of X d_X sq_X) n m ≫ f m

Next tactic:
rw [of_d_ne X _ _ h, of_d_ne Y _ _ h]
/-- A constructor for chain maps between `α`-indexed chain complexes built using `ChainComplex.of`,
from a dependently typed collection of morphisms.
-/
@[simps]
def ofHom (f : ∀ i : α, X i ⟶ Y i) (comm : ∀ i : α, f (i + 1) ≫ d_Y i = d_X i ≫ f i) :
    of X d_X sq_X ⟶ of Y d_Y sq_Y :=
  { f
    comm' := fun n m => by
      by_cases h : n = m + 1
      · subst h
        simpa using comm m
      · rw [of_d_ne X _ _ h, of_d_ne Y _ _ h]
        

Proof state:
case neg
ι : Type u_1
V : Type u
inst✝⁴ : Category.{v, u} V
inst✝³ : HasZeroMorphisms V
α : Type u_2
inst✝² : AddRightCancelSemigroup α
inst✝¹ : One α
inst✝ : DecidableEq α
X : α → V
d_X : (n : α) → X (n + 1) ⟶ X n
sq_X : ∀ (n : α), d_X (n + 1) ≫ d_X n = 0
Y : α → V
d_Y : (n : α) → Y (n + 1) ⟶ Y n
sq_Y : ∀ (n : α), d_Y (n + 1) ≫ d_Y n = 0
f : (i : α) → X i ⟶ Y i
comm : ∀ (i : α), f (i + 1) ≫ d_Y i = d_X i ≫ f i
n m : α
h : ¬n = m + 1
⊢ ComplexShape.Rel (ComplexShape.down α) n m → f n ≫ 0 = 0 ≫ f m

Next tactic:
simp
@[simp]
theorem mk_d_1_0 : (mk X₀ X₁ X₂ d₀ d₁ s succ).d 1 0 = d₀ := by
  

Proof state:
ι : Type u_1
V : Type u
inst✝¹ : Category.{v, u} V
inst✝ : HasZeroMorphisms V
X₀ X₁ X₂ : V
d₀ : X₁ ⟶ X₀
d₁ : X₂ ⟶ X₁
s : d₁ ≫ d₀ = 0
succ :
  (t : (X₀ : V) ×' (X₁ : V) ×' (X₂ : V) ×' (d₀ : X₁ ⟶ X₀) ×' (d₁ : X₂ ⟶ X₁) ×' d₁ ≫ d₀ = 0) →
    (X₃ : V) ×' (d₂ : X₃ ⟶ t.snd.snd.fst) ×' d₂ ≫ t.snd.snd.snd.snd.fst = 0
⊢ HomologicalComplex.d (mk X₀ X₁ X₂ d₀ d₁ s succ) 1 0 = d₀

Next tactic:
change ite (1 = 0 + 1) (𝟙 X₁ ≫ d₀) 0 = d₀
@[simp]
theorem mk_d_1_0 : (mk X₀ X₁ X₂ d₀ d₁ s succ).d 1 0 = d₀ := by
  change ite (1 = 0 + 1) (𝟙 X₁ ≫ d₀) 0 = d₀
  

Proof state:
ι : Type u_1
V : Type u
inst✝¹ : Category.{v, u} V
inst✝ : HasZeroMorphisms V
X₀ X₁ X₂ : V
d₀ : X₁ ⟶ X₀
d₁ : X₂ ⟶ X₁
s : d₁ ≫ d₀ = 0
succ :
  (t : (X₀ : V) ×' (X₁ : V) ×' (X₂ : V) ×' (d₀ : X₁ ⟶ X₀) ×' (d₁ : X₂ ⟶ X₁) ×' d₁ ≫ d₀ = 0) →
    (X₃ : V) ×' (d₂ : X₃ ⟶ t.snd.snd.fst) ×' d₂ ≫ t.snd.snd.snd.snd.fst = 0
⊢ (if 1 = 0 + 1 then 𝟙 X₁ ≫ d₀ else 0) = d₀

Next tactic:
rw [if_pos rfl, Category.id_comp]
@[simp]
theorem mk_d_2_1 : (mk X₀ X₁ X₂ d₀ d₁ s succ).d 2 1 = d₁ := by
  

Proof state:
ι : Type u_1
V : Type u
inst✝¹ : Category.{v, u} V
inst✝ : HasZeroMorphisms V
X₀ X₁ X₂ : V
d₀ : X₁ ⟶ X₀
d₁ : X₂ ⟶ X₁
s : d₁ ≫ d₀ = 0
succ :
  (t : (X₀ : V) ×' (X₁ : V) ×' (X₂ : V) ×' (d₀ : X₁ ⟶ X₀) ×' (d₁ : X₂ ⟶ X₁) ×' d₁ ≫ d₀ = 0) →
    (X₃ : V) ×' (d₂ : X₃ ⟶ t.snd.snd.fst) ×' d₂ ≫ t.snd.snd.snd.snd.fst = 0
⊢ HomologicalComplex.d (mk X₀ X₁ X₂ d₀ d₁ s succ) 2 1 = d₁

Next tactic:
change ite (2 = 1 + 1) (𝟙 X₂ ≫ d₁) 0 = d₁
@[simp]
theorem mk_d_2_1 : (mk X₀ X₁ X₂ d₀ d₁ s succ).d 2 1 = d₁ := by
  change ite (2 = 1 + 1) (𝟙 X₂ ≫ d₁) 0 = d₁
  

Proof state:
ι : Type u_1
V : Type u
inst✝¹ : Category.{v, u} V
inst✝ : HasZeroMorphisms V
X₀ X₁ X₂ : V
d₀ : X₁ ⟶ X₀
d₁ : X₂ ⟶ X₁
s : d₁ ≫ d₀ = 0
succ :
  (t : (X₀ : V) ×' (X₁ : V) ×' (X₂ : V) ×' (d₀ : X₁ ⟶ X₀) ×' (d₁ : X₂ ⟶ X₁) ×' d₁ ≫ d₀ = 0) →
    (X₃ : V) ×' (d₂ : X₃ ⟶ t.snd.snd.fst) ×' d₂ ≫ t.snd.snd.snd.snd.fst = 0
⊢ (if 2 = 1 + 1 then 𝟙 X₂ ≫ d₁ else 0) = d₁

Next tactic:
rw [if_pos rfl, Category.id_comp]
@[simp]
theorem mk'_d_1_0 : (mk' X₀ X₁ d₀ succ').d 1 0 = d₀ := by
  

Proof state:
ι : Type u_1
V : Type u
inst✝¹ : Category.{v, u} V
inst✝ : HasZeroMorphisms V
X₀ X₁ X₂ : V
d₀ : X₁ ⟶ X₀
d₁ : X₂ ⟶ X₁
s : d₁ ≫ d₀ = 0
succ :
  (t : (X₀ : V) ×' (X₁ : V) ×' (X₂ : V) ×' (d₀ : X₁ ⟶ X₀) ×' (d₁ : X₂ ⟶ X₁) ×' d₁ ≫ d₀ = 0) →
    (X₃ : V) ×' (d₂ : X₃ ⟶ t.snd.snd.fst) ×' d₂ ≫ t.snd.snd.snd.snd.fst = 0
succ' : (t : (X₀ : V) × (X₁ : V) × (X₁ ⟶ X₀)) → (X₂ : V) ×' (d : X₂ ⟶ t.snd.fst) ×' d ≫ t.snd.snd = 0
⊢ HomologicalComplex.d (mk' X₀ X₁ d₀ succ') 1 0 = d₀

Next tactic:
change ite (1 = 0 + 1) (𝟙 X₁ ≫ d₀) 0 = d₀
@[simp]
theorem mk'_d_1_0 : (mk' X₀ X₁ d₀ succ').d 1 0 = d₀ := by
  change ite (1 = 0 + 1) (𝟙 X₁ ≫ d₀) 0 = d₀
  

Proof state:
ι : Type u_1
V : Type u
inst✝¹ : Category.{v, u} V
inst✝ : HasZeroMorphisms V
X₀ X₁ X₂ : V
d₀ : X₁ ⟶ X₀
d₁ : X₂ ⟶ X₁
s : d₁ ≫ d₀ = 0
succ :
  (t : (X₀ : V) ×' (X₁ : V) ×' (X₂ : V) ×' (d₀ : X₁ ⟶ X₀) ×' (d₁ : X₂ ⟶ X₁) ×' d₁ ≫ d₀ = 0) →
    (X₃ : V) ×' (d₂ : X₃ ⟶ t.snd.snd.fst) ×' d₂ ≫ t.snd.snd.snd.snd.fst = 0
succ' : (t : (X₀ : V) × (X₁ : V) × (X₁ ⟶ X₀)) → (X₂ : V) ×' (d : X₂ ⟶ t.snd.fst) ×' d ≫ t.snd.snd = 0
⊢ (if 1 = 0 + 1 then 𝟙 X₁ ≫ d₀ else 0) = d₀

Next tactic:
rw [if_pos rfl, Category.id_comp]
/-- A constructor for chain maps between `ℕ`-indexed chain complexes,
working by induction on commutative squares.

You need to provide the components of the chain map in degrees 0 and 1,
show that these form a commutative square,
and then give a construction of each component,
and the fact that it forms a commutative square with the previous component,
using as an inductive hypothesis the data (and commutativity) of the previous two components.
-/
def mkHom : P ⟶ Q where
  f n := (mkHomAux P Q zero one one_zero_comm succ n).1
  comm' n m := by
    

Proof state:
ι : Type u_1
V : Type u
inst✝¹ : Category.{v, u} V
inst✝ : HasZeroMorphisms V
P Q : ChainComplex V ℕ
zero : HomologicalComplex.X P 0 ⟶ HomologicalComplex.X Q 0
one : HomologicalComplex.X P 1 ⟶ HomologicalComplex.X Q 1
one_zero_comm : one ≫ HomologicalComplex.d Q 1 0 = HomologicalComplex.d P 1 0 ≫ zero
succ :
  (n : ℕ) →
    (p :
        (f : HomologicalComplex.X P n ⟶ HomologicalComplex.X Q n) ×'
          (f' : HomologicalComplex.X P (n + 1) ⟶ HomologicalComplex.X Q (n + 1)) ×'
            f' ≫ HomologicalComplex.d Q (n + 1) n = HomologicalComplex.d P (n + 1) n ≫ f) →
      (f'' : HomologicalComplex.X P (n + 2) ⟶ HomologicalComplex.X Q (n + 2)) ×'
        f'' ≫ HomologicalComplex.d Q (n + 2) (n + 1) = HomologicalComplex.d P (n + 2) (n + 1) ≫ p.snd.fst
n m : ℕ
⊢ ComplexShape.Rel (ComplexShape.down ℕ) n m →
    (fun n => (mkHomAux P Q zero one one_zero_comm succ n).fst) n ≫ HomologicalComplex.d Q n m =
      HomologicalComplex.d P n m ≫ (fun n => (mkHomAux P Q zero one one_zero_comm succ n).fst) m

Next tactic:
rintro (rfl : m + 1 = n)
/-- A constructor for chain maps between `ℕ`-indexed chain complexes,
working by induction on commutative squares.

You need to provide the components of the chain map in degrees 0 and 1,
show that these form a commutative square,
and then give a construction of each component,
and the fact that it forms a commutative square with the previous component,
using as an inductive hypothesis the data (and commutativity) of the previous two components.
-/
def mkHom : P ⟶ Q where
  f n := (mkHomAux P Q zero one one_zero_comm succ n).1
  comm' n m := by
    rintro (rfl : m + 1 = n)
    

Proof state:
ι : Type u_1
V : Type u
inst✝¹ : Category.{v, u} V
inst✝ : HasZeroMorphisms V
P Q : ChainComplex V ℕ
zero : HomologicalComplex.X P 0 ⟶ HomologicalComplex.X Q 0
one : HomologicalComplex.X P 1 ⟶ HomologicalComplex.X Q 1
one_zero_comm : one ≫ HomologicalComplex.d Q 1 0 = HomologicalComplex.d P 1 0 ≫ zero
succ :
  (n : ℕ) →
    (p :
        (f : HomologicalComplex.X P n ⟶ HomologicalComplex.X Q n) ×'
          (f' : HomologicalComplex.X P (n + 1) ⟶ HomologicalComplex.X Q (n + 1)) ×'
            f' ≫ HomologicalComplex.d Q (n + 1) n = HomologicalComplex.d P (n + 1) n ≫ f) →
      (f'' : HomologicalComplex.X P (n + 2) ⟶ HomologicalComplex.X Q (n + 2)) ×'
        f'' ≫ HomologicalComplex.d Q (n + 2) (n + 1) = HomologicalComplex.d P (n + 2) (n + 1) ≫ p.snd.fst
m : ℕ
⊢ (fun n => (mkHomAux P Q zero one one_zero_comm succ n).fst) (m + 1) ≫ HomologicalComplex.d Q (m + 1) m =
    HomologicalComplex.d P (m + 1) m ≫ (fun n => (mkHomAux P Q zero one one_zero_comm succ n).fst) m

Next tactic:
exact (mkHomAux P Q zero one one_zero_comm succ m).2.2
@[simp]
theorem mkHom_f_succ_succ (n : ℕ) :
    (mkHom P Q zero one one_zero_comm succ).f (n + 2) =
      (succ n
          ⟨(mkHom P Q zero one one_zero_comm succ).f n,
            (mkHom P Q zero one one_zero_comm succ).f (n + 1),
            (mkHom P Q zero one one_zero_comm succ).comm (n + 1) n⟩).1 := by
  

Proof state:
ι : Type u_1
V : Type u
inst✝¹ : Category.{v, u} V
inst✝ : HasZeroMorphisms V
P Q : ChainComplex V ℕ
zero : HomologicalComplex.X P 0 ⟶ HomologicalComplex.X Q 0
one : HomologicalComplex.X P 1 ⟶ HomologicalComplex.X Q 1
one_zero_comm : one ≫ HomologicalComplex.d Q 1 0 = HomologicalComplex.d P 1 0 ≫ zero
succ :
  (n : ℕ) →
    (p :
        (f : HomologicalComplex.X P n ⟶ HomologicalComplex.X Q n) ×'
          (f' : HomologicalComplex.X P (n + 1) ⟶ HomologicalComplex.X Q (n + 1)) ×'
            f' ≫ HomologicalComplex.d Q (n + 1) n = HomologicalComplex.d P (n + 1) n ≫ f) →
      (f'' : HomologicalComplex.X P (n + 2) ⟶ HomologicalComplex.X Q (n + 2)) ×'
        f'' ≫ HomologicalComplex.d Q (n + 2) (n + 1) = HomologicalComplex.d P (n + 2) (n + 1) ≫ p.snd.fst
n : ℕ
⊢ HomologicalComplex.Hom.f (mkHom P Q zero one one_zero_comm succ) (n + 2) =
    (succ n
        { fst := HomologicalComplex.Hom.f (mkHom P Q zero one one_zero_comm succ) n,
          snd :=
            { fst := HomologicalComplex.Hom.f (mkHom P Q zero one one_zero_comm succ) (n + 1),
              snd :=
                (_ :
                  HomologicalComplex.Hom.f (mkHom P Q zero one one_zero_comm succ) (n + 1) ≫
                      HomologicalComplex.d Q (n + 1) n =
                    HomologicalComplex.d P (n + 1) n ≫
                      HomologicalComplex.Hom.f (mkHom P Q zero one one_zero_comm succ) n) } }).fst

Next tactic:
dsimp [mkHom, mkHomAux]
/-- Construct an `α`-indexed cochain complex from a dependently-typed differential.
-/
def of (X : α → V) (d : ∀ n, X n ⟶ X (n + 1)) (sq : ∀ n, d n ≫ d (n + 1) = 0) :
    CochainComplex V α :=
  { X := X
    d := fun i j => if h : i + 1 = j then d _ ≫ eqToHom (by 

Proof state:
ι : Type u_1
V : Type u
inst✝⁴ : Category.{v, u} V
inst✝³ : HasZeroMorphisms V
α : Type u_2
inst✝² : AddRightCancelSemigroup α
inst✝¹ : One α
inst✝ : DecidableEq α
X : α → V
d : (n : α) → X n ⟶ X (n + 1)
sq : ∀ (n : α), d n ≫ d (n + 1) = 0
i j : α
h : i + 1 = j
⊢ X (i + 1) = X j

Next tactic:
rw [h]
/-- Construct an `α`-indexed cochain complex from a dependently-typed differential.
-/
def of (X : α → V) (d : ∀ n, X n ⟶ X (n + 1)) (sq : ∀ n, d n ≫ d (n + 1) = 0) :
    CochainComplex V α :=
  { X := X
    d := fun i j => if h : i + 1 = j then d _ ≫ eqToHom (by rw [h]) else 0
    shape := fun i j w => by
      

Proof state:
ι : Type u_1
V : Type u
inst✝⁴ : Category.{v, u} V
inst✝³ : HasZeroMorphisms V
α : Type u_2
inst✝² : AddRightCancelSemigroup α
inst✝¹ : One α
inst✝ : DecidableEq α
X : α → V
d : (n : α) → X n ⟶ X (n + 1)
sq : ∀ (n : α), d n ≫ d (n + 1) = 0
i j : α
w : ¬ComplexShape.Rel (ComplexShape.up α) i j
⊢ (fun i j => if h : i + 1 = j then d i ≫ eqToHom (_ : X (i + 1) = X j) else 0) i j = 0

Next tactic:
dsimp
/-- Construct an `α`-indexed cochain complex from a dependently-typed differential.
-/
def of (X : α → V) (d : ∀ n, X n ⟶ X (n + 1)) (sq : ∀ n, d n ≫ d (n + 1) = 0) :
    CochainComplex V α :=
  { X := X
    d := fun i j => if h : i + 1 = j then d _ ≫ eqToHom (by rw [h]) else 0
    shape := fun i j w => by
      dsimp
      

Proof state:
ι : Type u_1
V : Type u
inst✝⁴ : Category.{v, u} V
inst✝³ : HasZeroMorphisms V
α : Type u_2
inst✝² : AddRightCancelSemigroup α
inst✝¹ : One α
inst✝ : DecidableEq α
X : α → V
d : (n : α) → X n ⟶ X (n + 1)
sq : ∀ (n : α), d n ≫ d (n + 1) = 0
i j : α
w : ¬ComplexShape.Rel (ComplexShape.up α) i j
⊢ (if h : i + 1 = j then d i ≫ eqToHom (_ : X (i + 1) = X j) else 0) = 0

Next tactic:
rw [dif_neg]
/-- Construct an `α`-indexed cochain complex from a dependently-typed differential.
-/
def of (X : α → V) (d : ∀ n, X n ⟶ X (n + 1)) (sq : ∀ n, d n ≫ d (n + 1) = 0) :
    CochainComplex V α :=
  { X := X
    d := fun i j => if h : i + 1 = j then d _ ≫ eqToHom (by rw [h]) else 0
    shape := fun i j w => by
      dsimp
      rw [dif_neg]
      

Proof state:
case hnc
ι : Type u_1
V : Type u
inst✝⁴ : Category.{v, u} V
inst✝³ : HasZeroMorphisms V
α : Type u_2
inst✝² : AddRightCancelSemigroup α
inst✝¹ : One α
inst✝ : DecidableEq α
X : α → V
d : (n : α) → X n ⟶ X (n + 1)
sq : ∀ (n : α), d n ≫ d (n + 1) = 0
i j : α
w : ¬ComplexShape.Rel (ComplexShape.up α) i j
⊢ ¬i + 1 = j

Next tactic:
exact w
/-- Construct an `α`-indexed cochain complex from a dependently-typed differential.
-/
def of (X : α → V) (d : ∀ n, X n ⟶ X (n + 1)) (sq : ∀ n, d n ≫ d (n + 1) = 0) :
    CochainComplex V α :=
  { X := X
    d := fun i j => if h : i + 1 = j then d _ ≫ eqToHom (by rw [h]) else 0
    shape := fun i j w => by
      dsimp
      rw [dif_neg]
      exact w
    d_comp_d' := fun i j k => by
      

Proof state:
ι : Type u_1
V : Type u
inst✝⁴ : Category.{v, u} V
inst✝³ : HasZeroMorphisms V
α : Type u_2
inst✝² : AddRightCancelSemigroup α
inst✝¹ : One α
inst✝ : DecidableEq α
X : α → V
d : (n : α) → X n ⟶ X (n + 1)
sq : ∀ (n : α), d n ≫ d (n + 1) = 0
i j k : α
⊢ ComplexShape.Rel (ComplexShape.up α) i j →
    ComplexShape.Rel (ComplexShape.up α) j k →
      (fun i j => if h : i + 1 = j then d i ≫ eqToHom (_ : X (i + 1) = X j) else 0) i j ≫
          (fun i j => if h : i + 1 = j then d i ≫ eqToHom (_ : X (i + 1) = X j) else 0) j k =
        0

Next tactic:
dsimp
/-- Construct an `α`-indexed cochain complex from a dependently-typed differential.
-/
def of (X : α → V) (d : ∀ n, X n ⟶ X (n + 1)) (sq : ∀ n, d n ≫ d (n + 1) = 0) :
    CochainComplex V α :=
  { X := X
    d := fun i j => if h : i + 1 = j then d _ ≫ eqToHom (by rw [h]) else 0
    shape := fun i j w => by
      dsimp
      rw [dif_neg]
      exact w
    d_comp_d' := fun i j k => by
      dsimp
      

Proof state:
ι : Type u_1
V : Type u
inst✝⁴ : Category.{v, u} V
inst✝³ : HasZeroMorphisms V
α : Type u_2
inst✝² : AddRightCancelSemigroup α
inst✝¹ : One α
inst✝ : DecidableEq α
X : α → V
d : (n : α) → X n ⟶ X (n + 1)
sq : ∀ (n : α), d n ≫ d (n + 1) = 0
i j k : α
⊢ i + 1 = j →
    j + 1 = k →
      ((if h : i + 1 = j then d i ≫ eqToHom (_ : X (i + 1) = X j) else 0) ≫
          if h : j + 1 = k then d j ≫ eqToHom (_ : X (j + 1) = X k) else 0) =
        0

Next tactic:
split_ifs with h h' h'
/-- Construct an `α`-indexed cochain complex from a dependently-typed differential.
-/
def of (X : α → V) (d : ∀ n, X n ⟶ X (n + 1)) (sq : ∀ n, d n ≫ d (n + 1) = 0) :
    CochainComplex V α :=
  { X := X
    d := fun i j => if h : i + 1 = j then d _ ≫ eqToHom (by rw [h]) else 0
    shape := fun i j w => by
      dsimp
      rw [dif_neg]
      exact w
    d_comp_d' := fun i j k => by
      dsimp
      split_ifs with h h' h'
      · 

Proof state:
case pos
ι : Type u_1
V : Type u
inst✝⁴ : Category.{v, u} V
inst✝³ : HasZeroMorphisms V
α : Type u_2
inst✝² : AddRightCancelSemigroup α
inst✝¹ : One α
inst✝ : DecidableEq α
X : α → V
d : (n : α) → X n ⟶ X (n + 1)
sq : ∀ (n : α), d n ≫ d (n + 1) = 0
i j k : α
h : i + 1 = j
h' : j + 1 = k
⊢ i + 1 = j → j + 1 = k → (d i ≫ eqToHom (_ : X (i + 1) = X j)) ≫ d j ≫ eqToHom (_ : X (j + 1) = X k) = 0

Next tactic:
substs h h'
/-- Construct an `α`-indexed cochain complex from a dependently-typed differential.
-/
def of (X : α → V) (d : ∀ n, X n ⟶ X (n + 1)) (sq : ∀ n, d n ≫ d (n + 1) = 0) :
    CochainComplex V α :=
  { X := X
    d := fun i j => if h : i + 1 = j then d _ ≫ eqToHom (by rw [h]) else 0
    shape := fun i j w => by
      dsimp
      rw [dif_neg]
      exact w
    d_comp_d' := fun i j k => by
      dsimp
      split_ifs with h h' h'
      · substs h h'
        

Proof state:
case pos
ι : Type u_1
V : Type u
inst✝⁴ : Category.{v, u} V
inst✝³ : HasZeroMorphisms V
α : Type u_2
inst✝² : AddRightCancelSemigroup α
inst✝¹ : One α
inst✝ : DecidableEq α
X : α → V
d : (n : α) → X n ⟶ X (n + 1)
sq : ∀ (n : α), d n ≫ d (n + 1) = 0
i : α
⊢ i + 1 = i + 1 →
    i + 1 + 1 = i + 1 + 1 →
      (d i ≫ eqToHom (_ : X (i + 1) = X (i + 1))) ≫ d (i + 1) ≫ eqToHom (_ : X (i + 1 + 1) = X (i + 1 + 1)) = 0

Next tactic:
simp [sq]