• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
      • Std/lists
      • Omaps
        • Defomap
        • Update
        • Mapp
        • Assoc
        • Update*
        • From-lists
        • Keys
        • List-lookup
        • Size
        • Compatiblep
        • Submap
        • Tail
        • Restrict
        • Head
          • Update-induction-on-maps
          • Rlookup
          • Lookup
          • List-notin
          • Emptyp
          • Rlookup*
          • Map
          • Lookup*
          • Values
          • List-in
          • Delete*
          • In*
          • Delete
          • From-alist
          • Mfix
          • Head-val
          • Head-key
          • Omap-induction2
          • Omap-order-rules
        • Std/alists
        • Obags
        • Std/util
        • Std/strings
        • Std/osets
        • 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)

    Theorem: head-of-mfix-map

    (defthm head-of-mfix-map
      (equal (head (mfix map)) (head map)))

    Theorem: head-mequiv-congruence-on-map

    (defthm head-mequiv-congruence-on-map
      (implies (mequiv map map-equiv)
               (equal (head map) (head map-equiv)))
      :rule-classes :congruence)