• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Error-checking
        • Apt
        • Abnf
        • Fty-extensions
        • Isar
        • Kestrel-utilities
          • Omaps
            • Defomap
            • Update
            • Mapp
            • Update*
            • In
              • Size
              • From-lists
              • Compatiblep
              • Head
              • Map
              • Submap
              • Rlookup
              • Empty
              • In*
              • Tail
              • Rlookup*
              • Restrict
              • Keys
              • Lookup*
              • Delete*
              • Delete
              • Mfix
              • Lookup
              • Values
              • Head-val
              • Head-key
            • Directed-untranslate
            • Include-book-paths
            • Ubi
            • Digits-any-base
            • Context-message-pair
            • Numbered-names
            • With-auto-termination
            • Make-termination-theorem
            • Theorems-about-true-list-lists
            • Checkpoint-list
            • Sublis-expr+
            • Prove$
            • Defthm<w
            • System-utilities-non-built-in
            • Integer-range-fix
            • Add-const-to-untranslate-preprocess
            • Minimize-ruler-extenders
            • Integers-from-to
            • Unsigned-byte-fix
            • Signed-byte-fix
            • Defthmr
            • Paired-names
            • Unsigned-byte-list-fix
            • Signed-byte-list-fix
            • Show-books
            • List-utilities
            • Skip-in-book
            • Typed-tuplep
            • Checkpoint-list-pretty
            • Defunt
            • Keyword-value-list-to-alist
            • Magic-macroexpand
            • Top-command-number-fn
            • Bits-as-digits-in-base-2
            • Show-checkpoint-list
            • Ubyte11s-as-digits-in-base-2048
            • Named-formulas
            • Bytes-as-digits-in-base-256
            • String-utilities
            • Make-keyword-value-list-from-keys-and-value
            • Defmacroq
            • Integer-range-listp
            • Apply-fn-if-known
            • Trans-eval-error-triple
            • Checkpoint-info-list
            • Previous-subsumer-hints
            • Fms!-lst
            • Zp-listp
            • Trans-eval-state
            • Injections
            • Doublets-to-alist
            • Theorems-about-osets
            • Typed-list-utilities
            • Book-runes-alist
            • User-interface
            • Bits/ubyte11s-digit-grouping
            • Bits/bytes-digit-grouping
            • Message-utilities
            • Subsetp-eq-linear
            • Strict-merge-sort-<
            • Miscellaneous-enumerations
            • Maybe-unquote
            • Oset-utilities
            • Thm<w
            • Defthmd<w
            • Io-utilities
          • Prime-field-constraint-systems
          • Soft
          • Bv
          • Imp-language
          • Event-macros
          • Bitcoin
          • Ethereum
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Java
          • C
          • Syntheto
          • Number-theory
          • Cryptography
          • Lists-light
          • File-io-light
          • Json
          • Built-ins
          • Axe
          • Solidity
          • Std-extensions
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Testing-utilities
      • Math
    • Omaps

    In

    Check if a key is in an omap.

    Signature
    (in key map) → pair?
    Arguments
    map — Guard (mapp map).
    Returns
    pair? — Type (listp pair?).

    If the key is present, return the cons pair with the key. Otherwise, return nil.

    This is similar to set::in for osets.

    Definitions and Theorems

    Function: in

    (defun in (key map)
      (declare (xargs :guard (mapp map)))
      (let ((__function__ 'in))
        (declare (ignorable __function__))
        (cond ((empty map) nil)
              (t (mv-let (key0 val0)
                         (head map)
                   (cond ((equal key key0) (cons key0 val0))
                         (t (in key (tail map)))))))))

    Theorem: listp-of-in

    (defthm listp-of-in
      (b* ((pair? (in key map)))
        (listp pair?))
      :rule-classes :rewrite)

    Theorem: in-of-mfix

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

    Theorem: in-when-empty

    (defthm in-when-empty
      (implies (empty map)
               (equal (in key map) nil))
      :rule-classes (:rewrite :type-prescription))

    Theorem: in-of-head

    (defthm in-of-head
      (iff (in (mv-nth 0 (head map)) map)
           (not (empty map))))

    Theorem: in-when-in-tail

    (defthm in-when-in-tail
      (implies (in key (tail map))
               (in key map)))

    Theorem: acl2-count-in-<-map

    (defthm acl2-count-in-<-map
      (implies (not (empty map))
               (< (acl2-count (in key map))
                  (acl2-count map))))

    Theorem: in-of-update

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

    Theorem: in-of-update*

    (defthm in-of-update*
      (equal (in key (update* map1 map2))
             (or (in key map1) (in key map2))))

    Theorem: update-of-cdr-of-in-when-in

    (defthm update-of-cdr-of-in-when-in
      (implies (in k m)
               (equal (update k (cdr (in k m)) m) m)))

    Theorem: consp-of-in-iff-in

    (defthm consp-of-in-iff-in
      (iff (consp (in key map)) (in key map)))