• 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
          • Sign
          • Init-from-mnemonic
          • Command-error-message
          • Stat
          • Next-key
          • Init-from-entropy
          • Process-command
          • Transaction-message
          • Maybe-command-error
          • Maybe-stat
            • Maybe-stat-fix
              • Maybe-stat-case
              • Maybe-stat-equiv
              • Maybe-stat-some
              • Maybe-stat-none
              • Maybe-statp
            • 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
    • Maybe-stat

    Maybe-stat-fix

    Fixing function for maybe-stat structures.

    Signature
    (maybe-stat-fix x) → new-x
    Arguments
    x — Guard (maybe-statp x).
    Returns
    new-x — Type (maybe-statp new-x).

    Definitions and Theorems

    Function: maybe-stat-fix$inline

    (defun maybe-stat-fix$inline (x)
      (declare (xargs :guard (maybe-statp x)))
      (let ((__function__ 'maybe-stat-fix))
        (declare (ignorable __function__))
        (mbe :logic (cond ((not x) nil)
                          (t (b* ((fty::val (stat-fix x)))
                               fty::val)))
             :exec x)))

    Theorem: maybe-statp-of-maybe-stat-fix

    (defthm maybe-statp-of-maybe-stat-fix
      (b* ((new-x (maybe-stat-fix$inline x)))
        (maybe-statp new-x))
      :rule-classes :rewrite)

    Theorem: maybe-stat-fix-when-maybe-statp

    (defthm maybe-stat-fix-when-maybe-statp
      (implies (maybe-statp x)
               (equal (maybe-stat-fix x) x)))

    Function: maybe-stat-equiv$inline

    (defun maybe-stat-equiv$inline (acl2::x acl2::y)
      (declare (xargs :guard (and (maybe-statp acl2::x)
                                  (maybe-statp acl2::y))))
      (equal (maybe-stat-fix acl2::x)
             (maybe-stat-fix acl2::y)))

    Theorem: maybe-stat-equiv-is-an-equivalence

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

    Theorem: maybe-stat-equiv-implies-equal-maybe-stat-fix-1

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

    Theorem: maybe-stat-fix-under-maybe-stat-equiv

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

    Theorem: equal-of-maybe-stat-fix-1-forward-to-maybe-stat-equiv

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

    Theorem: equal-of-maybe-stat-fix-2-forward-to-maybe-stat-equiv

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

    Theorem: maybe-stat-equiv-of-maybe-stat-fix-1-forward

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

    Theorem: maybe-stat-equiv-of-maybe-stat-fix-2-forward

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