# QC Fix DAG — L10: h00/h01 Helper Factoring **Date:** 2026-05-13 **Examiner:** subagent-task **Verdict:** PASS ## Input - `0-Core-Formalism/lean/Semantics/Semantics/Physics/UniversalBridge.lean` ## Transformation - Created `hermiteSharedTerms` private helper factoring shared Q16.16 arithmetic - Refactored `h00` and `h01` to use helper ## Output - `0-Core-Formalism/lean/Semantics/Semantics/Physics/UniversalBridge.lean` (modified) ## Verification - **Command:** `lake build` - **Result:** PASS - **Jobs:** 3530 ## Diff ```diff diff --git a/0-Core-Formalism/lean/Semantics/Semantics/Physics/UniversalBridge.lean b/0-Core-Formalism/lean/Semantics/Semantics/Physics/UniversalBridge.lean index c652b1bb..9913a2b7 100644 --- a/0-Core-Formalism/lean/Semantics/Semantics/Physics/UniversalBridge.lean +++ b/0-Core-Formalism/lean/Semantics/Semantics/Physics/UniversalBridge.lean @@ -33,6 +33,13 @@ private def q16_add (a b : Int) : Int := a + b private def q16_sub (a b : Int) : Int := a - b +private def hermiteSharedTerms (t : Int) : Int × Int × Int × Int := + let t2 := q16Mul t t + let t3 := q16Mul t2 t + let term3 := q16Mul (3 * scale) t2 + let term2 := q16Mul (2 * scale) t3 + (t2, t3, term3, term2) + -- ============================================================================ -- Normalized variable t = (Re − 2300) / 1700, as Q16.16 -- ============================================================================ @@ -48,18 +55,12 @@ def normalizedT (re : Int) : Option Int := /-- Basis function h00(t) = (1 − t)²(1 + 2t) = 1 − 3t² + 2t³ -/ def h00 (t : Int) : Int := - let t2 := q16Mul t t - let t3 := q16Mul t2 t - let term3 := q16Mul (3 * scale) t2 - let term2 := q16Mul (2 * scale) t3 + let (_, _, term3, term2) := hermiteSharedTerms t q16_sub (q16_add scale term2) term3 /-- Basis function h01(t) = t²(3 − 2t) = 3t² − 2t³ -/ def h01 (t : Int) : Int := - let t2 := q16Mul t t - let t3 := q16Mul t2 t - let term3 := q16Mul (3 * scale) t2 - let term2 := q16Mul (2 * scale) t3 + let (_, _, term3, term2) := hermiteSharedTerms t q16_sub term3 term2 /-- Basis function h10(t) = (1 − t)²·t -/ ```