[GOAL]
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝¹ : AddCommMonoid M
inst✝ : AddCommMonoid N
I₀ : WithTop (Box ι)
I J : Box ι
i : ι
f g : ι →ᵇᵃ[I₀] M
h : f.toFun = g.toFun
⊢ f = g
[PROOFSTEP]
cases f
[GOAL]
case mk
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝¹ : AddCommMonoid M
inst✝ : AddCommMonoid N
I₀ : WithTop (Box ι)
I J : Box ι
i : ι
g : ι →ᵇᵃ[I₀] M
toFun✝ : Box ι → M
sum_partition_boxes'✝ :
  ∀ (J : Box ι), ↑J ≤ I₀ → ∀ (π : Prepartition J), IsPartition π → ∑ Ji in π.boxes, toFun✝ Ji = toFun✝ J
h : { toFun := toFun✝, sum_partition_boxes' := sum_partition_boxes'✝ }.toFun = g.toFun
⊢ { toFun := toFun✝, sum_partition_boxes' := sum_partition_boxes'✝ } = g
[PROOFSTEP]
cases g
[GOAL]
case mk.mk
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝¹ : AddCommMonoid M
inst✝ : AddCommMonoid N
I₀ : WithTop (Box ι)
I J : Box ι
i : ι
toFun✝¹ : Box ι → M
sum_partition_boxes'✝¹ :
  ∀ (J : Box ι), ↑J ≤ I₀ → ∀ (π : Prepartition J), IsPartition π → ∑ Ji in π.boxes, toFun✝¹ Ji = toFun✝¹ J
toFun✝ : Box ι → M
sum_partition_boxes'✝ :
  ∀ (J : Box ι), ↑J ≤ I₀ → ∀ (π : Prepartition J), IsPartition π → ∑ Ji in π.boxes, toFun✝ Ji = toFun✝ J
h :
  { toFun := toFun✝¹, sum_partition_boxes' := sum_partition_boxes'✝¹ }.toFun =
    { toFun := toFun✝, sum_partition_boxes' := sum_partition_boxes'✝ }.toFun
⊢ { toFun := toFun✝¹, sum_partition_boxes' := sum_partition_boxes'✝¹ } =
    { toFun := toFun✝, sum_partition_boxes' := sum_partition_boxes'✝ }
[PROOFSTEP]
congr
[GOAL]
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝¹ : AddCommMonoid M
inst✝ : AddCommMonoid N
I₀ : WithTop (Box ι)
I✝ J : Box ι
i : ι
f g : ι →ᵇᵃ[I₀] M
I : Box ι
hI : ↑I ≤ I₀
π : Prepartition I
hπ : IsPartition π
⊢ ∑ Ji in π.boxes, (↑f + ↑g) Ji = (↑f + ↑g) I
[PROOFSTEP]
simp only [Pi.add_apply, sum_add_distrib, sum_partition_boxes _ hI hπ]
[GOAL]
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : AddCommMonoid N
I₀ : WithTop (Box ι)
I✝ J : Box ι
i : ι
R : Type ?u.25829
inst✝¹ : Monoid R
inst✝ : DistribMulAction R M
r : R
f : ι →ᵇᵃ[I₀] M
I : Box ι
hI : ↑I ≤ I₀
π : Prepartition I
hπ : IsPartition π
⊢ ∑ Ji in π.boxes, (r • ↑f) Ji = (r • ↑f) I
[PROOFSTEP]
simp only [Pi.smul_apply, ← smul_sum, sum_partition_boxes _ hI hπ]
[GOAL]
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝¹ : AddCommMonoid M
inst✝ : AddCommMonoid N
I₀ : WithTop (Box ι)
I J : Box ι
i✝ : ι
f : ι →ᵇᵃ[I₀] M
hI : ↑I ≤ I₀
i : ι
x : ℝ
⊢ Option.elim' 0 (↑f) (splitLower I i x) + Option.elim' 0 (↑f) (splitUpper I i x) = ↑f I
[PROOFSTEP]
rw [← f.sum_partition_boxes hI (isPartitionSplit I i x), sum_split_boxes]
[GOAL]
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I J : Box ι
i : ι
inst✝ : Fintype ι
f : Box ι → M
I₀ : WithTop (Box ι)
hf :
  ∀ (I : Box ι),
    ↑I ≤ I₀ →
      ∀ {i : ι} {x : ℝ},
        x ∈ Set.Ioo (lower I i) (upper I i) →
          Option.elim' 0 f (splitLower I i x) + Option.elim' 0 f (splitUpper I i x) = f I
⊢ ι →ᵇᵃ[I₀] M
[PROOFSTEP]
refine' ⟨f, _⟩
[GOAL]
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I J : Box ι
i : ι
inst✝ : Fintype ι
f : Box ι → M
I₀ : WithTop (Box ι)
hf :
  ∀ (I : Box ι),
    ↑I ≤ I₀ →
      ∀ {i : ι} {x : ℝ},
        x ∈ Set.Ioo (lower I i) (upper I i) →
          Option.elim' 0 f (splitLower I i x) + Option.elim' 0 f (splitUpper I i x) = f I
⊢ ∀ (J : Box ι), ↑J ≤ I₀ → ∀ (π : Prepartition J), IsPartition π → ∑ Ji in π.boxes, f Ji = f J
[PROOFSTEP]
replace hf : ∀ I : Box ι, ↑I ≤ I₀ → ∀ s, (∑ J in (splitMany I s).boxes, f J) = f I
[GOAL]
case hf
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I J : Box ι
i : ι
inst✝ : Fintype ι
f : Box ι → M
I₀ : WithTop (Box ι)
hf :
  ∀ (I : Box ι),
    ↑I ≤ I₀ →
      ∀ {i : ι} {x : ℝ},
        x ∈ Set.Ioo (lower I i) (upper I i) →
          Option.elim' 0 f (splitLower I i x) + Option.elim' 0 f (splitUpper I i x) = f I
⊢ ∀ (I : Box ι), ↑I ≤ I₀ → ∀ (s : Finset (ι × ℝ)), ∑ J in (splitMany I s).boxes, f J = f I
[PROOFSTEP]
intro I hI s
[GOAL]
case hf
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I✝ J : Box ι
i : ι
inst✝ : Fintype ι
f : Box ι → M
I₀ : WithTop (Box ι)
hf :
  ∀ (I : Box ι),
    ↑I ≤ I₀ →
      ∀ {i : ι} {x : ℝ},
        x ∈ Set.Ioo (lower I i) (upper I i) →
          Option.elim' 0 f (splitLower I i x) + Option.elim' 0 f (splitUpper I i x) = f I
