l3lab/ntp-mathlib huggingface dataset:
theorem forall_biUnionTagged (p : (ι → ℝ) → Box ι → Prop) (π : Prepartition I)
    (πi : ∀ J, TaggedPrepartition J) :
    (∀ J ∈ π.biUnionTagged πi, p ((π.biUnionTagged πi).tag J) J) ↔
      ∀ J ∈ π, ∀ J' ∈ πi J, p ((πi J).tag J') J' := by
  simp only [mem_biUnionTagged]
  refine' ⟨fun H J hJ J' hJ' => _, fun H J' ⟨J, hJ, hJ'⟩ => _⟩
  · rw [← π.tag_biUnionTagged hJ hJ']
    

Proof state:
case refine'_1
ι : Type u_1
I J✝ : Box ι
p : (ι → ℝ) → Box ι → Prop
π : Prepartition I
πi : (J : Box ι) → TaggedPrepartition J
H : ∀ (J : Box ι), (∃ J' ∈ π, J ∈ πi J') → p (TaggedPrepartition.tag (biUnionTagged π πi) J) J
J : Box ι
hJ : J ∈ π
J' : Box ι
hJ' : J' ∈ πi J
⊢ p (TaggedPrepartition.tag (biUnionTagged π πi) J') J'

Next tactic:
exact H J' ⟨J, hJ, hJ'⟩
theorem forall_biUnionTagged (p : (ι → ℝ) → Box ι → Prop) (π : Prepartition I)
    (πi : ∀ J, TaggedPrepartition J) :
    (∀ J ∈ π.biUnionTagged πi, p ((π.biUnionTagged πi).tag J) J) ↔
      ∀ J ∈ π, ∀ J' ∈ πi J, p ((πi J).tag J') J' := by
  simp only [mem_biUnionTagged]
  refine' ⟨fun H J hJ J' hJ' => _, fun H J' ⟨J, hJ, hJ'⟩ => _⟩
  · rw [← π.tag_biUnionTagged hJ hJ']
    exact H J' ⟨J, hJ, hJ'⟩
  · 

Proof state:
case refine'_2
ι : Type u_1
I J✝ : Box ι
p : (ι → ℝ) → Box ι → Prop
π : Prepartition I
πi : (J : Box ι) → TaggedPrepartition J
H : ∀ J ∈ π, ∀ J' ∈ πi J, p (TaggedPrepartition.tag (πi J) J') J'
J' : Box ι
x✝ : ∃ J'_1 ∈ π, J' ∈ πi J'_1
J : Box ι
hJ : J ∈ π
hJ' : J' ∈ πi J
⊢ p (TaggedPrepartition.tag (biUnionTagged π πi) J') J'

Next tactic:
rw [π.tag_biUnionTagged hJ hJ']
theorem forall_biUnionTagged (p : (ι → ℝ) → Box ι → Prop) (π : Prepartition I)
    (πi : ∀ J, TaggedPrepartition J) :
    (∀ J ∈ π.biUnionTagged πi, p ((π.biUnionTagged πi).tag J) J) ↔
      ∀ J ∈ π, ∀ J' ∈ πi J, p ((πi J).tag J') J' := by
  simp only [mem_biUnionTagged]
  refine' ⟨fun H J hJ J' hJ' => _, fun H J' ⟨J, hJ, hJ'⟩ => _⟩
  · rw [← π.tag_biUnionTagged hJ hJ']
    exact H J' ⟨J, hJ, hJ'⟩
  · rw [π.tag_biUnionTagged hJ hJ']
    

Proof state:
case refine'_2
ι : Type u_1
I J✝ : Box ι
p : (ι → ℝ) → Box ι → Prop
π : Prepartition I
πi : (J : Box ι) → TaggedPrepartition J
H : ∀ J ∈ π, ∀ J' ∈ πi J, p (TaggedPrepartition.tag (πi J) J') J'
J' : Box ι
x✝ : ∃ J'_1 ∈ π, J' ∈ πi J'_1
J : Box ι
hJ : J ∈ π
hJ' : J' ∈ πi J
⊢ p (TaggedPrepartition.tag (πi J) J') J'

Next tactic:
exact H J hJ J' hJ'
theorem mem_infPrepartition_comm :
    J ∈ π₁.infPrepartition π₂.toPrepartition ↔ J ∈ π₂.infPrepartition π₁.toPrepartition := by
  

Proof state:
ι : Type u_1
I J : Box ι
π π₁ π₂ : TaggedPrepartition I
x : ι → ℝ
⊢ J ∈ infPrepartition π₁ π₂.toPrepartition ↔ J ∈ infPrepartition π₂ π₁.toPrepartition

Next tactic:
simp only [← mem_toPrepartition, infPrepartition_toPrepartition, inf_comm]
/-- In a Henstock prepartition, there are at most `2 ^ Fintype.card ι` boxes with a given tag. -/
theorem IsHenstock.card_filter_tag_eq_le [Fintype ι] (h : π.IsHenstock) (x : ι → ℝ) :
    (π.boxes.filter fun J => π.tag J = x).card ≤ 2 ^ Fintype.card ι :=
  calc
    (π.boxes.filter fun J => π.tag J = x).card ≤
        (π.boxes.filter fun J : Box ι => x ∈ Box.Icc J).card := by
      

Proof state:
ι : Type u_1
I J : Box ι
π π₁ π₂ : TaggedPrepartition I
x✝ : ι → ℝ
inst✝ : Fintype ι
h : IsHenstock π
x : ι → ℝ
⊢ Finset.card (Finset.filter (fun J => tag π J = x) π.boxes) ≤
    Finset.card (Finset.filter (fun J => x ∈ Box.Icc J) π.boxes)

Next tactic:
refine' Finset.card_le_of_subset fun J hJ => _
/-- In a Henstock prepartition, there are at most `2 ^ Fintype.card ι` boxes with a given tag. -/
theorem IsHenstock.card_filter_tag_eq_le [Fintype ι] (h : π.IsHenstock) (x : ι → ℝ) :
    (π.boxes.filter fun J => π.tag J = x).card ≤ 2 ^ Fintype.card ι :=
  calc
    (π.boxes.filter fun J => π.tag J = x).card ≤
        (π.boxes.filter fun J : Box ι => x ∈ Box.Icc J).card := by
      refine' Finset.card_le_of_subset fun J hJ => _
      

Proof state:
ι : Type u_1
I J✝ : Box ι
π π₁ π₂ : TaggedPrepartition I
x✝ : ι → ℝ
inst✝ : Fintype ι
h : IsHenstock π
x : ι → ℝ
J : Box ι
hJ : J ∈ Finset.filter (fun J => tag π J = x) π.boxes
⊢ J ∈ Finset.filter (fun J => x ∈ Box.Icc J) π.boxes

Next tactic:
rw [Finset.mem_filter] at hJ ⊢
/-- In a Henstock prepartition, there are at most `2 ^ Fintype.card ι` boxes with a given tag. -/
theorem IsHenstock.card_filter_tag_eq_le [Fintype ι] (h : π.IsHenstock) (x : ι → ℝ) :
    (π.boxes.filter fun J => π.tag J = x).card ≤ 2 ^ Fintype.card ι :=
  calc
    (π.boxes.filter fun J => π.tag J = x).card ≤
        (π.boxes.filter fun J : Box ι => x ∈ Box.Icc J).card := by
      refine' Finset.card_le_of_subset fun J hJ => _
      rw [Finset.mem_filter] at hJ ⊢; 

Proof state:
ι : Type u_1
I J✝ : Box ι
π π₁ π₂ : TaggedPrepartition I
x✝ : ι → ℝ
inst✝ : Fintype ι
h : IsHenstock π
x : ι → ℝ
J : Box ι
hJ : J ∈ π.boxes ∧ tag π J = x
⊢ J ∈ π.boxes ∧ x ∈ Box.Icc J

Next tactic:
rcases hJ with ⟨hJ, rfl⟩
/-- In a Henstock prepartition, there are at most `2 ^ Fintype.card ι` boxes with a given tag. -/
theorem IsHenstock.card_filter_tag_eq_le [Fintype ι] (h : π.IsHenstock) (x : ι → ℝ) :
    (π.boxes.filter fun J => π.tag J = x).card ≤ 2 ^ Fintype.card ι :=
  calc
    (π.boxes.filter fun J => π.tag J = x).card ≤
        (π.boxes.filter fun J : Box ι => x ∈ Box.Icc J).card := by
      refine' Finset.card_le_of_subset fun J hJ => _
      rw [Finset.mem_filter] at hJ ⊢; rcases hJ with ⟨hJ, rfl⟩
      

Proof state:
case intro
ι : Type u_1
I J✝ : Box ι
π π₁ π₂ : TaggedPrepartition I
x : ι → ℝ
inst✝ : Fintype ι
h : IsHenstock π
J : Box ι
hJ : J ∈ π.boxes
⊢ J ∈ π.boxes ∧ tag π J ∈ Box.Icc J

Next tactic:
exact ⟨hJ, h J hJ⟩
theorem forall_mem_single (p : (ι → ℝ) → Box ι → Prop) (hJ : J ≤ I) (h : x ∈ Box.Icc I) :
    (∀ J' ∈ single I J hJ x h, p ((single I J hJ x h).tag J') J') ↔ p x J := by 

Proof state:
ι : Type u_1
I J : Box ι
π π₁ π₂ : TaggedPrepartition I
x : ι → ℝ
r r₁ r₂ : (ι → ℝ) → ↑(Ioi 0)
p : (ι → ℝ) → Box ι → Prop
hJ : J ≤ I
h : x ∈ Box.Icc I
⊢ (∀ J' ∈ single I J hJ x h, p (tag (single I J hJ x h) J') J') ↔ p x J

Next tactic:
simp
/-- Union of two tagged prepartitions with disjoint unions of boxes. -/
def disjUnion (π₁ π₂ : TaggedPrepartition I) (h : Disjoint π₁.iUnion π₂.iUnion) :
    TaggedPrepartition I where
  toPrepartition := π₁.toPrepartition.disjUnion π₂.toPrepartition h
  tag := π₁.boxes.piecewise π₁.tag π₂.tag
  tag_mem_Icc J := by
    

Proof state:
ι : Type u_1
I J✝ : Box ι
π π₁✝ π₂✝ : TaggedPrepartition I
x : ι → ℝ
r r₁ r₂ : (ι → ℝ) → ↑(Ioi 0)
π₁ π₂ : TaggedPrepartition I
h : Disjoint (iUnion π₁) (iUnion π₂)
J : Box ι
⊢ Finset.piecewise π₁.boxes π₁.tag π₂.tag J ∈ Box.Icc I

Next tactic:
dsimp only [Finset.piecewise]
/-- Union of two tagged prepartitions with disjoint unions of boxes. -/
def disjUnion (π₁ π₂ : TaggedPrepartition I) (h : Disjoint π₁.iUnion π₂.iUnion) :
    TaggedPrepartition I where
  toPrepartition := π₁.toPrepartition.disjUnion π₂.toPrepartition h
  tag := π₁.boxes.piecewise π₁.tag π₂.tag
  tag_mem_Icc J := by
    dsimp only [Finset.piecewise]
    

Proof state:
ι : Type u_1
I J✝ : Box ι
π π₁✝ π₂✝ : TaggedPrepartition I
x : ι → ℝ
r r₁ r₂ : (ι → ℝ) → ↑(Ioi 0)
π₁ π₂ : TaggedPrepartition I
h : Disjoint (iUnion π₁) (iUnion π₂)
J : Box ι
⊢ (if J ∈ π₁.boxes then tag π₁ J else tag π₂ J) ∈ Box.Icc I

Next tactic:
split_ifs
/-- Union of two tagged prepartitions with disjoint unions of boxes. -/
def disjUnion (π₁ π₂ : TaggedPrepartition I) (h : Disjoint π₁.iUnion π₂.iUnion) :
    TaggedPrepartition I where
  toPrepartition := π₁.toPrepartition.disjUnion π₂.toPrepartition h
  tag := π₁.boxes.piecewise π₁.tag π₂.tag
  tag_mem_Icc J := by
    dsimp only [Finset.piecewise]
    split_ifs
    

Proof state:
case pos
ι : Type u_1
I J✝ : Box ι
π π₁✝ π₂✝ : TaggedPrepartition I
x : ι → ℝ
r r₁ r₂ : (ι → ℝ) → ↑(Ioi 0)
π₁ π₂ : TaggedPrepartition I
h : Disjoint (iUnion π₁) (iUnion π₂)
J : Box ι
h✝ : J ∈ π₁.boxes
⊢ tag π₁ J ∈ Box.Icc I
case neg
ι : Type u_1
I J✝ : Box ι
π π₁✝ π₂✝ : TaggedPrepartition I
x : ι → ℝ
r r₁ r₂ : (ι → ℝ) → ↑(Ioi 0)
π₁ π₂ : TaggedPrepartition I
h : Disjoint (iUnion π₁) (iUnion π₂)
J : Box ι
h✝ : J ∉ π₁.boxes
⊢ tag π₂ J ∈ Box.Icc I

Next tactic:
exacts [π₁.tag_mem_Icc J, π₂.tag_mem_Icc J]
theorem IsSubordinate.disjUnion [Fintype ι] (h₁ : IsSubordinate π₁ r) (h₂ : IsSubordinate π₂ r)
    (h : Disjoint π₁.iUnion π₂.iUnion) : IsSubordinate (π₁.disjUnion π₂ h) r := by
  

Proof state:
ι : Type u_1
I J : Box ι
π π₁ π₂ : TaggedPrepartition I
x : ι → ℝ
r r₁ r₂ : (ι → ℝ) → ↑(Ioi 0)
inst✝ : Fintype ι
h₁ : IsSubordinate π₁ r
h₂ : IsSubordinate π₂ r
h : Disjoint (iUnion π₁) (iUnion π₂)
⊢ IsSubordinate (TaggedPrepartition.disjUnion π₁ π₂ h) r

Next tactic:
refine' fun J hJ => (Finset.mem_union.1 hJ).elim (fun hJ => _) fun hJ => _
theorem IsSubordinate.disjUnion [Fintype ι] (h₁ : IsSubordinate π₁ r) (h₂ : IsSubordinate π₂ r)
    (h : Disjoint π₁.iUnion π₂.iUnion) : IsSubordinate (π₁.disjUnion π₂ h) r := by
  refine' fun J hJ => (Finset.mem_union.1 hJ).elim (fun hJ => _) fun hJ => _
  · 

Proof state:
case refine'_1
ι : Type u_1
I J✝ : Box ι
π π₁ π₂ : TaggedPrepartition I
x : ι → ℝ
r r₁ r₂ : (ι → ℝ) → ↑(Ioi 0)
inst✝ : Fintype ι
h₁ : IsSubordinate π₁ r
h₂ : IsSubordinate π₂ r
h : Disjoint (iUnion π₁) (iUnion π₂)
J : Box ι
hJ✝ : J ∈ TaggedPrepartition.disjUnion π₁ π₂ h
hJ : J ∈ π₁.boxes
⊢ Box.Icc J ⊆
    closedBall (tag (TaggedPrepartition.disjUnion π₁ π₂ h) J) ↑(r (tag (TaggedPrepartition.disjUnion π₁ π₂ h) J))

Next tactic:
rw [disjUnion_tag_of_mem_left _ hJ]
theorem IsSubordinate.disjUnion [Fintype ι] (h₁ : IsSubordinate π₁ r) (h₂ : IsSubordinate π₂ r)
    (h : Disjoint π₁.iUnion π₂.iUnion) : IsSubordinate (π₁.disjUnion π₂ h) r := by
  refine' fun J hJ => (Finset.mem_union.1 hJ).elim (fun hJ => _) fun hJ => _
  · rw [disjUnion_tag_of_mem_left _ hJ]
    

Proof state:
case refine'_1
ι : Type u_1
I J✝ : Box ι
π π₁ π₂ : TaggedPrepartition I
x : ι → ℝ
r r₁ r₂ : (ι → ℝ) → ↑(Ioi 0)
inst✝ : Fintype ι
h₁ : IsSubordinate π₁ r
h₂ : IsSubordinate π₂ r
h : Disjoint (iUnion π₁) (iUnion π₂)
J : Box ι
hJ✝ : J ∈ TaggedPrepartition.disjUnion π₁ π₂ h
hJ : J ∈ π₁.boxes
⊢ Box.Icc J ⊆ closedBall (tag π₁ J) ↑(r (tag π₁ J))

Next tactic:
exact h₁ _ hJ
theorem IsSubordinate.disjUnion [Fintype ι] (h₁ : IsSubordinate π₁ r) (h₂ : IsSubordinate π₂ r)
    (h : Disjoint π₁.iUnion π₂.iUnion) : IsSubordinate (π₁.disjUnion π₂ h) r := by
  refine' fun J hJ => (Finset.mem_union.1 hJ).elim (fun hJ => _) fun hJ => _
  · rw [disjUnion_tag_of_mem_left _ hJ]
    exact h₁ _ hJ
  · 

Proof state:
case refine'_2
ι : Type u_1
I J✝ : Box ι
π π₁ π₂ : TaggedPrepartition I
x : ι → ℝ
r r₁ r₂ : (ι → ℝ) → ↑(Ioi 0)
inst✝ : Fintype ι
h₁ : IsSubordinate π₁ r
h₂ : IsSubordinate π₂ r
h : Disjoint (iUnion π₁) (iUnion π₂)
J : Box ι
hJ✝ : J ∈ TaggedPrepartition.disjUnion π₁ π₂ h
hJ : J ∈ π₂.boxes
⊢ Box.Icc J ⊆
    closedBall (tag (TaggedPrepartition.disjUnion π₁ π₂ h) J) ↑(r (tag (TaggedPrepartition.disjUnion π₁ π₂ h) J))

Next tactic:
rw [disjUnion_tag_of_mem_right _ hJ]
theorem IsSubordinate.disjUnion [Fintype ι] (h₁ : IsSubordinate π₁ r) (h₂ : IsSubordinate π₂ r)
    (h : Disjoint π₁.iUnion π₂.iUnion) : IsSubordinate (π₁.disjUnion π₂ h) r := by
  refine' fun J hJ => (Finset.mem_union.1 hJ).elim (fun hJ => _) fun hJ => _
  · rw [disjUnion_tag_of_mem_left _ hJ]
    exact h₁ _ hJ
  · rw [disjUnion_tag_of_mem_right _ hJ]
    

Proof state:
case refine'_2
ι : Type u_1
I J✝ : Box ι
π π₁ π₂ : TaggedPrepartition I
x : ι → ℝ
r r₁ r₂ : (ι → ℝ) → ↑(Ioi 0)
inst✝ : Fintype ι
h₁ : IsSubordinate π₁ r
h₂ : IsSubordinate π₂ r
h : Disjoint (iUnion π₁) (iUnion π₂)
J : Box ι
hJ✝ : J ∈ TaggedPrepartition.disjUnion π₁ π₂ h
hJ : J ∈ π₂.boxes
⊢ Box.Icc J ⊆ closedBall (tag π₂ J) ↑(r (tag π₂ J))

Next tactic:
exact h₂ _ hJ
theorem IsHenstock.disjUnion (h₁ : IsHenstock π₁) (h₂ : IsHenstock π₂)
    (h : Disjoint π₁.iUnion π₂.iUnion) : IsHenstock (π₁.disjUnion π₂ h) := by
  

Proof state:
ι : Type u_1
I J : Box ι
π π₁ π₂ : TaggedPrepartition I
x : ι → ℝ
r r₁ r₂ : (ι → ℝ) → ↑(Ioi 0)
h₁ : IsHenstock π₁
h₂ : IsHenstock π₂
h : Disjoint (iUnion π₁) (iUnion π₂)
⊢ IsHenstock (TaggedPrepartition.disjUnion π₁ π₂ h)

Next tactic:
refine' fun J hJ => (Finset.mem_union.1 hJ).elim (fun hJ => _) fun hJ => _
theorem IsHenstock.disjUnion (h₁ : IsHenstock π₁) (h₂ : IsHenstock π₂)
    (h : Disjoint π₁.iUnion π₂.iUnion) : IsHenstock (π₁.disjUnion π₂ h) := by
  refine' fun J hJ => (Finset.mem_union.1 hJ).elim (fun hJ => _) fun hJ => _
  · 

Proof state:
case refine'_1
ι : Type u_1
I J✝ : Box ι
π π₁ π₂ : TaggedPrepartition I
x : ι → ℝ
r r₁ r₂ : (ι → ℝ) → ↑(Ioi 0)
h₁ : IsHenstock π₁
h₂ : IsHenstock π₂
h : Disjoint (iUnion π₁) (iUnion π₂)
J : Box ι
hJ✝ : J ∈ TaggedPrepartition.disjUnion π₁ π₂ h
hJ : J ∈ π₁.boxes
⊢ tag (TaggedPrepartition.disjUnion π₁ π₂ h) J ∈ Box.Icc J

Next tactic:
rw [disjUnion_tag_of_mem_left _ hJ]
theorem IsHenstock.disjUnion (h₁ : IsHenstock π₁) (h₂ : IsHenstock π₂)
    (h : Disjoint π₁.iUnion π₂.iUnion) : IsHenstock (π₁.disjUnion π₂ h) := by
  refine' fun J hJ => (Finset.mem_union.1 hJ).elim (fun hJ => _) fun hJ => _
  · rw [disjUnion_tag_of_mem_left _ hJ]
    

Proof state:
case refine'_1
ι : Type u_1
I J✝ : Box ι
π π₁ π₂ : TaggedPrepartition I
x : ι → ℝ
r r₁ r₂ : (ι → ℝ) → ↑(Ioi 0)
h₁ : IsHenstock π₁
h₂ : IsHenstock π₂
h : Disjoint (iUnion π₁) (iUnion π₂)
J : Box ι
hJ✝ : J ∈ TaggedPrepartition.disjUnion π₁ π₂ h
hJ : J ∈ π₁.boxes
⊢ tag π₁ J ∈ Box.Icc J

Next tactic:
exact h₁ _ hJ
theorem IsHenstock.disjUnion (h₁ : IsHenstock π₁) (h₂ : IsHenstock π₂)
    (h : Disjoint π₁.iUnion π₂.iUnion) : IsHenstock (π₁.disjUnion π₂ h) := by
  refine' fun J hJ => (Finset.mem_union.1 hJ).elim (fun hJ => _) fun hJ => _
  · rw [disjUnion_tag_of_mem_left _ hJ]
    exact h₁ _ hJ
  · 

Proof state:
case refine'_2
ι : Type u_1
I J✝ : Box ι
π π₁ π₂ : TaggedPrepartition I
x : ι → ℝ
r r₁ r₂ : (ι → ℝ) → ↑(Ioi 0)
h₁ : IsHenstock π₁
h₂ : IsHenstock π₂
h : Disjoint (iUnion π₁) (iUnion π₂)
J : Box ι
hJ✝ : J ∈ TaggedPrepartition.disjUnion π₁ π₂ h
hJ : J ∈ π₂.boxes
⊢ tag (TaggedPrepartition.disjUnion π₁ π₂ h) J ∈ Box.Icc J

Next tactic:
rw [disjUnion_tag_of_mem_right _ hJ]
theorem IsHenstock.disjUnion (h₁ : IsHenstock π₁) (h₂ : IsHenstock π₂)
    (h : Disjoint π₁.iUnion π₂.iUnion) : IsHenstock (π₁.disjUnion π₂ h) := by
  refine' fun J hJ => (Finset.mem_union.1 hJ).elim (fun hJ => _) fun hJ => _
  · rw [disjUnion_tag_of_mem_left _ hJ]
    exact h₁ _ hJ
  · rw [disjUnion_tag_of_mem_right _ hJ]
    

Proof state:
case refine'_2
ι : Type u_1
I J✝ : Box ι
π π₁ π₂ : TaggedPrepartition I
x : ι → ℝ
r r₁ r₂ : (ι → ℝ) → ↑(Ioi 0)
h₁ : IsHenstock π₁
h₂ : IsHenstock π₂
h : Disjoint (iUnion π₁) (iUnion π₂)
J : Box ι
hJ✝ : J ∈ TaggedPrepartition.disjUnion π₁ π₂ h
hJ : J ∈ π₂.boxes
⊢ tag π₂ J ∈ Box.Icc J

Next tactic:
exact h₂ _ hJ
/-- If `I ≤ J`, then every tagged prepartition of `I` is a tagged prepartition of `J`. -/
def embedBox (I J : Box ι) (h : I ≤ J) : TaggedPrepartition I ↪ TaggedPrepartition J where
  toFun π :=
    { π with
      le_of_mem' := fun J' hJ' => (π.le_of_mem' J' hJ').trans h
      tag_mem_Icc := fun J => Box.le_iff_Icc.1 h (π.tag_mem_Icc J) }
  inj' := by
    

Proof state:
ι : Type u_1
I✝ J✝ : Box ι
π π₁ π₂ : TaggedPrepartition I✝
x : ι → ℝ
r r₁ r₂ : (ι → ℝ) → ↑(Ioi 0)
I J : Box ι
h : I ≤ J
⊢ Injective fun π =>
    {
      toPrepartition :=
        { boxes := π.boxes, le_of_mem' := (_ : ∀ J' ∈ π.boxes, J' ≤ J),
          pairwiseDisjoint := (_ : Set.Pairwise (↑π.boxes) (Disjoint on Box.toSet)) },
      tag := π.tag, tag_mem_Icc := (_ : ∀ (J_1 : Box ι), tag π J_1 ∈ Box.Icc J) }

Next tactic:
rintro ⟨⟨b₁, h₁le, h₁d⟩, t₁, ht₁⟩ ⟨⟨b₂, h₂le, h₂d⟩, t₂, ht₂⟩ H
/-- If `I ≤ J`, then every tagged prepartition of `I` is a tagged prepartition of `J`. -/
def embedBox (I J : Box ι) (h : I ≤ J) : TaggedPrepartition I ↪ TaggedPrepartition J where
  toFun π :=
    { π with
      le_of_mem' := fun J' hJ' => (π.le_of_mem' J' hJ').trans h
      tag_mem_Icc := fun J => Box.le_iff_Icc.1 h (π.tag_mem_Icc J) }
  inj' := by
    rintro ⟨⟨b₁, h₁le, h₁d⟩, t₁, ht₁⟩ ⟨⟨b₂, h₂le, h₂d⟩, t₂, ht₂⟩ H
    

Proof state:
case mk.mk.mk.mk
ι : Type u_1
I✝ J✝ : Box ι
π π₁ π₂ : TaggedPrepartition I✝
x : ι → ℝ
r r₁ r₂ : (ι → ℝ) → ↑(Ioi 0)
I J : Box ι
h : I ≤ J
t₁ : Box ι → ι → ℝ
ht₁ : ∀ (J : Box ι), t₁ J ∈ Box.Icc I
b₁ : Finset (Box ι)
h₁le : ∀ J ∈ b₁, J ≤ I
h₁d : Set.Pairwise (↑b₁) (Disjoint on Box.toSet)
t₂ : Box ι → ι → ℝ
ht₂ : ∀ (J : Box ι), t₂ J ∈ Box.Icc I
b₂ : Finset (Box ι)
h₂le : ∀ J ∈ b₂, J ≤ I
h₂d : Set.Pairwise (↑b₂) (Disjoint on Box.toSet)
H :
  (fun π =>
        {
          toPrepartition :=
            { boxes := π.boxes, le_of_mem' := (_ : ∀ J' ∈ π.boxes, J' ≤ J),
              pairwiseDisjoint := (_ : Set.Pairwise (↑π.boxes) (Disjoint on Box.toSet)) },
          tag := π.tag, tag_mem_Icc := (_ : ∀ (J_1 : Box ι), tag π J_1 ∈ Box.Icc J) })
      { toPrepartition := { boxes := b₁, le_of_mem' := h₁le, pairwiseDisjoint := h₁d }, tag := t₁,
        tag_mem_Icc := ht₁ } =
    (fun π =>
        {
          toPrepartition :=
            { boxes := π.boxes, le_of_mem' := (_ : ∀ J' ∈ π.boxes, J' ≤ J),
              pairwiseDisjoint := (_ : Set.Pairwise (↑π.boxes) (Disjoint on Box.toSet)) },
          tag := π.tag, tag_mem_Icc := (_ : ∀ (J_1 : Box ι), tag π J_1 ∈ Box.Icc J) })
      { toPrepartition := { boxes := b₂, le_of_mem' := h₂le, pairwiseDisjoint := h₂d }, tag := t₂, tag_mem_Icc := ht₂ }
⊢ { toPrepartition := { boxes := b₁, le_of_mem' := h₁le, pairwiseDisjoint := h₁d }, tag := t₁, tag_mem_Icc := ht₁ } =
    { toPrepartition := { boxes := b₂, le_of_mem' := h₂le, pairwiseDisjoint := h₂d }, tag := t₂, tag_mem_Icc := ht₂ }

Next tactic:
simpa using H
instance : NonUnitalNonAssocSemiring (⨁ i, A i) :=
  { (inferInstance : AddCommMonoid _) with
    mul := fun a b => mulHom A a b
    -- Porting note: these are no longer needed
    -- zero := 0
    -- add := (· + ·)
    zero_mul := fun _ => by simp only [HMul.hMul, map_zero, AddMonoidHom.zero_apply]
    mul_zero := fun _ => by simp only [HMul.hMul, AddMonoidHom.map_zero]
    left_distrib := fun _ _ _ => by 

Proof state:
ι : Type u_1
inst✝³ : DecidableEq ι
A : ι → Type u_2
inst✝² : Add ι
inst✝¹ : (i : ι) → AddCommMonoid (A i)
inst✝ : GNonUnitalNonAssocSemiring A
src✝ : AddCommMonoid (⨁ (i : ι), A i) := inferInstance
x✝² x✝¹ x✝ : ⨁ (i : ι), A i
⊢ x✝² * (x✝¹ + x✝) = x✝² * x✝¹ + x✝² * x✝

Next tactic:
simp only [HMul.hMul, AddMonoidHom.map_add]
instance : NonUnitalNonAssocSemiring (⨁ i, A i) :=
  { (inferInstance : AddCommMonoid _) with
    mul := fun a b => mulHom A a b
    -- Porting note: these are no longer needed
    -- zero := 0
    -- add := (· + ·)
    zero_mul := fun _ => by simp only [HMul.hMul, map_zero, AddMonoidHom.zero_apply]
    mul_zero := fun _ => by simp only [HMul.hMul, AddMonoidHom.map_zero]
    left_distrib := fun _ _ _ => by simp only [HMul.hMul, AddMonoidHom.map_add]
    right_distrib := fun _ _ _ => by
      

Proof state:
ι : Type u_1
inst✝³ : DecidableEq ι
A : ι → Type u_2
inst✝² : Add ι
inst✝¹ : (i : ι) → AddCommMonoid (A i)
inst✝ : GNonUnitalNonAssocSemiring A
src✝ : AddCommMonoid (⨁ (i : ι), A i) := inferInstance
x✝² x✝¹ x✝ : ⨁ (i : ι), A i
⊢ (x✝² + x✝¹) * x✝ = x✝² * x✝ + x✝¹ * x✝

Next tactic:
simp only [HMul.hMul, AddMonoidHom.map_add, AddMonoidHom.add_apply]
instance : NonUnitalNonAssocSemiring (⨁ i, A i) :=
  { (inferInstance : AddCommMonoid _) with
    mul := fun a b => mulHom A a b
    -- Porting note: these are no longer needed
    -- zero := 0
    -- add := (· + ·)
    zero_mul := fun _ => by 

Proof state:
ι : Type u_1
inst✝³ : DecidableEq ι
A : ι → Type u_2
inst✝² : Add ι
inst✝¹ : (i : ι) → AddCommMonoid (A i)
inst✝ : GNonUnitalNonAssocSemiring A
src✝ : AddCommMonoid (⨁ (i : ι), A i) := inferInstance
x✝ : ⨁ (i : ι), A i
⊢ 0 * x✝ = 0

Next tactic:
simp only [HMul.hMul, map_zero, AddMonoidHom.zero_apply]
instance : NonUnitalNonAssocSemiring (⨁ i, A i) :=
  { (inferInstance : AddCommMonoid _) with
    mul := fun a b => mulHom A a b
    -- Porting note: these are no longer needed
    -- zero := 0
    -- add := (· + ·)
    zero_mul := fun _ => by simp only [HMul.hMul, map_zero, AddMonoidHom.zero_apply]
    mul_zero := fun _ => by 

Proof state:
ι : Type u_1
inst✝³ : DecidableEq ι
A : ι → Type u_2
inst✝² : Add ι
inst✝¹ : (i : ι) → AddCommMonoid (A i)
inst✝ : GNonUnitalNonAssocSemiring A
src✝ : AddCommMonoid (⨁ (i : ι), A i) := inferInstance
x✝ : ⨁ (i : ι), A i
⊢ x✝ * 0 = 0

Next tactic:
simp only [HMul.hMul, AddMonoidHom.map_zero]
theorem mulHom_of_of {i j} (a : A i) (b : A j) :
    mulHom A (of A i a) (of A j b) = of A (i + j) (GradedMonoid.GMul.mul a b) := by
  

Proof state:
ι : Type u_1
inst✝³ : DecidableEq ι
A : ι → Type u_2
inst✝² : Add ι
inst✝¹ : (i : ι) → AddCommMonoid (A i)
inst✝ : GNonUnitalNonAssocSemiring A
i j : ι
a : A i
b : A j
⊢ ((mulHom A) ((of A i) a)) ((of A j) b) = (of A (i + j)) (GradedMonoid.GMul.mul a b)

Next tactic:
unfold mulHom
theorem mulHom_of_of {i j} (a : A i) (b : A j) :
    mulHom A (of A i a) (of A j b) = of A (i + j) (GradedMonoid.GMul.mul a b) := by
  unfold mulHom
  

Proof state:
ι : Type u_1
inst✝³ : DecidableEq ι
A : ι → Type u_2
inst✝² : Add ι
inst✝¹ : (i : ι) → AddCommMonoid (A i)
inst✝ : GNonUnitalNonAssocSemiring A
i j : ι
a : A i
b : A j
⊢ ((toAddMonoid fun x =>
          AddMonoidHom.flip
            (toAddMonoid fun x_1 => AddMonoidHom.flip (AddMonoidHom.comp (compHom (of A (x + x_1))) (gMulHom A))))
        ((of A i) a))
      ((of A j) b) =
    (of A (i + j)) (GradedMonoid.GMul.mul a b)

Next tactic:
simp only [toAddMonoid_of, flip_apply, coe_comp, Function.comp_apply]
theorem mulHom_of_of {i j} (a : A i) (b : A j) :
    mulHom A (of A i a) (of A j b) = of A (i + j) (GradedMonoid.GMul.mul a b) := by
  unfold mulHom
  simp only [toAddMonoid_of, flip_apply, coe_comp, Function.comp_apply]
  

Proof state:
ι : Type u_1
inst✝³ : DecidableEq ι
A : ι → Type u_2
inst✝² : Add ι
inst✝¹ : (i : ι) → AddCommMonoid (A i)
inst✝ : GNonUnitalNonAssocSemiring A
i j : ι
a : A i
b : A j
⊢ ((compHom (of A (i + j))) ((gMulHom A) a)) b = (of A (i + j)) (GradedMonoid.GMul.mul a b)

Next tactic:
rfl
private nonrec theorem one_mul (x : ⨁ i, A i) : 1 * x = x := by
  

Proof state:
ι : Type u_1
inst✝³ : DecidableEq ι
A : ι → Type u_2
inst✝² : (i : ι) → AddCommMonoid (A i)
inst✝¹ : AddMonoid ι
inst✝ : GSemiring A
x : ⨁ (i : ι), A i
⊢ 1 * x = x

Next tactic:
suffices mulHom A One.one = AddMonoidHom.id (⨁ i, A i) from FunLike.congr_fun this x
private nonrec theorem one_mul (x : ⨁ i, A i) : 1 * x = x := by
  suffices mulHom A One.one = AddMonoidHom.id (⨁ i, A i) from FunLike.congr_fun this x
  

Proof state:
ι : Type u_1
inst✝³ : DecidableEq ι
A : ι → Type u_2
inst✝² : (i : ι) → AddCommMonoid (A i)
inst✝¹ : AddMonoid ι
inst✝ : GSemiring A
x : ⨁ (i : ι), A i
⊢ (mulHom A) One.one = AddMonoidHom.id (⨁ (i : ι), A i)

Next tactic:
apply addHom_ext
private nonrec theorem one_mul (x : ⨁ i, A i) : 1 * x = x := by
  suffices mulHom A One.one = AddMonoidHom.id (⨁ i, A i) from FunLike.congr_fun this x
  apply addHom_ext; 

Proof state:
case H
ι : Type u_1
inst✝³ : DecidableEq ι
A : ι → Type u_2
inst✝² : (i : ι) → AddCommMonoid (A i)
inst✝¹ : AddMonoid ι
inst✝ : GSemiring A
x : ⨁ (i : ι), A i
⊢ ∀ (i : ι) (y : A i),
    ((mulHom A) One.one) ((of (fun i => A i) i) y) = (AddMonoidHom.id (⨁ (i : ι), A i)) ((of (fun i => A i) i) y)

Next tactic:
intro i xi
private nonrec theorem one_mul (x : ⨁ i, A i) : 1 * x = x := by
  suffices mulHom A One.one = AddMonoidHom.id (⨁ i, A i) from FunLike.congr_fun this x
  apply addHom_ext; intro i xi
  

Proof state:
case H
ι : Type u_1
inst✝³ : DecidableEq ι
A : ι → Type u_2
inst✝² : (i : ι) → AddCommMonoid (A i)
inst✝¹ : AddMonoid ι
inst✝ : GSemiring A
x : ⨁ (i : ι), A i
i : ι
xi : A i
⊢ ((mulHom A) One.one) ((of (fun i => A i) i) xi) = (AddMonoidHom.id (⨁ (i : ι), A i)) ((of (fun i => A i) i) xi)

Next tactic:
simp only [One.one]
private nonrec theorem one_mul (x : ⨁ i, A i) : 1 * x = x := by
  suffices mulHom A One.one = AddMonoidHom.id (⨁ i, A i) from FunLike.congr_fun this x
  apply addHom_ext; intro i xi
  simp only [One.one]
  

Proof state:
case H
ι : Type u_1
inst✝³ : DecidableEq ι
A : ι → Type u_2
inst✝² : (i : ι) → AddCommMonoid (A i)
inst✝¹ : AddMonoid ι
inst✝ : GSemiring A
x : ⨁ (i : ι), A i
i : ι
xi : A i
⊢ ((mulHom A) ((of (fun i => A i) 0) GradedMonoid.GOne.one)) ((of (fun i => A i) i) xi) =
    (AddMonoidHom.id (⨁ (i : ι), A i)) ((of (fun i => A i) i) xi)

Next tactic:
rw [mulHom_of_of]