• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • 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
        • Soft
        • C
          • Syntax-for-tools
          • Atc
          • Language
            • Abstract-syntax
              • Tyspecseq
              • Expr
              • Binop
              • Fileset
              • Obj-declor
              • Ident
              • Iconst
              • Obj-adeclor
              • Const
              • Fundef
              • Unop
              • File
              • Tag-declon
              • Fun-declor
              • Obj-declon
              • Iconst-length
              • Abstract-syntax-operations
              • Label
                • Label-case
                • Label-fix
                  • Label-equiv
                  • Labelp
                  • Label-name
                  • Label-cas
                  • Label-default
                  • Label-kind
                • Struct-declon
                • Initer
                • Ext-declon
                • Fun-adeclor
                • Expr-option
                • Iconst-base
                • Initer-option
                • Iconst-option
                • Tyspecseq-option
                • Stmt-option
                • Scspecseq
                • Param-declon
                • Obj-declon-option
                • File-option
                • Tyname
                • Transunit
                • Fun-declon
                • Transunit-result
                • Param-declon-list
                • Struct-declon-list
                • Expr-list
                • Tyspecseq-list
                • Ident-set
                • Ident-list
                • Ext-declon-list
                • Unop-list
                • Tyname-list
                • Fundef-list
                • Fun-declon-list
                • Binop-list
                • Stmt-fixtypes
                • Expr-fixtypes
              • Integer-ranges
              • Implementation-environments
              • Dynamic-semantics
              • Static-semantics
              • Grammar
              • Integer-formats
              • Types
              • Portable-ascii-identifiers
              • Values
              • Integer-operations
              • Computation-states
              • Object-designators
              • Operations
              • Errors
              • Tag-environments
              • Function-environments
              • Character-sets
              • Flexible-array-member-removal
              • Arithmetic-operations
              • Pointer-operations
              • Bytes
              • Keywords
              • Real-operations
              • Array-operations
              • Scalar-operations
              • Structure-operations
            • Representation
            • Transformation-tools
            • Insertion-sort
            • Pack
          • Bv
          • Imp-language
          • Event-macros
          • Java
          • Bitcoin
          • Ethereum
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Label

    Label-fix

    Fixing function for label structures.

    Signature
    (label-fix x) → new-x
    Arguments
    x — Guard (labelp x).
    Returns
    new-x — Type (labelp new-x).

    Definitions and Theorems

    Function: label-fix$inline

    (defun label-fix$inline (x)
      (declare (xargs :guard (labelp x)))
      (let ((__function__ 'label-fix))
        (declare (ignorable __function__))
        (mbe :logic
             (case (label-kind x)
               (:name (b* ((get (ident-fix (std::da-nth 0 (cdr x)))))
                        (cons :name (list get))))
               (:cas (b* ((get (expr-fix (std::da-nth 0 (cdr x)))))
                       (cons :cas (list get))))
               (:default (cons :default (list))))
             :exec x)))

    Theorem: labelp-of-label-fix

    (defthm labelp-of-label-fix
      (b* ((new-x (label-fix$inline x)))
        (labelp new-x))
      :rule-classes :rewrite)

    Theorem: label-fix-when-labelp

    (defthm label-fix-when-labelp
      (implies (labelp x)
               (equal (label-fix x) x)))

    Function: label-equiv$inline

    (defun label-equiv$inline (acl2::x acl2::y)
      (declare (xargs :guard (and (labelp acl2::x)
                                  (labelp acl2::y))))
      (equal (label-fix acl2::x)
             (label-fix acl2::y)))

    Theorem: label-equiv-is-an-equivalence

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

    Theorem: label-equiv-implies-equal-label-fix-1

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

    Theorem: label-fix-under-label-equiv

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

    Theorem: equal-of-label-fix-1-forward-to-label-equiv

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

    Theorem: equal-of-label-fix-2-forward-to-label-equiv

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

    Theorem: label-equiv-of-label-fix-1-forward

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

    Theorem: label-equiv-of-label-fix-2-forward

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

    Theorem: label-kind$inline-of-label-fix-x

    (defthm label-kind$inline-of-label-fix-x
      (equal (label-kind$inline (label-fix x))
             (label-kind$inline x)))

    Theorem: label-kind$inline-label-equiv-congruence-on-x

    (defthm label-kind$inline-label-equiv-congruence-on-x
      (implies (label-equiv x x-equiv)
               (equal (label-kind$inline x)
                      (label-kind$inline x-equiv)))
      :rule-classes :congruence)

    Theorem: consp-of-label-fix

    (defthm consp-of-label-fix
      (consp (label-fix x))
      :rule-classes :type-prescription)