Skip to content

Commit

Permalink
feat(algebra/order/ring): turn mul_self_pos into an iff (#11216)
Browse files Browse the repository at this point in the history
  • Loading branch information
urkud committed Jan 4, 2022
1 parent 85784b0 commit 3045014
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion archive/imo/imo1998_q2.lean
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ begin
have h' : (x + y) * (x + y) = 4*z*z + 4*z + 1, { rw h, ring, },
rw [← add_sq_add_sq_sub, h', add_le_add_iff_left],
suffices : 0 < (x - y) * (x - y), { apply int.add_one_le_of_lt this, },
apply mul_self_pos, rw sub_ne_zero, apply int.ne_of_odd_add ⟨z, h⟩,
rw [mul_self_pos, sub_ne_zero], apply int.ne_of_odd_add ⟨z, h⟩,
end

section
Expand Down
11 changes: 8 additions & 3 deletions src/algebra/order/ring.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1174,9 +1174,14 @@ lt_iff_lt_of_le_iff_le (mul_le_mul_right_of_neg h)
lemma sub_one_lt (a : α) : a - 1 < a :=
sub_lt_iff_lt_add.2 (lt_add_one a)

lemma mul_self_pos {a : α} (ha : a ≠ 0) : 0 < a * a :=
by rcases lt_trichotomy a 0 with h|h|h;
[exact mul_pos_of_neg_of_neg h h, exact (ha h).elim, exact mul_pos h h]
@[simp] lemma mul_self_pos {a : α} : 0 < a * a ↔ a ≠ 0 :=
begin
split,
{ rintro h rfl, rw mul_zero at h, exact h.false },
{ intro h,
cases h.lt_or_lt with h h,
exacts [mul_pos_of_neg_of_neg h h, mul_pos h h] }
end

lemma mul_self_le_mul_self_of_le_of_neg_le {x y : α} (h₁ : x ≤ y) (h₂ : -x ≤ y) : x * x ≤ y * y :=
begin
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/inner_product_space/conformal_linear_map.lean
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ lemma is_conformal_map_iff (f' : E →L[ℝ] F) :
begin
split,
{ rintros ⟨c₁, hc₁, li, h⟩,
refine ⟨c₁ * c₁, mul_self_pos hc₁, λ u v, _⟩,
refine ⟨c₁ * c₁, mul_self_pos.2 hc₁, λ u v, _⟩,
simp only [h, pi.smul_apply, inner_map_map,
real_inner_smul_left, real_inner_smul_right, mul_assoc], },
{ rintros ⟨c₁, hc₁, huv⟩,
Expand Down
2 changes: 1 addition & 1 deletion src/linear_algebra/quadratic_form/basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ lemma pos_def.add (Q Q' : quadratic_form R₂ M) (hQ : pos_def Q) (hQ' : pos_def
lemma lin_mul_lin_self_pos_def {R} [linear_ordered_comm_ring R] [module R M]
(f : M →ₗ[R] R) (hf : linear_map.ker f = ⊥) :
pos_def (lin_mul_lin f f) :=
λ x hx, mul_self_pos (λ h, hx (linear_map.ker_eq_bot.mp hf (by rw [h, linear_map.map_zero])))
λ x hx, mul_self_pos.2 (λ h, hx (linear_map.ker_eq_bot.mp hf (by rw [h, linear_map.map_zero])))

end pos_def
end quadratic_form
Expand Down

0 comments on commit 3045014

Please sign in to comment.