• 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
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
          • Syntax-for-tools
          • Atc
          • Language
            • Abstract-syntax
            • Integer-ranges
            • Implementation-environments
            • Dynamic-semantics
            • Static-semantics
            • Grammar
            • Integer-formats
            • Types
            • Portable-ascii-identifiers
            • Values
            • Integer-operations
            • Computation-states
            • Object-designators
            • Operations
            • Errors
              • Error
              • Defresult
              • Boolean-result
              • Defresult-fn
              • Tag-environments
              • Function-environments
              • Character-sets
              • Flexible-array-member-removal
              • Arithmetic-operations
              • Pointer-operations
              • Bytes
              • Keywords
              • Real-operations
              • Array-operations
              • Scalar-operations
              • Structure-operations
            • Representation
            • Transformation-tools
            • Insertion-sort
            • Pack
          • 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
    • Errors

    Defresult-fn

    Signature
    (defresult-fn type desc name enable wrld) → event
    Arguments
    wrld — Guard (plist-worldp wrld).

    Definitions and Theorems

    Function: defresult-fn

    (defun defresult-fn (type desc name enable wrld)
     (declare (xargs :guard (plist-worldp wrld)))
     (let ((__function__ 'defresult-fn))
      (declare (ignorable __function__))
      (b* ((fty-table (fty::get-fixtypes-alist wrld))
           (fty-info (fty::find-fixtype type fty-table))
           (typep (fty::fixtype->pred fty-info))
           (name (or name type))
           (name-result (add-suffix name "-RESULT"))
           (name-resultp (add-suffix name "-RESULTP"))
           (short (str::cat "Fixtype of " desc " and errors."))
           (typep-when-name-resultp-and-not-errorp
                (packn-pos (list typep '-when-
                                 name-resultp '-and-not-errorp)
                           name)))
       (cons
        'encapsulate
        (cons
         'nil
         (cons
          (cons
           'fty::defflatsum
           (cons
            name-result
            (cons
             ':short
             (cons
              short
              (cons
               (cons ':ok (cons type 'nil))
               (cons
                '(:err error)
                (cons
                 ':pred
                 (cons
                  name-resultp
                  (and
                   enable
                   (cons
                    ':prepwork
                    (cons
                     (cons
                      (cons
                       'defrulel
                       (cons
                        'disjoint
                        (cons
                         (cons
                          'implies
                          (cons
                              '(errorp x)
                              (cons (cons 'not
                                          (cons (cons typep '(x)) 'nil))
                                    'nil)))
                         (cons ':enable (cons enable 'nil)))))
                      'nil)
                     'nil)))))))))))
          (cons
           (cons
            'defruled
            (cons typep-when-name-resultp-and-not-errorp
                  (cons (cons 'implies
                              (cons (cons 'and
                                          (cons (cons name-resultp '(x))
                                                '((not (errorp x)))))
                                    (cons (cons typep '(x)) 'nil)))
                        (cons ':enable
                              (cons name-resultp 'nil)))))
           'nil)))))))