File: subtract_prime.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 (30 lines) | stat: -rw-r--r-- 787 bytes parent folder | download | duplicates (6)
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
\DOC subtract'

\TYPE {subtract' : ('a -> 'a -> bool) -> 'a list -> 'a list -> 'a list}

\SYNOPSIS
Subtraction of sets modulo an equivalence.

\DESCRIBE
The call {subtract' r l1 l2} removes from the list {l1} all elements {x} such
that there is an {x'} in {l2} with {r x x'}. If {l1} and {l2} were free of
equivalents under {r}, the resulting list will be too, so this is a set
operation modulo an equivalence. The function {subtract} is the special case
where the relation is just equality.

\FAILURE
Fails only if the function {r} fails.

\EXAMPLE
{
  # subtract' (fun x y -> abs(x) = abs(y)) [-1; 2; 1] [-2; -3; 4; -4];;
  val it : int list = [-1; 1]
}

\USES
Maintaining sets modulo an equivalence such as alpha-equivalence.

\SEEALSO
insert', mem', union, union', unions'.

\ENDDOC