• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
        • Warnings
        • Primitives
        • Use-set
        • Syntax
        • Getting-started
        • Utilities
          • Name-database
          • Vl-gc
          • Make-lookup-alist
          • Symbol-list-names
          • Html-encoding
          • Nats-from
          • Redundant-mergesort
          • Longest-common-prefix
          • Vl-edition-p
          • Nat-listp
          • Vl-plural-p
          • Vl-remove-keys
          • Sum-nats
          • Vl-maybe-nat-listp
          • Url-encoding
          • Fast-memberp
          • Vl-string-keys-p
          • Max-nats
          • Longest-common-prefix-list
          • Character-list-listp
          • Vl-string-list-values-p
          • Vl-character-list-list-values-p
          • Remove-from-alist
          • Prefix-of-eachp
          • Vl-maybe-string-listp
          • Pos-listp
          • Vl-string-values-p
          • String-list-listp
          • True-list-listp
          • Symbol-list-listp
          • Explode-list
          • All-have-len
          • Min-nats
          • Debuggable-and
            • Vl-starname
            • Remove-equal-without-guard
            • String-fix
            • Longer-than-p
            • Clean-alist
            • Anyp
            • Or*
            • Fast-alist-free-each-alist-val
            • And*
            • Not*
            • Free-list-of-fast-alists
            • *nls*
          • Loader
          • Transforms
          • Lint
          • Mlib
          • Server
          • Kit
          • Printer
          • Esim-vl
          • Well-formedness
        • Sv
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Utilities

    Debuggable-and

    Alternative to and that prints a message where it fails.

    (debuggable-and ...) is the same as (and ...), but prints a message when any of the conjuncts fails. For instance,

    VL !>(debuggable-and (natp 3)
                         (symbolp 'foo)
                         (consp 4)
                         (symbolp 'bar))
    Debuggable-and failure: (CONSP 4).
    NIL
    VL !>

    This can be useful when writing unit tests, checking guards, etc.

    Definitions and Theorems

    Function: debuggable-and-fn

    (defun debuggable-and-fn (args)
     (cond
      ((atom args) t)
      (t
       (cons
        'and
        (cons
         (cons
          'or
          (cons
            (car args)
            (cons (cons 'cw
                        (cons '"Debuggable-and failure: ~x0.~%"
                              (cons (cons 'quote (cons (car args) 'nil))
                                    'nil)))
                  'nil)))
         (cons (debuggable-and-fn (cdr args))
               'nil))))))