• 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
        • Soft
        • Bv
        • Imp-language
        • Ethereum
        • Event-macros
        • Java
          • Atj
            • Atj-implementation
              • Atj-types
              • Atj-java-primitive-array-model
              • Atj-java-abstract-syntax
              • Atj-input-processing
              • Atj-java-pretty-printer
              • Atj-code-generation
                • Atj-gen-test-method
                • Atj-shallow-code-generation
                • Atj-common-code-generation
                • Atj-shallow-quoted-constant-generation
                • Atj-pre-translation
                • Atj-gen-everything
                • Atj-name-translation
                • Atj-gen-test-cunit
                • Atj-gen-test-class
                • Atj-gen-main-file
                • Atj-post-translation
                  • Atj-post-translation-remove-array-write-calls
                  • Atj-post-translation-cache-const-methods
                  • Atj-post-translation-tailrec-elimination
                    • Atj-make-parallel-asg
                    • Atj-elim-tailrec-in-jstatems+jblocks
                    • Atj-parallel-asg-depgraph
                    • Atj-elim-tailrec-in-return
                    • Atj-serialize-parallel-asg
                      • Atj-elim-tailrec
                      • Atj-elim-tailrec-gen-block
                    • Atj-post-translation-fold-returns
                    • Atj-post-translate-body
                    • Atj-post-translation-lift-loop-tests
                    • Atj-post-translation-simplify-conds
                    • Atj-post-translate-jcbody-elements
                    • Atj-post-translation-remove-continue
                  • Atj-deep-code-generation
                  • Atj-gen-test-methods
                  • Atj-gen-test-file
                  • Atj-gen-env-file
                  • Atj-gen-output-subdir
                • Atj-java-primitives
                • Atj-java-primitive-arrays
                • Atj-type-macros
                • Atj-java-syntax-operations
                • Atj-fn
                • Atj-library-extensions
                • Atj-java-input-types
                • Atj-test-structures
                • Aij-notions
                • Atj-macro-definition
              • Atj-tutorial
            • Aij
            • Language
          • 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
    • Atj-post-translation-tailrec-elimination

    Atj-serialize-parallel-asg

    Generate a block that performs a parallel assignment of the given expressions to the given variables, according to the supplied serialization.

    Signature
    (atj-serialize-parallel-asg serialization vars exprs) → block
    Arguments
    serialization — Guard (string-listp serialization).
    vars — Guard (string-listp vars).
    exprs — Guard (jexpr-listp exprs).
    Returns
    block — Type (jblockp block).

    When the dependencies in a parallel assignment are not circular, it is possible to realize the parallel assignment via a sequence of single assignment that respects the dependencies. This function does that, based on the given serialization, which is calculated elsewhere via a topological sort.

    We go through the serialization, and for each element (i.e. variable name) we find the position in the vars list, and use that position to pick the corresponding expression to use in the assignment.

    We exclude trivial assignments of a variable to itself. These arise when formal arguments of tail-recursive ACL2 functions are passed unchanged as actual arguments to the recursive calls.

    Definitions and Theorems

    Function: atj-serialize-parallel-asg

    (defun atj-serialize-parallel-asg (serialization vars exprs)
      (declare (xargs :guard (and (string-listp serialization)
                                  (string-listp vars)
                                  (jexpr-listp exprs))))
      (declare (xargs :guard (and (= (len vars) (len exprs))
                                  (subsetp-equal serialization vars))))
      (let ((__function__ 'atj-serialize-parallel-asg))
        (declare (ignorable __function__))
        (b* (((when (endp serialization)) nil)
             (var (car serialization))
             (pos (index-of var vars))
             (expr (nth pos exprs))
             ((when (jexpr-equiv expr (jexpr-name var)))
              (atj-serialize-parallel-asg (cdr serialization)
                                          vars exprs))
             (first-asg (jblock-asg (jexpr-name var) expr))
             (rest-asg (atj-serialize-parallel-asg (cdr serialization)
                                                   vars exprs)))
          (append first-asg rest-asg))))

    Theorem: jblockp-of-atj-serialize-parallel-asg

    (defthm jblockp-of-atj-serialize-parallel-asg
     (b* ((block (atj-serialize-parallel-asg serialization vars exprs)))
       (jblockp block))
     :rule-classes :rewrite)