• 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-parallel-asg-depgraph

    Calculate a dependency graph for a parallel assignment.

    Signature
    (atj-parallel-asg-depgraph vars exprs) → graph
    Arguments
    vars — Guard (string-listp vars).
    exprs — Guard (jexpr-listp exprs).
    Returns
    graph — Type (alistp graph).

    Since Java does not have parallel assignment, in order to assign the expressions exprs to the variables vars, we attempt to topologically order these assignments according to their dependencies. This function calculates the dependency graph, in a form suitable for this dependency graph library.

    We go through the variables in order, and for each we construct an association pair for the graph represented as an alist. For each variable, we collect all the variables in the corresponding expression, but we exclude the variable itself and any variable not in the initial set. Thus, we use an auxiliary function that has the unchanging initial set as an additional argument.

    Definitions and Theorems

    Function: atj-parallel-asg-depgraph-aux

    (defun atj-parallel-asg-depgraph-aux (vars exprs all-vars)
      (declare (xargs :guard (and (string-listp vars)
                                  (jexpr-listp exprs)
                                  (string-listp all-vars))))
      (declare (xargs :guard (= (len vars) (len exprs))))
      (let ((__function__ 'atj-parallel-asg-depgraph-aux))
        (declare (ignorable __function__))
        (b* (((when (endp vars)) nil)
             (var (car vars))
             (expr (car exprs))
             (deps (remove-equal var
                                 (intersection-equal (jexpr-vars expr)
                                                     all-vars)))
             (rest-alist (atj-parallel-asg-depgraph-aux (cdr vars)
                                                        (cdr exprs)
                                                        all-vars)))
          (acons var deps rest-alist))))

    Theorem: alistp-of-atj-parallel-asg-depgraph-aux

    (defthm alistp-of-atj-parallel-asg-depgraph-aux
      (b* ((graph (atj-parallel-asg-depgraph-aux vars exprs all-vars)))
        (alistp graph))
      :rule-classes :rewrite)

    Theorem: atj-parallel-asg-depgraph-aux-subsetp-vars

    (defthm atj-parallel-asg-depgraph-aux-subsetp-vars
      (b* ((?graph (atj-parallel-asg-depgraph-aux vars exprs all-vars)))
        (subsetp-equal (alist-keys graph)
                       vars)))

    Function: atj-parallel-asg-depgraph

    (defun atj-parallel-asg-depgraph (vars exprs)
      (declare (xargs :guard (and (string-listp vars)
                                  (jexpr-listp exprs))))
      (declare (xargs :guard (= (len vars) (len exprs))))
      (let ((__function__ 'atj-parallel-asg-depgraph))
        (declare (ignorable __function__))
        (atj-parallel-asg-depgraph-aux vars exprs vars)))

    Theorem: alistp-of-atj-parallel-asg-depgraph

    (defthm alistp-of-atj-parallel-asg-depgraph
      (b* ((graph (atj-parallel-asg-depgraph vars exprs)))
        (alistp graph))
      :rule-classes :rewrite)

    Theorem: atj-parallel-asg-depgraph-subsetp-vars

    (defthm atj-parallel-asg-depgraph-subsetp-vars
      (b* ((?graph (atj-parallel-asg-depgraph vars exprs)))
        (subsetp-equal (alist-keys graph)
                       vars)))