TorchLean API

NN.Verification.Cert.Common

Common Certificate Helpers #

Shared JSON/parsing and approximate-comparison utilities for node-wise verification certificates.

The IBP, α-CROWN, and α/β-CROWN checkers all consume the same basic artifact shapes: flat interval boxes, affine lower/upper bounds, and optional per-node vectors. We keep those format-level helpers here so the individual checkers can focus on their propagation rule:

The JSON artifact is always untrusted. These helpers only parse and compare data; acceptance still requires each checker to recompute the corresponding bound inside Lean. The float tolerances here exist because JSON stores decimal strings/numbers, not because the external producer is trusted.

Approximate equality for flat scalar tensors (length-n vectors), up to an absolute tolerance.

This is used when comparing Lean-recomputed bounds to decimal-serialized JSON certificate values.

Instances For

    Approximate equality for flat matrices (shape m × n), up to an absolute tolerance.

    Instances For

      Approximate equality for FlatBox bounds, componentwise on lo and hi.

      Instances For

        Approximate equality for affine vectors, componentwise on matrix A and offset c.

        Instances For

          Approximate equality for flattened affine lower/upper bounds.

          Instances For

            Parse a flat interval box (two arrays of floats) from JSON.

            Instances For

              Parse a flat vector from JSON, accepting null as an absent optional vector.

              Instances For

                Parse flattened affine bounds (lower/upper) from JSON.

                Instances For

                  Check that an optional per-node certificate array contains all parents of node id.

                  Instances For

                    Pretty-printer for a flat box, used in certificate mismatch messages.

                    Instances For

                      Pretty-printer for affine bounds, used in certificate mismatch messages.

                      Instances For