• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • 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
        • C
          • Syntax-for-tools
          • Atc
            • Atc-implementation
              • Atc-abstract-syntax
              • Atc-pretty-printer
              • Atc-event-and-code-generation
                • Atc-symbolic-computation-states
                • Atc-symbolic-execution-rules
                • Atc-gen-ext-declon-lists
                • Atc-function-and-loop-generation
                  • Atc-gen-cfun-correct-thm
                  • Atc-typed-formals
                  • Atc-gen-outer-bindings-and-hyps
                  • Atc-gen-fundef
                  • Atc-gen-exec-stmt-while-for-loop
                  • Atc-gen-context-preamble
                  • Atc-gen-pop-frame-thm
                  • Atc-gen-loop-correct-thm
                  • Atc-gen-loop-body-correct-thm
                  • Atc-gen-init-scope-thms
                  • Atc-gen-fun-correct-thm
                  • Atc-gen-fn-result-thm
                  • Atc-gen-loop
                  • Atc-gen-loop-test-correct-thm
                  • Atc-check-guard-conjunct
                  • Atc-find-affected
                  • Atc-gen-cfun-final-compustate
                  • Atc-gen-init-inscope-auto
                  • Atc-gen-init-inscope-static
                  • Atc-gen-push-init-thm
                  • Atc-gen-loop-measure-fn
                  • Atc-gen-fun-endstate
                  • Atc-gen-loop-termination-thm
                  • Atc-gen-formal-thm
                  • Atc-gen-loop-final-compustate
                  • Atc-gen-loop-measure-thm
                  • Atc-gen-object-disjoint-hyps
                  • Atc-loop-body-term-subst
                  • Atc-gen-omap-update-formals
                  • Atc-gen-loop-tthm-formula
                  • Atc-gen-init-inscope
                  • Atc-gen-fn-def*
                  • Atc-gen-param-declon-list
                    • Atc-formal-affectablep
                    • Atc-gen-cfun-fun-env-thm
                    • Atc-gen-add-var-formals
                    • Atc-gen-cfun-fun-env-thm-name
                    • Atc-gen-fn-guard
                    • Atc-filter-exec-fun-args
                    • Atc-gen-context-preamble-aux-aux
                    • Atc-typed-formals-to-extobjs
                    • Atc-formal-affectable-listp
                  • Atc-statement-generation
                  • Atc-gen-fileset
                  • Atc-gen-everything
                  • Atc-gen-obj-declon
                  • Atc-gen-fileset-event
                  • Atc-tag-tables
                  • Atc-expression-generation
                  • Atc-generation-contexts
                  • Atc-gen-wf-thm
                  • Term-checkers-atc
                  • Atc-variable-tables
                  • Term-checkers-common
                  • Atc-gen-init-fun-env-thm
                  • Atc-gen-appconds
                  • Read-write-variables
                  • Atc-gen-thm-assert-events
                  • Test*
                  • Atc-gen-prog-const
                  • Atc-gen-expr-bool
                  • Atc-theorem-generation
                  • Atc-tag-generation
                  • Atc-gen-expr-pure
                  • Atc-function-tables
                  • Atc-object-tables
                • Fty-pseudo-term-utilities
                • Atc-term-recognizers
                • Atc-input-processing
                • Atc-shallow-embedding
                • Atc-process-inputs-and-gen-everything
                • Atc-table
                • Atc-fn
                • Atc-pretty-printing-options
                • Atc-types
                • Atc-macro-definition
              • Atc-tutorial
              • Pure-expression-execution
            • Transformation-tools
            • Language
            • Representation
            • Insertion-sort
            • Pack
          • Soft
          • Bv
          • Imp-language
          • Ethereum
          • Event-macros
          • Java
          • Riscv
          • Bitcoin
          • Zcash
          • Yul
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Atc-function-and-loop-generation

    Atc-gen-param-declon-list

    Generate a list of C parameter declarations from a list of ACL2 formal parameters.

    Signature
    (atc-gen-param-declon-list typed-formals fn prec-objs) 
      → 
    (mv erp params)
    Arguments
    typed-formals — Guard (atc-symbol-varinfo-alistp typed-formals).
    fn — Guard (symbolp fn).
    prec-objs — Guard (atc-string-objinfo-alistp prec-objs).
    Returns
    params — Type (param-declon-listp params).

    The ACL2 formal parameters are actually passed as an alist, from the formals to their information, as calculated by atc-typed-formals.

    We check that the name of each parameter is a portable C identifier, and distinct from the names of the other parameters.

    If a parameter represents an access to an external object, we skip it, i.e. we do not generate a declaration for it.

    Definitions and Theorems

    Function: atc-gen-param-declon-list

    (defun atc-gen-param-declon-list (typed-formals fn prec-objs)
     (declare
          (xargs :guard (and (atc-symbol-varinfo-alistp typed-formals)
                             (symbolp fn)
                             (atc-string-objinfo-alistp prec-objs))))
     (let ((__function__ 'atc-gen-param-declon-list))
      (declare (ignorable __function__))
      (b*
       (((reterr) nil)
        ((when (endp typed-formals))
         (retok nil))
        ((cons formal info) (car typed-formals))
        (type (atc-var-info->type info))
        (name (symbol-name formal))
        ((unless (paident-stringp name))
         (reterr
          (msg
           "The symbol name ~s0 of ~
                   the formal parameter ~x1 of the function ~x2 ~
                   must be a portable ASCII C identifier, but it is not."
           name formal fn)))
        (cdr-formals (strip-cars (cdr typed-formals)))
        ((when (member-equal name (symbol-name-lst cdr-formals)))
         (reterr
          (msg
           "The formal parameter ~x0 of the function ~x1 ~
                   has the same symbol name as ~
                   another formal parameter among ~x2; ~
                   this is disallowed, even if the package names differ."
           formal fn cdr-formals)))
        ((when
          (b*
           ((info (cdr (assoc-equal (symbol-name formal)
                                    prec-objs)))
            ((unless info) nil)
            ((unless (atc-obj-infop info))
             (raise
              "Internal error: ~
                                malformed ATC-OBJ-INFO ~x0."
              info))
            (info (atc-obj-info->defobject info)))
           (eq (defobject-info->name-symbol info)
               formal)))
         (atc-gen-param-declon-list (cdr typed-formals)
                                    fn prec-objs))
        ((mv tyspec declor)
         (ident+type-to-tyspec+declor (make-ident :name name)
                                      type))
        (param (make-param-declon :tyspec tyspec
                                  :declor declor))
        ((erp params)
         (atc-gen-param-declon-list (cdr typed-formals)
                                    fn prec-objs)))
       (retok (cons param params)))))

    Theorem: param-declon-listp-of-atc-gen-param-declon-list.params

    (defthm param-declon-listp-of-atc-gen-param-declon-list.params
      (b* (((mv acl2::?erp ?params)
            (atc-gen-param-declon-list typed-formals fn prec-objs)))
        (param-declon-listp params))
      :rule-classes :rewrite)