-- Module: Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic
Goal:
K : Type u_1
inst : Field K
inst_1 : NumberField K
x : (K →+* ℂ) → ℂ
hx : ∀ (φ : K →+* ℂ), (starRingEnd ℂ : (a : ℂ) → ℂ) (x φ) = x (ComplexEmbedding.conjugate φ)
c : index K
inl :
  ∀ (w : { w : InfinitePlace K // w.IsReal }),
    (↑((((Basis.repr (stdBasis K) :
                    (a : mixedSpace K) →
                      { w : InfinitePlace K // w.IsReal } ⊕ { w : InfinitePlace K // w.IsComplex } × Fin 2 →₀ ℝ)
                  (fun (w : { w : InfinitePlace K // w.IsReal }) ↦ (x (↑w : InfinitePlace K).embedding).re,
                    fun (w : { w : InfinitePlace K // w.IsComplex }) ↦ x (↑w : InfinitePlace K).embedding) :
                { w : InfinitePlace K // w.IsReal } ⊕ { w : InfinitePlace K // w.IsComplex } × Fin 2 →₀ ℝ) :
              (a : { w : InfinitePlace K // w.IsReal } ⊕ { w : InfinitePlace K // w.IsComplex } × Fin 2) → ℝ)
            (Sum.inl w)) :
        ℂ) =
      HAdd.hAdd (α := ℂ)
        (∑ x_1 : { w : InfinitePlace K // w.IsReal },
          fromBlocks (m := { w : InfinitePlace K // w.IsComplex } × Fin 2) (o :=
              { w : InfinitePlace K // w.IsComplex } × Fin 2) 1 0 0
              (submatrix
                (blockDiagonal fun (x : { w : InfinitePlace K // w.IsComplex }) ↦ !![2⁻¹, 2⁻¹; 2⁻¹ * -I, 2⁻¹ * I])
                Prod.swap Prod.swap)
              (Sum.inl w) (Sum.inl x_1) *
            x (↑x_1 : InfinitePlace K).embedding)
        (∑ x_1 : { w : InfinitePlace K // w.IsComplex },
          (fromBlocks (l := { w : InfinitePlace K // w.IsReal }) (m := { w : InfinitePlace K // w.IsComplex } × Fin 2)
                (o := { w : InfinitePlace K // w.IsComplex } × Fin 2) 1 0 0
                (submatrix
                  (blockDiagonal fun (x : { w : InfinitePlace K // w.IsComplex }) ↦ !![2⁻¹, 2⁻¹; 2⁻¹ * -I, 2⁻¹ * I])
                  Prod.swap Prod.swap)
                (Sum.inl w) (Sum.inr (x_1, 0)) *
              x (↑x_1 : InfinitePlace K).embedding +
            fromBlocks (l := { w : InfinitePlace K // w.IsReal }) (m := { w : InfinitePlace K // w.IsComplex } × Fin 2)
                (o := { w : InfinitePlace K // w.IsComplex } × Fin 2) 1 0 0
                (submatrix
                  (blockDiagonal fun (x : { w : InfinitePlace K // w.IsComplex }) ↦ !![2⁻¹, 2⁻¹; 2⁻¹ * -I, 2⁻¹ * I])
                  Prod.swap Prod.swap)
                (Sum.inl w) (Sum.inr (x_1, 1)) *
              x (ComplexEmbedding.conjugate (↑x_1 : InfinitePlace K).embedding)))
inr :
  ∀ (c : { w : InfinitePlace K // w.IsComplex } × Fin 2),
    (↑((((Basis.repr (stdBasis K) :
                    (a : mixedSpace K) →
                      { w : InfinitePlace K // w.IsReal } ⊕ { w : InfinitePlace K // w.IsComplex } × Fin 2 →₀ ℝ)
                  (fun (w : { w : InfinitePlace K // w.IsReal }) ↦ (x (↑w : InfinitePlace K).embedding).re,
                    fun (w : { w : InfinitePlace K // w.IsComplex }) ↦ x (↑w : InfinitePlace K).embedding) :
                { w : InfinitePlace K // w.IsReal } ⊕ { w : InfinitePlace K // w.IsComplex } × Fin 2 →₀ ℝ) :
              (a : { w : InfinitePlace K // w.IsReal } ⊕ { w : InfinitePlace K // w.IsComplex } × Fin 2) → ℝ)
            (Sum.inr c)) :
        ℂ) =
      HAdd.hAdd (α := ℂ)
        (∑ x_1 : { w : InfinitePlace K // w.IsReal },
          fromBlocks (m := { w : InfinitePlace K // w.IsComplex } × Fin 2) (n := { w : InfinitePlace K // w.IsReal }) 1
              0 0
              (submatrix
                (blockDiagonal fun (x : { w : InfinitePlace K // w.IsComplex }) ↦ !![2⁻¹, 2⁻¹; 2⁻¹ * -I, 2⁻¹ * I])
                Prod.swap Prod.swap)
              (Sum.inr c) (Sum.inl x_1) *
            x (↑x_1 : InfinitePlace K).embedding)
        (∑ x_1 : { w : InfinitePlace K // w.IsComplex },
          (fromBlocks (l := { w : InfinitePlace K // w.IsReal }) (m := { w : InfinitePlace K // w.IsComplex } × Fin 2)
                (n := { w : InfinitePlace K // w.IsReal }) 1 0 0
                (submatrix
                  (blockDiagonal fun (x : { w : InfinitePlace K // w.IsComplex }) ↦ !![2⁻¹, 2⁻¹; 2⁻¹ * -I, 2⁻¹ * I])
                  Prod.swap Prod.swap)
                (Sum.inr c) (Sum.inr (x_1, 0)) *
              x (↑x_1 : InfinitePlace K).embedding +
            fromBlocks (l := { w : InfinitePlace K // w.IsReal }) (m := { w : InfinitePlace K // w.IsComplex } × Fin 2)
                (n := { w : InfinitePlace K // w.IsReal }) 1 0 0
                (submatrix
                  (blockDiagonal fun (x : { w : InfinitePlace K // w.IsComplex }) ↦ !![2⁻¹, 2⁻¹; 2⁻¹ * -I, 2⁻¹ * I])
                  Prod.swap Prod.swap)
                (Sum.inr c) (Sum.inr (x_1, 1)) *
              x (ComplexEmbedding.conjugate (↑x_1 : InfinitePlace K).embedding)))
⊢ (↑((((Basis.repr (stdBasis K) :
                  (a : mixedSpace K) →
                    { w : InfinitePlace K // w.IsReal } ⊕ { w : InfinitePlace K // w.IsComplex } × Fin 2 →₀ ℝ)
                (fun (w : { w : InfinitePlace K // w.IsReal }) ↦ (x (↑w : InfinitePlace K).embedding).re,
                  fun (w : { w : InfinitePlace K // w.IsComplex }) ↦ x (↑w : InfinitePlace K).embedding) :
              { w : InfinitePlace K // w.IsReal } ⊕ { w : InfinitePlace K // w.IsComplex } × Fin 2 →₀ ℝ) :
            (a : { w : InfinitePlace K // w.IsReal } ⊕ { w : InfinitePlace K // w.IsComplex } × Fin 2) → ℝ)
          c) :
      ℂ) =
    HAdd.hAdd (α := ℂ)
      (∑ x_1 : { w : InfinitePlace K // w.IsReal },
        fromBlocks (m := { w : InfinitePlace K // w.IsComplex } × Fin 2) 1 0 0
            (submatrix
              (blockDiagonal fun (x : { w : InfinitePlace K // w.IsComplex }) ↦ !![2⁻¹, 2⁻¹; 2⁻¹ * -I, 2⁻¹ * I])
              Prod.swap Prod.swap)
            c (Sum.inl x_1) *
          x (↑x_1 : InfinitePlace K).embedding)
      (∑ x_1 : { w : InfinitePlace K // w.IsComplex },
        (fromBlocks (l := { w : InfinitePlace K // w.IsReal }) (m := { w : InfinitePlace K // w.IsComplex } × Fin 2) 1 0
              0
              (submatrix
                (blockDiagonal fun (x : { w : InfinitePlace K // w.IsComplex }) ↦ !![2⁻¹, 2⁻¹; 2⁻¹ * -I, 2⁻¹ * I])
                Prod.swap Prod.swap)
              c (Sum.inr (x_1, 0)) *
            x (↑x_1 : InfinitePlace K).embedding +
          fromBlocks (l := { w : InfinitePlace K // w.IsReal }) (m := { w : InfinitePlace K // w.IsComplex } × Fin 2) 1
              0 0
              (submatrix
                (blockDiagonal fun (x : { w : InfinitePlace K // w.IsComplex }) ↦ !![2⁻¹, 2⁻¹; 2⁻¹ * -I, 2⁻¹ * I])
                Prod.swap Prod.swap)
              c (Sum.inr (x_1, 1)) *
            x (ComplexEmbedding.conjugate (↑x_1 : InfinitePlace K).embedding)))

Tactic:
cases c with
  | inl w =>
      simp_rw [stdBasis_apply_isReal, fromBlocks_apply₁₁, fromBlocks_apply₁₂,
        one_apply, Matrix.zero_apply, ite_mul, one_mul, zero_mul, sum_ite_eq, mem_univ, ite_true,
        add_zero, sum_const_zero, add_zero, ← conj_eq_iff_re, hx (embedding w.val),
        conjugate_embedding_eq_of_isReal w.prop]
  | inr c =>
    rcases c with ⟨w, j⟩
    fin_cases j
    · simp only [Fin.zero_eta, Fin.isValue, stdBasis_apply_isComplex_fst, re_eq_add_conj,
        mul_neg, fromBlocks_apply₂₁, zero_apply, zero_mul, sum_const_zero, fromBlocks_apply₂₂,
        submatrix_apply, Prod.swap_prod_mk, blockDiagonal_apply, of_apply, cons_val', cons_val_zero,
        empty_val', cons_val_fin_one, ite_mul, cons_val_one, sum_add_distrib, sum_ite_eq,
        mem_univ, ↓reduceIte, ← hx (embedding w), zero_add]
      ring
    · simp only [Fin.mk_one, Fin.isValue, stdBasis_apply_isComplex_snd, im_eq_sub_conj,
        mul_neg, fromBlocks_apply₂₁, zero_apply, zero_mul, sum_const_zero, fromBlocks_apply₂₂,
        submatrix_apply, Prod.swap_prod_mk, blockDiagonal_apply, of_apply, cons_val', cons_val_zero,
        empty_val', cons_val_fin_one, cons_val_one, ite_mul, neg_mul,
        sum_add_distrib, sum_ite_eq, mem_univ, ↓reduceIte, ← hx (embedding w), zero_add]
      ring_nf; simp [field]

Premises used: Matrix.fromBlocks_apply₁₁, Finset.mem_univ, Complex.re_eq_add_conj, Fin.mk_one, Matrix.fromBlocks_apply₁₂, Matrix.fromBlocks_apply₂₂, Matrix.zero_apply, Matrix.one_apply, Finset.sum_add_distrib, NumberField.mixedEmbedding.stdBasis_apply_isComplex_snd, MulZeroClass.zero_mul, Matrix.cons_val_one, Matrix.cons_val_zero, Matrix.empty_val', Prod.swap_prod_mk, Matrix.cons_val_fin_one, ite_true, Matrix.fromBlocks_apply₂₁, Matrix.of_apply, Complex.conj_eq_iff_re, zero_add, Finset.sum_const_zero, NumberField.mixedEmbedding.stdBasis_apply_isComplex_fst, Fin.zero_eta, Fin.isValue, ite_mul, NumberField.mixedEmbedding.stdBasis_apply_isReal, Complex.im_eq_sub_conj, reduceIte, neg_mul, Matrix.submatrix_apply, add_zero, Matrix.blockDiagonal_apply, Finset.sum_ite_eq, one_mul, mul_neg, Matrix.cons_val'