• 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
              • Binary-tree-p
              • Bst<
              • Tree-node-with-hint
              • Bst-p
              • Tree-node
              • Tree-right
              • Tree-pre-order
              • Tree-post-order
              • Tree-in-order
              • Tree-equiv
              • Heapp
                • Tree-left
                • Tree-fix
                • Bst<-all-r
                • Bst<-all-l
                • Heap<-all-l
                • Tree-head
                • Tree-emptyp
                • Binary-tree-listp
                • Tree-induct
              • Tree-split
              • Heap<
              • 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
    • Binary-tree

    Heapp

    Check the max heap property.

    Signature
    (heapp tree) → *
    Arguments
    tree — Guard (binary-tree-p tree).

    Definitions and Theorems

    Function: heapp

    (defun heapp (tree)
      (declare (xargs :guard (binary-tree-p tree)))
      (declare (xargs :type-prescription (booleanp (heapp tree))))
      (let ((__function__ 'heapp))
        (declare (ignorable __function__))
        (or (tree-emptyp tree)
            (mbe :logic
                 (and (heapp (tree-left tree))
                      (heapp (tree-right tree))
                      (heap<-all-l (tree-left tree)
                                   (tree-head tree))
                      (heap<-all-l (tree-right tree)
                                   (tree-head tree)))
                 :exec
                 (b* (((mv heapp -)
                       (fast-nonempty-heapp tree)))
                   heapp)))))