TorchLean API

NN.MLTheory.CROWN.Proofs.GraphCertSoundness.Semantics

Graph Certificate Semantics #

Value semantics for the verifier graph dialect over , together with the local semantic consistency predicate used by certificate soundness proofs.

Basic types and predicates #

We work over because it has the right order structure for “true” soundness theorems. The runtime checkers operate over Float (fast, executable), and can be used to connect a Python-produced floating certificate to the same computations in Lean.

@[reducible, inline]
Instances For
    @[reducible, inline]

    Componentwise enclosure predicate for a tensor point inside a FlatBox.

    Instances For

      EnclosesBox B v means the value vector v lies inside the interval box B.

      We phrase enclosure using the existing Sem.encloses predicate, but our semantic values are FlatVecs (carrying their dimension as a Nat), so we also carry a dimension equality witness.

      Instances For

        Denotational (value) semantics for the verifier graph dialect #

        The semantics is defined as a safe Option evaluator:

        Safe lookup of a previously computed parent value.

        Instances For
          noncomputable def NN.MLTheory.CROWN.Graph.CertSoundness.evalNode? (nodes : Array Node) (ps : ParamStore ) (inputs : Std.HashMap Val) (vals : Array (Option Val)) (id : ) :

          Value semantics for a single node in the supported dialect (over ).

          Instances For

            Evaluate an entire graph in node-id order using evalNode?.

            Instances For

              Even though we provided an executable evalGraph?, the main soundness theorem below does not depend on it.

              Reason: proving properties about the foldl evaluator would introduce a lot of “bookkeeping” lemmas about Array.set! and list folds.

              Instead, we state soundness for any array vals that is a local model of the semantics step: each node’s value must equal evalNode? computed from its parents’ values.

              This is a standard technique in proof engineering: separate “semantic consistency” from “the particular implementation of the evaluator”.

              Local semantic consistency (SemLocalOK) #

              SemLocalOK g ps inputs vals means:

              For a DAG (and only for a DAG), this is exactly the property that vals is a valid interpretation of the graph semantics.

              Existence and uniqueness of vals are evaluator-correctness facts. This file proves the certificate theorem in the reusable form: for any semantic interpretation vals, a locally-correct certificate encloses it.