• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
      • Ipasir
      • Aignet
      • Aig
      • Satlink
      • Truth
      • Ubdds
        • Equal-by-eval-bdds
          • Equal-by-eval-bdds-hint-heavy
          • Term-is-bdd
          • Equal-by-eval-bdds-hint
          • Max-depth
          • Ubdd-constructors
          • Eval-bdd
          • Ubddp
          • Ubdd-fix
          • Q-sat
          • Bdd-sat-dfs
          • Eval-bdd-list
          • Qcdr
          • Qcar
          • Q-sat-any
          • Canonicalize-to-q-ite
          • Ubdd-listp
          • Qcons
        • Bdd
        • Faig
        • Bed
        • 4v
      • Projects
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Equal-by-eval-bdds

    Max-depth

    Depth of a cons tree.

    Definitions and Theorems

    Function: max-depth

    (defun max-depth (x)
           (declare (xargs :guard t))
           (if (atom x)
               0
               (1+ (max (max-depth (car x))
                        (max-depth (cdr x))))))

    Function: max-depth-memoize-condition

    (defun max-depth-memoize-condition (x)
           (declare (ignorable x)
                    (xargs :guard 't))
           (consp x))