• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
          • Implementation
            • Jenkins-hash
            • Binary-tree
            • Tree-split
            • Heap<
              • Heap<-with-hashes
            • Tree-join
            • Tree-delete
            • Rotations
            • Tree-insert
            • Tree-intersect
            • Tree-join-at
            • Tree-union
            • Hash
            • Tree-in
            • Tree-diff
            • Tree-nodes-count
          • Setp
          • Right
          • Left
          • Head
          • Double-containment
          • Subset
          • Intersect
          • Insert
          • In
          • Delete
          • Union
          • Diff
          • From-list
          • To-list
          • Set-equiv
          • Sfix
          • Pick-a-point
          • Cardinality
          • Set-induct
          • Set-bi-induct
          • Emptyp
        • Soft
        • C
        • Bv
        • Imp-language
        • Event-macros
        • Java
        • Bitcoin
        • Ethereum
        • Yul
        • Zcash
        • ACL2-programming-language
        • Prime-fields
        • Json
        • Syntheto
        • File-io-light
        • Cryptography
        • Number-theory
        • Lists-light
        • Axe
        • Builtins
        • Solidity
        • Helpers
        • Htclient
        • Typed-lists-light
        • Arithmetic-light
      • X86isa
      • Axe
      • Execloader
    • Math
    • Testing-utilities
  • Implementation

Heap<

A total order based on object hashes.

Signature
(heap< x y) → *

This order is determined primarily by the hash values of objects. Since the hashes may collide, we fall back to << when the hashes are equal to ensure the order is total.

The goal of this order is to be largely uncorrelated with <<. Therefore, it is important that the hash function (jenkins-hash) does not collide frequently and exhibits a strong avalanche effect.

Function: heap<$inline

(defun heap<$inline (x y)
  (declare (xargs :type-prescription (booleanp (heap< x y)))
           (optimize (speed 3) (safety 0)))
  (declare (xargs :guard t))
  (let ((hash-x (hash x)) (hash-y (hash y)))
    (declare (type (unsigned-byte 32) hash-x)
             (type (unsigned-byte 32) hash-y))
    (heap<-with-hashes x y hash-x hash-y)))

Macro: heap<

(defmacro heap< (x y)
  (list 'heap<$inline x y))

Subtopics

Heap<-with-hashes
Variant of heap< which uses pre-computed hashes.