feynlag.verify.checks

Executable physics invariants — the house verification toolkit.

Ported from bsm-calc/physics_utils.py. Philosophy: encode physical invariants as executable checks; a failing invariant stops the pipeline before the error propagates. All functions operate on SymPy objects and are model-agnostic.

House rule: every physical result gets BOTH a symbolic check and a random-point numeric check (numeric_equal()) — the numeric check defends against the canonical-form problem where two identical expressions differ syntactically and defeat simplify.

Functions

check_dimension(expr, symbol_dims, target_dim)

Symbolic dimensional analysis in powers of mass.

decoupling_limit(expr, heavy_scale[, direction])

Limit of expr as heavy_scale → ∞ (or → 0).

diagonalize_hermitian(M)

Diagonalize a hermitian matrix: returns (P, D) with M = P D P†.

is_hermitian(M)

Whether M = M† (simplifies the difference symbolically).

is_symmetric(M)

Whether M = Mᵀ — e.g. Majorana mass matrices.

numeric_equal(expr_a, expr_b, symbols[, ...])

Random-point NUMERIC equality of two expressions.

round_trip_reconstruct(lagrangian, fields)

Round-trip validation of the vertex extractor.

seesaw_light_mass(M_D, M_R)

Type-I seesaw at leading order: m_ν ≈ −M_D M_R⁻¹ M_Dᵀ.