I : Box ι
hI : ↑I ≤ I₀
s : Finset (ι × ℝ)
⊢ ∑ J in (splitMany I s).boxes, f J = f I
[PROOFSTEP]
induction' s using Finset.induction_on with a s _ ihs
[GOAL]
case hf.empty
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I✝ J : Box ι
i : ι
inst✝ : Fintype ι
f : Box ι → M
I₀ : WithTop (Box ι)
hf :
  ∀ (I : Box ι),
    ↑I ≤ I₀ →
      ∀ {i : ι} {x : ℝ},
        x ∈ Set.Ioo (lower I i) (upper I i) →
          Option.elim' 0 f (splitLower I i x) + Option.elim' 0 f (splitUpper I i x) = f I
I : Box ι
hI : ↑I ≤ I₀
⊢ ∑ J in (splitMany I ∅).boxes, f J = f I
[PROOFSTEP]
simp
[GOAL]
case hf.insert
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I✝ J : Box ι
i : ι
inst✝ : Fintype ι
f : Box ι → M
I₀ : WithTop (Box ι)
hf :
  ∀ (I : Box ι),
    ↑I ≤ I₀ →
      ∀ {i : ι} {x : ℝ},
        x ∈ Set.Ioo (lower I i) (upper I i) →
          Option.elim' 0 f (splitLower I i x) + Option.elim' 0 f (splitUpper I i x) = f I
I : Box ι
hI : ↑I ≤ I₀
a : ι × ℝ
s : Finset (ι × ℝ)
a✝ : ¬a ∈ s
ihs : ∑ J in (splitMany I s).boxes, f J = f I
⊢ ∑ J in (splitMany I (insert a s)).boxes, f J = f I
[PROOFSTEP]
rw [splitMany_insert, inf_split, ← ihs, biUnion_boxes, sum_biUnion_boxes]
[GOAL]
case hf.insert
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I✝ J : Box ι
i : ι
inst✝ : Fintype ι
f : Box ι → M
I₀ : WithTop (Box ι)
hf :
  ∀ (I : Box ι),
    ↑I ≤ I₀ →
      ∀ {i : ι} {x : ℝ},
        x ∈ Set.Ioo (lower I i) (upper I i) →
          Option.elim' 0 f (splitLower I i x) + Option.elim' 0 f (splitUpper I i x) = f I
I : Box ι
hI : ↑I ≤ I₀
a : ι × ℝ
s : Finset (ι × ℝ)
a✝ : ¬a ∈ s
ihs : ∑ J in (splitMany I s).boxes, f J = f I
⊢ ∑ J in (splitMany I s).boxes, ∑ J' in (split J a.fst a.snd).boxes, f J' = ∑ J in (splitMany I s).boxes, f J
[PROOFSTEP]
refine' Finset.sum_congr rfl fun J' hJ' => _
[GOAL]
case hf.insert
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I✝ J : Box ι
i : ι
inst✝ : Fintype ι
f : Box ι → M
I₀ : WithTop (Box ι)
hf :
  ∀ (I : Box ι),
    ↑I ≤ I₀ →
      ∀ {i : ι} {x : ℝ},
        x ∈ Set.Ioo (lower I i) (upper I i) →
          Option.elim' 0 f (splitLower I i x) + Option.elim' 0 f (splitUpper I i x) = f I
I : Box ι
hI : ↑I ≤ I₀
a : ι × ℝ
s : Finset (ι × ℝ)
a✝ : ¬a ∈ s
ihs : ∑ J in (splitMany I s).boxes, f J = f I
J' : Box ι
hJ' : J' ∈ (splitMany I s).boxes
⊢ ∑ J' in (split J' a.fst a.snd).boxes, f J' = f J'
[PROOFSTEP]
by_cases h : a.2 ∈ Ioo (J'.lower a.1) (J'.upper a.1)
[GOAL]
case pos
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I✝ J : Box ι
i : ι
inst✝ : Fintype ι
f : Box ι → M
I₀ : WithTop (Box ι)
hf :
  ∀ (I : Box ι),
    ↑I ≤ I₀ →
      ∀ {i : ι} {x : ℝ},
        x ∈ Set.Ioo (lower I i) (upper I i) →
          Option.elim' 0 f (splitLower I i x) + Option.elim' 0 f (splitUpper I i x) = f I
I : Box ι
hI : ↑I ≤ I₀
a : ι × ℝ
s : Finset (ι × ℝ)
a✝ : ¬a ∈ s
ihs : ∑ J in (splitMany I s).boxes, f J = f I
J' : Box ι
hJ' : J' ∈ (splitMany I s).boxes
h : a.snd ∈ Set.Ioo (lower J' a.fst) (upper J' a.fst)
⊢ ∑ J' in (split J' a.fst a.snd).boxes, f J' = f J'
[PROOFSTEP]
rw [sum_split_boxes]
[GOAL]
case pos
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I✝ J : Box ι
i : ι
inst✝ : Fintype ι
f : Box ι → M
I₀ : WithTop (Box ι)
hf :
  ∀ (I : Box ι),
    ↑I ≤ I₀ →
      ∀ {i : ι} {x : ℝ},
        x ∈ Set.Ioo (lower I i) (upper I i) →
          Option.elim' 0 f (splitLower I i x) + Option.elim' 0 f (splitUpper I i x) = f I
I : Box ι
hI : ↑I ≤ I₀
a : ι × ℝ
s : Finset (ι × ℝ)
a✝ : ¬a ∈ s
ihs : ∑ J in (splitMany I s).boxes, f J = f I
J' : Box ι
hJ' : J' ∈ (splitMany I s).boxes
h : a.snd ∈ Set.Ioo (lower J' a.fst) (upper J' a.fst)
⊢ Option.elim' 0 (fun J' => f J') (splitLower J' a.fst a.snd) +
      Option.elim' 0 (fun J' => f J') (splitUpper J' a.fst a.snd) =
    f J'
