• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • C
          • Syntax-for-tools
            • Formalized-subset
            • Mapping-to-language-definition
            • Input-files
            • Compilation-database
            • Printer
            • Output-files
            • Abstract-syntax-operations
            • Implementation-environments
            • Abstract-syntax
            • Concrete-syntax
            • Disambiguation
            • Validation
            • Gcc-builtins
            • Preprocessing
              • Preprocessor
                • Preprocessor-states
                  • Ppstate
                  • Plexeme
                  • Pnumber
                  • Macro-info
                  • Macro-add
                  • Init-ppstate
                  • Plexeme-token/newline-p
                  • Newline
                  • Plexeme-option
                  • Macro-info-option
                  • Macro-table
                    • Macro-table-fix
                      • Macro-table-equiv
                      • Make-macro-table
                      • Macro-table->alist
                      • Change-macro-table
                      • Macro-tablep
                    • Plexeme+span
                    • Update-ppstate->lexemes-unread
                    • Update-ppstate->lexemes-read
                    • Update-ppstate->lexemes-length
                    • Update-ppstate->chars-unread
                    • Update-ppstate->chars-read
                    • Update-ppstate->version
                    • Update-ppstate->position
                    • Update-ppstate->macros
                    • Update-ppstate->chars-length
                    • Macro-lookup
                    • Update-ppstate->bytes
                    • Update-ppstate->size
                    • Plexeme-token/space-p
                    • Plexeme-tokenp
                    • Ppstate->gcc
                    • Plexeme-list-token/space-p
                    • Ppstate->size
                    • Ppstate->lexemes-unread
                    • Ppstate->lexemes-read
                    • Ppstate->lexemes-length
                    • Ppstate->chars-unread
                    • Ppstate->bytes
                    • Plexeme-list-token/newline-p
                    • Plexeme-list-not-token/newline-p
                    • Ident-macroinfo-alist
                    • Update-ppstate->lexeme
                    • Update-ppstate->char
                    • Ppstate->version
                    • Ppstate->macros
                    • Ppstate->chars-read
                    • Ppstate->chars-length
                    • Plexeme-list-tokenp
                    • Plexeme-list-not-tokenp
                    • Macro-table-init
                    • Ppstate->lexeme
                    • Ppstate->char
                    • Ppstate-fix
                    • Plexeme+span-list
                    • Plexeme-list
                    • Irr-pnumber
                    • Irr-plexeme
                    • Irr-macro-table
                    • Ppstate->position
                  • Pread-token/newline
                  • Pread-token
                  • Preprocessor-lexer
                  • Pproc-files
                  • Preprocessor-printer
                  • Pproc-file
                  • Filepath-plexeme-list-alist-to-filepath-filedata-map
                  • Filepath-plexeme-list-alist
                  • Preprocessor-reader
                  • Preprocessor-messages
                • External-preprocessing
              • Parsing
            • Atc
            • Transformation-tools
            • Language
            • Representation
            • Insertion-sort
            • Pack
          • Soft
          • Bv
          • Imp-language
          • Ethereum
          • Event-macros
          • Java
          • Riscv
          • Bitcoin
          • Zcash
          • Yul
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Macro-table

    Macro-table-fix

    Fixing function for macro-table structures.

    Signature
    (macro-table-fix x) → new-x
    Arguments
    x — Guard (macro-tablep x).
    Returns
    new-x — Type (macro-tablep new-x).

    Definitions and Theorems

    Function: macro-table-fix$inline

    (defun macro-table-fix$inline (x)
     (declare (xargs :guard (macro-tablep x)))
     (mbe
       :logic
       (b* ((alist (ident-macroinfo-alist-fix (cdr (std::da-nth 0 x)))))
         (let ((alist (if (no-duplicatesp-equal (strip-cars alist))
                          alist
                        nil)))
           (list (cons 'alist alist))))
       :exec x))

    Theorem: macro-tablep-of-macro-table-fix

    (defthm macro-tablep-of-macro-table-fix
      (b* ((new-x (macro-table-fix$inline x)))
        (macro-tablep new-x))
      :rule-classes :rewrite)

    Theorem: macro-table-fix-when-macro-tablep

    (defthm macro-table-fix-when-macro-tablep
      (implies (macro-tablep x)
               (equal (macro-table-fix x) x)))

    Function: macro-table-equiv$inline

    (defun macro-table-equiv$inline (acl2::x acl2::y)
      (declare (xargs :guard (and (macro-tablep acl2::x)
                                  (macro-tablep acl2::y))))
      (equal (macro-table-fix acl2::x)
             (macro-table-fix acl2::y)))

    Theorem: macro-table-equiv-is-an-equivalence

    (defthm macro-table-equiv-is-an-equivalence
      (and (booleanp (macro-table-equiv x y))
           (macro-table-equiv x x)
           (implies (macro-table-equiv x y)
                    (macro-table-equiv y x))
           (implies (and (macro-table-equiv x y)
                         (macro-table-equiv y z))
                    (macro-table-equiv x z)))
      :rule-classes (:equivalence))

    Theorem: macro-table-equiv-implies-equal-macro-table-fix-1

    (defthm macro-table-equiv-implies-equal-macro-table-fix-1
      (implies (macro-table-equiv acl2::x x-equiv)
               (equal (macro-table-fix acl2::x)
                      (macro-table-fix x-equiv)))
      :rule-classes (:congruence))

    Theorem: macro-table-fix-under-macro-table-equiv

    (defthm macro-table-fix-under-macro-table-equiv
      (macro-table-equiv (macro-table-fix acl2::x)
                         acl2::x)
      :rule-classes (:rewrite :rewrite-quoted-constant))

    Theorem: equal-of-macro-table-fix-1-forward-to-macro-table-equiv

    (defthm equal-of-macro-table-fix-1-forward-to-macro-table-equiv
      (implies (equal (macro-table-fix acl2::x)
                      acl2::y)
               (macro-table-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: equal-of-macro-table-fix-2-forward-to-macro-table-equiv

    (defthm equal-of-macro-table-fix-2-forward-to-macro-table-equiv
      (implies (equal acl2::x (macro-table-fix acl2::y))
               (macro-table-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: macro-table-equiv-of-macro-table-fix-1-forward

    (defthm macro-table-equiv-of-macro-table-fix-1-forward
      (implies (macro-table-equiv (macro-table-fix acl2::x)
                                  acl2::y)
               (macro-table-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: macro-table-equiv-of-macro-table-fix-2-forward

    (defthm macro-table-equiv-of-macro-table-fix-2-forward
      (implies (macro-table-equiv acl2::x (macro-table-fix acl2::y))
               (macro-table-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: macro-table-fix$inline-of-macro-table-fix-x

    (defthm macro-table-fix$inline-of-macro-table-fix-x
      (equal (macro-table-fix$inline (macro-table-fix x))
             (macro-table-fix$inline x)))

    Theorem: macro-table-fix$inline-macro-table-equiv-congruence-on-x

    (defthm macro-table-fix$inline-macro-table-equiv-congruence-on-x
      (implies (macro-table-equiv x x-equiv)
               (equal (macro-table-fix$inline x)
                      (macro-table-fix$inline x-equiv)))
      :rule-classes :congruence)