• 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

    Lookup*

    Set of values associated to a set of keys in an omap.

    Signature
    (lookup* keys map) → vals
    Arguments
    keys — Guard (setp keys).
    map — Guard (mapp map).
    Returns
    vals — Type (setp vals).

    This lifts lookup to sets of keys.

    Definitions and Theorems

    Function: lookup*

    (defun lookup* (keys map)
      (declare (xargs :guard (and (setp keys) (mapp map))))
      (declare (xargs :guard (in* keys map)))
      (let ((__function__ 'lookup*))
        (declare (ignorable __function__))
        (cond ((set::emptyp keys) nil)
              ((mbt (if (assoc (set::head keys) map) t nil))
               (insert (lookup (set::head keys) map)
                       (lookup* (set::tail keys) map)))
              (t (lookup* (set::tail keys) map)))))

    Theorem: setp-of-lookup*

    (defthm setp-of-lookup*
      (b* ((vals (lookup* keys map)))
        (setp vals))
      :rule-classes :rewrite)

    Theorem: lookup*-when-left-emptyp

    (defthm lookup*-when-left-emptyp
      (implies (set::emptyp keys)
               (equal (lookup* keys map) nil))
      :rule-classes (:rewrite :type-prescription))

    Theorem: lookup*-when-right-emptyp

    (defthm lookup*-when-right-emptyp
      (implies (emptyp map)
               (equal (lookup* keys map) nil)))