• 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
        • Defun
        • Verify-guards
        • Table
        • Mutual-recursion
        • Memoize
        • Make-event
        • Include-book
        • Encapsulate
        • Defun-sk
          • Define-sk
          • Quantifier-tutorial
          • Defun-sk-queries
            • Defun-sk-matrix
              • Defun-sk-p
              • Defun-sk-namep
              • Defun-sk-body
              • Defun-sk-imatrix
              • Defun-sk-definition-name
              • Defun-sk-witness
              • Defun-sk-classicalp
              • Defun-sk-rewrite-kind
              • Defun-sk-rewrite-name
              • Defun-sk-rewrite-kind-p
              • Defun-sk-quantifier
              • Defun-sk-options
              • Defun-sk-bound-vars
              • Defun-sk-strengthen
              • Defun-sk-quantifier-p
            • Quantifiers
            • Defun-sk-example
            • Defund-sk
            • Forall
            • Def::un-sk
            • Equiv
            • Exists
            • Congruence
          • Defttag
          • Defstobj
          • Defpkg
          • Defattach
          • Defabsstobj
          • Defchoose
          • Progn
          • Verify-termination
          • Redundant-events
          • Defmacro
          • Defconst
          • Skip-proofs
          • In-theory
          • Embedded-event-form
          • Value-triple
          • Comp
          • Local
          • Defthm
          • Progn!
          • Defevaluator
          • Theory-invariant
          • Assert-event
          • Defun-inline
          • Project-dir-alist
          • Partial-encapsulate
          • Define-trusted-clause-processor
          • Defproxy
          • Defexec
          • Defun-nx
          • Defthmg
          • Defpun
          • Defabbrev
          • Set-table-guard
          • Name
          • Defrec
          • Add-custom-keyword-hint
          • Regenerate-tau-database
          • Defcong
          • Deftheory
          • Defaxiom
          • Deftheory-static
          • Defund
          • Evisc-table
          • Verify-guards+
          • Logical-name
          • Profile
          • Defequiv
          • Defmacro-untouchable
          • Add-global-stobj
          • Defthmr
          • Defstub
          • Defrefinement
          • Deflabel
          • In-arithmetic-theory
          • Unmemoize
          • Defabsstobj-missing-events
          • Defthmd
          • Fake-event
          • Set-body
          • Defun-notinline
          • Functions-after
          • Macros-after
          • Dump-events
          • Defund-nx
          • Defun$
          • Remove-global-stobj
          • Remove-custom-keyword-hint
          • Dft
          • Defthy
          • Defund-notinline
          • Defnd
          • Defn
          • Defund-inline
          • Defmacro-last
        • Parallelism
        • History
        • Programming
        • Operational-semantics
        • Real
        • Start-here
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Defun-sk-queries

    Defun-sk-matrix

    Retrieve the matrix of a function introduced via defun-sk, in untranslated form.

    Signature
    (defun-sk-matrix fn wrld) → matrix
    Arguments
    fn — Guard (defun-sk-namep fn wrld).
    wrld — Guard (plist-worldp wrld).
    Returns
    matrix — A pseudo-termp.

    If fn is defined (i.e. :constrain is nil or absent), then after translation, the (unnormalized) body of fn should have the form (return-last 'progn (throw-nonexec-error ...) core) if fn is non-executable (i.e. it fn is introduced via defun-nx in the encapsulate), or just core otherwise. core should have one of the following forms, where arg1, ..., argN are the formal arguments of fn, and matrix is the translated matrix:

    • ((lambda (bvar) matrix) (witness arg1 ... argN))

      if there is just one bound variable bvar, as resulting from the translation of the let.

    • ((lambda (mv argN ... arg1)
              ((lambda (bvar1 ... bvarM argN ... arg1) matrix)
               (mv-nth '0 mv) ... (mv-nth 'M-1 mv) argN ... arg1))
      (witness arg1 ... argN) arg1 ... argN)

      if there are M > 1 bound variables, as resulting from the translation of the mv-let.

    If instead fn is constrained (i.e. :constrain is not nil), the generated definition theorem for fn should have the form (equal (fn arg1 ... argN) core), with arg1, ..., argN and core as above.

    Note that here we consider a function to be defined if it has an unnormalized body (via ubody). Certain program-mode functions may be defined without having an unnormalized body; however, defun-sk functions should always be in logic mode.

    Use defun-sk-imatrix to retrieve the matrix in untranslated form.

    Definitions and Theorems

    Function: defun-sk-matrix

    (defun defun-sk-matrix (fn wrld)
     (declare (xargs :guard (and (plist-worldp wrld)
                                 (defun-sk-namep fn wrld))))
     (let ((__function__ 'defun-sk-matrix))
      (declare (ignorable __function__))
      (b* ((core (if (ubody fn wrld)
                     (b* ((body (ubody fn wrld)))
                       (if (non-executablep fn wrld)
                           (car (last body))
                         body))
                   (b* ((def-thm (defun-sk-definition-name fn wrld)))
                     (third (thm-formula def-thm wrld))))))
       (if
        (= 1 (len (defun-sk-bound-vars fn wrld)))
        (case-match core
         (((& & matrix) . &) matrix)
         (&
          (raise
           "Internal error: ~
                         the translated definiens ~x0 ~
                         of the DEFUN-SK function ~x1 ~
                         is malformed."
           core fn)))
        (case-match core
         (((& & ((& & matrix) . &)) . &) matrix)
         (&
          (raise
           "Internal error: ~
                       the translated definiens ~x0 ~
                       of the DEFUN-SK function ~x1 ~
                       is malformed."
           core fn)))))))