File: follow_path.doc

package info (click to toggle)
hol-light 20170109-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 36,568 kB
  • ctags: 8,549
  • sloc: ml: 540,018; cpp: 439; lisp: 286; java: 279; makefile: 262; sh: 229; yacc: 108; perl: 78; ansic: 57; sed: 39
file content (36 lines) | stat: -rw-r--r-- 764 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
\DOC follow_path

\TYPE {follow_path : string -> term -> term}

\SYNOPSIS
Find the subterm of a given term indicated by a path.

\DESCRIBE
A call {follow_path p t} follows path {p} inside {t} and returns the subterm 
encountered. The path is a string with the successive characters interpreted as 
follows:

\begin{{itemize}}

\item {"b"}: take the body of an abstraction

\item {"l"}: take the left (rator) path in an application 

\item {"r"}: take the right (rand) path in an application

\end{{itemize}}

\FAILURE
Fails if the path is not meaningful for the term, e.g. if a {"b"} is 
encountered for a subterm that is not an abstraction.

\EXAMPLE
{
  # follow_path "rrlr" `1 + 2 + 3 + 4 + 5`;;
  val it : term = `3`
}

\SEEALSO
find_path, PATH_CONV.

\ENDDOC