• 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
        • Bv
        • Imp-language
        • Event-macros
        • Java
        • Bitcoin
        • Ethereum
        • Yul
          • Transformations
          • Language
            • Abstract-syntax
              • Escape
              • Swcase-list->value-list
              • Hex-digit-list->chars
              • Fundef-list->name-list
              • Literal
                • Literal-fix
                  • Literal-case
                  • Literalp
                  • Literal-equiv
                  • Literal-plain-string
                  • Literal-hex-string
                  • Literal-hex-number
                  • Literal-boolean
                  • Literal-dec-number
                  • Literal-kind
                • Path
                • Hex-string-rest-element
                • Plain-string
                • String-element
                • Hex-string-content-option
                • Hex-string-content
                • Identifier
                • Funcall-option
                • Expression-option
                • Statement-option
                • Literal-option
                • Identifier-option
                • Hex-string
                • Hex-quad
                • Hex-digit
                • Hex-pair
                • Data-value
                • Data-item
                • Statements-to-fundefs
                • String-element-list-result
                • Identifier-identifier-map-result
                • Swcase-result
                • String-element-result
                • Statement-result
                • Literal-result
                • Identifier-set-result
                • Identifier-result
                • Identifier-list-result
                • Fundef-result
                • Funcall-result
                • Expression-result
                • Escape-result
                • Path-result
                • Block-result
                • Objects
                • Statements/blocks/cases/fundefs
                • Identifier-list
                • Identifier-set
                • Identifier-identifier-map
                • Identifier-identifier-alist
                • Hex-string-rest-element-list
                • String-element-list
                • Path-list
                • Hex-digit-list
                • Literal-list
                • Fundef-list
                • Expressions/funcalls
                • Abstract-syntax-induction-schemas
              • Dynamic-semantics
              • Concrete-syntax
              • Static-soundness
              • Static-semantics
              • Errors
            • Yul-json
          • 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
    • Literal

    Literal-fix

    Fixing function for literal structures.

    Signature
    (literal-fix x) → new-x
    Arguments
    x — Guard (literalp x).
    Returns
    new-x — Type (literalp new-x).

    Definitions and Theorems

    Function: literal-fix$inline

    (defun literal-fix$inline (x)
     (declare (xargs :guard (literalp x)))
     (let ((__function__ 'literal-fix))
      (declare (ignorable __function__))
      (mbe
        :logic
        (case (literal-kind x)
          (:boolean (b* ((get (acl2::bool-fix (std::da-nth 0 (cdr x)))))
                      (cons :boolean (list get))))
          (:dec-number (b* ((get (nfix (std::da-nth 0 (cdr x)))))
                         (cons :dec-number (list get))))
          (:hex-number
               (b* ((get (hex-digit-list-fix (std::da-nth 0 (cdr x)))))
                 (cons :hex-number (list get))))
          (:plain-string
               (b* ((get (plain-string-fix (std::da-nth 0 (cdr x)))))
                 (cons :plain-string (list get))))
          (:hex-string
               (b* ((get (hex-string-fix (std::da-nth 0 (cdr x)))))
                 (cons :hex-string (list get)))))
        :exec x)))

    Theorem: literalp-of-literal-fix

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

    Theorem: literal-fix-when-literalp

    (defthm literal-fix-when-literalp
      (implies (literalp x)
               (equal (literal-fix x) x)))

    Function: literal-equiv$inline

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

    Theorem: literal-equiv-is-an-equivalence

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

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

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

    Theorem: literal-fix-under-literal-equiv

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

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

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

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

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

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

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

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

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

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

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

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

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

    Theorem: consp-of-literal-fix

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