A listing of all ML entities that need to be documented in src/0
=================================================================

XXsignature Feedback =
XXsig
XX    type error_record = {origin_structure : string,
XX                         origin_function  : string,
XX                         message          : string}
XX
XX    exception HOL_ERR of error_record
XX
XX    val mk_HOL_ERR        : string -> string -> string -> exn
XX    val wrap_exn          : string -> string -> exn -> exn
XX
XX    val emit_ERR          : bool ref
XX    val emit_MESG         : bool ref
XX    val emit_WARNING      : bool ref
XX
XX    val ERR_outstream     : TextIO.outstream ref
XX    val MESG_outstream    : TextIO.outstream ref
XX    val WARNING_outstream : TextIO.outstream ref
XX
XX    val format_ERR        : error_record -> string
XX    val format_MESG       : string -> string
XX    val format_WARNING    : string -> string -> string -> string
XX   
XX    val ERR_to_string     : (error_record -> string) ref
XX    val MESG_to_string    : (string -> string) ref
XX    val WARNING_to_string : (string -> string -> string -> string) ref
XX    val exn_to_string     : exn -> string
XX
XX    val Raise             : exn -> 'a
XX    val fail              : unit -> 'a
XX    val failwith          : string -> 'a
XX    val HOL_MESG          : string -> unit
XX    val HOL_WARNING       : string -> string -> string -> unit
XX
XX    val traces            : unit -> {name:string, 
XX                                     trace_level:int, default:int} list
XX    val register_trace    : string -> int ref -> unit
XX    val set_trace         : string -> int -> unit
XX    val reset_trace       : string -> unit
XX    val reset_traces      : unit -> unit
XX    val trace             : string * int -> ('a -> 'b) -> 'a -> 'b
XXend;

