File: dest_small_numeral.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 (35 lines) | stat: -rw-r--r-- 929 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
\DOC dest_small_numeral

\TYPE {dest_small_numeral : term -> int}

\SYNOPSIS
Converts a HOL numeral term to machine integer.

\DESCRIBE
The call {dest_small_numeral t} where {t} is the HOL numeral representation of
{n}, returns {n} as an OCaml machine integer. It fails if the term is not a
numeral or the result doesn't fit in a machine integer.

\FAILURE
Fails if the term is not a numeral or if the result doesn't fit in a machine
integer.

\EXAMPLE
{
  # dest_small_numeral `12`;;
  val it : int = 12

  # dest_small_numeral `18446744073709551616`;;
  Exception: Failure "int_of_big_int".
}

\COMMENTS
If overflow is a danger, you may be better off using OCaml type {num} and the
analogous function {dest_numeral}. However, none of HOL's inference rules
depend on the behaviour of machine integers, so logical soundness is not an
issue.

\SEEALSO
dest_numeral, is_numeral, mk_numeral, mk_small_numeral, rat_of_term.

\ENDDOC