• 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

    Formal-nth

    The definition of (NTH n lst) for integers n and formal terms lst.

    Definitions and Theorems

    Function: formal-nth

    (defun formal-nth (n lst)
      (declare (xargs :guard (and (integerp n)
                                  (<= 0 n)
                                  (pseudo-termp lst)
                                  (equal (formal-true-listp lst) *t*))))
      (case-match lst
        (('quote x)
         (cons 'quote (cons (nth n x) 'nil)))
        (& (cond ((zp n) (fargn lst 1))
                 (t (formal-nth (- n 1) (fargn lst 2)))))))