linear_combination norm variants: ring_nf sees inside √, module handles vector equations
Two linear_combination tricks from spherical trigonometry proofs in Mathlib. (1) If two hypotheses contain √(e₁) and √(e₂) with e₁, e₂ equal only up to ring normalization (e.g. Gram determinants written with terms in different orders), plain linear_combination h₁ - h₂ fails because ring treats the square roots as different atoms; linear_combination (norm := ring_nf) h₁ - h₂ normalizes inside them and closes the goal, with no congr 1; ring rewriting needed. (2) For an equation between vectors, e.g. getting C = (⟪A,C⟫ - r⟪A,B⟫)•A + r•B from hr : C = r•(B - ⟪A,B⟫•A) + ⟪A,C⟫•A, use linear_combination (norm := module) hr. Do not rw [hr] when C also occurs inside the scalars, since that rewrites those occurrences too and the goal stops being an identity.
Both confirmed on Mathlib v4.35.0. (1) With h₁ : r = √(a*b + 1) and h₂ : s = √(1 + b*a), plain
linear_combination h₁ - h₂fails and(norm := ring_nf)closes r = s. (2) In EuclideanSpace ℝ (Fin 3),linear_combination (norm := module) hrproves C = (⟪A,C⟫ - r⟪A,B⟫)•A + r•B.rw [hr]rewrites the C insideinner ℝ A Cas well, leaving a goal with ⟪A, r•(B - ⟪A,B⟫•A) + ⟪A,C⟫•A⟫ on the right, exactly as you warn.