• 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
              • Abstract-syntax-trees
                • Expr
                • Type-spec
                • Exprs/decls/stmts
                • Binop
                • Stmt
                • Unop
                • Amb-expr/tyname
                • Dirdeclor
                • Asm-stmt
                • Dec/oct/hex-const
                  • Dec/oct/hex-const-fix
                    • Dec/oct/hex-const-case
                    • Dec/oct/hex-const-equiv
                    • Dec/oct/hex-constp
                    • Dec/oct/hex-const-hex
                    • Dec/oct/hex-const-oct
                    • Dec/oct/hex-const-dec
                    • Dec/oct/hex-const-kind
                  • Simple-escape
                  • Fsuffix
                  • Ident
                  • Attrib
                  • Amb-declon/stmt
                  • Dirabsdeclor
                  • Type-qual
                  • Fundef
                  • Decl-spec
                  • Struct-declon
                  • Asm-name-spec
                  • Amb-declor/absdeclor
                  • Struni-spec
                  • Param-declor
                  • Declor
                  • Stor-spec
                  • Transunit-ensemble
                  • Init-declor
                  • Absdeclor
                  • Tyname
                  • Keyword-uscores
                  • Label
                  • Align-spec
                  • Expr-option
                  • Attrib-name
                  • Spec/qual
                  • Lsuffix
                  • Hex-frac-const
                  • Desiniter
                  • Param-declon
                  • Iconst
                  • Dirabsdeclor-option
                  • Dec-frac-const
                  • Dec-core-fconst
                  • Comp-stmt
                  • Ext-declon
                  • Const-expr-option
                  • Amb?-declor/absdeclor
                  • Isuffix
                  • Hex-core-fconst
                  • Attrib-spec
                  • Struct-declor
                  • Escape
                  • Declon
                  • Amb?-expr/tyname
                  • Initer
                  • Ident-option
                  • Enum-spec
                  • Block-item
                  • Bexpo
                  • Absdeclor-option
                  • Statassert
                  • Member-designor
                  • Initer-option
                  • Declor-option
                  • Const
                  • Hex-quad
                  • Eprefix
                  • Const-expr
                  • Oct-escape
                  • Inc/dec-op
                  • Fun-spec
                  • Dexpo
                  • Cprefix-option
                  • Asm-name-spec-option
                  • Amb?-declon/stmt
                  • S-char
                  • Isuffix-option
                  • Genassoc
                  • Fsuffix-option
                  • Fconst
                  • Eprefix-option
                  • Dexpo-option
                  • Cprefix
                  • C-char
                  • Type-spec-option
                  • Sign-option
                  • Sign
                  • Q-char
                  • Iconst-option
                  • H-char
                  • Fundef-option
                  • Asm-output
                  • Asm-input
                  • Designor
                  • Const-option
                  • Usuffix
                  • Univ-char-name
                  • Hprefix
                  • Enumer
                  • Transunit
                  • Asm-qual
                  • Typequal/attribspec
                  • Stringlit
                  • Dexprefix
                  • Bexprefix
                  • Header-name
                  • Cconst
                  • Expr/tyname
                  • Declor/absdeclor
                  • Declon/stmt
                  • Asm-clobber
                  • Typequal/attribspec-list
                  • Decl-spec-list
                  • Stringlit-list
                  • Spec/qual-list
                  • Inc/dec-op-list
                  • Desiniter-list
                  • Attrib-spec-list
                  • S-char-list
                  • Q-char-list
                  • Param-declon-list
                  • H-char-list
                  • Declon-list
                  • C-char-list
                  • Typequal/attribspec-list-list
                  • Struct-declor-list
                  • Struct-declon-list
                  • Init-declor-list
                  • Genassoc-list
                  • Ext-declon-list
                  • Block-item-list
                  • Ident-list
                  • Enumer-list
                  • Filepath-transunit-map
                  • Expr-list
                  • Asm-qual-list
                  • Asm-output-list
                  • Asm-input-list
                  • Asm-clobber-list
                  • Type-spec-list
                  • Stor-spec-list
                  • Ident-set
                  • Ident-option-set
                  • Ident-list-list
                  • Eprefix-option-list
                  • Designor-list
                  • Attrib-list
                • Abstract-syntax-irrelevants
                • Type-specifier-lists
                • Ascii-identifiers
                • Abstraction-mapping
                • Standard
                • Storage-specifier-lists
                • Code-ensembles
                • Purity
                • Make-self-code-ensemble
              • 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
    • Dec/oct/hex-const

    Dec/oct/hex-const-fix

    Fixing function for dec/oct/hex-const structures.

    Signature
    (dec/oct/hex-const-fix x) → new-x
    Arguments
    x — Guard (dec/oct/hex-constp x).
    Returns
    new-x — Type (dec/oct/hex-constp new-x).

    Definitions and Theorems

    Function: dec/oct/hex-const-fix$inline

    (defun dec/oct/hex-const-fix$inline (x)
     (declare (xargs :guard (dec/oct/hex-constp x)))
     (mbe
      :logic
      (case (dec/oct/hex-const-kind x)
       (:dec (b* ((value (pos-fix (cdr x))))
               (cons :dec value)))
       (:oct (b* ((leading-zeros (pos-fix (car (cdr x))))
                  (value (nfix (cdr (cdr x)))))
               (cons :oct (cons leading-zeros value))))
       (:hex (b* ((prefix (hprefix-fix (car (cdr x))))
                  (digits (str::hex-digit-char-list-fix (cdr (cdr x)))))
               (cons :hex (cons prefix digits)))))
      :exec x))

    Theorem: dec/oct/hex-constp-of-dec/oct/hex-const-fix

    (defthm dec/oct/hex-constp-of-dec/oct/hex-const-fix
      (b* ((new-x (dec/oct/hex-const-fix$inline x)))
        (dec/oct/hex-constp new-x))
      :rule-classes :rewrite)

    Theorem: dec/oct/hex-const-fix-when-dec/oct/hex-constp

    (defthm dec/oct/hex-const-fix-when-dec/oct/hex-constp
      (implies (dec/oct/hex-constp x)
               (equal (dec/oct/hex-const-fix x) x)))

    Function: dec/oct/hex-const-equiv$inline

    (defun dec/oct/hex-const-equiv$inline (acl2::x acl2::y)
      (declare (xargs :guard (and (dec/oct/hex-constp acl2::x)
                                  (dec/oct/hex-constp acl2::y))))
      (equal (dec/oct/hex-const-fix acl2::x)
             (dec/oct/hex-const-fix acl2::y)))

    Theorem: dec/oct/hex-const-equiv-is-an-equivalence

    (defthm dec/oct/hex-const-equiv-is-an-equivalence
      (and (booleanp (dec/oct/hex-const-equiv x y))
           (dec/oct/hex-const-equiv x x)
           (implies (dec/oct/hex-const-equiv x y)
                    (dec/oct/hex-const-equiv y x))
           (implies (and (dec/oct/hex-const-equiv x y)
                         (dec/oct/hex-const-equiv y z))
                    (dec/oct/hex-const-equiv x z)))
      :rule-classes (:equivalence))

    Theorem: dec/oct/hex-const-equiv-implies-equal-dec/oct/hex-const-fix-1

    (defthm
          dec/oct/hex-const-equiv-implies-equal-dec/oct/hex-const-fix-1
      (implies (dec/oct/hex-const-equiv acl2::x x-equiv)
               (equal (dec/oct/hex-const-fix acl2::x)
                      (dec/oct/hex-const-fix x-equiv)))
      :rule-classes (:congruence))

    Theorem: dec/oct/hex-const-fix-under-dec/oct/hex-const-equiv

    (defthm dec/oct/hex-const-fix-under-dec/oct/hex-const-equiv
      (dec/oct/hex-const-equiv (dec/oct/hex-const-fix acl2::x)
                               acl2::x)
      :rule-classes (:rewrite :rewrite-quoted-constant))

    Theorem: equal-of-dec/oct/hex-const-fix-1-forward-to-dec/oct/hex-const-equiv

    (defthm
     equal-of-dec/oct/hex-const-fix-1-forward-to-dec/oct/hex-const-equiv
     (implies (equal (dec/oct/hex-const-fix acl2::x)
                     acl2::y)
              (dec/oct/hex-const-equiv acl2::x acl2::y))
     :rule-classes :forward-chaining)

    Theorem: equal-of-dec/oct/hex-const-fix-2-forward-to-dec/oct/hex-const-equiv

    (defthm
     equal-of-dec/oct/hex-const-fix-2-forward-to-dec/oct/hex-const-equiv
     (implies (equal acl2::x (dec/oct/hex-const-fix acl2::y))
              (dec/oct/hex-const-equiv acl2::x acl2::y))
     :rule-classes :forward-chaining)

    Theorem: dec/oct/hex-const-equiv-of-dec/oct/hex-const-fix-1-forward

    (defthm dec/oct/hex-const-equiv-of-dec/oct/hex-const-fix-1-forward
      (implies (dec/oct/hex-const-equiv (dec/oct/hex-const-fix acl2::x)
                                        acl2::y)
               (dec/oct/hex-const-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: dec/oct/hex-const-equiv-of-dec/oct/hex-const-fix-2-forward

    (defthm dec/oct/hex-const-equiv-of-dec/oct/hex-const-fix-2-forward
     (implies
       (dec/oct/hex-const-equiv acl2::x (dec/oct/hex-const-fix acl2::y))
       (dec/oct/hex-const-equiv acl2::x acl2::y))
     :rule-classes :forward-chaining)

    Theorem: dec/oct/hex-const-kind$inline-of-dec/oct/hex-const-fix-x

    (defthm dec/oct/hex-const-kind$inline-of-dec/oct/hex-const-fix-x
      (equal (dec/oct/hex-const-kind$inline (dec/oct/hex-const-fix x))
             (dec/oct/hex-const-kind$inline x)))

    Theorem: dec/oct/hex-const-kind$inline-dec/oct/hex-const-equiv-congruence-on-x

    (defthm
     dec/oct/hex-const-kind$inline-dec/oct/hex-const-equiv-congruence-on-x
     (implies (dec/oct/hex-const-equiv x x-equiv)
              (equal (dec/oct/hex-const-kind$inline x)
                     (dec/oct/hex-const-kind$inline x-equiv)))
     :rule-classes :congruence)

    Theorem: consp-of-dec/oct/hex-const-fix

    (defthm consp-of-dec/oct/hex-const-fix
      (consp (dec/oct/hex-const-fix x))
      :rule-classes :type-prescription)

    Theorem: dec/oct/hex-const-fix$inline-of-dec/oct/hex-const-fix-x

    (defthm dec/oct/hex-const-fix$inline-of-dec/oct/hex-const-fix-x
      (equal (dec/oct/hex-const-fix$inline (dec/oct/hex-const-fix x))
             (dec/oct/hex-const-fix$inline x)))

    Theorem: dec/oct/hex-const-fix$inline-dec/oct/hex-const-equiv-congruence-on-x

    (defthm
     dec/oct/hex-const-fix$inline-dec/oct/hex-const-equiv-congruence-on-x
     (implies (dec/oct/hex-const-equiv x x-equiv)
              (equal (dec/oct/hex-const-fix$inline x)
                     (dec/oct/hex-const-fix$inline x-equiv)))
     :rule-classes :congruence)