• 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-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-remove-ending-continue
                    • Atj-remove-continue-in-jstatems+jblocks
                      • Atj-remove-continue-in-jstatem
                      • Atj-remove-continue-in-jblock
                • 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-remove-continue

Atj-remove-continue-in-jstatems+jblocks

Remove the ending continue statements in all the loops found in statements and blocks.

We recursively process all the statements and blocks. When we encounter a loop, we use atj-remove-ending-continue to remove all its ending continues (if any), and then we recursively process the resulting body in order to remove continues from any nested loops.

Currently ATJ's ACL2-to-Java translation does not generate nested loops, and none of ATJ's post-translation steps generates nested loops. However, making this post-translation step more general require only little additional effort.

Definitions and Theorems

Function: atj-remove-continue-in-jstatem

(defun atj-remove-continue-in-jstatem (statem)
 (declare (xargs :guard (jstatemp statem)))
 (let ((__function__ 'atj-remove-continue-in-jstatem))
   (declare (ignorable __function__))
   (jstatem-case
        statem :locvar statem :expr
        statem :return statem :throw statem
        :break statem :continue statem :if
        (jstatem-if statem.test
                    (atj-remove-continue-in-jblock statem.then))
        :ifelse
        (jstatem-ifelse statem.test
                        (atj-remove-continue-in-jblock statem.then)
                        (atj-remove-continue-in-jblock statem.else))
        :while
        (b* ((body (atj-remove-ending-continue statem.body)))
          (jstatem-while statem.test
                         (atj-remove-continue-in-jblock body)))
        :do
        (b* ((body (atj-remove-ending-continue statem.body)))
          (jstatem-do (atj-remove-continue-in-jblock body)
                      statem.test))
        :for
        (b* ((body (atj-remove-ending-continue statem.body)))
          (jstatem-for statem.init statem.test statem.update
                       (atj-remove-continue-in-jblock body))))))

Function: atj-remove-continue-in-jblock

(defun atj-remove-continue-in-jblock (block)
  (declare (xargs :guard (jblockp block)))
  (let ((__function__ 'atj-remove-continue-in-jblock))
    (declare (ignorable __function__))
    (cond ((endp block) nil)
          (t (cons (atj-remove-continue-in-jstatem (car block))
                   (atj-remove-continue-in-jblock (cdr block)))))))

Theorem: return-type-of-atj-remove-continue-in-jstatem.new-statem

(defthm return-type-of-atj-remove-continue-in-jstatem.new-statem
  (implies
       (and (jstatemp statem))
       (b* ((?new-statem (atj-remove-continue-in-jstatem statem)))
         (jstatemp new-statem)))
  :rule-classes :rewrite)

Theorem: return-type-of-atj-remove-continue-in-jblock.new-block

(defthm return-type-of-atj-remove-continue-in-jblock.new-block
  (implies (and (jblockp block))
           (b* ((?new-block (atj-remove-continue-in-jblock block)))
             (jblockp new-block)))
  :rule-classes :rewrite)

Subtopics

Atj-remove-continue-in-jstatem
Atj-remove-continue-in-jblock