import Mathlib
import Optlib


open Set InnerProductSpace Topology Filter InnerProduct

open scoped Pointwise

theorem extracted_formal_statement_308.{u_3, u_2, u_1} {E₁ : Type u_1} {E₂ : Type u_2} {F : Type u_3}
  [inst : NormedAddCommGroup E₁] [inst_1 : InnerProductSpace ℝ E₁] [inst_2 : FiniteDimensional ℝ E₁]
  [inst_3 : NormedAddCommGroup E₂] [inst_4 : InnerProductSpace ℝ E₂] [inst_5 : FiniteDimensional ℝ E₂]
  [inst_6 : NormedAddCommGroup F] [inst_7 : InnerProductSpace ℝ F] [inst_8 : FiniteDimensional ℝ F]
  {admm : ADMM E₁ E₂ F} {admm_kkt : Existance_of_kkt admm} [inst_9 : Setting E₁ E₂ F admm admm_kkt]
  (htau : 0 < ADMM.τ E₁ E₂ F ∧ ADMM.τ E₁ E₂ F ≤ 1) (n : ℕ+) :
  let e_y_n := 1 / (ADMM.τ E₁ E₂ F * ADMM.ρ E₁ E₂ F) * ‖ey ↑n‖ ^ 2;
  let e_y_n1 := 1 / (ADMM.τ E₁ E₂ F * ADMM.ρ E₁ E₂ F) * ‖ey (↑n + 1)‖ ^ 2;
  let A2_e2_n := ADMM.ρ E₁ E₂ F * ‖(OptProblem.A₂ E₁) (e₂ ↑n)‖ ^ 2;
  let A2_e2_n1 := ADMM.ρ E₁ E₂ F * ‖(OptProblem.A₂ E₁) (e₂ (↑n + 1))‖ ^ 2;
  let Ae_Ae_n := (1 - ADMM.τ E₁ E₂ F) * ADMM.ρ E₁ E₂ F * ‖(OptProblem.A₁ E₂) (e₁ ↑n) + (OptProblem.A₂ E₁) (e₂ ↑n)‖ ^ 2;
  let Ae_Ae_n1 :=
    (1 - ADMM.τ E₁ E₂ F) * ADMM.ρ E₁ E₂ F * ‖(OptProblem.A₁ E₂) (e₁ (↑n + 1)) + (OptProblem.A₂ E₁) (e₂ (↑n + 1))‖ ^ 2;
  let Ax_Ax_n1 :=
    ADMM.ρ E₁ E₂ F *
      ‖(OptProblem.A₁ E₂) (ADMM.x₁ E₂ F (↑n + 1)) + (OptProblem.A₂ E₁) (ADMM.x₂ E₁ F (↑n + 1)) - OptProblem.b E₁ E₂‖ ^
        2;
  let A_diff_x := ADMM.τ E₁ E₂ F * ADMM.ρ E₁ E₂ F * ‖(OptProblem.A₂ E₁) (ADMM.x₂ E₁ F (↑n + 1) - ADMM.x₂ E₁ F ↑n)‖ ^ 2;
  let A_diff_x' := ADMM.τ E₁ E₂ F * ADMM.ρ E₁ E₂ F * ‖(OptProblem.A₂ E₁) (ADMM.x₂ E₁ F ↑n - ADMM.x₂ E₁ F (↑n + 1))‖ ^ 2;
  let t_A_diff_x := ADMM.ρ E₁ E₂ F * ‖(OptProblem.A₂ E₁) (ADMM.x₂ E₁ F ↑n - ADMM.x₂ E₁ F (↑n + 1))‖ ^ 2;
  let t_A_diff_x' := ADMM.ρ E₁ E₂ F * ‖(OptProblem.A₂ E₁) (ADMM.x₂ E₁ F (↑n + 1) - ADMM.x₂ E₁ F ↑n)‖ ^ 2;
  0 ≤ e_y_n + A2_e2_n - e_y_n1 - A2_e2_n1 - Ae_Ae_n1 + Ae_Ae_n - Ax_Ax_n1 + t_A_diff_x - A_diff_x' - t_A_diff_x' →
    let left_sub_right := e_y_n + A2_e2_n + Ae_Ae_n - (e_y_n1 + A2_e2_n1 + Ae_Ae_n1) - (Ax_Ax_n1 + A_diff_x);
    ‖(OptProblem.A₂ E₁) (ADMM.x₂ E₁ F ↑n - ADMM.x₂ E₁ F (↑n + 1))‖ ^ 2 =
        ‖(OptProblem.A₂ E₁) (ADMM.x₂ E₁ F (↑n + 1) - ADMM.x₂ E₁ F ↑n)‖ ^ 2 →
      left_sub_right =
          e_y_n + A2_e2_n - e_y_n1 - A2_e2_n1 - Ae_Ae_n1 + Ae_Ae_n - Ax_Ax_n1 + t_A_diff_x - A_diff_x' - t_A_diff_x' →
        e_y_n + A2_e2_n - e_y_n1 - A2_e2_n1 - Ae_Ae_n1 + Ae_Ae_n - Ax_Ax_n1 + t_A_diff_x - A_diff_x' - t_A_diff_x' =
          left_sub_right := sorry

