• 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
              • Expr-priority
              • Expr-priority-<=
              • Combine-dirabsdeclor-into-dirabsdeclor
              • Declor/dirdeclor-rename
                • Dirdeclor-rename
                • Declor-rename
              • Check-decl-spec-list-all-typespec/stoclass
              • Binop-expected-priorities
              • Expr->priority
              • Transunit-at-path
              • Declor/dirdeclor->ident
              • Declor/dirdeclor-has-params-p
              • Check-expr-binary
              • Apply-post-inc/dec-ops
              • Check-spec/qual-list-all-typespec
              • Apply-pre-inc/dec-ops
              • Check-decl-spec-list-all-typespec
              • Expr-to-asg-expr-list
              • Check-expr-mul
              • Expr-unary/postfix/primary-p
              • Transunit-ensemble-paths
              • Check-struni-spec-no-members
              • Expr-postfix/primary-p
              • Dirabsdeclor-declor?-nil-p
              • Check-enum-spec-no-list
              • Expr-zerop
              • Expr-priority->=
              • Decl-spec-list-to-stor-spec-list
              • Spec/qual-list-to-type-spec-list
              • Expr-priority->
              • Expr-priority-<
              • Declor-spec-list-filter-out-linkage-specs
              • Decl-spec-list-to-type-spec-list
              • Ident-list-map-expr-ident
              • Binop->priority
              • Stringlit-list->prefix?-list
              • Declor-spec-list-make-static
              • Binop-strictp
              • Check-expr-iconst
              • Init-declor->ident
              • Check-expr-ident
              • Dirabsdeclor-to-dirdeclor
              • Dirabsdeclor-option-to-dirdeclor
              • Dirdeclor-has-params-p
              • Absdeclor-to-declor
              • Dirdeclor-rename
              • Declor-rename
              • Declor-has-params-p
              • Dirdeclor->ident
              • Declor->ident
            • Implementation-environments
            • Abstract-syntax
            • Concrete-syntax
            • Disambiguation
            • Validation
            • Gcc-builtins
            • 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
  • Abstract-syntax-operations

Declor/dirdeclor-rename

Change the identifier of a declarator or direct declarator.

As noted in declor/dirdeclor->ident, a (direct) declarator always contains one identifier. These two mutually recursive companions change it.

Definitions and Theorems

Function: declor-rename

(defun declor-rename (declor ident)
  (declare (xargs :guard (and (declorp declor) (identp ident))))
  (b* (((declor declor) declor))
    (change-declor declor
                   :direct (dirdeclor-rename declor.direct ident))))

Function: dirdeclor-rename

(defun dirdeclor-rename (dirdeclor ident)
 (declare (xargs :guard (and (dirdeclorp dirdeclor)
                             (identp ident))))
 (dirdeclor-case
      dirdeclor
      :ident (change-dirdeclor-ident dirdeclor
                                     :ident ident)
      :paren (change-dirdeclor-paren
                  dirdeclor
                  :inner (declor-rename dirdeclor.inner ident))
      :array (change-dirdeclor-array
                  dirdeclor
                  :declor (dirdeclor-rename dirdeclor.declor ident))
      :array-static1
      (change-dirdeclor-array-static1
           dirdeclor
           :declor (dirdeclor-rename dirdeclor.declor ident))
      :array-static2
      (change-dirdeclor-array-static2
           dirdeclor
           :declor (dirdeclor-rename dirdeclor.declor ident))
      :array-star
      (change-dirdeclor-array-star
           dirdeclor
           :declor (dirdeclor-rename dirdeclor.declor ident))
      :function-params
      (change-dirdeclor-function-params
           dirdeclor
           :declor (dirdeclor-rename dirdeclor.declor ident))
      :function-names
      (change-dirdeclor-function-names
           dirdeclor
           :declor (dirdeclor-rename dirdeclor.declor ident))))

Theorem: return-type-of-declor-rename.declor$

(defthm return-type-of-declor-rename.declor$
  (b* ((?declor$ (declor-rename declor ident)))
    (declorp declor$))
  :rule-classes :rewrite)

Theorem: return-type-of-dirdeclor-rename.dirdeclor$

(defthm return-type-of-dirdeclor-rename.dirdeclor$
  (b* ((?dirdeclor$ (dirdeclor-rename dirdeclor ident)))
    (dirdeclorp dirdeclor$))
  :rule-classes :rewrite)

Theorem: declor-rename-of-declor-fix-declor

(defthm declor-rename-of-declor-fix-declor
  (equal (declor-rename (declor-fix declor)
                        ident)
         (declor-rename declor ident)))

Theorem: declor-rename-of-ident-fix-ident

(defthm declor-rename-of-ident-fix-ident
  (equal (declor-rename declor (ident-fix ident))
         (declor-rename declor ident)))

Theorem: dirdeclor-rename-of-dirdeclor-fix-dirdeclor

(defthm dirdeclor-rename-of-dirdeclor-fix-dirdeclor
  (equal (dirdeclor-rename (dirdeclor-fix dirdeclor)
                           ident)
         (dirdeclor-rename dirdeclor ident)))

Theorem: dirdeclor-rename-of-ident-fix-ident

(defthm dirdeclor-rename-of-ident-fix-ident
  (equal (dirdeclor-rename dirdeclor (ident-fix ident))
         (dirdeclor-rename dirdeclor ident)))

Theorem: declor-rename-declor-equiv-congruence-on-declor

(defthm declor-rename-declor-equiv-congruence-on-declor
  (implies (declor-equiv declor declor-equiv)
           (equal (declor-rename declor ident)
                  (declor-rename declor-equiv ident)))
  :rule-classes :congruence)

Theorem: declor-rename-ident-equiv-congruence-on-ident

(defthm declor-rename-ident-equiv-congruence-on-ident
  (implies (ident-equiv ident ident-equiv)
           (equal (declor-rename declor ident)
                  (declor-rename declor ident-equiv)))
  :rule-classes :congruence)

Theorem: dirdeclor-rename-dirdeclor-equiv-congruence-on-dirdeclor

(defthm dirdeclor-rename-dirdeclor-equiv-congruence-on-dirdeclor
  (implies (dirdeclor-equiv dirdeclor dirdeclor-equiv)
           (equal (dirdeclor-rename dirdeclor ident)
                  (dirdeclor-rename dirdeclor-equiv ident)))
  :rule-classes :congruence)

Theorem: dirdeclor-rename-ident-equiv-congruence-on-ident

(defthm dirdeclor-rename-ident-equiv-congruence-on-ident
  (implies (ident-equiv ident ident-equiv)
           (equal (dirdeclor-rename dirdeclor ident)
                  (dirdeclor-rename dirdeclor ident-equiv)))
  :rule-classes :congruence)

Subtopics

Dirdeclor-rename
Change the identifier of the direct declarator.
Declor-rename
Change the identifier of the declarator.