• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
        • Defun
        • Declare
        • System-utilities
        • Stobj
        • State
        • Mutual-recursion
        • Memoize
        • Mbe
        • Io
        • Defpkg
        • Apply$
        • Loop$
        • Programming-with-state
        • Arrays
        • Characters
        • Time$
        • Defmacro
        • Loop$-primer
          • Lp-section-8
          • Lp-section-10
          • Lp-section-6
          • Lp-section-9
          • Lp-section-17
          • Lp-section-16
          • Lp-section-15
          • Lp-section-11
          • Lp-section-4
          • Lp-section-7
          • Lp-section-13
          • Lp-section-12
          • Lp-section-14
          • Lp-section-5
          • Lp-section-0
          • Lp-section-2
          • Lp-section-18
            • Lp-section-3
            • Lp-section-1
          • Fast-alists
          • Defconst
          • Evaluation
          • Guard
          • Equality-variants
          • Compilation
          • Hons
          • ACL2-built-ins
          • Developers-guide
          • System-attachments
          • Advanced-features
          • Set-check-invariant-risk
          • Numbers
          • Efficiency
          • Irrelevant-formals
          • Introduction-to-programming-in-ACL2-for-those-who-know-lisp
          • Redefining-programs
          • Lists
          • Invariant-risk
          • Errors
          • Defabbrev
          • Conses
          • Alists
          • Set-register-invariant-risk
          • Strings
          • Program-wrapper
          • Get-internal-time
          • Basics
          • Packages
          • Oracle-eval
          • Defmacro-untouchable
          • <<
          • Primitive
          • Revert-world
          • Unmemoize
          • Set-duplicate-keys-action
          • Symbols
          • Def-list-constructor
          • Easy-simplify-term
          • Defiteration
          • Fake-oracle-eval
          • Defopen
          • Sleep
        • Operational-semantics
        • Real
        • Start-here
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Loop$-primer

    Lp-section-18

    Conclusion

    LP18: Conclusion

    Here are two pieces of advice.

    First, if you can think of a good name for the concept implemented by a loop$ statement, use defun to define that name. This is especially the case if you intend to reason about that loop$ statement or to write more than one instance of it.

    For example, rather than write instances of

    (loop$ for a in x as b in y sum (* a b))

    it is better to define (dot-product x y) with that loop$ as its body and then write calls of dot-product.

    Basically, names are good as long as you can remember them. They give you a place to hang lemmas and the lemmas match without having to think about rewriting lambdas, local variables, etc. Not all loop$s compute concepts with obvious, memorable names, but just because you can write “anonymous” iterations doesn't mean you should!

    Second, remember when you create a lemma intended to rewrite a loop$ statement you should normalize the body under your intended rewrite theory. As an experienced ACL2 user you would never write a lemma that tried to rewrite an endp or nfix or zp term. The lemma will never “see” such terms because the rewriter will have opened them up. You should apply that same kind of thinking when you write lemmas intended to rewrite loop$s.

    That's it. We can't think of anything else to say! We urge you to resort to the ACL2 user's manual for further information.

    Some relevant topics are

    • loop$
    • for-loop$
    • do-loop$
    • lambda$
    • rewrite-lambda-object
    • stating-and-proving-lemmas-about-loop$s

    The End of the Loop$ Primer. (Return to the Table of Contents).