l3lab/ntp-mathlib huggingface dataset:
/-- The isometry between a weighted sum of squares with weights `u` on the
(non-zero) real numbers and the weighted sum of squares with weights `sign ∘ u`. -/
noncomputable def isometryEquivSignWeightedSumSquares [DecidableEq ι] (w : ι → ℝ) :
    IsometryEquiv (weightedSumSquares ℝ w) (weightedSumSquares ℝ (Real.sign ∘ w)) := by
  let u i := if h : w i = 0 then (1 : ℝˣ) else Units.mk0 (w i) h
  have hu' : ∀ i : ι, (Real.sign (u i) * u i) ^ (-(1 / 2 : ℝ)) ≠ 0 := by
    intro i
    refine' (ne_of_lt (Real.rpow_pos_of_pos (sign_mul_pos_of_ne_zero _ <| Units.ne_zero _) _)).symm
  convert
    (weightedSumSquares ℝ w).isometryEquivBasisRepr
      ((Pi.basisFun ℝ ι).unitsSMul fun i => (isUnit_iff_ne_zero.2 <| hu' i).unit)
  ext1 v
  rw [basisRepr_apply, weightedSumSquares_apply, weightedSumSquares_apply]
  refine' sum_congr rfl fun j hj => _
  

Proof state:
case h.e'_10.H
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
w : ι → ℝ
u : ι → ℝˣ := fun i => if h : w i = 0 then 1 else Units.mk0 (w i) h
hu' : ∀ (i : ι), (sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)) ≠ 0
v : ι → ℝ
j : ι
hj : j ∈ univ
⊢ (sign ∘ w) j • (v j * v j) =
    w j •
      (Finset.sum univ
          (fun i =>
            v i •
              (Basis.unitsSMul (Pi.basisFun ℝ ι) fun i =>
                  IsUnit.unit (_ : IsUnit ((sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)))))
                i)
          j *
        Finset.sum univ
          (fun i =>
            v i •
              (Basis.unitsSMul (Pi.basisFun ℝ ι) fun i =>
                  IsUnit.unit (_ : IsUnit ((sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)))))
                i)
          j)

Next tactic:
have hsum :
    (∑ i : ι, v i • ((isUnit_iff_ne_zero.2 <| hu' i).unit : ℝ) • (Pi.basisFun ℝ ι) i) j =
      v j • (Real.sign (u j) * u j) ^ (-(1 / 2 : ℝ)) := by
    rw [Finset.sum_apply, sum_eq_single j, Pi.basisFun_apply, IsUnit.unit_spec,
      LinearMap.stdBasis_apply, Pi.smul_apply, Pi.smul_apply, Function.update_same, smul_eq_mul,
      smul_eq_mul, smul_eq_mul, mul_one]
    intro i _ hij
    rw [Pi.basisFun_apply, LinearMap.stdBasis_apply, Pi.smul_apply, Pi.smul_apply,
      Function.update_noteq hij.symm, Pi.zero_apply, smul_eq_mul, smul_eq_mul,
      mul_zero, mul_zero]
    intro hj'; exact False.elim (hj' hj)
/-- The isometry between a weighted sum of squares with weights `u` on the
(non-zero) real numbers and the weighted sum of squares with weights `sign ∘ u`. -/
noncomputable def isometryEquivSignWeightedSumSquares [DecidableEq ι] (w : ι → ℝ) :
    IsometryEquiv (weightedSumSquares ℝ w) (weightedSumSquares ℝ (Real.sign ∘ w)) := by
  let u i := if h : w i = 0 then (1 : ℝˣ) else Units.mk0 (w i) h
  have hu' : ∀ i : ι, (Real.sign (u i) * u i) ^ (-(1 / 2 : ℝ)) ≠ 0 := by
    intro i
    refine' (ne_of_lt (Real.rpow_pos_of_pos (sign_mul_pos_of_ne_zero _ <| Units.ne_zero _) _)).symm
  convert
    (weightedSumSquares ℝ w).isometryEquivBasisRepr
      ((Pi.basisFun ℝ ι).unitsSMul fun i => (isUnit_iff_ne_zero.2 <| hu' i).unit)
  ext1 v
  rw [basisRepr_apply, weightedSumSquares_apply, weightedSumSquares_apply]
  refine' sum_congr rfl fun j hj => _
  have hsum :
    (∑ i : ι, v i • ((isUnit_iff_ne_zero.2 <| hu' i).unit : ℝ) • (Pi.basisFun ℝ ι) i) j =
      v j • (Real.sign (u j) * u j) ^ (-(1 / 2 : ℝ)) := by
    

Proof state:
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
w : ι → ℝ
u : ι → ℝˣ := fun i => if h : w i = 0 then 1 else Units.mk0 (w i) h
hu' : ∀ (i : ι), (sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)) ≠ 0
v : ι → ℝ
j : ι
hj : j ∈ univ
⊢ Finset.sum univ
      (fun i => v i • ↑(IsUnit.unit (_ : IsUnit ((sign ↑(u i) * ↑(u i)) ^ (-(1 / 2))))) • (Pi.basisFun ℝ ι) i) j =
    v j • (sign ↑(u j) * ↑(u j)) ^ (-(1 / 2))

Next tactic:
rw [Finset.sum_apply, sum_eq_single j, Pi.basisFun_apply, IsUnit.unit_spec,
      LinearMap.stdBasis_apply, Pi.smul_apply, Pi.smul_apply, Function.update_same, smul_eq_mul,
      smul_eq_mul, smul_eq_mul, mul_one]
/-- The isometry between a weighted sum of squares with weights `u` on the
(non-zero) real numbers and the weighted sum of squares with weights `sign ∘ u`. -/
noncomputable def isometryEquivSignWeightedSumSquares [DecidableEq ι] (w : ι → ℝ) :
    IsometryEquiv (weightedSumSquares ℝ w) (weightedSumSquares ℝ (Real.sign ∘ w)) := by
  let u i := if h : w i = 0 then (1 : ℝˣ) else Units.mk0 (w i) h
  have hu' : ∀ i : ι, (Real.sign (u i) * u i) ^ (-(1 / 2 : ℝ)) ≠ 0 := by
    intro i
    refine' (ne_of_lt (Real.rpow_pos_of_pos (sign_mul_pos_of_ne_zero _ <| Units.ne_zero _) _)).symm
  convert
    (weightedSumSquares ℝ w).isometryEquivBasisRepr
      ((Pi.basisFun ℝ ι).unitsSMul fun i => (isUnit_iff_ne_zero.2 <| hu' i).unit)
  ext1 v
  rw [basisRepr_apply, weightedSumSquares_apply, weightedSumSquares_apply]
  refine' sum_congr rfl fun j hj => _
  have hsum :
    (∑ i : ι, v i • ((isUnit_iff_ne_zero.2 <| hu' i).unit : ℝ) • (Pi.basisFun ℝ ι) i) j =
      v j • (Real.sign (u j) * u j) ^ (-(1 / 2 : ℝ)) := by
    rw [Finset.sum_apply, sum_eq_single j, Pi.basisFun_apply, IsUnit.unit_spec,
      LinearMap.stdBasis_apply, Pi.smul_apply, Pi.smul_apply, Function.update_same, smul_eq_mul,
      smul_eq_mul, smul_eq_mul, mul_one]
    

Proof state:
case h₀
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
w : ι → ℝ
u : ι → ℝˣ := fun i => if h : w i = 0 then 1 else Units.mk0 (w i) h
hu' : ∀ (i : ι), (sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)) ≠ 0
v : ι → ℝ
j : ι
hj : j ∈ univ
⊢ ∀ b ∈ univ,
    b ≠ j → (v b • ↑(IsUnit.unit (_ : IsUnit ((sign ↑(u b) * ↑(u b)) ^ (-(1 / 2))))) • (Pi.basisFun ℝ ι) b) j = 0
case h₁
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
w : ι → ℝ
u : ι → ℝˣ := fun i => if h : w i = 0 then 1 else Units.mk0 (w i) h
hu' : ∀ (i : ι), (sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)) ≠ 0
v : ι → ℝ
j : ι
hj : j ∈ univ
⊢ j ∉ univ → (v j • ↑(IsUnit.unit (_ : IsUnit ((sign ↑(u j) * ↑(u j)) ^ (-(1 / 2))))) • (Pi.basisFun ℝ ι) j) j = 0

Next tactic:
intro i _ hij
/-- The isometry between a weighted sum of squares with weights `u` on the
(non-zero) real numbers and the weighted sum of squares with weights `sign ∘ u`. -/
noncomputable def isometryEquivSignWeightedSumSquares [DecidableEq ι] (w : ι → ℝ) :
    IsometryEquiv (weightedSumSquares ℝ w) (weightedSumSquares ℝ (Real.sign ∘ w)) := by
  let u i := if h : w i = 0 then (1 : ℝˣ) else Units.mk0 (w i) h
  have hu' : ∀ i : ι, (Real.sign (u i) * u i) ^ (-(1 / 2 : ℝ)) ≠ 0 := by
    intro i
    refine' (ne_of_lt (Real.rpow_pos_of_pos (sign_mul_pos_of_ne_zero _ <| Units.ne_zero _) _)).symm
  convert
    (weightedSumSquares ℝ w).isometryEquivBasisRepr
      ((Pi.basisFun ℝ ι).unitsSMul fun i => (isUnit_iff_ne_zero.2 <| hu' i).unit)
  ext1 v
  rw [basisRepr_apply, weightedSumSquares_apply, weightedSumSquares_apply]
  refine' sum_congr rfl fun j hj => _
  have hsum :
    (∑ i : ι, v i • ((isUnit_iff_ne_zero.2 <| hu' i).unit : ℝ) • (Pi.basisFun ℝ ι) i) j =
      v j • (Real.sign (u j) * u j) ^ (-(1 / 2 : ℝ)) := by
    rw [Finset.sum_apply, sum_eq_single j, Pi.basisFun_apply, IsUnit.unit_spec,
      LinearMap.stdBasis_apply, Pi.smul_apply, Pi.smul_apply, Function.update_same, smul_eq_mul,
      smul_eq_mul, smul_eq_mul, mul_one]
    intro i _ hij
    

Proof state:
case h₀
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
w : ι → ℝ
u : ι → ℝˣ := fun i => if h : w i = 0 then 1 else Units.mk0 (w i) h
hu' : ∀ (i : ι), (sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)) ≠ 0
v : ι → ℝ
j : ι
hj : j ∈ univ
i : ι
a✝ : i ∈ univ
hij : i ≠ j
⊢ (v i • ↑(IsUnit.unit (_ : IsUnit ((sign ↑(u i) * ↑(u i)) ^ (-(1 / 2))))) • (Pi.basisFun ℝ ι) i) j = 0
case h₁
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
w : ι → ℝ
u : ι → ℝˣ := fun i => if h : w i = 0 then 1 else Units.mk0 (w i) h
hu' : ∀ (i : ι), (sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)) ≠ 0
v : ι → ℝ
j : ι
hj : j ∈ univ
⊢ j ∉ univ → (v j • ↑(IsUnit.unit (_ : IsUnit ((sign ↑(u j) * ↑(u j)) ^ (-(1 / 2))))) • (Pi.basisFun ℝ ι) j) j = 0

Next tactic:
rw [Pi.basisFun_apply, LinearMap.stdBasis_apply, Pi.smul_apply, Pi.smul_apply,
      Function.update_noteq hij.symm, Pi.zero_apply, smul_eq_mul, smul_eq_mul,
      mul_zero, mul_zero]
/-- The isometry between a weighted sum of squares with weights `u` on the
(non-zero) real numbers and the weighted sum of squares with weights `sign ∘ u`. -/
noncomputable def isometryEquivSignWeightedSumSquares [DecidableEq ι] (w : ι → ℝ) :
    IsometryEquiv (weightedSumSquares ℝ w) (weightedSumSquares ℝ (Real.sign ∘ w)) := by
  let u i := if h : w i = 0 then (1 : ℝˣ) else Units.mk0 (w i) h
  have hu' : ∀ i : ι, (Real.sign (u i) * u i) ^ (-(1 / 2 : ℝ)) ≠ 0 := by
    intro i
    refine' (ne_of_lt (Real.rpow_pos_of_pos (sign_mul_pos_of_ne_zero _ <| Units.ne_zero _) _)).symm
  convert
    (weightedSumSquares ℝ w).isometryEquivBasisRepr
      ((Pi.basisFun ℝ ι).unitsSMul fun i => (isUnit_iff_ne_zero.2 <| hu' i).unit)
  ext1 v
  rw [basisRepr_apply, weightedSumSquares_apply, weightedSumSquares_apply]
  refine' sum_congr rfl fun j hj => _
  have hsum :
    (∑ i : ι, v i • ((isUnit_iff_ne_zero.2 <| hu' i).unit : ℝ) • (Pi.basisFun ℝ ι) i) j =
      v j • (Real.sign (u j) * u j) ^ (-(1 / 2 : ℝ)) := by
    rw [Finset.sum_apply, sum_eq_single j, Pi.basisFun_apply, IsUnit.unit_spec,
      LinearMap.stdBasis_apply, Pi.smul_apply, Pi.smul_apply, Function.update_same, smul_eq_mul,
      smul_eq_mul, smul_eq_mul, mul_one]
    intro i _ hij
    rw [Pi.basisFun_apply, LinearMap.stdBasis_apply, Pi.smul_apply, Pi.smul_apply,
      Function.update_noteq hij.symm, Pi.zero_apply, smul_eq_mul, smul_eq_mul,
      mul_zero, mul_zero]
    

Proof state:
case h₁
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
w : ι → ℝ
u : ι → ℝˣ := fun i => if h : w i = 0 then 1 else Units.mk0 (w i) h
hu' : ∀ (i : ι), (sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)) ≠ 0
v : ι → ℝ
j : ι
hj : j ∈ univ
⊢ j ∉ univ → (v j • ↑(IsUnit.unit (_ : IsUnit ((sign ↑(u j) * ↑(u j)) ^ (-(1 / 2))))) • (Pi.basisFun ℝ ι) j) j = 0

Next tactic:
intro hj'
/-- The isometry between a weighted sum of squares with weights `u` on the
(non-zero) real numbers and the weighted sum of squares with weights `sign ∘ u`. -/
noncomputable def isometryEquivSignWeightedSumSquares [DecidableEq ι] (w : ι → ℝ) :
    IsometryEquiv (weightedSumSquares ℝ w) (weightedSumSquares ℝ (Real.sign ∘ w)) := by
  let u i := if h : w i = 0 then (1 : ℝˣ) else Units.mk0 (w i) h
  have hu' : ∀ i : ι, (Real.sign (u i) * u i) ^ (-(1 / 2 : ℝ)) ≠ 0 := by
    intro i
    refine' (ne_of_lt (Real.rpow_pos_of_pos (sign_mul_pos_of_ne_zero _ <| Units.ne_zero _) _)).symm
  convert
    (weightedSumSquares ℝ w).isometryEquivBasisRepr
      ((Pi.basisFun ℝ ι).unitsSMul fun i => (isUnit_iff_ne_zero.2 <| hu' i).unit)
  ext1 v
  rw [basisRepr_apply, weightedSumSquares_apply, weightedSumSquares_apply]
  refine' sum_congr rfl fun j hj => _
  have hsum :
    (∑ i : ι, v i • ((isUnit_iff_ne_zero.2 <| hu' i).unit : ℝ) • (Pi.basisFun ℝ ι) i) j =
      v j • (Real.sign (u j) * u j) ^ (-(1 / 2 : ℝ)) := by
    rw [Finset.sum_apply, sum_eq_single j, Pi.basisFun_apply, IsUnit.unit_spec,
      LinearMap.stdBasis_apply, Pi.smul_apply, Pi.smul_apply, Function.update_same, smul_eq_mul,
      smul_eq_mul, smul_eq_mul, mul_one]
    intro i _ hij
    rw [Pi.basisFun_apply, LinearMap.stdBasis_apply, Pi.smul_apply, Pi.smul_apply,
      Function.update_noteq hij.symm, Pi.zero_apply, smul_eq_mul, smul_eq_mul,
      mul_zero, mul_zero]
    intro hj'; 

Proof state:
case h₁
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
w : ι → ℝ
u : ι → ℝˣ := fun i => if h : w i = 0 then 1 else Units.mk0 (w i) h
hu' : ∀ (i : ι), (sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)) ≠ 0
v : ι → ℝ
j : ι
hj : j ∈ univ
hj' : j ∉ univ
⊢ (v j • ↑(IsUnit.unit (_ : IsUnit ((sign ↑(u j) * ↑(u j)) ^ (-(1 / 2))))) • (Pi.basisFun ℝ ι) j) j = 0

Next tactic:
exact False.elim (hj' hj)
/-- The isometry between a weighted sum of squares with weights `u` on the
(non-zero) real numbers and the weighted sum of squares with weights `sign ∘ u`. -/
noncomputable def isometryEquivSignWeightedSumSquares [DecidableEq ι] (w : ι → ℝ) :
    IsometryEquiv (weightedSumSquares ℝ w) (weightedSumSquares ℝ (Real.sign ∘ w)) := by
  let u i := if h : w i = 0 then (1 : ℝˣ) else Units.mk0 (w i) h
  have hu' : ∀ i : ι, (Real.sign (u i) * u i) ^ (-(1 / 2 : ℝ)) ≠ 0 := by
    intro i
    refine' (ne_of_lt (Real.rpow_pos_of_pos (sign_mul_pos_of_ne_zero _ <| Units.ne_zero _) _)).symm
  convert
    (weightedSumSquares ℝ w).isometryEquivBasisRepr
      ((Pi.basisFun ℝ ι).unitsSMul fun i => (isUnit_iff_ne_zero.2 <| hu' i).unit)
  ext1 v
  rw [basisRepr_apply, weightedSumSquares_apply, weightedSumSquares_apply]
  refine' sum_congr rfl fun j hj => _
  have hsum :
    (∑ i : ι, v i • ((isUnit_iff_ne_zero.2 <| hu' i).unit : ℝ) • (Pi.basisFun ℝ ι) i) j =
      v j • (Real.sign (u j) * u j) ^ (-(1 / 2 : ℝ)) := by
    rw [Finset.sum_apply, sum_eq_single j, Pi.basisFun_apply, IsUnit.unit_spec,
      LinearMap.stdBasis_apply, Pi.smul_apply, Pi.smul_apply, Function.update_same, smul_eq_mul,
      smul_eq_mul, smul_eq_mul, mul_one]
    intro i _ hij
    rw [Pi.basisFun_apply, LinearMap.stdBasis_apply, Pi.smul_apply, Pi.smul_apply,
      Function.update_noteq hij.symm, Pi.zero_apply, smul_eq_mul, smul_eq_mul,
      mul_zero, mul_zero]
    intro hj'; exact False.elim (hj' hj)
  

Proof state:
case h.e'_10.H
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
w : ι → ℝ
u : ι → ℝˣ := fun i => if h : w i = 0 then 1 else Units.mk0 (w i) h
hu' : ∀ (i : ι), (sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)) ≠ 0
v : ι → ℝ
j : ι
hj : j ∈ univ
hsum :
  Finset.sum univ
      (fun i => v i • ↑(IsUnit.unit (_ : IsUnit ((sign ↑(u i) * ↑(u i)) ^ (-(1 / 2))))) • (Pi.basisFun ℝ ι) i) j =
    v j • (sign ↑(u j) * ↑(u j)) ^ (-(1 / 2))
⊢ (sign ∘ w) j • (v j * v j) =
    w j •
      (Finset.sum univ
          (fun i =>
            v i •
              (Basis.unitsSMul (Pi.basisFun ℝ ι) fun i =>
                  IsUnit.unit (_ : IsUnit ((sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)))))
                i)
          j *
        Finset.sum univ
          (fun i =>
            v i •
              (Basis.unitsSMul (Pi.basisFun ℝ ι) fun i =>
                  IsUnit.unit (_ : IsUnit ((sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)))))
                i)
          j)

Next tactic:
simp_rw [Basis.unitsSMul_apply]
/-- The isometry between a weighted sum of squares with weights `u` on the
(non-zero) real numbers and the weighted sum of squares with weights `sign ∘ u`. -/
noncomputable def isometryEquivSignWeightedSumSquares [DecidableEq ι] (w : ι → ℝ) :
    IsometryEquiv (weightedSumSquares ℝ w) (weightedSumSquares ℝ (Real.sign ∘ w)) := by
  let u i := if h : w i = 0 then (1 : ℝˣ) else Units.mk0 (w i) h
  have hu' : ∀ i : ι, (Real.sign (u i) * u i) ^ (-(1 / 2 : ℝ)) ≠ 0 := by
    intro i
    refine' (ne_of_lt (Real.rpow_pos_of_pos (sign_mul_pos_of_ne_zero _ <| Units.ne_zero _) _)).symm
  convert
    (weightedSumSquares ℝ w).isometryEquivBasisRepr
      ((Pi.basisFun ℝ ι).unitsSMul fun i => (isUnit_iff_ne_zero.2 <| hu' i).unit)
  ext1 v
  rw [basisRepr_apply, weightedSumSquares_apply, weightedSumSquares_apply]
  refine' sum_congr rfl fun j hj => _
  have hsum :
    (∑ i : ι, v i • ((isUnit_iff_ne_zero.2 <| hu' i).unit : ℝ) • (Pi.basisFun ℝ ι) i) j =
      v j • (Real.sign (u j) * u j) ^ (-(1 / 2 : ℝ)) := by
    rw [Finset.sum_apply, sum_eq_single j, Pi.basisFun_apply, IsUnit.unit_spec,
      LinearMap.stdBasis_apply, Pi.smul_apply, Pi.smul_apply, Function.update_same, smul_eq_mul,
      smul_eq_mul, smul_eq_mul, mul_one]
    intro i _ hij
    rw [Pi.basisFun_apply, LinearMap.stdBasis_apply, Pi.smul_apply, Pi.smul_apply,
      Function.update_noteq hij.symm, Pi.zero_apply, smul_eq_mul, smul_eq_mul,
      mul_zero, mul_zero]
    intro hj'; exact False.elim (hj' hj)
  simp_rw [Basis.unitsSMul_apply]
  

Proof state:
case h.e'_10.H
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
w : ι → ℝ
u : ι → ℝˣ := fun i => if h : w i = 0 then 1 else Units.mk0 (w i) h
hu' : ∀ (i : ι), (sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)) ≠ 0
v : ι → ℝ
j : ι
hj : j ∈ univ
hsum :
  Finset.sum univ
      (fun i => v i • ↑(IsUnit.unit (_ : IsUnit ((sign ↑(u i) * ↑(u i)) ^ (-(1 / 2))))) • (Pi.basisFun ℝ ι) i) j =
    v j • (sign ↑(u j) * ↑(u j)) ^ (-(1 / 2))
⊢ (sign ∘ w) j • (v j * v j) =
    w j •
      (Finset.sum univ
          (fun x => v x • IsUnit.unit (_ : IsUnit ((sign ↑(u x) * ↑(u x)) ^ (-(1 / 2)))) • (Pi.basisFun ℝ ι) x) j *
        Finset.sum univ
          (fun x => v x • IsUnit.unit (_ : IsUnit ((sign ↑(u x) * ↑(u x)) ^ (-(1 / 2)))) • (Pi.basisFun ℝ ι) x) j)

Next tactic:
erw [hsum]
/-- The isometry between a weighted sum of squares with weights `u` on the
(non-zero) real numbers and the weighted sum of squares with weights `sign ∘ u`. -/
noncomputable def isometryEquivSignWeightedSumSquares [DecidableEq ι] (w : ι → ℝ) :
    IsometryEquiv (weightedSumSquares ℝ w) (weightedSumSquares ℝ (Real.sign ∘ w)) := by
  let u i := if h : w i = 0 then (1 : ℝˣ) else Units.mk0 (w i) h
  have hu' : ∀ i : ι, (Real.sign (u i) * u i) ^ (-(1 / 2 : ℝ)) ≠ 0 := by
    intro i
    refine' (ne_of_lt (Real.rpow_pos_of_pos (sign_mul_pos_of_ne_zero _ <| Units.ne_zero _) _)).symm
  convert
    (weightedSumSquares ℝ w).isometryEquivBasisRepr
      ((Pi.basisFun ℝ ι).unitsSMul fun i => (isUnit_iff_ne_zero.2 <| hu' i).unit)
  ext1 v
  rw [basisRepr_apply, weightedSumSquares_apply, weightedSumSquares_apply]
  refine' sum_congr rfl fun j hj => _
  have hsum :
    (∑ i : ι, v i • ((isUnit_iff_ne_zero.2 <| hu' i).unit : ℝ) • (Pi.basisFun ℝ ι) i) j =
      v j • (Real.sign (u j) * u j) ^ (-(1 / 2 : ℝ)) := by
    rw [Finset.sum_apply, sum_eq_single j, Pi.basisFun_apply, IsUnit.unit_spec,
      LinearMap.stdBasis_apply, Pi.smul_apply, Pi.smul_apply, Function.update_same, smul_eq_mul,
      smul_eq_mul, smul_eq_mul, mul_one]
    intro i _ hij
    rw [Pi.basisFun_apply, LinearMap.stdBasis_apply, Pi.smul_apply, Pi.smul_apply,
      Function.update_noteq hij.symm, Pi.zero_apply, smul_eq_mul, smul_eq_mul,
      mul_zero, mul_zero]
    intro hj'; exact False.elim (hj' hj)
  simp_rw [Basis.unitsSMul_apply]
  erw [hsum]
  

Proof state:
case h.e'_10.H
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
w : ι → ℝ
u : ι → ℝˣ := fun i => if h : w i = 0 then 1 else Units.mk0 (w i) h
hu' : ∀ (i : ι), (sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)) ≠ 0
v : ι → ℝ
j : ι
hj : j ∈ univ
hsum :
  Finset.sum univ
      (fun i => v i • ↑(IsUnit.unit (_ : IsUnit ((sign ↑(u i) * ↑(u i)) ^ (-(1 / 2))))) • (Pi.basisFun ℝ ι) i) j =
    v j • (sign ↑(u j) * ↑(u j)) ^ (-(1 / 2))
⊢ (sign ∘ w) j • (v j * v j) =
    w j • (v j • (sign ↑(u j) * ↑(u j)) ^ (-(1 / 2)) * v j • (sign ↑(u j) * ↑(u j)) ^ (-(1 / 2)))

Next tactic:
simp only [Function.comp, smul_eq_mul]
/-- The isometry between a weighted sum of squares with weights `u` on the
(non-zero) real numbers and the weighted sum of squares with weights `sign ∘ u`. -/
noncomputable def isometryEquivSignWeightedSumSquares [DecidableEq ι] (w : ι → ℝ) :
    IsometryEquiv (weightedSumSquares ℝ w) (weightedSumSquares ℝ (Real.sign ∘ w)) := by
  let u i := if h : w i = 0 then (1 : ℝˣ) else Units.mk0 (w i) h
  have hu' : ∀ i : ι, (Real.sign (u i) * u i) ^ (-(1 / 2 : ℝ)) ≠ 0 := by
    intro i
    refine' (ne_of_lt (Real.rpow_pos_of_pos (sign_mul_pos_of_ne_zero _ <| Units.ne_zero _) _)).symm
  convert
    (weightedSumSquares ℝ w).isometryEquivBasisRepr
      ((Pi.basisFun ℝ ι).unitsSMul fun i => (isUnit_iff_ne_zero.2 <| hu' i).unit)
  ext1 v
  rw [basisRepr_apply, weightedSumSquares_apply, weightedSumSquares_apply]
  refine' sum_congr rfl fun j hj => _
  have hsum :
    (∑ i : ι, v i • ((isUnit_iff_ne_zero.2 <| hu' i).unit : ℝ) • (Pi.basisFun ℝ ι) i) j =
      v j • (Real.sign (u j) * u j) ^ (-(1 / 2 : ℝ)) := by
    rw [Finset.sum_apply, sum_eq_single j, Pi.basisFun_apply, IsUnit.unit_spec,
      LinearMap.stdBasis_apply, Pi.smul_apply, Pi.smul_apply, Function.update_same, smul_eq_mul,
      smul_eq_mul, smul_eq_mul, mul_one]
    intro i _ hij
    rw [Pi.basisFun_apply, LinearMap.stdBasis_apply, Pi.smul_apply, Pi.smul_apply,
      Function.update_noteq hij.symm, Pi.zero_apply, smul_eq_mul, smul_eq_mul,
      mul_zero, mul_zero]
    intro hj'; exact False.elim (hj' hj)
  simp_rw [Basis.unitsSMul_apply]
  erw [hsum]
  simp only [Function.comp, smul_eq_mul]
  

Proof state:
case h.e'_10.H
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
w : ι → ℝ
u : ι → ℝˣ := fun i => if h : w i = 0 then 1 else Units.mk0 (w i) h
hu' : ∀ (i : ι), (sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)) ≠ 0
v : ι → ℝ
j : ι
hj : j ∈ univ
hsum :
  Finset.sum univ
      (fun i => v i • ↑(IsUnit.unit (_ : IsUnit ((sign ↑(u i) * ↑(u i)) ^ (-(1 / 2))))) • (Pi.basisFun ℝ ι) i) j =
    v j • (sign ↑(u j) * ↑(u j)) ^ (-(1 / 2))
⊢ sign (w j) * (v j * v j) =
    w j *
      (v j *
          (sign ↑(if h : w j = 0 then 1 else Units.mk0 (w j) h) * ↑(if h : w j = 0 then 1 else Units.mk0 (w j) h)) ^
            (-(1 / 2)) *
        (v j *
          (sign ↑(if h : w j = 0 then 1 else Units.mk0 (w j) h) * ↑(if h : w j = 0 then 1 else Units.mk0 (w j) h)) ^
            (-(1 / 2))))

Next tactic:
split_ifs with h
/-- The isometry between a weighted sum of squares with weights `u` on the
(non-zero) real numbers and the weighted sum of squares with weights `sign ∘ u`. -/
noncomputable def isometryEquivSignWeightedSumSquares [DecidableEq ι] (w : ι → ℝ) :
    IsometryEquiv (weightedSumSquares ℝ w) (weightedSumSquares ℝ (Real.sign ∘ w)) := by
  let u i := if h : w i = 0 then (1 : ℝˣ) else Units.mk0 (w i) h
  have hu' : ∀ i : ι, (Real.sign (u i) * u i) ^ (-(1 / 2 : ℝ)) ≠ 0 := by
    intro i
    refine' (ne_of_lt (Real.rpow_pos_of_pos (sign_mul_pos_of_ne_zero _ <| Units.ne_zero _) _)).symm
  convert
    (weightedSumSquares ℝ w).isometryEquivBasisRepr
      ((Pi.basisFun ℝ ι).unitsSMul fun i => (isUnit_iff_ne_zero.2 <| hu' i).unit)
  ext1 v
  rw [basisRepr_apply, weightedSumSquares_apply, weightedSumSquares_apply]
  refine' sum_congr rfl fun j hj => _
  have hsum :
    (∑ i : ι, v i • ((isUnit_iff_ne_zero.2 <| hu' i).unit : ℝ) • (Pi.basisFun ℝ ι) i) j =
      v j • (Real.sign (u j) * u j) ^ (-(1 / 2 : ℝ)) := by
    rw [Finset.sum_apply, sum_eq_single j, Pi.basisFun_apply, IsUnit.unit_spec,
      LinearMap.stdBasis_apply, Pi.smul_apply, Pi.smul_apply, Function.update_same, smul_eq_mul,
      smul_eq_mul, smul_eq_mul, mul_one]
    intro i _ hij
    rw [Pi.basisFun_apply, LinearMap.stdBasis_apply, Pi.smul_apply, Pi.smul_apply,
      Function.update_noteq hij.symm, Pi.zero_apply, smul_eq_mul, smul_eq_mul,
      mul_zero, mul_zero]
    intro hj'; exact False.elim (hj' hj)
  simp_rw [Basis.unitsSMul_apply]
  erw [hsum]
  simp only [Function.comp, smul_eq_mul]
  split_ifs with h
  · 

Proof state:
case pos
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
w : ι → ℝ
u : ι → ℝˣ := fun i => if h : w i = 0 then 1 else Units.mk0 (w i) h
hu' : ∀ (i : ι), (sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)) ≠ 0
v : ι → ℝ
j : ι
hj : j ∈ univ
hsum :
  Finset.sum univ
      (fun i => v i • ↑(IsUnit.unit (_ : IsUnit ((sign ↑(u i) * ↑(u i)) ^ (-(1 / 2))))) • (Pi.basisFun ℝ ι) i) j =
    v j • (sign ↑(u j) * ↑(u j)) ^ (-(1 / 2))
h : w j = 0
⊢ sign (w j) * (v j * v j) = w j * (v j * (sign ↑1 * ↑1) ^ (-(1 / 2)) * (v j * (sign ↑1 * ↑1) ^ (-(1 / 2))))

Next tactic:
simp only [h, zero_smul, zero_mul, Real.sign_zero]