ACL2-pc::dive
(primitive)
move to the indicated subterm
Examples:
(DIVE 1) -- assign the new current subterm to be the first
argument of the existing current subterm
(DIVE 1 2) -- assign the new current subterm to be the result of
first taking the 1st argument of the existing
current subterm, and then the 2nd argument of that
For example, if the current subterm is
(* (+ a b) c),
then after (dive 1) it is
(+ a b).
If after that, then (dive 2) is invoked, the new current subterm will
be
b.
Instead of (dive 1) followed by (dive 2), the same current
subterm could be obtained by instead submitting the single instruction
(dive 1 2).
General Form:
(dive &rest naturals-list)
If naturals-list is a non-empty list (n_1 ... n_k) of natural
numbers, let the new current subterm be the result of selecting the
n_1-st argument of the current subterm, and then the n_2-th subterm
of that, ..., finally the n_k-th subterm.
Remark: Dive is related to the command pp, in that the
diving is done according to raw (translated, internal form) syntax. Use the
command dv if you want to dive according to the syntax displayed by the
command p. Note that (dv n) can be abbreviated by simply
n.
Remark: Emacs users who load (into Emacs) the file
emacs-acl2.el (from a suitable directory; see emacs) will have
defined a command, Control-t Control-d, that avoids the need to type
dive commands. After you print the current term using the pp
command, you may position the cursor on a subterm and type Control-t
Control-d. Emacs will respond by pasting the appropriate dive command
immediately after the interactive proof-builder's prompt. You can then simply
type <RETURN> in order to dive to the desired subterm.