INNER CODE UNIT · Python

verify

lean-dojo/TorchLean · torchlean/__init__.py:209

def verify(model: Any, example: Any = None, *examples: Any, frontend: str = "pytorch",
           checks: Sequence[str] = ("structure", "types"),
           checker: str | Path | Sequence[str] | None = None,
           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.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…