Generic contracts shared by measured observations and model predictions.
structure
Signals.Contracts.ResidualContract
(Measurement : Type u_1)
(Prediction : Type u_2)
(Residual : Type u_3)
:
Type (max (max u_1 u_2) u_3)
A measured-versus-predicted result with an explicit residual law.
The residual and magnitude functions are parameters of the contract rather than global subtraction or norm operations. This keeps units and domain semantics in the specialized adapter while allowing common acceptance tooling.
- measured : Measurement
- predicted : Prediction
- residual : Residual
- residualFunction : Measurement → Prediction → Residual
- residualLaw : self.residual = self.residualFunction self.measured self.predicted
- magnitude : Residual → ℝ
- tolerance : ℝ
- tolerance_nonnegative : 0 ≤ self.tolerance
Instances For
theorem
Signals.Contracts.ResidualContract.residual_holds
{Measurement : Type u_1}
{Prediction : Type u_2}
{Residual : Type u_3}
(contract : ResidualContract Measurement Prediction Residual)
:
contract.residual = contract.residualFunction contract.measured contract.predicted
The residual is computed by the contract's supplied residual function.
def
Signals.Contracts.ResidualContract.accepted
{Measurement : Type u_1}
{Prediction : Type u_2}
{Residual : Type u_3}
(contract : ResidualContract Measurement Prediction Residual)
:
The contract's residual satisfies its declared acceptance bound.
Instances For
theorem
Signals.Contracts.ResidualContract.accepted_iff
{Measurement : Type u_1}
{Prediction : Type u_2}
{Residual : Type u_3}
(contract : ResidualContract Measurement Prediction Residual)
:
Acceptance is exactly the supplied residual bound.