• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • 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$
        • Defconst
        • Fast-alists
        • Defmacro
        • Loop$-primer
        • 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
          • Std/alists
            • Alist-keys
            • Remove-assocs
            • Alist-vals
            • Alist-map-vals
            • Alist-map-keys
            • Std/alists/strip-cdrs
            • Hons-rassoc-equal
            • Std/alists/hons-assoc-equal
            • Std/alists/strip-cars
            • Fal-find-any
            • Fal-extract
            • Std/alists/abstract
            • Fal-extract-vals
            • Fal-all-boundp
            • Std/alists/alistp
            • Append-alist-vals
            • Append-alist-keys
            • Alist-equiv
            • Hons-remove-assoc
            • Std/alists/pairlis$
            • Worth-hashing
            • Alists-agree
              • Sub-alistp
              • Alist-fix
              • Std/alists/remove-assoc-equal
              • Std/alists/assoc-equal
            • Fast-alists
            • Alistp
            • Misc/records
            • Assoc
            • Remove-assocs
            • Symbol-alistp
            • Rassoc
            • Remove-assoc
            • Depgraph
            • Remove1-assoc
            • Alist-map-vals
            • 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
        • Miscellaneous
        • Output-controls
        • Bdd
        • Macros
        • Installation
        • Mailing-lists
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Std/alists

    Alists-agree

    (alists-agree keys al1 al2) determines if the alists al1 and al2 agree on the value of every key in keys.

    Definitions and Theorems

    Function: alists-agree

    (defun alists-agree (keys al1 al2)
      "Do AL1 and AL2 agree on the value of every KEY in KEYS?"
      (declare (xargs :guard t))
      (or (atom keys)
          (and (equal (hons-get (car keys) al1)
                      (hons-get (car keys) al2))
               (alists-agree (cdr keys) al1 al2))))

    Theorem: list-equiv-implies-equal-alists-agree-1

    (defthm list-equiv-implies-equal-alists-agree-1
      (implies (list-equiv keys keys-equiv)
               (equal (alists-agree keys al1 al2)
                      (alists-agree keys-equiv al1 al2)))
      :rule-classes (:congruence))

    Theorem: alists-agree-hons-assoc-equal

    (defthm alists-agree-hons-assoc-equal
      (implies (and (alists-agree keys a b)
                    (member-equal x keys))
               (equal (hons-assoc-equal x b)
                      (hons-assoc-equal x a))))

    Theorem: alists-agree-self

    (defthm alists-agree-self
      (alists-agree keys a a))

    Theorem: alists-agree-sym

    (defthm alists-agree-sym
      (implies (alists-agree keys a b)
               (alists-agree keys b a)))

    Function: alists-disagree-witness

    (defun alists-disagree-witness (keys al1 al2)
      (and (consp keys)
           (if (not (equal (hons-get (car keys) al1)
                           (hons-get (car keys) al2)))
               (car keys)
             (alists-disagree-witness (cdr keys)
                                      al1 al2))))

    Theorem: alists-agree-iff-witness

    (defthm alists-agree-iff-witness
      (iff (alists-agree keys al1 al2)
           (let ((x (alists-disagree-witness keys al1 al2)))
             (implies (member-equal x keys)
                      (equal (hons-assoc-equal x al1)
                             (hons-assoc-equal x al2))))))

    Theorem: alists-agree-trans

    (defthm alists-agree-trans
      (implies (and (alists-agree keys x y)
                    (alists-agree keys y z))
               (alists-agree keys x z)))