Filtering...

apply-term

books/std/system/apply-term

Included Books

other
(in-package "ACL2")
include-book
(include-book "pseudo-termfnp")
other
(define apply-term
  ((fn pseudo-termfnp) (terms pseudo-term-listp))
  :guard (or (symbolp fn) (= (len terms) (len (lambda-formals fn))))
  :returns (term "A @(tsee pseudo-termp).")
  :parents (std/system/term-transformations)
  :short "Apply a function symbol or a lambda expression to a list of terms,
          obtaining a term."
  :long (topstring-p "This utility is similar to @(tsee cons-term),
    but it performs a beta reduction when @('fn') is a lambda expression.")
  (cond ((symbolp fn) (cons-term fn terms))
    (t (subcor-var (lambda-formals fn) terms (lambda-body fn))))
  :guard-hints (("Goal" :in-theory (enable pseudo-termfnp pseudo-lambdap))))
other
(defsection apply-term*
  :parents (std/system/term-transformations)
  :short "Apply a function symbol or a lambda expression to zero or more terms,
          obtaining a term."
  :long (topstring (p "This utility is similar to @(tsee cons-term*),
     but it performs a beta reduction when @('fn') is a lambda expressions.
     It is a macro version of @(tsee apply-term).")
    (@def "apply-term*"))
  (defmacro apply-term*
    (fn &rest terms)
    `(apply-term ,FN (list ,@TERMS))))