• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Debugging
    • Projects
    • 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
        • Memoize
        • Mbe
        • Io
        • Defpkg
        • Apply$
        • Mutual-recursion
        • Loop$
        • Programming-with-state
        • Arrays
        • Characters
        • Time$
        • Loop$-primer
        • Fast-alists
        • Defmacro
        • Defconst
        • Evaluation
        • Guard
        • Equality-variants
        • Compilation
        • Hons
        • ACL2-built-ins
        • Developers-guide
        • System-attachments
        • Advanced-features
        • Set-check-invariant-risk
        • Numbers
        • Irrelevant-formals
        • Efficiency
        • Introduction-to-programming-in-ACL2-for-those-who-know-lisp
        • Redefining-programs
        • Lists
          • Member
          • Append
          • Nth
          • Len
          • List
          • True-listp
          • String-listp
          • Nat-listp
          • Character-listp
          • Symbol-listp
          • True-list-listp
          • Length
          • Search
          • Intersection$
          • Union$
          • Remove-duplicates
          • Position
          • Take
          • Update-nth
          • Set-difference$
          • Subsetp
          • No-duplicatesp
          • Nthcdr
          • Concatenate
          • Remove
          • Remove1
          • Intersectp
          • Endp
          • Keyword-value-listp
          • Reverse
          • List-utilities
            • Set-size
            • List-len-const-theorems
              • Nthcdr-theorems
              • Append-theorems
              • Rev-theorems
              • Prefixp-theorems
              • Take-theorems
              • Intersectp-equal-theorems
              • Add-to-set-equal-theorems
              • List-primitive-theorems
              • Set-difference-equal-theorems
              • Intersection-equal-theorems
              • Index-of-theorems
              • Last-theorems
            • Add-to-set
            • Set-size
            • Integer-listp
            • Revappend
            • Subseq
            • Make-list
            • Lists-light
            • Butlast
            • Pairlis$
            • Boolean-listp
            • Substitute
            • Count
            • Keyword-listp
            • List*
            • Eqlable-listp
            • Last
            • Pos-listp
            • Integer-range-listp
            • Rational-listp
            • Evens
            • Atom-listp
            • ACL2-number-listp
            • Typed-list-utilities
            • Listp
            • Odds
            • Standard-char-listp
            • Last-cdr
            • Pairlis
            • Proper-consp
            • Improper-consp
            • Pairlis-x2
            • Pairlis-x1
            • Merge-sort-lexorder
            • Fix-true-list
            • Real-listp
          • 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
          • Set-duplicate-keys-action
          • Unmemoize
          • Symbols
          • Def-list-constructor
          • Easy-simplify-term
          • Defiteration
          • Fake-oracle-eval
          • Defopen
          • Sleep
        • Real
        • Start-here
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • List-utilities

    List-len-const-theorems

    Some theorems about lists whose lengths are (i) equal, (ii) equal or above, or (iii) above constant values.

    These theorems are disabled by default. They can be enabled to turn assertions about lengths and constants into assertions about consp and cdr: the expansion terminates because of the syntaxp restriction.

    Definitions and Theorems

    Theorem: equal-len-const

    (defthm equal-len-const
      (implies (syntaxp (quotep c))
               (equal (equal (len x) c)
                      (if (natp c)
                          (if (equal c 0)
                              (not (consp x))
                            (and (consp x)
                                 (equal (len (cdr x)) (1- c))))
                        nil))))

    Theorem: gteq-len-const

    (defthm gteq-len-const
      (implies (syntaxp (quotep c))
               (equal (>= (len x) c)
                      (or (<= (fix c) 0)
                          (and (consp x)
                               (>= (len (cdr x)) (1- c)))))))

    Theorem: gt-len-const

    (defthm gt-len-const
      (implies (syntaxp (quotep c))
               (equal (> (len x) c)
                      (or (< (fix c) 0)
                          (and (consp x)
                               (> (len (cdr x)) (1- c)))))))