• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
        • Defun
        • Declare
        • System-utilities
        • Stobj
        • State
        • Mutual-recursion
        • Memoize
        • Mbe
        • Io
        • Defpkg
        • Apply$
        • Loop$
        • Programming-with-state
        • Arrays
        • Characters
        • Time$
        • Defmacro
        • Loop$-primer
        • Fast-alists
        • Defconst
        • Evaluation
        • Guard
        • Equality-variants
        • Compilation
        • Hons
        • ACL2-built-ins
        • Developers-guide
        • System-attachments
        • Advanced-features
        • Set-check-invariant-risk
        • Numbers
        • Efficiency
        • Irrelevant-formals
        • Introduction-to-programming-in-ACL2-for-those-who-know-lisp
        • Redefining-programs
        • Lists
        • Invariant-risk
        • Errors
        • Defabbrev
        • Conses
        • Alists
          • 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
            • Std/alists
            • Fast-alists
            • Alistp
            • Misc/records
            • Remove-assocs
            • Assoc
            • Symbol-alistp
            • Rassoc
            • Remove-assoc
            • Remove1-assoc
            • Alist-map-vals
            • Depgraph
            • Alist-map-keys
            • Put-assoc
            • Strip-cars
            • Pairlis$
            • Strip-cdrs
            • Sublis
            • Acons
            • Eqlable-alistp
            • Assoc-string-equal
            • Alist-to-doublets
            • Character-alistp
            • String-alistp
            • Alist-keys-subsetp
            • R-symbol-alistp
            • R-eqlable-alistp
            • Pairlis
            • Pairlis-x2
            • Pairlis-x1
            • Delete-assoc
          • Set-register-invariant-risk
          • Strings
          • Program-wrapper
          • Get-internal-time
          • Basics
          • Packages
          • Oracle-eval
          • Defmacro-untouchable
          • <<
          • Primitive
          • Revert-world
          • Unmemoize
          • Set-duplicate-keys-action
          • Symbols
          • Def-list-constructor
          • Easy-simplify-term
          • Defiteration
          • Fake-oracle-eval
          • Defopen
          • Sleep
        • Operational-semantics
        • Real
        • Start-here
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
        • Interfacing-tools
      • 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)))