• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • 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
        • 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
        • Solidity
        • Axe
        • Std-extensions
          • Std/util-extensions
          • Std/basic-extensions
            • Mbt$
            • Organize-symbols-by-pkg
              • Organize-symbols-by-name
              • Good-valuep
              • Symbol-package-name-non-cl
              • Symbol-package-name-lst
              • Good-pseudo-termp
              • Maybe-string-fix
              • Std/basic/if*
              • Std/basic/member-symbol-name
            • Std/strings-extensions
            • Std/system-extensions
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Execloader
        • Axe
      • Testing-utilities
      • Math
    • Std/basic-extensions
    • Std/basic

    Organize-symbols-by-pkg

    Organize a list of symbols by their packages.

    Signature
    (organize-symbols-by-pkg syms) → syms-by-pkg
    Arguments
    syms — Guard (symbol-listp syms).
    Returns
    syms-by-pkg — Type (string-symbollist-alistp syms-by-pkg), given the guard.

    The result is an alist from package names (strings) to the non-empty lists of the symbols that are in the respective packages.

    The alist has unique keys, and each of its values has no duplicates.

    Definitions and Theorems

    Function: organize-symbols-by-pkg-aux

    (defun
     organize-symbols-by-pkg-aux (syms acc)
     (declare (xargs :guard (and (symbol-listp syms)
                                 (string-symbollist-alistp acc))))
     (let
         ((__function__ 'organize-symbols-by-pkg-aux))
         (declare (ignorable __function__))
         (b* (((when (endp syms)) acc)
              (sym (car syms))
              (pkg (symbol-package-name sym))
              (prev-syms-for-pkg (cdr (assoc-equal pkg acc))))
             (organize-symbols-by-pkg-aux
                  (cdr syms)
                  (put-assoc-equal pkg
                                   (add-to-set-eq sym prev-syms-for-pkg)
                                   acc)))))

    Theorem: string-symbollist-alistp-of-organize-symbols-by-pkg-aux

    (defthm
     string-symbollist-alistp-of-organize-symbols-by-pkg-aux
     (implies (and (symbol-listp syms)
                   (string-symbollist-alistp acc))
              (b* ((syms-by-pkg (organize-symbols-by-pkg-aux syms acc)))
                  (string-symbollist-alistp syms-by-pkg)))
     :rule-classes :rewrite)

    Function: organize-symbols-by-pkg

    (defun organize-symbols-by-pkg (syms)
           (declare (xargs :guard (symbol-listp syms)))
           (let ((__function__ 'organize-symbols-by-pkg))
                (declare (ignorable __function__))
                (organize-symbols-by-pkg-aux syms nil)))

    Theorem: string-symbollist-alistp-of-organize-symbols-by-pkg

    (defthm string-symbollist-alistp-of-organize-symbols-by-pkg
            (implies (and (symbol-listp syms))
                     (b* ((syms-by-pkg (organize-symbols-by-pkg syms)))
                         (string-symbollist-alistp syms-by-pkg)))
            :rule-classes :rewrite)