• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
      • Std/lists
      • Std/alists
      • Obags
      • Std/util
      • Std/strings
      • Std/osets
        • Omaps
          • Defomap
          • Update
          • Mapp
          • Assoc
          • Update*
          • Size
          • Keys
          • From-lists
          • Update-induction-on-maps
          • Compatiblep
          • Tail
          • Head
            • Restrict
            • Submap
            • Map
            • Rlookup
            • Emptyp
            • Rlookup*
            • Lookup*
            • Delete*
            • Values
            • In*
            • Lookup
            • Delete
            • Mfix
            • Head-val
            • Head-key
            • Omap-induction2
            • Omap-order-rules
          • All-by-membership
          • Defset
          • In
          • Primitives
          • Subset
          • Mergesort
          • Intersect
          • Union
          • Pick-a-point-subset-strategy
          • Delete
          • Double-containment
          • Difference
          • Cardinality
          • Set
          • Intersectp
        • Std/io
        • Std/basic
        • Std/system
        • Std/typed-lists
        • Std/bitsets
        • Std/testing
        • Std/typed-alists
        • Std/stobjs
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Omaps

    Head

    Smallest key, and associated value, of a non-empty omap.

    Signature
    (head map) → (mv key val)
    Arguments
    map — Guard (mapp map).

    This is similar to set::head for osets.

    Definitions and Theorems

    Function: head

    (defun head (map)
      (declare (xargs :guard (mapp map)))
      (declare (xargs :guard (not (emptyp map))))
      (let ((__function__ 'head))
        (declare (ignorable __function__))
        (let ((pair (car (mfix map))))
          (mv (car pair) (cdr pair)))))

    Theorem: head-key-when-emptyp

    (defthm head-key-when-emptyp
      (implies (emptyp map)
               (equal (mv-nth 0 (head map)) nil))
      :rule-classes (:rewrite :type-prescription))

    Theorem: head-value-when-emptyp

    (defthm head-value-when-emptyp
      (implies (emptyp map)
               (equal (mv-nth 1 (head map)) nil))
      :rule-classes (:rewrite :type-prescription))

    Theorem: head-key-count

    (defthm head-key-count
      (implies (not (emptyp map))
               (< (acl2-count (mv-nth 0 (head map)))
                  (acl2-count map)))
      :rule-classes (:rewrite :linear))

    Theorem: head-value-count

    (defthm head-value-count
      (implies (not (emptyp map))
               (< (acl2-count (mv-nth 1 (head map)))
                  (acl2-count map)))
      :rule-classes (:rewrite :linear))

    Theorem: head-key-count-built-in

    (defthm head-key-count-built-in
      (implies (not (emptyp map))
               (o< (acl2-count (mv-nth 0 (head map)))
                   (acl2-count map)))
      :rule-classes :built-in-clause)

    Theorem: head-value-count-built-in

    (defthm head-value-count-built-in
      (implies (not (emptyp map))
               (o< (acl2-count (mv-nth 1 (head map)))
                   (acl2-count map)))
      :rule-classes :built-in-clause)