• 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
          • Normed
          • Hons-note
          • Hons-resize
          • Hons-wash
          • Hons-clear
          • Hons-copy
          • Maybe-wash-memory
          • Hons-equal
            • Hons-equal-lite
          • Hons-summary
          • Hons-equal-lite
          • Hons-sublis
          • Hons-wash!
          • Hons-clear!
          • Hons-copy-persistent
        • ACL2-built-ins
        • 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
  • Hons
  • Equal
  • ACL2-built-ins

Hons-equal

(hons-equal x y) is a recursive equality check that optimizes when parts of its arguments are normed.

In the logic, hons-equal is just equal; we leave it enabled and would think it odd to ever prove a theorem about it.

Under the hood, when hons-equal encounters two arguments that are both normed, it becomes a mere eql check, and hence avoids the overhead of recursively checking large cons structures for equality.

Note. If hons-equal is given arguments that do not contain many normed objects, it can actually be much slower than equal! This is because it checks to see whether its arguments are normed at each recursive step, and so you are repeatedly paying the price of such checks. Also see hons-equal-lite, which only checks at the top level whether its arguments are normed.

Function: hons-equal

(defun hons-equal (x y)
  (declare (xargs :guard t))
  (equal x y))

Subtopics

Hons-equal-lite
(hons-equal-lite x y) is a non-recursive equality check that optimizes if its arguments are normed.