l3lab/ntp-mathlib huggingface dataset:
/-- If a family of complete sets with diameter tending to `0` is such that each finite intersection
is nonempty, then the total intersection is also nonempty. -/
theorem _root_.IsComplete.nonempty_iInter_of_nonempty_biInter {s : ℕ → Set α}
    (h0 : IsComplete (s 0)) (hs : ∀ n, IsClosed (s n)) (h's : ∀ n, IsBounded (s n))
    (h : ∀ N, (⋂ n ≤ N, s n).Nonempty) (h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)) :
    (⋂ n, s n).Nonempty := by
  let u N := (h N).some
  have I : ∀ n N, n ≤ N → u N ∈ s n := by
    intro n N hn
    apply mem_of_subset_of_mem _ (h N).choose_spec
    intro x hx
    simp only [mem_iInter] at hx
    exact hx n hn
  have : CauchySeq u := by
    apply cauchySeq_of_le_tendsto_0 _ _ h'
    

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s✝ : Set α
x y z : α
s : ℕ → Set α
h0 : IsComplete (s 0)
hs : ∀ (n : ℕ), IsClosed (s n)
h's : ∀ (n : ℕ), IsBounded (s n)
h : ∀ (N : ℕ), Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n)
h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)
u : ℕ → α := fun N => Set.Nonempty.some (_ : Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n))
I : ∀ (n N : ℕ), n ≤ N → u N ∈ s n
⊢ ∀ (n m N : ℕ), N ≤ n → N ≤ m → dist (u n) (u m) ≤ diam (s N)

Next tactic:
intro m n N hm hn
/-- If a family of complete sets with diameter tending to `0` is such that each finite intersection
is nonempty, then the total intersection is also nonempty. -/
theorem _root_.IsComplete.nonempty_iInter_of_nonempty_biInter {s : ℕ → Set α}
    (h0 : IsComplete (s 0)) (hs : ∀ n, IsClosed (s n)) (h's : ∀ n, IsBounded (s n))
    (h : ∀ N, (⋂ n ≤ N, s n).Nonempty) (h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)) :
    (⋂ n, s n).Nonempty := by
  let u N := (h N).some
  have I : ∀ n N, n ≤ N → u N ∈ s n := by
    intro n N hn
    apply mem_of_subset_of_mem _ (h N).choose_spec
    intro x hx
    simp only [mem_iInter] at hx
    exact hx n hn
  have : CauchySeq u := by
    apply cauchySeq_of_le_tendsto_0 _ _ h'
    intro m n N hm hn
    

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s✝ : Set α
x y z : α
s : ℕ → Set α
h0 : IsComplete (s 0)
hs : ∀ (n : ℕ), IsClosed (s n)
h's : ∀ (n : ℕ), IsBounded (s n)
h : ∀ (N : ℕ), Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n)
h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)
u : ℕ → α := fun N => Set.Nonempty.some (_ : Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n))
I : ∀ (n N : ℕ), n ≤ N → u N ∈ s n
m n N : ℕ
hm : N ≤ m
hn : N ≤ n
⊢ dist (u m) (u n) ≤ diam (s N)

Next tactic:
exact dist_le_diam_of_mem (h's N) (I _ _ hm) (I _ _ hn)
/-- If a family of complete sets with diameter tending to `0` is such that each finite intersection
is nonempty, then the total intersection is also nonempty. -/
theorem _root_.IsComplete.nonempty_iInter_of_nonempty_biInter {s : ℕ → Set α}
    (h0 : IsComplete (s 0)) (hs : ∀ n, IsClosed (s n)) (h's : ∀ n, IsBounded (s n))
    (h : ∀ N, (⋂ n ≤ N, s n).Nonempty) (h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)) :
    (⋂ n, s n).Nonempty := by
  let u N := (h N).some
  have I : ∀ n N, n ≤ N → u N ∈ s n := by
    intro n N hn
    apply mem_of_subset_of_mem _ (h N).choose_spec
    intro x hx
    simp only [mem_iInter] at hx
    exact hx n hn
  have : CauchySeq u := by
    apply cauchySeq_of_le_tendsto_0 _ _ h'
    intro m n N hm hn
    exact dist_le_diam_of_mem (h's N) (I _ _ hm) (I _ _ hn)
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s✝ : Set α
x y z : α
s : ℕ → Set α
h0 : IsComplete (s 0)
hs : ∀ (n : ℕ), IsClosed (s n)
h's : ∀ (n : ℕ), IsBounded (s n)
h : ∀ (N : ℕ), Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n)
h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)
u : ℕ → α := fun N => Set.Nonempty.some (_ : Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n))
I : ∀ (n N : ℕ), n ≤ N → u N ∈ s n
this : CauchySeq u
⊢ Set.Nonempty (⋂ n, s n)