Tactic state before:
E₁ : Type u_1
E₂ : Type u_2
F : Type u_3
inst✝⁹ : NormedAddCommGroup E₁
inst✝⁸ : InnerProductSpace ℝ E₁
inst✝⁷ : FiniteDimensional ℝ E₁
inst✝⁶ : NormedAddCommGroup E₂
inst✝⁵ : InnerProductSpace ℝ E₂
inst✝⁴ : FiniteDimensional ℝ E₂
inst✝³ : NormedAddCommGroup F
inst✝² : InnerProductSpace ℝ F
inst✝¹ : FiniteDimensional ℝ F
admm : ADMM E₁ E₂ F
admm_kkt : Existance_of_kkt admm
inst✝ : Setting E₁ E₂ F admm admm_kkt
htau : 0 < ADMM.τ E₁ E₂ F ∧ ADMM.τ E₁ E₂ F ≤ 1
n : ℕ+
e_y_n : ℝ := 1 / (ADMM.τ E₁ E₂ F * ADMM.ρ E₁ E₂ F) * ‖ey ↑n‖ ^ 2
e_y_n1 : ℝ := 1 / (ADMM.τ E₁ E₂ F * ADMM.ρ E₁ E₂ F) * ‖ey (↑n + 1)‖ ^ 2
A2_e2_n : ℝ := ADMM.ρ E₁ E₂ F * ‖(OptProblem.A₂ E₁) (e₂ ↑n)‖ ^ 2
A2_e2_n1 : ℝ := ADMM.ρ E₁ E₂ F * ‖(OptProblem.A₂ E₁) (e₂ (↑n + 1))‖ ^ 2
Ae_Ae_n : ℝ := (1 - ADMM.τ E₁ E₂ F) * ADMM.ρ E₁ E₂ F * ‖(OptProblem.A₁ E₂) (e₁ ↑n) + (OptProblem.A₂ E₁) (e₂ ↑n)‖ ^ 2
Ae_Ae_n1 : ℝ :=
  (1 - ADMM.τ E₁ E₂ F) * ADMM.ρ E₁ E₂ F * ‖(OptProblem.A₁ E₂) (e₁ (↑n + 1)) + (OptProblem.A₂ E₁) (e₂ (↑n + 1))‖ ^ 2
Ax_Ax_n1 : ℝ :=
  ADMM.ρ E₁ E₂ F *
    ‖(OptProblem.A₁ E₂) (ADMM.x₁ E₂ F (↑n + 1)) + (OptProblem.A₂ E₁) (ADMM.x₂ E₁ F (↑n + 1)) - OptProblem.b E₁ E₂‖ ^ 2
