• 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

    Compatiblep

    Check if two omaps are compatible, in the sense that they map their common keys to the same values.

    Signature
    (compatiblep map1 map2) → yes/no
    Arguments
    map1 — Guard (mapp map1).
    map2 — Guard (mapp map2).
    Returns
    yes/no — Type (booleanp yes/no).

    This definition is not optimal for execution. The compatibility of two omaps can be checked by linearly scanning through them in order. A future version of this operation should have that definition, at least for execution.

    Definitions and Theorems

    Function: compatiblep

    (defun compatiblep (map1 map2)
      (declare (xargs :guard (and (mapp map1) (mapp map2))))
      (let ((__function__ 'compatiblep))
        (declare (ignorable __function__))
        (cond ((emptyp map1) t)
              ((mv-let (key1 val1)
                       (head map1)
                 (let ((pair2 (assoc key1 map2)))
                   (and pair2 (not (equal val1 (cdr pair2))))))
               nil)
              (t (compatiblep (tail map1) map2)))))

    Theorem: booleanp-of-compatiblep

    (defthm booleanp-of-compatiblep
      (b* ((yes/no (compatiblep map1 map2)))
        (booleanp yes/no))
      :rule-classes :rewrite)

    Theorem: compatiblep-when-left-emptyp

    (defthm compatiblep-when-left-emptyp
      (implies (emptyp map1)
               (compatiblep map1 map2)))

    Theorem: compatiblep-when-right-emptyp

    (defthm compatiblep-when-right-emptyp
      (implies (emptyp map2)
               (compatiblep map1 map2)))

    Theorem: compatiblep-of-mfix-map1

    (defthm compatiblep-of-mfix-map1
      (equal (compatiblep (mfix map1) map2)
             (compatiblep map1 map2)))

    Theorem: compatiblep-mequiv-congruence-on-map1

    (defthm compatiblep-mequiv-congruence-on-map1
      (implies (mequiv map1 map1-equiv)
               (equal (compatiblep map1 map2)
                      (compatiblep map1-equiv map2)))
      :rule-classes :congruence)

    Theorem: compatiblep-of-mfix-map2

    (defthm compatiblep-of-mfix-map2
      (equal (compatiblep map1 (mfix map2))
             (compatiblep map1 map2)))

    Theorem: compatiblep-mequiv-congruence-on-map2

    (defthm compatiblep-mequiv-congruence-on-map2
      (implies (mequiv map2 map2-equiv)
               (equal (compatiblep map1 map2)
                      (compatiblep map1 map2-equiv)))
      :rule-classes :congruence)