feynlag.verify.checks.round_trip_reconstruct

feynlag.verify.checks.round_trip_reconstruct(lagrangian, fields)[source]

Round-trip validation of the vertex extractor.

Extracts interaction coefficients from lagrangian, reconstructs the Lagrangian from the coefficient dict, and returns the residual expand(original − reconstructed) (zero on success), together with a boolean verdict.

Returns:

(ok: bool, residual) — ok is True when the residual vanishes or contains no field symbols (pure-parameter constant terms are not interactions and may legitimately differ).