Next tactic:
obtain ⟨x, -, xlim⟩ : ∃ x ∈ s 0, Tendsto (fun n : ℕ => u n) atTop (𝓝 x) :=
    cauchySeq_tendsto_of_isComplete h0 (fun n => I 0 n (zero_le _)) this
/-- If a family of complete sets with diameter tending to `0` is such that each finite intersection
is nonempty, then the total intersection is also nonempty. -/
theorem _root_.IsComplete.nonempty_iInter_of_nonempty_biInter {s : ℕ → Set α}
    (h0 : IsComplete (s 0)) (hs : ∀ n, IsClosed (s n)) (h's : ∀ n, IsBounded (s n))
    (h : ∀ N, (⋂ n ≤ N, s n).Nonempty) (h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)) :
    (⋂ n, s n).Nonempty := by
  let u N := (h N).some
  have I : ∀ n N, n ≤ N → u N ∈ s n := by
    intro n N hn
    apply mem_of_subset_of_mem _ (h N).choose_spec
    intro x hx
    simp only [mem_iInter] at hx
    exact hx n hn
  have : CauchySeq u := by
    apply cauchySeq_of_le_tendsto_0 _ _ h'
    intro m n N hm hn
    exact dist_le_diam_of_mem (h's N) (I _ _ hm) (I _ _ hn)
  obtain ⟨x, -, xlim⟩ : ∃ x ∈ s 0, Tendsto (fun n : ℕ => u n) atTop (𝓝 x) :=
    cauchySeq_tendsto_of_isComplete h0 (fun n => I 0 n (zero_le _)) this
  

Proof state:
case intro.intro
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s✝ : Set α
x✝ y z : α
s : ℕ → Set α
h0 : IsComplete (s 0)
hs : ∀ (n : ℕ), IsClosed (s n)
h's : ∀ (n : ℕ), IsBounded (s n)
h : ∀ (N : ℕ), Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n)
h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)
u : ℕ → α := fun N => Set.Nonempty.some (_ : Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n))
I : ∀ (n N : ℕ), n ≤ N → u N ∈ s n
this : CauchySeq u
x : α
xlim : Tendsto (fun n => u n) atTop (𝓝 x)
⊢ Set.Nonempty (⋂ n, s n)

Next tactic:
refine' ⟨x, mem_iInter.2 fun n => _⟩
/-- If a family of complete sets with diameter tending to `0` is such that each finite intersection
is nonempty, then the total intersection is also nonempty. -/
theorem _root_.IsComplete.nonempty_iInter_of_nonempty_biInter {s : ℕ → Set α}
    (h0 : IsComplete (s 0)) (hs : ∀ n, IsClosed (s n)) (h's : ∀ n, IsBounded (s n))
    (h : ∀ N, (⋂ n ≤ N, s n).Nonempty) (h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)) :
    (⋂ n, s n).Nonempty := by
  let u N := (h N).some
  have I : ∀ n N, n ≤ N → u N ∈ s n := by
    intro n N hn
    apply mem_of_subset_of_mem _ (h N).choose_spec
    intro x hx
    simp only [mem_iInter] at hx
    exact hx n hn
  have : CauchySeq u := by
    apply cauchySeq_of_le_tendsto_0 _ _ h'
    intro m n N hm hn
    exact dist_le_diam_of_mem (h's N) (I _ _ hm) (I _ _ hn)
  obtain ⟨x, -, xlim⟩ : ∃ x ∈ s 0, Tendsto (fun n : ℕ => u n) atTop (𝓝 x) :=
    cauchySeq_tendsto_of_isComplete h0 (fun n => I 0 n (zero_le _)) this
  refine' ⟨x, mem_iInter.2 fun n => _⟩
  

Proof state:
case intro.intro
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s✝ : Set α
x✝ y z : α
s : ℕ → Set α
h0 : IsComplete (s 0)
hs : ∀ (n : ℕ), IsClosed (s n)
h's : ∀ (n : ℕ), IsBounded (s n)
h : ∀ (N : ℕ), Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n)
h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)
u : ℕ → α := fun N => Set.Nonempty.some (_ : Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n))
I : ∀ (n N : ℕ), n ≤ N → u N ∈ s n
this : CauchySeq u
x : α
xlim : Tendsto (fun n => u n) atTop (𝓝 x)
n : ℕ
⊢ x ∈ s n

