• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
        • Defun
        • Declare
        • System-utilities
        • Stobj
        • State
        • Mutual-recursion
        • Memoize
        • Mbe
        • Io
        • Defpkg
        • Apply$
        • Loop$
        • Programming-with-state
        • Arrays
        • Characters
        • Time$
        • Defmacro
        • Loop$-primer
        • Fast-alists
        • Defconst
        • Evaluation
        • Guard
        • Equality-variants
        • Compilation
        • Hons
        • ACL2-built-ins
          • Let
          • Declare
          • Mbe
          • Apply$
          • Fmt
          • Loop$
          • Return-last
          • Mv-let
          • Df
          • Pseudo-termp
          • Defwarrant
          • Time$
          • Mbt
          • Ec-call
          • Mv-nth
          • Sys-call
          • Msg
          • Er
          • Value-triple
          • O-p
          • Comp
          • Member
          • O<
          • Cw
          • Flet
          • Or
          • Hons
          • Cbd
          • Mv
          • Defbadge
          • Append
          • *ACL2-exports*
          • Comment
            • Eql
            • List
            • Unsigned-byte-p
            • Posp
            • Natp
            • The
            • Nth
            • And
            • Len
            • Time-tracker
            • Term-order
            • True-listp
            • Msgp
            • Booleanp
            • <
            • If
            • Pseudo-term-listp
            • +
            • Not
            • With-global-stobj
            • Bitp
            • Equal
            • Cdr
            • Car
            • String-listp
            • Nat-listp
            • Implies
            • Iff
            • Character-listp
            • Alistp
            • Cons
            • Symbol-listp
            • Macrolet
            • Quote
            • Integerp
            • Consp
            • True-list-listp
            • State-global-let*
            • Compress1
            • Symbolp
            • Stringp
            • *common-lisp-symbols-from-main-lisp-package*
            • Characterp
            • Prog2$
            • *
            • Last-prover-steps
            • Hons-acons
            • Let*
            • Eq
            • With-guard-checking
            • @
            • Length
            • With-local-stobj
            • Hard-error
            • -
            • Zp
            • Search
            • Intersection$
            • Assign
            • Aset1
            • Symbol-name
            • Union$
            • Set-gc-strategy
            • In-tau-intervalp
            • Cons-with-hint
            • Break-on-error
            • Pand
            • Case-match
            • Fast-alist-fork
            • Sys-call+
            • Signed-byte-p
            • ACL2-count
            • Remove-duplicates
            • With-serialize-character
            • Observation
            • Hons-resize
            • Make-tau-interval
            • Logbitp
            • Termp
            • Position
            • Assoc
            • *standard-co*
            • Hons-acons!
            • Update-nth
            • Take
            • Aref1
            • Read-run-time
            • Keywordp
            • Symbol-package-name
            • Symbol-alistp
            • Hons-wash
            • Expt
            • Coerce
            • Get-internal-time
            • Intern
            • Non-exec
            • Case
            • Standard-oi
            • Standard-co
            • Formula
            • Nthcdr
            • Atom
            • Without-evisc
            • Good-bye
            • With-local-state
            • Spec-mv-let
            • Intern-in-package-of-symbol
            • Binary-+
            • <=
            • Ash
            • With-fast-alist
            • Set-difference$
            • Hons-clear
            • Flush-compress
            • Rationalp
            • Por
            • Rassoc
            • Remove-assoc
            • =
            • Pargs
            • Nfix
            • Hons-copy
            • Alphorder
            • Subsetp
            • Logand
            • Remove1-assoc
            • No-duplicatesp
            • Mv-list
            • Canonical-pathname
            • Aset2
            • Floor
            • Serialize-read
            • Random$
            • Fmt-to-comment-window
            • F-put-global
            • Compress2
            • Concatenate
            • Fast-alist-clean
            • Assert$
            • Remove
            • Remove1
            • Intersectp
            • Endp
            • Put-assoc
            • Princ$
            • Primitive
            • Keyword-value-listp
            • True-list-fix
            • Swap-stobjs
            • Integer-listp
            • Illegal
            • Hons-get
            • With-output-lock
            • Setenv$
            • Open-output-channel!
            • Fast-alist-free
            • Er-progn
            • Cw-print-base-radix
            • Reverse
            • Cond
            • Complex
            • Add-to-set
            • Truncate
            • Digit-char-p
            • Code-char
            • Char-code
            • Set-print-case
            • Set-print-base
            • Read-ACL2-oracle
            • Error1
            • Print-object$
            • Plet
            • Integer-length
            • Zip
            • With-live-state
            • Hons-assoc-equal
            • Extend-pathname
            • Logior
            • With-guard-checking-event
            • Term-listp
            • Print-object$+
            • Fmx-cw
            • String
            • Mod
            • In-package
            • Unary--
            • Set-print-radix
            • Resize-list
            • Pkg-witness
            • Revappend
            • Null
            • Term-list-listp
            • Make-fast-alist
            • Header
            • Boole$
            • Subseq
            • With-guard-checking-error-triple
            • /
            • Make-list
            • Logxor
            • Char-upcase
            • Char-downcase
            • Strip-cars
            • Set-fmt-hard-right-margin
            • Make-ord
            • Ifix
            • Fast-alist-free-on-exit
            • F-get-global
            • Aref2
            • Standard-char-p
            • Lognot
            • Last
            • Must-be-equal
            • Integer-range-p
            • Getenv$
            • Binary-append
            • Er-hard
            • Eqlablep
            • Cpu-core-count
            • Boolean-listp
            • Allocate-fixnum-range
            • ACL2-numberp
            • Butlast
            • Pairlis$
            • Mod-expt
            • Hons-equal
            • Gc$
            • Substitute
            • Ceiling
            • With-stolen-alist
            • Mv?-let
            • String-upcase
            • String-downcase
            • Round
            • Count
            • Char
            • Sys-call-status
            • Progn$
            • Pprogn
            • Lexorder
            • Hons-summary
            • Break$
            • Assert*
            • Alpha-char-p
            • Strip-cdrs
            • Serialize-write
            • Keyword-listp
            • Upper-case-p
            • Lower-case-p
            • Logeqv
            • List*
            • Proofs-co
            • Maximum-length
            • Fix
            • Explode-nonnegative-integer
            • Eqlable-listp
            • Dimensions
            • Default
            • Arity
            • Sublis
            • Max
            • Evenp
            • Explode-atom
            • Change
            • Zerop
            • String<
            • String-equal
            • Abs
            • Set-print-base-radix
            • Print-base-p
            • Nonnegative-integer-quotient
            • Intern$
            • Getprop
            • Binary-*
            • Aset1-trusted
            • Symbol<
            • String-append
            • Rfix
            • Mv?
            • Logic-fns-list-listp
            • Fast-alist-fork!
            • Er-hard?
            • Char-equal
            • 1+
            • *standard-oi*
            • Sys-call*
            • Pos-listp
            • Mbt*
            • Hons-wash!
            • Hons-clear!
            • Signum
            • Rem
            • Real/rationalp
            • Rational-listp
            • O-first-coeff
            • Logic-fnsp
            • Logic-fns-listp
            • Hons-copy-persistent
            • Gc-strategy
            • Fast-alist-summary
            • String>=
            • String<=
            • Acons
            • O-first-expt
            • Fast-alist-clean!
            • >=
            • >
            • Subst
            • Logcount
            • Getpropc
            • Evens
            • Er-soft
            • Digit-to-char
            • Comp-gcl
            • Atom-listp
            • Arities-okp
            • ACL2-number-listp
            • /=
            • Cadr
            • *standard-ci*
            • Unary-/
            • The-true-list
            • Realfix
            • O-rst
            • Fast-alist-len
            • Complex/complex-rationalp
            • Array2p
            • Array1p
            • Logtest
            • Logandc1
            • Char<
            • Trace-co
            • Putprop
            • Get-real-time
            • Eqlable-alistp
            • Count-keys
            • Assoc-string-equal
            • Logorc1
            • Logandc2
            • Denominator
            • 1-
            • Packn
            • Logic-termp
            • Logic-term-list-listp
            • Fmt!
            • Fms
            • Cw!
            • Assoc-keyword
            • String>
            • Numerator
            • Logorc2
            • Char>=
            • Update-nth-array
            • The-number
            • Odds
            • Makunbound-global
            • Make-character-list
            • Make
            • List$
            • Int=
            • Get-cpu-time
            • Fmt-to-comment-window!
            • Fms!
            • F-boundp-global
            • Complex-rationalp
            • Alist-to-doublets
            • Access
            • Min
            • Lognor
            • Listp
            • Identity
            • Char>
            • Char<=
            • Zpf
            • Standard-char-listp
            • O-finp
            • Number-subtrees
            • Logic-term-listp
            • Last-cdr
            • Fmt1!
            • Fmt-to-comment-window!+
            • Character-alistp
            • Oddp
            • Minusp
            • Lognand
            • Imagpart
            • Conjugate
            • Xor
            • Unquote
            • String-alistp
            • Packn-pos
            • Maybe-flush-and-compress1
            • Kwote
            • Fmt1
            • Fmt-to-comment-window+
            • Cw-print-base-radix!
            • Alist-keys-subsetp
            • Realpart
            • Plusp
            • First
            • Symbol-name-lst
            • R-symbol-alistp
            • R-eqlable-alistp
            • Fmx
            • Cw!+
            • Cons-subtrees
            • Cons-count-bounded
            • Cddr
            • Caar
            • Proper-consp
            • Kwote-lst
            • Improper-consp
            • Cw+
            • Rest
            • Standard-char-p+
            • Mbe1
            • Caddr
            • Pairlis-x2
            • Pairlis-x1
            • O>=
            • O<=
            • O-infp
            • Merge-sort-lexorder
            • Fix-true-list
            • Cdddr
            • Set-fmt-soft-right-margin
            • Real-listp
            • O>
            • Cddar
            • Cdar
            • Cdadr
            • Cdaar
            • Cadar
            • Caadr
            • Caaar
            • Cadddr
            • Caddar
            • Third
            • Tenth
            • Sixth
            • Seventh
            • Second
            • Ninth
            • Fourth
            • Fifth
            • Eighth
            • Cddddr
            • Cdddar
            • Cddadr
            • Cddaar
            • Cdaddr
            • Cdadar
            • Cdaadr
            • Cdaaar
            • Cadadr
            • Cadaar
            • Caaddr
            • Caadar
            • Caaadr
            • Caaaar
            • Hons-shrink-alist!
            • Hons-shrink-alist
            • Flush-hons-get-hash-table-link
            • Delete-assoc
          • Developers-guide
          • System-attachments
          • Advanced-features
          • Set-check-invariant-risk
          • Numbers
          • Efficiency
          • Irrelevant-formals
          • Introduction-to-programming-in-ACL2-for-those-who-know-lisp
          • Redefining-programs
          • Lists
          • Invariant-risk
          • Errors
          • Defabbrev
          • Conses
          • Alists
          • Set-register-invariant-risk
          • Strings
          • Program-wrapper
          • Get-internal-time
          • Basics
          • Packages
          • Oracle-eval
          • Defmacro-untouchable
          • <<
          • Primitive
          • Revert-world
          • Unmemoize
          • Set-duplicate-keys-action
          • Symbols
          • Def-list-constructor
          • Easy-simplify-term
          • Defiteration
          • Fake-oracle-eval
          • Defopen
          • Sleep
        • Operational-semantics
        • Real
        • Start-here
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Hide
    • ACL2-built-ins

    Comment

    Variant of prog2$ to help debug evaluation failures during proofs

    Semantically, (comment x y) equals y; the value of x is ignored. Thus comment is much like prog2$. However, when you see a call of comment in ACL2 proof output, it will likely be under a call of hide, with information that may be helpful in understanding why the call of hide was inserted. Below we illustrate the various ways in which ACL2 may replace a term tm by (hide (comment "..." tm)). (On occasion you will simply see (hide tm); such cases are not discussed here.)

    Also see hide for further discussion of how to avoid such proof failures, and for how to keep the prover from inserting a comment call under a call of hide.

    Evaluation during rewriting

    Forms:

    (HIDE (COMMENT "Failed attempt to call constrained function <fn>" <term>))
    (HIDE (COMMENT "Failed attempt to call non-executable function <fn>" <term>))

    Consider the following example.

    (defstub f (x) t)
    (defun g (x) (cons (f x) x))
    (defund h (x) (cons x (cdr (g x))))
    (thm (equal (h 3) '(3 . 3)))

    Note that the definition of h is disabled, but its executable-counterpart is not. The proof attempt fails for the thm call, indicating the checkpoint shown below.

    *** Key checkpoint at the top level: ***
    
    Goal'
    (EQUAL
     (HIDE
       (COMMENT "Failed attempt to call constrained function F;
    see :DOC comment"
                (H 3)))
     '(3 . 3))

    The first argument of equal is logically just (h 3). But the comment and hide wrappers are telling us that evaluation of (h 3) failed because it led to a call of the constrained function f. It is easy to see why in this case, by looking at the definitions, where h calls g, which calls f. But more complicated such failures may be difficult to understand without such information. In very complicated cases, one might even want to use the Lisp debugger after designating a break$ call using trace$, like this (here, shown using host Lisp CCL).

    ACL2 !>(trace$ (f :entry (break$)))
     ((F :ENTRY (BREAK$)))
    ACL2 !>(thm (equal (h 3) '(3 . 3)))
    
    > Break: Break
    > While executing: BREAK$, in process listener(1).
    > Type :GO to continue, :POP to abort, :R for a list of available restarts.
    > If continued: Return from BREAK.
    > Type :? for other options.
    1 > :b ; user input to get backtrace
     (262932A0) : 0 (BREAK$) 157
     (262932F0) : 1 (F 3) 141
     (26293338) : 2 (FUNCALL #'#<(:INTERNAL ACL2_*1*_ACL2::G ACL2_*1*_ACL2::G)> 3) 37
     (26293350) : 3 (FUNCALL #'#<(:INTERNAL ACL2_*1*_ACL2::H ACL2_*1*_ACL2::H)> 3) 37
     (26293368) : 4 (RAW-EV-FNCALL H (3) NIL NIL [[.. output elided ..]]

    This output from Lisp is quite low-level, but reading from the bottom up provides the following sequence of events.

    • 4. Call h with argument list (3).
    • 3. Call the executable-counterpart of h.
    • 2. Call the executable-counterpart of g.
    • 1. Attempt to call the constrained function, f.

    An easy way to avoid this proof failure is to avoid execution of calls of h and g, as follows.

    (thm (equal (h 3) '(3 . 3))
         :hints (("Goal" :in-theory (disable (:e g) (:e h)))))

    (It actually suffices to disable only (:e h), but the workings of the ACL2 rewriter are out of scope here.)

    If the offending function (here, f) is introduced as non-executable rather than constrained, in particular if that function is defined using defun-nx or defund-nx, then in the first argument of comment you will see ``non-executable'' instead of ``constrained''.

    Evaluation during substitution

    Form:

    (HIDE
     (COMMENT
      "Failed attempt (during substitution) to call constrained function <fn>;
    see :DOC comment"
      <term>))

    Consider how ACL2 approaches the proof of the non-theorem below.

    (defstub foo (x) t)
    (defund bar (x) (foo x))
    (thm (implies (equal x 3) (equal (bar x) yyy)))

    The prover attacks the thm event by substituting the constant '3 for x, which results in an attempt to evaluate (bar 3). This evaluation fails because bar calls the undefined function foo. The checkpoint is as follows.

    (EQUAL
     (HIDE
      (COMMENT
         "Failed attempt (during substitution) to call constrained function FOO;
    see :DOC comment"
         (BAR 3)))
     YYY)

    Failure to expand using a rule

    Form:

    (HIDE (COMMENT "Unable to expand using the rule <name>;
    see :DOC comment"
                   <term>))

    Consider how ACL2 approaches the proof for the second event below.

    (defthm nth-open (implies (and (consp x) (posp n))
                              (equal (nth n x) (nth (1- n) (cdr x))))
      :rule-classes ((:definition :controller-alist ((nth t t)) :install-body t)))
    (thm (equal (nth i y) zzz)
         :hints (("Goal" :expand (nth i y) :do-not-induct t)))

    The checkpoint is as follows. What happened is that the rule nth-open had a hypothesis that was false when an attempt was made to apply it to the term (nth i y).

    (IMPLIES
     (NOT (CONSP Y))
     (EQUAL
      (HIDE (COMMENT "Unable to expand using the rule NTH-OPEN;
    see :DOC comment"
                     (NTH I Y)))
      ZZZ))

    Failure due to disabled or missing warrants

    Forms:

    (HIDE (COMMENT "Call failed because the rule apply$-<fn> is disabled;
    see :DOC comment"
          <term>))
    (HIDE (COMMENT "Call failed because the warrant for <fn> is not known to be true;
    see :DOC comment"
          <term>))

    The first of these forms may appear when an attempt to evaluate a call of apply$ fails because a necessary warrant is disable)d. The second form may appear when the warrant is not known to be true in the present context, either because it is known to be false or because it cannot be assumed true because forcing is disabled. In the following example, the attempt to simplify the call of apply$ in the theorem ultimately leads to an attempt to evaluate a call of ev$, which ultimately fails because it leads to a call to evaluate (apply$ 'bar '(3)) bar. That call causes an error because the warrant is unavailable since the rule apply$-bar is disabled, hence cannot rewrite a term (apply$ 'bar args) to (bar (car args)).

    (include-book "projects/apply/top" :dir :system)
    (defun$ bar (x) x)
    (thm (implies (warrant bar)
                  (equal (apply$ '(lambda (y) (bar y)) '(3)) 3))
         :hints (("Goal" :in-theory (disable apply$-bar ev$))))

    The checkpoint in the proof for the thm just above is as follows.

    (IMPLIES
     (APPLY$-WARRANT-BAR)
     (EQUAL
      (HIDE
       (COMMENT
          "Call failed because the rule APPLY$-BAR is disabled;
    see :DOC comment"
          (EV$ '(BAR Y) '((Y . 3)))))
      3))

    Similarly, if we instead submit the following event, we see the other such message, in this case about a false warrant.

    (thm (implies (not (warrant bar))
                  (equal (apply$ '(lambda (y) (bar y)) '(3)) 3))
         :hints (("Goal" :in-theory (disable ev$))))

    Here is the resulting checkpoint.

    (IMPLIES
     (NOT (APPLY$-WARRANT-BAR))
     (EQUAL
      (HIDE
       (COMMENT
        "Call failed because the warrant for BAR is not known to be true;
    see :DOC comment"
        (EV$ '(BAR Y) '((Y . 3)))))
      3))

    Our final example illustrates a failure due to forcing being disabled. The use of loop$ in the definition of bar expands to create a call of ev$, which cannot be simplified during the proof of the thm below because the necessary warrant hypothesis is missing and cannot be forced, since forcing is disabled (see also disable-forcing).

    (defun$ hello (x)
       (declare (xargs :guard t))
       (list 'hi x))
    
    (defun bar (lst)
       (declare (xargs :guard (true-listp lst)))
       (loop$ for name in lst collect (hello name))))
    
    (thm (equal (bar '(john))
                '((hi john)))
         :hints (("Goal" :in-theory (disable (:e force)))))

    Here is the resulting checkpoint.

    (EQUAL
     (HIDE
      (COMMENT
       "Call failed because the warrant for HELLO is not known to be true;
    see :DOC comment"
       (EV$ '(RETURN-LAST 'PROGN
                          '(LAMBDA$ (LOOP$-IVAR)
                             (LET ((NAME LOOP$-IVAR))
                               (DECLARE (IGNORABLE NAME))
                               (HELLO NAME)))
                          ((LAMBDA (NAME) (HELLO NAME))
                           LOOP$-IVAR))
            '((LOOP$-IVAR . JOHN)))))
     '(HI JOHN))