• 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
          • Defbyte
          • Defresult
          • Fold
          • Defsubtype
          • Defset
          • Specific-types
          • Defflatsum
          • Deflist-of-len
          • Pos-list
          • Defbytelist
          • Defomap
          • Defbyte-standard-instances
          • Deffixtype-alias
          • Defbytelist-standard-instances
          • Defunit
          • Byte-list
          • Byte
          • Database
          • Pos-option
          • Nibble
          • Nat-option
          • String-option
          • Byte-list20
          • Byte-list32
          • Byte-list64
          • Pseudo-event-form
          • Natoption/natoptionlist
          • Nati
          • Character-list
          • Nat/natlist
          • Maybe-string
          • Nibble-list
          • Natoption/natoptionlist-result
          • Nat/natlist-result
          • Nat-option-list-result
          • Set
          • String-result
          • String-list-result
          • Nat-result
          • Nat-option-result
          • Nat-list-result
          • Maybe-string-result
          • Integer-result
          • Character-result
          • Character-list-result
          • Boolean-result
            • Boolean-result-fix
              • Boolean-result-equiv
              • Boolean-result-ok
              • Boolean-result-err
              • Boolean-resultp
              • Boolean-result-kind
            • Map
            • Bag
            • Pos-set
            • Hex-digit-char-list
            • Dec-digit-char-list
            • Pseudo-event-form-list
            • Nat-option-list
            • Symbol-set
            • String-set
            • Nat-set
            • Oct-digit-char-list
            • Bin-digit-char-list
            • Bit-list
          • 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
    • Boolean-result

    Boolean-result-fix

    Fixing function for boolean-result structures.

    Signature
    (boolean-result-fix x) → new-x
    Arguments
    x — Guard (boolean-resultp x).
    Returns
    new-x — Type (boolean-resultp new-x).

    Definitions and Theorems

    Function: boolean-result-fix$inline

    (defun boolean-result-fix$inline (x)
      (declare (xargs :guard (boolean-resultp x)))
      (let ((__function__ 'boolean-result-fix))
        (declare (ignorable __function__))
        (mbe :logic
             (case (boolean-result-kind x)
               (:ok (b* ((get (bool-fix x))) get))
               (:err (b* ((get (fty::reserr-fix x))) get)))
             :exec x)))

    Theorem: boolean-resultp-of-boolean-result-fix

    (defthm boolean-resultp-of-boolean-result-fix
      (b* ((new-x (boolean-result-fix$inline x)))
        (boolean-resultp new-x))
      :rule-classes :rewrite)

    Theorem: boolean-result-fix-when-boolean-resultp

    (defthm boolean-result-fix-when-boolean-resultp
      (implies (boolean-resultp x)
               (equal (boolean-result-fix x) x)))

    Function: boolean-result-equiv$inline

    (defun boolean-result-equiv$inline (x y)
      (declare (xargs :guard (and (boolean-resultp x)
                                  (boolean-resultp y))))
      (equal (boolean-result-fix x)
             (boolean-result-fix y)))

    Theorem: boolean-result-equiv-is-an-equivalence

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

    Theorem: boolean-result-equiv-implies-equal-boolean-result-fix-1

    (defthm boolean-result-equiv-implies-equal-boolean-result-fix-1
      (implies (boolean-result-equiv x x-equiv)
               (equal (boolean-result-fix x)
                      (boolean-result-fix x-equiv)))
      :rule-classes (:congruence))

    Theorem: boolean-result-fix-under-boolean-result-equiv

    (defthm boolean-result-fix-under-boolean-result-equiv
      (boolean-result-equiv (boolean-result-fix x)
                            x)
      :rule-classes (:rewrite :rewrite-quoted-constant))

    Theorem: equal-of-boolean-result-fix-1-forward-to-boolean-result-equiv

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

    Theorem: equal-of-boolean-result-fix-2-forward-to-boolean-result-equiv

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

    Theorem: boolean-result-equiv-of-boolean-result-fix-1-forward

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

    Theorem: boolean-result-equiv-of-boolean-result-fix-2-forward

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

    Theorem: boolean-result-kind$inline-of-boolean-result-fix-x

    (defthm boolean-result-kind$inline-of-boolean-result-fix-x
      (equal (boolean-result-kind$inline (boolean-result-fix x))
             (boolean-result-kind$inline x)))

    Theorem: boolean-result-kind$inline-boolean-result-equiv-congruence-on-x

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