/-- Pythagoras with vectors and its converse: `|u + v|² = |u|² + |v|²` iff `u · v = 0`.
Hint: `norm_add_sq_real` expands `‖u + v‖ ^ 2` as `‖u‖ ^ 2 + 2 * ⟪u, v⟫ + ‖v‖ ^ 2`. -/
theorem pythagoras_iff_perp (u v : V) : ‖u + v‖ ^ 2 = ‖u‖ ^ 2 + ‖v‖ ^ 2 ↔ ⟪u, v⟫ = 0 := by
sorryShow the compiled solution
/-- **Pythagoras with vectors, and its converse**: `|u + v|² = |u|² + |v|²` exactly when
`u · v = 0`. Expanding gives `|u + v|² = |u|² + 2 u · v + |v|²` (Mathlib's
`norm_add_sq_real`), so the two sides differ by `2 u · v`. -/
theorem pythagoras_iff_perp (u v : V) : ‖u + v‖ ^ 2 = ‖u‖ ^ 2 + ‖v‖ ^ 2 ↔ ⟪u, v⟫ = 0 := by
rw [norm_add_sq_real]
constructor
· intro h; linarith
· intro h; rw [h]; ringAxioms used: propext, Classical.choice, Quot.soundformal/Lumenary/Vectors.leanTry it in the Lean web editor