Next tactic:
apply (hs n).mem_of_tendsto xlim
/-- If a family of complete sets with diameter tending to `0` is such that each finite intersection
is nonempty, then the total intersection is also nonempty. -/
theorem _root_.IsComplete.nonempty_iInter_of_nonempty_biInter {s : ℕ → Set α}
    (h0 : IsComplete (s 0)) (hs : ∀ n, IsClosed (s n)) (h's : ∀ n, IsBounded (s n))
    (h : ∀ N, (⋂ n ≤ N, s n).Nonempty) (h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)) :
    (⋂ n, s n).Nonempty := by
  let u N := (h N).some
  have I : ∀ n N, n ≤ N → u N ∈ s n := by
    intro n N hn
    apply mem_of_subset_of_mem _ (h N).choose_spec
    intro x hx
    simp only [mem_iInter] at hx
    exact hx n hn
  have : CauchySeq u := by
    apply cauchySeq_of_le_tendsto_0 _ _ h'
    intro m n N hm hn
    exact dist_le_diam_of_mem (h's N) (I _ _ hm) (I _ _ hn)
  obtain ⟨x, -, xlim⟩ : ∃ x ∈ s 0, Tendsto (fun n : ℕ => u n) atTop (𝓝 x) :=
    cauchySeq_tendsto_of_isComplete h0 (fun n => I 0 n (zero_le _)) this
  refine' ⟨x, mem_iInter.2 fun n => _⟩
  apply (hs n).mem_of_tendsto xlim
  

Proof state:
case intro.intro
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s✝ : Set α
x✝ y z : α
s : ℕ → Set α
h0 : IsComplete (s 0)
hs : ∀ (n : ℕ), IsClosed (s n)
h's : ∀ (n : ℕ), IsBounded (s n)
h : ∀ (N : ℕ), Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n)
h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)
u : ℕ → α := fun N => Set.Nonempty.some (_ : Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n))
I : ∀ (n N : ℕ), n ≤ N → u N ∈ s n
this : CauchySeq u
x : α
xlim : Tendsto (fun n => u n) atTop (𝓝 x)
n : ℕ
⊢ ∀ᶠ (x : ℕ) in atTop, u x ∈ s n