XXsignature Lib =
XXsig
XX  val curry         : ('a * 'b -> 'c) -> 'a -> 'b -> 'c
XX  val uncurry       : ('a -> 'b -> 'c) -> 'a * 'b -> 'c
XX  val append        : 'a list -> 'a list -> 'a list
XX  val concat        : string -> string -> string
XX  val equal         : ''a -> ''a -> bool
XX  val cons          : 'a -> 'a list -> 'a list
XX  val ##            : ('a -> 'b) * ('c -> 'd) -> 'a * 'c -> 'b * 'd
XX  val A             : ('a -> 'b) -> 'a -> 'b
XX  val B             : ('a -> 'b) -> ('c -> 'a) -> 'c -> 'b
XX  val C             : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c
XX  val I             : 'a -> 'a
XX  val K             : 'a -> 'b -> 'a
XX  val S             : ('a -> 'b -> 'c) -> ('a -> 'b) -> 'a -> 'c
XX  val W             : ('a -> 'a -> 'b) -> 'a -> 'b
XX  val fst           : 'a * 'b -> 'a
XX  val snd           : 'a * 'b -> 'b
XX  val can           : ('a -> 'b) -> 'a -> bool
XX  val partial       : exn -> ('a -> 'b option) -> 'a -> 'b
XX  val total         : ('a -> 'b) -> 'a -> 'b option
XX  val try           : ('a -> 'b) -> 'a -> 'b
XX  val trye          : ('a -> 'b) -> 'a -> 'b
XX  val assert        : ('a -> bool) -> 'a -> 'a
XX  val assert_exn    : ('a -> bool) -> 'a -> exn -> 'a
XX  val with_exn      : ('a -> 'b) -> 'a -> exn -> 'b
XX  val tryfind       : ('a -> 'b) -> 'a list -> 'b
XX  val el            : int -> 'a list -> 'a
XX  val index         : ''a -> ''a list -> int
XX  val map2          : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
XX  val all           : ('a -> bool) -> 'a list -> bool
XX  val all2          : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
XX  val exists        : ('a -> bool) -> 'a list -> bool
XX  val first         : ('a -> bool) -> 'a list -> 'a
XX  val split_after   : int -> 'a list -> 'a list * 'a list
XX  val partition     : ('a -> bool) -> 'a list -> 'a list * 'a list
  val gather        : ('a -> bool) -> 'a list -> 'a list
  val filter        : ('a -> bool) -> 'a list -> 'a list
  val itlist        : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b
  val itlist2       : ('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> 'c
  val rev_itlist    : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b
  val rev_itlist2   : ('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> 'c
  val end_itlist    : ('a -> 'a -> 'a) -> 'a list -> 'a
  val zip           : 'a list -> 'b list -> ('a * 'b) list
  val combine       : 'a list * 'b list -> ('a * 'b) list
  val unzip         : ('a * 'b) list -> 'a list * 'b list
  val split         : ('a * 'b) list -> 'a list * 'b list
  val mapfilter     : ('a -> 'b) -> 'a list -> 'b list
  val flatten       : 'a list list -> 'a list
  val pluck         : ('a -> bool) -> 'a list -> 'a * 'a list
  val enumerate     : int -> 'a list -> (int * 'a) list
  val repeat        : ('a -> 'a) -> 'a -> 'a
  val assoc         : ''a -> (''a * 'b) list -> 'b
  val rev_assoc     : ''a -> ('b * ''a) list -> 'b
  val assoc1        : ''a -> (''a * 'b) list -> (''a * 'b) option
  val assoc2        : ''a -> ('b * ''a) list -> ('b * ''a) option

  type ('a,'b) subst = {redex:'a, residue:'b} list
  val subst_assoc   : ('a -> bool) -> ('a,'b)subst -> 'b option
  val |->           : ('a * 'b) -> {redex:'a, residue:'b}

  val mem           : ''a -> ''a list -> bool
  val insert        : ''a -> ''a list -> ''a list
  val mk_set        : ''a list -> ''a list
  val union         : ''a list -> ''a list -> ''a list
  val U             : ''a list list -> ''a list
  val set_diff      : ''a list -> ''a list -> ''a list
  val subtract      : ''a list -> ''a list -> ''a list
  val intersect     : ''a list -> ''a list -> ''a list
  val null_intersection : ''a list -> ''a list -> bool
  val set_eq        : ''a list -> ''a list -> bool
  val op_mem        : ('a -> 'a -> bool) -> 'a -> 'a list -> bool
  val op_insert     : ('a -> 'a -> bool) -> 'a -> 'a list -> 'a list
  val op_union      : ('a -> 'a -> bool) -> 'a list -> 'a list -> 'a list
  val op_mk_set     : ('a -> 'a -> bool) -> 'a list -> 'a list
  val op_U          : ('a -> 'a -> bool) -> 'a list list -> 'a list
  val op_intersect  : ('a -> 'a -> bool) -> 'a list -> 'a list -> 'a list
  val op_set_diff   : ('a -> 'a -> bool) -> 'a list -> 'a list -> 'a list
  val for           : int -> int -> (int -> 'a) -> 'a list
  val for_se        : int -> int -> (int -> 'a) -> unit
  val list_of_array : 'a array -> 'a list
  val int_to_string : int -> string
  val string_to_int : string -> int
  val sort          : ('a -> 'a -> bool) -> 'a list -> 'a list
  val int_sort      : int list -> int list

  val start_time    : unit -> Timer.cpu_timer
  val end_time      : Timer.cpu_timer -> unit
  val time          : ('a -> 'b) -> 'a -> 'b

  type ('a,'b) istream
  val mk_istream    : ('a -> 'a) -> 'a -> ('a -> 'b) -> ('a,'b) istream
  val next          : ('a,'b) istream -> ('a,'b) istream
  val state         : ('a,'b) istream -> 'b
  val reset         : ('a,'b) istream -> ('a,'b) istream

  val say           : string -> unit

  (* quote puts double quotes around a string;

     mlquote does this and also quotes all of the characters in the string
     so that the resulting string could be printed out in a way that would
     make it a valid ML lexeme  (e.g., newlines turn into \n)
  *)
  val quote         : string -> string
  val mlquote       : string -> string

  val words2        : string -> string -> string list
  val commafy       : string list -> string list
  val prime         : string -> string

  val front_last    : 'a list -> 'a list * 'a
  val butlast       : 'a list -> 'a list
  val last          : 'a list -> 'a
  val funpow        : int -> ('a -> 'a) -> 'a -> 'a
  val with_flag     : 'a ref * 'a -> ('b -> 'c) -> 'b -> 'c
  val hash          : int -> string -> int*int -> int
  val list_compare  : ('a * 'a -> order) -> 'a list * 'a list -> order

  datatype 'a delta 
       = SAME 
       | DIFF of 'a

  val delta_apply   : ('a -> 'a delta) -> 'a -> 'a
  val delta_map     : ('a -> 'a delta) -> 'a list -> 'a list delta
  val delta_pair    : ('a -> 'a delta) -> ('b -> 'b delta) 
                       -> 'a * 'b -> ('a * 'b) delta
end

signature Globals =
sig

  val HOLDIR                 : string
  val release                : string
  val version                : int

  val show_types             : bool ref
  val show_numeral_types     : bool ref
  val show_assums            : bool ref
  val show_tags              : bool ref
  val show_axioms            : bool ref
  val show_scrub             : bool ref
  val linewidth              : int ref
  val max_print_depth        : int ref
  val type_pp_prefix         : string ref
  val type_pp_suffix         : string ref
  val term_pp_prefix         : string ref
  val term_pp_suffix         : string ref
  val goal_line              : string ref
  val old                    : (string -> string) ref
  val pp_flags               : {show_types         : bool ref,
                                show_numeral_types : bool ref}

  val priming                : string option ref
  val guessing_tyvars        : bool ref
  val guessing_overloads     : bool ref
  val notify_on_tyvar_guess  : bool ref

  val strings_defined        : unit -> bool
  val assert_strings_defined : unit -> unit

end

signature Count =
sig

  datatype rule = Assume | Refl | Beta | Subst | Abs | Disch | Mp | InstType
                | MkComb | ApTerm | ApThm | Alpha | EtaConv 
                | Sym | Trans | EqMp | EqImpRule | Inst
                | Spec | Gen 
                | Exists | Choose 
                | Conj | Conjunct1 | Conjunct2
                | Disj1 | Disj2 | DisjCases
                | NotIntro | NotElim  | Ccontr 
                | Definition | Axiom | Disk | Oracle;

  val counting_thms   : bool -> unit
  val reset_thm_count : unit -> unit
  val inc_count       : rule -> unit

  val thm_count : unit -> 
   {ASSUME : int, REFL : int, 
    BETA_CONV : int, SUBST : int, 
    ABS : int, DISCH : int, 
    MP : int, INST_TYPE : int, 
    MK_COMB : int, AP_TERM : int, 
    AP_THM : int, ALPHA : int, 
    ETA_CONV : int,
    SYM : int, TRANS : int, 
    EQ_MP : int, EQ_IMP_RULE : int, 
    INST : int, SPEC : int, GEN : int, 
    EXISTS : int, CHOOSE : int,
    CONJ : int, CONJUNCT1 : int, 
    CONJUNCT2 : int, DISJ1 : int, 
    DISJ2 : int, DISJ_CASES : int, 
    NOT_INTRO : int, NOT_ELIM : int, CCONTR : int, 
    definition : int, axiom : int, 
    from_disk : int, oracle :int,      total :int }

  type meter
  val mk_meter  : unit -> meter
  val read   : meter -> {axioms:int,defns:int,oracles:int,disk:int,prims:int}
  val report : {axioms:int,defns:int,oracles:int,disk:int,prims:int} -> unit
  val apply  : ('a -> 'b) -> 'a -> 'b

end;

signature Definition =
sig
  type term = Term.term
  type thm  = Thm.thm

  val new_type_definition : string * thm -> thm
  val new_definition      : string * term -> thm
  val new_specification   : string * string list * thm -> thm

  val new_definition_hook : ((term -> term list * term) *
                             (term list * thm -> thm)) ref
end

structure HolKernel =
struct
  structure Type = Type
  structure Term = Term
  structure Tag  = Tag
  structure Thm  = Thm
  structure Theory = Theory
  structure Definition = Definition

  open Feedback Globals Lib Type Term Thm Theory Definition


val ty_antiq      : hol_type -> term
val dest_ty_antiq : term -> hol_type
val is_ty_antiq   : term -> bool


val dest_monop (name,thy) e M =
val dest_binop (name,thy) e tm =
val strip_binop dest = 
val mk_binder c f (p as (Bvar,_)) =
val dest_binder (name,thy) e M =
val strip_binder dest =
val list_mk_fun (dtys, rty) = 
val strip_fun = 
val list_mk_abs : term list * term -> term 
val strip_abs : term -> term list * term 
val strip_comb : term -> term * term list

datatype lambda 
   = VAR   of string * hol_type
   | CONST of {Name:string, Thy:string, Ty:hol_type}
   | COMB  of term * term
   | LAMB  of term * term;

val dest_term : term -> lambda 
val disch : term * term list -> term list


(*---------------------------------------------------------------------------*
 * Search a term for a sub-term satisfying the predicate P. If application   *
 * of P raises an exception, that propagates to the caller. Therefore,       *
 * P should be a total predicate: otherwise, the caller won't know whether   *
 * the search failed because the sought-for subterm is not there, or because *
 * P failed.                                                                 *
 *---------------------------------------------------------------------------*)

val find_term : (term -> bool) -> term -> term 
val find_terms: (term -> bool) -> term -> term list

(*---------------------------------------------------------------------------
 * Subst_occs
 * Put a new variable in tm2 at designated (and free) occurrences of redex.
 * Rebuilds the entire term.
 *---------------------------------------------------------------------------*)
val subst_occs occ_lists tm_subst tm =
val thm_free_vars : thm -> term list
val ho_match_term : term list -> term -> term 
                      -> (term,term)subst * (hol_type,hol_type)subst
end

(* ===================================================================== *)
(* FILE          : Net.sig                                               *)
(* DESCRIPTION   : Signature for term nets.                              *)
(*                                                                       *)
(* AUTHOR        : Originally, Larry Paulson for LCF. Then ICL HOL group *)
(* DATE          : August 26, 1991                                       *)
(* Rewritten and                                                         *)
(* Expanded      : July 17, 1999, Konrad Slind                           *)
(* ===================================================================== *)

signature Net =
sig
  type 'a net
  type term = Term.term

  val empty     : 'a net
  val insert    : term * 'a -> 'a net -> 'a net
  val match     : term -> 'a net -> 'a list
  val index     : term -> 'a net -> 'a list
  val delete    : term * ('a -> bool) -> 'a net -> 'a net
  val filter    : ('a -> bool) -> 'a net -> 'a net
  val union     : 'a net -> 'a net -> 'a net
  val map       : ('a -> 'b) -> 'a net -> 'b net
  val itnet     : ('a -> 'b -> 'b) -> 'a net -> 'b -> 'b
  val size      : 'a net -> int
  val listItems : 'a net -> 'a list

  val enter     : term * 'a -> 'a net -> 'a net  (* for compatibility *)
  val lookup    : term -> 'a net -> 'a list      (* for compatibility *)


(*---------------------------------------------------------------------------

    A term net is a collection of items, each of which can be thought
    of as being indexed by a path which is computed from a term which
    is supplied when the item is inserted into the net. Type information, 
    and the names of variables, is not represented in paths, so more than
    one term may be indexed by the same path, i.e., the extraction 
    operations are not exact. In this sense, term nets are akin to
    hash tables.

  [empty] is the empty term net.

  [insert (tm, x) net]

    The term tm is used as a key to compute a path at which to
    store x in net. If the path does not already exist in net, 
    it is created. Note that insert merely adds x to the net; 
    if x has already been stored under tm, then it is not overwritten.

  [match tm net]
  
    Term nets can be used to cut down on the number of match attempts
    that a matching function would have to make, say when rewriting
    with a collection of theorems. "match tm net" will return every 
    element that has been inserted into the net using a term M as the 
    key, such that M possibly matches tm. The matches are returned in
    "most specific match first" order.
  
   [index tm net]

    An alternative use of term nets ignores any paths in the net
    arising from clearly non-alpha-convertible terms. "index" is a more
    discriminating entrypoint than "match", in the sense that the set
    of results is always a subset of those returned for matches.

   [delete (tm,P) net] uses tm as an index into the net. There can be
     more than one element indexable by tm. The net resulting from 
     removing all such elements that also meet the predicate P is 
     returned.

   [filter P net] The net resulting from removing all elements meeting
      P is returned.

   [union net1 net2] joins net1 and net2. Looking up or fetching
     an element from the result should return the union of the 
     results of separately fetching or looking up in net1 and net2.

   [map f net] returns a new net, each element of which has had f
     applied to it.

   [itnet f net b] folds function f through net, with base value b.

   [size net] returns the number of elements in the net.

   [listItems net] lists the elements in the net, in no particular order.

   [enter (tm,x) net] An outdated version of insert, kept for compatibility.

   [lookup tm net] An outdated version of match, kept for compatibility.

 ---------------------------------------------------------------------------*)
end;

(* ===================================================================== *)
(* FILE          : Lexis.sig                                             *)
(* DESCRIPTION   : Signature for functions defining lexical structure    *)
(*                 of hol90 types and terms.                             *)
(*                                                                       *)
(* AUTHOR        : Konrad Slind, University of Calgary                   *)
(* DATE          : August 26, 1991                                       *)
(* Modified      : September 22, 1997, Ken Larsen                        *)
(* ===================================================================== *)


signature Lexis =
sig
  val alphanumerics         : Word8Array.array
  val hol_symbols           : Word8Array.array
  val sml_symbols           : Word8Array.array
  val alphabet              : Word8Array.array
  val numbers               : Word8Array.array
  val tyvar_ids             : Word8Array.array
  val parens                : Word8Array.array
  val in_class              : Word8Array.array * int -> bool

  val allowed_user_type_var : string -> bool
  val allowed_type_constant : string -> bool
  val allowed_term_constant : string -> bool
  val ok_identifier         : string -> bool
  val ok_symbolic           : string -> bool
  val ok_sml_identifier     : string -> bool
  val is_num_literal        : string -> bool
  val is_string_literal     : string -> bool

  val tyvar_vary            : string -> string
  val tmvar_vary            : string -> string
  val gen_variant           : (string -> string) -> string list 
                               -> string -> string
end;

(* ===================================================================== *)
(* FILE          : Subst.sig                                             *)
(* DESCRIPTION   : Explicit Substitutions                                *)
(*                                                                       *)
(* AUTHOR        : (c) Bruno Barras, Cambridge University and            *)
(*                                   INRIA Rocquencourt                  *)
(* DATE          : 1999                                                  *)
(* ===================================================================== *)

signature Subst =
sig
  eqtype 'a subs;

  val id      : 'a subs;
  val cons    : 'a subs * 'a -> 'a subs;
  val shift   : int * 'a subs -> 'a subs;
  val lift    : int * 'a subs -> 'a subs;
  val is_id   : 'a subs -> bool;
  val exp_rel : 'a subs * int -> int * 'a option;
  val comp    : ('a subs * 'a -> 'a) -> 'a subs * 'a subs -> 'a subs;

end;

signature Tag =
sig
     type tag

     val read   : string -> tag
     val merge  : tag -> tag -> tag
     val pp_tag : Portable.ppstream -> tag -> unit

end 

signature Term =
sig

  eqtype term
  type hol_type     = Type.hol_type
  type ('a,'b)subst = ('a,'b)Lib.subst

  val type_of       : term -> hol_type
  val free_vars     : term -> term list
  val free_vars_lr  : term -> term list
  val free_in       : term -> term -> bool
  val all_vars      : term -> term list
  val free_varsl    : term list -> term list
  val all_varsl     : term list -> term list
  val type_vars_in_term : term -> hol_type list
  val tyvar_occurs  : hol_type -> term -> bool
  val var_occurs    : term -> term -> bool
  val existsFV      : (string * hol_type -> bool) -> term -> bool
  val existsTYV     : (hol_type -> bool) -> term -> bool

  val genvar        : hol_type -> term
  val genvars       : hol_type -> int -> term list
  val variant       : term list -> term -> term
  val prim_variant  : term list -> term -> term

  val mk_var        : string * hol_type -> term
  val mk_primed_var : string * hol_type -> term
  val decls         : string -> term list
  val all_consts    : unit -> term list
  val mk_const      : string * hol_type -> term
  val prim_mk_const : {Thy:string, Name:string} -> term
  val mk_thy_const  : {Thy:string, Name:string, Ty:hol_type} -> term
  val list_mk_comb  : term * term list -> term
  val mk_comb       : term * term -> term
  val mk_abs        : term * term -> term
  val dest_var      : term -> string * hol_type
  val dest_const    : term -> string * hol_type
  val dest_thy_const: term -> {Thy:string, Name:string, Ty:hol_type}
  val dest_comb     : term -> term * term
  val dest_abs      : term -> term * term
  val is_var        : term -> bool
  val is_genvar     : term -> bool
  val is_const      : term -> bool
  val is_comb       : term -> bool
  val is_abs        : term -> bool

  val rator         : term -> term
  val rand          : term -> term
  val bvar          : term -> term
  val body          : term -> term
  val is_bvar       : term -> bool

  val aconv         : term -> term -> bool
  val beta_conv     : term -> term
  val eta_conv      : term -> term
  val subst         : (term,term) subst -> term -> term
  val inst          : (hol_type,hol_type) subst -> term -> term

  val raw_match     : term -> term
                       -> (term,term)subst 
                           * ((hol_type,hol_type)subst * hol_type list)
                       -> (term,term)subst 
                            * ((hol_type,hol_type)subst * hol_type list)
  val match_term    : term -> term 
                        -> (term,term)subst * (hol_type,hol_type)subst
  val norm_subst    : (hol_type,hol_type)subst 
                        -> (term,term)subst -> (term,term)subst

  val compare       : term * term -> order
end;

signature Theory =
sig

  type hol_type  = Type.hol_type
  type term      = Term.term
  type thm       = Thm.thm
  type ppstream  = Portable.ppstream
  type thy_addon = {sig_ps    : (ppstream -> unit) option,
                    struct_ps : (ppstream -> unit) option}
 
(* Create a new theory *)

  val new_theory         : string -> unit

(* Adding to the current theory *)

  val new_type           : string * int -> unit
  val new_constant       : string * hol_type -> unit
  val new_axiom          : string * term -> thm
  val save_thm           : string * thm -> thm

(* Delete from the current theory *)

  val delete_type        : string -> unit
  val delete_const       : string -> unit
  val delete_axiom       : string -> unit
  val delete_definition  : string -> unit
  val delete_theorem     : string -> unit

(* Information on the current theory segment *)

  val current_theory     : unit -> string
  val parents            : string -> string list
  val ancestry           : string -> string list
  val types              : string -> (string * int) list
  val constants          : string -> term list
  val axioms             : unit -> (string * thm) list
  val definitions        : unit -> (string * thm) list
  val theorems           : unit -> (string * thm) list
  val axiom              : string -> thm
  val definition         : string -> thm
  val theorem            : string -> thm

(* Support for persistent theories *)

  val adjoin_to_theory   : thy_addon -> unit
  val export_theory      : unit -> unit
  val after_new_theory   : (string -> unit) -> unit

(* Freshness information on HOL objects *)

  val uptodate_type      : hol_type -> bool
  val uptodate_term      : term -> bool
  val uptodate_thm       : thm -> bool
  val scrub              : unit -> unit

(* Changing internal bindings of ML-level names to theory objects *)

  val set_MLname         : string -> string -> unit

(* For internal use *)

  val pp_thm             : (ppstream -> thm -> unit) ref
  val link_parents       : string*int*int -> (string*int*int)list -> unit
  val incorporate_types  : string -> (string*int) list -> unit
  val incorporate_consts : string -> (string*hol_type)list -> unit

end;

signature TheoryPP =
sig
 type thm      = Thm.thm
 type hol_type = Type.hol_type
 type ppstream = Portable.ppstream

 val pp_type : string -> string -> ppstream -> hol_type -> unit

 val pp_sig 
   : (ppstream -> thm -> unit)
     -> {name        : string,
         parents     : string list,
         axioms      : (string * thm) list,
         definitions : (string * thm) list,
         theorems    : (string * thm) list,
         sig_ps      : (ppstream -> unit) option list} 
     -> ppstream 
     -> unit

 val pp_struct
   : {theory      : string*int*int,
      parents     : (string*int*int) list,
      types       : (string*int) list,
      constants   : (string*hol_type) list,
      axioms      : (string * thm) list,
      definitions : (string * thm) list,
      theorems    : (string * thm) list,
      struct_ps   : (ppstream -> unit) option list} 
   -> ppstream 
   -> unit

end

signature Thm =
sig

  type thm
  type tag      = Tag.tag
  type term     = Term.term  
  type hol_type = Type.hol_type



  (* Simple operations on the type of theorems *)

  val tag           : thm -> tag
  val hyp           : thm -> term list
  val concl         : thm -> term
  val dest_thm      : thm -> term list * term
  val thm_frees     : thm -> term list


  (* The primitive rules of inference *)

  val ASSUME        : term -> thm
  val REFL          : term -> thm
  val BETA_CONV     : term -> thm
  val ABS           : term -> thm -> thm
  val DISCH         : term -> thm -> thm
  val MP            : thm -> thm -> thm
  val SUBST         : (term,thm)Lib.subst -> term -> thm -> thm
  val INST_TYPE     : (hol_type,hol_type)Lib.subst -> thm -> thm


  (* Now some derivable-but-primitive rules of inference *)


  (* Lambda calculus rules *)

  val ALPHA         : term -> term -> thm
  val MK_COMB       : thm * thm -> thm
  val AP_TERM       : term -> thm -> thm
  val AP_THM        : thm -> term -> thm
  val ETA_CONV      : term -> thm


  (* Equality *)

  val SYM           : thm -> thm
  val TRANS         : thm -> thm -> thm
  val EQ_MP         : thm -> thm -> thm
  val EQ_IMP_RULE   : thm -> thm * thm


  (* Free variable instantiation *)

  val INST          : (term,term)Lib.subst -> thm -> thm


  (* Universal quantification *)

  val SPEC          : term -> thm -> thm
  val GEN           : term -> thm -> thm


  (* Existential quantification *)

  val EXISTS        : term * term -> thm -> thm
  val CHOOSE        : term * thm -> thm -> thm


  (* Conjunction *)

  val CONJ          : thm -> thm -> thm
  val CONJUNCT1     : thm -> thm
  val CONJUNCT2     : thm -> thm


  (* Disjunction *)

  val DISJ1         : thm -> term -> thm
  val DISJ2         : term -> thm -> thm
  val DISJ_CASES    : thm -> thm -> thm -> thm


  (* Negation *)

  val NOT_INTRO     : thm -> thm
  val NOT_ELIM      : thm -> thm
  val CCONTR        : term -> thm -> thm


  (* Computing with explicit substitutions *)

  val Beta          : thm -> thm
  val Eta           : thm -> thm
  val Mk_comb       : thm -> thm * thm * (thm -> thm -> thm)
  val Mk_abs        : thm -> term * thm * (thm -> thm)
  val Spec          : term -> thm -> thm


  (* Oracle invocation *)

  val mk_thm        : term list * term -> thm
  val mk_oracle_thm : tag -> term list * term -> thm

  (* Fetching theorems from disk *)

  val disk_thm      : term vector 
                       -> string * 'a frag list list * 'a frag list -> thm
end;

signature Type =
sig

 eqtype hol_type

 val mk_vartype    : string -> hol_type
 val gen_tyvar     : unit -> hol_type
 val dest_vartype  : hol_type -> string
 val is_vartype    : hol_type -> bool
 val is_gen_tyvar  : hol_type -> bool

 val mk_type       : string * hol_type list -> hol_type
 val dest_type     : hol_type -> string * hol_type list
 val is_type       : hol_type -> bool
 val mk_thy_type   : {Thy:string, Tyop:string, Args:hol_type list} -> hol_type
 val dest_thy_type : hol_type -> {Thy:string, Tyop:string, Args:hol_type list}

 val type_vars     : hol_type -> hol_type list
 val type_varsl    : hol_type list -> hol_type list
 val type_var_in   : hol_type -> hol_type -> bool
 val exists_tyvar  : (hol_type -> bool) -> hol_type -> bool
 val polymorphic   : hol_type -> bool
 val compare       : hol_type * hol_type -> order

 val -->           : hol_type * hol_type -> hol_type  (* infixr 3 --> *)
 val dom_rng       : hol_type -> hol_type * hol_type  (* inverts -->  *)
 val bool          : hol_type
 val ind           : hol_type
 val alpha         : hol_type
 val beta          : hol_type
 val gamma         : hol_type
 val delta         : hol_type

 val type_subst    : (hol_type,hol_type) Lib.subst -> hol_type -> hol_type
 val match_type    : hol_type -> hol_type -> (hol_type,hol_type) Lib.subst

end;
