Brahmagupta-Fibonacci identity, in both forms, over any commutative ring
ProvedEqualTwoSquares.two_squares_mulFor elements p, q, r and s of an arbitrary commutative ring, the product (p^2 + q^2)(r^2 + s^2) equals both (pr + qs)^2 + (ps - qr)^2 and (pr - qs)^2 + (ps + qr)^2.
import Mathlib
namespace EqualTwoSquares
/-- Brahmagupta–Fibonacci identity, both forms. -/
theorem two_squares_mul {R : Type*} [CommRing R] (p q r s : R) :
(p^2 + q^2) * (r^2 + s^2) = (p * r + q * s)^2 + (p * s - q * r)^2 ∧
(p^2 + q^2) * (r^2 + s^2) = (p * r - q * s)^2 + (p * s + q * r)^2 := by sorry
end EqualTwoSquaresRead-back
What the Lean code literally says, in plain math · independent-agent
Read-back: two_squares_mul
Declared in namespace EqualTwoSquares (file items/two_squares_mul.lean); the name agrees with the file name. Its own doc line reads "Brahmagupta–Fibonacci identity, both forms."
What the declaration literally says
Let be any type equipped with a commutative ring structure, and let . Then both of the following hold simultaneously (a conjunction):
Here means and the multiplication is that of the (arbitrary) commutative ring ; no division, ordering or integrality is used. The same value appears on the left of both conclusions, so the two forms are two representations of one product. All four ring elements are explicit arguments, all occur in both conclusions, and the only implicit argument is the typeclass instance making a commutative ring.
Because the statement is completely general, it silently covers degenerate instances: rings with zero divisors, rings of positive characteristic (where may vanish, in characteristic even ), and the zero ring; also , all-equal entries, and non-units. In every one of these the identity is asserted to hold, and it does.
Audit notes
- Truth. Verified by polynomial expansion: both right-hand sides expand to , which equals ; no cancellation between the two sides of an equation is relied on. Additionally checked by random sampling in the (non-domain, non-reduced, mixed-characteristic) rings for ; no failure. TRUE (universally, in every commutative ring).
- Faithfulness. Name matches file name; doc line "both forms" matches the conjunction of the two representations. No free variables; and its ring structure are properly bound.
- Trivializing premise. None — there are no hypotheses beyond the typeclass
[CommRing R], which is a legitimate structural requirement, not an assumption of the conclusion. - Satisfiability. The typeclass constraint is satisfiable (e.g. ); the quantification is non-vacuous.
- Elaboration. Included in
statements/All.lean; elaborates with only the expecteddeclaration uses 'sorry'warning.
FAITHFUL
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.