Next tactic:
filter_upwards [Ici_mem_atTop n] with p hp
/-- If a family of complete sets with diameter tending to `0` is such that each finite intersection
is nonempty, then the total intersection is also nonempty. -/
theorem _root_.IsComplete.nonempty_iInter_of_nonempty_biInter {s : ℕ → Set α}
    (h0 : IsComplete (s 0)) (hs : ∀ n, IsClosed (s n)) (h's : ∀ n, IsBounded (s n))
    (h : ∀ N, (⋂ n ≤ N, s n).Nonempty) (h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)) :
    (⋂ n, s n).Nonempty := by
  let u N := (h N).some
  have I : ∀ n N, n ≤ N → u N ∈ s n := by
    intro n N hn
    apply mem_of_subset_of_mem _ (h N).choose_spec
    intro x hx
    simp only [mem_iInter] at hx
    exact hx n hn
  have : CauchySeq u := by
    apply cauchySeq_of_le_tendsto_0 _ _ h'
    intro m n N hm hn
    exact dist_le_diam_of_mem (h's N) (I _ _ hm) (I _ _ hn)
  obtain ⟨x, -, xlim⟩ : ∃ x ∈ s 0, Tendsto (fun n : ℕ => u n) atTop (𝓝 x) :=
    cauchySeq_tendsto_of_isComplete h0 (fun n => I 0 n (zero_le _)) this
  refine' ⟨x, mem_iInter.2 fun n => _⟩
  apply (hs n).mem_of_tendsto xlim
  filter_upwards [Ici_mem_atTop n] with p hp
  

Proof state:
case h
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s✝ : Set α
x✝ y z : α
s : ℕ → Set α
h0 : IsComplete (s 0)
hs : ∀ (n : ℕ), IsClosed (s n)
h's : ∀ (n : ℕ), IsBounded (s n)
h : ∀ (N : ℕ), Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n)
h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)
u : ℕ → α := fun N => Set.Nonempty.some (_ : Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n))
I : ∀ (n N : ℕ), n ≤ N → u N ∈ s n
this : CauchySeq u
x : α
xlim : Tendsto (fun n => u n) atTop (𝓝 x)
n p : ℕ
hp : p ∈ Ici n
⊢ u p ∈ s n

Next tactic:
exact I n p hp
theorem Metric.cobounded_eq_cocompact [ProperSpace α] : cobounded α = cocompact α := by
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝¹ : PseudoMetricSpace α
inst✝ : ProperSpace α
⊢ cobounded α = cocompact α

Next tactic:
nontriviality α
theorem Metric.cobounded_eq_cocompact [ProperSpace α] : cobounded α = cocompact α := by
  nontriviality α; 

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝¹ : PseudoMetricSpace α
inst✝ : ProperSpace α
✝ : Nontrivial α
⊢ cobounded α = cocompact α

Next tactic:
inhabit α
theorem Metric.cobounded_eq_cocompact [ProperSpace α] : cobounded α = cocompact α := by
  nontriviality α; inhabit α
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝¹ : PseudoMetricSpace α
inst✝ : ProperSpace α
✝ : Nontrivial α
inhabited_h : Inhabited α
⊢ cobounded α = cocompact α

Next tactic:
exact cobounded_le_cocompact.antisymm <| (hasBasis_cobounded_compl_closedBall default).ge_iff.2
    fun _ _ ↦ (isCompact_closedBall _ _).compl_mem_cocompact
theorem comap_dist_left_atTop_eq_cocompact [ProperSpace α] (x : α) :
    comap (dist x) atTop = cocompact α := by 

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝¹ : PseudoMetricSpace α
inst✝ : ProperSpace α
x : α
⊢ comap (dist x) atTop = cocompact α

Next tactic:
simp [cobounded_eq_cocompact]
theorem Metric.finite_isBounded_inter_isClosed [ProperSpace α] {K s : Set α} [DiscreteTopology s]
    (hK : IsBounded K) (hs : IsClosed s) : Set.Finite (K ∩ s) := by
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝² : PseudoMetricSpace α
inst✝¹ : ProperSpace α
K s : Set α
inst✝ : DiscreteTopology ↑s
hK : IsBounded K
hs : IsClosed s
⊢ Set.Finite (K ∩ s)

Next tactic:
refine Set.Finite.subset (IsCompact.finite ?_ ?_) (Set.inter_subset_inter_left s subset_closure)
theorem Metric.finite_isBounded_inter_isClosed [ProperSpace α] {K s : Set α} [DiscreteTopology s]
    (hK : IsBounded K) (hs : IsClosed s) : Set.Finite (K ∩ s) := by
  refine Set.Finite.subset (IsCompact.finite ?_ ?_) (Set.inter_subset_inter_left s subset_closure)
  · 

Proof state:
case refine_1
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝² : PseudoMetricSpace α
inst✝¹ : ProperSpace α
K s : Set α
inst✝ : DiscreteTopology ↑s
hK : IsBounded K
hs : IsClosed s
⊢ IsCompact (closure K ∩ s)

