• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • Proof-checker-array
      • 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
        • Farray
        • Rp-rewriter
        • Instant-runoff-voting
        • Imp-language
        • Sidekick
        • Leftist-trees
        • Java
        • Taspi
        • Bitcoin
        • Riscv
        • Des
        • Ethereum
        • X86isa
        • Sha-2
        • Yul
        • Zcash
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Bigmems
        • Builtins
        • Execloader
        • Aleo
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Defobject-implementation

    Defobject-process-init

    Process the :init input.

    Signature
    (defobject-process-init init type wrld) → (mv erp initer?)
    Arguments
    type — Guard (typep type).
    wrld — Guard (plist-worldp wrld).
    Returns
    initer? — An initer-optionp.

    We ensure that it is either nil, or a single term that appropriately represents an expression if the type is an integer type, or a non-empty list of terms that appropriately represent expressions if the type is an integer array type; in the last case, the length of the list must match the (positive) size of the array type.

    Definitions and Theorems

    Function: defobject-process-init

    (defun defobject-process-init (init type wrld)
     (declare (xargs :guard (and (typep type) (plist-worldp wrld))))
     (let ((__function__ 'defobject-process-init))
      (declare (ignorable __function__))
      (b* (((reterr) (irr-initer))
           ((when (null init)) (retok nil)))
       (cond
        ((type-integerp type)
         (b* (((erp expr)
               (defobject-process-init-term init type wrld)))
           (retok (initer-single expr))))
        ((type-case type :array)
         (b*
          (((unless (true-listp init))
            (reterr
             (msg
              "Since the object's type is ~x0, ~
                                   the :INIT input must be a list, ~
                                   but it is ~x0 instead."
              type init)))
           (elemtype (type-array->of type))
           (size (type-array->size type))
           ((unless (equal (len init) size))
            (reterr
             (msg
              "The number ~x0 of elements of the :INIT input ~
                            must match the size ~x1 of the array ~
                            specified by the :TYPE input."
              (len init)
              size)))
           ((erp exprs)
            (defobject-process-init-terms init elemtype wrld)))
          (retok (initer-list exprs))))
        (t (reterr (raise "Internal error: type ~x0." type)))))))