• 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-result-fix
              • String-result-equiv
              • String-result-ok
              • String-result-err
              • String-resultp
              • String-result-kind
            • String-list-result
            • Nat-result
            • Nat-option-result
            • Nat-list-result
            • Maybe-string-result
            • Integer-result
            • Character-result
            • Character-list-result
            • Boolean-result
            • 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
    • String-result

    String-result-fix

    Fixing function for string-result structures.

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

    Definitions and Theorems

    Function: string-result-fix$inline

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

    Theorem: string-resultp-of-string-result-fix

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

    Theorem: string-result-fix-when-string-resultp

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

    Function: string-result-equiv$inline

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

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

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

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

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

    Theorem: string-result-fix-under-string-result-equiv

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

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

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

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

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

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

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

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

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

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

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

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

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