Next tactic:
exact hK.isCompact_closure.inter_right hs
theorem Metric.finite_isBounded_inter_isClosed [ProperSpace α] {K s : Set α} [DiscreteTopology s]
    (hK : IsBounded K) (hs : IsClosed s) : Set.Finite (K ∩ s) := by
  refine Set.Finite.subset (IsCompact.finite ?_ ?_) (Set.inter_subset_inter_left s subset_closure)
  · exact hK.isCompact_closure.inter_right hs
  · 

Proof state:
case refine_2
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝² : PseudoMetricSpace α
inst✝¹ : ProperSpace α
K s : Set α
inst✝ : DiscreteTopology ↑s
hK : IsBounded K
hs : IsClosed s
⊢ DiscreteTopology ↑(closure K ∩ s)

Next tactic:
exact DiscreteTopology.of_subset inferInstance (Set.inter_subset_right _ s)
/-- The differential in the complex of inhomogeneous cochains used to
calculate group cohomology. -/
@[simps]
def d [Monoid G] (n : ℕ) (A : Rep k G) : ((Fin n → G) → A) →ₗ[k] (Fin (n + 1) → G) → A where
  toFun f g :=
    A.ρ (g 0) (f fun i => g i.succ) +
      Finset.univ.sum fun j : Fin (n + 1) =>
        (-1 : k) ^ ((j : ℕ) + 1) • f (Fin.contractNth j (· * ·) g)
  map_add' f g := by
    

