The linear fit: the classical two-equation normal system
ProvedMetodosNumericos.mmq_linear_caseFor the base functions and , a coefficient pair minimizes the sum of squared residuals if and only if
the normal system of the straight-line fit of §6.1–6.3.
import Mathlib import Definitions.Def_MetodosNumericos_ajusteDefs
namespace MetodosNumericos
theorem mmq_linear_case {m : ℕ} (x f : Fin (m + 1) → ℝ) (c : Fin 2 → ℝ)
(phi : Fin 2 → ℝ → ℝ) (hphi0 : phi 0 = fun _ => 1) (hphi1 : phi 1 = fun t => t) :
(∀ d : Fin 2 → ℝ, sqError phi x f c ≤ sqError phi x f d) ↔
(c 0 * (m + 1 : ℝ) + c 1 * ∑ i : Fin (m + 1), x i = ∑ i : Fin (m + 1), f i ∧
c 0 * (∑ i : Fin (m + 1), x i) + c 1 * ∑ i : Fin (m + 1), x i ^ 2 =
∑ i : Fin (m + 1), x i * f i) := by sorry
end MetodosNumericosRead-back
What the Lean code literally says, in plain math · self-authored-by-drafting-agent (non-blind)
Disclosure: this read-back is not blind. It was written by the same agent that drafted the Lean statement, at the explicit instruction of the mission's human owner, and not by an independent auditor with fresh context.
For a natural number , families of reals, a pair of coefficients and a family of two real functions, under the hypotheses that is the constant function with value and is the identity function, the statement is an if-and-only-if between:
- for every pair of reals, ; and
- the conjunction of the two equations
where is the natural number cast into , that is, the number of data points.
No assumption is made that the nodes are distinct; if all coincide the two equations become dependent and both sides of the equivalence are still meaningful.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.