TorchLean API

NN.API.Verification.Core

Verification #

The public vocabulary used by trained-model verification. Ordinary code calls trained.verify center (radius := r) (norm := linf) and adds named choices only when needed. Report retains those choices with the returned bounds; explicit graph lowering is intentionally separate in NN.API.Verification.Lowering.

Bound-propagation algorithm used to construct a verification report.

  • ibp : Algorithm

    Fast interval bound propagation.

  • crown : Algorithm

    CROWN output bounds: forward affine on exact backends, directed backward on rounded ones.

  • alphaCrown : Algorithm

    Fixed-relaxation alpha-CROWN with the ReLU phases IBP proves. No phase beyond IBP is assumed, so no beta split and no branch-and-bound search runs. Reports print it as Alpha-CROWN (IBP phases). On a rounded scalar it runs directed CROWN instead, and the report says CROWN.

Instances For

    Human-readable method name used in reports.

    Instances For

      Norm of the input region requested for verification.

      The current native CROWN path implements linf; the other cases remain part of the request language so adding a non-box region does not require another public API.

      • l1 : Norm

        L1 input ball.

      • l2 : Norm

        L2 input ball.

      • linf : Norm

        L-infinity input ball.

      Instances For
        @[instance_reducible]

        Human-readable norm name used in reports and diagnostics.

        Instances For

          Property evaluated from output bounds.

          outputBounds returns the complete output enclosure. topLabel label additionally asks whether one flattened output stays strictly above every competing output.

          • outputBounds : Property

            Return the output enclosure without an additional assertion.

          • topLabel (label : ℕ) : Property

            Check that label remains the unique largest flattened output.

          Instances For
            Instances For

              Human-readable property description used in reports.

              Instances For

                Reject an invalid input-region radius before verification begins.

                Instances For

                  Componentwise lower and upper bounds for a flattened model output.

                  • size : ℕ

                    Shared number of flattened output components.

                  • lower : Tensor Float [self.size]

                    Componentwise lower output bounds.

                  • upper : Tensor Float [self.size]

                    Componentwise upper output bounds.

                  Instances For

                    Check the basic consistency needed by public reporting helpers.

                    Instances For

                      Largest output value other than label.

                      Instances For

                        Result of evaluating a requested output property from valid bounds.

                        • bounds : Result

                          The report contains an output enclosure but no additional assertion.

                        • topLabel (label : ℕ) (margin : Float) (certified : Bool) : Result

                          A top-label assertion with its computed margin and strict-positivity test. The binary64 difference may overflow to infinity even when both endpoints are finite.

                        Instances For

                          One-line rendering of a verification result.

                          Instances For

                            Evaluate a public property against componentwise output bounds.

                            Instances For

                              Complete report returned by trained.verify.

                              • radius : Float

                                Radius of the checked input region around the supplied center tensor.

                              • norm : Norm

                                Norm used to define the checked input region.

                              • property : Property

                                Output property evaluated from the output enclosure.

                              • algorithm : Algorithm

                                Bound-propagation algorithm that produced the enclosure.

                              • bounds : Bounds

                                Output enclosure produced by the selected algorithm.

                              • result : Result

                                Chosen property evaluated from the output enclosure.

                              Instances For
                                def TorchLean.Verification.Report.fromBounds (radius : Float) (bounds : Bounds) (norm : Norm := linf) (property : Property := outputBounds) (algorithm : Algorithm := alphaCrown) :

                                Build a report after checking the radius and consistency of the supplied output bounds.

                                The caller supplies the enclosure guarantee; these checks do not establish it.

                                Instances For

                                  One-line human-readable verification summary.

                                  Instances For

                                    Print the concise verification summary.

                                    Instances For