INNER CODE UNIT · Python
export
lean-dojo/TorchLean · torchlean/__init__.py:212
export: str | Path | None = None) -> dict[str, Any]:
"""Check a captured computation or an existing typed IR artifact.
``model`` is a PyTorch module, a JAX function with ``frontend="jax"``, or an
artifact mapping. Both frontends accept positional tensor arguments, as in
``verify(function, x, y)``. ``checks`` may request ``structure``, ``types``,
``execute``, ``compare`` or ``compare_bitwise``. ``compare`` lets two NaN results
agree whatever their sign and payload; ``compare_bitwise`` compares their words.
Unknown requests produce unsupported entries, not a pass.
Capture and translation are automatic. Optional ``export="model.json"`` saves
the exact artifact sent to Lean; ``export="Model.lean"`` embeds it in a Lean
module exposing ``Model.program`` and its import/validation proofs. Further
mathematical proofs can refer to this program without recapturing the function.
Export writes proof source; open or compile the Lean module to check its proofs.
The Lean filename must be an ASCII identifier. Existing files are never replaced.
Failed checks or checker errors still leave the capture for inspection; unsupported
capture creates no file. Invalid graphs cannot pass the generated Lean validation proof.