• 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

    Lookup

    Value associated to a key in an omap.

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

    Definitions and Theorems

    Function: lookup

    (defun lookup (key map)
      (declare (xargs :guard (mapp map)))
      (declare (xargs :guard (assoc key map)))
      (let ((__function__ 'lookup))
        (declare (ignorable __function__))
        (cdr (assoc key map))))

    Theorem: lookup-when-emptyp

    (defthm lookup-when-emptyp
      (implies (emptyp map)
               (not (lookup key map)))
      :rule-classes (:rewrite :type-prescription))

    Theorem: acl2-count-lookup-<-map

    (defthm acl2-count-lookup-<-map
      (implies (not (emptyp map))
               (< (acl2-count (lookup key map))
                  (acl2-count map))))

    Theorem: lookup-of-tail-when-assoc-tail

    (defthm lookup-of-tail-when-assoc-tail
      (implies (assoc key (tail map))
               (equal (lookup key (tail map))
                      (lookup key map))))

    Theorem: lookup-of-update

    (defthm lookup-of-update
      (equal (lookup key1 (update key val map))
             (if (equal key1 key)
                 val
               (lookup key1 map))))

    Theorem: lookup-of-update*

    (defthm lookup-of-update*
      (equal (lookup key (update* map1 map2))
             (if (assoc key map1)
                 (lookup key map1)
               (lookup key (mfix map2)))))

    Theorem: lookup-of-mfix-map

    (defthm lookup-of-mfix-map
      (equal (lookup key (mfix map))
             (lookup key map)))

    Theorem: lookup-mequiv-congruence-on-map

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