Proof state:
k G : Type u
inst✝¹ : CommRing k
n✝ : ℕ
inst✝ : Monoid G
n : ℕ
A : Rep k G
f g : (Fin n → G) → CoeSort.coe A
⊢ (fun f g =>
        ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
          Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
      (f + g) =
    (fun f g =>
          ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
            Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
        f +
      (fun f g =>
          ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
            Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
        g

Next tactic:
ext x
/-- The differential in the complex of inhomogeneous cochains used to
calculate group cohomology. -/
@[simps]
def d [Monoid G] (n : ℕ) (A : Rep k G) : ((Fin n → G) → A) →ₗ[k] (Fin (n + 1) → G) → A where
  toFun f g :=
    A.ρ (g 0) (f fun i => g i.succ) +
      Finset.univ.sum fun j : Fin (n + 1) =>
        (-1 : k) ^ ((j : ℕ) + 1) • f (Fin.contractNth j (· * ·) g)
  map_add' f g := by
    ext x
/- Porting note: changed from `simp only` which needed extra heartbeats -/
    

Proof state:
case h
k G : Type u
inst✝¹ : CommRing k
n✝ : ℕ
inst✝ : Monoid G
n : ℕ
A : Rep k G
f g : (Fin n → G) → CoeSort.coe A
x : Fin (n + 1) → G
⊢ (fun f g =>
        ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
          Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
      (f + g) x =
    ((fun f g =>
            ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
              Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
          f +
        (fun f g =>
            ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
              Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
          g)
      x

Next tactic:
simp_rw [Pi.add_apply, map_add, smul_add, Finset.sum_add_distrib, add_add_add_comm]
/-- The differential in the complex of inhomogeneous cochains used to
calculate group cohomology. -/
@[simps]
def d [Monoid G] (n : ℕ) (A : Rep k G) : ((Fin n → G) → A) →ₗ[k] (Fin (n + 1) → G) → A where
  toFun f g :=
    A.ρ (g 0) (f fun i => g i.succ) +
      Finset.univ.sum fun j : Fin (n + 1) =>
        (-1 : k) ^ ((j : ℕ) + 1) • f (Fin.contractNth j (· * ·) g)
  map_add' f g := by
    ext x
/- Porting note: changed from `simp only` which needed extra heartbeats -/
    simp_rw [Pi.add_apply, map_add, smul_add, Finset.sum_add_distrib, add_add_add_comm]
  map_smul' r f := by
    

Proof state:
k G : Type u
inst✝¹ : CommRing k
n✝ : ℕ
inst✝ : Monoid G
n : ℕ
A : Rep k G
r : k
f : (Fin n → G) → CoeSort.coe A
⊢ AddHom.toFun
      {
        toFun := fun f g =>
          ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
            Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g),
        map_add' :=
          (_ :
            ∀ (f g : (Fin n → G) → CoeSort.coe A),
              (fun f g =>
                    ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
                      Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
                  (f + g) =
                (fun f g =>
                      ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
                        Finset.sum Finset.univ fun j =>
                          (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
                    f +
                  (fun f g =>
                      ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
                        Finset.sum Finset.univ fun j =>
                          (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
                    g) }
      (r • f) =
    (RingHom.id k) r •
      AddHom.toFun
        {
          toFun := fun f g =>
            ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
              Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g),
          map_add' :=
            (_ :
              ∀ (f g : (Fin n → G) → CoeSort.coe A),
                (fun f g =>
                      ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
                        Finset.sum Finset.univ fun j =>
                          (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
                    (f + g) =
                  (fun f g =>
                        ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
                          Finset.sum Finset.univ fun j =>
                            (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
                      f +
                    (fun f g =>
                        ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
                          Finset.sum Finset.univ fun j =>
                            (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
                      g) }
        f

Next tactic:
ext x
/-- The theorem that our isomorphism `Fun(Gⁿ, A) ≅ Hom(k[Gⁿ⁺¹], A)` (where the righthand side is
morphisms in `Rep k G`) commutes with the differentials in the complex of inhomogeneous cochains
and the homogeneous `linearYonedaObjResolution`. -/
@[nolint checkType] theorem d_eq :
    d n A =
      (diagonalHomEquiv n A).toModuleIso.inv ≫
        (linearYonedaObjResolution A).d n (n + 1) ≫
          (diagonalHomEquiv (n + 1) A).toModuleIso.hom := by
  

Proof state:
k G : Type u
inst✝¹ : CommRing k
n : ℕ
inst✝ : Group G
A : Rep k G
⊢ d n A =
    (LinearEquiv.toModuleIso (diagonalHomEquiv n A)).inv ≫
      HomologicalComplex.d (linearYonedaObjResolution A) n (n + 1) ≫
        (LinearEquiv.toModuleIso (diagonalHomEquiv (n + 1) A)).hom

Next tactic:
ext f g
/-- The theorem that our isomorphism `Fun(Gⁿ, A) ≅ Hom(k[Gⁿ⁺¹], A)` (where the righthand side is
morphisms in `Rep k G`) commutes with the differentials in the complex of inhomogeneous cochains
and the homogeneous `linearYonedaObjResolution`. -/
@[nolint checkType] theorem d_eq :
    d n A =
      (diagonalHomEquiv n A).toModuleIso.inv ≫
        (linearYonedaObjResolution A).d n (n + 1) ≫
          (diagonalHomEquiv (n + 1) A).toModuleIso.hom := by
  ext f g
/- Porting note: broken proof was
  simp only [ModuleCat.coe_comp, LinearEquiv.coe_coe, Function.comp_apply,
    LinearEquiv.toModuleIso_inv, linearYonedaObjResolution_d_apply, LinearEquiv.toModuleIso_hom,
    diagonalHomEquiv_apply, Action.comp_hom, Resolution.d_eq k G n,
    Resolution.d_of (Fin.partialProd g), LinearMap.map_sum,
    ← Finsupp.smul_single_one _ ((-1 : k) ^ _), map_smul, d_apply]
  simp only [@Fin.sum_univ_succ _ _ (n + 1), Fin.val_zero, pow_zero, one_smul, Fin.succAbove_zero,
    diagonalHomEquiv_symm_apply f (Fin.partialProd g ∘ @Fin.succ (n + 1)), Function.comp_apply,
    Fin.partialProd_succ, Fin.castSucc_zero, Fin.partialProd_zero, one_mul]
  congr 1
  · congr
    ext
    have := Fin.partialProd_right_inv g (Fin.castSucc x)
    simp only [mul_inv_rev, Fin.castSucc_fin_succ] at *
    rw [mul_assoc, ← mul_assoc _ _ (g x.succ), this, inv_mul_cancel_left]
  · exact Finset.sum_congr rfl fun j hj => by
      rw [diagonalHomEquiv_symm_partialProd_succ, Fin.val_succ] -/
  -- https://github.com/leanprover-community/mathlib4/issues/5026
  -- https://github.com/leanprover-community/mathlib4/issues/5164
  

Proof state:
case h.h
k G : Type u
inst✝¹ : CommRing k
n : ℕ
inst✝ : Group G
A : Rep k G
f : (Fin n → G) → CoeSort.coe A
g : Fin (n + 1) → G
⊢ (d n A) f g =
    ((LinearEquiv.toModuleIso (diagonalHomEquiv n A)).inv ≫
        HomologicalComplex.d (linearYonedaObjResolution A) n (n + 1) ≫
          (LinearEquiv.toModuleIso (diagonalHomEquiv (n + 1) A)).hom)
      f g

Next tactic:
change d n A f g = diagonalHomEquiv (n + 1) A
    ((resolution k G).d (n + 1) n ≫ (diagonalHomEquiv n A).symm f) g
/-- The theorem that our isomorphism `Fun(Gⁿ, A) ≅ Hom(k[Gⁿ⁺¹], A)` (where the righthand side is
morphisms in `Rep k G`) commutes with the differentials in the complex of inhomogeneous cochains
and the homogeneous `linearYonedaObjResolution`. -/
@[nolint checkType] theorem d_eq :
    d n A =
      (diagonalHomEquiv n A).toModuleIso.inv ≫
        (linearYonedaObjResolution A).d n (n + 1) ≫
          (diagonalHomEquiv (n + 1) A).toModuleIso.hom := by
  ext f g
/- Porting note: broken proof was
  simp only [ModuleCat.coe_comp, LinearEquiv.coe_coe, Function.comp_apply,
    LinearEquiv.toModuleIso_inv, linearYonedaObjResolution_d_apply, LinearEquiv.toModuleIso_hom,
    diagonalHomEquiv_apply, Action.comp_hom, Resolution.d_eq k G n,
    Resolution.d_of (Fin.partialProd g), LinearMap.map_sum,
    ← Finsupp.smul_single_one _ ((-1 : k) ^ _), map_smul, d_apply]
  simp only [@Fin.sum_univ_succ _ _ (n + 1), Fin.val_zero, pow_zero, one_smul, Fin.succAbove_zero,
    diagonalHomEquiv_symm_apply f (Fin.partialProd g ∘ @Fin.succ (n + 1)), Function.comp_apply,
    Fin.partialProd_succ, Fin.castSucc_zero, Fin.partialProd_zero, one_mul]
  congr 1
  · congr
    ext
    have := Fin.partialProd_right_inv g (Fin.castSucc x)
    simp only [mul_inv_rev, Fin.castSucc_fin_succ] at *
    rw [mul_assoc, ← mul_assoc _ _ (g x.succ), this, inv_mul_cancel_left]
  · exact Finset.sum_congr rfl fun j hj => by
      rw [diagonalHomEquiv_symm_partialProd_succ, Fin.val_succ] -/
  -- https://github.com/leanprover-community/mathlib4/issues/5026
  -- https://github.com/leanprover-community/mathlib4/issues/5164
  change d n A f g = diagonalHomEquiv (n + 1) A
    ((resolution k G).d (n + 1) n ≫ (diagonalHomEquiv n A).symm f) g
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  

Proof state:
case h.h
k G : Type u
inst✝¹ : CommRing k
n : ℕ
inst✝ : Group G
A : Rep k G
f : (Fin n → G) → CoeSort.coe A
g : Fin (n + 1) → G
⊢ (d n A) f g =
    (diagonalHomEquiv (n + 1) A)
      (HomologicalComplex.d (resolution k G) (n + 1) n ≫ (LinearEquiv.symm (diagonalHomEquiv n A)) f) g

Next tactic:
erw [diagonalHomEquiv_apply, Action.comp_hom, ModuleCat.comp_def, LinearMap.comp_apply,
    resolution.d_eq]