/-- 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 _ _)]
        abel
      · have : (J.face i : WithTop (Box (Fin n))) ≤ I₀.face i :=
          WithTop.coe_le_coe.2 (face_mono hJ i)
        rw [le_iff_Icc, @Box.Icc_eq_pi _ I₀] at hJ
        simp only
        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]
        have hx' : x ∈ Ioo ((J.face i).lower j) ((J.face i).upper j) := hx
        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]
        

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

Next tactic:
simp only [Box.face]