Zulip Chat Archive

Stream: new members

Topic: inner product equal -1 iff vectors are opposite


Ilmārs Cīrulis (Jun 21 2025 at 03:18):

Is there a shorter way to prove/golf this result? I want to put in Mathlib.Analysis.InnerProductSpace.Basic right after inner_eq_one_iff_of_norm_one.

import Mathlib.Analysis.InnerProductSpace.Basic

variable {π•œ E : Type*}
variable [RCLike π•œ]
variable [NormedAddCommGroup E]
variable [InnerProductSpace π•œ E]

/-- If the inner product of two unit vectors is `-1`, then the two vectors are opposite. -/
theorem inner_eq_neg_one_iff_of_norm_one {x y : E} (hx : β€–xβ€– = 1) (hy : β€–yβ€– = 1) :
    inner π•œ x y = -1 ↔ x = -y := by
  have H := inner_eq_one_iff_of_norm_one (π•œ := π•œ) (x := x) (y := -y)
  simp only [norm_neg, inner_neg_right] at H
  rw [← H hx hy]
  constructor <;> intros H0
  Β· rw [H0]; simp
  Β· rw [← H0]; simp

Aaron Liu (Jun 21 2025 at 03:32):

#mwe?

Ilmārs Cīrulis (Jun 21 2025 at 03:33):

Fixed

Ilmārs Cīrulis (Jun 21 2025 at 03:42):

Ok, this is a bit shorter

import Mathlib.Analysis.InnerProductSpace.Basic

variable {π•œ E : Type*}
variable [RCLike π•œ]
variable [NormedAddCommGroup E]
variable [InnerProductSpace π•œ E]

/-- If the inner product of two unit vectors is `-1`, then the two vectors are opposite. -/
theorem inner_eq_neg_one_iff_of_norm_one {x y : E} (hx : β€–xβ€– = 1) (hy : β€–yβ€– = 1) :
    inner π•œ x y = -1 ↔ x = -y := by
  have H := inner_eq_one_iff_of_norm_one (π•œ := π•œ) (x := x) (y := -y)
  simp only [norm_neg, inner_neg_right] at H
  rw [← H hx hy, neg_eq_iff_eq_neg]

Aaron Liu (Jun 21 2025 at 03:49):

import Mathlib.Analysis.InnerProductSpace.Basic

variable {π•œ E : Type*}
variable [RCLike π•œ]
variable [NormedAddCommGroup E]
variable [InnerProductSpace π•œ E]

/-- If the inner product of two unit vectors is `-1`, then the two vectors are opposite. -/
theorem inner_eq_neg_one_iff_of_norm_one {x y : E} (hx : β€–xβ€– = 1) (hy : β€–yβ€– = 1) :
    inner π•œ x y = -1 ↔ x = -y := by
  simpa [neg_eq_iff_eq_neg] using
    inner_eq_one_iff_of_norm_one (π•œ := π•œ) hx (show β€–-yβ€– = 1 by simpa using hy)

Last updated: Dec 20 2025 at 21:32 UTC