[PROOFSTEP]
exact hf _ ((WithTop.coe_le_coe.2 <| le_of_mem _ hJ').trans hI) h
[GOAL]
case neg
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I✝ J : Box ι
i : ι
inst✝ : Fintype ι
f : Box ι → M
I₀ : WithTop (Box ι)
hf :
  ∀ (I : Box ι),
    ↑I ≤ I₀ →
      ∀ {i : ι} {x : ℝ},
        x ∈ Set.Ioo (lower I i) (upper I i) →
          Option.elim' 0 f (splitLower I i x) + Option.elim' 0 f (splitUpper I i x) = f I
I : Box ι
hI : ↑I ≤ I₀
a : ι × ℝ
s : Finset (ι × ℝ)
a✝ : ¬a ∈ s
ihs : ∑ J in (splitMany I s).boxes, f J = f I
J' : Box ι
hJ' : J' ∈ (splitMany I s).boxes
h : ¬a.snd ∈ Set.Ioo (lower J' a.fst) (upper J' a.fst)
⊢ ∑ J' in (split J' a.fst a.snd).boxes, f J' = f J'
[PROOFSTEP]
rw [split_of_not_mem_Ioo h, top_boxes, Finset.sum_singleton]
[GOAL]
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I J : Box ι
i : ι
inst✝ : Fintype ι
f : Box ι → M
I₀ : WithTop (Box ι)
hf : ∀ (I : Box ι), ↑I ≤ I₀ → ∀ (s : Finset (ι × ℝ)), ∑ J in (splitMany I s).boxes, f J = f I
⊢ ∀ (J : Box ι), ↑J ≤ I₀ → ∀ (π : Prepartition J), IsPartition π → ∑ Ji in π.boxes, f Ji = f J
[PROOFSTEP]
intro I hI π hπ
[GOAL]
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I✝ J : Box ι
i : ι
inst✝ : Fintype ι
f : Box ι → M
I₀ : WithTop (Box ι)
hf : ∀ (I : Box ι), ↑I ≤ I₀ → ∀ (s : Finset (ι × ℝ)), ∑ J in (splitMany I s).boxes, f J = f I
I : Box ι
hI : ↑I ≤ I₀
π : Prepartition I
hπ : IsPartition π
⊢ ∑ Ji in π.boxes, f Ji = f I
[PROOFSTEP]
have Hle : ∀ J ∈ π, ↑J ≤ I₀ := fun J hJ => (WithTop.coe_le_coe.2 <| π.le_of_mem hJ).trans hI
[GOAL]
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I✝ J : Box ι
i : ι
inst✝ : Fintype ι
f : Box ι → M
I₀ : WithTop (Box ι)
hf : ∀ (I : Box ι), ↑I ≤ I₀ → ∀ (s : Finset (ι × ℝ)), ∑ J in (splitMany I s).boxes, f J = f I
I : Box ι
hI : ↑I ≤ I₀
π : Prepartition I
hπ : IsPartition π
Hle : ∀ (J : Box ι), J ∈ π → ↑J ≤ I₀
⊢ ∑ Ji in π.boxes, f Ji = f I
[PROOFSTEP]
rcases hπ.exists_splitMany_le with ⟨s, hs⟩
[GOAL]
case intro
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I✝ J : Box ι
i : ι
inst✝ : Fintype ι
f : Box ι → M
I₀ : WithTop (Box ι)
hf : ∀ (I : Box ι), ↑I ≤ I₀ → ∀ (s : Finset (ι × ℝ)), ∑ J in (splitMany I s).boxes, f J = f I
I : Box ι
hI : ↑I ≤ I₀
π : Prepartition I
hπ : IsPartition π
Hle : ∀ (J : Box ι), J ∈ π → ↑J ≤ I₀
s : Finset (ι × ℝ)
hs : splitMany I s ≤ π
⊢ ∑ Ji in π.boxes, f Ji = f I
[PROOFSTEP]
rw [← hf _ hI, ← inf_of_le_right hs, inf_splitMany, biUnion_boxes, sum_biUnion_boxes]
[GOAL]
case intro
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I✝ J : Box ι
i : ι
inst✝ : Fintype ι
f : Box ι → M
I₀ : WithTop (Box ι)
hf : ∀ (I : Box ι), ↑I ≤ I₀ → ∀ (s : Finset (ι × ℝ)), ∑ J in (splitMany I s).boxes, f J = f I
I : Box ι
hI : ↑I ≤ I₀
π : Prepartition I
hπ : IsPartition π
Hle : ∀ (J : Box ι), J ∈ π → ↑J ≤ I₀
s : Finset (ι × ℝ)
hs : splitMany I s ≤ π
⊢ ∑ Ji in π.boxes, f Ji = ∑ J in π.boxes, ∑ J' in (splitMany J s).boxes, f J'
[PROOFSTEP]
exact Finset.sum_congr rfl fun J hJ => (hf _ (Hle _ hJ) _).symm
[GOAL]
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝¹ : AddCommMonoid M
inst✝ : AddCommMonoid N
I₀ : WithTop (Box ι)
I✝ J : Box ι
i : ι
f : ι →ᵇᵃ[I₀] M
g : M →+ N
I : Box ι
hI : ↑I ≤ I₀
π : Prepartition I
hπ : IsPartition π
⊢ ∑ Ji in π.boxes, (↑g ∘ ↑f) Ji = (↑g ∘ ↑f) I
[PROOFSTEP]
simp_rw [comp, ← g.map_sum, f.sum_partition_boxes hI hπ]
[GOAL]
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀ : WithTop (Box ι)
I J : Box ι
i : ι
inst✝ : Finite ι
f : ι →ᵇᵃ[I₀] M
hI : ↑I ≤ I₀
π₁ π₂ : Prepartition I
h : Prepartition.iUnion π₁ = Prepartition.iUnion π₂
⊢ ∑ J in π₁.boxes, ↑f J = ∑ J in π₂.boxes, ↑f J
[PROOFSTEP]
rcases exists_splitMany_inf_eq_filter_of_finite { π₁, π₂ } ((finite_singleton _).insert _) with ⟨s, hs⟩
[GOAL]
case intro
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀ : WithTop (Box ι)
I J : Box ι
i : ι
inst✝ : Finite ι
f : ι →ᵇᵃ[I₀] M
hI : ↑I ≤ I₀
π₁ π₂ : Prepartition I
h : Prepartition.iUnion π₁ = Prepartition.iUnion π₂
s : Finset (ι × ℝ)
hs :
  ∀ (π : Prepartition I),
    π ∈ {π₁, π₂} → π ⊓ splitMany I s = Prepartition.filter (splitMany I s) fun J => ↑J ⊆ Prepartition.iUnion π
⊢ ∑ J in π₁.boxes, ↑f J = ∑ J in π₂.boxes, ↑f J
[PROOFSTEP]
simp only [inf_splitMany] at hs
[GOAL]
case intro
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀ : WithTop (Box ι)
I J : Box ι
i : ι
inst✝ : Finite ι
f : ι →ᵇᵃ[I₀] M
hI : ↑I ≤ I₀
π₁ π₂ : Prepartition I
h : Prepartition.iUnion π₁ = Prepartition.iUnion π₂
s : Finset (ι × ℝ)
hs :
  ∀ (π : Prepartition I),
    π ∈ {π₁, π₂} →
      (biUnion π fun J => splitMany J s) = Prepartition.filter (splitMany I s) fun J => ↑J ⊆ Prepartition.iUnion π
⊢ ∑ J in π₁.boxes, ↑f J = ∑ J in π₂.boxes, ↑f J
[PROOFSTEP]
rcases hs _ (Or.inl rfl), hs _ (Or.inr rfl) with ⟨h₁, h₂⟩
[GOAL]
case intro
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀ : WithTop (Box ι)
I J : Box ι
i : ι
inst✝ : Finite ι
f : ι →ᵇᵃ[I₀] M
hI : ↑I ≤ I₀
π₁ π₂ : Prepartition I
h : Prepartition.iUnion π₁ = Prepartition.iUnion π₂
s : Finset (ι × ℝ)
hs :
  ∀ (π : Prepartition I),
    π ∈ {π₁, π₂} →
      (biUnion π fun J => splitMany J s) = Prepartition.filter (splitMany I s) fun J => ↑J ⊆ Prepartition.iUnion π
h₁ : (biUnion π₁ fun J => splitMany J s) = Prepartition.filter (splitMany I s) fun J => ↑J ⊆ Prepartition.iUnion π₁
h₂ : (biUnion π₂ fun J => splitMany J s) = Prepartition.filter (splitMany I s) fun J => ↑J ⊆ Prepartition.iUnion π₂
⊢ ∑ J in π₁.boxes, ↑f J = ∑ J in π₂.boxes, ↑f J
[PROOFSTEP]
clear hs
[GOAL]
case intro
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀ : WithTop (Box ι)
I J : Box ι
i : ι
inst✝ : Finite ι
f : ι →ᵇᵃ[I₀] M
hI : ↑I ≤ I₀
π₁ π₂ : Prepartition I
h : Prepartition.iUnion π₁ = Prepartition.iUnion π₂
s : Finset (ι × ℝ)
h₁ : (biUnion π₁ fun J => splitMany J s) = Prepartition.filter (splitMany I s) fun J => ↑J ⊆ Prepartition.iUnion π₁
h₂ : (biUnion π₂ fun J => splitMany J s) = Prepartition.filter (splitMany I s) fun J => ↑J ⊆ Prepartition.iUnion π₂
⊢ ∑ J in π₁.boxes, ↑f J = ∑ J in π₂.boxes, ↑f J
[PROOFSTEP]
rw [h] at h₁
[GOAL]
case intro
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀ : WithTop (Box ι)
I J : Box ι
i : ι
inst✝ : Finite ι
f : ι →ᵇᵃ[I₀] M
hI : ↑I ≤ I₀
π₁ π₂ : Prepartition I
h : Prepartition.iUnion π₁ = Prepartition.iUnion π₂
s : Finset (ι × ℝ)
h₁ : (biUnion π₁ fun J => splitMany J s) = Prepartition.filter (splitMany I s) fun J => ↑J ⊆ Prepartition.iUnion π₂
h₂ : (biUnion π₂ fun J => splitMany J s) = Prepartition.filter (splitMany I s) fun J => ↑J ⊆ Prepartition.iUnion π₂
⊢ ∑ J in π₁.boxes, ↑f J = ∑ J in π₂.boxes, ↑f J
[PROOFSTEP]
calc
  ∑ J in π₁.boxes, f J = ∑ J in π₁.boxes, ∑ J' in (splitMany J s).boxes, f J' :=
    Finset.sum_congr rfl fun J hJ => (f.sum_partition_boxes ?_ (isPartition_splitMany _ _)).symm
  _ = ∑ J in (π₁.biUnion fun J => splitMany J s).boxes, f J := (sum_biUnion_boxes _ _ _).symm
  _ = ∑ J in (π₂.biUnion fun J => splitMany J s).boxes, f J := by rw [h₁, h₂]
  _ = ∑ J in π₂.boxes, ∑ J' in (splitMany J s).boxes, f J' := (sum_biUnion_boxes _ _ _)
  _ = ∑ J in π₂.boxes, f J := Finset.sum_congr rfl fun J hJ => f.sum_partition_boxes ?_ (isPartition_splitMany _ _)
[GOAL]
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀ : WithTop (Box ι)
I J : Box ι
i : ι
inst✝ : Finite ι
f : ι →ᵇᵃ[I₀] M
hI : ↑I ≤ I₀
π₁ π₂ : Prepartition I
h : Prepartition.iUnion π₁ = Prepartition.iUnion π₂
s : Finset (ι × ℝ)
h₁ : (biUnion π₁ fun J => splitMany J s) = Prepartition.filter (splitMany I s) fun J => ↑J ⊆ Prepartition.iUnion π₂
h₂ : (biUnion π₂ fun J => splitMany J s) = Prepartition.filter (splitMany I s) fun J => ↑J ⊆ Prepartition.iUnion π₂
⊢ ∑ J in (biUnion π₁ fun J => splitMany J s).boxes, ↑f J = ∑ J in (biUnion π₂ fun J => splitMany J s).boxes, ↑f J
[PROOFSTEP]
rw [h₁, h₂]
[GOAL]
case intro.calc_1
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀ : WithTop (Box ι)
I J✝ : Box ι
i : ι
inst✝ : Finite ι
f : ι →ᵇᵃ[I₀] M
hI : ↑I ≤ I₀
π₁ π₂ : Prepartition I
h : Prepartition.iUnion π₁ = Prepartition.iUnion π₂
s : Finset (ι × ℝ)
h₁ : (biUnion π₁ fun J => splitMany J s) = Prepartition.filter (splitMany I s) fun J => ↑J ⊆ Prepartition.iUnion π₂
h₂ : (biUnion π₂ fun J => splitMany J s) = Prepartition.filter (splitMany I s) fun J => ↑J ⊆ Prepartition.iUnion π₂
J : Box ι
hJ : J ∈ π₁.boxes
⊢ ↑J ≤ I₀
case intro.calc_2
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀ : WithTop (Box ι)
I J✝ : Box ι
i : ι
inst✝ : Finite ι
f : ι →ᵇᵃ[I₀] M
hI : ↑I ≤ I₀
π₁ π₂ : Prepartition I
h : Prepartition.iUnion π₁ = Prepartition.iUnion π₂
s : Finset (ι × ℝ)
h₁ : (biUnion π₁ fun J => splitMany J s) = Prepartition.filter (splitMany I s) fun J => ↑J ⊆ Prepartition.iUnion π₂
h₂ : (biUnion π₂ fun J => splitMany J s) = Prepartition.filter (splitMany I s) fun J => ↑J ⊆ Prepartition.iUnion π₂
J : Box ι
hJ : J ∈ π₂.boxes
⊢ ↑J ≤ I₀
[PROOFSTEP]
exacts [(WithTop.coe_le_coe.2 <| π₁.le_of_mem hJ).trans hI, (WithTop.coe_le_coe.2 <| π₂.le_of_mem hJ).trans hI]
[GOAL]
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I J : Box ι
i✝ : ι
G : Type u
inst✝ : AddCommGroup G
I₀ : Box (Fin (n + 1))
i : Fin (n + 1)
f : ℝ → Box (Fin n) → G
fb : ↑(Set.Icc (lower I₀ i) (upper I₀ i)) → Fin n →ᵇᵃ[↑(face I₀ i)] G
hf :
  ∀ (x : ℝ) (hx : x ∈ Set.Icc (lower I₀ i) (upper I₀ i)) (J : Box (Fin n)), f x J = ↑(fb { val := x, property := hx }) J
⊢ ∀ (I : Box (Fin (n + 1))),
    ↑I ≤ ↑I₀ →
      ∀ {i_1 : Fin (n + 1)} {x : ℝ},
        x ∈ Set.Ioo (lower I i_1) (upper I i_1) →
          Option.elim' 0 (fun J => f (upper J i) (face J i) - f (lower J i) (face J i)) (splitLower I i_1 x) +
              Option.elim' 0 (fun J => f (upper J i) (face J i) - f (lower J i) (face J i)) (splitUpper I i_1 x) =
            (fun J => f (upper J i) (face J i) - f (lower J i) (face J i)) I
[PROOFSTEP]
intro J hJ j x
[GOAL]
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I J✝ : Box ι
i✝ : ι
G : Type u
inst✝ : AddCommGroup G
I₀ : Box (Fin (n + 1))
i : Fin (n + 1)
f : ℝ → Box (Fin n) → G
fb : ↑(Set.Icc (lower I₀ i) (upper I₀ i)) → Fin n →ᵇᵃ[↑(face I₀ i)] G
hf :
  ∀ (x : ℝ) (hx : x ∈ Set.Icc (lower I₀ i) (upper I₀ i)) (J : Box (Fin n)), f x J = ↑(fb { val := x, property := hx }) J
J : Box (Fin (n + 1))
hJ : ↑J ≤ ↑I₀
j : Fin (n + 1)
x : ℝ
⊢ x ∈ Set.Ioo (lower J j) (upper J j) →
    Option.elim' 0 (fun J => f (upper J i) (face J i) - f (lower J i) (face J i)) (splitLower J j x) +
        Option.elim' 0 (fun J => f (upper J i) (face J i) - f (lower J i) (face J i)) (splitUpper J j x) =
      (fun J => f (upper J i) (face J i) - f (lower J i) (face J i)) J
[PROOFSTEP]
rw [WithTop.coe_le_coe] at hJ
[GOAL]
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I J✝ : Box ι
i✝ : ι
G : Type u
inst✝ : AddCommGroup G
I₀ : Box (Fin (n + 1))
i : Fin (n + 1)
f : ℝ → Box (Fin n) → G
fb : ↑(Set.Icc (lower I₀ i) (upper I₀ i)) → Fin n →ᵇᵃ[↑(face I₀ i)] G
hf :
  ∀ (x : ℝ) (hx : x ∈ Set.Icc (lower I₀ i) (upper I₀ i)) (J : Box (Fin n)), f x J = ↑(fb { val := x, property := hx }) J
J : Box (Fin (n + 1))
hJ : J ≤ I₀
j : Fin (n + 1)
x : ℝ
⊢ x ∈ Set.Ioo (lower J j) (upper J j) →
    Option.elim' 0 (fun J => f (upper J i) (face J i) - f (lower J i) (face J i)) (splitLower J j x) +
        Option.elim' 0 (fun J => f (upper J i) (face J i) - f (lower J i) (face J i)) (splitUpper J j x) =
      (fun J => f (upper J i) (face J i) - f (lower J i) (face J i)) J
[PROOFSTEP]
refine' i.succAboveCases (fun hx => _) (fun j hx => _) j
[GOAL]
case refine'_1
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I J✝ : Box ι
i✝ : ι
G : Type u
inst✝ : AddCommGroup G
I₀ : Box (Fin (n + 1))
i : Fin (n + 1)
f : ℝ → Box (Fin n) → G
fb : ↑(Set.Icc (lower I₀ i) (upper I₀ i)) → Fin n →ᵇᵃ[↑(face I₀ i)] G
hf :
  ∀ (x : ℝ) (hx : x ∈ Set.Icc (lower I₀ i) (upper I₀ i)) (J : Box (Fin n)), f x J = ↑(fb { val := x, property := hx }) J
J : Box (Fin (n + 1))
hJ : J ≤ I₀
j : Fin (n + 1)
x : ℝ
hx : x ∈ Set.Ioo (lower J i) (upper J i)
⊢ Option.elim' 0 (fun J => f (upper J i) (face J i) - f (lower J i) (face J i)) (splitLower J i x) +
      Option.elim' 0 (fun J => f (upper J i) (face J i) - f (lower J i) (face J i)) (splitUpper J i x) =
    (fun J => f (upper J i) (face J i) - f (lower J i) (face J i)) J
[PROOFSTEP]
simp only [Box.splitLower_def hx, Box.splitUpper_def hx, update_same, ← WithBot.some_eq_coe, Option.elim', Box.face,
  (· ∘ ·), update_noteq (Fin.succAbove_ne _ _)]
[GOAL]
case refine'_1
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I J✝ : Box ι
i✝ : ι
G : Type u
inst✝ : AddCommGroup G
I₀ : Box (Fin (n + 1))
i : Fin (n + 1)
f : ℝ → Box (Fin n) → G
fb : ↑(Set.Icc (lower I₀ i) (upper I₀ i)) → Fin n →ᵇᵃ[↑(face I₀ i)] G
hf :
  ∀ (x : ℝ) (hx : x ∈ Set.Icc (lower I₀ i) (upper I₀ i)) (J : Box (Fin n)), f x J = ↑(fb { val := x, property := hx }) J
J : Box (Fin (n + 1))
hJ : J ≤ I₀
j : Fin (n + 1)
x : ℝ
hx : x ∈ Set.Ioo (lower J i) (upper J i)
⊢ f x
          { lower := fun x => lower J (Fin.succAbove i x), upper := fun x => upper J (Fin.succAbove i x),
            lower_lt_upper :=
              (_ :
                ∀ (i_1 : Fin n),
                  (fun x_1 =>
                        lower
                          { lower := J.lower, upper := update J.upper i x,
                            lower_lt_upper := (_ : ∀ (x_2 : Fin (n + 1)), lower J x_2 < update J.upper i x x_2) }
                          (Fin.succAbove i x_1))
                      i_1 <
                    (fun x => upper J (Fin.succAbove i x)) i_1) } -
        f (lower J i)
          { lower := fun x => lower J (Fin.succAbove i x), upper := fun x => upper J (Fin.succAbove i x),
            lower_lt_upper :=
              (_ :
                ∀ (i_1 : Fin n),
                  (fun x_1 =>
                        lower
                          { lower := J.lower, upper := update J.upper i x,
                            lower_lt_upper := (_ : ∀ (x_2 : Fin (n + 1)), lower J x_2 < update J.upper i x x_2) }
                          (Fin.succAbove i x_1))
                      i_1 <
                    (fun x => upper J (Fin.succAbove i x)) i_1) } +
      (f (upper J i)
          { lower := fun x => lower J (Fin.succAbove i x), upper := fun x => upper J (Fin.succAbove i x),
            lower_lt_upper :=
              (_ :
                ∀ (i_1 : Fin n),
                  (fun x => lower J (Fin.succAbove i x)) i_1 < (fun x => upper J (Fin.succAbove i x)) i_1) } -
        f x
          { lower := fun x => lower J (Fin.succAbove i x), upper := fun x => upper J (Fin.succAbove i x),
            lower_lt_upper :=
              (_ :
                ∀ (i_1 : Fin n),
                  (fun x => lower J (Fin.succAbove i x)) i_1 < (fun x => upper J (Fin.succAbove i x)) i_1) }) =
    f (upper J i)
        { lower := fun x => lower J (Fin.succAbove i x), upper := fun x => upper J (Fin.succAbove i x),
          lower_lt_upper :=
            (_ :
              ∀ (i_1 : Fin n),
                (fun x => lower J (Fin.succAbove i x)) i_1 < (fun x => upper J (Fin.succAbove i x)) i_1) } -
      f (lower J i)
        { lower := fun x => lower J (Fin.succAbove i x), upper := fun x => upper J (Fin.succAbove i x),
          lower_lt_upper :=
            (_ :
              ∀ (i_1 : Fin n),
                (fun x => lower J (Fin.succAbove i x)) i_1 < (fun x => upper J (Fin.succAbove i x)) i_1) }
[PROOFSTEP]
abel
[GOAL]
case refine'_1
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I J✝ : Box ι
i✝ : ι
G : Type u
inst✝ : AddCommGroup G
I₀ : Box (Fin (n + 1))
i : Fin (n + 1)
f : ℝ → Box (Fin n) → G
fb : ↑(Set.Icc (lower I₀ i) (upper I₀ i)) → Fin n →ᵇᵃ[↑(face I₀ i)] G
hf :
  ∀ (x : ℝ) (hx : x ∈ Set.Icc (lower I₀ i) (upper I₀ i)) (J : Box (Fin n)), f x J = ↑(fb { val := x, property := hx }) J
J : Box (Fin (n + 1))
hJ : J ≤ I₀
j : Fin (n + 1)
x : ℝ
hx : x ∈ Set.Ioo (lower J i) (upper J i)
⊢ f x
          { lower := fun x => lower J (Fin.succAbove i x), upper := fun x => upper J (Fin.succAbove i x),
            lower_lt_upper :=
              (_ :
                ∀ (i_1 : Fin n),
                  (fun x_1 =>
                        lower
                          { lower := J.lower, upper := update J.upper i x,
                            lower_lt_upper := (_ : ∀ (x_2 : Fin (n + 1)), lower J x_2 < update J.upper i x x_2) }
                          (Fin.succAbove i x_1))
                      i_1 <
                    (fun x => upper J (Fin.succAbove i x)) i_1) } -
        f (lower J i)
          { lower := fun x => lower J (Fin.succAbove i x), upper := fun x => upper J (Fin.succAbove i x),
            lower_lt_upper :=
              (_ :
                ∀ (i_1 : Fin n),
                  (fun x_1 =>
                        lower
                          { lower := J.lower, upper := update J.upper i x,
                            lower_lt_upper := (_ : ∀ (x_2 : Fin (n + 1)), lower J x_2 < update J.upper i x x_2) }
                          (Fin.succAbove i x_1))
                      i_1 <
                    (fun x => upper J (Fin.succAbove i x)) i_1) } +
      (f (upper J i)
          { lower := fun x => lower J (Fin.succAbove i x), upper := fun x => upper J (Fin.succAbove i x),
            lower_lt_upper :=
              (_ :
                ∀ (i_1 : Fin n),
                  (fun x => lower J (Fin.succAbove i x)) i_1 < (fun x => upper J (Fin.succAbove i x)) i_1) } -
        f x
          { lower := fun x => lower J (Fin.succAbove i x), upper := fun x => upper J (Fin.succAbove i x),
            lower_lt_upper :=
              (_ :
                ∀ (i_1 : Fin n),
                  (fun x => lower J (Fin.succAbove i x)) i_1 < (fun x => upper J (Fin.succAbove i x)) i_1) }) =
    f (upper J i)
        { lower := fun x => lower J (Fin.succAbove i x), upper := fun x => upper J (Fin.succAbove i x),
          lower_lt_upper :=
            (_ :
              ∀ (i_1 : Fin n),
                (fun x => lower J (Fin.succAbove i x)) i_1 < (fun x => upper J (Fin.succAbove i x)) i_1) } -
      f (lower J i)
        { lower := fun x => lower J (Fin.succAbove i x), upper := fun x => upper J (Fin.succAbove i x),
          lower_lt_upper :=
            (_ :
              ∀ (i_1 : Fin n),
                (fun x => lower J (Fin.succAbove i x)) i_1 < (fun x => upper J (Fin.succAbove i x)) i_1) }
[PROOFSTEP]
abel
[GOAL]
case refine'_2
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I J✝ : Box ι
i✝ : ι
G : Type u
inst✝ : AddCommGroup G
I₀ : Box (Fin (n + 1))
i : Fin (n + 1)
f : ℝ → Box (Fin n) → G
fb : ↑(Set.Icc (lower I₀ i) (upper I₀ i)) → Fin n →ᵇᵃ[↑(face I₀ i)] G
hf :
  ∀ (x : ℝ) (hx : x ∈ Set.Icc (lower I₀ i) (upper I₀ i)) (J : Box (Fin n)), f x J = ↑(fb { val := x, property := hx }) J
J : Box (Fin (n + 1))
hJ : J ≤ I₀
j✝ : Fin (n + 1)
x : ℝ
j : Fin n
hx : x ∈ Set.Ioo (lower J (Fin.succAbove i j)) (upper J (Fin.succAbove i j))
⊢ Option.elim' 0 (fun J => f (upper J i) (face J i) - f (lower J i) (face J i)) (splitLower J (Fin.succAbove i j) x) +
      Option.elim' 0 (fun J => f (upper J i) (face J i) - f (lower J i) (face J i))
        (splitUpper J (Fin.succAbove i j) x) =
    (fun J => f (upper J i) (face J i) - f (lower J i) (face J i)) J
[PROOFSTEP]
have : (J.face i : WithTop (Box (Fin n))) ≤ I₀.face i := WithTop.coe_le_coe.2 (face_mono hJ i)
[GOAL]
case refine'_2
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I J✝ : Box ι
i✝ : ι
G : Type u
inst✝ : AddCommGroup G
I₀ : Box (Fin (n + 1))
i : Fin (n + 1)
f : ℝ → Box (Fin n) → G
fb : ↑(Set.Icc (lower I₀ i) (upper I₀ i)) → Fin n →ᵇᵃ[↑(face I₀ i)] G
hf :
  ∀ (x : ℝ) (hx : x ∈ Set.Icc (lower I₀ i) (upper I₀ i)) (J : Box (Fin n)), f x J = ↑(fb { val := x, property := hx }) J
J : Box (Fin (n + 1))
hJ : J ≤ I₀
j✝ : Fin (n + 1)
x : ℝ
j : Fin n
hx : x ∈ Set.Ioo (lower J (Fin.succAbove i j)) (upper J (Fin.succAbove i j))
this : ↑(face J i) ≤ ↑(face I₀ i)
⊢ Option.elim' 0 (fun J => f (upper J i) (face J i) - f (lower J i) (face J i)) (splitLower J (Fin.succAbove i j) x) +
      Option.elim' 0 (fun J => f (upper J i) (face J i) - f (lower J i) (face J i))
        (splitUpper J (Fin.succAbove i j) x) =
    (fun J => f (upper J i) (face J i) - f (lower J i) (face J i)) J
[PROOFSTEP]
rw [le_iff_Icc, @Box.Icc_eq_pi _ I₀] at hJ
[GOAL]
case refine'_2
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I J✝ : Box ι
i✝ : ι
G : Type u
inst✝ : AddCommGroup G
I₀ : Box (Fin (n + 1))
i : Fin (n + 1)
f : ℝ → Box (Fin n) → G
fb : ↑(Set.Icc (lower I₀ i) (upper I₀ i)) → Fin n →ᵇᵃ[↑(face I₀ i)] G
hf :
  ∀ (x : ℝ) (hx : x ∈ Set.Icc (lower I₀ i) (upper I₀ i)) (J : Box (Fin n)), f x J = ↑(fb { val := x, property := hx }) J
J : Box (Fin (n + 1))
hJ : ↑Box.Icc J ⊆ Set.pi Set.univ fun i => Set.Icc (lower I₀ i) (upper I₀ i)
j✝ : Fin (n + 1)
x : ℝ
j : Fin n
hx : x ∈ Set.Ioo (lower J (Fin.succAbove i j)) (upper J (Fin.succAbove i j))
this : ↑(face J i) ≤ ↑(face I₀ i)
⊢ Option.elim' 0 (fun J => f (upper J i) (face J i) - f (lower J i) (face J i)) (splitLower J (Fin.succAbove i j) x) +
      Option.elim' 0 (fun J => f (upper J i) (face J i) - f (lower J i) (face J i))
        (splitUpper J (Fin.succAbove i j) x) =
    (fun J => f (upper J i) (face J i) - f (lower J i) (face J i)) J
[PROOFSTEP]
simp only
[GOAL]
case refine'_2
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I J✝ : Box ι
i✝ : ι
G : Type u
inst✝ : AddCommGroup G
I₀ : Box (Fin (n + 1))
i : Fin (n + 1)
f : ℝ → Box (Fin n) → G
fb : ↑(Set.Icc (lower I₀ i) (upper I₀ i)) → Fin n →ᵇᵃ[↑(face I₀ i)] G
hf :
  ∀ (x : ℝ) (hx : x ∈ Set.Icc (lower I₀ i) (upper I₀ i)) (J : Box (Fin n)), f x J = ↑(fb { val := x, property := hx }) J
J : Box (Fin (n + 1))
hJ : ↑Box.Icc J ⊆ Set.pi Set.univ fun i => Set.Icc (lower I₀ i) (upper I₀ i)
j✝ : Fin (n + 1)
x : ℝ
j : Fin n
hx : x ∈ Set.Ioo (lower J (Fin.succAbove i j)) (upper J (Fin.succAbove i j))
this : ↑(face J i) ≤ ↑(face I₀ i)
⊢ Option.elim' 0 (fun J => f (upper J i) (face J i) - f (lower J i) (face J i)) (splitLower J (Fin.succAbove i j) x) +
      Option.elim' 0 (fun J => f (upper J i) (face J i) - f (lower J i) (face J i))
        (splitUpper J (Fin.succAbove i j) x) =
    f (upper J i) (face J i) - f (lower J i) (face J i)
[PROOFSTEP]
rw [hf _ (hJ J.upper_mem_Icc _ trivial), hf _ (hJ J.lower_mem_Icc _ trivial), ← (fb _).map_split_add this j x, ←
  (fb _).map_split_add this j x]
[GOAL]
case refine'_2
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I J✝ : Box ι
i✝ : ι
G : Type u
inst✝ : AddCommGroup G
I₀ : Box (Fin (n + 1))
i : Fin (n + 1)
f : ℝ → Box (Fin n) → G
fb : ↑(Set.Icc (lower I₀ i) (upper I₀ i)) → Fin n →ᵇᵃ[↑(face I₀ i)] G
hf :
  ∀ (x : ℝ) (hx : x ∈ Set.Icc (lower I₀ i) (upper I₀ i)) (J : Box (Fin n)), f x J = ↑(fb { val := x, property := hx }) J
J : Box (Fin (n + 1))
hJ : ↑Box.Icc J ⊆ Set.pi Set.univ fun i => Set.Icc (lower I₀ i) (upper I₀ i)
j✝ : Fin (n + 1)
x : ℝ
j : Fin n
hx : x ∈ Set.Ioo (lower J (Fin.succAbove i j)) (upper J (Fin.succAbove i j))
this : ↑(face J i) ≤ ↑(face I₀ i)
⊢ Option.elim' 0 (fun J => f (upper J i) (face J i) - f (lower J i) (face J i)) (splitLower J (Fin.succAbove i j) x) +
      Option.elim' 0 (fun J => f (upper J i) (face J i) - f (lower J i) (face J i))
        (splitUpper J (Fin.succAbove i j) x) =
    Option.elim' 0
          (↑(fb { val := upper J i, property := (_ : upper J i ∈ (fun i => Set.Icc (lower I₀ i) (upper I₀ i)) i) }))
          (splitLower (face J i) j x) +
        Option.elim' 0
          (↑(fb { val := upper J i, property := (_ : upper J i ∈ (fun i => Set.Icc (lower I₀ i) (upper I₀ i)) i) }))
          (splitUpper (face J i) j x) -
      (Option.elim' 0
          (↑(fb { val := lower J i, property := (_ : lower J i ∈ (fun i => Set.Icc (lower I₀ i) (upper I₀ i)) i) }))
          (splitLower (face J i) j x) +
        Option.elim' 0
          (↑(fb { val := lower J i, property := (_ : lower J i ∈ (fun i => Set.Icc (lower I₀ i) (upper I₀ i)) i) }))
          (splitUpper (face J i) j x))
[PROOFSTEP]
have hx' : x ∈ Ioo ((J.face i).lower j) ((J.face i).upper j) := hx
[GOAL]
case refine'_2
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I J✝ : Box ι
i✝ : ι
G : Type u
inst✝ : AddCommGroup G
I₀ : Box (Fin (n + 1))
i : Fin (n + 1)
f : ℝ → Box (Fin n) → G
fb : ↑(Set.Icc (lower I₀ i) (upper I₀ i)) → Fin n →ᵇᵃ[↑(face I₀ i)] G
hf :
  ∀ (x : ℝ) (hx : x ∈ Set.Icc (lower I₀ i) (upper I₀ i)) (J : Box (Fin n)), f x J = ↑(fb { val := x, property := hx }) J
J : Box (Fin (n + 1))
hJ : ↑Box.Icc J ⊆ Set.pi Set.univ fun i => Set.Icc (lower I₀ i) (upper I₀ i)
j✝ : Fin (n + 1)
x : ℝ
j : Fin n
hx : x ∈ Set.Ioo (lower J (Fin.succAbove i j)) (upper J (Fin.succAbove i j))
this : ↑(face J i) ≤ ↑(face I₀ i)
hx' : x ∈ Set.Ioo (lower (face J i) j) (upper (face J i) j)
⊢ Option.elim' 0 (fun J => f (upper J i) (face J i) - f (lower J i) (face J i)) (splitLower J (Fin.succAbove i j) x) +
      Option.elim' 0 (fun J => f (upper J i) (face J i) - f (lower J i) (face J i))
        (splitUpper J (Fin.succAbove i j) x) =
    Option.elim' 0
          (↑(fb { val := upper J i, property := (_ : upper J i ∈ (fun i => Set.Icc (lower I₀ i) (upper I₀ i)) i) }))
          (splitLower (face J i) j x) +
        Option.elim' 0
          (↑(fb { val := upper J i, property := (_ : upper J i ∈ (fun i => Set.Icc (lower I₀ i) (upper I₀ i)) i) }))
          (splitUpper (face J i) j x) -
      (Option.elim' 0
          (↑(fb { val := lower J i, property := (_ : lower J i ∈ (fun i => Set.Icc (lower I₀ i) (upper I₀ i)) i) }))
          (splitLower (face J i) j x) +
        Option.elim' 0
          (↑(fb { val := lower J i, property := (_ : lower J i ∈ (fun i => Set.Icc (lower I₀ i) (upper I₀ i)) i) }))
          (splitUpper (face J i) j x))
[PROOFSTEP]
simp only [Box.splitLower_def hx, Box.splitUpper_def hx, Box.splitLower_def hx', Box.splitUpper_def hx', ←
  WithBot.some_eq_coe, Option.elim', Box.face_mk, update_noteq (Fin.succAbove_ne _ _).symm, sub_add_sub_comm,
  update_comp_eq_of_injective _ (Fin.strictMono_succAbove i).injective j x, ← hf]
[GOAL]
case refine'_2
ι : Type u_1
M : Type u_2
n : ℕ
N : Type u_3
inst✝² : AddCommMonoid M
inst✝¹ : AddCommMonoid N
I₀✝ : WithTop (Box ι)
I J✝ : Box ι
i✝ : ι
G : Type u
inst✝ : AddCommGroup G
I₀ : Box (Fin (n + 1))
i : Fin (n + 1)
f : ℝ → Box (Fin n) → G
fb : ↑(Set.Icc (lower I₀ i) (upper I₀ i)) → Fin n →ᵇᵃ[↑(face I₀ i)] G
hf :
  ∀ (x : ℝ) (hx : x ∈ Set.Icc (lower I₀ i) (upper I₀ i)) (J : Box (Fin n)), f x J = ↑(fb { val := x, property := hx }) J
J : Box (Fin (n + 1))
hJ : ↑Box.Icc J ⊆ Set.pi Set.univ fun i => Set.Icc (lower I₀ i) (upper I₀ i)
j✝ : Fin (n + 1)
x : ℝ
j : Fin n
hx : x ∈ Set.Ioo (lower J (Fin.succAbove i j)) (upper J (Fin.succAbove i j))
this : ↑(face J i) ≤ ↑(face I₀ i)
hx' : x ∈ Set.Ioo (lower (face J i) j) (upper (face J i) j)
⊢ f (upper J i)
          { lower := J.lower ∘ Fin.succAbove i, upper := update (J.upper ∘ Fin.succAbove i) j x,
            lower_lt_upper :=
              (_ : ∀ (i_1 : Fin n), (J.lower ∘ Fin.succAbove i) i_1 < update (J.upper ∘ Fin.succAbove i) j x i_1) } +
        f (upper J i)
          { lower := update (J.lower ∘ Fin.succAbove i) j x, upper := J.upper ∘ Fin.succAbove i,
            lower_lt_upper :=
              (_ : ∀ (i_1 : Fin n), update (J.lower ∘ Fin.succAbove i) j x i_1 < (J.upper ∘ Fin.succAbove i) i_1) } -
      (f (lower J i)
          { lower := J.lower ∘ Fin.succAbove i, upper := update (J.upper ∘ Fin.succAbove i) j x,
            lower_lt_upper :=
              (_ : ∀ (i_1 : Fin n), (J.lower ∘ Fin.succAbove i) i_1 < update (J.upper ∘ Fin.succAbove i) j x i_1) } +
        f (lower J i)
          { lower := update (J.lower ∘ Fin.succAbove i) j x, upper := J.upper ∘ Fin.succAbove i,
            lower_lt_upper :=
              (_ : ∀ (i_1 : Fin n), update (J.lower ∘ Fin.succAbove i) j x i_1 < (J.upper ∘ Fin.succAbove i) i_1) }) =
    f (upper J i)
          { lower := (face J i).lower, upper := update (face J i).upper j x,
            lower_lt_upper := (_ : ∀ (x_1 : Fin n), lower (face J i) x_1 < update (face J i).upper j x x_1) } +
        f (upper J i)
          { lower := update (face J i).lower j x, upper := (face J i).upper,
            lower_lt_upper := (_ : ∀ (x_1 : Fin n), update (face J i).lower j x x_1 < upper (face J i) x_1) } -
      (f (lower J i)
          { lower := (face J i).lower, upper := update (face J i).upper j x,
            lower_lt_upper := (_ : ∀ (x_1 : Fin n), lower (face J i) x_1 < update (face J i).upper j x x_1) } +
        f (lower J i)
          { lower := update (face J i).lower j x, upper := (face J i).upper,
            lower_lt_upper := (_ : ∀ (x_1 : Fin n), update (face J i).lower j x x_1 < upper (face J i) x_1) })
[PROOFSTEP]
simp only [Box.face]