• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
          • Command-error
            • Command-error-p
            • Command-error-fix
              • Command-error-case
              • Command-error-kind
              • Command-error-equiv
              • Command-error-wrong-number-of-arguments
              • Command-error-address-key-index-too-large
              • Command-error-wrong-command
              • Command-error-malformed-value
              • Command-error-malformed-to
              • Command-error-malformed-passphrase
              • Command-error-malformed-nonce
              • Command-error-malformed-mnemonic
              • Command-error-malformed-gas-price
              • Command-error-malformed-gas-limit
              • Command-error-malformed-entropy
              • Command-error-malformed-data
              • Command-error-malformed-address-key-index
              • Command-error-address-key-index-skipped
              • Command-error-address-key-derivation-fail
              • Command-error-transaction-sign-fail
              • Command-error-transaction-rlp-fail
              • Command-error-state-file-untestable
              • Command-error-state-file-present
              • Command-error-state-file-not-regular
              • Command-error-state-file-malformed
              • Command-error-state-file-absent
              • Command-error-root-key-derivation-fail
              • Command-error-purpose-key-derivation-fail
              • Command-error-pretransaction-rlp-fail
              • Command-error-no-command
              • Command-error-external-chain-key-derivation-fail
              • Command-error-coin-type-key-derivation-fail
              • Command-error-address-key-index-limit
              • Command-error-account-key-derivation-fail
            • Sign
            • Init-from-mnemonic
            • Command-error-message
            • Stat
            • Next-key
            • Init-from-entropy
            • Process-command
            • Transaction-message
            • Maybe-command-error
            • Maybe-stat
            • Check-stat-file-present
            • Valid-key-path-p
            • String-to-byte-list
            • Load-stat
            • Mnemonic-message
            • Process-sign
            • Process-init-from-entropy
            • All-valid-key-paths-p
            • String-to-word
            • String-to-nat
            • Process-next-key
            • Wallet
            • Process-init-from-mnemonic
            • Check-stat-file-absent
            • Stat-wfp
            • Save-stat
            • Stat-addresses-bounded-p
            • Stat-all-valid-key-paths-p
            • Stat-priv-keys-p
            • Stat-root-depth-zero-p
            • Stat-path-prefix-in-tree-p
            • Crypto-hdwallet-executable
            • *stat-filepath*
            • *key-path-prefix*
            • *coin-type-index*
            • *purpose-index*
            • *external-chain-index*
            • *command-name-init-from-mnemonic*
            • *command-name-init-from-entropy*
            • *account-index*
            • *command-name-sign*
            • *command-name-next-key*
          • Apt
          • Error-checking
          • Fty-extensions
          • Isar
          • Kestrel-utilities
          • Set
          • Soft
          • C
          • 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
    • Command-error

    Command-error-fix

    Fixing function for command-error structures.

    Signature
    (command-error-fix x) → new-x
    Arguments
    x — Guard (command-error-p x).
    Returns
    new-x — Type (command-error-p new-x).

    Definitions and Theorems

    Function: command-error-fix$inline

    (defun command-error-fix$inline (x)
     (declare (xargs :guard (command-error-p x)))
     (let ((__function__ 'command-error-fix))
      (declare (ignorable __function__))
      (mbe
       :logic
       (case (command-error-kind x)
        (:malformed-mnemonic
             (b* ((mnemonic (acl2::str-fix (std::da-nth 0 (cdr x)))))
               (cons :malformed-mnemonic (list mnemonic))))
        (:malformed-passphrase
             (b* ((passphrase (acl2::str-fix (std::da-nth 0 (cdr x)))))
               (cons :malformed-passphrase (list passphrase))))
        (:malformed-entropy
             (b* ((entropy (acl2::str-fix (std::da-nth 0 (cdr x)))))
               (cons :malformed-entropy (list entropy))))
        (:malformed-nonce
             (b* ((nonce (acl2::str-fix (std::da-nth 0 (cdr x)))))
               (cons :malformed-nonce (list nonce))))
        (:malformed-gas-price
             (b* ((gas-price (acl2::str-fix (std::da-nth 0 (cdr x)))))
               (cons :malformed-gas-price (list gas-price))))
        (:malformed-gas-limit
             (b* ((gas-limit (acl2::str-fix (std::da-nth 0 (cdr x)))))
               (cons :malformed-gas-limit (list gas-limit))))
        (:malformed-to
             (b* ((to (acl2::str-fix (std::da-nth 0 (cdr x)))))
               (cons :malformed-to (list to))))
        (:malformed-value
             (b* ((value (acl2::str-fix (std::da-nth 0 (cdr x)))))
               (cons :malformed-value (list value))))
        (:malformed-data
             (b* ((data (acl2::str-fix (std::da-nth 0 (cdr x)))))
               (cons :malformed-data (list data))))
        (:malformed-address-key-index
         (b*
          ((address-key-index (acl2::str-fix (std::da-nth 0 (cdr x)))))
          (cons :malformed-address-key-index (list address-key-index))))
        (:address-key-index-too-large
             (b* ((address-key-index (nfix (std::da-nth 0 (cdr x))))
                  (limit (nfix (std::da-nth 1 (cdr x)))))
               (cons :address-key-index-too-large
                     (list address-key-index limit))))
        (:address-key-index-skipped
          (b* ((address-key-index (nfix (std::da-nth 0 (cdr x)))))
            (cons :address-key-index-skipped (list address-key-index))))
        (:root-key-derivation-fail
             (cons :root-key-derivation-fail (list)))
        (:purpose-key-derivation-fail
             (cons :purpose-key-derivation-fail (list)))
        (:coin-type-key-derivation-fail
             (cons :coin-type-key-derivation-fail (list)))
        (:account-key-derivation-fail
             (cons :account-key-derivation-fail (list)))
        (:external-chain-key-derivation-fail
             (cons :external-chain-key-derivation-fail (list)))
        (:address-key-derivation-fail
         (b* ((address-key-index (nfix (std::da-nth 0 (cdr x)))))
          (cons :address-key-derivation-fail (list address-key-index))))
        (:address-key-index-limit
             (cons :address-key-index-limit (list)))
        (:pretransaction-rlp-fail
             (cons :pretransaction-rlp-fail (list)))
        (:transaction-sign-fail (cons :transaction-sign-fail (list)))
        (:transaction-rlp-fail (cons :transaction-rlp-fail (list)))
        (:state-file-untestable (cons :state-file-untestable (list)))
        (:state-file-absent (cons :state-file-absent (list)))
        (:state-file-present (cons :state-file-present (list)))
        (:state-file-not-regular (cons :state-file-not-regular (list)))
        (:state-file-malformed (cons :state-file-malformed (list)))
        (:wrong-number-of-arguments
             (b* ((required (nfix (std::da-nth 0 (cdr x))))
                  (given (nfix (std::da-nth 1 (cdr x)))))
               (cons :wrong-number-of-arguments (list required given))))
        (:wrong-command
             (b* ((command (acl2::str-fix (std::da-nth 0 (cdr x)))))
               (cons :wrong-command (list command))))
        (:no-command (cons :no-command (list))))
       :exec x)))

    Theorem: command-error-p-of-command-error-fix

    (defthm command-error-p-of-command-error-fix
      (b* ((new-x (command-error-fix$inline x)))
        (command-error-p new-x))
      :rule-classes :rewrite)

    Theorem: command-error-fix-when-command-error-p

    (defthm command-error-fix-when-command-error-p
      (implies (command-error-p x)
               (equal (command-error-fix x) x)))

    Function: command-error-equiv$inline

    (defun command-error-equiv$inline (acl2::x acl2::y)
      (declare (xargs :guard (and (command-error-p acl2::x)
                                  (command-error-p acl2::y))))
      (equal (command-error-fix acl2::x)
             (command-error-fix acl2::y)))

    Theorem: command-error-equiv-is-an-equivalence

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

    Theorem: command-error-equiv-implies-equal-command-error-fix-1

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

    Theorem: command-error-fix-under-command-error-equiv

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

    Theorem: equal-of-command-error-fix-1-forward-to-command-error-equiv

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

    Theorem: equal-of-command-error-fix-2-forward-to-command-error-equiv

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

    Theorem: command-error-equiv-of-command-error-fix-1-forward

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

    Theorem: command-error-equiv-of-command-error-fix-2-forward

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

    Theorem: command-error-kind$inline-of-command-error-fix-x

    (defthm command-error-kind$inline-of-command-error-fix-x
      (equal (command-error-kind$inline (command-error-fix x))
             (command-error-kind$inline x)))

    Theorem: command-error-kind$inline-command-error-equiv-congruence-on-x

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

    Theorem: consp-of-command-error-fix

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