File: find_path.doc

package info (click to toggle)
hol-light 20190729-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 42,676 kB
  • sloc: ml: 637,078; cpp: 439; makefile: 301; lisp: 286; java: 279; sh: 239; yacc: 108; perl: 78; ansic: 57; sed: 39; python: 13
file content (36 lines) | stat: -rw-r--r-- 813 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 find_path

\TYPE {find_path : (term -> bool) -> term -> string}

\SYNOPSIS
Returns a path to some subterm satisfying a predicate.

\DESCRIBE
The call {find_path p t} traverses the term {t} top-down until it finds a 
subterm satisfying the predicate {p}. It then returns a path indicating how to
reach it; this is just a string with each character interpreted as:

\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 there is no subterm satisfying {p}.

\EXAMPLE
{
  # find_path is_list `!x. ~(x = []) ==> CONS (HD x) (TL x) = x`;;
  Warning: inventing type variables
  val it : string = "rblrrr"
}

\SEEALSO
follow_path, PATH_CONV.

\ENDDOC