TorchLean API

NN.MLTheory.CROWN.Proofs.GraphCrownCertSoundness

End-to-end CROWN certificate-checking framework (graph dialect) #

This file provides the reusable end-to-end CROWN certificate-checking framework for graph dialects:

The main theorem is phrased in the standard "if the checker accepts, the bound holds" style.

Relation to auto_LiRPA / alpha-beta-CROWN #

This file is written in a producer/checker style that matches common workflows:

We deliberately state the main theorem schematically in terms of an abstract step function: plain CROWN, α-CROWN, and α/β-CROWN can all share the same end-to-end checker theorem once their transfer rules are proved sound.

Trust boundary for transcendental ops #

IEEE-754 does not standardize libm transcendental functions. For ops like exp, log, tanh, and sigmoid, soundness is therefore expressed as an explicit assumption in the checker predicate. This matches the repo's existing design: rigorous transcendental enclosures are handled via an oracle boundary (e.g. Arb-backed interval enclosures), not by assuming a particular libm.

References (code) #

Pointwise interpretation of affine bounds #

A FlatAffineBounds α represents (componentwise) affine lower/upper functions of a fixed flattened input vector. To compare it to a concrete semantic value, we evaluate the affine maps at the chosen input point.

Evaluate affine lower/upper bounds at a concrete input point, yielding a FlatBox.

Instances For

    Enclosure predicate #

    We reuse Semantics.encloses from NN.MLTheory.CROWN.Graph for componentwise enclosure.

    Enclosure of a node value v under an affine bound b, evaluated at the designated input x.

    This is a well-typed variant of EnclosesVec (boundsEvalAt b x) v that guards the dependent dimension b.inDim.

    In a well-formed CROWN certificate, every bound satisfies b.inDim = ctx.inputDim, so the guard branch is the one that matters.

    Instances For

      Local semantic consistency #

      We reuse the real-valued graph dialect evaluator from graph_cert_soundness.lean, but we keep the definition abstract: the CROWN enclosure theorem below holds for any locally-consistent semantic interpretation vals (provided the graph is topologically sorted).

      For IEEE32Exec, a separate evaluator can be plugged in later; the theorem below is stated for any vals satisfying SemLocalOK.

      @[reducible, inline]

      Alias for the semantic value record used by CertSoundness.

      Instances For
        @[reducible, inline]

        Alias for the partial node evaluator used by CertSoundness.

        Instances For
          @[reducible, inline]

          Alias for the local semantic consistency predicate used by CertSoundness.

          Instances For
            @[reducible, inline]

            Alias for the topological-sorting predicate used by CertSoundness.

            Instances For

              A CROWN certificate "step function" (checker interface) #

              The runtime runCROWN produces FlatAffineBounds by a forward pass. For a certificate/checker architecture, we treat the producer as untrusted and phrase correctness as a local step condition:

              This file separates the generic checker theorem from per-operator transfer proofs. In particular, transcendental operators are represented by explicit transfer-soundness assumptions supplied by the backend or checker workflow.

              crownStepNode? is a parameter to the checker theorem: different certificate formats (plain CROWN, α/β-CROWN, split certificates) can share the same end-to-end theorem as long as they provide a step function and discharge transfer soundness.

              Transfer-rule soundness assumptions #

              CrownTransferSound is the kernel of the checker theorem: it states that the certificate's local step rule is sound for each supported node kind.

              For transcendental ops, this assumption is where you connect to an oracle model (e.g. Arb).

              "Checker implies enclosure" theorem (end-to-end) #

              This is the theorem you want to use in the paper:

              If a certificate is locally consistent and the transfer rules are sound, then the certificate enforces enclosure of the full graph semantics.

              This theorem is deliberately generic: it does not commit to a particular certificate producer (plain CROWN vs α/β-CROWN) nor to a particular transcendental backend.

              theorem NN.MLTheory.CROWN.Graph.CrownCertSoundness.crown_checker_encloses_semantics (g : Graph) (ps : ParamStore ) (step : Array (Option (FlatAffineBounds ))Option (FlatAffineBounds )) (cert : Array (Option (FlatAffineBounds ))) (inputs : Std.HashMap Val) (vals : Array (Option Val)) (ctx : AffineCtx) (x : Spec.Tensor (Spec.Shape.dim ctx.inputDim Spec.Shape.scalar)) (htopo : TopoSorted g) (_hsem : SemLocalOK g ps inputs vals) (hcert : CrownCertLocalOK g step cert) (hsound : CrownTransferSound g ps inputs vals ctx x step cert) (id : ) :
              id < g.nodes.sizematch cert[id]!, vals[id]! with | some b, some v => EnclosesAtInput ctx x b v | x, x_1 => True

              IEEE32Exec specialization (statement only) #

              The repository has a rich IEEE32 executable semantics (IEEE32Exec) and directed rounding lemmas for interval endpoints. However, a full end-to-end theorem connecting the float-running CROWN engine to IEEE32Exec execution requires a separate refinement theorem (rounding + libm/oracle).

              For the paper, the right way to expose that dependency is to keep the theorem schematic: instantiate CrownTransferSound with the appropriate backend assumptions (e.g. Arb for transcendentals), and then the generic checker theorem applies.