src/Tools/Metis/src/Useful.sig
author desharna
Thu, 09 Jul 2020 11:39:16 +0200
changeset 72004 913162a47d9f
parent 39502 cffceed8e7fa
permissions -rw-r--r--
Update Metis to 2.4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
     1
(* ========================================================================= *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
     2
(* ML UTILITY FUNCTIONS                                                      *)
72004
913162a47d9f Update Metis to 2.4
desharna
parents: 39502
diff changeset
     3
(* Copyright (c) 2001 Joe Leslie-Hurd, distributed under the BSD License     *)
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
     4
(* ========================================================================= *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
     5
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
     6
signature Useful =
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
     7
sig
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
     8
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
     9
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    10
(* Exceptions.                                                               *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    11
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    12
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    13
exception Error of string
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    14
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    15
exception Bug of string
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    16
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    17
val total : ('a -> 'b) -> 'a -> 'b option
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    18
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    19
val can : ('a -> 'b) -> 'a -> bool
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    20
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    21
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    22
(* Tracing.                                                                  *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    23
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    24
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    25
val tracePrint : (string -> unit) ref
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    26
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    27
val trace : string -> unit
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    28
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    29
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    30
(* Combinators.                                                              *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    31
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    32
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    33
val C : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    34
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    35
val I : 'a -> 'a
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    36
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    37
val K : 'a -> 'b -> 'a
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    38
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    39
val S : ('a -> 'b -> 'c) -> ('a -> 'b) -> 'a -> 'c
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    40
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    41
val W : ('a -> 'a -> 'b) -> 'a -> 'b
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    42
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    43
val funpow : int -> ('a -> 'a) -> 'a -> 'a
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    44
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    45
val exp : ('a * 'a -> 'a) -> 'a -> int -> 'a -> 'a
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    46
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    47
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    48
(* Pairs.                                                                    *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    49
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    50
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    51
val fst : 'a * 'b -> 'a
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    52
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    53
val snd : 'a * 'b -> 'b
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    54
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    55
val pair : 'a -> 'b -> 'a * 'b
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    56
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    57
val swap : 'a * 'b -> 'b * 'a
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    58
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    59
val curry : ('a * 'b -> 'c) -> 'a -> 'b -> 'c
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    60
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    61
val uncurry : ('a -> 'b -> 'c) -> 'a * 'b -> 'c
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    62
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    63
val ## : ('a -> 'c) * ('b -> 'd) -> 'a * 'b -> 'c * 'd
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    64
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    65
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    66
(* State transformers.                                                       *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    67
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    68
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    69
val unit : 'a -> 's -> 'a * 's
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    70
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    71
val bind : ('s -> 'a * 's) -> ('a -> 's -> 'b * 's) -> 's -> 'b * 's
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    72
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    73
val mmap : ('a -> 'b) -> ('s -> 'a * 's) -> 's -> 'b * 's
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    74
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    75
val mjoin : ('s -> ('s -> 'a * 's) * 's) -> 's -> 'a * 's
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    76
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    77
val mwhile : ('a -> bool) -> ('a -> 's -> 'a * 's) -> 'a -> 's -> 'a * 's
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    78
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    79
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    80
(* Equality.                                                                 *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    81
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    82
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    83
val equal : ''a -> ''a -> bool
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    84
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    85
val notEqual : ''a -> ''a -> bool
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    86
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    87
val listEqual : ('a -> 'a -> bool) -> 'a list -> 'a list -> bool
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    88
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    89
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    90
(* Comparisons.                                                              *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    91
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    92
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    93
val mapCompare : ('a -> 'b) -> ('b * 'b -> order) -> 'a * 'a -> order
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    94
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    95
val revCompare : ('a * 'a -> order) -> 'a * 'a -> order
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    96
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    97
val prodCompare :
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    98
    ('a * 'a -> order) -> ('b * 'b -> order) -> ('a * 'b) * ('a * 'b) -> order
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
    99
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   100
val lexCompare : ('a * 'a -> order) -> 'a list * 'a list -> order
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   101
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   102
val optionCompare : ('a * 'a -> order) -> 'a option * 'a option -> order
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   103
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   104
val boolCompare : bool * bool -> order  (* false < true *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   105
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   106
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   107
(* Lists: note we count elements from 0.                                     *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   108
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   109
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   110
val cons : 'a -> 'a list -> 'a list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   111
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   112
val hdTl : 'a list -> 'a * 'a list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   113
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   114
val append : 'a list -> 'a list -> 'a list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   115
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   116
val singleton : 'a -> 'a list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   117
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   118
val first : ('a -> 'b option) -> 'a list -> 'b option
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   119
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   120
val maps : ('a -> 's -> 'b * 's) -> 'a list -> 's -> 'b list * 's
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   121
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   122
val mapsPartial : ('a -> 's -> 'b option * 's) -> 'a list -> 's -> 'b list * 's
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   123
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   124
val zipWith : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   125
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   126
val zip : 'a list -> 'b list -> ('a * 'b) list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   127
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   128
val unzip : ('a * 'b) list -> 'a list * 'b list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   129
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   130
val cartwith : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   131
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   132
val cart : 'a list -> 'b list -> ('a * 'b) list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   133
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   134
val takeWhile : ('a -> bool) -> 'a list -> 'a list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   135
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   136
val dropWhile : ('a -> bool) -> 'a list -> 'a list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   137
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   138
val divideWhile : ('a -> bool) -> 'a list -> 'a list * 'a list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   139
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   140
val groups : ('a * 's -> bool * 's) -> 's -> 'a list -> 'a list list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   141
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   142
val groupsBy : ('a * 'a -> bool) -> 'a list -> 'a list list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   143
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   144
val groupsByFst : (''a * 'b) list -> (''a * 'b list) list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   145
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   146
val groupsOf : int -> 'a list -> 'a list list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   147
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   148
val index : ('a -> bool) -> 'a list -> int option
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   149
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   150
val enumerate : 'a list -> (int * 'a) list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   151
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   152
val divide : 'a list -> int -> 'a list * 'a list  (* Subscript *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   153
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   154
val revDivide : 'a list -> int -> 'a list * 'a list  (* Subscript *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   155
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   156
val updateNth : int * 'a -> 'a list -> 'a list  (* Subscript *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   157
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   158
val deleteNth : int -> 'a list -> 'a list  (* Subscript *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   159
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   160
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   161
(* Sets implemented with lists.                                              *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   162
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   163
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   164
val mem : ''a -> ''a list -> bool
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   165
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   166
val insert : ''a -> ''a list -> ''a list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   167
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   168
val delete : ''a -> ''a list -> ''a list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   169
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   170
val setify : ''a list -> ''a list  (* removes duplicates *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   171
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   172
val union : ''a list -> ''a list -> ''a list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   173
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   174
val intersect : ''a list -> ''a list -> ''a list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   175
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   176
val difference : ''a list -> ''a list -> ''a list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   177
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   178
val subset : ''a list -> ''a list -> bool
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   179
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   180
val distinct : ''a list -> bool
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   181
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   182
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   183
(* Sorting and searching.                                                    *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   184
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   185
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   186
val minimum : ('a * 'a -> order) -> 'a list -> 'a * 'a list  (* Empty *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   187
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   188
val maximum : ('a * 'a -> order) -> 'a list -> 'a * 'a list  (* Empty *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   189
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   190
val merge : ('a * 'a -> order) -> 'a list -> 'a list -> 'a list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   191
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   192
val sort : ('a * 'a -> order) -> 'a list -> 'a list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   193
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   194
val sortMap : ('a -> 'b) -> ('b * 'b -> order) -> 'a list -> 'a list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   195
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   196
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   197
(* Integers.                                                                 *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   198
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   199
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   200
val interval : int -> int -> int list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   201
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   202
val divides : int -> int -> bool
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   203
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   204
val gcd : int -> int -> int
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   205
72004
913162a47d9f Update Metis to 2.4
desharna
parents: 39502
diff changeset
   206
(* Primes *)
913162a47d9f Update Metis to 2.4
desharna
parents: 39502
diff changeset
   207
913162a47d9f Update Metis to 2.4
desharna
parents: 39502
diff changeset
   208
type sieve
913162a47d9f Update Metis to 2.4
desharna
parents: 39502
diff changeset
   209
913162a47d9f Update Metis to 2.4
desharna
parents: 39502
diff changeset
   210
val initSieve : sieve
913162a47d9f Update Metis to 2.4
desharna
parents: 39502
diff changeset
   211
913162a47d9f Update Metis to 2.4
desharna
parents: 39502
diff changeset
   212
val maxSieve : sieve -> int
913162a47d9f Update Metis to 2.4
desharna
parents: 39502
diff changeset
   213
913162a47d9f Update Metis to 2.4
desharna
parents: 39502
diff changeset
   214
val primesSieve : sieve -> int list
913162a47d9f Update Metis to 2.4
desharna
parents: 39502
diff changeset
   215
913162a47d9f Update Metis to 2.4
desharna
parents: 39502
diff changeset
   216
val incSieve : sieve -> bool * sieve
913162a47d9f Update Metis to 2.4
desharna
parents: 39502
diff changeset
   217
913162a47d9f Update Metis to 2.4
desharna
parents: 39502
diff changeset
   218
val nextSieve : sieve -> int * sieve
913162a47d9f Update Metis to 2.4
desharna
parents: 39502
diff changeset
   219
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   220
val primes : int -> int list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   221
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   222
val primesUpTo : int -> int list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   223
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   224
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   225
(* Strings.                                                                  *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   226
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   227
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   228
val rot : int -> char -> char
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   229
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   230
val charToInt : char -> int option
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   231
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   232
val charFromInt : int -> char option
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   233
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   234
val nChars : char -> int -> string
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   235
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   236
val chomp : string -> string
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   237
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   238
val trim : string -> string
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   239
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   240
val join : string -> string list -> string
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   241
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   242
val split : string -> string -> string list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   243
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   244
val capitalize : string -> string
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   245
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   246
val mkPrefix : string -> string -> string
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   247
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   248
val destPrefix : string -> string -> string
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   249
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   250
val isPrefix : string -> string -> bool
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   251
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   252
val stripPrefix : (char -> bool) -> string -> string
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   253
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   254
val mkSuffix : string -> string -> string
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   255
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   256
val destSuffix : string -> string -> string
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   257
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   258
val isSuffix : string -> string -> bool
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   259
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   260
val stripSuffix : (char -> bool) -> string -> string
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   261
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   262
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   263
(* Tables.                                                                   *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   264
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   265
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   266
type columnAlignment = {leftAlign : bool, padChar : char}
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   267
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   268
val alignColumn : columnAlignment -> string list -> string list -> string list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   269
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   270
val alignTable : columnAlignment list -> string list list -> string list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   271
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   272
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   273
(* Reals.                                                                    *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   274
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   275
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   276
val percentToString : real -> string
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   277
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   278
val pos : real -> real
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   279
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   280
val log2 : real -> real  (* Domain *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   281
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   282
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   283
(* Sum datatype.                                                             *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   284
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   285
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   286
datatype ('a,'b) sum = Left of 'a | Right of 'b
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   287
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   288
val destLeft : ('a,'b) sum -> 'a
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   289
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   290
val isLeft : ('a,'b) sum -> bool
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   291
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   292
val destRight : ('a,'b) sum -> 'b
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   293
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   294
val isRight : ('a,'b) sum -> bool
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   295
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   296
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   297
(* Useful impure features.                                                   *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   298
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   299
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   300
val newInt : unit -> int
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   301
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   302
val newInts : int -> int list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   303
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   304
val withRef : 'r ref * 'r -> ('a -> 'b) -> 'a -> 'b
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   305
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   306
val cloneArray : 'a Array.array -> 'a Array.array
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   307
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   308
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   309
(* The environment.                                                          *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   310
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   311
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   312
val host : unit -> string
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   313
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   314
val time : unit -> string
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   315
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   316
val date : unit -> string
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   317
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   318
val readDirectory : {directory : string} -> {filename : string} list
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   319
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   320
val readTextFile : {filename : string} -> string
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   321
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   322
val writeTextFile : {contents : string, filename : string} -> unit
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   323
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   324
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   325
(* Profiling and error reporting.                                            *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   326
(* ------------------------------------------------------------------------- *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   327
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   328
val try : ('a -> 'b) -> 'a -> 'b
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   329
39443
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39414
diff changeset
   330
val chat : string -> unit  (* stdout *)
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39414
diff changeset
   331
e330437cd22a copied the unmodified official Metis 2.3 (15 Sept. 2010) sources into Isabelle
blanchet
parents: 39414
diff changeset
   332
val chide : string -> unit  (* stderr *)
39348
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   333
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   334
val warn : string -> unit
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   335
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   336
val die : string -> 'exit
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   337
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   338
val timed : ('a -> 'b) -> 'a -> real * 'b
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   339
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   340
val timedMany : ('a -> 'b) -> 'a -> real * 'b
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   341
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   342
val executionTime : unit -> real  (* Wall clock execution time *)
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   343
6f9c9899f99f new version of the Metis files
blanchet
parents:
diff changeset
   344
end