t_Ax_Ax_n1 : ℝ :=
  (2 - ADMM.τ E₁ E₂ F) * ADMM.ρ E₁ E₂ F *
    ‖(OptProblem.A₁ E₂) (ADMM.x₁ E₂ F (↑n + 1)) + (OptProblem.A₂ E₁) (ADMM.x₂ E₁ F (↑n + 1)) - OptProblem.b E₁ E₂‖ ^ 2
tt_Ax_Ax_n : ℝ :=
  (1 - ADMM.τ E₁ E₂ F) * ADMM.ρ E₁ E₂ F *
    ‖(OptProblem.A₁ E₂) (ADMM.x₁ E₂ F ↑n) + (OptProblem.A₂ E₁) (ADMM.x₂ E₁ F ↑n) - OptProblem.b E₁ E₂‖ ^ 2
A_diff_x : ℝ := ADMM.τ E₁ E₂ F * ADMM.ρ E₁ E₂ F * ‖(OptProblem.A₂ E₁) (ADMM.x₂ E₁ F (↑n + 1) - ADMM.x₂ E₁ F ↑n)‖ ^ 2
A_diff_x' : ℝ := ADMM.τ E₁ E₂ F * ADMM.ρ E₁ E₂ F * ‖(OptProblem.A₂ E₁) (ADMM.x₂ E₁ F ↑n - ADMM.x₂ E₁ F (↑n + 1))‖ ^ 2
t_A_diff_x : ℝ := ADMM.ρ E₁ E₂ F * ‖(OptProblem.A₂ E₁) (ADMM.x₂ E₁ F ↑n - ADMM.x₂ E₁ F (↑n + 1))‖ ^ 2
t_A_diff_x' : ℝ := ADMM.ρ E₁ E₂ F * ‖(OptProblem.A₂ E₁) (ADMM.x₂ E₁ F (↑n + 1) - ADMM.x₂ E₁ F ↑n)‖ ^ 2
tt_A_diff_x' : ℝ :=
  (1 - ADMM.τ E₁ E₂ F) * ADMM.ρ E₁ E₂ F * ‖(OptProblem.A₂ E₁) (ADMM.x₂ E₁ F ↑n - ADMM.x₂ E₁ F (↑n + 1))‖ ^ 2
ey_diff : ℝ := 1 / (ADMM.τ E₁ E₂ F * ADMM.ρ E₁ E₂ F) * (‖ey ↑n‖ ^ 2 - ‖ey (↑n + 1)‖ ^ 2)
cond : 0 ≤ e_y_n + A2_e2_n - e_y_n1 - A2_e2_n1 - Ae_Ae_n1 + Ae_Ae_n - Ax_Ax_n1 + t_A_diff_x - A_diff_x' - t_A_diff_x'
left_sub_right : ℝ := e_y_n + A2_e2_n + Ae_Ae_n - (e_y_n1 + A2_e2_n1 + Ae_Ae_n1) - (Ax_Ax_n1 + A_diff_x)
norm_abs :
  ‖(OptProblem.A₂ E₁) (ADMM.x₂ E₁ F ↑n - ADMM.x₂ E₁ F (↑n + 1))‖ ^ 2 =
    ‖(OptProblem.A₂ E₁) (ADMM.x₂ E₁ F (↑n + 1) - ADMM.x₂ E₁ F ↑n)‖ ^ 2
equation :
  left_sub_right =
    e_y_n + A2_e2_n - e_y_n1 - A2_e2_n1 - Ae_Ae_n1 + Ae_Ae_n - Ax_Ax_n1 + t_A_diff_x - A_diff_x' - t_A_diff_x'
⊢ e_y_n + A2_e2_n - e_y_n1 - A2_e2_n1 - Ae_Ae_n1 + Ae_Ae_n - Ax_Ax_n1 + t_A_diff_x - A_diff_x' - t_A_diff_x' =
    left_sub_right

Tactic:
rw [equation]

Tactic state after: