l3lab/ntp-mathlib huggingface dataset:
/-- Binary strict **rearrangement inequality**. -/
theorem smul_add_smul_lt_smul_add_smul [CovariantClass M M (· + ·) (· < ·)]
    [ContravariantClass M M (· + ·) (· < ·)] {a b : k} {c d : M} (hab : a < b) (hcd : c < d) :
    a • d + b • c < a • c + b • d := by
  obtain ⟨b, rfl⟩ := exists_add_of_le hab.le
  

Proof state:
case intro
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝⁵ : OrderedRing k
inst✝⁴ : OrderedAddCommGroup M
inst✝³ : Module k M
inst✝² : OrderedSMul k M
a✝ b✝ : M
c✝ d✝ : k
inst✝¹ : CovariantClass M M (fun x x_1 => x + x_1) fun x x_1 => x < x_1
inst✝ : ContravariantClass M M (fun x x_1 => x + x_1) fun x x_1 => x < x_1
a : k
c d : M
hcd : c < d
b : k
hab : a < a + b
⊢ a • d + (a + b) • c < a • c + (a + b) • d

Next tactic:
obtain ⟨d, rfl⟩ := exists_add_of_le hcd.le
/-- Binary strict **rearrangement inequality**. -/
theorem smul_add_smul_lt_smul_add_smul [CovariantClass M M (· + ·) (· < ·)]
    [ContravariantClass M M (· + ·) (· < ·)] {a b : k} {c d : M} (hab : a < b) (hcd : c < d) :
    a • d + b • c < a • c + b • d := by
  obtain ⟨b, rfl⟩ := exists_add_of_le hab.le
  obtain ⟨d, rfl⟩ := exists_add_of_le hcd.le
  

Proof state:
case intro.intro
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝⁵ : OrderedRing k
inst✝⁴ : OrderedAddCommGroup M
inst✝³ : Module k M
inst✝² : OrderedSMul k M
a✝ b✝ : M
c✝ d✝ : k
inst✝¹ : CovariantClass M M (fun x x_1 => x + x_1) fun x x_1 => x < x_1
inst✝ : ContravariantClass M M (fun x x_1 => x + x_1) fun x x_1 => x < x_1
a : k
c : M
b : k
hab : a < a + b
d : M
hcd : c < c + d
⊢ a • (c + d) + (a + b) • c < a • c + (a + b) • (c + d)

Next tactic:
rw [smul_add, add_right_comm, smul_add, ← add_assoc, add_smul _ _ d]
/-- Binary strict **rearrangement inequality**. -/
theorem smul_add_smul_lt_smul_add_smul [CovariantClass M M (· + ·) (· < ·)]
    [ContravariantClass M M (· + ·) (· < ·)] {a b : k} {c d : M} (hab : a < b) (hcd : c < d) :
    a • d + b • c < a • c + b • d := by
  obtain ⟨b, rfl⟩ := exists_add_of_le hab.le
  obtain ⟨d, rfl⟩ := exists_add_of_le hcd.le
  rw [smul_add, add_right_comm, smul_add, ← add_assoc, add_smul _ _ d]
  

Proof state:
case intro.intro
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝⁵ : OrderedRing k
inst✝⁴ : OrderedAddCommGroup M
inst✝³ : Module k M
inst✝² : OrderedSMul k M
a✝ b✝ : M
c✝ d✝ : k
inst✝¹ : CovariantClass M M (fun x x_1 => x + x_1) fun x x_1 => x < x_1
inst✝ : ContravariantClass M M (fun x x_1 => x + x_1) fun x x_1 => x < x_1
a : k
c : M
b : k
hab : a < a + b
d : M
hcd : c < c + d
⊢ a • c + (a + b) • c + a • d < a • c + (a + b) • c + (a • d + b • d)

Next tactic:
rw [lt_add_iff_pos_right] at hab hcd
/-- Binary strict **rearrangement inequality**. -/
theorem smul_add_smul_lt_smul_add_smul [CovariantClass M M (· + ·) (· < ·)]
    [ContravariantClass M M (· + ·) (· < ·)] {a b : k} {c d : M} (hab : a < b) (hcd : c < d) :
    a • d + b • c < a • c + b • d := by
  obtain ⟨b, rfl⟩ := exists_add_of_le hab.le
  obtain ⟨d, rfl⟩ := exists_add_of_le hcd.le
  rw [smul_add, add_right_comm, smul_add, ← add_assoc, add_smul _ _ d]
  rw [lt_add_iff_pos_right] at hab hcd
  

Proof state:
case intro.intro
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝⁵ : OrderedRing k
inst✝⁴ : OrderedAddCommGroup M
inst✝³ : Module k M
inst✝² : OrderedSMul k M
a✝ b✝ : M
c✝ d✝ : k
inst✝¹ : CovariantClass M M (fun x x_1 => x + x_1) fun x x_1 => x < x_1
inst✝ : ContravariantClass M M (fun x x_1 => x + x_1) fun x x_1 => x < x_1
a : k
c : M
b : k
hab : 0 < b
d : M
hcd : 0 < d
⊢ a • c + (a + b) • c + a • d < a • c + (a + b) • c + (a • d + b • d)

Next tactic:
exact add_lt_add_left (lt_add_of_pos_right _ <| smul_pos hab hcd) _
/-- Binary strict **rearrangement inequality**. -/
theorem smul_add_smul_lt_smul_add_smul' [CovariantClass M M (· + ·) (· < ·)]
    [ContravariantClass M M (· + ·) (· < ·)] {a b : k} {c d : M} (hba : b < a) (hdc : d < c) :
    a • d + b • c < a • c + b • d := by
  

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝⁵ : OrderedRing k
inst✝⁴ : OrderedAddCommGroup M
inst✝³ : Module k M
inst✝² : OrderedSMul k M
a✝ b✝ : M
c✝ d✝ : k
inst✝¹ : CovariantClass M M (fun x x_1 => x + x_1) fun x x_1 => x < x_1
inst✝ : ContravariantClass M M (fun x x_1 => x + x_1) fun x x_1 => x < x_1
a b : k
c d : M
hba : b < a
hdc : d < c
⊢ a • d + b • c < a • c + b • d

Next tactic:
rw [add_comm (a • d), add_comm (a • c)]
/-- Binary strict **rearrangement inequality**. -/
theorem smul_add_smul_lt_smul_add_smul' [CovariantClass M M (· + ·) (· < ·)]
    [ContravariantClass M M (· + ·) (· < ·)] {a b : k} {c d : M} (hba : b < a) (hdc : d < c) :
    a • d + b • c < a • c + b • d := by
  rw [add_comm (a • d), add_comm (a • c)]
  

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝⁵ : OrderedRing k
inst✝⁴ : OrderedAddCommGroup M
inst✝³ : Module k M
inst✝² : OrderedSMul k M
a✝ b✝ : M
c✝ d✝ : k
inst✝¹ : CovariantClass M M (fun x x_1 => x + x_1) fun x x_1 => x < x_1
inst✝ : ContravariantClass M M (fun x x_1 => x + x_1) fun x x_1 => x < x_1
a b : k
c d : M
hba : b < a
hdc : d < c
⊢ b • c + a • d < b • d + a • c

Next tactic:
exact smul_add_smul_lt_smul_add_smul hba hdc
theorem smul_le_smul_iff_of_neg (hc : c < 0) : c • a ≤ c • b ↔ b ≤ a := by
  

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedField k
inst✝² : OrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
a b : M
c : k
hc : c < 0
⊢ c • a ≤ c • b ↔ b ≤ a

Next tactic:
rw [← neg_neg c, neg_smul, neg_smul (-c), neg_le_neg_iff]
theorem smul_le_smul_iff_of_neg (hc : c < 0) : c • a ≤ c • b ↔ b ≤ a := by
  rw [← neg_neg c, neg_smul, neg_smul (-c), neg_le_neg_iff]
  

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedField k
inst✝² : OrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
a b : M
c : k
hc : c < 0
⊢ -c • b ≤ -c • a ↔ b ≤ a

Next tactic:
exact smul_le_smul_iff_of_pos (neg_pos_of_neg hc)
theorem inv_smul_le_iff_of_neg (h : c < 0) : c⁻¹ • a ≤ b ↔ c • b ≤ a := by
  

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedField k
inst✝² : OrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
a b : M
c : k
h : c < 0
⊢ c⁻¹ • a ≤ b ↔ c • b ≤ a

Next tactic:
rw [← smul_le_smul_iff_of_neg h, smul_inv_smul₀ h.ne]
theorem inv_smul_lt_iff_of_neg (h : c < 0) : c⁻¹ • a < b ↔ c • b < a := by
  

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedField k
inst✝² : OrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
a b : M
c : k
h : c < 0
⊢ c⁻¹ • a < b ↔ c • b < a

Next tactic:
rw [← smul_lt_smul_iff_of_neg h, smul_inv_smul₀ h.ne]
theorem smul_inv_le_iff_of_neg (h : c < 0) : a ≤ c⁻¹ • b ↔ b ≤ c • a := by
  

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedField k
inst✝² : OrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
a b : M
c : k
h : c < 0
⊢ a ≤ c⁻¹ • b ↔ b ≤ c • a

Next tactic:
rw [← smul_le_smul_iff_of_neg h, smul_inv_smul₀ h.ne]
theorem smul_inv_lt_iff_of_neg (h : c < 0) : a < c⁻¹ • b ↔ b < c • a := by
  

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedField k
inst✝² : OrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
a b : M
c : k
h : c < 0
⊢ a < c⁻¹ • b ↔ b < c • a

Next tactic:
rw [← smul_lt_smul_iff_of_neg h, smul_inv_smul₀ h.ne]
lemma nonneg_and_nonneg_or_nonpos_and_nonpos_of_smul_nonneg (hab : 0 ≤ a • b) :
    0 ≤ a ∧ 0 ≤ b ∨ a ≤ 0 ∧ b ≤ 0 := by
  

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedRing k
inst✝² : LinearOrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
f : ι → k
g : ι → M
s : Set ι
a a₁ a₂ : k
b b₁ b₂ : M
hab : 0 ≤ a • b
⊢ 0 ≤ a ∧ 0 ≤ b ∨ a ≤ 0 ∧ b ≤ 0

Next tactic:
simp only [Decidable.or_iff_not_and_not, not_and, not_le]
lemma nonneg_and_nonneg_or_nonpos_and_nonpos_of_smul_nonneg (hab : 0 ≤ a • b) :
    0 ≤ a ∧ 0 ≤ b ∨ a ≤ 0 ∧ b ≤ 0 := by
  simp only [Decidable.or_iff_not_and_not, not_and, not_le]
  

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedRing k
inst✝² : LinearOrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
f : ι → k
g : ι → M
s : Set ι
a a₁ a₂ : k
b b₁ b₂ : M
hab : 0 ≤ a • b
⊢ (0 ≤ a → b < 0) → ¬(a ≤ 0 → 0 < b)

Next tactic:
refine fun ab nab ↦ hab.not_lt ?_
lemma nonneg_and_nonneg_or_nonpos_and_nonpos_of_smul_nonneg (hab : 0 ≤ a • b) :
    0 ≤ a ∧ 0 ≤ b ∨ a ≤ 0 ∧ b ≤ 0 := by
  simp only [Decidable.or_iff_not_and_not, not_and, not_le]
  refine fun ab nab ↦ hab.not_lt ?_
  

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedRing k
inst✝² : LinearOrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
f : ι → k
g : ι → M
s : Set ι
a a₁ a₂ : k
b b₁ b₂ : M
hab : 0 ≤ a • b
ab : 0 ≤ a → b < 0
nab : a ≤ 0 → 0 < b
⊢ a • b < 0

Next tactic:
obtain ha | rfl | ha := lt_trichotomy 0 a
lemma nonneg_and_nonneg_or_nonpos_and_nonpos_of_smul_nonneg (hab : 0 ≤ a • b) :
    0 ≤ a ∧ 0 ≤ b ∨ a ≤ 0 ∧ b ≤ 0 := by
  simp only [Decidable.or_iff_not_and_not, not_and, not_le]
  refine fun ab nab ↦ hab.not_lt ?_
  obtain ha | rfl | ha := lt_trichotomy 0 a
  

Proof state:
case inl
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedRing k
inst✝² : LinearOrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
f : ι → k
g : ι → M
s : Set ι
a a₁ a₂ : k
b b₁ b₂ : M
hab : 0 ≤ a • b
ab : 0 ≤ a → b < 0
nab : a ≤ 0 → 0 < b
ha : 0 < a
⊢ a • b < 0
case inr.inl
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedRing k
inst✝² : LinearOrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
f : ι → k
g : ι → M
s : Set ι
a₁ a₂ : k
b b₁ b₂ : M
hab : 0 ≤ 0 • b
ab : 0 ≤ 0 → b < 0
nab : 0 ≤ 0 → 0 < b
⊢ 0 • b < 0
case inr.inr
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedRing k
inst✝² : LinearOrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
f : ι → k
g : ι → M
s : Set ι
a a₁ a₂ : k
b b₁ b₂ : M
hab : 0 ≤ a • b
ab : 0 ≤ a → b < 0
nab : a ≤ 0 → 0 < b
ha : a < 0
⊢ a • b < 0

Next tactic:
exacts [smul_neg_of_pos_of_neg ha (ab ha.le), ((ab le_rfl).asymm (nab le_rfl)).elim,
    smul_neg_of_neg_of_pos ha (nab ha.le)]
lemma smul_nonpos_iff : a • b ≤ 0 ↔ 0 ≤ a ∧ b ≤ 0 ∨ a ≤ 0 ∧ 0 ≤ b := by
  

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedRing k
inst✝² : LinearOrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
f : ι → k
g : ι → M
s : Set ι
a a₁ a₂ : k
b b₁ b₂ : M
⊢ a • b ≤ 0 ↔ 0 ≤ a ∧ b ≤ 0 ∨ a ≤ 0 ∧ 0 ≤ b

Next tactic:
rw [← neg_nonneg, ← smul_neg, smul_nonneg_iff, neg_nonneg, neg_nonpos]
lemma smul_nonneg_iff_pos_imp_nonneg : 0 ≤ a • b ↔ (0 < a → 0 ≤ b) ∧ (0 < b → 0 ≤ a) := by
  

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedRing k
inst✝² : LinearOrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
f : ι → k
g : ι → M
s : Set ι
a a₁ a₂ : k
b b₁ b₂ : M
⊢ 0 ≤ a • b ↔ (0 < a → 0 ≤ b) ∧ (0 < b → 0 ≤ a)

Next tactic:
refine smul_nonneg_iff.trans ?_
lemma smul_nonneg_iff_pos_imp_nonneg : 0 ≤ a • b ↔ (0 < a → 0 ≤ b) ∧ (0 < b → 0 ≤ a) := by
  refine smul_nonneg_iff.trans ?_
  

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedRing k
inst✝² : LinearOrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
f : ι → k
g : ι → M
s : Set ι
a a₁ a₂ : k
b b₁ b₂ : M
⊢ 0 ≤ a ∧ 0 ≤ b ∨ a ≤ 0 ∧ b ≤ 0 ↔ (0 < a → 0 ≤ b) ∧ (0 < b → 0 ≤ a)

Next tactic:
simp_rw [← not_le, ← or_iff_not_imp_left]
lemma smul_nonneg_iff_pos_imp_nonneg : 0 ≤ a • b ↔ (0 < a → 0 ≤ b) ∧ (0 < b → 0 ≤ a) := by
  refine smul_nonneg_iff.trans ?_
  simp_rw [← not_le, ← or_iff_not_imp_left]
  

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedRing k
inst✝² : LinearOrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
f : ι → k
g : ι → M
s : Set ι
a a₁ a₂ : k
b b₁ b₂ : M
⊢ 0 ≤ a ∧ 0 ≤ b ∨ a ≤ 0 ∧ b ≤ 0 ↔ (a ≤ 0 ∨ 0 ≤ b) ∧ (b ≤ 0 ∨ 0 ≤ a)

Next tactic:
have := le_total a 0
lemma smul_nonneg_iff_pos_imp_nonneg : 0 ≤ a • b ↔ (0 < a → 0 ≤ b) ∧ (0 < b → 0 ≤ a) := by
  refine smul_nonneg_iff.trans ?_
  simp_rw [← not_le, ← or_iff_not_imp_left]
  have := le_total a 0
  

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedRing k
inst✝² : LinearOrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
f : ι → k
g : ι → M
s : Set ι
a a₁ a₂ : k
b b₁ b₂ : M
this : a ≤ 0 ∨ 0 ≤ a
⊢ 0 ≤ a ∧ 0 ≤ b ∨ a ≤ 0 ∧ b ≤ 0 ↔ (a ≤ 0 ∨ 0 ≤ b) ∧ (b ≤ 0 ∨ 0 ≤ a)

Next tactic:
have := le_total b 0
lemma smul_nonneg_iff_pos_imp_nonneg : 0 ≤ a • b ↔ (0 < a → 0 ≤ b) ∧ (0 < b → 0 ≤ a) := by
  refine smul_nonneg_iff.trans ?_
  simp_rw [← not_le, ← or_iff_not_imp_left]
  have := le_total a 0
  have := le_total b 0
  

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedRing k
inst✝² : LinearOrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
f : ι → k
g : ι → M
s : Set ι
a a₁ a₂ : k
b b₁ b₂ : M
this✝ : a ≤ 0 ∨ 0 ≤ a
this : b ≤ 0 ∨ 0 ≤ b
⊢ 0 ≤ a ∧ 0 ≤ b ∨ a ≤ 0 ∧ b ≤ 0 ↔ (a ≤ 0 ∨ 0 ≤ b) ∧ (b ≤ 0 ∨ 0 ≤ a)

Next tactic:
tauto
lemma smul_nonneg_iff_neg_imp_nonpos : 0 ≤ a • b ↔ (a < 0 → b ≤ 0) ∧ (b < 0 → a ≤ 0) := by
  

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedRing k
inst✝² : LinearOrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
f : ι → k
g : ι → M
s : Set ι
a a₁ a₂ : k
b b₁ b₂ : M
⊢ 0 ≤ a • b ↔ (a < 0 → b ≤ 0) ∧ (b < 0 → a ≤ 0)

Next tactic:
rw [← neg_smul_neg, smul_nonneg_iff_pos_imp_nonneg]
lemma smul_nonneg_iff_neg_imp_nonpos : 0 ≤ a • b ↔ (a < 0 → b ≤ 0) ∧ (b < 0 → a ≤ 0) := by
  rw [← neg_smul_neg, smul_nonneg_iff_pos_imp_nonneg]; 

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedRing k
inst✝² : LinearOrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
f : ι → k
g : ι → M
s : Set ι
a a₁ a₂ : k
b b₁ b₂ : M
⊢ (0 < -a → 0 ≤ -b) ∧ (0 < -b → 0 ≤ -a) ↔ (a < 0 → b ≤ 0) ∧ (b < 0 → a ≤ 0)

Next tactic:
simp only [neg_pos, neg_nonneg]
lemma smul_nonpos_iff_pos_imp_nonpos : a • b ≤ 0 ↔ (0 < a → b ≤ 0) ∧ (b < 0 → 0 ≤ a) := by
  

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedRing k
inst✝² : LinearOrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
f : ι → k
g : ι → M
s : Set ι
a a₁ a₂ : k
b b₁ b₂ : M
⊢ a • b ≤ 0 ↔ (0 < a → b ≤ 0) ∧ (b < 0 → 0 ≤ a)

Next tactic:
rw [← neg_nonneg, ← smul_neg, smul_nonneg_iff_pos_imp_nonneg]
lemma smul_nonpos_iff_pos_imp_nonpos : a • b ≤ 0 ↔ (0 < a → b ≤ 0) ∧ (b < 0 → 0 ≤ a) := by
  rw [← neg_nonneg, ← smul_neg, smul_nonneg_iff_pos_imp_nonneg]; 

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedRing k
inst✝² : LinearOrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
f : ι → k
g : ι → M
s : Set ι
a a₁ a₂ : k
b b₁ b₂ : M
⊢ (0 < a → 0 ≤ -b) ∧ (0 < -b → 0 ≤ a) ↔ (0 < a → b ≤ 0) ∧ (b < 0 → 0 ≤ a)

Next tactic:
simp only [neg_pos, neg_nonneg]
lemma smul_nonpos_iff_neg_imp_nonneg : a • b ≤ 0 ↔ (a < 0 → 0 ≤ b) ∧ (0 < b → a ≤ 0) := by
  

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedRing k
inst✝² : LinearOrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
f : ι → k
g : ι → M
s : Set ι
a a₁ a₂ : k
b b₁ b₂ : M
⊢ a • b ≤ 0 ↔ (a < 0 → 0 ≤ b) ∧ (0 < b → a ≤ 0)

Next tactic:
rw [← neg_nonneg, ← neg_smul, smul_nonneg_iff_pos_imp_nonneg]
lemma smul_nonpos_iff_neg_imp_nonneg : a • b ≤ 0 ↔ (a < 0 → 0 ≤ b) ∧ (0 < b → a ≤ 0) := by
  rw [← neg_nonneg, ← neg_smul, smul_nonneg_iff_pos_imp_nonneg]; 

Proof state:
ι : Type u_1
k : Type u_2
M : Type u_3
N : Type u_4
inst✝³ : LinearOrderedRing k
inst✝² : LinearOrderedAddCommGroup M
inst✝¹ : Module k M
inst✝ : OrderedSMul k M
f : ι → k
g : ι → M
s : Set ι
a a₁ a₂ : k
b b₁ b₂ : M
⊢ (0 < -a → 0 ≤ b) ∧ (0 < b → 0 ≤ -a) ↔ (a < 0 → 0 ≤ b) ∧ (0 < b → a ≤ 0)

Next tactic:
simp only [neg_pos, neg_nonneg]
/-- 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
  

Proof state:
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
w : ι → ℝ
⊢ IsometryEquiv (weightedSumSquares ℝ w) (weightedSumSquares ℝ (sign ∘ w))

Next tactic:
let u i := if h : w i = 0 then (1 : ℝˣ) else Units.mk0 (w i) 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
  

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
⊢ IsometryEquiv (weightedSumSquares ℝ w) (weightedSumSquares ℝ (sign ∘ w))

Next tactic:
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
/-- 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
    

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
⊢ ∀ (i : ι), (sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)) ≠ 0

Next tactic:
intro i
/-- 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
    

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
i : ι
⊢ (sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)) ≠ 0

Next tactic:
refine' (ne_of_lt (Real.rpow_pos_of_pos (sign_mul_pos_of_ne_zero _ <| Units.ne_zero _) _)).symm
/-- 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
  

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
⊢ IsometryEquiv (weightedSumSquares ℝ w) (weightedSumSquares ℝ (sign ∘ w))

Next tactic:
convert
    (weightedSumSquares ℝ w).isometryEquivBasisRepr
      ((Pi.basisFun ℝ ι).unitsSMul fun i => (isUnit_iff_ne_zero.2 <| hu' i).unit)
/-- 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)
  

Proof state:
case h.e'_10
ι : 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
⊢ weightedSumSquares ℝ (sign ∘ w) =
    basisRepr (weightedSumSquares ℝ w)
      (Basis.unitsSMul (Pi.basisFun ℝ ι) fun i => IsUnit.unit (_ : IsUnit ((sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)))))

Next tactic:
ext1 v
/-- 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
  

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 : ι → ℝ
⊢ (weightedSumSquares ℝ (sign ∘ w)) v =
    (basisRepr (weightedSumSquares ℝ w)
        (Basis.unitsSMul (Pi.basisFun ℝ ι) fun i => IsUnit.unit (_ : IsUnit ((sign ↑(u i) * ↑(u i)) ^ (-(1 / 2))))))
      v

Next tactic:
rw [basisRepr_apply, weightedSumSquares_apply, weightedSumSquares_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]
  

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 : ι → ℝ
⊢ ∑ i : ι, (sign ∘ w) i • (v i * v i) =
    ∑ i : ι,
      w i •
        (Finset.sum univ
            (fun i =>
              v i •
                (Basis.unitsSMul (Pi.basisFun ℝ ι) fun i =>
                    IsUnit.unit (_ : IsUnit ((sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)))))
                  i)
            i *
          Finset.sum univ
            (fun i =>
              v i •
                (Basis.unitsSMul (Pi.basisFun ℝ ι) fun i =>
                    IsUnit.unit (_ : IsUnit ((sign ↑(u i) * ↑(u i)) ^ (-(1 / 2)))))
                  i)
            i)

Next tactic:
refine' sum_congr rfl fun j hj => _