• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • ACL2
    • Macro-libraries
    • 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
            • Atc-implementation
              • Atc-abstract-syntax
              • Atc-pretty-printer
              • Atc-event-and-code-generation
              • Fty-pseudo-term-utilities
              • Atc-term-recognizers
              • Atc-input-processing
              • Atc-shallow-embedding
                • Defstruct
                • Defobject
                  • Defobject-implementation
                    • Defobject-info
                    • Defobject-gen-everything
                    • Defobject-process-name
                    • Defobject-info-option
                    • Defobject-term-to-expr
                    • Term-checkers-common
                    • Defobject-process-init
                    • Defobject-process-init-term
                      • Defobject-table-record-event
                      • Defobject-process-type
                      • Defobject-process-inputs
                      • Defobject-table-lookup
                      • Defobject-process-init-terms
                      • Defobject-process-inputs-and-gen-everything
                      • Defobject-fn
                      • Defobject-table-definition
                      • *defobject-table*
                      • Defobject-macro-definition
                  • Atc-let-designations
                  • Pointer-types
                  • Atc-conditional-expressions
                • Atc-process-inputs-and-gen-everything
                • Atc-table
                • Atc-fn
                • Atc-pretty-printing-options
                • Atc-types
                • Atc-macro-definition
              • Atc-tutorial
            • Language
            • 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
    • Defobject-implementation

    Defobject-process-init-term

    Process a term that is the :init input or an element of :init input.

    Signature
    (defobject-process-init-term term required-type wrld) 
      → 
    (mv erp expr)
    Arguments
    required-type — Guard (typep required-type).
    wrld — Guard (plist-worldp wrld).
    Returns
    expr — An exprp.

    We translate the term. We check whether it has the form required in the user documentation, and whether it has the right type, which is passed as argument. We return the expression represented by the term, if all the checks succeed.

    Definitions and Theorems

    Function: defobject-process-init-term

    (defun defobject-process-init-term (term required-type wrld)
     (declare (xargs :guard (and (typep required-type)
                                 (plist-worldp wrld))))
     (let ((__function__ 'defobject-process-init-term))
      (declare (ignorable __function__))
      (b*
       (((reterr) (irr-expr))
        ((mv term/msg stobjs-out)
         (acl2::check-user-term term wrld))
        ((unless (pseudo-termp term/msg))
         (reterr
          (msg
           "The initializer term ~x0 must be an untranslated term.  ~
                          ~@1"
           term term/msg)))
        ((unless (equal stobjs-out (list nil)))
         (reterr
          (msg
           "The initializer term ~x0 must return ~
                          a single non-stobj value, ~
                          but it returns ~x1 instead."
           term stobjs-out)))
        ((erp expr type)
         (defobject-term-to-expr term/msg))
        ((unless (equal type required-type))
         (reterr
          (msg
           "The initializer term ~x0 has type ~x1, ~
                          which does not match the required type ~x2."
           term type required-type))))
       (retok expr))))