pub fn prove_scale(
source: &Document,
candidate: &ScaleCandidate,
plan: &ScalePlan,
) -> Result<ScaleProof, ScaleError>Expand description
Independently re-derive and check every claim ScalePlan makes.
Proof runs on the in-memory candidate, re-deriving world matrices,
sampled trajectories, skin matrices, and bounds from source and
candidate rather than trusting how they were built. Numerical residuals
use ScaleTolerancePolicy::scalar_tolerance computed from that
comparison’s own actual before/after magnitudes, never a proxy such as the
plan’s declared factor. Discrete topology and the complete rest-world
affine outside a rest/bind closure are exact unchanged-domain invariants.
The world comparison is a semantic placement claim; exact local write-set
parity is a separate artifact/ledger obligation. Neither source nor
candidate need be numerically identical to the document plan was
computed against, but re-deriving source’s structural planning inventory
must produce the same affected domain and proof obligations.
§Errors
Returns ScaleError::PlanDocumentMismatch when the supplied source
derives a different proof inventory, any planning/selector error surfaced
while re-deriving that inventory, ScaleError::CandidateStructureMismatch
when an exact source/candidate invariant differs,
ScaleError::ProofResidualExceeded for the first residual that exceeds
ScalePlan::tolerance_policy, or ScaleError::MissingProofEvidence if
an obligation the plan declares provable has no counterpart evidence in
candidate.
Two claims checked here are not gated by ScaleProofObligation.
ProofResidualKind::TrackValue compares every stored animation element
with that track domain’s analytic expectation: the declared multiplier
where the plan rewrites the domain, and the retained value where it does
not. Both branches are owed by every plan.
ProofResidualKind::MeshPosition does the same for every base mesh
POSITION. In particular, whole-document conversion rewrites those values
with ScaleRewriteRule::WholeDocumentLength; this is not a preservation
claim. The comparison remains unconditional because skinned bounds would
otherwise be its only witness, and bounds reports zero comparisons for a
document with no skinned instance. Neither claim admits an obligation flag
as a proxy for having run — see ScaleProof, whose comparison counts
report what each actually walked.
ScaleProof::observed_factor is re-derived here from source rather
than copied from ScalePlan::observed_factor; it is reported as
evidence and is not itself an obligation. Both witnesses and the
divergence between them are recorded
(ScaleProof::planned_observed_factor,
ScaleProof::observed_factor_divergence); none of the three is checked
against a band here.