• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
        • Type-prescription
        • Rewrite
        • Meta
          • Force
          • Syntaxp
          • Extended-metafunctions
          • Meta-extract
          • Backchain-limit
          • Magic-ev-fncall
          • Evaluator-restrictions
          • Meta-implicit-hypothesis
          • Transparent-functions
          • Set-skip-meta-termp-checks
          • Case-split
          • Term-table
          • Magic-ev
          • Meta-lemmas
            • Meta-functions
              • Expand-member-meta
              • Reduce-nth-meta
                • Beta-reduce
                • Formal-member
                • Formal-true-listp
                • Formal-consp
                • Formal-nth
              • Meta-lemma-theory
            • Set-skip-meta-termp-checks!
          • Linear
          • Definition
          • Clause-processor
          • Tau-system
          • Forward-chaining
          • Equivalence
          • Congruence
          • Free-variables
          • Executable-counterpart
          • Induction
          • Type-reasoning
          • Compound-recognizer
          • Rewrite-quoted-constant
          • Elim
          • Well-founded-relation-rule
          • Built-in-clause
          • Well-formedness-guarantee
          • Patterned-congruence
          • Rule-classes-introduction
          • Guard-holders
          • Refinement
          • Type-set-inverter
          • Generalize
          • Corollary
          • Induction-heuristics
          • Backchaining
          • Default-backchain-limit
        • Proof-builder
        • Recursion-and-induction
        • Hons-and-memoization
        • Events
        • Parallelism
        • History
        • Programming
        • Operational-semantics
        • Real
        • Start-here
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Meta-functions

    Reduce-nth-meta

    Meta function for nth.

    This meta function is designed to quickly rewrite terms of the form (NTH n lst) where n is an integer and lst is formally a proper list.

    Definitions and Theorems

    Function: reduce-nth-meta

    (defun reduce-nth-meta (term)
      (declare (xargs :guard (pseudo-termp term)))
      (case-match term
        (('nth ('quote n) lst)
         (if (and (integerp n)
                  (<= 0 n)
                  (equal (formal-true-listp lst) *t*))
             (formal-nth n lst)
           term))
        (& term)))

    This meta lemma was designed to quickly rewrite the terms generated by the mv-let macro.

    Theorem: reduce-nth-meta-correct

    (defthm reduce-nth-meta-correct
      (implies (and (pseudo-termp term) (alistp a))
               (equal (meta-ev term a)
                      (meta-ev (reduce-nth-meta term) a)))
      :rule-classes ((:meta :trigger-fns (nth))))