• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
      • Vwsim
      • Fgl
      • Vl
        • Syntax
        • Loader
        • Warnings
        • Getting-started
        • Utilities
          • Name-database
          • Vl-gc
          • Symbol-list-names
          • Ints-from
          • Nats-from
          • Make-lookup-alist
          • Redundant-mergesort
          • Longest-common-prefix
          • Vl-remove-keys
          • Vl-plural-p
          • Vl-merge-contiguous-indices
          • Sum-nats
          • Vl-edition-p
          • Vl-maybe-integer-listp
          • Fast-memberp
          • Nat-listp
          • Max-nats
          • Longest-common-prefix-list
          • Character-list-listp
          • Vl-character-list-list-values-p
          • Remove-from-alist
          • Prefix-of-eachp
          • Vl-string-keys-p
          • Vl-maybe-nat-listp
          • Vl-string-list-values-p
          • String-list-listp
          • Vl-string-values-p
          • Explode-list
          • True-list-listp
          • Symbol-list-listp
          • All-have-len
          • Pos-listp
          • Min-nats
            • Debuggable-and
            • Vl-starname
            • Remove-equal-without-guard
            • String-fix
            • Anyp
            • Vl-maybe-string-list
            • Longer-than-p
            • Fast-alist-free-each-alist-val
            • Not*
            • Free-list-of-fast-alists
            • *nls*
          • Printer
          • Kit
          • Mlib
          • Transforms
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Testing-utilities
      • Math
    • Utilities

    Min-nats

    Minimum member in a list of naturals.

    Signature
    (min-nats x) → *
    Arguments
    x — Guard (nat-listp x).

    Typically you would only use this on non-empty lists, but as a reasonable default we say the minimum of the empty list is 0.

    Definitions and Theorems

    Function: min-nats

    (defun min-nats (x)
           (declare (xargs :guard (nat-listp x)))
           (let ((__function__ 'min-nats))
                (declare (ignorable __function__))
                (cond ((atom x) 0)
                      ((atom (cdr x)) (lnfix (car x)))
                      (t (min (lnfix (car x))
                              (min-nats (cdr x)))))))

    Theorem: natp-of-min-nats

    (defthm natp-of-min-nats (natp (min-nats x))
            :rule-classes :type-prescription)

    Theorem: min-nats-bound

    (defthm min-nats-bound
            (implies (consp x)
                     (<= (min-nats x) (max-nats x)))
            :rule-classes ((:rewrite) (:linear)))