/-- Given a box `I₀` in `ℝⁿ⁺¹`, `f x : Box (Fin n) → G` is a family of functions indexed by a real
`x` and for `x ∈ [I₀.lower i, I₀.upper i]`, `f x` is box-additive on subboxes of the `i`-th face of
`I₀`, then `fun J ↦ f (J.upper i) (J.face i) - f (J.lower i) (J.face i)` is box-additive on subboxes
of `I₀`. -/
@[simps!]
def upperSubLower.{u} {G : Type u} [AddCommGroup G] (I₀ : Box (Fin (n + 1))) (i : Fin (n + 1))
    (f : ℝ → Box (Fin n) → G) (fb : Icc (I₀.lower i) (I₀.upper i) → Fin n →ᵇᵃ[I₀.face i] G)
    (hf : ∀ (x) (hx : x ∈ Icc (I₀.lower i) (I₀.upper i)) (J), f x J = fb ⟨x, hx⟩ J) :
    Fin (n + 1) →ᵇᵃ[I₀] G :=
  ofMapSplitAdd (fun J : Box (Fin (n + 1)) => f (J.upper i) (J.face i) - f (J.lower i) (J.face i))
    I₀
    (by
      intro J hJ j x
      rw [WithTop.coe_le_coe] at hJ
      refine' i.succAboveCases (fun hx => _) (fun j hx => _) j
      · 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 _ _)]
        

Proof state:
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) }

Next tactic:
abel