• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
      • Vwsim
      • Fgl
      • Vl
        • Syntax
        • Loader
        • Warnings
        • Getting-started
        • Utilities
          • Name-database
          • Vl-gc
          • Symbol-list-names
          • Ints-from
          • Nats-from
          • Make-lookup-alist
          • Redundant-mergesort
          • Longest-common-prefix
          • Vl-remove-keys
          • Vl-plural-p
          • Vl-merge-contiguous-indices
          • Sum-nats
          • Vl-edition-p
          • Vl-maybe-integer-listp
          • Fast-memberp
          • Nat-listp
          • Max-nats
          • Longest-common-prefix-list
          • Character-list-listp
          • Vl-character-list-list-values-p
          • Remove-from-alist
            • Prefix-of-eachp
            • Vl-string-keys-p
            • Vl-maybe-nat-listp
            • Vl-string-list-values-p
            • String-list-listp
            • Vl-string-values-p
            • Explode-list
            • True-list-listp
            • Symbol-list-listp
            • All-have-len
            • Pos-listp
            • Min-nats
            • Debuggable-and
            • Vl-starname
            • Remove-equal-without-guard
            • String-fix
            • Anyp
            • Vl-maybe-string-list
            • Longer-than-p
            • Fast-alist-free-each-alist-val
            • Not*
            • Free-list-of-fast-alists
            • *nls*
          • Printer
          • Kit
          • Mlib
          • Transforms
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Testing-utilities
      • Math
    • Utilities

    Remove-from-alist

    (remove-from-alist key alist) removes all bindings for key from alist.

    Signature
    (remove-from-alist key alist) → ans
    Arguments
    alist — Guard (alistp alist).
    Returns
    ans — Type (alistp ans), given the guard.

    Definitions and Theorems

    Function: remove-from-alist

    (defun remove-from-alist (key alist)
           (declare (xargs :guard (alistp alist)))
           (let ((__function__ 'remove-from-alist))
                (declare (ignorable __function__))
                (cond ((atom alist) nil)
                      ((equal key (caar alist))
                       (remove-from-alist key (cdr alist)))
                      (t (cons (car alist)
                               (remove-from-alist key (cdr alist)))))))

    Theorem: alistp-of-remove-from-alist

    (defthm alistp-of-remove-from-alist
            (implies (and (force (alistp alist)))
                     (b* ((ans (remove-from-alist key alist)))
                         (alistp ans)))
            :rule-classes :rewrite)

    Theorem: remove-from-alist-when-not-consp

    (defthm remove-from-alist-when-not-consp
            (implies (not (consp alist))
                     (equal (remove-from-alist key alist)
                            nil)))

    Theorem: remove-from-alist-of-cons

    (defthm remove-from-alist-of-cons
            (equal (remove-from-alist key (cons a x))
                   (if (equal key (car a))
                       (remove-from-alist key x)
                       (cons a (remove-from-alist key x)))))