Metakit / @doeixd/metakit/conformance
checkResidualizeSoundness
function · packages/metakit/src/conformance.ts:238
function checkResidualizeSoundness<S extends Schema.Top, A>(
expr: Expr.Expr<S['Type'], A>,
schema: S,
mask: (env: S['Type']) => Expr.PartialEnv<S['Type']>,
options?: {
readonly samples?: number
readonly seed?: number
},
): {
readonly ok: boolean
readonly checked: number
readonly seed: number
readonly mismatch?: {
readonly env: S['Type']
readonly full: Outcome<A>
readonly residual: Outcome<A>
}
}Property-test Tier 2 partial evaluation soundness against Tier 1 evaluation:
∀ env ~ schema:
eval(residualize(expr, mask(env)), env) === eval(expr, env)
and, for a boolean expr, where judge returns True or False, that is
what eval gives. The environments are drawn by seed (default 1), which
the report gives back to reproduce a mismatch.