• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
      • B*
      • Defunc
      • Fty
        • Deftagsum
        • Defprod
        • Defflexsum
        • Defbitstruct
        • Deflist
        • Defalist
        • Defbyte
        • Deffixequiv
        • Defresult
        • Deffixtype
        • Defoption
        • Fty-discipline
        • Fold
        • 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
          • Defsubtype
          • Defset
          • Deftypes
          • Specific-types
          • Defflatsum
          • Deflist-of-len
          • Defbytelist
          • Fty::basetypes
          • Defomap
          • Defvisitors
          • Deffixtype-alias
          • Deffixequiv-sk
          • Defunit
          • Multicase
          • Deffixequiv-mutual
          • Fty::baselists
          • Def-enumcase
          • Defmap
        • Apt
        • Std/util
        • Defdata
        • Defrstobj
        • Seq
        • Match-tree
        • Defrstobj
        • With-supporters
        • Def-partial-measure
        • Template-subst
        • Soft
        • Defthm-domain
        • Event-macros
        • Def-universal-equiv
        • Def-saved-obligs
        • With-supporters-after
        • Definec
        • Sig
        • Outer-local
        • Data-structures
      • ACL2
        • Theories
        • Rule-classes
        • Proof-builder
        • Recursion-and-induction
        • Hons-and-memoization
        • Events
        • Parallelism
        • History
        • Programming
        • Operational-semantics
        • Real
        • Start-here
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
          • Make-event
          • Defmacro
          • Untranslate-patterns
          • Tc
          • Trans*
          • Macro-aliases-table
          • Macro-args
          • Defabbrev
          • User-defined-functions-table
          • Trans
          • Untranslate-for-execution
          • Add-macro-fn
          • Check-vars-not-free
          • Safe-mode
          • Macro-libraries
            • B*
            • Defunc
            • Fty
              • Deftagsum
              • Defprod
              • Defflexsum
              • Defbitstruct
              • Deflist
              • Defalist
              • Defbyte
              • Deffixequiv
              • Defresult
              • Deffixtype
              • Defoption
              • Fty-discipline
              • Fold
              • 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
                • Defsubtype
                • Defset
                • Deftypes
                • Specific-types
                • Defflatsum
                • Deflist-of-len
                • Defbytelist
                • Fty::basetypes
                • Defomap
                • Defvisitors
                • Deffixtype-alias
                • Deffixequiv-sk
                • Defunit
                • Multicase
                • Deffixequiv-mutual
                • Fty::baselists
                • Def-enumcase
                • Defmap
              • Apt
              • Std/util
              • Defdata
              • Defrstobj
              • Seq
              • Match-tree
              • Defrstobj
              • With-supporters
              • Def-partial-measure
              • Template-subst
              • Soft
              • Defthm-domain
              • Event-macros
              • Def-universal-equiv
              • Def-saved-obligs
              • With-supporters-after
              • Definec
              • Sig
              • Outer-local
              • Data-structures
            • Trans1
            • Defmacro-untouchable
            • Set-duplicate-keys-action
            • Add-macro-alias
            • Magic-macroexpand
            • Defmacroq
            • Trans!
            • Remove-macro-fn
            • Remove-macro-alias
            • Add-binop
            • Untrans-table
            • Trans*-
            • Remove-binop
            • Tcp
            • Tca
          • Interfacing-tools
        • Interfacing-tools
        • Hardware-verification
        • Software-verification
        • 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)