• 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-2

    Loop in Common Lisp and loop$ in ACL2

    LP2: Loop in Common Lisp and loop$ in ACL2

    The loop macro of Common Lisp was inspired by the “iterative statements” in Warren Teitelman's CLISP package of Interlisp (1974). But programming languages have had iterative statements since early in the development of compilers. The first release of a FORTRAN compiler (1957) supported what is probably the most well-known iterative construct, the “DO loop.” But CLISP added many additional features including simultaneous looping over multiple ranges, structured ways to filter the elements, structured exit control mechanisms, and multiple ways to accumulate the results. Common Lisp supports these and many other features.

    ACL2's loop$ facility supports a tiny subset of Common Lisp's loop statements. It is hard to overstate how small the ACL2 subset is! For example, to manage iteration over a range of numbers, ACL2 provides FROM, TO, and BY, but Common Lisp additionally provides DOWNFROM,UPFROM,DOWNTO,UPTO,BELOW,and ABOVE. For value accumulation, ACL2 supports SUM, COLLECT, APPEND, ALWAYS, and THEREIS, while Common Lisp also supports NCONC, COUNT, MAXIMIZE, and MINIMIZE. Even within its restricted subset, ACL2 syntax is less flexible regarding the order of the various “clauses” and the presence of, say, multiple accumulators. The list of differences could go on and on because the Common Lisp facility is so elaborate.

    While many more Common Lisp loop features could be supported in ACL2, we believe it is best to test and refine the techniques reasoning about loop$ before elaborating it further.

    Now go to lp-section-3 (or return to the Table of Contents).