cleanup, mark old (<1994) deleted files as dead
authorkleing
Sat, 05 Apr 2003 16:24:20 +0200
changeset 13895 b6105462ccd3
parent 13894 8018173a7979
child 13896 717bd79b976f
cleanup, mark old (<1994) deleted files as dead
src/HOLCF/cfun1.ML
src/Pure/Syntax/earley0A.ML
src/Pure/Syntax/extension.ML
src/Pure/Syntax/parse_tree.ML
src/Pure/Syntax/sextension.ML
src/Pure/Syntax/xgram.ML
src/Pure/Thy/parse.ML
src/Pure/Thy/read.ML
src/Pure/Thy/scan.ML
src/Pure/Thy/syntax.ML
src/ZF/Fin.ML
src/ZF/Fin.thy
src/ZF/IMP/Aexp.ML
src/ZF/IMP/Aexp.thy
src/ZF/IMP/Assign.ML
src/ZF/IMP/Assign.thy
src/ZF/IMP/Bexp.ML
src/ZF/IMP/Bexp.thy
src/ZF/IMP/Evala.ML
src/ZF/IMP/Evala.thy
src/ZF/IMP/Evala0.thy
src/ZF/IMP/Evalb.ML
src/ZF/IMP/Evalb.thy
src/ZF/IMP/Evalb0.thy
src/ZF/IMP/Evalc.ML
src/ZF/IMP/Evalc.thy
src/ZF/IMP/Evalc0.thy
src/ZF/ListFn.ML
src/ZF/ListFn.thy
src/ZF/Ord.ML
src/ZF/Ord.thy
src/ZF/Pair.ML
src/ZF/Pair.thy
src/ZF/Zorn0.ML
src/ZF/Zorn0.thy
src/ZF/arith.ML
src/ZF/arith.thy
src/ZF/bool.ML
src/ZF/bool.thy
src/ZF/co-inductive.ML
src/ZF/coinductive.ML
src/ZF/coinductive.thy
src/ZF/datatype.ML
src/ZF/datatype.thy
src/ZF/epsilon.ML
src/ZF/epsilon.thy
src/ZF/ex/BT_Fn.ML
src/ZF/ex/BT_Fn.thy
src/ZF/ex/BinFn.ML
src/ZF/ex/BinFn.thy
src/ZF/ex/Contract0.ML
src/ZF/ex/Contract0.thy
src/ZF/ex/Equiv.ML
src/ZF/ex/Equiv.thy
src/ZF/ex/LListFn.ML
src/ZF/ex/LListFn.thy
src/ZF/ex/LList_Eq.ML
src/ZF/ex/ParContract.ML
src/ZF/ex/Primrec0.ML
src/ZF/ex/Primrec0.thy
src/ZF/ex/Prop.ML
src/ZF/ex/TF_Fn.ML
src/ZF/ex/TF_Fn.thy
src/ZF/ex/TermFn.ML
src/ZF/ex/TermFn.thy
src/ZF/ex/acc.ML
src/ZF/ex/bin.ML
src/ZF/ex/binfn.ML
src/ZF/ex/binfn.thy
src/ZF/ex/bt.ML
src/ZF/ex/bt_fn.ML
src/ZF/ex/bt_fn.thy
src/ZF/ex/comb.ML
src/ZF/ex/contract0.ML
src/ZF/ex/contract0.thy
src/ZF/ex/counit.ML
src/ZF/ex/data.ML
src/ZF/ex/enum.ML
src/ZF/ex/equiv.ML
src/ZF/ex/equiv.thy
src/ZF/ex/integ.ML
src/ZF/ex/integ.thy
src/ZF/ex/listn.ML
src/ZF/ex/llist.ML
src/ZF/ex/llist_eq.ML
src/ZF/ex/llistfn.ML
src/ZF/ex/llistfn.thy
src/ZF/ex/parcontract.ML
src/ZF/ex/primrec0.ML
src/ZF/ex/primrec0.thy
src/ZF/ex/prop.ML
src/ZF/ex/proplog.ML
src/ZF/ex/proplog.thy
src/ZF/ex/ramsey.ML
src/ZF/ex/ramsey.thy
src/ZF/ex/rmap.ML
src/ZF/ex/term.ML
src/ZF/ex/termfn.ML
src/ZF/ex/termfn.thy
src/ZF/ex/tf.ML
src/ZF/ex/tf_fn.ML
src/ZF/ex/tf_fn.thy
src/ZF/ex/twos-compl.ML
src/ZF/fin.ML
src/ZF/fin.thy
src/ZF/fixedpt.ML
src/ZF/fixedpt.thy
src/ZF/ind-syntax.ML
src/ZF/inductive.ML
src/ZF/inductive.thy
src/ZF/intr-elim.ML
src/ZF/list.ML
src/ZF/list.thy
src/ZF/listfn.ML
src/ZF/listfn.thy
src/ZF/nat.ML
src/ZF/nat.thy
src/ZF/ord.ML
src/ZF/ord.thy
src/ZF/perm.ML
src/ZF/perm.thy
src/ZF/qpair.ML
src/ZF/qpair.thy
src/ZF/quniv.ML
src/ZF/quniv.thy
src/ZF/sum.ML
src/ZF/sum.thy
src/ZF/trancl.ML
src/ZF/trancl.thy
src/ZF/univ.ML
src/ZF/univ.thy
src/ZF/wf.ML
src/ZF/wf.thy
src/ZF/zf.ML
src/ZF/zf.thy
--- a/src/HOLCF/cfun1.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-(*  Title: 	HOLCF/cfun1.ML
-    ID:         $Id$
-    Author: 	Franz Regensburger
-    Copyright   1993 Technische Universitaet Muenchen
-
-Lemmas for cfun1.thy 
-*)
-
-open Cfun1;
-
-(* ------------------------------------------------------------------------ *)
-(* A non-emptyness result for Cfun                                          *)
-(* ------------------------------------------------------------------------ *)
-
-val CfunI = prove_goalw Cfun1.thy [Cfun_def] "(% x.x):Cfun"
- (fn prems =>
-	[
-	(rtac (mem_Collect_eq RS ssubst) 1),
-	(rtac contX_id 1)
-	]);
-
-
-(* ------------------------------------------------------------------------ *)
-(* less_cfun is a partial order on type 'a -> 'b                            *)
-(* ------------------------------------------------------------------------ *)
-
-val refl_less_cfun = prove_goalw Cfun1.thy [less_cfun_def] "less_cfun(f,f)"
-(fn prems =>
-	[
-	(rtac refl_less 1)
-	]);
-
-val antisym_less_cfun = prove_goalw Cfun1.thy [less_cfun_def] 
-	"[|less_cfun(f1,f2); less_cfun(f2,f1)|] ==> f1 = f2"
-(fn prems =>
-	[
-	(cut_facts_tac prems 1),
-	(rtac injD 1),
-	(rtac antisym_less 2),
-	(atac 3),
-	(atac 2),
-	(rtac inj_inverseI 1),
-	(rtac Rep_Cfun_inverse 1)
-	]);
-
-val trans_less_cfun = prove_goalw Cfun1.thy [less_cfun_def] 
-	"[|less_cfun(f1,f2); less_cfun(f2,f3)|] ==> less_cfun(f1,f3)"
-(fn prems =>
-	[
-	(cut_facts_tac prems 1),
-	(etac trans_less 1),
-	(atac 1)
-	]);
-
-(* ------------------------------------------------------------------------ *)
-(* lemmas about application of continuous functions                         *)
-(* ------------------------------------------------------------------------ *)
-
-val cfun_cong = prove_goal Cfun1.thy 
-	 "[| f=g; x=y |] ==> f[x] = g[y]"
-(fn prems =>
-	[
-	(cut_facts_tac prems 1),
-	(fast_tac HOL_cs 1)
-	]);
-
-val cfun_fun_cong = prove_goal Cfun1.thy "f=g ==> f[x] = g[x]"
-(fn prems =>
-	[
-	(cut_facts_tac prems 1),
-	(etac cfun_cong 1),
-	(rtac refl 1)
-	]);
-
-val cfun_arg_cong = prove_goal Cfun1.thy "x=y ==> f[x] = f[y]"
-(fn prems =>
-	[
-	(cut_facts_tac prems 1),
-	(rtac cfun_cong 1),
-	(rtac refl 1),
-	(atac 1)
-	]);
-
-
-(* ------------------------------------------------------------------------ *)
-(* additional lemma about the isomorphism between -> and Cfun               *)
-(* ------------------------------------------------------------------------ *)
-
-val Abs_Cfun_inverse2 = prove_goal Cfun1.thy "contX(f) ==> fapp(fabs(f)) = f"
-(fn prems =>
-	[
-	(cut_facts_tac prems 1),
-	(rtac Abs_Cfun_inverse 1),
-	(rewrite_goals_tac [Cfun_def]),
-	(etac (mem_Collect_eq RS ssubst) 1)
-	]);
-
-(* ------------------------------------------------------------------------ *)
-(* simplification of application                                            *)
-(* ------------------------------------------------------------------------ *)
-
-val Cfunapp2 = prove_goal Cfun1.thy 
-	"contX(f) ==> (fabs(f))[x] = f(x)"
-(fn prems =>
-	[
-	(cut_facts_tac prems 1),
-	(etac (Abs_Cfun_inverse2 RS fun_cong) 1)
-	]);
-
-(* ------------------------------------------------------------------------ *)
-(* beta - equality for continuous functions                                 *)
-(* ------------------------------------------------------------------------ *)
-
-val beta_cfun = prove_goal Cfun1.thy 
-	"contX(c1) ==> (LAM x .c1(x))[u] = c1(u)"
-(fn prems =>
-	[
-	(cut_facts_tac prems 1),
-	(rtac Cfunapp2 1),
-	(atac 1)
-	]);
-
-(* ------------------------------------------------------------------------ *)
-(* load ML file cinfix.ML                                                   *)
-(* ------------------------------------------------------------------------ *)
-
-
- writeln "Reading file  cinfix.ML"; 
-use "cinfix.ML";
--- a/src/Pure/Syntax/earley0A.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,465 +0,0 @@
-(*  Title:      Pure/Syntax/earley0A.ML
-    ID:         $Id$
-    Author:     Tobias Nipkow
-
-WARNING: This file is about to disappear.
-*)
-
-signature PARSER =
-sig
-  structure Lexicon: LEXICON
-  structure SynExt: SYN_EXT
-  local open Lexicon SynExt SynExt.Ast in
-    type gram
-    val empty_gram: gram
-    val extend_gram: gram -> string list -> xprod list -> gram
-    val merge_grams: gram -> gram -> gram
-    val pretty_gram: gram -> Pretty.T list
-    datatype parsetree =
-      Node of string * parsetree list |
-      Tip of token
-    val parse: gram -> string -> token list -> parsetree list
-  end
-end;
-
-functor EarleyFun(structure Symtab: SYMTAB and Lexicon: LEXICON
-  and SynExt: SYN_EXT)(*: PARSER *) =  (* FIXME *)
-struct
-
-structure Pretty = SynExt.Ast.Pretty;
-structure Lexicon = Lexicon;
-structure SynExt = SynExt;
-open Lexicon;
-
-
-(** datatype parsetree **)
-
-datatype parsetree =
-  Node of string * parsetree list |
-  Tip of token;
-
-fun mk_pt ("", [pt]) = pt
-  | mk_pt ("", _) = sys_error "mk_pt: funny copy op in parse tree"
-  | mk_pt (s, ptl) = Node (s, ptl);
-
-
-
-(** token maps (from lexicon.ML) **)
-
-type 'b TokenMap = (token * 'b list) list * 'b list;
-val first_token = 0;
-
-fun int_of_token(Token(tk)) = first_token |
-    int_of_token(IdentSy _) = first_token - 1 |
-    int_of_token(VarSy _) = first_token - 2 |
-    int_of_token(TFreeSy _) = first_token - 3 |
-    int_of_token(TVarSy _) = first_token - 4 |
-    int_of_token(EndToken) = first_token - 5;
-
-fun lesstk(s, t) = int_of_token(s) < int_of_token(t) orelse
-                  (case (s, t) of (Token(a), Token(b)) => a<b | _ => false);
-
-fun mkTokenMap(atll) =
-    let val aill = atll;
-        val dom = sort lesstk (distinct(flat(map snd aill)));
-        val mt = map fst (filter (null o snd) atll);
-        fun mktm(i) =
-            let fun add(l, (a, il)) = if i mem il then a::l else l
-            in (i, foldl add ([], aill)) end;
-    in (map mktm dom, mt) end;
-
-fun find_al (i) =
-    let fun find((j, al)::l) = if lesstk(i, j) then [] else
-                              if matching_tokens(i, j) then al else find l |
-            find [] = [];
-    in find end;
-fun applyTokenMap((l, mt), tk:token) = mt@(find_al tk l);
-
-
-
-(* Linked lists: *)
-infix 5 &;
-datatype 'a LList = nilL | op & of 'a * ('a LListR)
-withtype 'a LListR = 'a LList ref;
-
-(* Apply proc to all elements in a linked list *)
-fun seqll (proc: '_a -> unit) : ('_a LListR -> unit) =
-    let fun seq (ref nilL) = () |
-            seq (ref((a:'_a)&l)) = (proc a; seq l)
-    in seq end;
-
-fun llist_to_list (ref nilL) = [] |
-    llist_to_list (ref(a&ll)) = a::(llist_to_list ll);
-
-val len = length;
-
-local open Array SynExt in
-nonfix sub;
-
-fun forA(p: int -> unit, a: 'a array) : unit =
-    let val ub = length a
-        fun step(i) = if i=ub then () else (p(i); step(i+1));
-    in step 0 end;
-
-fun itA(a0:'a, b: 'b array)(f:'a * 'b -> 'a) : 'a =
-    let val ub = length b
-        fun acc(a,i) = if i=ub then a else acc(f(a,sub(b,i)),i+1)
-    in acc(a0,0) end;
-
-
-
-(** grammars **)
-
-datatype 'a symb =
-  Dlm of 'a |
-  Arg of string * int;
-
-datatype 'a prod = Prod of string * 'a symb list * string * int;
-
-
-datatype Symbol = T of token | NT of int * int
-     and Op = Op of OpSyn * string * int
-withtype OpSyn = Symbol array
-     and OpListA = Op array * int TokenMap
-     and FastAcc = int TokenMap;
-
-(*gram_tabs: name of nt -> number, nt number -> productions array,
-  nt number -> list of nt's reachable via copy ops*)
-
-type gram_tabs = int Symtab.table * OpListA array * int list array;
-
-type gram = string list * string prod list * gram_tabs;
-
-
-fun non_term (Arg (s, _)) = if is_terminal s then None else Some s
-  | non_term _ = None;
-
-fun non_terms (Prod (_, symbs, _, _)) = mapfilter non_term symbs;
-
-
-(* mk_pre_grammar *)
-(* converts a list of productions in external format into an
-   internal gram object. *)
-
-val dummyTM:FastAcc = mkTokenMap[];
-
-fun mk_pre_grammar prods : gram_tabs =
-  let
-    fun same_res (Prod(t1, _, _, _), Prod(t2, _, _, _)) = t1=t2;
-    val partitioned0 = partition_eq same_res prods;
-    val nts0 = map (fn Prod(ty, _, _, _)::_ => ty) partitioned0;
-    val nts' = distinct(flat(map non_terms prods)) \\ nts0;
-    val nts = nts' @ nts0;
-    val partitioned = (replicate (len nts') []) @ partitioned0;
-    val ntis = nts ~~ (0 upto (len(nts)-1));
-    val tab = foldr Symtab.update (ntis, Symtab.null);
-
-    fun nt_or_vt (s, p) =
-      (case predef_term s of
-        None => NT (the (Symtab.lookup (tab, s)), p)
-      | Some tk => T tk);
-
-    fun mksyn(Dlm(t)) = T(t)
-      | mksyn(Arg(t)) = nt_or_vt t;
-
-    fun prod2op(Prod(nt, sy, opn, p)) =
-        let val syA = arrayoflist(map mksyn sy) in Op(syA, opn, p) end;
-
-    fun mkops prods = (arrayoflist(map prod2op prods), dummyTM);
-
-    val opLA = arrayoflist(map mkops partitioned);
-
-    val subs = array(length opLA, []) : int list array;
-    fun newcp v (a, Op(syA, _, p)) =
-        if p=chain_pri
-        then let val NT(k, _) = sub(syA, 0)
-             in if k mem v then a else k ins a end
-        else a;
-    fun reach v i =
-        let val new = itA ([], #1(sub(opLA, i))) (newcp v)
-            val v' = new union v
-        in flat(map (reach v') new) union v' end;
-    fun rch(i) = update(subs, i, reach[i]i);
-
-  in
-    forA(rch, subs); (tab, opLA, subs)
-  end;
-
-
-val RootPref = "__";
-
-(* Lookahead tables for speeding up parsing. Lkhd is a mapping from
-nonterminals (in the form of OpList) to sets (lists) of token strings *)
-
-type Lkhd = token list list list;
-
-(* subst_syn(s, k) syn = [ pref k ts | ts is a token string derivable from sy
-                                      under substitution s ] *)
-(* This is the general version.
-fun cross l1 l2 = flat(map (fn e2 => (map (fn e1 => e1@e2) l1)) l2);
-
-(* pref k [x1,...,xn] is [x1,...,xk] if 0<=k<=n and [x1,...,xn] otherwise *)
-fun pref 0 l = []
-  | pref _ [] = []
-  | pref k (e::l) = e::(pref (k-1) l);
-
-fun subst_syn(s:Lkhd,k) =
-    let fun subst(ref(symb & syn)):token list list =
-              let val l1 = case symb of T t => [[t]] |
-                         NT(oplr,_) => let val Some l = assoc(s,!oplr) in l end
-              in distinct(map (pref k) (cross l1 (subst syn))) end |
-            subst _ = [[]]
-    in subst end;
-*)
-(* This one is specialized to lookahead 1 and a bit too generous *)
-fun subst_syn(s:Lkhd,1) syA =
-    let fun subst i = if i = length(syA) then [[]] else
-              case sub(syA,i) of
-                NT(j,_) => let val pre = nth_elem(j,s)
-                         in if [] mem pre then (pre \ []) union subst(i+1)
-                            else pre end |
-               T(tk) => [[tk]];
-    in subst 0 end;
-
-(* mk_lkhd(G,k) returns a table which associates with every nonterminal N in
-G the list of pref k s for all token strings s with N -G->* s *)
-
-fun mk_lkhd(opLA:OpListA array,k:int):Lkhd =
-    let fun step(s:Lkhd):Lkhd =
-            let fun subst_op(l,Op(sy,_,_)) = subst_syn(s,k)sy union l;
-                fun step2(l,(opA,_)) = l@[itA([],opA)subst_op];
-            in writeln"."; itA([],opLA)step2 end;
-        fun iterate(s:Lkhd):Lkhd = let val s' = step s
-              in if map len s = map len s' then s
-                 else iterate s' end
-    in writeln"Computing lookahead tables ...";
-       iterate (replicate (length opLA) []) end;
-
-
-(* mk_earley_gram *)       (* create look ahead tables *)
-
-fun mk_earley_gram (g as (tab, opLA, _):gram_tabs):gram_tabs =
-    let val lkhd = mk_lkhd(opLA, 1);
-        fun mk_fa(i):FastAcc =
-            let val opA = #1(sub(opLA, i));
-                fun start(j) = let val Op(sy, _, _) = sub(opA, j);
-                                   val pre = subst_syn(lkhd, 1) sy
-                        in (j, if [] mem pre then [] else map hd pre) end;
-            in mkTokenMap(map start (0 upto(length(opA)-1))) end;
-        fun updt(i) = update(opLA, i, (#1(sub(opLA, i)), mk_fa(i)));
-
-    in forA(updt, opLA); g end;
-
-
-(* compile_xgram *)
-
-fun compile_xgram (roots, prods) =
-  let
-    fun mk_root nt =
-      Prod (RootPref ^ nt, [Arg (nt, 0), Dlm EndToken], "", 0);
-
-    val prods' = (map mk_root roots) @ prods;
-  in
-    mk_earley_gram (mk_pre_grammar prods')
-  end;
-
-
-(* translate (from xgram.ML) *)
-
-fun translate trfn =
-  map (fn Dlm t => Dlm (trfn t) | Arg s => Arg s);
-
-
-(* mk_gram_tabs *)
-
-fun str_to_tok (opl: string prod list): token prod list =
-  map
-    (fn Prod (t, syn, s, pa) => Prod (t, translate Token syn, s, pa))
-    opl;
-
-fun mk_gram_tabs roots prods = compile_xgram (roots, str_to_tok prods);
-
-
-
-(** build gram **)
-
-fun mk_gram roots prods = (roots, prods, mk_gram_tabs roots prods);
-
-fun sub_gram (roots1, prods1, _) (roots2, prods2, _) =
-  roots1 subset roots2 andalso prods1 subset prods2;
-
-
-(* empty, extend, merge grams *)
-
-val empty_gram = mk_gram [] [];
-
-fun extend_gram (gram1 as (roots1, prods1, _)) roots2 xprods2 =
-  let
-    fun symb_of (Delim s) = Some (Dlm s)
-      | symb_of (Argument s_p) = Some (Arg s_p)
-      | symb_of _ = None;
-
-    fun prod_of (XProd (lhs, xsymbs, const, pri)) =
-      Prod (lhs, mapfilter symb_of xsymbs, const, pri);
-
-    val prods2 = distinct (map prod_of xprods2);
-  in
-    if roots2 subset roots1 andalso prods2 subset prods1 then gram1
-    else mk_gram (extend_list roots1 roots2) (extend_list prods1 prods2)
-  end;
-
-fun merge_grams (gram1 as (roots1, prods1, _)) (gram2 as (roots2, prods2, _)) =
-  if sub_gram gram2 gram1 then gram1
-  else if sub_gram gram1 gram2 then gram2
-  else mk_gram (merge_lists roots1 roots2) (merge_lists prods1 prods2);
-
-
-(* pretty_gram *)
-
-fun pretty_gram (_, prods, _) =
-  let
-    fun pretty_name name = [Pretty.str (name ^ " =")];
-
-    fun pretty_symb (Dlm s) = Pretty.str (quote s)
-      | pretty_symb (Arg (s, p)) =
-          if is_terminal s then Pretty.str s
-          else Pretty.str (s ^ "[" ^ string_of_int p ^ "]");
-
-    fun pretty_const "" = []
-      | pretty_const c = [Pretty.str ("=> " ^ quote c)];
-
-    fun pretty_pri p = [Pretty.str ("(" ^ string_of_int p ^ ")")];
-
-    fun pretty_prod (Prod (name, symbs, const, pri)) =
-      Pretty.block (Pretty.breaks (pretty_name name @
-        map pretty_symb symbs @ pretty_const const @ pretty_pri pri));
-  in
-    map pretty_prod prods
-  end;
-
-
-
-(* State: nonterminal#, production#, index in production,
-          index of originating state set,
-          parse trees generated so far,
-*)
-
-datatype State = St of int * int * int * int * parsetree list
-withtype StateSet  = State LListR * (State -> unit) LListR;
-type Compl = State -> unit;
-type StateSetList = StateSet array;
-(* Debugging:
-val print_SL = seqll(fn St(nti,pi,ip,fs,ptl)=>
-(print_int nti; prs" "; print_int pi; prs" "; print_int ip; prs" ";
-print_int fs; prs" "; print_int(len ptl); prs"\n"));
-
-fun print_SS(s1,delr) = (writeln"================="; print_SL s1);
-
-fun count_ss(ref nilL) = 0
-  | count_ss(ref(_ & ss)) = count_ss(ss)+1;
-
-fun print_stat(state_sets) =
-    let fun pr i = let val(s1,_)=sub(state_sets,i)
-                in prs" "; print_int(count_ss s1) end;
-    in prs"["; forA(pr,state_sets); prs"]\n" end;
-*)
-fun mt_stateS():StateSet = (ref nilL, ref nilL);
-
-fun mt_states(n):StateSetList = array(n,mt_stateS());
-
-fun ismt_stateS((ref nilL,_):StateSet) = true | ismt_stateS _ = false;
-
-fun fst_state((ref(st & _),_): StateSet) = st;
-
-fun apply_all_states(f,(slr,_):StateSet) = seqll f slr;
-
-fun add_state(nti,pi,ip,from,ptl,(sllr,delr):StateSet) =
-      let fun add(ref(St(nti',pi',ip',from',_) & rest)) =
-                if nti=nti' andalso pi=pi' andalso ip=ip' andalso from=from'
-                then ()
-                else add rest |
-              add(last as ref nilL) =
-                let val newst = St(nti,pi,ip,from,ptl)
-                in last := newst & ref nilL;
-                   seqll (fn compl => compl newst) delr
-                end;
-      in add sllr end;
-
-fun complete(nti,syA,opn,p,ptl,ss,si as (_,delr):StateSet,opLA,rchA) =
-      let val pt = mk_pt(opn,ptl)
-          fun compl(St(ntj,pj,jp,from,ptl)) =
-                let val Op(syj,_,_) = sub(fst(sub(opLA,ntj)),pj) in
-                if jp=length(syj) then () else
-                case sub(syj,jp) of
-                  NT(nt,p') => if p >= p' andalso nti mem sub(rchA,nt)
-                        then add_state(ntj,pj,jp+1,from,ptl@[pt], si)
-                        else ()
-                | _ => ()
-                end
-      in apply_all_states(compl,ss);
-         if length(syA)=0 (* delayed completion in case of empty production: *)
-         then delr := compl & ref(!delr) else ()
-      end;
-
-fun predict(tk,isi,si,p',opLA) = fn nti =>
-    let val (opA,tm) = sub(opLA,nti);
-        fun add(pi) = let val opr as Op(syA,_,p) = sub(opA,pi)
-                in if p < p' then () else add_state(nti,pi,0,isi,[],si) end
-    in seq add (applyTokenMap(tm,tk)) end;
-
-
-
-fun unknown c = error ("Unparsable category: " ^ c);
-
-fun syn_err toks =
-  error ("Syntax error at: " ^ quote (space_implode " " (map str_of_token toks)));
-
-fun parse ((_, _, (tab, opLA, rchA)):gram) (root:string) (tl: token list): parsetree list =
-  let
-    val tl' = tl;
-    val state_sets = mt_states(len tl' + 1);
-    val s0 = mt_stateS();
-    val rooti = case Symtab.lookup(tab, RootPref^root) of
-            Some(ri) => ri | None => unknown root;
-
-    fun lr (tl, isi, si, t) =
-        if ismt_stateS(si) then syn_err (t::tl) else
-        case tl of
-          [] => () |
-          t::tl =>
-            let val si1 = mt_stateS();
-                fun process(St(nti,pi,ip,from,ptl)) =
-                      let val opA = #1(sub(opLA,nti))
-                          val Op(syA,opn,p) = sub(opA,pi) in
-                    if ip = length(syA)
-                    then complete(nti,syA,opn,p,ptl,
-                                    sub(state_sets,from),si,opLA,rchA)
-                    else case sub(syA,ip) of
-                      NT(ntj,p) =>
-                            seq (predict(t,isi,si,p,opLA)) (sub(rchA,ntj))
-                    | T(t') =>
-                        if matching_tokens(t,t')
-                        then add_state(nti,pi,ip+1,from,
-                                       if valued_token(t)
-                                       then ptl@[Tip(t)] else ptl,
-                                       si1)
-                        else () end;
-
-        in apply_all_states(process,si);
-           update(state_sets,isi+1,si1);
-           lr(tl,isi+1,si1,t) end
-
-  in
-    update (state_sets, 0, s0);
-    add_state (rooti, 0, 0, 0, [], s0);
-    lr (tl', 0, s0, EndToken(*dummy*));
-    (*print_stat state_sets;*)
-    let val St(_, _, _, _, [pt]) = fst_state(sub(state_sets, len tl'))
-    in [pt] end
-  end;
-
-end;
-
-
-end;
-
--- a/src/Pure/Syntax/extension.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,315 +0,0 @@
-(*  Title:      Pure/Syntax/extension.ML
-    ID:         $Id$
-    Author:     Tobias Nipkow and Markus Wenzel, TU Muenchen
-
-External grammar definition (internal interface).
-*)
-
-signature EXTENSION0 =
-sig
-  val typeT: typ
-  val constrainC: string
-end;
-
-signature EXTENSION =
-sig
-  include EXTENSION0
-  structure XGram: XGRAM
-  local open XGram XGram.Ast in
-    datatype mfix = Mfix of string * typ * string * int list * int
-    datatype ext =
-      Ext of {
-        roots: string list,
-        mfix: mfix list,
-        extra_consts: string list,
-        parse_ast_translation: (string * (ast list -> ast)) list,
-        parse_translation: (string * (term list -> term)) list,
-        print_translation: (string * (term list -> term)) list,
-        print_ast_translation: (string * (ast list -> ast)) list} |
-      ExtRules of {
-        parse_rules: (ast * ast) list,
-        print_rules: (ast * ast) list} |
-      ExtRoots of string list
-    val logic: string
-    val args: string
-    val idT: typ
-    val varT: typ
-    val tfreeT: typ
-    val tvarT: typ
-    val typ_to_nonterm: typ -> string
-    val applC: string
-    val empty_xgram: xgram
-    val extend_xgram: xgram -> ext -> xgram
-    val mk_xgram: ext -> xgram
-  end
-end;
-
-functor ExtensionFun(structure XGram: XGRAM and Lexicon: LEXICON): EXTENSION =
-struct
-
-structure XGram = XGram;
-open XGram XGram.Ast Lexicon;
-
-
-(** datatype ext **)
-
-(*Mfix (sy, ty, c, ps, p):
-    sy: rhs of production as symbolic string
-    ty: type description of production
-    c: head of parse tree
-    ps: priorities of arguments in sy
-    p: priority of production*)
-
-datatype mfix = Mfix of string * typ * string * int list * int;
-
-datatype ext =
-  Ext of {
-    roots: string list,
-    mfix: mfix list,
-    extra_consts: string list,
-    parse_ast_translation: (string * (ast list -> ast)) list,
-    parse_translation: (string * (term list -> term)) list,
-    print_translation: (string * (term list -> term)) list,
-    print_ast_translation: (string * (ast list -> ast)) list} |
-  ExtRules of {
-    parse_rules: (ast * ast) list,
-    print_rules: (ast * ast) list} |
-  ExtRoots of string list;
-
-
-(* ext_components *)
-
-fun ext_components (Ext ext) = {
-      roots = #roots ext,
-      mfix = #mfix ext,
-      extra_consts = #extra_consts ext,
-      parse_ast_translation = #parse_ast_translation ext,
-      parse_rules = [],
-      parse_translation = #parse_translation ext,
-      print_translation = #print_translation ext,
-      print_rules = [],
-      print_ast_translation = #print_ast_translation ext}
-  | ext_components (ExtRules {parse_rules, print_rules}) = {
-      roots = [],
-      mfix = [],
-      extra_consts = [],
-      parse_ast_translation = [],
-      parse_rules = parse_rules,
-      parse_translation = [],
-      print_translation = [],
-      print_rules = print_rules,
-      print_ast_translation = []}
-  | ext_components (ExtRoots roots) = {
-      roots = roots,
-      mfix = [],
-      extra_consts = [],
-      parse_ast_translation = [],
-      parse_rules = [],
-      parse_translation = [],
-      print_translation = [],
-      print_rules = [],
-      print_ast_translation = []};
-
-
-(* empty_xgram *)
-
-val empty_xgram =
-  XGram {
-    roots = [], prods = [], consts = [],
-    parse_ast_translation = [],
-    parse_rules = [],
-    parse_translation = [],
-    print_translation = [],
-    print_rules = [],
-    print_ast_translation = []};
-
-
-(* syntactic categories *)
-
-val logic = "logic";
-val logicT = Type (logic, []);
-
-val logic1 = "logic1";
-val logic1T = Type (logic1, []);
-
-val args = "args";
-val argsT = Type (args, []);
-
-val funT = Type ("fun", []);
-
-val typeT = Type ("type", []);
-
-
-(* terminals *)
-
-val idT = Type (id, []);
-val varT = Type (var, []);
-val tfreeT = Type (tfree, []);
-val tvarT = Type (tvar, []);
-
-
-(* constants *)
-
-val applC = "_appl";
-val constrainC = "_constrain";
-
-
-(* typ_to_nonterm *)
-
-fun typ_to_nonterm (Type (c, _)) = c
-  | typ_to_nonterm _ = logic;
-
-fun typ_to_nonterm1 (Type (c, _)) = c
-  | typ_to_nonterm1 _ = logic1;
-
-
-
-(** mfix_to_prod **)
-
-fun mfix_to_prod (Mfix (sy, typ, const, pris, pri)) =
-  let
-    fun err msg =
-      (writeln ("Error in mixfix annotation " ^ quote sy ^ " for " ^ quote const);
-        error msg);
-
-    fun check_pri p =
-      if p >= 0 andalso p <= max_pri then ()
-      else err ("precedence out of range: " ^ string_of_int p);
-
-    fun blocks_ok [] 0 = true
-      | blocks_ok [] _ = false
-      | blocks_ok (Bg _ :: syms) n = blocks_ok syms (n + 1)
-      | blocks_ok (En :: _) 0 = false
-      | blocks_ok (En :: syms) n = blocks_ok syms (n - 1)
-      | blocks_ok (_ :: syms) n = blocks_ok syms n;
-
-    fun check_blocks syms =
-      if blocks_ok syms 0 then ()
-      else err "unbalanced block parentheses";
-
-
-    fun is_meta c = c mem ["(", ")", "/", "_"];
-
-    fun scan_delim_char ("'" :: c :: cs) =
-          if is_blank c then err "illegal spaces in delimiter" else (c, cs)
-      | scan_delim_char ["'"] = err "trailing escape character"
-      | scan_delim_char (chs as c :: cs) =
-          if is_blank c orelse is_meta c then raise LEXICAL_ERROR else (c, cs)
-      | scan_delim_char [] = raise LEXICAL_ERROR;
-
-    val scan_symb =
-      $$ "_" >> K (Nonterminal ("", 0)) ||
-      $$ "(" -- scan_int >> (Bg o #2) ||
-      $$ ")" >> K En ||
-      $$ "/" -- $$ "/" >> K (Brk ~1) ||
-      $$ "/" -- scan_any is_blank >> (Brk o length o #2) ||
-      scan_any1 is_blank >> (Space o implode) ||
-      repeat1 scan_delim_char >> (Terminal o implode);
-
-
-    val cons_fst = apfst o cons;
-
-    fun add_args [] ty [] = ([], typ_to_nonterm1 ty)
-      | add_args [] _ _ = err "too many precedences"
-      | add_args (Nonterminal _ :: syms) (Type ("fun", [ty, tys])) [] =
-          cons_fst (Nonterminal (typ_to_nonterm ty, 0)) (add_args syms tys [])
-      | add_args (Nonterminal _ :: syms) (Type ("fun", [ty, tys])) (p :: ps) =
-          cons_fst (Nonterminal (typ_to_nonterm ty, p)) (add_args syms tys ps)
-      | add_args (Nonterminal _ :: _) _ _ =
-          err "more arguments than in corresponding type"
-      | add_args (sym :: syms) ty ps = cons_fst sym (add_args syms ty ps);
-
-
-    fun is_arg (Nonterminal _) = true
-      | is_arg _ = false;
-
-    fun is_term (Terminal _) = true
-      | is_term (Nonterminal (s, _)) = is_terminal s
-      | is_term _ = false;
-
-    fun rem_pri (Nonterminal (s, _)) = Nonterminal (s, chain_pri)
-      | rem_pri sym = sym;
-
-
-    val (raw_symbs, _) = repeat scan_symb (explode sy);
-    val (symbs, lhs) = add_args raw_symbs typ pris;
-    val prod = Prod (lhs, symbs, const, pri);
-  in
-    seq check_pri pris;
-    check_pri pri;
-    check_blocks symbs;
-
-    if is_terminal lhs then err ("illegal lhs: " ^ lhs)
-    else if const <> "" then prod
-    else if length (filter is_arg symbs) <> 1 then
-      err "copy production must have exactly one argument"
-    else if exists is_term symbs then prod
-    else Prod (lhs, map rem_pri symbs, "", chain_pri)
-  end;
-
-
-
-(** extend_xgram **)
-
-fun extend_xgram (XGram xgram) ext =
-  let
-    fun descend (from, to) = Mfix ("_", to --> from, "", [0], 0);
-
-    fun parents T = Mfix ("'(_')", T --> T, "", [0], max_pri);
-
-    fun mkappl T =
-      Mfix ("(1_/(1'(_')))", [funT, argsT] ---> T, applC, [max_pri, 0], max_pri);
-
-    fun mkid T = Mfix ("_", idT --> T, "", [], max_pri);
-
-    fun mkvar T = Mfix ("_", varT --> T, "", [], max_pri);
-
-    fun constrain T =
-      Mfix ("_::_", [T, typeT] ---> T, constrainC, [max_pri, 0], max_pri - 1);
-
-
-    val {roots = roots1, prods, consts,
-      parse_ast_translation = parse_ast_translation1,
-      parse_rules = parse_rules1,
-      parse_translation = parse_translation1,
-      print_translation = print_translation1,
-      print_rules = print_rules1,
-      print_ast_translation = print_ast_translation1} = xgram;
-
-    val {roots = roots2, mfix, extra_consts,
-      parse_ast_translation = parse_ast_translation2,
-      parse_rules = parse_rules2,
-      parse_translation = parse_translation2,
-      print_translation = print_translation2,
-      print_rules = print_rules2,
-      print_ast_translation = print_ast_translation2} = ext_components ext;
-
-    val Troots = map (apr (Type, [])) (roots2 \\ roots1);
-    val Troots' = Troots \\ [typeT, propT, logicT];
-    val mfix' = mfix @ map parents (Troots \ logicT) @ map mkappl Troots' @
-      map mkid Troots' @ map mkvar Troots' @ map constrain Troots' @
-      map (apl (logicT, descend)) (Troots \\ [typeT, logicT]) @
-      map (apr (descend, logic1T)) Troots';
-    val mfix_consts =
-      distinct (filter is_xid (map (fn (Mfix (_, _, c, _, _)) => c) mfix'));
-  in
-    XGram {
-      roots = distinct (roots1 @ roots2),
-      prods = prods @ map mfix_to_prod mfix',
-      consts = extra_consts union (mfix_consts union consts),
-      parse_ast_translation = parse_ast_translation1 @ parse_ast_translation2,
-      parse_rules = parse_rules1 @ parse_rules2,
-      parse_translation = parse_translation1 @ parse_translation2,
-      print_translation = print_translation1 @ print_translation2,
-      print_rules = print_rules1 @ print_rules2,
-      print_ast_translation = print_ast_translation1 @ print_ast_translation2}
-  end;
-
-
-(* mk_xgram *)
-
-val mk_xgram = extend_xgram empty_xgram;
-
-
-end;
-
--- a/src/Pure/Syntax/parse_tree.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-(*  Title:      Pure/Syntax/parse_tree.ML
-    ID:         $Id$
-    Author:     Tobias Nipkow and Markus Wenzel, TU Muenchen
-
-TODO:
-  move parsetree to parser.ML
-  move pt_to_ast before ast_to_term (sextension.ML (?))
-  delete this file
-*)
-
-signature PARSE_TREE =
-sig
-  structure Ast: AST
-  structure Lexicon: LEXICON
-  local open Ast Lexicon in
-    datatype parsetree =
-      Node of string * parsetree list |
-      Tip of token
-    val pt_to_ast: (string -> (ast list -> ast) option) -> parsetree -> ast
-  end
-end;
-
-functor ParseTreeFun(structure Ast: AST and Lexicon: LEXICON): PARSE_TREE =
-struct
-
-structure Ast = Ast;
-structure Lexicon = Lexicon;
-open Ast Lexicon;
-
-
-(* datatype parsetree *)
-
-datatype parsetree =
-  Node of string * parsetree list |
-  Tip of token;
-
-
-(* pt_to_ast *)
-
-fun pt_to_ast trf pt =
-  let
-    fun trans a args =
-      (case trf a of
-        None => mk_appl (Constant a) args
-      | Some f => f args handle exn
-          => (writeln ("Error in parse ast translation for " ^ quote a); raise exn));
-
-    fun ast_of (Node (a, pts)) = trans a (map ast_of pts)
-      | ast_of (Tip tok) = Variable (str_of_token tok);
-  in
-    ast_of pt
-  end;
-
-
-end;
-
--- a/src/Pure/Syntax/sextension.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,591 +0,0 @@
-(*  Title:      Pure/Syntax/sextension.ML
-    ID:         $Id$
-    Author:     Tobias Nipkow and Markus Wenzel, TU Muenchen
-
-Syntax extensions (external interface): mixfix declarations, infixes,
-binders, translation rules / functions and the Pure syntax.
-
-TODO:
-  move ast_to_term, pt_to_ast (?)
-*)
-
-infix |-> <-| <->;
-
-signature SEXTENSION0 =
-sig
-  structure Parser: PARSER
-  local open Parser.SynExt.Ast in
-    datatype mixfix =
-      Mixfix of string * string * string * int list * int |
-      Delimfix of string * string * string |
-      Infixl of string * string * int |
-      Infixr of string * string * int |
-      Binder of string * string * string * int * int |
-      TInfixl of string * string * int |
-      TInfixr of string * string * int
-    datatype xrule =
-      op |-> of (string * string) * (string * string) |
-      op <-| of (string * string) * (string * string) |
-      op <-> of (string * string) * (string * string)
-    datatype sext =
-      Sext of {
-        mixfix: mixfix list,
-        parse_translation: (string * (term list -> term)) list,
-        print_translation: (string * (term list -> term)) list} |
-      NewSext of {
-        mixfix: mixfix list,
-        xrules: xrule list,
-        parse_ast_translation: (string * (ast list -> ast)) list,
-        parse_translation: (string * (term list -> term)) list,
-        print_translation: (string * (term list -> term)) list,
-        print_ast_translation: (string * (ast list -> ast)) list}
-    val eta_contract: bool ref
-    val mk_binder_tr: string * string -> string * (term list -> term)
-    val mk_binder_tr': string * string -> string * (term list -> term)
-    val dependent_tr': string * string -> term list -> term
-    val max_pri: int
-  end
-end;
-
-signature SEXTENSION1 =
-sig
-  include SEXTENSION0
-  local open Parser.SynExt.Ast in
-    val empty_sext: sext
-    val simple_sext: mixfix list -> sext
-    val constants: sext -> (string list * string) list
-    val pure_sext: sext
-    val syntax_types: string list
-    val syntax_consts: (string list * string) list
-    val constrainAbsC: string
-    val pure_trfuns:
-      (string * (ast list -> ast)) list *
-      (string * (term list -> term)) list *
-      (string * (term list -> term)) list *
-      (string * (ast list -> ast)) list
-  end
-end;
-
-signature SEXTENSION =
-sig
-  include SEXTENSION1
-  local open Parser Parser.SynExt Parser.SynExt.Ast in
-    val xrules_of: sext -> xrule list
-    val abs_tr': term -> term
-    val prop_tr': bool -> term -> term
-    val appl_ast_tr': ast * ast list -> ast
-    val syn_ext_of_sext: string list -> string list -> string list -> (string -> typ) -> sext -> syn_ext
-    val pt_to_ast: (string -> (ast list -> ast) option) -> parsetree -> ast
-    val ast_to_term: (string -> (term list -> term) option) -> ast -> term
-  end
-end;
-
-functor SExtensionFun(structure TypeExt: TYPE_EXT and Parser: PARSER
-  sharing TypeExt.SynExt = Parser.SynExt): SEXTENSION =
-struct
-
-structure Parser = Parser;
-open TypeExt Parser.Lexicon Parser.SynExt.Ast Parser.SynExt Parser;
-
-
-(** datatype sext **)   (* FIXME remove *)
-
-datatype mixfix =
-  Mixfix of string * string * string * int list * int |
-  Delimfix of string * string * string |
-  Infixl of string * string * int |
-  Infixr of string * string * int |
-  Binder of string * string * string * int * int |
-  TInfixl of string * string * int |
-  TInfixr of string * string * int;
-
-
-(* FIXME -> syntax.ML, BASIC_SYNTAX, SYNTAX *)
-datatype xrule =
-  op |-> of (string * string) * (string * string) |
-  op <-| of (string * string) * (string * string) |
-  op <-> of (string * string) * (string * string);
-
-datatype sext =
-  Sext of {
-    mixfix: mixfix list,
-    parse_translation: (string * (term list -> term)) list,
-    print_translation: (string * (term list -> term)) list} |
-  NewSext of {
-    mixfix: mixfix list,
-    xrules: xrule list,
-    parse_ast_translation: (string * (ast list -> ast)) list,
-    parse_translation: (string * (term list -> term)) list,
-    print_translation: (string * (term list -> term)) list,
-    print_ast_translation: (string * (ast list -> ast)) list};
-
-
-(* simple_sext *)
-
-fun simple_sext mixfix =
-  Sext {mixfix = mixfix, parse_translation = [], print_translation = []};
-
-
-(* empty_sext *)
-
-val empty_sext = simple_sext [];
-
-
-(* sext_components *)
-
-fun sext_components (Sext {mixfix, parse_translation, print_translation}) =
-      {mixfix = mixfix,
-        xrules = [],
-        parse_ast_translation = [],
-        parse_translation = parse_translation,
-        print_translation = print_translation,
-        print_ast_translation = []}
-  | sext_components (NewSext cmps) = cmps;
-
-
-(* mixfix_of *)
-
-fun mixfix_of (Sext {mixfix, ...}) = mixfix
-  | mixfix_of (NewSext {mixfix, ...}) = mixfix;
-
-
-(* xrules_of *)
-
-fun xrules_of (Sext _) = []
-  | xrules_of (NewSext {xrules, ...}) = xrules;
-
-
-
-(*** translation functions ***) (* FIXME -> trans.ML *)
-
-fun const c = Const (c, dummyT);
-
-
-(** parse (ast) translations **)
-
-(* application *)
-
-fun appl_ast_tr (*"_appl"*) [f, args] = Appl (f :: unfold_ast "_args" args)
-  | appl_ast_tr (*"_appl"*) asts = raise_ast "appl_ast_tr" asts;
-
-
-(* abstraction *)
-
-fun idtyp_ast_tr (*"_idtyp"*) [x, ty] = Appl [Constant constrainC, x, ty]
-  | idtyp_ast_tr (*"_idtyp"*) asts = raise_ast "idtyp_ast_tr" asts;
-
-fun lambda_ast_tr (*"_lambda"*) [idts, body] =
-      fold_ast_p "_abs" (unfold_ast "_idts" idts, body)
-  | lambda_ast_tr (*"_lambda"*) asts = raise_ast "lambda_ast_tr" asts;
-
-fun abs_tr (*"_abs"*) [Free (x, T), body] = absfree (x, T, body)
-  | abs_tr (*"_abs"*) (ts as [Const (c, _) $ Free (x, T) $ tT, body]) =
-      if c = constrainC then
-        const "_constrainAbs" $ absfree (x, T, body) $ tT
-      else raise_term "abs_tr" ts
-  | abs_tr (*"_abs"*) ts = raise_term "abs_tr" ts;
-
-
-(* nondependent abstraction *)
-
-fun k_tr (*"_K"*) [t] = Abs ("uu", dummyT, incr_boundvars 1 t)
-  | k_tr (*"_K"*) ts = raise_term "k_tr" ts;
-
-
-(* binder *)
-
-fun mk_binder_tr (sy, name) =
-  let
-    fun tr (Free (x, T), t) = const name $ absfree (x, T, t)
-      | tr (Const ("_idts", _) $ idt $ idts, t) = tr (idt, tr (idts, t))
-      | tr (t1 as Const (c, _) $ Free (x, T) $ tT, t) =
-          if c = constrainC then
-            const name $ (const "_constrainAbs" $ absfree (x, T, t) $ tT)
-          else raise_term "binder_tr" [t1, t]
-      | tr (t1, t2) = raise_term "binder_tr" [t1, t2];
-
-    fun binder_tr (*sy*) [idts, body] = tr (idts, body)
-      | binder_tr (*sy*) ts = raise_term "binder_tr" ts;
-  in
-    (sy, binder_tr)
-  end;
-
-
-(* meta propositions *)
-
-fun aprop_tr (*"_aprop"*) [t] = const constrainC $ t $ const "prop"
-  | aprop_tr (*"_aprop"*) ts = raise_term "aprop_tr" ts;
-
-fun ofclass_tr (*"_ofclass"*) [ty, cls] =
-      cls $ (const constrainC $ const "TYPE" $ (const "itself" $ ty))
-  | ofclass_tr (*"_ofclass"*) ts = raise_term "ofclass_tr" ts;
-
-
-(* meta implication *)
-
-fun bigimpl_ast_tr (*"_bigimpl"*) [asms, concl] =
-      fold_ast_p "==>" (unfold_ast "_asms" asms, concl)
-  | bigimpl_ast_tr (*"_bigimpl"*) asts = raise_ast "bigimpl_ast_tr" asts;
-
-
-(* explode atoms *)
-
-fun explode_tr (*"_explode"*) (ts as [consC, nilC, bit0, bit1, txt]) =
-      let
-        fun mk_list [] = nilC
-          | mk_list (t :: ts) = consC $ t $ mk_list ts;
-
-        fun encode_bit 0 = bit0
-          | encode_bit 1 = bit1
-          | encode_bit _ = sys_error "encode_bit";
-
-        fun encode_char c =   (* FIXME leading 0s (?) *)
-          mk_list (map encode_bit (radixpand (2, (ord c))));
-
-        val str =
-          (case txt of
-            Free (s, _) => s
-          | Const (s, _) => s
-          | _ => raise_term "explode_tr" ts);
-      in
-        mk_list (map encode_char (explode str))
-      end
-  | explode_tr (*"_explode"*) ts = raise_term "explode_tr" ts;
-
-
-
-(** print (ast) translations **)
-
-(* application *)
-
-fun appl_ast_tr' (f, []) = raise_ast "appl_ast_tr'" [f]
-  | appl_ast_tr' (f, args) = Appl [Constant "_appl", f, fold_ast "_args" args];
-
-
-(* abstraction *)
-
-fun strip_abss vars_of body_of tm =
-  let
-    fun free (x, _) = Free (x, dummyT);
-
-    val vars = vars_of tm;
-    val body = body_of tm;
-    val rev_new_vars = rename_wrt_term body vars;
-  in
-    (map Free (rev rev_new_vars), subst_bounds (map free rev_new_vars, body))
-  end;
-
-(*do (partial) eta-contraction before printing*)
-
-val eta_contract = ref false;
-
-fun eta_contr tm =
-  let
-    fun eta_abs (Abs (a, T, t)) =
-          (case eta_abs t of
-            t' as f $ u =>
-              (case eta_abs u of
-                Bound 0 =>
-                  if not (0 mem loose_bnos f) then incr_boundvars ~1 f
-                  else Abs (a, T, t')
-              | _ => Abs (a, T, t'))
-          | t' => Abs (a, T, t'))
-      | eta_abs t = t;
-  in
-    if ! eta_contract then eta_abs tm else tm
-  end;
-
-
-fun abs_tr' tm =
-  foldr (fn (x, t) => const "_abs" $ x $ t)
-    (strip_abss strip_abs_vars strip_abs_body (eta_contr tm));
-
-
-fun abs_ast_tr' (*"_abs"*) asts =
-  (case unfold_ast_p "_abs" (Appl (Constant "_abs" :: asts)) of
-    ([], _) => raise_ast "abs_ast_tr'" asts
-  | (xs, body) => Appl [Constant "_lambda", fold_ast "_idts" xs, body]);
-
-
-(* binder *)
-
-fun mk_binder_tr' (name, sy) =
-  let
-    fun mk_idts [] = raise Match    (*abort translation*)
-      | mk_idts [idt] = idt
-      | mk_idts (idt :: idts) = const "_idts" $ idt $ mk_idts idts;
-
-    fun tr' t =
-      let
-        val (xs, bd) = strip_abss (strip_qnt_vars name) (strip_qnt_body name) t;
-      in
-        const sy $ mk_idts xs $ bd
-      end;
-
-    fun binder_tr' (*name*) (t :: ts) =
-          list_comb (tr' (const name $ t), ts)
-      | binder_tr' (*name*) [] = raise Match;
-  in
-    (name, binder_tr')
-  end;
-
-
-(* idts *)
-
-fun idts_ast_tr' (*"_idts"*) [Appl [Constant c, x, ty], xs] =
-      if c = constrainC then
-        Appl [Constant "_idts", Appl [Constant "_idtyp", x, ty], xs]
-      else raise Match
-  | idts_ast_tr' (*"_idts"*) _ = raise Match;
-
-
-(* meta propositions *)
-
-fun prop_tr' show_sorts tm =
-  let
-    fun aprop t = const "_aprop" $ t;
-
-    fun is_prop tys t =
-      fastype_of1 (tys, t) = propT handle TERM _ => false;
-
-    fun tr' _ (t as Const _) = t
-      | tr' _ (t as Free (x, ty)) =
-          if ty = propT then aprop (Free (x, dummyT)) else t
-      | tr' _ (t as Var (xi, ty)) =
-          if ty = propT then aprop (Var (xi, dummyT)) else t
-      | tr' tys (t as Bound _) =
-          if is_prop tys t then aprop t else t
-      | tr' tys (Abs (x, ty, t)) = Abs (x, ty, tr' (ty :: tys) t)
-      | tr' tys (t as t1 $ (t2 as Const ("TYPE", Type ("itself", [ty])))) =
-          if is_prop tys t then
-            const "_ofclass" $ term_of_typ show_sorts ty $ tr' tys t1
-          else tr' tys t1 $ tr' tys t2
-      | tr' tys (t as t1 $ t2) =
-          (if is_Const (head_of t) orelse not (is_prop tys t)
-            then I else aprop) (tr' tys t1 $ tr' tys t2);
-  in
-    tr' [] tm
-  end;
-
-
-(* meta implication *)
-
-fun impl_ast_tr' (*"==>"*) asts =
-  (case unfold_ast_p "==>" (Appl (Constant "==>" :: asts)) of
-    (asms as _ :: _ :: _, concl)
-      => Appl [Constant "_bigimpl", fold_ast "_asms" asms, concl]
-  | _ => raise Match);
-
-
-(* dependent / nondependent quantifiers *)
-
-fun dependent_tr' (q, r) (A :: Abs (x, T, B) :: ts) =
-      if 0 mem (loose_bnos B) then
-        let val (x', B') = variant_abs (x, dummyT, B);
-        in list_comb (const q $ Free (x', T) $ A $ B', ts) end
-      else list_comb (const r $ A $ B, ts)
-  | dependent_tr' _ _ = raise Match;
-
-
-(* implode atoms *)
-
-fun implode_ast_tr' (*"_implode"*) (asts as [Constant cons_name, nilC,
-    bit0, bit1, bitss]) =
-      let
-        fun err () = raise_ast "implode_ast_tr'" asts;
-
-        fun strip_list lst =
-          let val (xs, y) = unfold_ast_p cons_name lst
-          in if y = nilC then xs else err ()
-          end;
-
-        fun decode_bit bit =
-          if bit = bit0 then "0"
-          else if bit = bit1 then "1"
-          else err ();
-
-        fun decode_char bits =
-          chr (#1 (scan_radixint (2, map decode_bit (strip_list bits))));
-      in
-        Variable (implode (map decode_char (strip_list bitss)))
-      end
-  | implode_ast_tr' (*"_implode"*) asts = raise_ast "implode_ast_tr'" asts;
-
-
-
-
-(** syn_ext_of_sext **)   (* FIXME remove *)
-
-fun strip_esc str =
-  let
-    fun strip ("'" :: c :: cs) = c :: strip cs
-      | strip ["'"] = []
-      | strip (c :: cs) = c :: strip cs
-      | strip [] = [];
-  in
-    implode (strip (explode str))
-  end;
-
-fun infix_name sy = "op " ^ strip_esc sy;
-
-
-fun syn_ext_of_sext all_roots new_roots xconsts read_typ sext =
-  let
-    val {mixfix, parse_ast_translation, parse_translation, print_translation,
-      print_ast_translation, ...} = sext_components sext;
-
-    val tinfixT = [typeT, typeT] ---> typeT;
-
-    fun binder (Binder (sy, _, name, _, _)) = Some (sy, name)
-      | binder _ = None;
-
-    fun binder_typ ty =
-      (case read_typ ty of
-        Type ("fun", [Type ("fun", [_, T2]), T3]) =>
-          [Type ("idts", []), T2] ---> T3
-      | _ => error ("Illegal binder type " ^ quote ty));
-
-    fun mk_infix sy ty c p1 p2 p3 =
-      [Mfix ("(_ " ^ sy ^ "/ _)", ty, c, [p1, p2], p3),
-       Mfix ("op " ^ sy, ty, c, [], max_pri)];
-
-    fun mfix_of (Mixfix (sy, ty, c, ps, p)) = [Mfix (sy, read_typ ty, c, ps, p)]
-      | mfix_of (Delimfix (sy, ty, c)) = [Mfix (sy, read_typ ty, c, [], max_pri)]
-      | mfix_of (Infixl (sy, ty, p)) =
-          mk_infix sy (read_typ ty) (infix_name sy) p (p + 1) p
-      | mfix_of (Infixr (sy, ty, p)) =
-          mk_infix sy (read_typ ty) (infix_name sy) (p + 1) p p
-      | mfix_of (Binder (sy, ty, _, p, q)) =
-          [Mfix ("(3" ^ sy ^ "_./ _)", binder_typ ty, sy, [0, p], q)]
-      | mfix_of (TInfixl (s, c, p)) =
-          [Mfix ("(_ " ^ s ^ "/ _)", tinfixT, c, [p, p + 1], p)]
-      | mfix_of (TInfixr (s, c, p)) =
-          [Mfix ("(_ " ^ s ^ "/ _)", tinfixT, c, [p + 1, p], p)];
-
-    val mfix = flat (map mfix_of mixfix);
-    val binders = mapfilter binder mixfix;
-    val bparses = map mk_binder_tr binders;
-    val bprints = map (mk_binder_tr' o swap) binders;
-  in
-    syn_ext all_roots new_roots mfix (distinct (filter is_xid xconsts))
-      (parse_ast_translation,
-        bparses @ parse_translation,
-        bprints @ print_translation,
-        print_ast_translation)
-      ([], [])
-  end;
-
-
-
-(** constants **)     (* FIXME remove *)
-
-fun constants sext =
-  let
-    fun consts (Delimfix (_, ty, c)) = ([c], ty)
-      | consts (Mixfix (_, ty, c, _, _)) = ([c], ty)
-      | consts (Infixl (c, ty, _)) = ([infix_name c], ty)
-      | consts (Infixr (c, ty, _)) = ([infix_name c], ty)
-      | consts (Binder (_, ty, c, _, _)) = ([c], ty)
-      | consts _ = ([""], "");    (*is filtered out below*)
-  in
-    distinct (filter_out (fn (l, _) => l = [""]) (map consts (mixfix_of sext)))
-  end;
-
-
-
-(** pt_to_ast **)
-
-fun pt_to_ast trf pt =
-  let
-    fun trans a args =
-      (case trf a of
-        None => mk_appl (Constant a) args
-      | Some f => f args handle exn
-          => (writeln ("Error in parse ast translation for " ^ quote a); raise exn));
-
-    fun ast_of (Node (a, pts)) = trans a (map ast_of pts)
-      | ast_of (Tip tok) = Variable (str_of_token tok);
-  in
-    ast_of pt
-  end;
-
-
-
-(** ast_to_term **)
-
-fun ast_to_term trf ast =
-  let
-    fun trans a args =
-      (case trf a of
-        None => list_comb (const a, args)
-      | Some f => f args handle exn
-          => (writeln ("Error in parse translation for " ^ quote a); raise exn));
-
-    fun term_of (Constant a) = trans a []
-      | term_of (Variable x) = scan_var x
-      | term_of (Appl (Constant a :: (asts as _ :: _))) =
-          trans a (map term_of asts)
-      | term_of (Appl (ast :: (asts as _ :: _))) =
-          list_comb (term_of ast, map term_of asts)
-      | term_of (ast as Appl _) = raise_ast "ast_to_term: malformed ast" [ast];
-  in
-    term_of ast
-  end;
-
-
-
-(** pure_trfuns **)
-
-val pure_trfuns =
- ([(applC, appl_ast_tr), ("_lambda", lambda_ast_tr), ("_idtyp", idtyp_ast_tr),
-    ("_bigimpl", bigimpl_ast_tr)],
-  [("_abs", abs_tr), ("_aprop", aprop_tr), ("_ofclass", ofclass_tr),
-    ("_K", k_tr), ("_explode", explode_tr)],
-  [],
-  [("_abs", abs_ast_tr'), ("_idts", idts_ast_tr'), ("==>", impl_ast_tr'),
-    ("_implode", implode_ast_tr')]);
-
-val constrainAbsC = "_constrainAbs";
-
-
-(** the Pure syntax **)   (* FIXME remove *)
-
-val pure_sext =
-  NewSext {
-    mixfix = [
-      Mixfix   ("(3%_./ _)",  "[idts, 'a] => ('b => 'a)",      "_lambda", [0], 0),
-      Delimfix ("_",          "'a => " ^ args,                 ""),
-      Delimfix ("_,/ _",      "['a, " ^ args ^ "] => " ^ args, "_args"),
-      Delimfix ("_",          "id => idt",                     ""),
-      Mixfix   ("_::_",       "[id, type] => idt",             "_idtyp", [0, 0], 0),
-      Delimfix ("'(_')",      "idt => idt",                    ""),
-      Delimfix ("_",          "idt => idts",                   ""),
-      Mixfix   ("_/ _",       "[idt, idts] => idts",           "_idts", [1, 0], 0),
-      Delimfix ("_",          "id => aprop",                   ""),
-      Delimfix ("_",          "var => aprop",                  ""),
-      Mixfix   ("(1_/(1'(_')))", "[('b => 'a), " ^ args ^ "] => aprop", applC, [max_pri, 0], max_pri),
-      Delimfix ("PROP _",     "aprop => prop",                 "_aprop"),
-      Delimfix ("_",          "prop => asms",                  ""),
-      Delimfix ("_;/ _",      "[prop, asms] => asms",          "_asms"),
-      Mixfix   ("((3[| _ |]) ==>/ _)", "[asms, prop] => prop", "_bigimpl", [0, 1], 1),
-      Mixfix   ("(_ ==/ _)",  "['a::{}, 'a] => prop",          "==", [3, 2], 2),
-      Mixfix   ("(_ =?=/ _)", "['a::{}, 'a] => prop",          "=?=", [3, 2], 2),
-      Mixfix   ("(_ ==>/ _)", "[prop, prop] => prop",          "==>", [2, 1], 1),
-      Binder   ("!!",         "('a::logic => prop) => prop",   "all", 0, 0)],
-    xrules = [],
-    parse_ast_translation = [(applC, appl_ast_tr), ("_lambda", lambda_ast_tr),
-      ("_idtyp", idtyp_ast_tr), ("_bigimpl", bigimpl_ast_tr)],
-    parse_translation = [("_abs", abs_tr), ("_aprop", aprop_tr), ("_K", k_tr),
-      ("_explode", explode_tr)],
-    print_translation = [],
-    print_ast_translation = [("_abs", abs_ast_tr'), ("_idts", idts_ast_tr'),
-      ("==>", impl_ast_tr'), ("_implode", implode_ast_tr')]};
-
-val syntax_types = terminals @ ["syntax", logic, "type", "types", "sort",
-  "classes", args, "idt", "idts", "aprop", "asms"];
-
-val syntax_consts = [(["_K", "_explode", "_implode"], "syntax")];
-
-
-end;
-
--- a/src/Pure/Syntax/xgram.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-(*  Title:      Pure/Syntax/xgram.ML
-    ID:         $Id$
-    Author:     Tobias Nipkow and Markus Wenzel, TU Muenchen
-
-External grammar representation (internal interface).
-
-TODO:
-  prod, xsymb: 'a --> string
-  Terminal --> Literal, Nonterminal --> Argument (?)
-*)
-
-signature XGRAM =
-sig
-  structure Ast: AST
-  local open Ast in
-    datatype 'a xsymb =
-      Terminal of 'a |
-      Nonterminal of string * int |
-      Space of string |
-      Bg of int | Brk of int | En
-    datatype 'a prod = Prod of string * ('a xsymb list) * string * int
-    val max_pri: int
-    val chain_pri: int
-    val literals_of: string prod list -> string list
-    datatype xgram =
-      XGram of {
-        roots: string list,
-        prods: string prod list,
-        consts: string list,
-        parse_ast_translation: (string * (ast list -> ast)) list,
-        parse_rules: (ast * ast) list,
-        parse_translation: (string * (term list -> term)) list,
-        print_translation: (string * (term list -> term)) list,
-        print_rules: (ast * ast) list,
-        print_ast_translation: (string * (ast list -> ast)) list}
-  end
-end;
-
-functor XGramFun(Ast: AST): XGRAM =
-struct
-
-structure Ast = Ast;
-open Ast;
-
-
-(** datatype prod **)
-
-(*Terminal s: literal token s
-  Nonterminal (s, p): nonterminal s requiring priority >= p, or valued token
-  Space s: some white space for printing
-  Bg, Brk, En: blocks and breaks for pretty printing*)
-
-datatype 'a xsymb =
-  Terminal of 'a |
-  Nonterminal of string * int |
-  Space of string |
-  Bg of int | Brk of int | En;
-
-
-(*Prod (lhs, syms, c, p):
-    lhs: name of nonterminal on the lhs of the production
-    syms: list of symbols on the rhs of the production
-    c: head of parse tree
-    p: priority of this production*)
-
-datatype 'a prod = Prod of string * ('a xsymb list) * string * int;
-
-val max_pri = 1000;   (*maximum legal priority*)
-val chain_pri = ~1;   (*dummy for chain productions*)
-
-
-(* literals_of *)
-
-fun literals_of prods =
-  let
-    fun lits_of (Prod (_, syn, _, _)) =
-      mapfilter (fn Terminal s => Some s | _ => None) syn;
-  in
-    distinct (flat (map lits_of prods))
-  end;
-
-
-
-(** datatype xgram **)
-
-datatype xgram =
-  XGram of {
-    roots: string list,
-    prods: string prod list,
-    consts: string list,
-    parse_ast_translation: (string * (ast list -> ast)) list,
-    parse_rules: (ast * ast) list,
-    parse_translation: (string * (term list -> term)) list,
-    print_translation: (string * (term list -> term)) list,
-    print_rules: (ast * ast) list,
-    print_ast_translation: (string * (ast list -> ast)) list};
-
-
-end;
-
--- a/src/Pure/Thy/parse.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-(*  Title: 	Pure/Thy/parse
-    ID:         $Id$
-    Author: 	Sonia Mahjoub / Tobias Nipkow
-    Copyright   1992  TU Muenchen
-
-    modified    Dezember 1993 by Max Breitling (type-variables added)
-
-The parser combinators.
-Adapted from Larry Paulson's ML for the Working Programmer.
-*)
-
-(*Global infix declarations for the parsing primitives*)
-infix 5 -- --$$ $$--;
-infix 3 >>;
-infix 0 ||;
-
-
-signature PARSE = 
-sig
-
-type token
-val $$     : string -> 
-             (token * int) list -> string * (token * int)list 
-val id     : (token * int) list -> string * (token * int)list 
-val nat    : (token * int) list -> string * (token * int)list 
-val stg    : (token * int) list -> string * (token * int)list 
-val txt    : (token * int) list -> string * (token * int)list 
-val typevar: (token * int) list -> string * (token * int)list
-val >>     : ('a -> 'b * 'c) * ('b -> 'd) -> 'a -> 'd * 'c
-val ||     : ('a -> 'b) * ('a -> 'b) -> 'a -> 'b 
-val --     : ('a -> 'b * 'c) * ('c -> 'd * 'e) -> 
-             'a -> ('b * 'd) * 'e
-val $$--   : string * ((token * int)list -> 'b * 'c) -> 
-             (token * int) list -> 'b * 'c
-val --$$   : ( 'a -> 'b * (token * int)list ) * string -> 
-             'a -> 'b * (token * int)list 
-val !!     : ((token * int) list -> 'a * (token * int) list ) 
-             -> (token * int) list -> 'a * (token * int) list 
-val empty  : 'a -> 'b list * 'a
-val repeat : ('a -> 'b * 'a) -> 'a -> 'b list * 'a
-val repeat1: ('a -> 'b * 'a) -> 'a -> 'b list * 'a
-val list_of: ((token * int)list -> 'b * (token * int)list ) -> 
-             (token * int)list  -> 'b list * (token * int)list 
-val list_of1: ((token * int)list -> 'b * (token * int)list ) -> 
-             (token * int)list  -> 'b list * (token * int)list 
-val reader : ((token * int) list -> 'a * ('b * int) list )
-              -> string list -> 'a
-
-end;
-
-
-
-functor ParseFUN (Lex: LEXICAL): PARSE =
-struct
-
-type token = Lex.token;
-
-datatype synerr = Line of string * string * int | EOF of string;
-
-exception SynError of synerr;
-
-fun synerr(Line(s1, s2, n)) =
-      error("Syntax error on line " ^ (string_of_int n) ^ ": " ^ s1 ^
-            " expected and " ^ s2 ^ " was found")
-  | synerr(EOF(s)) = error("Syntax error on last line: " ^ s ^
-                           " expected and end-of-file was found"); 
-
-fun string_of_token (Lex.Key b) = b
-  | string_of_token (Lex.Id b)  = b
-  | string_of_token (Lex.Nat b) = b
-  | string_of_token (Lex.Txt b) = b
-  | string_of_token (Lex.Stg b) = b
-  | string_of_token (Lex.TypVar b) = b;
-
-fun line_err x = raise SynError(Line x);
-fun eof_err s =  raise SynError(EOF s);
-
-fun $$a ((Lex.Key b,n) :: toks) =
-           if a = b then (a,toks) else line_err(a,b,n) 
-  | $$a ((t,n) :: toks) = line_err (a,string_of_token t, n)
-  | $$a _ = eof_err a;
-
-
-fun id ((Lex.Id b,n) :: toks) = (b, toks)
-  | id ((t,n) :: toks) = line_err ("identifier", string_of_token t, n)
-  | id _ = eof_err "identifier";
-
-
-fun nat ((Lex.Nat b,n) :: toks) = (b, toks)
-  | nat ((t,n) :: toks) = 
-	line_err ("natural number", string_of_token t, n)
-  | nat _ = eof_err "natural number";
-
-
-fun stg ((Lex.Stg b,n) :: toks) = (b, toks)
-  | stg ((t,n) :: toks) = line_err("string", string_of_token t, n)
-  | stg _ = eof_err"string";
-
-
-fun txt ((Lex.Txt b,n) :: toks) = (b, toks)
-  | txt ((t,n) :: toks) = line_err ("ML text", string_of_token t, n)
-  | txt _ = eof_err "ML text";
-
-fun typevar ((Lex.TypVar b,n) :: toks) = (b, toks)
-  | typevar ((t,n)::toks) = line_err("type variable",string_of_token t,n)
-  | typevar _ = eof_err "type variable";
-
-
-fun ( ph >> f) toks = let val (x, toks2) = ph toks in (f x, toks2) end;
-
-fun (ph1 || ph2) toks = ph1 toks handle SynError _ => ph2 toks;
-
-
-fun (ph1 -- ph2) toks =
-    let val (x, toks2) = ph1 toks
-        val (y, toks3) = ph2 toks2
-    in ((x,y), toks3) end;
-
-fun (a $$-- ph)  =  $$a -- ph >> #2;
-
-fun (ph --$$ a)  =  ph -- $$a >> #1;
-
-fun !! ph toks = ph toks handle SynError s => synerr s;
-
-fun empty toks = ([], toks);
-
-fun repeat ph toks  = (   ph -- repeat ph >> (op::)
-                       || empty ) toks; 
-
-fun repeat1 ph  =  ph -- repeat ph >> (op::);
-
-fun list_of1 ph =  ph -- repeat("," $$-- !! ph) >> (op::);
-fun list_of ph  =  list_of1 ph || empty;
-
-fun reader ph a = 
-       ( case ph (Lex.scan a) of 
-                (x,  []) => x
-              | (_,(_, n)::_) => error
-                ("Syntax error on line " ^ (string_of_int n) ^ ": " ^
-                 "Extra characters in phrase")
-       );
-end;
--- a/src/Pure/Thy/read.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,452 +0,0 @@
-(*  Title:      Pure/Thy/read
-    ID:         $Id$
-    Author:     Sonia Mahjoub / Tobias Nipkow / L C Paulson
-    Copyright   1993  TU Muenchen
-
-Reading and writing the theory definition files.
-
-For theory XXX, the  input file is called XXX.thy
-                the output file is called .XXX.thy.ML
-                and it then tries to read XXX.ML
-*)
-
-datatype thy_info = ThyInfo of {name: string, path: string,
-                                children: string list,
-                                thy_info: string option, ml_info: string option,
-                                theory: Thm.theory option};
-
-signature READTHY =
-sig
-  datatype basetype = Thy  of string
-                    | File of string
-
-  val loaded_thys    : thy_info list ref
-  val loadpath       : string list ref
-  val delete_tmpfiles: bool ref
-
-  val use_thy        : string -> unit
-  val update         : unit -> unit
-  val time_use_thy   : string -> unit
-  val unlink_thy     : string -> unit
-  val base_on        : basetype list -> string -> Thm.theory
-  val store_theory   : string -> Thm.theory -> unit
-end;
-
-
-functor ReadthyFUN (structure ThySyn: THYSYN) : READTHY =
-struct
-
-datatype basetype = Thy  of string
-                  | File of string;
-
-val loaded_thys = ref [ThyInfo {name = "Pure", path = "", children = [], 
-                                thy_info = Some "", ml_info = Some "", 
-                                theory = Some Thm.pure_thy}];
-
-val loadpath = ref ["."];           (*default search path for theory files *)
-
-val delete_tmpfiles = ref true;         (*remove temporary files after use *)
-
-(*Make name of the output ML file for a theory *)
-fun out_name thy = "." ^ thy ^ ".thy.ML";
-
-(*Read a file specified by thy_file containing theory thy *)
-fun read_thy thy thy_file =
-    let val instream  = open_in thy_file;
-        val outstream = open_out (out_name thy)
-    in  output (outstream, ThySyn.read (explode(input(instream, 999999))));
-        close_out outstream;
-        close_in instream
-    end;
-
-fun file_exists file =
-  let val instream = open_in file in close_in instream; true end
-    handle Io _ => false;
-
-(*Get thy_info for a loaded theory *)
-fun get_thyinfo thy =
-  let fun do_search (t :: loaded : thy_info list) =
-            let val ThyInfo {name, ...} = t
-            in if name = thy then Some t else do_search loaded end
-        | do_search [] = None
-  in do_search (!loaded_thys) end;
-
-(*Replace an item by the result of make_change *)
-fun change_thyinfo make_change =
-  let fun search (t :: loaded) =
-            let val ThyInfo {name, path, children, thy_info, ml_info,
-                             theory} = t
-                val (new_t, continue) = make_change name path children thy_info
-                                                    ml_info theory
-            in if continue then            
-                 new_t :: (search loaded)
-               else
-                 new_t :: loaded
-            end
-        | search [] = []
-  in loaded_thys := search (!loaded_thys) end;
-
-(*Check if a theory was already loaded *)
-fun already_loaded thy =
-  let val t = get_thyinfo thy
-  in if is_none t then false
-     else let val ThyInfo {thy_info, ml_info, ...} = the t
-          in if is_none thy_info orelse is_none ml_info then false 
-             else true end
-  end;
-
-(*Check if a theory file has changed since its last use.
-  Return a pair of boolean values for .thy and for .ML *)
-fun thy_unchanged thy thy_file ml_file = 
-  let val t = get_thyinfo thy
-  in if is_some t then
-       let val ThyInfo {thy_info, ml_info, ...} = the t
-           val tn = is_none thy_info;
-           val mn = is_none ml_info
-       in if not tn andalso not mn then
-              ((file_info thy_file = the thy_info), 
-               (file_info ml_file = the ml_info))
-          else if not tn andalso mn then (true, false)
-          else (false, false)
-       end
-     else (false, false)
-  end;
-
-exception FILE_NOT_FOUND;   (*raised by find_file *)
-
-(*Find a file using a list of paths if no absolute or relative path is
-  specified.*)
-fun find_file "" name =
-      let fun find_it (curr :: paths) =
-                if file_exists (tack_on curr name) then
-                    tack_on curr name
-                else 
-                    find_it paths
-           | find_it [] = ""
-      in find_it (!loadpath) end
-  | find_file path name =
-      if file_exists (tack_on path name) then tack_on path name
-                                         else "";
-
-(*Get absolute pathnames for a new or already loaded theory *)
-fun get_filenames path name =
-  let fun make_absolute file =
-        if file = "" then "" else 
-            if hd (explode file) = "/" then file else tack_on (pwd ()) file;
-
-      fun new_filename () =
-        let val found = find_file path (name ^ ".thy")
-                        handle FILE_NOT_FOUND => "";
-            val thy_file = make_absolute found;
-            val (thy_path, _) = split_filename thy_file;
-            val found = find_file path (name ^ ".ML");
-            val ml_file = if thy_file = "" then make_absolute found
-                          else if file_exists (tack_on thy_path (name ^ ".ML"))
-                          then tack_on thy_path (name ^ ".ML")
-                          else "";
-            val searched_dirs = if path = "" then (!loadpath) else [path]
-        in if thy_file = "" andalso ml_file = "" then
-             error ("Could not find file \"" ^ name ^ ".thy\" or \""
-                    ^ name ^ ".ML\" for theory \"" ^ name ^ "\"\n"
-                    ^ "in the following directories: \"" ^
-                    (space_implode "\", \"" searched_dirs) ^ "\"")
-           else ();
-           (thy_file, ml_file) 
-        end;
-
-      val thy = get_thyinfo name
-  in if is_some thy andalso path = "" then
-       let val ThyInfo {path = abs_path, ...} = the thy;
-           val (thy_file, ml_file) = if abs_path = "" then new_filename ()
-                                     else (find_file abs_path (name ^ ".thy"),
-                                           find_file abs_path (name ^ ".ML"))
-       in if thy_file = "" andalso ml_file = "" then
-            (writeln ("Warning: File \"" ^ (tack_on path name)
-                      ^ ".thy\"\ncontaining theory \"" ^ name
-                      ^ "\" no longer exists.");
-             new_filename ()
-            )
-          else (thy_file, ml_file)
-       end
-     else new_filename ()
-  end;
-
-(*Remove theory from all child lists in loaded_thys *)
-fun unlink_thy thy =
-  let fun remove name path children thy_info ml_info theory =
-            (ThyInfo {name = name, path = path, children = children \ thy, 
-                      thy_info = thy_info, ml_info = ml_info,
-                      theory = theory}, true)
-  in change_thyinfo remove end;
-
-(*Remove a theory from loaded_thys *)
-fun remove_thy thy =
-  let fun remove (t :: ts) =
-            let val ThyInfo {name, ...} = t
-            in if name = thy then ts
-                             else t :: (remove ts)
-            end
-        | remove [] = []
-  in loaded_thys := remove (!loaded_thys) end;
-
-(*Change thy_info and ml_info for an existent item *)
-fun set_info thy_new ml_new thy =
-  let fun change name path children thy_info ml_info theory =
-        if name = thy then
-            (ThyInfo {name = name, path = path, children = children,
-                      thy_info = Some thy_new, ml_info = Some ml_new,
-                      theory = theory}, false)
-        else
-            (ThyInfo {name = name, path = path, children = children,
-                      thy_info = thy_info, ml_info = ml_info,
-                      theory = theory}, true)
-  in change_thyinfo change end;
-
-(*Mark theory as changed since last read if it has been completly read *)
-fun mark_outdated thy =
-  if already_loaded thy then set_info "" "" thy
-                        else ();
-
-(*Read .thy and .ML files that haven't been read yet or have changed since 
-  they were last read;
-  loaded_thys is a thy_info list ref containing all theories that have 
-  completly been read by this and preceeding use_thy calls.
-  If a theory changed since its last use its children are marked as changed *)
-fun use_thy name =
-    let val (path, thy_name) = split_filename name;
-        val (thy_file, ml_file) = get_filenames path thy_name;
-        val (abs_path, _) = if thy_file = "" then split_filename ml_file
-                            else split_filename thy_file;
-        val (thy_uptodate, ml_uptodate) = thy_unchanged thy_name 
-                                                        thy_file ml_file;
-
-         (*Set absolute path for loaded theory *)
-         fun set_path () =
-           let fun change name path children thy_info ml_info theory =
-                 if name = thy_name then            
-                   (ThyInfo {name = name, path = abs_path, children = children,
-                             thy_info = thy_info, ml_info = ml_info,
-                             theory = theory}, false)
-                 else
-                   (ThyInfo {name = name, path = path, children = children,
-                             thy_info = thy_info, ml_info = ml_info,
-                             theory = theory}, true)
-           in change_thyinfo change end;
-
-         (*Mark all direct descendants of a theory as changed *)
-         fun mark_children thy =
-           let val ThyInfo {children, ...} = the (get_thyinfo thy)
-               val loaded = filter already_loaded children
-           in if loaded <> [] then
-                  (writeln ("The following children of theory " ^ (quote thy)
-                            ^ " are now out-of-date: "
-                            ^ (quote (space_implode "\",\"" loaded)));
-                   seq mark_outdated loaded
-                  )
-              else ()
-           end
-
-    in if thy_uptodate andalso ml_uptodate then ()
-       else
-       (
-         if thy_uptodate orelse thy_file = "" then ()
-         else (writeln ("Reading \"" ^ name ^ ".thy\"");
-               read_thy thy_name thy_file;
-               use (out_name thy_name)
-              );
-
-         if ml_file = "" then () 
-         else (writeln ("Reading \"" ^ name ^ ".ML\"");
-               use ml_file);
-
-         use_string ["store_theory " ^ quote thy_name ^ " " ^ thy_name 
-                     ^ ".thy;"];
-
-         (*Now set the correct info*)
-         set_info (file_info thy_file) (file_info ml_file) thy_name;
-         set_path ();
-
-         (*Mark theories that have to be reloaded*)
-         mark_children thy_name;
-
-         (*Remove temporary files*)
-         if not (!delete_tmpfiles) orelse (thy_file = "") orelse thy_uptodate 
-           then ()
-         else delete_file (out_name thy_name)
-        )
-    end;
-
-fun time_use_thy tname = timeit(fn()=>
-   (writeln("\n**** Starting Theory " ^ tname ^ " ****");  
-    use_thy tname;
-    writeln("\n**** Finished Theory " ^ tname ^ " ****"))
-   );
-
-(*Load all thy or ML files that have been changed and also
-  all theories that depend on them *)
-fun update () =
-  let (*List theories in the order they have to be loaded *)
-      fun load_order [] result = result
-        | load_order thys result =
-            let fun next_level (t :: ts) =
-                      let val thy = get_thyinfo t
-                      in if is_some thy then
-                             let val ThyInfo {children, ...} = the thy
-                             in children union (next_level ts)
-                             end
-                         else next_level ts
-                      end
-                  | next_level [] = [];
-                  
-                val children = next_level thys
-            in load_order children ((result \\ children) @ children) end;
-
-      fun reload_changed (t :: ts) =
-            let val thy = get_thyinfo t;
-
-                fun abspath () =
-                  if is_some thy then
-                    let val ThyInfo {path, ...} = the thy in path end
-                  else "";
-
-                val (thy_file, ml_file) = get_filenames (abspath ()) t;
-                val (thy_uptodate, ml_uptodate) =
-                        thy_unchanged t thy_file ml_file;
-            in if thy_uptodate andalso ml_uptodate then ()
-                                                   else use_thy t;
-               reload_changed ts
-            end
-        | reload_changed [] = ();
-
-     (*Remove all theories that are no descendants of Pure.
-       If there are still children in the deleted theory's list
-       schedule them for reloading *)
-     fun collect_garbage not_garbage =
-       let fun collect (t :: ts) =
-                 let val ThyInfo {name, children, ...} = t
-                 in if name mem not_garbage then collect ts
-                    else (writeln("Theory \"" ^ name 
-                           ^ "\" is no longer linked with Pure - removing it.");
-                          remove_thy name;
-                          seq mark_outdated children
-                         )
-                 end
-             | collect [] = ()
-
-       in collect (!loaded_thys) end
-
-  in collect_garbage ("Pure" :: (load_order ["Pure"] []));
-     reload_changed (load_order ["Pure"] [])
-  end;
-
-(*Merge theories to build a base for a new theory.
-  Base members are only loaded if they are missing. *)
-fun base_on bases child =
-      let (*List all descendants of a theory list *)
-          fun list_descendants (t :: ts) =
-                let val tinfo = get_thyinfo t
-                in if is_some tinfo then
-                     let val ThyInfo {children, ...} = the tinfo
-                     in children union (list_descendants (ts union children))
-                     end
-                   else []
-                end
-            | list_descendants [] = [];
-
-          (*Show the cycle that would be created by add_child *)
-          fun show_cycle base =
-            let fun find_it result curr =
-                  let val tinfo = get_thyinfo curr
-                  in if base = curr then 
-                       error ("Cyclic dependency of theories: "
-                              ^ child ^ "->" ^ base ^ result)
-                     else if is_some tinfo then
-                       let val ThyInfo {children, ...} = the tinfo
-                       in seq (find_it ("->" ^ curr ^ result)) children
-                       end
-                     else ()
-                  end
-            in find_it "" child end;
-        
-          (*Check if a cycle will be created by add_child *)
-          fun find_cycle base =
-            if base mem (list_descendants [child]) then show_cycle base
-            else ();
-                   
-          (*Add child to child list of base *)
-          fun add_child base =
-            let fun add (t :: loaded) =
-                      let val ThyInfo {name, path, children,
-                                       thy_info, ml_info, theory} = t
-                      in if name = base then
-                           ThyInfo {name = name, path = path,
-                                    children = child ins children,
-                                    thy_info = thy_info, ml_info = ml_info,
-                                    theory = theory} :: loaded
-                         else
-                           t :: (add loaded)
-                      end
-                  | add [] =
-                      [ThyInfo {name = base, path = "", children = [child], 
-                                thy_info = None, ml_info = None, theory = None}]
-            in loaded_thys := add (!loaded_thys) end;       
-
-          (*Load a base theory if not already done
-            and no cycle would be created *)
-          fun load base =
-              let val thy_present = already_loaded base
-                                            (*test this before child is added *)
-              in
-                if child = base then
-                    error ("Cyclic dependency of theories: " ^ child
-                           ^ "->" ^ child)
-                else 
-                  (find_cycle base;
-                   add_child base;
-                   if thy_present then ()
-                   else (writeln ("Autoloading theory " ^ (quote base)
-                                  ^ " (used by " ^ (quote child) ^ ")");
-                         use_thy base)
-                  )
-              end; 
-
-          (*Load all needed files and make a list of all real theories *)
-          fun load_base (Thy b :: bs) =
-               (load b;
-                b :: (load_base bs))
-            | load_base (File b :: bs) =
-               (load b;
-                load_base bs)    (*don't add it to merge_theories' parameter *)
-            | load_base [] = [];
-
-          (*Get theory object for a loaded theory *)
-          fun get_theory name =
-            let val ThyInfo {theory, ...} = the (get_thyinfo name)
-            in the theory end;
-
-          val mergelist = (unlink_thy child;
-                           load_base bases);
-          val (t :: ts) = if mergelist = [] then ["Pure"] else mergelist
-                                               (*we have to return something *)
-     in writeln ("Loading theory " ^ (quote child));
-        foldl Thm.merge_theories (get_theory t, map get_theory ts) end;
-
-(*Change theory object for an existent item of loaded_thys 
-  or create a new item *)
-fun store_theory thy_name thy =
-  let fun make_change (t :: loaded) =
-            let val ThyInfo {name, path, children, thy_info, ml_info, ...} = t
-            in if name = thy_name then            
-                    ThyInfo {name = name, path = path, children = children,
-                             thy_info = thy_info, ml_info = ml_info,
-                             theory = Some thy} :: loaded
-               else
-                    t :: (make_change loaded)
-            end
-        | make_change [] =
-            [ThyInfo {name = thy_name, path = "", children = [],
-                      thy_info = Some "", ml_info = Some "",
-                      theory = Some thy}]
-  in loaded_thys := make_change (!loaded_thys) end;
-
-end;
--- a/src/Pure/Thy/scan.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-(*  Title: 	Pure/Thy/scan
-    ID:         $Id$
-    Author: 	Sonia Mahjoub / Tobias Nipkow
-    Copyright   1992  TU Muenchen
-
-    modified    December 1993 by Max Breitling (Type-variables added)
-
-The scanner. Adapted from Larry Paulson's ML for the Working Programmer.
-*)
-
-signature LEXICAL =
-sig
-
-
-datatype token = Id  of string 
-               | Key of string
-               | Nat of string
-               | Stg of string
-               | Txt of string
-               | TypVar of string
-
-val scan : string list -> (token * int) list
-end;
-
-signature KEYWORD = 
-sig
-val alphas  : string list
-val symbols : string list
-end;
-
-
-functor LexicalFUN (Keyword: KEYWORD): LEXICAL = 
-
-struct
-
-
-
-datatype token = Id  of string 
-               | Key of string
-               | Nat of string
-               | Stg of string
-               | Txt of string
-               | TypVar of string;
-
-
-fun lexerr(n,s) =
-    error("Lexical error on line " ^ (string_of_int n) ^ ": " ^ s);
-
-val specials = explode"!{}@#$%^&*()+-=[]:\";,./?`_~<>|\\";
-
-fun is_symbol c = "_" = c orelse "'" = c;
-
-fun alphanum (id, c::cs) =
-       if is_letter c orelse is_digit c orelse is_symbol c
-       then alphanum (id ^ c , cs)
-       else (id , c :: cs)
-  | alphanum (id ,[]) = (id ,[]);
-
-fun numeric (nat, c::cs) =
-      if is_digit c 
-      then numeric (nat^c, cs)
-      else (nat, c::cs)
-  | numeric (nat, []) = (nat,[]);
- 
-fun tokenof (a, n) =
-      if a mem Keyword.alphas
-      then (Key a, n) 
-      else (Id a, n);
-
-fun symbolic (sy, c::cs) =
-       if (sy mem Keyword.symbols) andalso 
-          not((sy^c) mem Keyword.symbols) 
-          orelse not (c mem specials)
-       then (sy, c::cs)
-       else symbolic(sy^c, cs)
-  | symbolic (sy, []) = (sy, []);
-
-fun stringerr(n) = lexerr(n, "No matching quote found on this line");
-
-fun is_control_chr ([],_,n) = stringerr(n)
-  | is_control_chr (c::cs,s,n) = 
-          let val m = ord c
-          in if (m >= 64 andalso m <= 95)
-             then (cs, s^c, n)
-             else stringerr(n)
-          end;
-
-fun is_3_dgt (c1::c2::cs, c,n) = 
-          let val s = c^c1^c2
-          in  if (s >= "000" andalso s <= "255")
-              then (cs, s)
-              else stringerr(n)
-          end 
-  | is_3_dgt (_,_,n) = stringerr(n); 
-
-fun is_imprt_seq ([],_,n) = stringerr(n)
-  | is_imprt_seq ((c::cs),s,n) = 
-          if c = "\\" then (cs,s^"\\",n)
-          else if c = "\n"
-               then is_imprt_seq (cs,s^"\n",n+1)
-          else if (c = "\t") orelse (c = " ")
-               then is_imprt_seq (cs,s^c,n)
-          else stringerr(n);
-
-fun is_escape_seq ([],_,n) = stringerr(n)
-  | is_escape_seq ((c::cs),s,n) =  
-          if c = "\\" then (cs,s^"\\",n)
-          else if c = "\n" 
-               then is_imprt_seq (cs,s^"\n",n+1) 
-          else if (c = "\t") orelse (c = " ")
-               then is_imprt_seq (cs,s^c,n)
-          else if c = "^" 
-               then is_control_chr (cs,s^"^",n)
-          else if ("0" <= c andalso c <= "2") 
-               then let val (cs',s') = 
-                            is_3_dgt(cs,c,n)
-                    in (cs',s^s',n)
-                    end
-          else stringerr(n);
-
-
-fun string (_,[],_,n) = stringerr(n)
-  | string (toks, c::cs, s, n) =
-       if c  = "\"" then ((Stg s, n)::toks , cs, n)
-       else if c = "\\" 
-            then  let val (cs',s',n') = 
-                          is_escape_seq (cs, s^"\\",n) 
-                  in string (toks,cs',s',n') end 
-       else string (toks,cs,s^c,n);
-
-
-fun comment ((c1::c2::cs), n) =
-      if c1 = "*" andalso c2 = ")" then (cs,n) else
-      if c1 = "\n" then comment((c2::cs), n+1)
-      else comment((c2::cs), n)
-  | comment (_, n) = lexerr(n, "Missing end of comment");
-
-fun scanning (toks , [], n) = rev toks
-  | scanning (toks , c :: cs, n) = 
-       if is_letter c 
-       then let val (id , cs2) = alphanum (c , cs)
-            in if id = "ML"
-               then let val text = implode cs2
-                    in  scanning ((Txt text,n) :: toks , [], n)
-                    end
-               else scanning (tokenof(id,n) :: toks , cs2, n) 
-            end
-       else if is_digit c 
-            then let val (nat , cs2) = numeric(c , cs)
-                 in scanning ((Nat nat,n) :: toks , cs2, n) end
-
-       else if c = "'" andalso is_letter(hd cs)
-            then let val (var, cs2) = alphanum (hd cs, tl cs)
-                 in scanning((TypVar (c^var),n) :: toks, cs2, n) end
-
-       else if c mem specials
-            then if c = "\""
-                 then let val (toks', cs', n') = string (toks, cs, "", n)
-                      in scanning (toks', cs', n') end
-                 else let val (sy , cs2) = symbolic (c , cs)
-                      in if sy = "(*"
-                         then let val (cs3,n2) = comment(cs2,n)
-                              in scanning (toks , cs3, n2) end
-                         else scanning ((Key sy,n) :: toks, cs2, n)
-                      end
-       else if c = "\n" then scanning (toks, cs, n+1)
-       else if c = " " orelse c = "\t" then scanning (toks , cs, n)
-       else lexerr(n,"Illegal character " ^ c);
-
-fun scan a = scanning ([] , a, 1);
-
-end;
--- a/src/Pure/Thy/syntax.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,403 +0,0 @@
-(*  Title:      Pure/Thy/syntax.ML
-    ID:         $Id$
-    Author:     Sonia Mahjoub and Tobias Nipkow and Markus Wenzel, TU Muenchen
-
-Definition of theory syntax together with translation to ML code.
-*)
-
-signature THYSYN =
- sig
-  datatype basetype = Thy  of string
-                    | File of string
-
-   val read: string list -> string
- end;
-
-
-
-functor ThySynFUN (Parse: PARSE): THYSYN =
-struct
-
-
-(*-------------- OBJECT TO STRING TRANSLATION ---------------*)
-
-fun parent s = "(" ^ s ^ ")";
-
-fun pair(a, b) = parent(a ^ ", " ^ b);
-
-fun triple(a, b, c) = parent(a ^ ", " ^ b ^ ", " ^ c);
-
-fun pair_quote(a, b) = pair(quote a, quote b);
-
-fun pair_quote2(a, b) = pair(a, quote b);
-
-fun bracket s = "[" ^ s ^ "]";
-
-val comma = space_implode ", ";
-
-val bracket_comma = bracket o comma;
-
-val big_bracket_comma = bracket o space_implode ",\n";
-
-fun big_bracket_comma_ind ind strs = bracket (space_implode (",\n" ^ ind) strs);
-
-val bracket_comma_quote = bracket_comma o (map quote);
-
-
-(*------------------- ABSTRACT SYNTAX FUNCTIONS ---------------------*)
-
-datatype mixfix = Mixfix of string * string * string
-                | Delimfix of string
-                | Infixl of string
-                | Infixr of string
-                | Binder of string * string
-                | TInfixl of string
-                | TInfixr of string;
-
-
-datatype pfix_or_mfix = Pref of string | Mixf of string;
-datatype type_or_abbr = Typed of pfix_or_mfix | Abbrd of pfix_or_mfix;
-
-fun pm_proj(Pref s) = s
-  | pm_proj(Mixf s) = s;
-
-fun ta_proj(Typed s) = s
-  | ta_proj(Abbrd s) = s;
-
-fun split_decls l =
-    let val (p, m) = partition (fn Pref _ => true | _ => false) l;
-    in (big_bracket_comma_ind "   " (map pm_proj p), map pm_proj m) end;
-
-fun split_decls_type l =
-  let val (t,a) = partition (fn Typed _ => true | _ => false) l
-      val (tp,tm) = partition (fn Pref _ => true | _ => false) (map ta_proj t)
-      val (ap,am) = partition (fn Pref _ => true | _ => false) (map ta_proj a)
-    in (big_bracket_comma_ind "   " (map pm_proj tp),
-         big_bracket_comma_ind "   " (map pm_proj ap),
-         (map pm_proj tm) @ (map pm_proj am))
-  end;
-
-
-fun delim_mix (s, None) = Delimfix(s)
-  | delim_mix (s, Some(l, n)) = Mixfix(s, l, n);
-
-fun mixfix (sy, c, ty, l, n) =  "Mixfix(" ^ comma[quote sy, c, ty, l, n] ^ ")";
-
-fun infixrl(ty, c, n) = parent(comma[ty, c, n]);
-
-fun binder(sy, c, ty, n) = "Binder(" ^ comma[quote sy, c, ty, "0", n] ^ ")";
-
-fun delimfix (sy, c, ty) = "Delimfix(" ^ comma[quote sy, c, ty] ^ ")";
-
-fun tinfixrl (ty, n) = "(" ^ comma[ty, ty, n] ^ ")";
-
-fun mk_mfix((c, ty), mfix) =
-      let val cs = quote c and tys = quote ty
-      in case mfix of
-           Mixfix(sy, l, n) => mixfix (sy, tys, cs, l, n)
-         | Infixr(n) => "Infixr" ^ infixrl(cs, tys, n)
-         | Infixl(n) => "Infixl" ^ infixrl(cs, tys, n)
-         | Binder(sy, n) => binder(sy, tys, cs, n)
-         | TInfixl(n) => "TInfixl" ^ tinfixrl(cs, n)
-         | TInfixr(n) => "TInfixr" ^ tinfixrl(cs, n)
-         | Delimfix(sy) => delimfix(sy, tys, cs)
-      end;
-
-
-fun mk_mixfix((cs, ty), None) =
-      [Pref(pair(bracket_comma_quote cs, quote ty))]
-  | mk_mixfix((c::cs, ty), Some(mfix)) =
-      Mixf(mk_mfix((c, ty), mfix)) :: mk_mixfix((cs, ty), Some(mfix))
-  | mk_mixfix(([], _), _) = [];
-
-fun mk_type_decl((ts, n), None) = [Typed(Pref(pair(bracket_comma_quote ts, n)))]
-  | mk_type_decl((t::ts, n), Some(tinfix)) =
-      [Typed(Pref(pair(bracket(quote t), n))), Typed(Mixf(mk_mfix((t, n), tinfix)))] @
-      mk_type_decl((ts, n), Some(tinfix))
-  | mk_type_decl(([], n), Some(tinfix)) = [];
-
-fun mk_abbr_decl(((ts, a), b), None) =
-    [Abbrd(Pref(triple(quote a, ts, quote b)))]
-  | mk_abbr_decl(((ts, a), b), Some(tinfix)) =
-      [Abbrd(Pref(triple(quote a, ts, quote b))), Abbrd(Mixf(mk_mfix((a, "0"), tinfix)))];
-
-fun mk_extension (((((((cl, def), (ty, ab, tinfix)), ar), (co, mfix)), tr), ax), ml) =
-  ((cl, def, ty, ab, ar, co, ax), big_bracket_comma_ind "    " tinfix,
-    big_bracket_comma_ind "     " mfix, big_bracket_comma_ind "     " tr, ml);
-
-fun add_val((id, _), s) = "val " ^ id ^ " = get_axiom thy " ^ quote id ^ "\n" ^ s;
-
-fun mk_rules ps =
-  let
-    val axs = big_bracket_comma_ind "  " (map pair_quote ps);
-    val vals = foldr add_val (ps, "")
-  in
-    axs ^ "\n\n" ^ vals
-  end;
-
-fun mk_struct (id, s) = "structure " ^ id ^ " =\nstruct\n" ^ s ^ "\nend;\n";
-
-
-fun mk_sext mfix trans =
-  "Some (NewSext {\n\
-\   mixfix =\n    " ^ mfix ^ ",\n\
-\   xrules =\n    " ^ trans ^ ",\n\
-\   parse_ast_translation = parse_ast_translation,\n\
-\   parse_translation = parse_translation,\n\
-\   print_translation = print_translation,\n\
-\   print_ast_translation = print_ast_translation})";
-
-fun mk_simple_sext mfix =
-  "Some (Syntax.simple_sext\n   " ^ mfix ^ ")";
-
-fun mk_ext ((cl, def, ty, ab, ar, co, ax), sext) =
-  " (" ^ space_implode ",\n  " [cl, def, ty, ab, ar, co, sext] ^ ")\n " ^ ax ^ "\n";
-
-fun mk_ext_thy (base, name, ext, sext) =
-  "extend_theory (" ^ base ^ ")\n " ^ quote name ^ "\n" ^ mk_ext (ext, sext);
-
-val preamble =
-  "\nlocal\n\
-  \ val parse_ast_translation = []\n\
-  \ val parse_translation = []\n\
-  \ val print_translation = []\n\
-  \ val print_ast_translation = []\n\
-  \in\n\n\
-  \(**** begin of user section ****)\n";
-
-val postamble = "\n(**** end of user section ****)\n";
-
-fun mk_structure ((name, base), Some (ext, tinfix, mfix, trans, ml)) =
-      let
-        val noext = ("[]", "[]", "[]", "[]", "[]", "[]", "[]");
-        val basethy =
-          if tinfix = "[]" then base ^ (quote name)
-          else mk_ext_thy (base ^ (quote name), name ^ "(type infix)", noext, mk_simple_sext tinfix);
-        val sext =
-          if mfix = "[]" andalso trans = "[]" andalso ml = "" then "None"
-          else mk_sext mfix trans;
-        val thy = "val thy = " ^ mk_ext_thy (basethy, name, ext, sext);
-      in
-        mk_struct (name, preamble ^ ml ^ postamble ^ thy ^ "\nend")
-      end
-  | mk_structure ((name, base), None) =
-      mk_struct (name, "\nval thy = " ^ base ^ (quote name));
-
-datatype basetype = Thy  of string
-                  | File of string;
-
-fun merge thys =
-  let fun make_list (Thy t :: ts) =
-            ("Thy \"" ^ t ^ "\"") :: make_list ts
-        | make_list (File t :: ts) =
-            ("File \"" ^ t ^ "\"") :: make_list ts
-        | make_list [] = []
-  in "base_on " ^ (bracket (space_implode "," (make_list thys))) ^ " " end;
-
-
-
-(*------------------------ PARSERS -------------------------*)
-
-
-open Parse
-
-(*------------------- VARIOUS PARSERS ----------------------*)
-
-val emptyl = empty >> K "[]";
-
-val ids  =  list_of1 id >> bracket_comma_quote;
-(* -> "[id1, id2, ..., idn]" *)
-
-val stgorids =  list_of1 (stg || id);
-val stgorid = stg || id;
-
-val sort =    id >> (bracket o quote)
-           || "{" $$-- (ids || emptyl) --$$ "}";
-(* -> "[id]"
-   -> "[id1, ..., idn]"  *)
-
-val infxl = "infixl" $$-- !! nat
-and infxr = "infixr" $$-- !! nat
-
-
-(*------------------- CLASSES PARSER ----------------------*)
-
-
-
-
-val class  =  (id >> quote) -- ( "<" $$-- (!! ids)  ||  emptyl)   >> pair;
-
-(* -> "(id, [id1, ..., idn])"
-   ||
-   -> "(id, [])"  *)
-
-
-val classes =  "classes" $$-- !!(repeat1 class) >> bracket_comma
-            || emptyl;
-
-
-(* "[(id, [..]), ..., (id, [...])]" *)
-
-
-
-(*------------------- DEFAULT PARSER ---------------------*)
-
-
-val default =  "default" $$-- !!sort
-           ||  emptyl;
-
-(* -> "[]"
-   -> "[id]"
-   -> "[id1, ..., idn]"  *)
-
-
-(*-------------------- TYPES  PARSER  ----------------------*)
-
-val xtypevar = typevar >> quote;
-
-val type_vars_decl = xtypevar >> (fn t => [t])
-                 ||  "(" $$-- list_of1(xtypevar) --$$ ")"
-                 ||  empty >> K [];
-
-val abbr_vars_decl = xtypevar >> bracket
-                 ||  "(" $$-- list_of1(xtypevar) --$$ ")" >> bracket_comma
-                 ||  empty >> K "[]";
-
-val type_decl =  stgorids -- nat
-              || type_vars_decl -- stgorid
-                         >> (fn (ns,t) => ([t], string_of_int(length(ns))));
-
-val abbr_decl = abbr_vars_decl -- stgorid --$$ "=" -- stg;
-
-val tyinfix =  infxl  >> (Some o TInfixl)
-            || infxr  >> (Some o TInfixr);
-
-val type_infix =   "(" $$-- tyinfix --$$ ")"
-               || empty                           >> K None;
-
-val types =  "types" $$--
-                !! (repeat1 ((abbr_decl -- type_infix >> mk_abbr_decl)
-                          || (type_decl -- type_infix >> mk_type_decl)))
-                >> (split_decls_type o flat)
-          || empty >> (K ("[]", "[]", []));
-
-  (* ==> ("[(id, nat), ... ]", "[(id, typevars, stg), ...]", [strg, ...]) *)
-
-
-
-(*-------------------- ARITIES PARSER ----------------------*)
-
-
-val sorts =  list_of sort >> bracket_comma;
-
-(* -> "[[id1, ...], ..., [id, ...]]" *)
-
-
-val arity =  id                           >> (fn s => pair("[]", quote s))
-          || "(" $$-- sorts --$$")" -- id >> (fn (l, s) => pair(l, quote s));
-
-(* -> "([], id)"
-   -> "([[id, ..], ..., [id, ..]], id)" *)
-
-val tys = stgorids >> bracket_comma_quote;
-
-val arities =  "arities" $$-- !! (repeat1 (tys --$$ "::" -- arity >> pair))
-               >> bracket_comma
-            || emptyl;
-
-(* -> "[([id, ..], ([[id, ...], ...], id))]" *)
-
-
-(*--------------------- CONSTS PARSER ---------------------*)
-
-val natlist = "[" $$--  !!(list_of nat --$$ "]") >> bracket_comma
-            || empty                             >> K "[]";
-
-
-  (* "[nat, ...]"  || "[]" *)
-
-
-val prio_opt =  natlist -- nat  >> Some
-             || empty           >> K None;
-
-val mfix =  stg -- !! prio_opt            >> delim_mix
-         || infxl                         >> Infixl
-         || infxr                         >> Infixr
-         || "binder" $$-- !!(stg -- nat)  >> Binder
-
-val const_decl = stgorids -- !! ("::" $$-- stg);
-
-(*("[exid, ...]", stg)  *)
-
-
-val mixfix =  "(" $$-- !! (mfix --$$ ")")  >> Some
-           || empty                        >> K None;
-
-(* (s, e, l, n) *)
-
-
-val consts = "consts" $$--
-                 !! (repeat1 (const_decl -- mixfix >> mk_mixfix))
-                 >> (split_decls o flat)
-           || empty >> K ("[]", []);
-
-(* ("[([exid, ...], stg), ....]", [strg, ..])  *)
-
-
-(*---------------- TRANSLATIONS PARSER --------------------*)
-
-val xpat = "(" $$-- id --$$ ")" -- stg >> pair_quote
-         || stg >> (fn s => pair_quote ("logic", s));
-
-val arrow = $$ "=>" >> K " |-> "
-         || $$ "<=" >> K " <-| "
-         || $$ "==" >> K " <-> ";
-
-val xrule = xpat -- !! (arrow -- xpat) >> (fn (xp1, (a, xp2)) => xp1 ^ a ^ xp2);
-
-val translations = "translations" $$-- !! (repeat1 xrule)
-                 || empty;
-
-
-(*------------------- RULES PARSER -----------------------*)
-
-val rules  = "rules" $$-- !! (repeat1 (id -- !! stg) >> mk_rules)
-           || emptyl;
-
-(* "[(id, stg), ...]" *)
-
-(*----------------------- BASE PARSER -------------------------*)
-
-
-fun base toks =
-  let fun make_thy (b, toks) = (Thy b, toks);
-
-      fun make_file (b, toks) = (File b, toks);
-
-      val (b, toks) = make_thy (id toks)
-                      handle _ => make_file (stg toks)
-  in (b, toks) end;
-
-
-(*----------------------- ML_TEXT -------------------------*)
-
-val mltxt =  txt || empty >> K "";
-
-
-(*---------------------------------------------------------*)
-
-val extension = "+" $$-- !! (classes -- default -- types -- arities
-                             -- consts -- translations -- rules --$$ "end" -- mltxt)
-                       >> (Some o mk_extension)
-              || empty >> K None;
-
-
-val bases = base -- repeat("+" $$-- base) >> op:: ;
-
-val theoryDef = !!(id --$$ "=" -- (bases >> merge) -- extension)
-                >> mk_structure;
-
-val read = reader theoryDef
-
-end;
-
--- a/src/ZF/Fin.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-(*  Title: 	ZF/ex/Fin.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1994  University of Cambridge
-
-Finite powerset operator
-
-prove X:Fin(A) ==> |X| < nat
-
-prove:  b: Fin(A) ==> inj(b,b)<=surj(b,b)
-*)
-
-structure Fin = Inductive_Fun
- (val thy        = Arith.thy |> add_consts [("Fin", "i=>i", NoSyn)]
-  val thy_name   = "Fin"
-  val rec_doms   = [("Fin","Pow(A)")]
-  val sintrs     = ["0 : Fin(A)",
-                    "[| a: A;  b: Fin(A) |] ==> cons(a,b) : Fin(A)"]
-  val monos      = []
-  val con_defs   = []
-  val type_intrs = [empty_subsetI, cons_subsetI, PowI]
-  val type_elims = [make_elim PowD]);
-
-val [Fin_0I, Fin_consI] = Fin.intrs;
-
-
-goalw Fin.thy Fin.defs "!!A B. A<=B ==> Fin(A) <= Fin(B)";
-by (rtac lfp_mono 1);
-by (REPEAT (rtac Fin.bnd_mono 1));
-by (REPEAT (ares_tac (Pow_mono::basic_monos) 1));
-val Fin_mono = result();
-
-(* A : Fin(B) ==> A <= B *)
-val FinD = Fin.dom_subset RS subsetD RS PowD;
-
-(** Induction on finite sets **)
-
-(*Discharging x~:y entails extra work*)
-val major::prems = goal Fin.thy 
-    "[| b: Fin(A);  \
-\       P(0);        \
-\       !!x y. [| x: A;  y: Fin(A);  x~:y;  P(y) |] ==> P(cons(x,y)) \
-\    |] ==> P(b)";
-by (rtac (major RS Fin.induct) 1);
-by (excluded_middle_tac "a:b" 2);
-by (etac (cons_absorb RS ssubst) 3 THEN assume_tac 3);	    (*backtracking!*)
-by (REPEAT (ares_tac prems 1));
-val Fin_induct = result();
-
-(** Simplification for Fin **)
-val Fin_ss = arith_ss addsimps Fin.intrs;
-
-(*The union of two finite sets is finite.*)
-val major::prems = goal Fin.thy
-    "[| b: Fin(A);  c: Fin(A) |] ==> b Un c : Fin(A)";
-by (rtac (major RS Fin_induct) 1);
-by (ALLGOALS (asm_simp_tac (Fin_ss addsimps (prems@[Un_0, Un_cons]))));
-val Fin_UnI = result();
-
-(*The union of a set of finite sets is finite.*)
-val [major] = goal Fin.thy "C : Fin(Fin(A)) ==> Union(C) : Fin(A)";
-by (rtac (major RS Fin_induct) 1);
-by (ALLGOALS (asm_simp_tac (Fin_ss addsimps [Union_0, Union_cons, Fin_UnI])));
-val Fin_UnionI = result();
-
-(*Every subset of a finite set is finite.*)
-goal Fin.thy "!!b A. b: Fin(A) ==> ALL z. z<=b --> z: Fin(A)";
-by (etac Fin_induct 1);
-by (simp_tac (Fin_ss addsimps [subset_empty_iff]) 1);
-by (safe_tac (ZF_cs addSDs [subset_cons_iff RS iffD1]));
-by (eres_inst_tac [("b","z")] (cons_Diff RS subst) 2);
-by (ALLGOALS (asm_simp_tac Fin_ss));
-val Fin_subset_lemma = result();
-
-goal Fin.thy "!!c b A. [| c<=b;  b: Fin(A) |] ==> c: Fin(A)";
-by (REPEAT (ares_tac [Fin_subset_lemma RS spec RS mp] 1));
-val Fin_subset = result();
-
-val major::prems = goal Fin.thy 
-    "[| c: Fin(A);  b: Fin(A);  				\
-\       P(b);       						\
-\       !!x y. [| x: A;  y: Fin(A);  x:y;  P(y) |] ==> P(y-{x}) \
-\    |] ==> c<=b --> P(b-c)";
-by (rtac (major RS Fin_induct) 1);
-by (rtac (Diff_cons RS ssubst) 2);
-by (ALLGOALS (asm_simp_tac (Fin_ss addsimps (prems@[Diff_0, cons_subset_iff, 
-				Diff_subset RS Fin_subset]))));
-val Fin_0_induct_lemma = result();
-
-val prems = goal Fin.thy 
-    "[| b: Fin(A);  						\
-\       P(b);        						\
-\       !!x y. [| x: A;  y: Fin(A);  x:y;  P(y) |] ==> P(y-{x}) \
-\    |] ==> P(0)";
-by (rtac (Diff_cancel RS subst) 1);
-by (rtac (Fin_0_induct_lemma RS mp) 1);
-by (REPEAT (ares_tac (subset_refl::prems) 1));
-val Fin_0_induct = result();
-
-(*Functions from a finite ordinal*)
-val prems = goal Fin.thy "n: nat ==> n->A <= Fin(nat*A)";
-by (nat_ind_tac "n" prems 1);
-by (simp_tac (ZF_ss addsimps [Pi_empty1, Fin_0I, subset_iff, cons_iff]) 1);
-by (asm_simp_tac (ZF_ss addsimps [succ_def, mem_not_refl RS cons_fun_eq]) 1);
-by (fast_tac (ZF_cs addSIs [Fin_consI]) 1);
-val nat_fun_subset_Fin = result();
--- a/src/ZF/Fin.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-(*Dummy theory to document dependencies *)
-
-Fin = Arith + "inductive" + "equalities"
--- a/src/ZF/IMP/Aexp.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-(*  Title: 	ZF/IMP/Aexp.ML
-    ID:         $Id$
-    Author: 	Heiko Loetzbeyer & Robert Sandner, TUM
-    Copyright   1994 TUM
-*)
-
-structure Aexp = Datatype_Fun
- (
-  val thy = Univ.thy |> add_consts [("loc", "i", NoSyn)]
-  val thy_name = "Aexp"
-  val rec_specs = 
-      [(
-        "aexp", "univ(loc Un (nat->nat) Un ((nat*nat) -> nat) )",
-          [
-           (["N","X"],	"i => i", NoSyn),
-           (["Op1"],    "[i,i] => i", NoSyn),
-           (["Op2"],    "[i,i,i] => i", NoSyn) 
-          ]
-       )];
-
-  val rec_styp = "i";
-  val ext = None;
-
-  val sintrs = 
-      [
-       "n:nat ==> N(n) : aexp", 
-       "x:loc ==> X(x) : aexp",
-       "[| f: nat -> nat; a : aexp |] ==> Op1(f,a) : aexp",
-       "[| f: (nat * nat) -> nat; a0 : aexp; a1: aexp |] \
-\          ==> Op2(f,a0,a1) : aexp"
-      ];
-  val monos = [];
-  val type_intrs = datatype_intrs;
-  val type_elims = datatype_elims;
- );
--- a/src/ZF/IMP/Aexp.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-(*  Title: 	ZF/IMP/Aexp.thy
-    ID:         $Id$
-    Author: 	Heiko Loetzbeyer & Robert Sandner, TUM
-    Copyright   1994 TUM
-
-Dummy theory merely recording dependence
-*)
-
-Aexp = Univ
--- a/src/ZF/IMP/Assign.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-(*  Title: 	ZF/IMP/Assign.ML
-    ID:         $Id$
-    Author: 	Heiko Loetzbeyer & Robert Sandner, TUM
-    Copyright   1994 TUM
-*)
-
-open Assign;
-
-val assign_type = prove_goalw Assign.thy [assign_def]
-	"[| sigma:loc -> nat; n:nat |] ==> sigma[n/x] : loc -> nat"
-    (fn prems => [(fast_tac  
-                   (ZF_cs addIs [apply_type,lam_type,if_type]@prems) 1)]);
--- a/src/ZF/IMP/Assign.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-(*  Title: 	ZF/IMP/Assign.thy
-    ID:         $Id$
-    Author: 	Heiko Loetzbeyer & Robert Sandner, TUM
-    Copyright   1994 TUM
-*)
-
-Assign = Aexp +
-consts 
-	"assign" :: "[i,i,i] => i"	("_[_'/_]" [900,0,0] 900)
-
-rules 
-	assign_def	"sigma[m/x] == lam y:loc. if(y=x,m,sigma`y)"
-end
--- a/src/ZF/IMP/Bexp.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-(*  Title: 	ZF/IMP/Bexp.ML
-    ID:         $Id$
-    Author: 	Heiko Loetzbeyer & Robert Sandner, TUM
-    Copyright   1994 TUM
-*)
-
-structure Bexp = Datatype_Fun
- (
-  val thy = Aexp.thy;
-  val thy_name = "Bexp"
-  val rec_specs = 
-      [
-       (
-        "bexp", "univ(aexp Un ((nat*nat)->bool) )",
-	  [
-           ( ["true","false"],	"i", NoSyn),
-	   ( ["noti"],		"i => i", NoSyn),
-	   ( ["andi"], 	"[i,i]=>i", Infixl 60),
-	   ( ["ori"], 	"[i,i]=>i", Infixl 60),
-           ( ["ROp"], "[i,i,i] => i", NoSyn)
-          ]
-       )
-      ];
-
-  val rec_styp = "i";
-  val sintrs = 
-       [
-        "true : bexp",
-	"false : bexp",
-	"[| a0 : aexp; a1 : aexp; f: (nat*nat)->bool |] ==> ROp(f,a0,a1) : bexp",
-	"b : bexp ==> noti(b) : bexp",
-	"[| b0 : bexp; b1 : bexp |] ==> b0 andi b1 : bexp",
-	"[| b0 : bexp; b1 : bexp |] ==> b0 ori b1 : bexp"
-       ];
-  val monos = [];
-  val type_intrs = datatype_intrs;
-  val type_elims = datatype_elims;
- );
--- a/src/ZF/IMP/Bexp.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-(*  Title: 	ZF/IMP/Bexp.thy
-    ID:         $Id$
-    Author: 	Heiko Loetzbeyer & Robert Sandner, TUM
-    Copyright   1994 TUM
-
-Dummy theory merely recording dependence
-*)
-
-Bexp = Aexp
--- a/src/ZF/IMP/Evala.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-(*  Title: 	ZF/IMP/Evala.ML
-    ID:         $Id$
-    Author: 	Heiko Loetzbeyer & Robert Sandner, TUM
-    Copyright   1994 TUM
-*)
-
-structure Evala = Inductive_Fun
- (
-  val thy = Evala0.thy;
-  val thy_name="Evala";
-  val rec_doms = [("evala","aexp * (loc -> nat) * nat")];
-  val sintrs = 
-      [
-	"[| n:nat ; sigma:loc->nat |] ==> <N(n),sigma> -a-> n",
-       	"[| x:loc;  sigma:loc->nat |] ==> <X(x),sigma> -a-> sigma`x",
-       	"[| <e,sigma> -a-> n; f: nat -> nat |] \
-\           ==> <Op1(f,e),sigma> -a-> f`n" ,
-       	"[| <e0,sigma> -a-> n0; <e1,sigma>  -a-> n1; \
-\           f: (nat * nat) -> nat  |] \
-\           ==> <Op2(f,e0,e1),sigma> -a-> f`<n0,n1>"  ];
-
-  val monos = [];
-  val con_defs = [];
-  val type_intrs = Aexp.intrs@[apply_funtype];
-  val type_elims = []
- );
--- a/src/ZF/IMP/Evala.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-(*  Title: 	ZF/IMP/Evala.thy
-    ID:         $Id$
-    Author: 	Heiko Loetzbeyer & Robert Sandner, TUM
-    Copyright   1994 TUM
-
-Dummy theory merely recording dependence
-*)
-
-Evala = Evala0
--- a/src/ZF/IMP/Evala0.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-(*  Title: 	ZF/IMP/Evala0.thy
-    ID:         $Id$
-    Author: 	Heiko Loetzbeyer & Robert Sandner, TUM
-    Copyright   1994 TUM
-*)
-
-Evala0 = Aexp +
-
-consts  evala    :: "i"
-       "@evala"  :: "[i,i,i] => o"	("<_,_>/ -a-> _")
-
-translations
- "<ae,sig> -a-> n" == "<ae,sig,n> : evala"
-end
--- a/src/ZF/IMP/Evalb.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-(*  Title: 	ZF/IMP/Evalb.ML
-    ID:         $Id$
-    Author: 	Heiko Loetzbeyer & Robert Sandner, TUM
-    Copyright   1994 TUM
-*)
-
-structure Evalb = Inductive_Fun
- (
-  val thy = Evalb0.thy;
-  val thy_name = "Evalb"
-  val rec_doms = [("evalb","bexp * (loc -> nat) * bool")];
-  val sintrs = 
-      [
-	"[| sigma:loc -> nat |] ==> <true,sigma> -b-> 1",
-       	"[| sigma:loc -> nat |] ==> <false,sigma> -b-> 0",
-       	"[| <a0,sigma> -a-> n0; <a1,sigma> -a-> n1; f: (nat*nat)->bool |] \
-\	    ==> <ROp(f,a0,a1),sigma> -b-> f`<n0,n1> ",
-       	"[| <b,sigma> -b-> w |] \
-\	    ==> <noti(b),sigma> -b-> not(w)", 
-       	"[| <b0,sigma> -b-> w0; <b1,sigma> -b-> w1 |] \
-\	    ==> <b0 andi b1,sigma> -b-> (w0 and w1)",
-       	"[| <b0,sigma> -b-> w0; <b1,sigma> -b-> w1 |] \
-\	    ==> <b0 ori b1,sigma> -b-> (w0 or w1)"
-      ];
-
-  val monos = [];
-  val con_defs = [];
-  val type_intrs = Bexp.intrs@[apply_funtype,and_type,or_type,
-		   bool_1I,bool_0I,not_type];
-  val type_elims = [make_elim(Evala.dom_subset RS subsetD) ];
- );
--- a/src/ZF/IMP/Evalb.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-(*  Title: 	ZF/IMP/Evalb.thy
-    ID:         $Id$
-    Author: 	Heiko Loetzbeyer & Robert Sandner, TUM
-    Copyright   1994 TUM
-
-Dummy theory merely recording dependence
-*)
-
-Evalb = Evalb0
--- a/src/ZF/IMP/Evalb0.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-(*  Title: 	ZF/IMP/Evalb0.thy
-    ID:         $Id$
-    Author: 	Heiko Loetzbeyer & Robert Sandner, TUM
-    Copyright   1994 TUM
-*)
-
-Evalb0 = Evala + Bexp +
-
-consts 
-        evalb	 :: "i"	
-        "@evalb" :: "[i,i,i] => o"	("<_,_>/ -b-> _")
-
-translations
-	"<be,sig> -b-> b" == "<be,sig,b> : evalb"
-end
--- a/src/ZF/IMP/Evalc.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-(*  Title: 	ZF/IMP/Evalc.ML
-    ID:         $Id$
-    Author: 	Heiko Loetzbeyer & Robert Sandner, TUM
-    Copyright   1994 TUM
-*)
-
-structure Evalc = Inductive_Fun    
- (
-  val thy = Evalc0.thy;
-  val thy_name = "Evalc"
-  val rec_doms = [("evalc","com * (loc -> nat) * (loc -> nat)")];
-  val sintrs =
-      [
-	"[| sigma: loc -> nat |] ==> <skip,sigma> -c-> sigma",
-       	"[| m: nat; x: loc; a:aexp; <a,sigma> -a-> m |] ==> \
-\          <X(x) := a,sigma> -c-> sigma[m/x]" , 
-       "[| <c0,sigma> -c-> sigma2; <c1,sigma2> -c-> sigma1 |] ==> \
-\          <c0 ; c1, sigma> -c-> sigma1",
-       "[| b:bexp; c1:com; sigma:loc->nat;\
-\          <b,sigma> -b-> 1; <c0,sigma> -c-> sigma1 |] ==> \
-\       <ifc b then c0 else c1, sigma> -c-> sigma1 ",
-       "[| b:bexp; c0:com; sigma:loc->nat;\
-\          <b,sigma> -b-> 0; <c1,sigma> -c-> sigma1 |] ==> \
-\       <ifc b then c0 else c1, sigma> -c-> sigma1 ",
-       "[| b:bexp; c:com; <b, sigma> -b-> 0 |] ==> \
-\          <while b do c,sigma> -c-> sigma ",
-       "[| b:bexp; c:com; <b,sigma> -b-> 1; <c,sigma> -c-> sigma2; \
-\          <while b do c, sigma2> -c-> sigma1 |] ==> \
-\          <while b do c, sigma> -c-> sigma1 "];
-
-  val monos = [];
-  val con_defs = [assign_def];
-  val type_intrs = Bexp.intrs@Com.intrs@[if_type,lam_type,apply_type];
-  val type_elims = [make_elim(Evala.dom_subset RS subsetD),
-		    make_elim(Evalb.dom_subset RS subsetD) ]);
--- a/src/ZF/IMP/Evalc.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-(*  Title: 	ZF/IMP/Evalc.thy
-    ID:         $Id$
-    Author: 	Heiko Loetzbeyer & Robert Sandner, TUM
-    Copyright   1994 TUM
-
-Dummy theory merely recording dependence
-*)
-
-Evalc = Evalc0
--- a/src/ZF/IMP/Evalc0.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-(*  Title: 	ZF/IMP/Evalc0.thy
-    ID:         $Id$
-    Author: 	Heiko Loetzbeyer & Robert Sandner, TUM
-    Copyright   1994 TUM
-*)
-
-Evalc0 = Evalb + Com + Assign +
-
-consts
-       evalc    :: "i"
-       "@evalc" :: "[i,i,i] => o"   ("<_,_>/ -c-> _")
-
-translations
-       "<ce,sig> -c-> s" == "<ce,sig,s> : evalc"
-end
--- a/src/ZF/ListFn.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,366 +0,0 @@
-(*  Title: 	ZF/list-fn.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1992  University of Cambridge
-
-For list-fn.thy.  Lists in Zermelo-Fraenkel Set Theory 
-*)
-
-open ListFn;
-
-(** hd and tl **)
-
-goalw ListFn.thy [hd_def] "hd(Cons(a,l)) = a";
-by (resolve_tac List.case_eqns 1);
-val hd_Cons = result();
-
-goalw ListFn.thy [tl_def] "tl(Nil) = Nil";
-by (resolve_tac List.case_eqns 1);
-val tl_Nil = result();
-
-goalw ListFn.thy [tl_def] "tl(Cons(a,l)) = l";
-by (resolve_tac List.case_eqns 1);
-val tl_Cons = result();
-
-goal ListFn.thy "!!l. l: list(A) ==> tl(l) : list(A)";
-by (etac List.elim 1);
-by (ALLGOALS (asm_simp_tac (ZF_ss addsimps (List.intrs @ [tl_Nil,tl_Cons]))));
-val tl_type = result();
-
-(** drop **)
-
-goalw ListFn.thy [drop_def] "drop(0, l) = l";
-by (rtac rec_0 1);
-val drop_0 = result();
-
-goalw ListFn.thy [drop_def] "!!i. i:nat ==> drop(i, Nil) = Nil";
-by (etac nat_induct 1);
-by (ALLGOALS (asm_simp_tac (nat_ss addsimps [tl_Nil])));
-val drop_Nil = result();
-
-goalw ListFn.thy [drop_def]
-    "!!i. i:nat ==> drop(succ(i), Cons(a,l)) = drop(i,l)";
-by (etac nat_induct 1);
-by (ALLGOALS (asm_simp_tac (nat_ss addsimps [tl_Cons])));
-val drop_succ_Cons = result();
-
-goalw ListFn.thy [drop_def] 
-    "!!i l. [| i:nat; l: list(A) |] ==> drop(i,l) : list(A)";
-by (etac nat_induct 1);
-by (ALLGOALS (asm_simp_tac (nat_ss addsimps [tl_type])));
-val drop_type = result();
-
-(** list_rec -- by Vset recursion **)
-
-goal ListFn.thy "list_rec(Nil,c,h) = c";
-by (rtac (list_rec_def RS def_Vrec RS trans) 1);
-by (simp_tac (ZF_ss addsimps List.case_eqns) 1);
-val list_rec_Nil = result();
-
-goal ListFn.thy "list_rec(Cons(a,l), c, h) = h(a, l, list_rec(l,c,h))";
-by (rtac (list_rec_def RS def_Vrec RS trans) 1);
-by (simp_tac (rank_ss addsimps (rank_Cons2::List.case_eqns)) 1);
-val list_rec_Cons = result();
-
-(*Type checking -- proved by induction, as usual*)
-val prems = goal ListFn.thy
-    "[| l: list(A);    \
-\       c: C(Nil);       \
-\       !!x y r. [| x:A;  y: list(A);  r: C(y) |] ==> h(x,y,r): C(Cons(x,y))  \
-\    |] ==> list_rec(l,c,h) : C(l)";
-by (list_ind_tac "l" prems 1);
-by (ALLGOALS (asm_simp_tac
-	      (ZF_ss addsimps (prems@[list_rec_Nil,list_rec_Cons]))));
-val list_rec_type = result();
-
-(** Versions for use with definitions **)
-
-val [rew] = goal ListFn.thy
-    "[| !!l. j(l)==list_rec(l, c, h) |] ==> j(Nil) = c";
-by (rewtac rew);
-by (rtac list_rec_Nil 1);
-val def_list_rec_Nil = result();
-
-val [rew] = goal ListFn.thy
-    "[| !!l. j(l)==list_rec(l, c, h) |] ==> j(Cons(a,l)) = h(a,l,j(l))";
-by (rewtac rew);
-by (rtac list_rec_Cons 1);
-val def_list_rec_Cons = result();
-
-fun list_recs def = map standard
-    	([def] RL [def_list_rec_Nil, def_list_rec_Cons]);
-
-(** map **)
-
-val [map_Nil,map_Cons] = list_recs map_def;
-
-val prems = goalw ListFn.thy [map_def] 
-    "[| l: list(A);  !!x. x: A ==> h(x): B |] ==> map(h,l) : list(B)";
-by (REPEAT (ares_tac (prems@[list_rec_type, NilI, ConsI]) 1));
-val map_type = result();
-
-val [major] = goal ListFn.thy "l: list(A) ==> map(h,l) : list({h(u). u:A})";
-by (rtac (major RS map_type) 1);
-by (etac RepFunI 1);
-val map_type2 = result();
-
-(** length **)
-
-val [length_Nil,length_Cons] = list_recs length_def;
-
-goalw ListFn.thy [length_def] 
-    "!!l. l: list(A) ==> length(l) : nat";
-by (REPEAT (ares_tac [list_rec_type, nat_0I, nat_succI] 1));
-val length_type = result();
-
-(** app **)
-
-val [app_Nil,app_Cons] = list_recs app_def;
-
-goalw ListFn.thy [app_def] 
-    "!!xs ys. [| xs: list(A);  ys: list(A) |] ==> xs@ys : list(A)";
-by (REPEAT (ares_tac [list_rec_type, ConsI] 1));
-val app_type = result();
-
-(** rev **)
-
-val [rev_Nil,rev_Cons] = list_recs rev_def;
-
-val prems = goalw ListFn.thy [rev_def] 
-    "xs: list(A) ==> rev(xs) : list(A)";
-by (REPEAT (ares_tac (prems @ [list_rec_type, NilI, ConsI, app_type]) 1));
-val rev_type = result();
-
-
-(** flat **)
-
-val [flat_Nil,flat_Cons] = list_recs flat_def;
-
-val prems = goalw ListFn.thy [flat_def] 
-    "ls: list(list(A)) ==> flat(ls) : list(A)";
-by (REPEAT (ares_tac (prems @ [list_rec_type, NilI, ConsI, app_type]) 1));
-val flat_type = result();
-
-
-(** list_add **)
-
-val [list_add_Nil,list_add_Cons] = list_recs list_add_def;
-
-val prems = goalw ListFn.thy [list_add_def] 
-    "xs: list(nat) ==> list_add(xs) : nat";
-by (REPEAT (ares_tac (prems @ [list_rec_type, nat_0I, add_type]) 1));
-val list_add_type = result();
-
-(** ListFn simplification **)
-
-val list_typechecks =
-      [NilI, ConsI, list_rec_type,
-       map_type, map_type2, app_type, length_type, rev_type, flat_type,
-       list_add_type];
-
-val list_ss = arith_ss 
-    addsimps List.case_eqns
-    addsimps [list_rec_Nil, list_rec_Cons, 
-	     map_Nil, map_Cons,
-	     app_Nil, app_Cons,
-	     length_Nil, length_Cons,
-	     rev_Nil, rev_Cons,
-	     flat_Nil, flat_Cons,
-	     list_add_Nil, list_add_Cons]
-    setsolver (type_auto_tac list_typechecks);
-(*Could also rewrite using the list_typechecks...*)
-
-(*** theorems about map ***)
-
-val prems = goal ListFn.thy
-    "l: list(A) ==> map(%u.u, l) = l";
-by (list_ind_tac "l" prems 1);
-by (ALLGOALS (asm_simp_tac list_ss));
-val map_ident = result();
-
-val prems = goal ListFn.thy
-    "l: list(A) ==> map(h, map(j,l)) = map(%u.h(j(u)), l)";
-by (list_ind_tac "l" prems 1);
-by (ALLGOALS (asm_simp_tac list_ss));
-val map_compose = result();
-
-val prems = goal ListFn.thy
-    "xs: list(A) ==> map(h, xs@ys) = map(h,xs) @ map(h,ys)";
-by (list_ind_tac "xs" prems 1);
-by (ALLGOALS (asm_simp_tac list_ss));
-val map_app_distrib = result();
-
-val prems = goal ListFn.thy
-    "ls: list(list(A)) ==> map(h, flat(ls)) = flat(map(map(h),ls))";
-by (list_ind_tac "ls" prems 1);
-by (ALLGOALS (asm_simp_tac (list_ss addsimps [map_app_distrib])));
-val map_flat = result();
-
-val prems = goal ListFn.thy
-    "l: list(A) ==> \
-\    list_rec(map(h,l), c, d) = \
-\    list_rec(l, c, %x xs r. d(h(x), map(h,xs), r))";
-by (list_ind_tac "l" prems 1);
-by (ALLGOALS (asm_simp_tac list_ss));
-val list_rec_map = result();
-
-(** theorems about list(Collect(A,P)) -- used in ex/term.ML **)
-
-(* c : list(Collect(B,P)) ==> c : list(B) *)
-val list_CollectD = standard (Collect_subset RS list_mono RS subsetD);
-
-val prems = goal ListFn.thy
-    "l: list({x:A. h(x)=j(x)}) ==> map(h,l) = map(j,l)";
-by (list_ind_tac "l" prems 1);
-by (ALLGOALS (asm_simp_tac list_ss));
-val map_list_Collect = result();
-
-(*** theorems about length ***)
-
-val prems = goal ListFn.thy
-    "xs: list(A) ==> length(map(h,xs)) = length(xs)";
-by (list_ind_tac "xs" prems 1);
-by (ALLGOALS (asm_simp_tac list_ss));
-val length_map = result();
-
-val prems = goal ListFn.thy
-    "xs: list(A) ==> length(xs@ys) = length(xs) #+ length(ys)";
-by (list_ind_tac "xs" prems 1);
-by (ALLGOALS (asm_simp_tac list_ss));
-val length_app = result();
-
-(* [| m: nat; n: nat |] ==> m #+ succ(n) = succ(n) #+ m 
-   Used for rewriting below*)
-val add_commute_succ = nat_succI RSN (2,add_commute);
-
-val prems = goal ListFn.thy
-    "xs: list(A) ==> length(rev(xs)) = length(xs)";
-by (list_ind_tac "xs" prems 1);
-by (ALLGOALS (asm_simp_tac (list_ss addsimps [length_app, add_commute_succ])));
-val length_rev = result();
-
-val prems = goal ListFn.thy
-    "ls: list(list(A)) ==> length(flat(ls)) = list_add(map(length,ls))";
-by (list_ind_tac "ls" prems 1);
-by (ALLGOALS (asm_simp_tac (list_ss addsimps [length_app])));
-val length_flat = result();
-
-(** Length and drop **)
-
-(*Lemma for the inductive step of drop_length*)
-goal ListFn.thy
-    "!!xs. xs: list(A) ==> \
-\          ALL x.  EX z zs. drop(length(xs), Cons(x,xs)) = Cons(z,zs)";
-by (etac List.induct 1);
-by (ALLGOALS (asm_simp_tac (list_ss addsimps [drop_0,drop_succ_Cons])));
-by (fast_tac ZF_cs 1);
-val drop_length_Cons_lemma = result();
-val drop_length_Cons = standard (drop_length_Cons_lemma RS spec);
-
-goal ListFn.thy
-    "!!l. l: list(A) ==> ALL i: length(l).  EX z zs. drop(i,l) = Cons(z,zs)";
-by (etac List.induct 1);
-by (ALLGOALS (asm_simp_tac (list_ss addsimps bquant_simps)));
-by (rtac conjI 1);
-by (etac drop_length_Cons 1);
-by (rtac ballI 1);
-by (rtac natE 1);
-by (etac ([asm_rl, length_type, Ord_nat] MRS Ord_trans) 1);
-by (assume_tac 1);
-by (asm_simp_tac (list_ss addsimps [drop_0]) 1);
-by (fast_tac ZF_cs 1);
-by (asm_simp_tac (list_ss addsimps [drop_succ_Cons]) 1);
-by (dtac bspec 1);
-by (fast_tac ZF_cs 2);
-by (fast_tac (ZF_cs addEs [succ_in_naturalD,length_type]) 1);
-val drop_length_lemma = result();
-val drop_length = standard (drop_length_lemma RS bspec);
-
-
-(*** theorems about app ***)
-
-val [major] = goal ListFn.thy "xs: list(A) ==> xs@Nil=xs";
-by (rtac (major RS List.induct) 1);
-by (ALLGOALS (asm_simp_tac list_ss));
-val app_right_Nil = result();
-
-val prems = goal ListFn.thy "xs: list(A) ==> (xs@ys)@zs = xs@(ys@zs)";
-by (list_ind_tac "xs" prems 1);
-by (ALLGOALS (asm_simp_tac list_ss));
-val app_assoc = result();
-
-val prems = goal ListFn.thy
-    "ls: list(list(A)) ==> flat(ls@ms) = flat(ls)@flat(ms)";
-by (list_ind_tac "ls" prems 1);
-by (ALLGOALS (asm_simp_tac (list_ss addsimps [app_assoc])));
-val flat_app_distrib = result();
-
-(*** theorems about rev ***)
-
-val prems = goal ListFn.thy "l: list(A) ==> rev(map(h,l)) = map(h,rev(l))";
-by (list_ind_tac "l" prems 1);
-by (ALLGOALS (asm_simp_tac (list_ss addsimps [map_app_distrib])));
-val rev_map_distrib = result();
-
-(*Simplifier needs the premises as assumptions because rewriting will not
-  instantiate the variable ?A in the rules' typing conditions; note that
-  rev_type does not instantiate ?A.  Only the premises do.
-*)
-goal ListFn.thy
-    "!!xs. [| xs: list(A);  ys: list(A) |] ==> rev(xs@ys) = rev(ys)@rev(xs)";
-by (etac List.induct 1);
-by (ALLGOALS (asm_simp_tac (list_ss addsimps [app_right_Nil,app_assoc])));
-val rev_app_distrib = result();
-
-val prems = goal ListFn.thy "l: list(A) ==> rev(rev(l))=l";
-by (list_ind_tac "l" prems 1);
-by (ALLGOALS (asm_simp_tac (list_ss addsimps [rev_app_distrib])));
-val rev_rev_ident = result();
-
-val prems = goal ListFn.thy
-    "ls: list(list(A)) ==> rev(flat(ls)) = flat(map(rev,rev(ls)))";
-by (list_ind_tac "ls" prems 1);
-by (ALLGOALS (asm_simp_tac (list_ss addsimps 
-       [map_app_distrib, flat_app_distrib, rev_app_distrib, app_right_Nil])));
-val rev_flat = result();
-
-
-(*** theorems about list_add ***)
-
-val prems = goal ListFn.thy
-    "[| xs: list(nat);  ys: list(nat) |] ==> \
-\    list_add(xs@ys) = list_add(ys) #+ list_add(xs)";
-by (cut_facts_tac prems 1);
-by (list_ind_tac "xs" prems 1);
-by (ALLGOALS 
-    (asm_simp_tac (list_ss addsimps [add_0_right, add_assoc RS sym])));
-by (rtac (add_commute RS subst_context) 1);
-by (REPEAT (ares_tac [refl, list_add_type] 1));
-val list_add_app = result();
-
-val prems = goal ListFn.thy
-    "l: list(nat) ==> list_add(rev(l)) = list_add(l)";
-by (list_ind_tac "l" prems 1);
-by (ALLGOALS
-    (asm_simp_tac (list_ss addsimps [list_add_app, add_0_right])));
-val list_add_rev = result();
-
-val prems = goal ListFn.thy
-    "ls: list(list(nat)) ==> list_add(flat(ls)) = list_add(map(list_add,ls))";
-by (list_ind_tac "ls" prems 1);
-by (ALLGOALS (asm_simp_tac (list_ss addsimps [list_add_app])));
-by (REPEAT (ares_tac [refl, list_add_type, map_type, add_commute] 1));
-val list_add_flat = result();
-
-(** New induction rule **)
-
-val major::prems = goal ListFn.thy
-    "[| l: list(A);  \
-\       P(Nil);        \
-\       !!x y. [| x: A;  y: list(A);  P(y) |] ==> P(y @ [x]) \
-\    |] ==> P(l)";
-by (rtac (major RS rev_rev_ident RS subst) 1);
-by (rtac (major RS rev_type RS List.induct) 1);
-by (ALLGOALS (asm_simp_tac (list_ss addsimps prems)));
-val list_append_induct = result();
-
--- a/src/ZF/ListFn.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-(*  Title: 	ZF/list-fn
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-Functions for Lists in Zermelo-Fraenkel Set Theory 
-
-map is a binding operator -- it applies to meta-level functions, not 
-object-level functions.  This simplifies the final form of term_rec_conv,
-although complicating its derivation.
-*)
-
-ListFn = List + "constructor" +
-consts
-  "@"	     :: "[i,i]=>i"      			(infixr 60)
-  list_rec   :: "[i, i, [i,i,i]=>i] => i"
-  map 	     :: "[i=>i, i] => i"
-  length,rev :: "i=>i"
-  flat       :: "i=>i"
-  list_add   :: "i=>i"
-  hd,tl      :: "i=>i"
-  drop	     :: "[i,i]=>i"
-
- (* List Enumeration *)
- "[]"        :: "i" 	                           	("[]")
- "@List"     :: "is => i" 	                   	("[(_)]")
-
-
-translations
-  "[x, xs]"     == "Cons(x, [xs])"
-  "[x]"         == "Cons(x, [])"
-  "[]"          == "Nil"
-
-
-rules
-
-  hd_def	"hd(l)	     == list_case(0, %x xs.x, l)"
-  tl_def	"tl(l)       == list_case(Nil, %x xs.xs, l)"
-  drop_def	"drop(i,l)   == rec(i, l, %j r. tl(r))"
-
-  list_rec_def
-      "list_rec(l,c,h) == Vrec(l, %l g.list_case(c, %x xs. h(x, xs, g`xs), l))"
-
-  map_def       "map(f,l)    == list_rec(l,  Nil,  %x xs r. Cons(f(x), r))"
-  length_def    "length(l)   == list_rec(l,  0,  %x xs r. succ(r))"
-  app_def       "xs@ys       == list_rec(xs, ys, %x xs r. Cons(x,r))"
-  rev_def       "rev(l)      == list_rec(l,  Nil,  %x xs r. r @ [x])"
-  flat_def      "flat(ls)    == list_rec(ls, Nil,  %l ls r. l @ r)"
-  list_add_def  "list_add(l) == list_rec(l, 0,  %x xs r. x#+r)"
-end
--- a/src/ZF/Ord.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,524 +0,0 @@
-(*  Title: 	ZF/ordinal.thy
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-For ordinal.thy.  Ordinals in Zermelo-Fraenkel Set Theory 
-*)
-
-open Ord;
-
-(*** Rules for Transset ***)
-
-(** Two neat characterisations of Transset **)
-
-goalw Ord.thy [Transset_def] "Transset(A) <-> A<=Pow(A)";
-by (fast_tac ZF_cs 1);
-val Transset_iff_Pow = result();
-
-goalw Ord.thy [Transset_def] "Transset(A) <-> Union(succ(A)) = A";
-by (fast_tac (eq_cs addSEs [equalityE]) 1);
-val Transset_iff_Union_succ = result();
-
-(** Consequences of downwards closure **)
-
-goalw Ord.thy [Transset_def]
-    "!!C a b. [| Transset(C); {a,b}: C |] ==> a:C & b: C";
-by (fast_tac ZF_cs 1);
-val Transset_doubleton_D = result();
-
-val [prem1,prem2] = goalw Ord.thy [Pair_def]
-    "[| Transset(C); <a,b>: C |] ==> a:C & b: C";
-by (cut_facts_tac [prem2] 1);	
-by (fast_tac (ZF_cs addSDs [prem1 RS Transset_doubleton_D]) 1);
-val Transset_Pair_D = result();
-
-val prem1::prems = goal Ord.thy
-    "[| Transset(C); A*B <= C; b: B |] ==> A <= C";
-by (cut_facts_tac prems 1);
-by (fast_tac (ZF_cs addSDs [prem1 RS Transset_Pair_D]) 1);
-val Transset_includes_domain = result();
-
-val prem1::prems = goal Ord.thy
-    "[| Transset(C); A*B <= C; a: A |] ==> B <= C";
-by (cut_facts_tac prems 1);
-by (fast_tac (ZF_cs addSDs [prem1 RS Transset_Pair_D]) 1);
-val Transset_includes_range = result();
-
-val [prem1,prem2] = goalw (merge_theories(Ord.thy,Sum.thy)) [sum_def]
-    "[| Transset(C); A+B <= C |] ==> A <= C & B <= C";
-by (rtac (prem2 RS (Un_subset_iff RS iffD1) RS conjE) 1);
-by (REPEAT (etac (prem1 RS Transset_includes_range) 1
-     ORELSE resolve_tac [conjI, singletonI] 1));
-val Transset_includes_summands = result();
-
-val [prem] = goalw (merge_theories(Ord.thy,Sum.thy)) [sum_def]
-    "Transset(C) ==> (A+B) Int C <= (A Int C) + (B Int C)";
-by (rtac (Int_Un_distrib RS ssubst) 1);
-by (fast_tac (ZF_cs addSDs [prem RS Transset_Pair_D]) 1);
-val Transset_sum_Int_subset = result();
-
-(** Closure properties **)
-
-goalw Ord.thy [Transset_def] "Transset(0)";
-by (fast_tac ZF_cs 1);
-val Transset_0 = result();
-
-goalw Ord.thy [Transset_def]
-    "!!i j. [| Transset(i);  Transset(j) |] ==> Transset(i Un j)";
-by (fast_tac ZF_cs 1);
-val Transset_Un = result();
-
-goalw Ord.thy [Transset_def]
-    "!!i j. [| Transset(i);  Transset(j) |] ==> Transset(i Int j)";
-by (fast_tac ZF_cs 1);
-val Transset_Int = result();
-
-goalw Ord.thy [Transset_def] "!!i. Transset(i) ==> Transset(succ(i))";
-by (fast_tac ZF_cs 1);
-val Transset_succ = result();
-
-goalw Ord.thy [Transset_def] "!!i. Transset(i) ==> Transset(Pow(i))";
-by (fast_tac ZF_cs 1);
-val Transset_Pow = result();
-
-goalw Ord.thy [Transset_def] "!!A. Transset(A) ==> Transset(Union(A))";
-by (fast_tac ZF_cs 1);
-val Transset_Union = result();
-
-val [Transprem] = goalw Ord.thy [Transset_def]
-    "[| !!i. i:A ==> Transset(i) |] ==> Transset(Union(A))";
-by (fast_tac (ZF_cs addEs [Transprem RS bspec RS subsetD]) 1);
-val Transset_Union_family = result();
-
-val [prem,Transprem] = goalw Ord.thy [Transset_def]
-    "[| j:A;  !!i. i:A ==> Transset(i) |] ==> Transset(Inter(A))";
-by (cut_facts_tac [prem] 1);
-by (fast_tac (ZF_cs addEs [Transprem RS bspec RS subsetD]) 1);
-val Transset_Inter_family = result();
-
-(*** Natural Deduction rules for Ord ***)
-
-val prems = goalw Ord.thy [Ord_def]
-    "[| Transset(i);  !!x. x:i ==> Transset(x) |]  ==>  Ord(i) ";
-by (REPEAT (ares_tac (prems@[ballI,conjI]) 1));
-val OrdI = result();
-
-val [major] = goalw Ord.thy [Ord_def]
-    "Ord(i) ==> Transset(i)";
-by (rtac (major RS conjunct1) 1);
-val Ord_is_Transset = result();
-
-val [major,minor] = goalw Ord.thy [Ord_def]
-    "[| Ord(i);  j:i |] ==> Transset(j) ";
-by (rtac (minor RS (major RS conjunct2 RS bspec)) 1);
-val Ord_contains_Transset = result();
-
-(*** Lemmas for ordinals ***)
-
-goalw Ord.thy [Ord_def,Transset_def] "!!i j. [| Ord(i);  j:i |] ==> Ord(j) ";
-by (fast_tac ZF_cs 1);
-val Ord_in_Ord = result();
-
-(* Ord(succ(j)) ==> Ord(j) *)
-val Ord_succD = succI1 RSN (2, Ord_in_Ord);
-
-goal Ord.thy "!!i j. [| Ord(i);  Transset(j);  j<=i |] ==> Ord(j)";
-by (REPEAT (ares_tac [OrdI] 1
-     ORELSE eresolve_tac [Ord_contains_Transset, subsetD] 1));
-val Ord_subset_Ord = result();
-
-goalw Ord.thy [Ord_def,Transset_def] "!!i j. [| j:i;  Ord(i) |] ==> j<=i";
-by (fast_tac ZF_cs 1);
-val OrdmemD = result();
-
-goal Ord.thy "!!i j k. [| i:j;  j:k;  Ord(k) |] ==> i:k";
-by (REPEAT (ares_tac [OrdmemD RS subsetD] 1));
-val Ord_trans = result();
-
-goal Ord.thy "!!i j. [| i:j;  Ord(j) |] ==> succ(i) <= j";
-by (REPEAT (ares_tac [OrdmemD RSN (2,succ_subsetI)] 1));
-val Ord_succ_subsetI = result();
-
-
-(*** The construction of ordinals: 0, succ, Union ***)
-
-goal Ord.thy "Ord(0)";
-by (REPEAT (ares_tac [OrdI,Transset_0] 1 ORELSE etac emptyE 1));
-val Ord_0 = result();
-
-goal Ord.thy "!!i. Ord(i) ==> Ord(succ(i))";
-by (REPEAT (ares_tac [OrdI,Transset_succ] 1
-     ORELSE eresolve_tac [succE,ssubst,Ord_is_Transset,
-			  Ord_contains_Transset] 1));
-val Ord_succ = result();
-
-goal Ord.thy "Ord(succ(i)) <-> Ord(i)";
-by (fast_tac (ZF_cs addIs [Ord_succ] addDs [Ord_succD]) 1);
-val Ord_succ_iff = result();
-
-goalw Ord.thy [Ord_def] "!!i j. [| Ord(i); Ord(j) |] ==> Ord(i Un j)";
-by (fast_tac (ZF_cs addSIs [Transset_Un]) 1);
-val Ord_Un = result();
-
-goalw Ord.thy [Ord_def] "!!i j. [| Ord(i); Ord(j) |] ==> Ord(i Int j)";
-by (fast_tac (ZF_cs addSIs [Transset_Int]) 1);
-val Ord_Int = result();
-
-val nonempty::prems = goal Ord.thy
-    "[| j:A;  !!i. i:A ==> Ord(i) |] ==> Ord(Inter(A))";
-by (rtac (nonempty RS Transset_Inter_family RS OrdI) 1);
-by (rtac Ord_is_Transset 1);
-by (REPEAT (ares_tac ([Ord_contains_Transset,nonempty]@prems) 1
-     ORELSE etac InterD 1));
-val Ord_Inter = result();
-
-val jmemA::prems = goal Ord.thy
-    "[| j:A;  !!x. x:A ==> Ord(B(x)) |] ==> Ord(INT x:A. B(x))";
-by (rtac (jmemA RS RepFunI RS Ord_Inter) 1);
-by (etac RepFunE 1);
-by (etac ssubst 1);
-by (eresolve_tac prems 1);
-val Ord_INT = result();
-
-
-(*** < is 'less than' for ordinals ***)
-
-goalw Ord.thy [lt_def] "!!i j. [| i:j;  Ord(j) |] ==> i<j";
-by (REPEAT (ares_tac [conjI] 1));
-val ltI = result();
-
-val major::prems = goalw Ord.thy [lt_def]
-    "[| i<j;  [| i:j;  Ord(i);  Ord(j) |] ==> P |] ==> P";
-by (rtac (major RS conjE) 1);
-by (REPEAT (ares_tac (prems@[Ord_in_Ord]) 1));
-val ltE = result();
-
-goal Ord.thy "!!i j. i<j ==> i:j";
-by (etac ltE 1);
-by (assume_tac 1);
-val ltD = result();
-
-goalw Ord.thy [lt_def] "~ i<0";
-by (fast_tac ZF_cs 1);
-val not_lt0 = result();
-
-(* i<0 ==> R *)
-val lt0E = standard (not_lt0 RS notE);
-
-goal Ord.thy "!!i j k. [| i<j;  j<k |] ==> i<k";
-by (fast_tac (ZF_cs addSIs [ltI] addSEs [ltE, Ord_trans]) 1);
-val lt_trans = result();
-
-goalw Ord.thy [lt_def] "!!i j. [| i<j;  j<i |] ==> P";
-by (REPEAT (eresolve_tac [asm_rl, conjE, mem_anti_sym] 1));
-val lt_anti_sym = result();
-
-val lt_anti_refl = prove_goal Ord.thy "i<i ==> P"
- (fn [major]=> [ (rtac (major RS (major RS lt_anti_sym)) 1) ]);
-
-val lt_not_refl = prove_goal Ord.thy "~ i<i"
- (fn _=> [ (rtac notI 1), (etac lt_anti_refl 1) ]);
-
-(** le is less than or equals;  recall  i le j  abbrevs  i<succ(j) !! **)
-
-goalw Ord.thy [lt_def] "i le j <-> i<j | (i=j & Ord(j))";
-by (fast_tac (ZF_cs addSIs [Ord_succ] addSDs [Ord_succD]) 1);
-val le_iff = result();
-
-goal Ord.thy "!!i j. i<j ==> i le j";
-by (asm_simp_tac (ZF_ss addsimps [le_iff]) 1);
-val leI = result();
-
-goal Ord.thy "!!i. [| i=j;  Ord(j) |] ==> i le j";
-by (asm_simp_tac (ZF_ss addsimps [le_iff]) 1);
-val le_eqI = result();
-
-val le_refl = refl RS le_eqI;
-
-val [prem] = goal Ord.thy "(~ (i=j & Ord(j)) ==> i<j) ==> i le j";
-by (rtac (disjCI RS (le_iff RS iffD2)) 1);
-by (etac prem 1);
-val leCI = result();
-
-val major::prems = goal Ord.thy
-    "[| i le j;  i<j ==> P;  [| i=j;  Ord(j) |] ==> P |] ==> P";
-by (rtac (major RS (le_iff RS iffD1 RS disjE)) 1);
-by (DEPTH_SOLVE (ares_tac prems 1 ORELSE etac conjE 1));
-val leE = result();
-
-goal Ord.thy "!!i j. [| i le j;  j le i |] ==> i=j";
-by (asm_full_simp_tac (ZF_ss addsimps [le_iff]) 1);
-by (fast_tac (ZF_cs addEs [lt_anti_sym]) 1);
-val le_asym = result();
-
-goal Ord.thy "i le 0 <-> i=0";
-by (fast_tac (ZF_cs addSIs [Ord_0 RS le_refl] addSEs [leE, lt0E]) 1);
-val le0_iff = result();
-
-val le0D = standard (le0_iff RS iffD1);
-
-val lt_cs = 
-    ZF_cs addSIs [le_refl, leCI]
-          addSDs [le0D]
-          addSEs [lt_anti_refl, lt0E, leE];
-
-
-(*** Natural Deduction rules for Memrel ***)
-
-goalw Ord.thy [Memrel_def] "<a,b> : Memrel(A) <-> a:b & a:A & b:A";
-by (fast_tac ZF_cs 1);
-val Memrel_iff = result();
-
-val prems = goal Ord.thy "[| a: b;  a: A;  b: A |]  ==>  <a,b> : Memrel(A)";
-by (REPEAT (resolve_tac (prems@[conjI, Memrel_iff RS iffD2]) 1));
-val MemrelI = result();
-
-val [major,minor] = goal Ord.thy
-    "[| <a,b> : Memrel(A);  \
-\       [| a: A;  b: A;  a:b |]  ==> P \
-\    |]  ==> P";
-by (rtac (major RS (Memrel_iff RS iffD1) RS conjE) 1);
-by (etac conjE 1);
-by (rtac minor 1);
-by (REPEAT (assume_tac 1));
-val MemrelE = result();
-
-(*The membership relation (as a set) is well-founded.
-  Proof idea: show A<=B by applying the foundation axiom to A-B *)
-goalw Ord.thy [wf_def] "wf(Memrel(A))";
-by (EVERY1 [rtac (foundation RS disjE RS allI),
-	    etac disjI1,
-	    etac bexE, 
-	    rtac (impI RS allI RS bexI RS disjI2),
-	    etac MemrelE,
-	    etac bspec,
-	    REPEAT o assume_tac]);
-val wf_Memrel = result();
-
-(*** Transfinite induction ***)
-
-(*Epsilon induction over a transitive set*)
-val major::prems = goalw Ord.thy [Transset_def]
-    "[| i: k;  Transset(k);                          \
-\       !!x.[| x: k;  ALL y:x. P(y) |] ==> P(x) \
-\    |]  ==>  P(i)";
-by (rtac (major RS (wf_Memrel RS wf_induct2)) 1);
-by (fast_tac (ZF_cs addEs [MemrelE]) 1);
-by (resolve_tac prems 1);
-by (assume_tac 1);
-by (cut_facts_tac prems 1);
-by (fast_tac (ZF_cs addIs [MemrelI]) 1);
-val Transset_induct = result();
-
-(*Induction over an ordinal*)
-val Ord_induct = Ord_is_Transset RSN (2, Transset_induct);
-
-(*Induction over the class of ordinals -- a useful corollary of Ord_induct*)
-val [major,indhyp] = goal Ord.thy
-    "[| Ord(i); \
-\       !!x.[| Ord(x);  ALL y:x. P(y) |] ==> P(x) \
-\    |]  ==>  P(i)";
-by (rtac (major RS Ord_succ RS (succI1 RS Ord_induct)) 1);
-by (rtac indhyp 1);
-by (rtac (major RS Ord_succ RS Ord_in_Ord) 1);
-by (REPEAT (assume_tac 1));
-val trans_induct = result();
-
-(*Perform induction on i, then prove the Ord(i) subgoal using prems. *)
-fun trans_ind_tac a prems i = 
-    EVERY [res_inst_tac [("i",a)] trans_induct i,
-	   rename_last_tac a ["1"] (i+1),
-	   ares_tac prems i];
-
-
-(*** Fundamental properties of the epsilon ordering (< on ordinals) ***)
-
-(*Finds contradictions for the following proof*)
-val Ord_trans_tac = EVERY' [etac notE, etac Ord_trans, REPEAT o atac];
-
-(** Proving that < is a linear ordering on the ordinals **)
-
-val prems = goal Ord.thy
-    "Ord(i) ==> (ALL j. Ord(j) --> i:j | i=j | j:i)";
-by (trans_ind_tac "i" prems 1);
-by (rtac (impI RS allI) 1);
-by (trans_ind_tac "j" [] 1);
-by (DEPTH_SOLVE (swap_res_tac [disjCI,equalityI,subsetI] 1
-     ORELSE ball_tac 1
-     ORELSE eresolve_tac [impE,disjE,allE] 1 
-     ORELSE hyp_subst_tac 1
-     ORELSE Ord_trans_tac 1));
-val Ord_linear_lemma = result();
-
-(*The trichotomy law for ordinals!*)
-val ordi::ordj::prems = goalw Ord.thy [lt_def]
-    "[| Ord(i);  Ord(j);  i<j ==> P;  i=j ==> P;  j<i ==> P |] ==> P";
-by (rtac ([ordi,ordj] MRS (Ord_linear_lemma RS spec RS impE)) 1);
-by (REPEAT (FIRSTGOAL (etac disjE)));
-by (DEPTH_SOLVE (ares_tac ([ordi,ordj,conjI] @ prems) 1));
-val Ord_linear_lt = result();
-
-val prems = goal Ord.thy
-    "[| Ord(i);  Ord(j);  i le j ==> P;  j le i ==> P |]  ==> P";
-by (res_inst_tac [("i","i"),("j","j")] Ord_linear_lt 1);
-by (DEPTH_SOLVE (ares_tac ([leI,le_eqI] @ prems) 1));
-val Ord_linear_le = result();
-
-goal Ord.thy "!!i j. j le i ==> ~ i<j";
-by (fast_tac (lt_cs addEs [lt_anti_sym]) 1);
-val le_imp_not_lt = result();
-
-goal Ord.thy "!!i j. [| ~ i<j;  Ord(i);  Ord(j) |] ==> j le i";
-by (res_inst_tac [("i","i"),("j","j")] Ord_linear_le 1);
-by (REPEAT (SOMEGOAL assume_tac));
-by (fast_tac (lt_cs addEs [lt_anti_sym]) 1);
-val not_lt_imp_le = result();
-
-goal Ord.thy "!!i j. [| Ord(i);  Ord(j) |] ==> ~ i<j <-> j le i";
-by (REPEAT (ares_tac [iffI, le_imp_not_lt, not_lt_imp_le] 1));
-val not_lt_iff_le = result();
-
-goal Ord.thy "!!i j. [| Ord(i);  Ord(j) |] ==> ~ i le j <-> j<i";
-by (asm_simp_tac (ZF_ss addsimps [not_lt_iff_le RS iff_sym]) 1);
-val not_le_iff_lt = result();
-
-goal Ord.thy "!!i. Ord(i) ==> 0 le i";
-by (etac (not_lt_iff_le RS iffD1) 1);
-by (REPEAT (resolve_tac [Ord_0, not_lt0] 1));
-val Ord_0_le = result();
-
-goal Ord.thy "!!i. [| Ord(i);  i~=0 |] ==> 0<i";
-by (etac (not_le_iff_lt RS iffD1) 1);
-by (rtac Ord_0 1);
-by (fast_tac lt_cs 1);
-val Ord_0_lt = result();
-
-(*** Results about less-than or equals ***)
-
-(** For ordinals, j<=i (subset) implies j le i (less-than or equals) **)
-
-goal Ord.thy "!!i j. [| j<=i;  Ord(i);  Ord(j) |] ==> j le i";
-by (rtac (not_lt_iff_le RS iffD1) 1);
-by (assume_tac 1);
-by (assume_tac 1);
-by (fast_tac (ZF_cs addEs [ltE, mem_anti_refl]) 1);
-val subset_imp_le = result();
-
-goal Ord.thy "!!i j. i le j ==> i<=j";
-by (etac leE 1);
-by (fast_tac ZF_cs 2);
-by (fast_tac (subset_cs addIs [OrdmemD] addEs [ltE]) 1);
-val le_imp_subset = result();
-
-goal Ord.thy "j le i <-> j<=i & Ord(i) & Ord(j)";
-by (fast_tac (ZF_cs addSEs [subset_imp_le, le_imp_subset]
-	            addEs [ltE, make_elim Ord_succD]) 1);
-val le_subset_iff = result();
-
-goal Ord.thy "i le succ(j) <-> i le j | i=succ(j) & Ord(i)";
-by (simp_tac (ZF_ss addsimps [le_iff]) 1);
-by (fast_tac (ZF_cs addIs [Ord_succ] addDs [Ord_succD]) 1);
-val le_succ_iff = result();
-
-goal Ord.thy "!!i j. [| i le j;  j<k |] ==> i<k";
-by (fast_tac (ZF_cs addEs [leE, lt_trans]) 1);
-val lt_trans1 = result();
-
-goal Ord.thy "!!i j. [| i<j;  j le k |] ==> i<k";
-by (fast_tac (ZF_cs addEs [leE, lt_trans]) 1);
-val lt_trans2 = result();
-
-goal Ord.thy "!!i j. [| i le j;  j le k |] ==> i le k";
-by (REPEAT (ares_tac [lt_trans1] 1));
-val le_trans = result();
-
-goal Ord.thy "!!i j. i<j ==> succ(i) le j";
-by (rtac (not_lt_iff_le RS iffD1) 1);
-by (fast_tac (lt_cs addEs [lt_anti_sym]) 3);
-by (ALLGOALS (fast_tac (ZF_cs addEs [ltE] addIs [Ord_succ])));
-val succ_leI = result();
-
-goal Ord.thy "!!i j. succ(i) le j ==> i<j";
-by (rtac (not_le_iff_lt RS iffD1) 1);
-by (fast_tac (lt_cs addEs [lt_anti_sym]) 3);
-by (ALLGOALS (fast_tac (ZF_cs addEs [ltE, make_elim Ord_succD])));
-val succ_leE = result();
-
-goal Ord.thy "succ(i) le j <-> i<j";
-by (REPEAT (ares_tac [iffI,succ_leI,succ_leE] 1));
-val succ_le_iff = result();
-
-(** Union and Intersection **)
-
-goal Ord.thy "!!i j. [| Ord(i); Ord(j) |] ==> i le i Un j";
-by (rtac (Un_upper1 RS subset_imp_le) 1);
-by (REPEAT (ares_tac [Ord_Un] 1));
-val Un_upper1_le = result();
-
-goal Ord.thy "!!i j. [| Ord(i); Ord(j) |] ==> j le i Un j";
-by (rtac (Un_upper2 RS subset_imp_le) 1);
-by (REPEAT (ares_tac [Ord_Un] 1));
-val Un_upper2_le = result();
-
-(*Replacing k by succ(k') yields the similar rule for le!*)
-goal Ord.thy "!!i j k. [| i<k;  j<k |] ==> i Un j < k";
-by (res_inst_tac [("i","i"),("j","j")] Ord_linear_le 1);
-by (rtac (Un_commute RS ssubst) 4);
-by (asm_full_simp_tac (ZF_ss addsimps [le_subset_iff, subset_Un_iff]) 4);
-by (asm_full_simp_tac (ZF_ss addsimps [le_subset_iff, subset_Un_iff]) 3);
-by (REPEAT (eresolve_tac [asm_rl, ltE] 1));
-val Un_least_lt = result();
-
-(*Replacing k by succ(k') yields the similar rule for le!*)
-goal Ord.thy "!!i j k. [| i<k;  j<k |] ==> i Int j < k";
-by (res_inst_tac [("i","i"),("j","j")] Ord_linear_le 1);
-by (rtac (Int_commute RS ssubst) 4);
-by (asm_full_simp_tac (ZF_ss addsimps [le_subset_iff, subset_Int_iff]) 4);
-by (asm_full_simp_tac (ZF_ss addsimps [le_subset_iff, subset_Int_iff]) 3);
-by (REPEAT (eresolve_tac [asm_rl, ltE] 1));
-val Int_greatest_lt = result();
-
-(*** Results about limits ***)
-
-val prems = goal Ord.thy "[| !!i. i:A ==> Ord(i) |] ==> Ord(Union(A))";
-by (rtac (Ord_is_Transset RS Transset_Union_family RS OrdI) 1);
-by (REPEAT (etac UnionE 1 ORELSE ares_tac ([Ord_contains_Transset]@prems) 1));
-val Ord_Union = result();
-
-val prems = goal Ord.thy "[| !!x. x:A ==> Ord(B(x)) |] ==> Ord(UN x:A. B(x))";
-by (rtac Ord_Union 1);
-by (etac RepFunE 1);
-by (etac ssubst 1);
-by (eresolve_tac prems 1);
-val Ord_UN = result();
-
-(* No < version; consider (UN i:nat.i)=nat *)
-val [ordi,limit] = goal Ord.thy
-    "[| Ord(i);  !!x. x:A ==> b(x) le i |] ==> (UN x:A. b(x)) le i";
-by (rtac (le_imp_subset RS UN_least RS subset_imp_le) 1);
-by (REPEAT (ares_tac [ordi, Ord_UN, limit] 1 ORELSE etac (limit RS ltE) 1));
-val UN_least_le = result();
-
-val [jlti,limit] = goal Ord.thy
-    "[| j<i;  !!x. x:A ==> b(x)<j |] ==> (UN x:A. succ(b(x))) < i";
-by (rtac (jlti RS ltE) 1);
-by (rtac (UN_least_le RS lt_trans2) 1);
-by (REPEAT (ares_tac [jlti, succ_leI, limit] 1));
-val UN_succ_least_lt = result();
-
-val prems = goal Ord.thy
-    "[| a: A;  i le b(a);  !!x. x:A ==> Ord(b(x)) |] ==> i le (UN x:A. b(x))";
-by (resolve_tac (prems RL [ltE]) 1);
-by (rtac (le_imp_subset RS subset_trans RS subset_imp_le) 1);
-by (REPEAT (ares_tac (prems @ [UN_upper, Ord_UN]) 1));
-val UN_upper_le = result();
-
-goal Ord.thy "!!i. Ord(i) ==> (UN y:i. succ(y)) = i";
-by (fast_tac (eq_cs addEs [Ord_trans]) 1);
-val Ord_equality = result();
-
-(*Holds for all transitive sets, not just ordinals*)
-goal Ord.thy "!!i. Ord(i) ==> Union(i) <= i";
-by (fast_tac (ZF_cs addSEs [Ord_trans]) 1);
-val Ord_Union_subset = result();
--- a/src/ZF/Ord.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-(*  Title: 	ZF/ordinal.thy
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-Ordinals in Zermelo-Fraenkel Set Theory 
-*)
-
-Ord = WF + "simpdata" + "equalities" +
-consts
-  Memrel      	:: "i=>i"
-  Transset,Ord  :: "i=>o"
-  "<"           :: "[i,i] => o"  (infixl 50) (*less than on ordinals*)
-  "le"          :: "[i,i] => o"  (infixl 50) (*less than or equals*)
-
-translations
-  "x le y"      == "x < succ(y)"
-
-rules
-  Memrel_def  	"Memrel(A)   == {z: A*A . EX x y. z=<x,y> & x:y }"
-  Transset_def	"Transset(i) == ALL x:i. x<=i"
-  Ord_def     	"Ord(i)      == Transset(i) & (ALL x:i. Transset(x))"
-  lt_def        "i<j         == i:j & Ord(j)"
-
-end
--- a/src/ZF/Pair.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-(*  Title: 	ZF/pair
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1992  University of Cambridge
-
-Ordered pairs in Zermelo-Fraenkel Set Theory 
-*)
-
-(** Lemmas for showing that <a,b> uniquely determines a and b **)
-
-val doubleton_iff = prove_goal ZF.thy
-    "{a,b} = {c,d} <-> (a=c & b=d) | (a=d & b=c)"
- (fn _=> [ (resolve_tac [extension RS iff_trans] 1),
-           (fast_tac upair_cs 1) ]);
-
-val Pair_iff = prove_goalw ZF.thy [Pair_def]
-    "<a,b> = <c,d> <-> a=c & b=d"
- (fn _=> [ (simp_tac (FOL_ss addsimps [doubleton_iff]) 1),
-           (fast_tac FOL_cs 1) ]);
-
-val Pair_inject = standard (Pair_iff RS iffD1 RS conjE);
-
-val Pair_inject1 = prove_goal ZF.thy "<a,b> = <c,d> ==> a=c"
- (fn [major]=>
-  [ (rtac (major RS Pair_inject) 1), (assume_tac 1) ]);
-
-val Pair_inject2 = prove_goal ZF.thy "<a,b> = <c,d> ==> b=d"
- (fn [major]=>
-  [ (rtac (major RS Pair_inject) 1), (assume_tac 1) ]);
-
-val Pair_neq_0 = prove_goalw ZF.thy [Pair_def] "<a,b>=0 ==> P"
- (fn [major]=>
-  [ (rtac (major RS equalityD1 RS subsetD RS emptyE) 1),
-    (rtac consI1 1) ]);
-
-val Pair_neq_fst = prove_goalw ZF.thy [Pair_def] "<a,b>=a ==> P"
- (fn [major]=>
-  [ (rtac (consI1 RS mem_anti_sym RS FalseE) 1),
-    (rtac (major RS subst) 1),
-    (rtac consI1 1) ]);
-
-val Pair_neq_snd = prove_goalw ZF.thy [Pair_def] "<a,b>=b ==> P"
- (fn [major]=>
-  [ (rtac (consI1 RS consI2 RS mem_anti_sym RS FalseE) 1),
-    (rtac (major RS subst) 1),
-    (rtac (consI1 RS consI2) 1) ]);
-
-
-(*** Sigma: Disjoint union of a family of sets
-     Generalizes Cartesian product ***)
-
-val SigmaI = prove_goalw ZF.thy [Sigma_def]
-    "[| a:A;  b:B(a) |] ==> <a,b> : Sigma(A,B)"
- (fn prems=> [ (REPEAT (resolve_tac (prems@[singletonI,UN_I]) 1)) ]);
-
-(*The general elimination rule*)
-val SigmaE = prove_goalw ZF.thy [Sigma_def]
-    "[| c: Sigma(A,B);  \
-\       !!x y.[| x:A;  y:B(x);  c=<x,y> |] ==> P \
-\    |] ==> P"
- (fn major::prems=>
-  [ (cut_facts_tac [major] 1),
-    (REPEAT (eresolve_tac [UN_E, singletonE] 1 ORELSE ares_tac prems 1)) ]);
-
-(** Elimination of <a,b>:A*B -- introduces no eigenvariables **)
-val SigmaD1 = prove_goal ZF.thy "<a,b> : Sigma(A,B) ==> a : A"
- (fn [major]=>
-  [ (rtac (major RS SigmaE) 1),
-    (REPEAT (eresolve_tac [asm_rl,Pair_inject,ssubst] 1)) ]);
-
-val SigmaD2 = prove_goal ZF.thy "<a,b> : Sigma(A,B) ==> b : B(a)"
- (fn [major]=>
-  [ (rtac (major RS SigmaE) 1),
-    (REPEAT (eresolve_tac [asm_rl,Pair_inject,ssubst] 1)) ]);
-
-(*Also provable via 
-  rule_by_tactic (REPEAT_FIRST (etac Pair_inject ORELSE' bound_hyp_subst_tac)
-		  THEN prune_params_tac)
-      (read_instantiate [("c","<a,b>")] SigmaE);  *)
-val SigmaE2 = prove_goal ZF.thy
-    "[| <a,b> : Sigma(A,B);    \
-\       [| a:A;  b:B(a) |] ==> P   \
-\    |] ==> P"
- (fn [major,minor]=>
-  [ (rtac minor 1),
-    (rtac (major RS SigmaD1) 1),
-    (rtac (major RS SigmaD2) 1) ]);
-
-val Sigma_cong = prove_goalw ZF.thy [Sigma_def]
-    "[| A=A';  !!x. x:A' ==> B(x)=B'(x) |] ==> \
-\    Sigma(A,B) = Sigma(A',B')"
- (fn prems=> [ (simp_tac (FOL_ss addsimps prems addcongs [RepFun_cong]) 1) ]);
-
-val Sigma_empty1 = prove_goal ZF.thy "Sigma(0,B) = 0"
- (fn _ => [ (fast_tac (lemmas_cs addIs [equalityI] addSEs [SigmaE]) 1) ]);
-
-val Sigma_empty2 = prove_goal ZF.thy "A*0 = 0"
- (fn _ => [ (fast_tac (lemmas_cs addIs [equalityI] addSEs [SigmaE]) 1) ]);
-
-
-(*** Eliminator - split ***)
-
-val split = prove_goalw ZF.thy [split_def]
-    "split(%x y.c(x,y), <a,b>) = c(a,b)"
- (fn _ =>
-  [ (fast_tac (upair_cs addIs [the_equality] addEs [Pair_inject]) 1) ]);
-
-val split_type = prove_goal ZF.thy
-    "[|  p:Sigma(A,B);   \
-\        !!x y.[| x:A; y:B(x) |] ==> c(x,y):C(<x,y>) \
-\    |] ==> split(%x y.c(x,y), p) : C(p)"
- (fn major::prems=>
-  [ (rtac (major RS SigmaE) 1),
-    (etac ssubst 1),
-    (REPEAT (ares_tac (prems @ [split RS ssubst]) 1)) ]);
-
-(*** conversions for fst and snd ***)
-
-val fst_conv = prove_goalw ZF.thy [fst_def] "fst(<a,b>) = a"
- (fn _=> [ (rtac split 1) ]);
-
-val snd_conv = prove_goalw ZF.thy [snd_def] "snd(<a,b>) = b"
- (fn _=> [ (rtac split 1) ]);
-
-
-(*** split for predicates: result type o ***)
-
-goalw ZF.thy [fsplit_def] "!!R a b. R(a,b) ==> fsplit(R, <a,b>)";
-by (REPEAT (ares_tac [refl,exI,conjI] 1));
-val fsplitI = result();
-
-val major::prems = goalw ZF.thy [fsplit_def]
-    "[| fsplit(R,z);  !!x y. [| z = <x,y>;  R(x,y) |] ==> P |] ==> P";
-by (cut_facts_tac [major] 1);
-by (REPEAT (eresolve_tac (prems@[asm_rl,exE,conjE]) 1));
-val fsplitE = result();
-
-goal ZF.thy "!!R a b. fsplit(R,<a,b>) ==> R(a,b)";
-by (REPEAT (eresolve_tac [asm_rl,fsplitE,Pair_inject,ssubst] 1));
-val fsplitD = result();
-
-val pair_cs = upair_cs 
-    addSIs [SigmaI]
-    addSEs [SigmaE2, SigmaE, Pair_inject, make_elim succ_inject,
-	    Pair_neq_0, sym RS Pair_neq_0, succ_neq_0, sym RS succ_neq_0];
-
--- a/src/ZF/Pair.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-(*Dummy theory to document dependencies *)
-
-pair = "upair"
--- a/src/ZF/Zorn0.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-(*  Title: 	ZF/Zorn0.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1994  University of Cambridge
-
-Preamble to proofs from the paper
-    Abrial & Laffitte, 
-    Towards the Mechanization of the Proofs of Some 
-    Classical Theorems of Set Theory. 
-*)
-
-
-(*** Section 1.  Mathematical Preamble ***)
-
-goal ZF.thy "!!A B C. (ALL x:C. x<=A | B<=x) ==> Union(C)<=A | B<=Union(C)";
-by (fast_tac ZF_cs 1);
-val Union_lemma0 = result();
-
-goal ZF.thy
-    "!!A B C. [| c:C; ALL x:C. A<=x | x<=B |] ==> A<=Inter(C) | Inter(C)<=B";
-by (fast_tac ZF_cs 1);
-val Inter_lemma0 = result();
-
-open Zorn0;
-
-(*** Section 2.  The Transfinite Construction ***)
-
-goalw Zorn0.thy [increasing_def]
-    "!!f A. f: increasing(A) ==> f: Pow(A)->Pow(A)";
-by (eresolve_tac [CollectD1] 1);
-val increasingD1 = result();
-
-goalw Zorn0.thy [increasing_def]
-    "!!f A. [| f: increasing(A); x<=A |] ==> x <= f`x";
-by (eresolve_tac [CollectD2 RS spec RS mp] 1);
-by (assume_tac 1);
-val increasingD2 = result();
-
-goal Zorn0.thy
-    "!!next S. [| X : Pow(S);  next: increasing(S) |] ==> next`X : Pow(S)";
-by (eresolve_tac [increasingD1 RS apply_type] 1);
-by (assume_tac 1);
-val next_bounded = result();
-
-(*Trivial to prove here; hard to prove within Inductive_Fun*)
-goal ZF.thy "!!Y. Y : Pow(Pow(A)) ==> Union(Y) : Pow(A)";
-by (fast_tac ZF_cs 1);
-val Union_in_Pow = result();
-
-(** We could make the inductive definition conditional on next: increasing(S)
-    but instead we make this a side-condition of an introduction rule.  Thus
-    the induction rule lets us assume that condition!  Many inductive proofs
-    are therefore unconditional.
-**)
-    
-
--- a/src/ZF/Zorn0.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-(*  Title: 	ZF/Zorn0.thy
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1994  University of Cambridge
-
-Based upon the article
-    Abrial & Laffitte, 
-    Towards the Mechanization of the Proofs of Some 
-    Classical Theorems of Set Theory. 
-*)
-
-Zorn0 = OrderArith + AC + "inductive" +
-
-consts
-  Subset_rel      :: "i=>i"
-  increasing      :: "i=>i"
-  chain, maxchain :: "i=>i"
-  super           :: "[i,i]=>i"
-
-rules
-  Subset_rel_def "Subset_rel(A) == {z: A*A . EX x y. z=<x,y> & x<=y & x~=y}"
-  increasing_def "increasing(A) == {f: Pow(A)->Pow(A). ALL x. x<=A --> x<=f`x}"
-
-  chain_def      "chain(A)      == {F: Pow(A). ALL X:F. ALL Y:F. X<=Y | Y<=X}"
-  super_def      "super(A,c)    == {d: chain(A). c<=d & c~=d}"
-  maxchain_def   "maxchain(A)   == {c: chain(A). super(A,c)=0}"
-
-end
--- a/src/ZF/arith.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,378 +0,0 @@
-(*  Title: 	ZF/arith.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1992  University of Cambridge
-
-For arith.thy.  Arithmetic operators and their definitions
-
-Proofs about elementary arithmetic: addition, multiplication, etc.
-
-Could prove def_rec_0, def_rec_succ...
-*)
-
-open Arith;
-
-(*"Difference" is subtraction of natural numbers.
-  There are no negative numbers; we have
-     m #- n = 0  iff  m<=n   and     m #- n = succ(k) iff m>n.
-  Also, rec(m, 0, %z w.z) is pred(m).   
-*)
-
-(** rec -- better than nat_rec; the succ case has no type requirement! **)
-
-val rec_trans = rec_def RS def_transrec RS trans;
-
-goal Arith.thy "rec(0,a,b) = a";
-by (rtac rec_trans 1);
-by (rtac nat_case_0 1);
-val rec_0 = result();
-
-goal Arith.thy "rec(succ(m),a,b) = b(m, rec(m,a,b))";
-by (rtac rec_trans 1);
-by (simp_tac (ZF_ss addsimps [nat_case_succ, nat_succI]) 1);
-val rec_succ = result();
-
-val major::prems = goal Arith.thy
-    "[| n: nat;  \
-\       a: C(0);  \
-\       !!m z. [| m: nat;  z: C(m) |] ==> b(m,z): C(succ(m))  \
-\    |] ==> rec(n,a,b) : C(n)";
-by (rtac (major RS nat_induct) 1);
-by (ALLGOALS
-    (asm_simp_tac (ZF_ss addsimps (prems@[rec_0,rec_succ]))));
-val rec_type = result();
-
-val nat_le_refl = naturals_are_ordinals RS le_refl;
-
-val nat_typechecks = [rec_type, nat_0I, nat_1I, nat_succI, Ord_nat];
-
-val nat_simps = [rec_0, rec_succ, not_lt0, nat_0_le, le0_iff, succ_le_iff,
-		 nat_le_refl];
-
-val nat_ss = ZF_ss addsimps (nat_simps @ nat_typechecks);
-
-
-(** Addition **)
-
-val add_type = prove_goalw Arith.thy [add_def]
-    "[| m:nat;  n:nat |] ==> m #+ n : nat"
- (fn prems=> [ (typechk_tac (prems@nat_typechecks@ZF_typechecks)) ]);
-
-val add_0 = prove_goalw Arith.thy [add_def]
-    "0 #+ n = n"
- (fn _ => [ (rtac rec_0 1) ]);
-
-val add_succ = prove_goalw Arith.thy [add_def]
-    "succ(m) #+ n = succ(m #+ n)"
- (fn _=> [ (rtac rec_succ 1) ]); 
-
-(** Multiplication **)
-
-val mult_type = prove_goalw Arith.thy [mult_def]
-    "[| m:nat;  n:nat |] ==> m #* n : nat"
- (fn prems=>
-  [ (typechk_tac (prems@[add_type]@nat_typechecks@ZF_typechecks)) ]);
-
-val mult_0 = prove_goalw Arith.thy [mult_def]
-    "0 #* n = 0"
- (fn _ => [ (rtac rec_0 1) ]);
-
-val mult_succ = prove_goalw Arith.thy [mult_def]
-    "succ(m) #* n = n #+ (m #* n)"
- (fn _ => [ (rtac rec_succ 1) ]); 
-
-(** Difference **)
-
-val diff_type = prove_goalw Arith.thy [diff_def]
-    "[| m:nat;  n:nat |] ==> m #- n : nat"
- (fn prems=> [ (typechk_tac (prems@nat_typechecks@ZF_typechecks)) ]);
-
-val diff_0 = prove_goalw Arith.thy [diff_def]
-    "m #- 0 = m"
- (fn _ => [ (rtac rec_0 1) ]);
-
-val diff_0_eq_0 = prove_goalw Arith.thy [diff_def]
-    "n:nat ==> 0 #- n = 0"
- (fn [prem]=>
-  [ (rtac (prem RS nat_induct) 1),
-    (ALLGOALS (asm_simp_tac nat_ss)) ]);
-
-(*Must simplify BEFORE the induction!!  (Else we get a critical pair)
-  succ(m) #- succ(n)   rewrites to   pred(succ(m) #- n)  *)
-val diff_succ_succ = prove_goalw Arith.thy [diff_def]
-    "[| m:nat;  n:nat |] ==> succ(m) #- succ(n) = m #- n"
- (fn prems=>
-  [ (asm_simp_tac (nat_ss addsimps prems) 1),
-    (nat_ind_tac "n" prems 1),
-    (ALLGOALS (asm_simp_tac (nat_ss addsimps prems))) ]);
-
-val prems = goal Arith.thy 
-    "[| m:nat;  n:nat |] ==> m #- n le m";
-by (rtac (prems MRS diff_induct) 1);
-by (etac leE 3);
-by (ALLGOALS
-    (asm_simp_tac
-     (nat_ss addsimps (prems @ [le_iff, diff_0, diff_0_eq_0, 
-				diff_succ_succ, naturals_are_ordinals]))));
-val diff_le_self = result();
-
-(*** Simplification over add, mult, diff ***)
-
-val arith_typechecks = [add_type, mult_type, diff_type];
-val arith_simps = [add_0, add_succ,
-		   mult_0, mult_succ,
-		   diff_0, diff_0_eq_0, diff_succ_succ];
-
-val arith_ss = nat_ss addsimps (arith_simps@arith_typechecks);
-
-(*** Addition ***)
-
-(*Associative law for addition*)
-val add_assoc = prove_goal Arith.thy 
-    "m:nat ==> (m #+ n) #+ k = m #+ (n #+ k)"
- (fn prems=>
-  [ (nat_ind_tac "m" prems 1),
-    (ALLGOALS (asm_simp_tac (arith_ss addsimps prems))) ]);
-
-(*The following two lemmas are used for add_commute and sometimes
-  elsewhere, since they are safe for rewriting.*)
-val add_0_right = prove_goal Arith.thy
-    "m:nat ==> m #+ 0 = m"
- (fn prems=>
-  [ (nat_ind_tac "m" prems 1),
-    (ALLGOALS (asm_simp_tac (arith_ss addsimps prems))) ]); 
-
-val add_succ_right = prove_goal Arith.thy
-    "m:nat ==> m #+ succ(n) = succ(m #+ n)"
- (fn prems=>
-  [ (nat_ind_tac "m" prems 1),
-    (ALLGOALS (asm_simp_tac (arith_ss addsimps prems))) ]); 
-
-(*Commutative law for addition*)  
-val add_commute = prove_goal Arith.thy 
-    "[| m:nat;  n:nat |] ==> m #+ n = n #+ m"
- (fn prems=>
-  [ (nat_ind_tac "n" prems 1),
-    (ALLGOALS
-     (asm_simp_tac
-      (arith_ss addsimps (prems@[add_0_right, add_succ_right])))) ]);
-
-(*Cancellation law on the left*)
-val [knat,eqn] = goal Arith.thy 
-    "[| k:nat;  k #+ m = k #+ n |] ==> m=n";
-by (rtac (eqn RS rev_mp) 1);
-by (nat_ind_tac "k" [knat] 1);
-by (ALLGOALS (simp_tac arith_ss));
-by (fast_tac ZF_cs 1);
-val add_left_cancel = result();
-
-(*** Multiplication ***)
-
-(*right annihilation in product*)
-val mult_0_right = prove_goal Arith.thy 
-    "m:nat ==> m #* 0 = 0"
- (fn prems=>
-  [ (nat_ind_tac "m" prems 1),
-    (ALLGOALS (asm_simp_tac (arith_ss addsimps prems)))  ]);
-
-(*right successor law for multiplication*)
-val mult_succ_right = prove_goal Arith.thy 
-    "!!m n. [| m:nat;  n:nat |] ==> m #* succ(n) = m #+ (m #* n)"
- (fn _=>
-  [ (nat_ind_tac "m" [] 1),
-    (ALLGOALS (asm_simp_tac (arith_ss addsimps [add_assoc RS sym]))),
-       (*The final goal requires the commutative law for addition*)
-    (rtac (add_commute RS subst_context) 1),
-    (REPEAT (assume_tac 1))  ]);
-
-(*Commutative law for multiplication*)
-val mult_commute = prove_goal Arith.thy 
-    "[| m:nat;  n:nat |] ==> m #* n = n #* m"
- (fn prems=>
-  [ (nat_ind_tac "m" prems 1),
-    (ALLGOALS (asm_simp_tac
-	     (arith_ss addsimps (prems@[mult_0_right, mult_succ_right])))) ]);
-
-(*addition distributes over multiplication*)
-val add_mult_distrib = prove_goal Arith.thy 
-    "!!m n. [| m:nat;  k:nat |] ==> (m #+ n) #* k = (m #* k) #+ (n #* k)"
- (fn _=>
-  [ (etac nat_induct 1),
-    (ALLGOALS (asm_simp_tac (arith_ss addsimps [add_assoc RS sym]))) ]);
-
-(*Distributive law on the left; requires an extra typing premise*)
-val add_mult_distrib_left = prove_goal Arith.thy 
-    "[| m:nat;  n:nat;  k:nat |] ==> k #* (m #+ n) = (k #* m) #+ (k #* n)"
- (fn prems=>
-      let val mult_commute' = read_instantiate [("m","k")] mult_commute
-          val ss = arith_ss addsimps ([mult_commute',add_mult_distrib]@prems)
-      in [ (simp_tac ss 1) ]
-      end);
-
-(*Associative law for multiplication*)
-val mult_assoc = prove_goal Arith.thy 
-    "!!m n k. [| m:nat;  n:nat;  k:nat |] ==> (m #* n) #* k = m #* (n #* k)"
- (fn _=>
-  [ (etac nat_induct 1),
-    (ALLGOALS (asm_simp_tac (arith_ss addsimps [add_mult_distrib]))) ]);
-
-
-(*** Difference ***)
-
-val diff_self_eq_0 = prove_goal Arith.thy 
-    "m:nat ==> m #- m = 0"
- (fn prems=>
-  [ (nat_ind_tac "m" prems 1),
-    (ALLGOALS (asm_simp_tac (arith_ss addsimps prems))) ]);
-
-(*Addition is the inverse of subtraction*)
-goal Arith.thy "!!m n. [| n le m;  m:nat |] ==> n #+ (m#-n) = m";
-by (forward_tac [lt_nat_in_nat] 1);
-by (etac nat_succI 1);
-by (etac rev_mp 1);
-by (res_inst_tac [("m","m"),("n","n")] diff_induct 1);
-by (ALLGOALS (asm_simp_tac arith_ss));
-val add_diff_inverse = result();
-
-(*Subtraction is the inverse of addition. *)
-val [mnat,nnat] = goal Arith.thy
-    "[| m:nat;  n:nat |] ==> (n#+m) #-n = m";
-by (rtac (nnat RS nat_induct) 1);
-by (ALLGOALS (asm_simp_tac (arith_ss addsimps [mnat])));
-val diff_add_inverse = result();
-
-val [mnat,nnat] = goal Arith.thy
-    "[| m:nat;  n:nat |] ==> n #- (n#+m) = 0";
-by (rtac (nnat RS nat_induct) 1);
-by (ALLGOALS (asm_simp_tac (arith_ss addsimps [mnat])));
-val diff_add_0 = result();
-
-
-(*** Remainder ***)
-
-goal Arith.thy "!!m n. [| 0<n;  n le m;  m:nat |] ==> m #- n < m";
-by (forward_tac [lt_nat_in_nat] 1 THEN etac nat_succI 1);
-by (etac rev_mp 1);
-by (etac rev_mp 1);
-by (res_inst_tac [("m","m"),("n","n")] diff_induct 1);
-by (ALLGOALS (asm_simp_tac (nat_ss addsimps [diff_le_self,diff_succ_succ])));
-val div_termination = result();
-
-val div_rls =	(*for mod and div*)
-    nat_typechecks @
-    [Ord_transrec_type, apply_type, div_termination RS ltD, if_type,
-     naturals_are_ordinals, not_lt_iff_le RS iffD1];
-
-val div_ss = ZF_ss addsimps [naturals_are_ordinals, div_termination RS ltD,
-			     not_lt_iff_le RS iffD2];
-
-(*Type checking depends upon termination!*)
-goalw Arith.thy [mod_def] "!!m n. [| 0<n;  m:nat;  n:nat |] ==> m mod n : nat";
-by (REPEAT (ares_tac div_rls 1 ORELSE etac lt_trans 1));
-val mod_type = result();
-
-goal Arith.thy "!!m n. [| 0<n;  m<n |] ==> m mod n = m";
-by (rtac (mod_def RS def_transrec RS trans) 1);
-by (asm_simp_tac div_ss 1);
-val mod_less = result();
-
-goal Arith.thy "!!m n. [| 0<n;  n le m;  m:nat |] ==> m mod n = (m#-n) mod n";
-by (forward_tac [lt_nat_in_nat] 1 THEN etac nat_succI 1);
-by (rtac (mod_def RS def_transrec RS trans) 1);
-by (asm_simp_tac div_ss 1);
-val mod_geq = result();
-
-(*** Quotient ***)
-
-(*Type checking depends upon termination!*)
-goalw Arith.thy [div_def]
-    "!!m n. [| 0<n;  m:nat;  n:nat |] ==> m div n : nat";
-by (REPEAT (ares_tac div_rls 1 ORELSE etac lt_trans 1));
-val div_type = result();
-
-goal Arith.thy "!!m n. [| 0<n;  m<n |] ==> m div n = 0";
-by (rtac (div_def RS def_transrec RS trans) 1);
-by (asm_simp_tac div_ss 1);
-val div_less = result();
-
-goal Arith.thy
- "!!m n. [| 0<n;  n le m;  m:nat |] ==> m div n = succ((m#-n) div n)";
-by (forward_tac [lt_nat_in_nat] 1 THEN etac nat_succI 1);
-by (rtac (div_def RS def_transrec RS trans) 1);
-by (asm_simp_tac div_ss 1);
-val div_geq = result();
-
-(*Main Result.*)
-goal Arith.thy
-    "!!m n. [| 0<n;  m:nat;  n:nat |] ==> (m div n)#*n #+ m mod n = m";
-by (etac complete_induct 1);
-by (res_inst_tac [("Q","x<n")] (excluded_middle RS disjE) 1);
-(*case x<n*)
-by (asm_simp_tac (arith_ss addsimps [mod_less, div_less]) 2);
-(*case n le x*)
-by (asm_full_simp_tac
-     (arith_ss addsimps [not_lt_iff_le, naturals_are_ordinals,
-			 mod_geq, div_geq, add_assoc,
-			 div_termination RS ltD, add_diff_inverse]) 1);
-val mod_div_equality = result();
-
-
-(**** Additional theorems about "le" ****)
-
-goal Arith.thy "!!m n. [| m:nat;  n:nat |] ==> m le m #+ n";
-by (etac nat_induct 1);
-by (ALLGOALS (asm_simp_tac arith_ss));
-val add_le_self = result();
-
-goal Arith.thy "!!m n. [| m:nat;  n:nat |] ==> m le n #+ m";
-by (rtac (add_commute RS ssubst) 1);
-by (REPEAT (ares_tac [add_le_self] 1));
-val add_le_self2 = result();
-
-(** Monotonicity of addition **)
-
-(*strict, in 1st argument*)
-goal Arith.thy "!!i j k. [| i<j; j:nat; k:nat |] ==> i#+k < j#+k";
-by (forward_tac [lt_nat_in_nat] 1);
-by (assume_tac 1);
-by (etac succ_lt_induct 1);
-by (ALLGOALS (asm_simp_tac (arith_ss addsimps [leI])));
-val add_lt_mono1 = result();
-
-(*strict, in both arguments*)
-goal Arith.thy "!!i j k l. [| i<j; k<l; j:nat; l:nat |] ==> i#+k < j#+l";
-by (rtac (add_lt_mono1 RS lt_trans) 1);
-by (REPEAT (eresolve_tac [asm_rl, lt_nat_in_nat] 1));
-by (EVERY [rtac (add_commute RS ssubst) 1,
-	   rtac (add_commute RS ssubst) 3,
-	   rtac add_lt_mono1 5]);
-by (REPEAT (eresolve_tac [asm_rl, lt_nat_in_nat] 1));
-val add_lt_mono = result();
-
-(*A [clumsy] way of lifting < monotonicity to le monotonicity *)
-val lt_mono::ford::prems = goal Ord.thy
-     "[| !!i j. [| i<j; j:k |] ==> f(i) < f(j);	\
-\        !!i. i:k ==> Ord(f(i));		\
-\        i le j;  j:k				\
-\     |] ==> f(i) le f(j)";
-by (cut_facts_tac prems 1);
-by (fast_tac (lt_cs addSIs [lt_mono,ford] addSEs [leE]) 1);
-val Ord_lt_mono_imp_le_mono = result();
-
-(*le monotonicity, 1st argument*)
-goal Arith.thy
-    "!!i j k. [| i le j; j:nat; k:nat |] ==> i#+k le j#+k";
-by (res_inst_tac [("f", "%j.j#+k")] Ord_lt_mono_imp_le_mono 1);
-by (REPEAT (ares_tac [add_lt_mono1, add_type RS naturals_are_ordinals] 1));
-val add_le_mono1 = result();
-
-(* le monotonicity, BOTH arguments*)
-goal Arith.thy
-    "!!i j k. [| i le j; k le l; j:nat; l:nat |] ==> i#+k le j#+l";
-by (rtac (add_le_mono1 RS le_trans) 1);
-by (REPEAT (eresolve_tac [asm_rl, lt_nat_in_nat, nat_succI] 1));
-by (EVERY [rtac (add_commute RS ssubst) 1,
-	   rtac (add_commute RS ssubst) 3,
-	   rtac add_le_mono1 5]);
-by (REPEAT (eresolve_tac [asm_rl, lt_nat_in_nat, nat_succI] 1));
-val add_le_mono = result();
--- a/src/ZF/arith.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-(*  Title: 	ZF/arith.thy
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1992  University of Cambridge
-
-Arithmetic operators and their definitions
-*)
-
-Arith = Epsilon + "simpdata" +
-consts
-    rec  :: "[i, i, [i,i]=>i]=>i"
-    "#*" :: "[i,i]=>i"      		(infixl 70)
-    div  :: "[i,i]=>i"      		(infixl 70) 
-    mod  :: "[i,i]=>i"      		(infixl 70)
-    "#+" :: "[i,i]=>i"      		(infixl 65)
-    "#-" :: "[i,i]=>i"      		(infixl 65)
-
-rules
-    rec_def  "rec(k,a,b) ==  transrec(k, %n f. nat_case(a, %m. b(m, f`m), n))"
-
-    add_def  "m#+n == rec(m, n, %u v.succ(v))"
-    diff_def "m#-n == rec(n, m, %u v. rec(v, 0, %x y.x))"
-    mult_def "m#*n == rec(m, 0, %u v. n #+ v)"
-    mod_def  "m mod n == transrec(m, %j f. if(j<n, j, f`(j#-n)))"
-    div_def  "m div n == transrec(m, %j f. if(j<n, 0, succ(f`(j#-n))))"
-end
--- a/src/ZF/bool.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-(*  Title: 	ZF/bool
-    ID:         $Id$
-    Author: 	Martin D Coen, Cambridge University Computer Laboratory
-    Copyright   1992  University of Cambridge
-
-For ZF/bool.thy.  Booleans in Zermelo-Fraenkel Set Theory 
-*)
-
-open Bool;
-
-val bool_defs = [bool_def,cond_def];
-
-(* Introduction rules *)
-
-goalw Bool.thy bool_defs "1 : bool";
-by (rtac (consI1 RS consI2) 1);
-val bool_1I = result();
-
-goalw Bool.thy bool_defs "0 : bool";
-by (rtac consI1 1);
-val bool_0I = result();
-
-goalw Bool.thy bool_defs "1~=0";
-by (rtac succ_not_0 1);
-val one_not_0 = result();
-
-(** 1=0 ==> R **)
-val one_neq_0 = one_not_0 RS notE;
-
-val major::prems = goalw Bool.thy bool_defs
-    "[| c: bool;  c=1 ==> P;  c=0 ==> P |] ==> P";
-by (rtac (major RS consE) 1);
-by (REPEAT (eresolve_tac (singletonE::prems) 1));
-val boolE = result();
-
-(** cond **)
-
-(*1 means true*)
-goalw Bool.thy bool_defs "cond(1,c,d) = c";
-by (rtac (refl RS if_P) 1);
-val cond_1 = result();
-
-(*0 means false*)
-goalw Bool.thy bool_defs "cond(0,c,d) = d";
-by (rtac (succ_not_0 RS not_sym RS if_not_P) 1);
-val cond_0 = result();
-
-val major::prems = goal Bool.thy 
-    "[|  b: bool;  c: A(1);  d: A(0) |] ==> cond(b,c,d): A(b)";
-by (rtac (major RS boolE) 1);
-by (asm_simp_tac (ZF_ss addsimps (cond_1::prems)) 1);
-by (asm_simp_tac (ZF_ss addsimps (cond_0::prems)) 1);
-val cond_type = result();
-
-val [rew] = goal Bool.thy "[| !!b. j(b)==cond(b,c,d) |] ==> j(1) = c";
-by (rewtac rew);
-by (rtac cond_1 1);
-val def_cond_1 = result();
-
-val [rew] = goal Bool.thy "[| !!b. j(b)==cond(b,c,d) |] ==> j(0) = d";
-by (rewtac rew);
-by (rtac cond_0 1);
-val def_cond_0 = result();
-
-fun conds def = [standard (def RS def_cond_1), standard (def RS def_cond_0)];
-
-val [not_1,not_0] = conds not_def;
-
-val [and_1,and_0] = conds and_def;
-
-val [or_1,or_0] = conds or_def;
-
-val [xor_1,xor_0] = conds xor_def;
-
-val not_type = prove_goalw Bool.thy [not_def]
-    "a:bool ==> not(a) : bool"
- (fn prems=> [ (typechk_tac (prems@[bool_1I, bool_0I, cond_type])) ]);
-
-val and_type = prove_goalw Bool.thy [and_def]
-    "[| a:bool;  b:bool |] ==> a and b : bool"
- (fn prems=> [ (typechk_tac (prems@[bool_1I, bool_0I, cond_type])) ]);
-
-val or_type = prove_goalw Bool.thy [or_def]
-    "[| a:bool;  b:bool |] ==> a or b : bool"
- (fn prems=> [ (typechk_tac (prems@[bool_1I, bool_0I, cond_type])) ]);
-
-val xor_type = prove_goalw Bool.thy [xor_def]
-    "[| a:bool;  b:bool |] ==> a xor b : bool"
- (fn prems=> [ (typechk_tac(prems@[bool_1I, bool_0I, cond_type, not_type])) ]);
-
-val bool_typechecks = [bool_1I, bool_0I, cond_type, not_type, and_type, 
-		       or_type, xor_type]
-
-val bool_simps = [cond_1,cond_0,not_1,not_0,and_1,and_0,or_1,or_0,xor_1,xor_0];
-
-val bool_ss0 = ZF_ss addsimps bool_simps;
-
-fun bool0_tac i =
-    EVERY [etac boolE i, asm_simp_tac bool_ss0 (i+1), asm_simp_tac bool_ss0 i];
-
-(*** Laws for 'not' ***)
-
-goal Bool.thy "!!a. a:bool ==> not(not(a)) = a";
-by (bool0_tac 1);
-val not_not = result();
-
-goal Bool.thy "!!a b. a:bool ==> not(a and b) = not(a) or not(b)";
-by (bool0_tac 1);
-val not_and = result();
-
-goal Bool.thy "!!a b. a:bool ==> not(a or b) = not(a) and not(b)";
-by (bool0_tac 1);
-val not_or = result();
-
-(*** Laws about 'and' ***)
-
-goal Bool.thy "!!a. a: bool ==> a and a = a";
-by (bool0_tac 1);
-val and_absorb = result();
-
-goal Bool.thy "!!a b. [| a: bool; b:bool |] ==> a and b = b and a";
-by (etac boolE 1);
-by (bool0_tac 1);
-by (bool0_tac 1);
-val and_commute = result();
-
-goal Bool.thy
- "!!a. a: bool ==> (a and b) and c  =  a and (b and c)";
-by (bool0_tac 1);
-val and_assoc = result();
-
-goal Bool.thy
- "!!a. [| a: bool; b:bool; c:bool |] ==> \
-\      (a or b) and c  =  (a and c) or (b and c)";
-by (REPEAT (bool0_tac 1));
-val and_or_distrib = result();
-
-(** binary orion **)
-
-goal Bool.thy "!!a. a: bool ==> a or a = a";
-by (bool0_tac 1);
-val or_absorb = result();
-
-goal Bool.thy "!!a b. [| a: bool; b:bool |] ==> a or b = b or a";
-by (etac boolE 1);
-by (bool0_tac 1);
-by (bool0_tac 1);
-val or_commute = result();
-
-goal Bool.thy "!!a. a: bool ==> (a or b) or c  =  a or (b or c)";
-by (bool0_tac 1);
-val or_assoc = result();
-
-goal Bool.thy
- "!!a b c. [| a: bool; b: bool; c: bool |] ==> \
-\          (a and b) or c  =  (a or c) and (b or c)";
-by (REPEAT (bool0_tac 1));
-val or_and_distrib = result();
-
--- a/src/ZF/bool.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-(*  Title: 	ZF/bool.thy
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1992  University of Cambridge
-
-Booleans in Zermelo-Fraenkel Set Theory 
-*)
-
-Bool = ZF + "simpdata" +
-consts
-    "1"		::      "i"     	("1")
-    bool        ::      "i"
-    cond        ::      "[i,i,i]=>i"
-    not		::	"i=>i"
-    and         ::      "[i,i]=>i"      (infixl 70)
-    or		::      "[i,i]=>i"      (infixl 65)
-    xor		::      "[i,i]=>i"      (infixl 65)
-
-translations
-   "1"  == "succ(0)"
-
-rules
-    bool_def	"bool == {0,1}"
-    cond_def	"cond(b,c,d) == if(b=1,c,d)"
-    not_def	"not(b) == cond(b,0,1)"
-    and_def	"a and b == cond(a,b,0)"
-    or_def	"a or b == cond(a,1,b)"
-    xor_def	"a xor b == cond(a,not(b),b)"
-end
--- a/src/ZF/co-inductive.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-(*  Title: 	ZF/co-inductive.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-Co-inductive Definitions for Zermelo-Fraenkel Set Theory
-
-Uses greatest fixedpoints with Quine-inspired products and sums
-
-Sums are used only for mutual recursion;
-Products are used only to derive "streamlined" induction rules for relations
-*)
-
-structure Gfp =
-  struct
-  val oper	= Const("gfp",      [iT,iT-->iT]--->iT)
-  val bnd_mono	= Const("bnd_mono", [iT,iT-->iT]--->oT)
-  val bnd_monoI	= bnd_monoI
-  val subs	= def_gfp_subset
-  val Tarski	= def_gfp_Tarski
-  val induct	= def_Collect_coinduct
-  end;
-
-structure Quine_Prod =
-  struct
-  val sigma	= Const("QSigma", [iT, iT-->iT]--->iT)
-  val pair	= Const("QPair", [iT,iT]--->iT)
-  val split_const	= Const("qsplit", [[iT,iT]--->iT, iT]--->iT)
-  val fsplit_const	= Const("qfsplit", [[iT,iT]--->oT, iT]--->oT)
-  val pair_iff	= QPair_iff
-  val split_eq	= qsplit
-  val fsplitI	= qfsplitI
-  val fsplitD	= qfsplitD
-  val fsplitE	= qfsplitE
-  end;
-
-structure Quine_Sum =
-  struct
-  val sum	= Const("op <+>", [iT,iT]--->iT)
-  val inl	= Const("QInl", iT-->iT)
-  val inr	= Const("QInr", iT-->iT)
-  val elim	= Const("qcase", [iT-->iT, iT-->iT, iT]--->iT)
-  val case_inl	= qcase_QInl
-  val case_inr	= qcase_QInr
-  val inl_iff	= QInl_iff
-  val inr_iff	= QInr_iff
-  val distinct	= QInl_QInr_iff
-  val distinct' = QInr_QInl_iff
-  end;
-
-signature CO_INDRULE =
-  sig
-  val co_induct : thm
-  end;
-
-
-functor Co_Inductive_Fun (Ind: INDUCTIVE) 
-          : sig include INTR_ELIM CO_INDRULE end =
-struct
-structure Intr_elim = 
-    Intr_elim_Fun(structure Ind=Ind and Fp=Gfp and 
-		  Pr=Quine_Prod and Su=Quine_Sum);
-
-open Intr_elim 
-val co_induct = raw_induct
-end;
-
--- a/src/ZF/coinductive.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-(*  Title: 	ZF/coinductive.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-Coinductive Definitions for Zermelo-Fraenkel Set Theory
-
-Uses greatest fixedpoints with Quine-inspired products and sums
-
-Sums are used only for mutual recursion;
-Products are used only to derive "streamlined" induction rules for relations
-*)
-
-structure Gfp =
-  struct
-  val oper	= Const("gfp",      [iT,iT-->iT]--->iT)
-  val bnd_mono	= Const("bnd_mono", [iT,iT-->iT]--->oT)
-  val bnd_monoI	= bnd_monoI
-  val subs	= def_gfp_subset
-  val Tarski	= def_gfp_Tarski
-  val induct	= def_Collect_coinduct
-  end;
-
-structure Quine_Prod =
-  struct
-  val sigma	= Const("QSigma", [iT, iT-->iT]--->iT)
-  val pair	= Const("QPair", [iT,iT]--->iT)
-  val split_const	= Const("qsplit", [[iT,iT]--->iT, iT]--->iT)
-  val fsplit_const	= Const("qfsplit", [[iT,iT]--->oT, iT]--->oT)
-  val pair_iff	= QPair_iff
-  val split_eq	= qsplit
-  val fsplitI	= qfsplitI
-  val fsplitD	= qfsplitD
-  val fsplitE	= qfsplitE
-  end;
-
-structure Quine_Sum =
-  struct
-  val sum	= Const("op <+>", [iT,iT]--->iT)
-  val inl	= Const("QInl", iT-->iT)
-  val inr	= Const("QInr", iT-->iT)
-  val elim	= Const("qcase", [iT-->iT, iT-->iT, iT]--->iT)
-  val case_inl	= qcase_QInl
-  val case_inr	= qcase_QInr
-  val inl_iff	= QInl_iff
-  val inr_iff	= QInr_iff
-  val distinct	= QInl_QInr_iff
-  val distinct' = QInr_QInl_iff
-  end;
-
-signature COINDRULE =
-  sig
-  val coinduct : thm
-  end;
-
-
-functor CoInductive_Fun (Ind: INDUCTIVE) 
-          : sig include INTR_ELIM COINDRULE end =
-struct
-structure Intr_elim = 
-    Intr_elim_Fun(structure Ind=Ind and Fp=Gfp and 
-		  Pr=Quine_Prod and Su=Quine_Sum);
-
-open Intr_elim 
-val coinduct = raw_induct
-end;
-
--- a/src/ZF/coinductive.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-(*Dummy theory to document dependencies *)
-
-coinductive = "ind_syntax" + "intr_elim"
\ No newline at end of file
--- a/src/ZF/datatype.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-(*  Title: 	ZF/datatype.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-(Co)Datatype Definitions for Zermelo-Fraenkel Set Theory
-*)
-
-
-(*Datatype definitions use least fixedpoints, standard products and sums*)
-functor Datatype_Fun (Const: CONSTRUCTOR) 
-         : sig include CONSTRUCTOR_RESULT INTR_ELIM INDRULE end =
-struct
-structure Constructor = Constructor_Fun (structure Const=Const and 
-  		                      Pr=Standard_Prod and Su=Standard_Sum);
-open Const Constructor;
-
-structure Inductive = Inductive_Fun
-        (val thy = con_thy;
-	 val rec_doms = (map #1 rec_specs) ~~ (map #2 rec_specs);
-	 val sintrs = sintrs;
-	 val monos = monos;
-	 val con_defs = con_defs;
-	 val type_intrs = type_intrs;
-	 val type_elims = type_elims);
-
-open Inductive
-end;
-
-
-(*Codatatype definitions use greatest fixedpoints, Quine products and sums*)
-functor CoDatatype_Fun (Const: CONSTRUCTOR) 
-         : sig include CONSTRUCTOR_RESULT INTR_ELIM COINDRULE end =
-struct
-structure Constructor = Constructor_Fun (structure Const=Const and 
-  		                      Pr=Quine_Prod and Su=Quine_Sum);
-open Const Constructor;
-
-structure CoInductive = CoInductive_Fun
-        (val thy = con_thy;
-	 val rec_doms = (map #1 rec_specs) ~~ (map #2 rec_specs);
-	 val sintrs = sintrs;
-	 val monos = monos;
-	 val con_defs = con_defs;
-	 val type_intrs = type_intrs;
-	 val type_elims = type_elims);
-
-open CoInductive
-end;
-
-
-
-(*For most datatypes involving univ*)
-val datatype_intrs = 
-    [SigmaI, InlI, InrI,
-     Pair_in_univ, Inl_in_univ, Inr_in_univ, 
-     zero_in_univ, A_into_univ, nat_into_univ, UnCI];
-
-(*Needed for mutual recursion*)
-val datatype_elims = [make_elim InlD, make_elim InrD];
-
-(*For most codatatypes involving quniv*)
-val codatatype_intrs = 
-    [QSigmaI, QInlI, QInrI,
-     QPair_in_quniv, QInl_in_quniv, QInr_in_quniv, 
-     zero_in_quniv, A_into_quniv, nat_into_quniv, UnCI];
-
-val codatatype_elims = [make_elim QInlD, make_elim QInrD];
-
--- a/src/ZF/datatype.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-(*Dummy theory to document dependencies *)
-
-Datatype = "constructor" + "inductive" + "coinductive" + Univ + QUniv
-               (*this must be capital to avoid conflicts with ML's "datatype" *)
\ No newline at end of file
--- a/src/ZF/epsilon.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,299 +0,0 @@
-(*  Title: 	ZF/epsilon.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-For epsilon.thy.  Epsilon induction and recursion
-*)
-
-open Epsilon;
-
-(*** Basic closure properties ***)
-
-goalw Epsilon.thy [eclose_def] "A <= eclose(A)";
-by (rtac (nat_rec_0 RS equalityD2 RS subset_trans) 1);
-by (rtac (nat_0I RS UN_upper) 1);
-val arg_subset_eclose = result();
-
-val arg_into_eclose = arg_subset_eclose RS subsetD;
-
-goalw Epsilon.thy [eclose_def,Transset_def] "Transset(eclose(A))";
-by (rtac (subsetI RS ballI) 1);
-by (etac UN_E 1);
-by (rtac (nat_succI RS UN_I) 1);
-by (assume_tac 1);
-by (etac (nat_rec_succ RS ssubst) 1);
-by (etac UnionI 1);
-by (assume_tac 1);
-val Transset_eclose = result();
-
-(* x : eclose(A) ==> x <= eclose(A) *)
-val eclose_subset = 
-    standard (rewrite_rule [Transset_def] Transset_eclose RS bspec);
-
-(* [| A : eclose(B); c : A |] ==> c : eclose(B) *)
-val ecloseD = standard (eclose_subset RS subsetD);
-
-val arg_in_eclose_sing = arg_subset_eclose RS singleton_subsetD;
-val arg_into_eclose_sing = arg_in_eclose_sing RS ecloseD;
-
-(* This is epsilon-induction for eclose(A); see also eclose_induct_down...
-   [| a: eclose(A);  !!x. [| x: eclose(A); ALL y:x. P(y) |] ==> P(x) 
-   |] ==> P(a) 
-*)
-val eclose_induct = standard (Transset_eclose RSN (2, Transset_induct));
-
-(*Epsilon induction*)
-val prems = goal Epsilon.thy
-    "[| !!x. ALL y:x. P(y) ==> P(x) |]  ==>  P(a)";
-by (rtac (arg_in_eclose_sing RS eclose_induct) 1);
-by (eresolve_tac prems 1);
-val eps_induct = result();
-
-(*Perform epsilon-induction on i. *)
-fun eps_ind_tac a = 
-    EVERY' [res_inst_tac [("a",a)] eps_induct,
-	    rename_last_tac a ["1"]];
-
-
-(*** Leastness of eclose ***)
-
-(** eclose(A) is the least transitive set including A as a subset. **)
-
-goalw Epsilon.thy [Transset_def]
-    "!!X A n. [| Transset(X);  A<=X;  n: nat |] ==> \
-\             nat_rec(n, A, %m r. Union(r)) <= X";
-by (etac nat_induct 1);
-by (asm_simp_tac (ZF_ss addsimps [nat_rec_0]) 1);
-by (asm_simp_tac (ZF_ss addsimps [nat_rec_succ]) 1);
-by (fast_tac ZF_cs 1);
-val eclose_least_lemma = result();
-
-goalw Epsilon.thy [eclose_def]
-     "!!X A. [| Transset(X);  A<=X |] ==> eclose(A) <= X";
-by (rtac (eclose_least_lemma RS UN_least) 1);
-by (REPEAT (assume_tac 1));
-val eclose_least = result();
-
-(*COMPLETELY DIFFERENT induction principle from eclose_induct!!*)
-val [major,base,step] = goal Epsilon.thy
-    "[| a: eclose(b);						\
-\       !!y.   [| y: b |] ==> P(y);				\
-\       !!y z. [| y: eclose(b);  P(y);  z: y |] ==> P(z)	\
-\    |] ==> P(a)";
-by (rtac (major RSN (3, eclose_least RS subsetD RS CollectD2)) 1);
-by (rtac (CollectI RS subsetI) 2);
-by (etac (arg_subset_eclose RS subsetD) 2);
-by (etac base 2);
-by (rewtac Transset_def);
-by (fast_tac (ZF_cs addEs [step,ecloseD]) 1);
-val eclose_induct_down = result();
-
-goal Epsilon.thy "!!X. Transset(X) ==> eclose(X) = X";
-by (etac ([eclose_least, arg_subset_eclose] MRS equalityI) 1);
-by (rtac subset_refl 1);
-val Transset_eclose_eq_arg = result();
-
-
-(*** Epsilon recursion ***)
-
-(*Unused...*)
-goal Epsilon.thy "!!A B C. [| A: eclose(B);  B: eclose(C) |] ==> A: eclose(C)";
-by (rtac ([Transset_eclose, eclose_subset] MRS eclose_least RS subsetD) 1);
-by (REPEAT (assume_tac 1));
-val mem_eclose_trans = result();
-
-(*Variant of the previous lemma in a useable form for the sequel*)
-goal Epsilon.thy
-    "!!A B C. [| A: eclose({B});  B: eclose({C}) |] ==> A: eclose({C})";
-by (rtac ([Transset_eclose, singleton_subsetI] MRS eclose_least RS subsetD) 1);
-by (REPEAT (assume_tac 1));
-val mem_eclose_sing_trans = result();
-
-goalw Epsilon.thy [Transset_def]
-    "!!i j. [| Transset(i);  j:i |] ==> Memrel(i)-``{j} = j";
-by (fast_tac (eq_cs addSIs [MemrelI] addSEs [MemrelE]) 1);
-val under_Memrel = result();
-
-(* j : eclose(A) ==> Memrel(eclose(A)) -`` j = j *)
-val under_Memrel_eclose = Transset_eclose RS under_Memrel;
-
-val wfrec_ssubst = standard (wf_Memrel RS wfrec RS ssubst);
-
-val [kmemj,jmemi] = goal Epsilon.thy
-    "[| k:eclose({j});  j:eclose({i}) |] ==> \
-\    wfrec(Memrel(eclose({i})), k, H) = wfrec(Memrel(eclose({j})), k, H)";
-by (rtac (kmemj RS eclose_induct) 1);
-by (rtac wfrec_ssubst 1);
-by (rtac wfrec_ssubst 1);
-by (asm_simp_tac (ZF_ss addsimps [under_Memrel_eclose,
-				  jmemi RSN (2,mem_eclose_sing_trans)]) 1);
-val wfrec_eclose_eq = result();
-
-val [prem] = goal Epsilon.thy
-    "k: i ==> wfrec(Memrel(eclose({i})),k,H) = wfrec(Memrel(eclose({k})),k,H)";
-by (rtac (arg_in_eclose_sing RS wfrec_eclose_eq) 1);
-by (rtac (prem RS arg_into_eclose_sing) 1);
-val wfrec_eclose_eq2 = result();
-
-goalw Epsilon.thy [transrec_def]
-    "transrec(a,H) = H(a, lam x:a. transrec(x,H))";
-by (rtac wfrec_ssubst 1);
-by (simp_tac (ZF_ss addsimps [wfrec_eclose_eq2, arg_in_eclose_sing,
-			      under_Memrel_eclose]) 1);
-val transrec = result();
-
-(*Avoids explosions in proofs; resolve it with a meta-level definition.*)
-val rew::prems = goal Epsilon.thy
-    "[| !!x. f(x)==transrec(x,H) |] ==> f(a) = H(a, lam x:a. f(x))";
-by (rewtac rew);
-by (REPEAT (resolve_tac (prems@[transrec]) 1));
-val def_transrec = result();
-
-val prems = goal Epsilon.thy
-    "[| !!x u. [| x:eclose({a});  u: Pi(x,B) |] ==> H(x,u) : B(x)   \
-\    |]  ==> transrec(a,H) : B(a)";
-by (res_inst_tac [("i", "a")] (arg_in_eclose_sing RS eclose_induct) 1);
-by (rtac (transrec RS ssubst) 1);
-by (REPEAT (ares_tac (prems @ [lam_type]) 1 ORELSE etac bspec 1));
-val transrec_type = result();
-
-goal Epsilon.thy "!!i. Ord(i) ==> eclose({i}) <= succ(i)";
-by (etac (Ord_is_Transset RS Transset_succ RS eclose_least) 1);
-by (rtac (succI1 RS singleton_subsetI) 1);
-val eclose_sing_Ord = result();
-
-val prems = goal Epsilon.thy
-    "[| j: i;  Ord(i);  \
-\       !!x u. [| x: i;  u: Pi(x,B) |] ==> H(x,u) : B(x)   \
-\    |]  ==> transrec(j,H) : B(j)";
-by (rtac transrec_type 1);
-by (resolve_tac prems 1);
-by (rtac (Ord_in_Ord RS eclose_sing_Ord RS subsetD RS succE) 1);
-by (DEPTH_SOLVE (ares_tac prems 1 ORELSE eresolve_tac [ssubst,Ord_trans] 1));
-val Ord_transrec_type = result();
-
-(*** Rank ***)
-
-(*NOT SUITABLE FOR REWRITING -- RECURSIVE!*)
-goal Epsilon.thy "rank(a) = (UN y:a. succ(rank(y)))";
-by (rtac (rank_def RS def_transrec RS ssubst) 1);
-by (simp_tac ZF_ss 1);
-val rank = result();
-
-goal Epsilon.thy "Ord(rank(a))";
-by (eps_ind_tac "a" 1);
-by (rtac (rank RS ssubst) 1);
-by (rtac (Ord_succ RS Ord_UN) 1);
-by (etac bspec 1);
-by (assume_tac 1);
-val Ord_rank = result();
-
-val [major] = goal Epsilon.thy "Ord(i) ==> rank(i) = i";
-by (rtac (major RS trans_induct) 1);
-by (rtac (rank RS ssubst) 1);
-by (asm_simp_tac (ZF_ss addsimps [Ord_equality]) 1);
-val rank_of_Ord = result();
-
-goal Epsilon.thy "!!a b. a:b ==> rank(a) < rank(b)";
-by (res_inst_tac [("a1","b")] (rank RS ssubst) 1);
-by (etac (UN_I RS ltI) 1);
-by (rtac succI1 1);
-by (REPEAT (ares_tac [Ord_UN, Ord_succ, Ord_rank] 1));
-val rank_lt = result();
-
-val [major] = goal Epsilon.thy "a: eclose(b) ==> rank(a) < rank(b)";
-by (rtac (major RS eclose_induct_down) 1);
-by (etac rank_lt 1);
-by (etac (rank_lt RS lt_trans) 1);
-by (assume_tac 1);
-val eclose_rank_lt = result();
-
-goal Epsilon.thy "!!a b. a<=b ==> rank(a) le rank(b)";
-by (rtac subset_imp_le 1);
-by (rtac (rank RS ssubst) 1);
-by (rtac (rank RS ssubst) 1);
-by (etac UN_mono 1);
-by (REPEAT (resolve_tac [subset_refl, Ord_rank] 1));
-val rank_mono = result();
-
-goal Epsilon.thy "rank(Pow(a)) = succ(rank(a))";
-by (rtac (rank RS trans) 1);
-by (rtac le_asym 1);
-by (DO_GOAL [rtac (Ord_rank RS Ord_succ RS UN_least_le),
-	     etac (PowD RS rank_mono RS succ_leI)] 1);
-by (DO_GOAL [rtac ([Pow_top, le_refl] MRS UN_upper_le),
-	     REPEAT o rtac (Ord_rank RS Ord_succ)] 1);
-val rank_Pow = result();
-
-goal Epsilon.thy "rank(0) = 0";
-by (rtac (rank RS trans) 1);
-by (fast_tac (ZF_cs addSIs [equalityI]) 1);
-val rank_0 = result();
-
-goal Epsilon.thy "rank(succ(x)) = succ(rank(x))";
-by (rtac (rank RS trans) 1);
-by (rtac ([UN_least, succI1 RS UN_upper] MRS equalityI) 1);
-by (etac succE 1);
-by (fast_tac ZF_cs 1);
-by (etac (rank_lt RS leI RS succ_leI RS le_imp_subset) 1);
-val rank_succ = result();
-
-goal Epsilon.thy "rank(Union(A)) = (UN x:A. rank(x))";
-by (rtac equalityI 1);
-by (rtac (rank_mono RS le_imp_subset RS UN_least) 2);
-by (etac Union_upper 2);
-by (rtac (rank RS ssubst) 1);
-by (rtac UN_least 1);
-by (etac UnionE 1);
-by (rtac subset_trans 1);
-by (etac (RepFunI RS Union_upper) 2);
-by (etac (rank_lt RS succ_leI RS le_imp_subset) 1);
-val rank_Union = result();
-
-goal Epsilon.thy "rank(eclose(a)) = rank(a)";
-by (rtac le_asym 1);
-by (rtac (arg_subset_eclose RS rank_mono) 2);
-by (res_inst_tac [("a1","eclose(a)")] (rank RS ssubst) 1);
-by (rtac (Ord_rank RS UN_least_le) 1);
-by (etac (eclose_rank_lt RS succ_leI) 1);
-val rank_eclose = result();
-
-goalw Epsilon.thy [Pair_def] "rank(a) < rank(<a,b>)";
-by (rtac (consI1 RS rank_lt RS lt_trans) 1);
-by (rtac (consI1 RS consI2 RS rank_lt) 1);
-val rank_pair1 = result();
-
-goalw Epsilon.thy [Pair_def] "rank(b) < rank(<a,b>)";
-by (rtac (consI1 RS consI2 RS rank_lt RS lt_trans) 1);
-by (rtac (consI1 RS consI2 RS rank_lt) 1);
-val rank_pair2 = result();
-
-goalw (merge_theories(Epsilon.thy,Sum.thy)) [Inl_def] "rank(a) < rank(Inl(a))";
-by (rtac rank_pair2 1);
-val rank_Inl = result();
-
-goalw (merge_theories(Epsilon.thy,Sum.thy)) [Inr_def] "rank(a) < rank(Inr(a))";
-by (rtac rank_pair2 1);
-val rank_Inr = result();
-
-(*** Corollaries of leastness ***)
-
-goal Epsilon.thy "!!A B. A:B ==> eclose(A)<=eclose(B)";
-by (rtac (Transset_eclose RS eclose_least) 1);
-by (etac (arg_into_eclose RS eclose_subset) 1);
-val mem_eclose_subset = result();
-
-goal Epsilon.thy "!!A B. A<=B ==> eclose(A) <= eclose(B)";
-by (rtac (Transset_eclose RS eclose_least) 1);
-by (etac subset_trans 1);
-by (rtac arg_subset_eclose 1);
-val eclose_mono = result();
-
-(** Idempotence of eclose **)
-
-goal Epsilon.thy "eclose(eclose(A)) = eclose(A)";
-by (rtac equalityI 1);
-by (rtac ([Transset_eclose, subset_refl] MRS eclose_least) 1);
-by (rtac arg_subset_eclose 1);
-val eclose_idem = result();
--- a/src/ZF/epsilon.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-(*  Title: 	ZF/epsilon.thy
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-Epsilon induction and recursion
-*)
-
-Epsilon = Nat + "mono" +
-consts
-    eclose,rank ::      "i=>i"
-    transrec    ::      "[i, [i,i]=>i] =>i"
-
-rules
-  eclose_def	"eclose(A) == UN n:nat. nat_rec(n, A, %m r. Union(r))"
-  transrec_def	"transrec(a,H) == wfrec(Memrel(eclose({a})), a, H)"
-  rank_def    	"rank(a) == transrec(a, %x f. UN y:x. succ(f`y))"
-end
--- a/src/ZF/ex/BT_Fn.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-(*  Title: 	ZF/bt.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1992  University of Cambridge
-
-For bt.thy.  Binary trees
-*)
-
-open BT_Fn;
-
-
-
-(** bt_rec -- by Vset recursion **)
-
-goalw BT.thy BT.con_defs "rank(l) < rank(Br(a,l,r))";
-by (simp_tac rank_ss 1);
-val rank_Br1 = result();
-
-goalw BT.thy BT.con_defs "rank(r) < rank(Br(a,l,r))";
-by (simp_tac rank_ss 1);
-val rank_Br2 = result();
-
-goal BT_Fn.thy "bt_rec(Lf,c,h) = c";
-by (rtac (bt_rec_def RS def_Vrec RS trans) 1);
-by (simp_tac (ZF_ss addsimps BT.case_eqns) 1);
-val bt_rec_Lf = result();
-
-goal BT_Fn.thy
-    "bt_rec(Br(a,l,r), c, h) = h(a, l, r, bt_rec(l,c,h), bt_rec(r,c,h))";
-by (rtac (bt_rec_def RS def_Vrec RS trans) 1);
-by (simp_tac (rank_ss addsimps (BT.case_eqns @ [rank_Br1, rank_Br2])) 1);
-val bt_rec_Br = result();
-
-(*Type checking -- proved by induction, as usual*)
-val prems = goal BT_Fn.thy
-    "[| t: bt(A);    \
-\       c: C(Lf);       \
-\       !!x y z r s. [| x:A;  y:bt(A);  z:bt(A);  r:C(y);  s:C(z) |] ==> \
-\		     h(x,y,z,r,s): C(Br(x,y,z))  \
-\    |] ==> bt_rec(t,c,h) : C(t)";
-by (bt_ind_tac "t" prems 1);
-by (ALLGOALS (asm_simp_tac (ZF_ss addsimps
-			    (prems@[bt_rec_Lf,bt_rec_Br]))));
-val bt_rec_type = result();
-
-(** Versions for use with definitions **)
-
-val [rew] = goal BT_Fn.thy "[| !!t. j(t)==bt_rec(t, c, h) |] ==> j(Lf) = c";
-by (rewtac rew);
-by (rtac bt_rec_Lf 1);
-val def_bt_rec_Lf = result();
-
-val [rew] = goal BT_Fn.thy
-    "[| !!t. j(t)==bt_rec(t, c, h) |] ==> j(Br(a,l,r)) = h(a,l,r,j(l),j(r))";
-by (rewtac rew);
-by (rtac bt_rec_Br 1);
-val def_bt_rec_Br = result();
-
-fun bt_recs def = map standard ([def] RL [def_bt_rec_Lf, def_bt_rec_Br]);
-
-(** n_nodes **)
-
-val [n_nodes_Lf,n_nodes_Br] = bt_recs n_nodes_def;
-
-val prems = goalw BT_Fn.thy [n_nodes_def] 
-    "xs: bt(A) ==> n_nodes(xs) : nat";
-by (REPEAT (ares_tac (prems @ [bt_rec_type, nat_0I, nat_succI, add_type]) 1));
-val n_nodes_type = result();
-
-
-(** n_leaves **)
-
-val [n_leaves_Lf,n_leaves_Br] = bt_recs n_leaves_def;
-
-val prems = goalw BT_Fn.thy [n_leaves_def] 
-    "xs: bt(A) ==> n_leaves(xs) : nat";
-by (REPEAT (ares_tac (prems @ [bt_rec_type, nat_0I, nat_succI, add_type]) 1));
-val n_leaves_type = result();
-
-(** bt_reflect **)
-
-val [bt_reflect_Lf, bt_reflect_Br] = bt_recs bt_reflect_def;
-
-val prems = goalw BT_Fn.thy [bt_reflect_def] 
-    "xs: bt(A) ==> bt_reflect(xs) : bt(A)";
-by (REPEAT (ares_tac (prems @ [bt_rec_type, LfI, BrI]) 1));
-val bt_reflect_type = result();
-
-
-(** BT_Fn simplification **)
-
-
-val bt_typechecks =
-      [LfI, BrI, bt_rec_type, n_nodes_type, n_leaves_type, bt_reflect_type];
-
-val bt_ss = arith_ss 
-    addsimps BT.case_eqns
-    addsimps bt_typechecks
-    addsimps [bt_rec_Lf, bt_rec_Br, 
-	     n_nodes_Lf, n_nodes_Br,
-	     n_leaves_Lf, n_leaves_Br,
-	     bt_reflect_Lf, bt_reflect_Br];
-
-
-(*** theorems about n_leaves ***)
-
-val prems = goal BT_Fn.thy
-    "t: bt(A) ==> n_leaves(bt_reflect(t)) = n_leaves(t)";
-by (bt_ind_tac "t" prems 1);
-by (ALLGOALS (asm_simp_tac bt_ss));
-by (REPEAT (ares_tac [add_commute, n_leaves_type] 1));
-val n_leaves_reflect = result();
-
-val prems = goal BT_Fn.thy
-    "t: bt(A) ==> n_leaves(t) = succ(n_nodes(t))";
-by (bt_ind_tac "t" prems 1);
-by (ALLGOALS (asm_simp_tac (bt_ss addsimps [add_succ_right])));
-val n_leaves_nodes = result();
-
-(*** theorems about bt_reflect ***)
-
-val prems = goal BT_Fn.thy
-    "t: bt(A) ==> bt_reflect(bt_reflect(t))=t";
-by (bt_ind_tac "t" prems 1);
-by (ALLGOALS (asm_simp_tac bt_ss));
-val bt_reflect_bt_reflect_ident = result();
-
-
--- a/src/ZF/ex/BT_Fn.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-(*  Title: 	ZF/ex/bt-fn.thy
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1992  University of Cambridge
-
-Binary trees
-*)
-
-BT_Fn = BT +
-consts
-    bt_rec    	:: "[i, i, [i,i,i,i,i]=>i] => i"
-    n_nodes	:: "i=>i"
-    n_leaves   	:: "i=>i"
-    bt_reflect 	:: "i=>i"
-
-rules
-  bt_rec_def
-    "bt_rec(t,c,h) == Vrec(t, %t g.bt_case(c, %x y z. h(x,y,z,g`y,g`z), t))"
-
-  n_nodes_def	"n_nodes(t) == bt_rec(t,  0,  %x y z r s. succ(r#+s))"
-  n_leaves_def	"n_leaves(t) == bt_rec(t,  succ(0),  %x y z r s. r#+s)"
-  bt_reflect_def "bt_reflect(t) == bt_rec(t,  Lf,  %x y z r s. Br(x,s,r))"
-
-end
--- a/src/ZF/ex/BinFn.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,450 +0,0 @@
-(*  Title: 	ZF/ex/bin.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-For bin.thy.  Arithmetic on binary integers.
-*)
-
-open BinFn;
-
-
-(** bin_rec -- by Vset recursion **)
-
-goal BinFn.thy "bin_rec(Plus,a,b,h) = a";
-by (rtac (bin_rec_def RS def_Vrec RS trans) 1);
-by (rewrite_goals_tac Bin.con_defs);
-by (simp_tac rank_ss 1);
-val bin_rec_Plus = result();
-
-goal BinFn.thy "bin_rec(Minus,a,b,h) = b";
-by (rtac (bin_rec_def RS def_Vrec RS trans) 1);
-by (rewrite_goals_tac Bin.con_defs);
-by (simp_tac rank_ss 1);
-val bin_rec_Minus = result();
-
-goal BinFn.thy "bin_rec(w$$x,a,b,h) = h(w, x, bin_rec(w,a,b,h))";
-by (rtac (bin_rec_def RS def_Vrec RS trans) 1);
-by (rewrite_goals_tac Bin.con_defs);
-by (simp_tac rank_ss 1);
-val bin_rec_Bcons = result();
-
-(*Type checking*)
-val prems = goal BinFn.thy
-    "[| w: bin;    \
-\       a: C(Plus);   b: C(Minus);       \
-\       !!w x r. [| w: bin;  x: bool;  r: C(w) |] ==> h(w,x,r): C(w$$x)  \
-\    |] ==> bin_rec(w,a,b,h) : C(w)";
-by (bin_ind_tac "w" prems 1);
-by (ALLGOALS 
-    (asm_simp_tac (ZF_ss addsimps (prems@[bin_rec_Plus,bin_rec_Minus,
-					 bin_rec_Bcons]))));
-val bin_rec_type = result();
-
-(** Versions for use with definitions **)
-
-val [rew] = goal BinFn.thy
-    "[| !!w. j(w)==bin_rec(w,a,b,h) |] ==> j(Plus) = a";
-by (rewtac rew);
-by (rtac bin_rec_Plus 1);
-val def_bin_rec_Plus = result();
-
-val [rew] = goal BinFn.thy
-    "[| !!w. j(w)==bin_rec(w,a,b,h) |] ==> j(Minus) = b";
-by (rewtac rew);
-by (rtac bin_rec_Minus 1);
-val def_bin_rec_Minus = result();
-
-val [rew] = goal BinFn.thy
-    "[| !!w. j(w)==bin_rec(w,a,b,h) |] ==> j(w$$x) = h(w,x,j(w))";
-by (rewtac rew);
-by (rtac bin_rec_Bcons 1);
-val def_bin_rec_Bcons = result();
-
-fun bin_recs def = map standard
-	([def] RL [def_bin_rec_Plus, def_bin_rec_Minus, def_bin_rec_Bcons]);
-
-(** Type checking **)
-
-val bin_typechecks0 = bin_rec_type :: Bin.intrs;
-
-goalw BinFn.thy [integ_of_bin_def]
-    "!!w. w: bin ==> integ_of_bin(w) : integ";
-by (typechk_tac (bin_typechecks0@integ_typechecks@
-		 nat_typechecks@[bool_into_nat]));
-val integ_of_bin_type = result();
-
-goalw BinFn.thy [bin_succ_def]
-    "!!w. w: bin ==> bin_succ(w) : bin";
-by (typechk_tac (bin_typechecks0@bool_typechecks));
-val bin_succ_type = result();
-
-goalw BinFn.thy [bin_pred_def]
-    "!!w. w: bin ==> bin_pred(w) : bin";
-by (typechk_tac (bin_typechecks0@bool_typechecks));
-val bin_pred_type = result();
-
-goalw BinFn.thy [bin_minus_def]
-    "!!w. w: bin ==> bin_minus(w) : bin";
-by (typechk_tac ([bin_pred_type]@bin_typechecks0@bool_typechecks));
-val bin_minus_type = result();
-
-goalw BinFn.thy [bin_add_def]
-    "!!v w. [| v: bin; w: bin |] ==> bin_add(v,w) : bin";
-by (typechk_tac ([bin_succ_type,bin_pred_type]@bin_typechecks0@
-		 bool_typechecks@ZF_typechecks));
-val bin_add_type = result();
-
-goalw BinFn.thy [bin_mult_def]
-    "!!v w. [| v: bin; w: bin |] ==> bin_mult(v,w) : bin";
-by (typechk_tac ([bin_minus_type,bin_add_type]@bin_typechecks0@
-		 bool_typechecks));
-val bin_mult_type = result();
-
-val bin_typechecks = bin_typechecks0 @
-    [integ_of_bin_type, bin_succ_type, bin_pred_type, 
-     bin_minus_type, bin_add_type, bin_mult_type];
-
-val bin_ss = integ_ss 
-    addsimps([bool_1I, bool_0I,
-	     bin_rec_Plus, bin_rec_Minus, bin_rec_Bcons] @ 
-	     bin_recs integ_of_bin_def @ bool_simps @ bin_typechecks);
-
-val typechecks = bin_typechecks @ integ_typechecks @ nat_typechecks @
-                 [bool_subset_nat RS subsetD];
-
-(**** The carry/borrow functions, bin_succ and bin_pred ****)
-
-(** Lemmas **)
-
-goal Integ.thy 
-    "!!z v. [| z $+ v = z' $+ v';  \
-\       z: integ; z': integ;  v: integ; v': integ;  w: integ |]   \
-\    ==> z $+ (v $+ w) = z' $+ (v' $+ w)";
-by (asm_simp_tac (integ_ss addsimps ([zadd_assoc RS sym])) 1);
-val zadd_assoc_cong = result();
-
-goal Integ.thy 
-    "!!z v w. [| z: integ;  v: integ;  w: integ |]   \
-\    ==> z $+ (v $+ w) = v $+ (z $+ w)";
-by (REPEAT (ares_tac [zadd_commute RS zadd_assoc_cong] 1));
-val zadd_assoc_swap = result();
-
-val zadd_cong = 
-    read_instantiate_sg (sign_of Integ.thy) [("t","op $+")] subst_context2;
-
-val zadd_kill = (refl RS zadd_cong);
-val zadd_assoc_swap_kill = zadd_kill RSN (4, zadd_assoc_swap RS trans);
-
-(*Pushes 'constants' of the form $#m to the right -- LOOPS if two!*)
-val zadd_assoc_znat = standard (znat_type RS zadd_assoc_swap);
-
-goal Integ.thy 
-    "!!z w. [| z: integ;  w: integ |]   \
-\    ==> w $+ (z $+ (w $+ z)) = w $+ (w $+ (z $+ z))";
-by (REPEAT (ares_tac [zadd_kill, zadd_assoc_swap] 1));
-val zadd_swap_pairs = result();
-
-
-val carry_ss = bin_ss addsimps 
-               (bin_recs bin_succ_def @ bin_recs bin_pred_def);
-
-goal BinFn.thy
-    "!!w. w: bin ==> integ_of_bin(bin_succ(w)) = $#1 $+ integ_of_bin(w)";
-by (etac Bin.induct 1);
-by (simp_tac (carry_ss addsimps [zadd_0_right]) 1);
-by (simp_tac (carry_ss addsimps [zadd_zminus_inverse]) 1);
-by (etac boolE 1);
-by (ALLGOALS (asm_simp_tac (carry_ss addsimps [zadd_assoc])));
-by (REPEAT (ares_tac (zadd_swap_pairs::typechecks) 1));
-val integ_of_bin_succ = result();
-
-goal BinFn.thy
-    "!!w. w: bin ==> integ_of_bin(bin_pred(w)) = $~ ($#1) $+ integ_of_bin(w)";
-by (etac Bin.induct 1);
-by (simp_tac (carry_ss addsimps [zadd_0_right]) 1);
-by (simp_tac (carry_ss addsimps [zadd_zminus_inverse]) 1);
-by (etac boolE 1);
-by (ALLGOALS 
-    (asm_simp_tac 
-     (carry_ss addsimps [zadd_assoc RS sym,
-			zadd_zminus_inverse, zadd_zminus_inverse2])));
-by (REPEAT (ares_tac ([zadd_commute, zadd_cong, refl]@typechecks) 1));
-val integ_of_bin_pred = result();
-
-(*These two results replace the definitions of bin_succ and bin_pred*)
-
-
-(*** bin_minus: (unary!) negation of binary integers ***)
-
-val bin_minus_ss =
-    bin_ss addsimps (bin_recs bin_minus_def @
-		    [integ_of_bin_succ, integ_of_bin_pred]);
-
-goal BinFn.thy
-    "!!w. w: bin ==> integ_of_bin(bin_minus(w)) = $~ integ_of_bin(w)";
-by (etac Bin.induct 1);
-by (simp_tac (bin_minus_ss addsimps [zminus_0]) 1);
-by (simp_tac (bin_minus_ss addsimps [zadd_0_right]) 1);
-by (etac boolE 1);
-by (ALLGOALS 
-    (asm_simp_tac (bin_minus_ss addsimps [zminus_zadd_distrib, zadd_assoc])));
-val integ_of_bin_minus = result();
-
-
-(*** bin_add: binary addition ***)
-
-goalw BinFn.thy [bin_add_def] "!!w. w: bin ==> bin_add(Plus,w) = w";
-by (asm_simp_tac bin_ss 1);
-val bin_add_Plus = result();
-
-goalw BinFn.thy [bin_add_def] "!!w. w: bin ==> bin_add(Minus,w) = bin_pred(w)";
-by (asm_simp_tac bin_ss 1);
-val bin_add_Minus = result();
-
-goalw BinFn.thy [bin_add_def] "bin_add(v$$x,Plus) = v$$x";
-by (simp_tac bin_ss 1);
-val bin_add_Bcons_Plus = result();
-
-goalw BinFn.thy [bin_add_def] "bin_add(v$$x,Minus) = bin_pred(v$$x)";
-by (simp_tac bin_ss 1);
-val bin_add_Bcons_Minus = result();
-
-goalw BinFn.thy [bin_add_def]
-    "!!w y. [| w: bin;  y: bool |] ==> \
-\           bin_add(v$$x, w$$y) = \
-\           bin_add(v, cond(x and y, bin_succ(w), w)) $$ (x xor y)";
-by (asm_simp_tac bin_ss 1);
-val bin_add_Bcons_Bcons = result();
-
-val bin_add_rews = [bin_add_Plus, bin_add_Minus, bin_add_Bcons_Plus,
-		    bin_add_Bcons_Minus, bin_add_Bcons_Bcons,
-		    integ_of_bin_succ, integ_of_bin_pred];
-
-val bin_add_ss = bin_ss addsimps ([bool_subset_nat RS subsetD] @ bin_add_rews);
-
-goal BinFn.thy
-    "!!v. v: bin ==> \
-\         ALL w: bin. integ_of_bin(bin_add(v,w)) = \
-\                     integ_of_bin(v) $+ integ_of_bin(w)";
-by (etac Bin.induct 1);
-by (simp_tac bin_add_ss 1);
-by (simp_tac bin_add_ss 1);
-by (rtac ballI 1);
-by (bin_ind_tac "wa" [] 1);
-by (asm_simp_tac (bin_add_ss addsimps [zadd_0_right]) 1);
-by (asm_simp_tac bin_add_ss 1);
-by (REPEAT (ares_tac (zadd_commute::typechecks) 1));
-by (etac boolE 1);
-by (asm_simp_tac (bin_add_ss addsimps [zadd_assoc, zadd_swap_pairs]) 2);
-by (REPEAT (ares_tac ([refl, zadd_kill, zadd_assoc_swap_kill]@typechecks) 2));
-by (etac boolE 1);
-by (ALLGOALS (asm_simp_tac (bin_add_ss addsimps [zadd_assoc,zadd_swap_pairs])));
-by (REPEAT (ares_tac ([refl, zadd_kill, zadd_assoc_swap_kill RS sym]@
-		      typechecks) 1));
-val integ_of_bin_add_lemma = result();
-
-val integ_of_bin_add = integ_of_bin_add_lemma RS bspec;
-
-
-(*** bin_add: binary multiplication ***)
-
-val bin_mult_ss =
-    bin_ss addsimps (bin_recs bin_mult_def @ 
-		       [integ_of_bin_minus, integ_of_bin_add]);
-
-
-val major::prems = goal BinFn.thy
-    "[| v: bin; w: bin |] ==>	\
-\    integ_of_bin(bin_mult(v,w)) = \
-\    integ_of_bin(v) $* integ_of_bin(w)";
-by (cut_facts_tac prems 1);
-by (bin_ind_tac "v" [major] 1);
-by (asm_simp_tac (bin_mult_ss addsimps [zmult_0]) 1);
-by (asm_simp_tac (bin_mult_ss addsimps [zmult_1,zmult_zminus]) 1);
-by (etac boolE 1);
-by (asm_simp_tac (bin_mult_ss addsimps [zadd_zmult_distrib]) 2);
-by (asm_simp_tac 
-    (bin_mult_ss addsimps [zadd_zmult_distrib, zmult_1, zadd_assoc]) 1);
-by (REPEAT (ares_tac ([zadd_commute, zadd_assoc_swap_kill RS sym]@
-		      typechecks) 1));
-val integ_of_bin_mult = result();
-
-(**** Computations ****)
-
-(** extra rules for bin_succ, bin_pred **)
-
-val [bin_succ_Plus, bin_succ_Minus, _] = bin_recs bin_succ_def;
-val [bin_pred_Plus, bin_pred_Minus, _] = bin_recs bin_pred_def;
-
-goal BinFn.thy "bin_succ(w$$1) = bin_succ(w) $$ 0";
-by (simp_tac carry_ss 1);
-val bin_succ_Bcons1 = result();
-
-goal BinFn.thy "bin_succ(w$$0) = w$$1";
-by (simp_tac carry_ss 1);
-val bin_succ_Bcons0 = result();
-
-goal BinFn.thy "bin_pred(w$$1) = w$$0";
-by (simp_tac carry_ss 1);
-val bin_pred_Bcons1 = result();
-
-goal BinFn.thy "bin_pred(w$$0) = bin_pred(w) $$ 1";
-by (simp_tac carry_ss 1);
-val bin_pred_Bcons0 = result();
-
-(** extra rules for bin_minus **)
-
-val [bin_minus_Plus, bin_minus_Minus, _] = bin_recs bin_minus_def;
-
-goal BinFn.thy "bin_minus(w$$1) = bin_pred(bin_minus(w) $$ 0)";
-by (simp_tac bin_minus_ss 1);
-val bin_minus_Bcons1 = result();
-
-goal BinFn.thy "bin_minus(w$$0) = bin_minus(w) $$ 0";
-by (simp_tac bin_minus_ss 1);
-val bin_minus_Bcons0 = result();
-
-(** extra rules for bin_add **)
-
-goal BinFn.thy 
-    "!!w. w: bin ==> bin_add(v$$1, w$$1) = bin_add(v, bin_succ(w)) $$ 0";
-by (asm_simp_tac bin_add_ss 1);
-val bin_add_Bcons_Bcons11 = result();
-
-goal BinFn.thy 
-    "!!w. w: bin ==> bin_add(v$$1, w$$0) = bin_add(v,w) $$ 1";
-by (asm_simp_tac bin_add_ss 1);
-val bin_add_Bcons_Bcons10 = result();
-
-goal BinFn.thy 
-    "!!w y.[| w: bin;  y: bool |] ==> bin_add(v$$0, w$$y) = bin_add(v,w) $$ y";
-by (asm_simp_tac bin_add_ss 1);
-val bin_add_Bcons_Bcons0 = result();
-
-(** extra rules for bin_mult **)
-
-val [bin_mult_Plus, bin_mult_Minus, _] = bin_recs bin_mult_def;
-
-goal BinFn.thy "bin_mult(v$$1, w) = bin_add(bin_mult(v,w)$$0, w)";
-by (simp_tac bin_mult_ss 1);
-val bin_mult_Bcons1 = result();
-
-goal BinFn.thy "bin_mult(v$$0, w) = bin_mult(v,w)$$0";
-by (simp_tac bin_mult_ss 1);
-val bin_mult_Bcons0 = result();
-
-
-(*** The computation simpset ***)
-
-val bin_comp_ss = integ_ss 
-    addsimps [bin_succ_Plus, bin_succ_Minus,
-	     bin_succ_Bcons1, bin_succ_Bcons0,
-	     bin_pred_Plus, bin_pred_Minus,
-	     bin_pred_Bcons1, bin_pred_Bcons0,
-	     bin_minus_Plus, bin_minus_Minus,
-	     bin_minus_Bcons1, bin_minus_Bcons0,
-	     bin_add_Plus, bin_add_Minus, bin_add_Bcons_Plus, 
-	     bin_add_Bcons_Minus, bin_add_Bcons_Bcons0, 
-	     bin_add_Bcons_Bcons10, bin_add_Bcons_Bcons11,
-	     bin_mult_Plus, bin_mult_Minus,
-	     bin_mult_Bcons1, bin_mult_Bcons0]
-    setsolver (type_auto_tac ([bool_1I, bool_0I] @ bin_typechecks0));
-
-(*** Examples of performing binary arithmetic by simplification ***)
-
-proof_timing := true;
-(*All runtimes below are on a SPARCserver 10*)
-
-(* 13+19 = 32 *)
-goal BinFn.thy
-    "bin_add(Plus$$1$$1$$0$$1, Plus$$1$$0$$0$$1$$1) = Plus$$1$$0$$0$$0$$0$$0";
-by (simp_tac bin_comp_ss 1);	(*0.6 secs*)
-result();
-
-bin_add(binary_of_int 13, binary_of_int 19);
-
-(* 1234+5678 = 6912 *)
-goal BinFn.thy
-    "bin_add(Plus$$1$$0$$0$$1$$1$$0$$1$$0$$0$$1$$0, \
-\	     Plus$$1$$0$$1$$1$$0$$0$$0$$1$$0$$1$$1$$1$$0) = \
-\    Plus$$1$$1$$0$$1$$1$$0$$0$$0$$0$$0$$0$$0$$0";
-by (simp_tac bin_comp_ss 1);	(*2.6 secs*)
-result();
-
-bin_add(binary_of_int 1234, binary_of_int 5678);
-
-(* 1359-2468 = ~1109 *)
-goal BinFn.thy
-    "bin_add(Plus$$1$$0$$1$$0$$1$$0$$0$$1$$1$$1$$1,		\
-\	     Minus$$0$$1$$1$$0$$0$$1$$0$$1$$1$$1$$0$$0) = 	\
-\    Minus$$1$$0$$1$$1$$1$$0$$1$$0$$1$$0$$1$$1";
-by (simp_tac bin_comp_ss 1);	(*2.3 secs*)
-result();
-
-bin_add(binary_of_int 1359, binary_of_int ~2468);
-
-(* 93746-46375 = 47371 *)
-goal BinFn.thy
-    "bin_add(Plus$$1$$0$$1$$1$$0$$1$$1$$1$$0$$0$$0$$1$$1$$0$$0$$1$$0, \
-\	     Minus$$0$$1$$0$$0$$1$$0$$1$$0$$1$$1$$0$$1$$1$$0$$0$$1) = \
-\    Plus$$0$$1$$0$$1$$1$$1$$0$$0$$1$$0$$0$$0$$0$$1$$0$$1$$1";
-by (simp_tac bin_comp_ss 1);	(*3.9 secs*)
-result();
-
-bin_add(binary_of_int 93746, binary_of_int ~46375);
-
-(* negation of 65745 *)
-goal BinFn.thy
-    "bin_minus(Plus$$1$$0$$0$$0$$0$$0$$0$$0$$0$$1$$1$$0$$1$$0$$0$$0$$1) = \
-\    Minus$$0$$1$$1$$1$$1$$1$$1$$1$$1$$0$$0$$1$$0$$1$$1$$1$$1";
-by (simp_tac bin_comp_ss 1);	(*0.6 secs*)
-result();
-
-bin_minus(binary_of_int 65745);
-
-(* negation of ~54321 *)
-goal BinFn.thy
-    "bin_minus(Minus$$0$$0$$1$$0$$1$$0$$1$$1$$1$$1$$0$$0$$1$$1$$1$$1) = \
-\    Plus$$0$$1$$1$$0$$1$$0$$1$$0$$0$$0$$0$$1$$1$$0$$0$$0$$1";
-by (simp_tac bin_comp_ss 1);	(*0.7 secs*)
-result();
-
-bin_minus(binary_of_int ~54321);
-
-(* 13*19 = 247 *)
-goal BinFn.thy "bin_mult(Plus$$1$$1$$0$$1, Plus$$1$$0$$0$$1$$1) = \
-\               Plus$$1$$1$$1$$1$$0$$1$$1$$1";
-by (simp_tac bin_comp_ss 1);	(*1.5 secs*)
-result();
-
-bin_mult(binary_of_int 13, binary_of_int 19);
-
-(* ~84 * 51 = ~4284 *)
-goal BinFn.thy
-    "bin_mult(Minus$$0$$1$$0$$1$$1$$0$$0, Plus$$1$$1$$0$$0$$1$$1) = \
-\    Minus$$0$$1$$1$$1$$1$$0$$1$$0$$0$$0$$1$$0$$0";
-by (simp_tac bin_comp_ss 1);	(*2.6 secs*)
-result();
-
-bin_mult(binary_of_int ~84, binary_of_int 51);
-
-(* 255*255 = 65025;  the worst case for 8-bit operands *)
-goal BinFn.thy
-    "bin_mult(Plus$$1$$1$$1$$1$$1$$1$$1$$1, \
-\             Plus$$1$$1$$1$$1$$1$$1$$1$$1) = \
-\        Plus$$1$$1$$1$$1$$1$$1$$1$$0$$0$$0$$0$$0$$0$$0$$0$$1";
-by (simp_tac bin_comp_ss 1);	(*9.8 secs*)
-result();
-
-bin_mult(binary_of_int 255, binary_of_int 255);
-
-(* 1359 * ~2468 = ~3354012 *)
-goal BinFn.thy
-    "bin_mult(Plus$$1$$0$$1$$0$$1$$0$$0$$1$$1$$1$$1, 		\
-\	      Minus$$0$$1$$1$$0$$0$$1$$0$$1$$1$$1$$0$$0) = 	\
-\    Minus$$0$$0$$1$$1$$0$$0$$1$$1$$0$$1$$0$$0$$1$$0$$0$$1$$1$$0$$0$$1$$0$$0";
-by (simp_tac bin_comp_ss 1);	(*13.7 secs*)
-result();
-
-bin_mult(binary_of_int 1359, binary_of_int ~2468);
--- a/src/ZF/ex/BinFn.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-(*  Title: 	ZF/bin
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-Arithmetic on binary integers.
-*)
-
-BinFn = Integ + Bin +
-consts
-  bin_rec          :: "[i, i, i, [i,i,i]=>i] => i"
-  integ_of_bin     :: "i=>i"
-  bin_succ         :: "i=>i"
-  bin_pred         :: "i=>i"
-  bin_minus        :: "i=>i"
-  bin_add,bin_mult :: "[i,i]=>i"
-
-rules
-
-  bin_rec_def
-      "bin_rec(z,a,b,h) == \
-\      Vrec(z, %z g. bin_case(a, b, %w x. h(w, x, g`w), z))"
-
-  integ_of_bin_def 
-      "integ_of_bin(w) == bin_rec(w, $#0, $~($#1), %w x r. $#x $+ r $+ r)"
-
-  bin_succ_def
-      "bin_succ(w0) == bin_rec(w0, Plus$$1, Plus, %w x r. cond(x, r$$0, w$$1))"
-
-  bin_pred_def
-      "bin_pred(w0) == \
-\	bin_rec(w0, Minus, Minus$$0, %w x r. cond(x, w$$0, r$$1))"
-
-  bin_minus_def
-      "bin_minus(w0) == \
-\	bin_rec(w0, Plus, Plus$$1, %w x r. cond(x, bin_pred(r$$0), r$$0))"
-
-  bin_add_def
-      "bin_add(v0,w0) == 			\
-\       bin_rec(v0, 				\
-\         lam w:bin. w,       		\
-\         lam w:bin. bin_pred(w),	\
-\         %v x r. lam w1:bin. 		\
-\	           bin_rec(w1, v$$x, bin_pred(v$$x),	\
-\		     %w y s. (r`cond(x and y, bin_succ(w), w)) \
-\		             $$ (x xor y)))    ` w0"
-
-  bin_mult_def
-      "bin_mult(v0,w) == 			\
-\       bin_rec(v0, Plus, bin_minus(w),		\
-\         %v x r. cond(x, bin_add(r$$0,w), r$$0))"
-end
--- a/src/ZF/ex/Contract0.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-(*  Title: 	ZF/ex/Contract0.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson
-    Copyright   1993  University of Cambridge
-
-For ex/contract.thy.
-*)
-
-open Contract0;
-
-structure Contract = Inductive_Fun
- (val thy 	= Contract0.thy;
-  val thy_name 	= "Contract";
-  val rec_doms 	= [("contract","comb*comb")];
-  val sintrs 	= 
-      ["[| p:comb;  q:comb |] ==> K#p#q -1-> p",
-       "[| p:comb;  q:comb;  r:comb |] ==> S#p#q#r -1-> (p#r)#(q#r)",
-       "[| p-1->q;  r:comb |] ==> p#r -1-> q#r",
-       "[| p-1->q;  r:comb |] ==> r#p -1-> r#q"];
-  val monos 	= [];
-  val con_defs 	= [];
-  val type_intrs = Comb.intrs;
-  val type_elims = []);
-
-val [K_contract,S_contract,Ap_contract1,Ap_contract2] = Contract.intrs;
-
-val contract_induct = standard
-    (Contract.mutual_induct RS spec RS spec RSN (2,rev_mp));
-
-(*For type checking: replaces a-1->b by a,b:comb *)
-val contract_combE2 = Contract.dom_subset RS subsetD RS SigmaE2;
-val contract_combD1 = Contract.dom_subset RS subsetD RS SigmaD1;
-val contract_combD2 = Contract.dom_subset RS subsetD RS SigmaD2;
-
-goal Contract.thy "field(contract) = comb";
-by (fast_tac (ZF_cs addIs [equalityI,K_contract] addSEs [contract_combE2]) 1);
-val field_contract_eq = result();
-
-val reduction_refl = standard
-    (field_contract_eq RS equalityD2 RS subsetD RS rtrancl_refl);
-
-val rtrancl_into_rtrancl2 = standard
-    (r_into_rtrancl RS (trans_rtrancl RS transD));
-
-val reduction_rls = [reduction_refl, K_contract, S_contract, 
-		     K_contract RS rtrancl_into_rtrancl2,
-		     S_contract RS rtrancl_into_rtrancl2,
-		     Ap_contract1 RS rtrancl_into_rtrancl2,
-		     Ap_contract2 RS rtrancl_into_rtrancl2];
-
-goalw Contract.thy [I_def] "!!p. p:comb ==> I#p ---> p";
-by (REPEAT (ares_tac (Comb.intrs @ reduction_rls) 1));
-val I_reduce = result();
-
-goalw Contract.thy [I_def] "I: comb";
-by (REPEAT (ares_tac Comb.intrs 1));
-val I_comb = result();
-
-(** Non-contraction results **)
-
-(*Derive a case for each combinator constructor*)
-val K_contract_case = Contract.mk_cases Comb.con_defs "K -1-> r";
-val S_contract_case = Contract.mk_cases Comb.con_defs "S -1-> r";
-val Ap_contract_case = Contract.mk_cases Comb.con_defs "p#q -1-> r";
-
-val contract_cs =
-    ZF_cs addSIs Comb.intrs
-	  addIs  Contract.intrs
-	  addSEs [contract_combD1,contract_combD2]     (*type checking*)
-	  addSEs [K_contract_case, S_contract_case, Ap_contract_case]
-	  addSEs Comb.free_SEs;
-
-goalw Contract.thy [I_def] "!!r. I -1-> r ==> P";
-by (fast_tac contract_cs 1);
-val I_contract_case = result();
-
-goal Contract.thy "!!p r. K#p -1-> r ==> (EX q. r = K#q & p -1-> q)";
-by (fast_tac contract_cs 1);
-val K1_contractD = result();
-
-goal Contract.thy "!!p r. [| p ---> q;  r: comb |] ==> p#r ---> q#r";
-by (forward_tac [rtrancl_type RS subsetD RS SigmaD1] 1);
-by (dtac (field_contract_eq RS equalityD1 RS subsetD) 1);
-by (etac rtrancl_induct 1);
-by (fast_tac (contract_cs addIs reduction_rls) 1);
-by (etac (trans_rtrancl RS transD) 1);
-by (fast_tac (contract_cs addIs reduction_rls) 1);
-val Ap_reduce1 = result();
-
-goal Contract.thy "!!p r. [| p ---> q;  r: comb |] ==> r#p ---> r#q";
-by (forward_tac [rtrancl_type RS subsetD RS SigmaD1] 1);
-by (dtac (field_contract_eq RS equalityD1 RS subsetD) 1);
-by (etac rtrancl_induct 1);
-by (fast_tac (contract_cs addIs reduction_rls) 1);
-by (etac (trans_rtrancl RS transD) 1);
-by (fast_tac (contract_cs addIs reduction_rls) 1);
-val Ap_reduce2 = result();
-
-(** Counterexample to the diamond property for -1-> **)
-
-goal Contract.thy "K#I#(I#I) -1-> I";
-by (REPEAT (ares_tac [K_contract, I_comb, Ap_comb] 1));
-val KIII_contract1 = result();
-
-goalw Contract.thy [I_def] "K#I#(I#I) -1-> K#I#((K#I)#(K#I))";
-by (DEPTH_SOLVE (resolve_tac (Comb.intrs @ Contract.intrs) 1));
-val KIII_contract2 = result();
-
-goal Contract.thy "K#I#((K#I)#(K#I)) -1-> I";
-by (REPEAT (ares_tac (Comb.intrs @ [K_contract, I_comb]) 1));
-val KIII_contract3 = result();
-
-goalw Contract.thy [diamond_def] "~ diamond(contract)";
-by (fast_tac (ZF_cs addIs [KIII_contract1,KIII_contract2,KIII_contract3]
-                    addSEs [I_contract_case]) 1);
-val not_diamond_contract = result();
-
-writeln"Reached end of file.";
--- a/src/ZF/ex/Contract0.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-(*  Title: 	ZF/ex/contract.thy
-    ID:         $Id$
-    Author: 	Lawrence C Paulson
-    Copyright   1993  University of Cambridge
-
-Inductive definition of (1-step) contractions and (mult-step) reductions
-*)
-
-Contract0 = Comb +
-consts
-  diamond   :: "i => o"
-  I         :: "i"
-
-  contract  :: "i"
-  "-1->"    :: "[i,i] => o"    			(infixl 50)
-  "--->"    :: "[i,i] => o"    			(infixl 50)
-
-  parcontract :: "i"
-  "=1=>"    :: "[i,i] => o"    			(infixl 50)
-  "===>"    :: "[i,i] => o"    			(infixl 50)
-
-translations
-  "p -1-> q" == "<p,q> : contract"
-  "p ---> q" == "<p,q> : contract^*"
-  "p =1=> q" == "<p,q> : parcontract"
-  "p ===> q" == "<p,q> : parcontract^+"
-
-rules
-
-  diamond_def "diamond(r) == ALL x y. <x,y>:r --> \
-\                            (ALL y'. <x,y'>:r --> \
-\                                 (EX z. <y,z>:r & <y',z> : r))"
-
-  I_def       "I == S#K#K"
-
-end
--- a/src/ZF/ex/Equiv.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,268 +0,0 @@
-(*  Title: 	ZF/ex/Equiv.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1994  University of Cambridge
-
-For Equiv.thy.  Equivalence relations in Zermelo-Fraenkel Set Theory 
-*)
-
-val RSLIST = curry (op MRS);
-
-open Equiv;
-
-(*** Suppes, Theorem 70: r is an equiv relation iff converse(r) O r = r ***)
-
-(** first half: equiv(A,r) ==> converse(r) O r = r **)
-
-goalw Equiv.thy [trans_def,sym_def]
-    "!!r. [| sym(r); trans(r) |] ==> converse(r) O r <= r";
-by (fast_tac (ZF_cs addSEs [converseD,compE]) 1);
-val sym_trans_comp_subset = result();
-
-goalw Equiv.thy [refl_def]
-    "!!A r. [| refl(A,r); r <= A*A |] ==> r <= converse(r) O r";
-by (fast_tac (ZF_cs addSIs [converseI] addIs [compI]) 1);
-val refl_comp_subset = result();
-
-goalw Equiv.thy [equiv_def]
-    "!!A r. equiv(A,r) ==> converse(r) O r = r";
-by (rtac equalityI 1);
-by (REPEAT (ares_tac [sym_trans_comp_subset, refl_comp_subset] 1
-     ORELSE etac conjE 1));
-val equiv_comp_eq = result();
-
-(*second half*)
-goalw Equiv.thy [equiv_def,refl_def,sym_def,trans_def]
-    "!!A r. [| converse(r) O r = r;  domain(r) = A |] ==> equiv(A,r)";
-by (etac equalityE 1);
-by (subgoal_tac "ALL x y. <x,y> : r --> <y,x> : r" 1);
-by (safe_tac ZF_cs);
-by (fast_tac (ZF_cs addSIs [converseI] addIs [compI]) 3);
-by (ALLGOALS (fast_tac 
-	      (ZF_cs addSIs [converseI] addIs [compI] addSEs [compE])));
-by flexflex_tac;
-val comp_equivI = result();
-
-(** Equivalence classes **)
-
-(*Lemma for the next result*)
-goalw Equiv.thy [trans_def,sym_def]
-    "!!A r. [| sym(r);  trans(r);  <a,b>: r |] ==> r``{a} <= r``{b}";
-by (fast_tac ZF_cs 1);
-val equiv_class_subset = result();
-
-goalw Equiv.thy [equiv_def]
-    "!!A r. [| equiv(A,r);  <a,b>: r |] ==> r``{a} = r``{b}";
-by (safe_tac (subset_cs addSIs [equalityI, equiv_class_subset]));
-by (rewrite_goals_tac [sym_def]);
-by (fast_tac ZF_cs 1);
-val equiv_class_eq = result();
-
-val prems = goalw Equiv.thy [equiv_def,refl_def]
-    "[| equiv(A,r);  a: A |] ==> a: r``{a}";
-by (cut_facts_tac prems 1);
-by (fast_tac ZF_cs 1);
-val equiv_class_self = result();
-
-(*Lemma for the next result*)
-goalw Equiv.thy [equiv_def,refl_def]
-    "!!A r. [| equiv(A,r);  r``{b} <= r``{a};  b: A |] ==> <a,b>: r";
-by (fast_tac ZF_cs 1);
-val subset_equiv_class = result();
-
-val prems = goal Equiv.thy
-    "[| r``{a} = r``{b};  equiv(A,r);  b: A |] ==> <a,b>: r";
-by (REPEAT (resolve_tac (prems @ [equalityD2, subset_equiv_class]) 1));
-val eq_equiv_class = result();
-
-(*thus r``{a} = r``{b} as well*)
-goalw Equiv.thy [equiv_def,trans_def,sym_def]
-    "!!A r. [| equiv(A,r);  x: (r``{a} Int r``{b}) |] ==> <a,b>: r";
-by (fast_tac ZF_cs 1);
-val equiv_class_nondisjoint = result();
-
-goalw Equiv.thy [equiv_def] "!!A r. equiv(A,r) ==> r <= A*A";
-by (safe_tac ZF_cs);
-val equiv_type = result();
-
-goal Equiv.thy
-    "!!A r. equiv(A,r) ==> <x,y>: r <-> r``{x} = r``{y} & x:A & y:A";
-by (fast_tac (ZF_cs addIs [eq_equiv_class, equiv_class_eq]
-		    addDs [equiv_type]) 1);
-val equiv_class_eq_iff = result();
-
-goal Equiv.thy
-    "!!A r. [| equiv(A,r);  x: A;  y: A |] ==> r``{x} = r``{y} <-> <x,y>: r";
-by (fast_tac (ZF_cs addIs [eq_equiv_class, equiv_class_eq]
-		    addDs [equiv_type]) 1);
-val eq_equiv_class_iff = result();
-
-(*** Quotients ***)
-
-(** Introduction/elimination rules -- needed? **)
-
-val prems = goalw Equiv.thy [quotient_def] "x:A ==> r``{x}: A/r";
-by (rtac RepFunI 1);
-by (resolve_tac prems 1);
-val quotientI = result();
-
-val major::prems = goalw Equiv.thy [quotient_def]
-    "[| X: A/r;  !!x. [| X = r``{x};  x:A |] ==> P |] 	\
-\    ==> P";
-by (rtac (major RS RepFunE) 1);
-by (eresolve_tac prems 1);
-by (assume_tac 1);
-val quotientE = result();
-
-goalw Equiv.thy [equiv_def,refl_def,quotient_def]
-    "!!A r. equiv(A,r) ==> Union(A/r) = A";
-by (fast_tac eq_cs 1);
-val Union_quotient = result();
-
-goalw Equiv.thy [quotient_def]
-    "!!A r. [| equiv(A,r);  X: A/r;  Y: A/r |] ==> X=Y | (X Int Y <= 0)";
-by (safe_tac (ZF_cs addSIs [equiv_class_eq]));
-by (assume_tac 1);
-by (rewrite_goals_tac [equiv_def,trans_def,sym_def]);
-by (fast_tac ZF_cs 1);
-val quotient_disj = result();
-
-(**** Defining unary operations upon equivalence classes ****)
-
-(** These proofs really require as local premises
-     equiv(A,r);  congruent(r,b)
-**)
-
-(*Conversion rule*)
-val prems as [equivA,bcong,_] = goal Equiv.thy
-    "[| equiv(A,r);  congruent(r,b);  a: A |] ==> (UN x:r``{a}. b(x)) = b(a)";
-by (cut_facts_tac prems 1);
-by (rtac ([refl RS UN_cong, UN_constant] MRS trans) 1);
-by (etac equiv_class_self 2);
-by (assume_tac 2);
-by (rewrite_goals_tac [equiv_def,sym_def,congruent_def]);
-by (fast_tac ZF_cs 1);
-val UN_equiv_class = result();
-
-(*Resolve th against the "local" premises*)
-val localize = RSLIST [equivA,bcong];
-
-(*type checking of  UN x:r``{a}. b(x) *)
-val _::_::prems = goalw Equiv.thy [quotient_def]
-    "[| equiv(A,r);  congruent(r,b);  X: A/r;	\
-\	!!x.  x : A ==> b(x) : B |] 	\
-\    ==> (UN x:X. b(x)) : B";
-by (cut_facts_tac prems 1);
-by (safe_tac ZF_cs);
-by (rtac (localize UN_equiv_class RS ssubst) 1);
-by (REPEAT (ares_tac prems 1));
-val UN_equiv_class_type = result();
-
-(*Sufficient conditions for injectiveness.  Could weaken premises!
-  major premise could be an inclusion; bcong could be !!y. y:A ==> b(y):B
-*)
-val _::_::prems = goalw Equiv.thy [quotient_def]
-    "[| equiv(A,r);   congruent(r,b);  \
-\       (UN x:X. b(x))=(UN y:Y. b(y));  X: A/r;  Y: A/r;  \
-\       !!x y. [| x:A; y:A; b(x)=b(y) |] ==> <x,y>:r |] 	\
-\    ==> X=Y";
-by (cut_facts_tac prems 1);
-by (safe_tac ZF_cs);
-by (rtac (equivA RS equiv_class_eq) 1);
-by (REPEAT (ares_tac prems 1));
-by (etac box_equals 1);
-by (REPEAT (ares_tac [localize UN_equiv_class] 1));
-val UN_equiv_class_inject = result();
-
-
-(**** Defining binary operations upon equivalence classes ****)
-
-
-goalw Equiv.thy [congruent_def,congruent2_def,equiv_def,refl_def]
-    "!!A r. [| equiv(A,r);  congruent2(r,b);  a: A |] ==> congruent(r,b(a))";
-by (fast_tac ZF_cs 1);
-val congruent2_implies_congruent = result();
-
-val equivA::prems = goalw Equiv.thy [congruent_def]
-    "[| equiv(A,r);  congruent2(r,b);  a: A |] ==> \
-\    congruent(r, %x1. UN x2:r``{a}. b(x1,x2))";
-by (cut_facts_tac (equivA::prems) 1);
-by (safe_tac ZF_cs);
-by (rtac (equivA RS equiv_type RS subsetD RS SigmaE2) 1);
-by (assume_tac 1);
-by (asm_simp_tac (ZF_ss addsimps [equivA RS UN_equiv_class,
-				 congruent2_implies_congruent]) 1);
-by (rewrite_goals_tac [congruent2_def,equiv_def,refl_def]);
-by (fast_tac ZF_cs 1);
-val congruent2_implies_congruent_UN = result();
-
-val prems as equivA::_ = goal Equiv.thy
-    "[| equiv(A,r);  congruent2(r,b);  a1: A;  a2: A |]  \
-\    ==> (UN x1:r``{a1}. UN x2:r``{a2}. b(x1,x2)) = b(a1,a2)";
-by (cut_facts_tac prems 1);
-by (asm_simp_tac (ZF_ss addsimps [equivA RS UN_equiv_class,
-				 congruent2_implies_congruent,
-				 congruent2_implies_congruent_UN]) 1);
-val UN_equiv_class2 = result();
-
-(*type checking*)
-val prems = goalw Equiv.thy [quotient_def]
-    "[| equiv(A,r);  congruent2(r,b);  \
-\       X1: A/r;  X2: A/r;	\
-\	!!x1 x2.  [| x1: A; x2: A |] ==> b(x1,x2) : B |]    \
-\    ==> (UN x1:X1. UN x2:X2. b(x1,x2)) : B";
-by (cut_facts_tac prems 1);
-by (safe_tac ZF_cs);
-by (REPEAT (ares_tac (prems@[UN_equiv_class_type,
-			     congruent2_implies_congruent_UN,
-			     congruent2_implies_congruent, quotientI]) 1));
-val UN_equiv_class_type2 = result();
-
-
-(*Suggested by John Harrison -- the two subproofs may be MUCH simpler
-  than the direct proof*)
-val prems = goalw Equiv.thy [congruent2_def,equiv_def,refl_def]
-    "[| equiv(A,r);	\
-\       !! y z w. [| w: A;  <y,z> : r |] ==> b(y,w) = b(z,w);      \
-\       !! y z w. [| w: A;  <y,z> : r |] ==> b(w,y) = b(w,z)       \
-\    |] ==> congruent2(r,b)";
-by (cut_facts_tac prems 1);
-by (safe_tac ZF_cs);
-by (rtac trans 1);
-by (REPEAT (ares_tac prems 1
-     ORELSE etac (subsetD RS SigmaE2) 1 THEN assume_tac 2 THEN assume_tac 1));
-val congruent2I = result();
-
-val [equivA,commute,congt] = goal Equiv.thy
-    "[| equiv(A,r);	\
-\       !! y z. [| y: A;  z: A |] ==> b(y,z) = b(z,y);        \
-\       !! y z w. [| w: A;  <y,z>: r |] ==> b(w,y) = b(w,z)	\
-\    |] ==> congruent2(r,b)";
-by (resolve_tac [equivA RS congruent2I] 1);
-by (rtac (commute RS trans) 1);
-by (rtac (commute RS trans RS sym) 3);
-by (rtac sym 5);
-by (REPEAT (ares_tac [congt] 1
-     ORELSE etac (equivA RS equiv_type RS subsetD RS SigmaE2) 1));
-val congruent2_commuteI = result();
-
-(***OBSOLETE VERSION
-(*Rules congruentI and congruentD would simplify use of rewriting below*)
-val [equivA,ZinA,congt,commute] = goalw Equiv.thy [quotient_def]
-    "[| equiv(A,r);  Z: A/r;  \
-\       !!w. [| w: A |] ==> congruent(r, %z.b(w,z));	\
-\       !!x y. [| x: A;  y: A |] ==> b(y,x) = b(x,y)	\
-\    |] ==> congruent(r, %w. UN z: Z. b(w,z))";
-val congt' = rewrite_rule [congruent_def] congt;
-by (cut_facts_tac [ZinA,congt] 1);
-by (rewtac congruent_def);
-by (safe_tac ZF_cs);
-by (rtac (equivA RS equiv_type RS subsetD RS SigmaE2) 1);
-by (assume_tac 1);
-by (asm_simp_tac (ZF_ss addsimps [congt RS (equivA RS UN_equiv_class)]) 1);
-by (rtac (commute RS trans) 1);
-by (rtac (commute RS trans RS sym) 3);
-by (rtac sym 5);
-by (REPEAT (ares_tac [congt' RS spec RS spec RS mp] 1));
-val congruent_commuteI = result();
-***)
--- a/src/ZF/ex/Equiv.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-(*  Title: 	ZF/ex/Equiv.thy
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1994  University of Cambridge
-
-Equivalence relations in Zermelo-Fraenkel Set Theory 
-*)
-
-Equiv = Rel + Perm + 
-consts
-    "'/"        ::      "[i,i]=>i"  (infixl 90)  (*set of equiv classes*)
-    congruent	::	"[i,i=>i]=>o"
-    congruent2  ::      "[i,[i,i]=>i]=>o"
-
-rules
-    quotient_def  "A/r == {r``{x} . x:A}"
-    congruent_def "congruent(r,b) == ALL y z. <y,z>:r --> b(y)=b(z)"
-
-    congruent2_def
-       "congruent2(r,b) == ALL y1 z1 y2 z2. \
-\           <y1,z1>:r --> <y2,z2>:r --> b(y1,y2) = b(z1,z2)"
-
-end
--- a/src/ZF/ex/LListFn.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-(*  Title: 	ZF/ex/llist-fn.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-Functions for Lazy Lists in Zermelo-Fraenkel Set Theory 
-
-Examples of coinduction for type-checking and to prove llist equations
-*)
-
-open LListFn;
-
-(*** lconst -- defined directly using lfp, but equivalent to a LList_corec ***)
-
-goalw LListFn.thy LList.con_defs "bnd_mono(univ(a), %l. LCons(a,l))";
-by (rtac bnd_monoI 1);
-by (REPEAT (ares_tac [subset_refl, QInr_mono, QPair_mono] 2));
-by (REPEAT (ares_tac [subset_refl, A_subset_univ, 
-		      QInr_subset_univ, QPair_subset_univ] 1));
-val lconst_fun_bnd_mono = result();
-
-(* lconst(a) = LCons(a,lconst(a)) *)
-val lconst = standard 
-    ([lconst_def, lconst_fun_bnd_mono] MRS def_lfp_Tarski);
-
-val lconst_subset = lconst_def RS def_lfp_subset;
-
-val member_subset_Union_eclose = standard (arg_into_eclose RS Union_upper);
-
-goal LListFn.thy "!!a A. a : A ==> lconst(a) : quniv(A)";
-by (rtac (lconst_subset RS subset_trans RS qunivI) 1);
-by (etac (arg_into_eclose RS eclose_subset RS univ_mono) 1);
-val lconst_in_quniv = result();
-
-goal LListFn.thy "!!a A. a:A ==> lconst(a): llist(A)";
-by (rtac (singletonI RS LList.coinduct) 1);
-by (fast_tac (ZF_cs addSIs [lconst_in_quniv]) 1);
-by (fast_tac (ZF_cs addSIs [lconst]) 1);
-val lconst_type = result();
-
-(*** flip --- equations merely assumed; certain consequences proved ***)
-
-val flip_ss = ZF_ss addsimps [flip_LNil, flip_LCons, not_type];
-
-goal QUniv.thy "!!b. b:bool ==> b Int X <= univ(eclose(A))";
-by (fast_tac (quniv_cs addSEs [boolE]) 1);
-val bool_Int_subset_univ = result();
-
-val flip_cs = quniv_cs addSIs [not_type]
-                       addIs  [bool_Int_subset_univ];
-
-(*Reasoning borrowed from llist_eq.ML; a similar proof works for all
-  "productive" functions -- cf Coquand's "Infinite Objects in Type Theory".*)
-goal LListFn.thy
-   "!!i. Ord(i) ==> ALL l: llist(bool). flip(l) Int Vset(i) <= \
-\                   univ(eclose(bool))";
-by (etac trans_induct 1);
-by (rtac ballI 1);
-by (etac LList.elim 1);
-by (asm_simp_tac flip_ss 1);
-by (asm_simp_tac flip_ss 2);
-by (rewrite_goals_tac ([QInl_def,QInr_def]@LList.con_defs));
-(*LNil case*)
-by (fast_tac flip_cs 1);
-(*LCons case*)
-by (safe_tac flip_cs);
-by (ALLGOALS (fast_tac (flip_cs addSEs [Ord_trans, make_elim bspec])));
-val flip_llist_quniv_lemma = result();
-
-goal LListFn.thy "!!l. l: llist(bool) ==> flip(l) : quniv(bool)";
-by (rtac (flip_llist_quniv_lemma RS bspec RS Int_Vset_subset RS qunivI) 1);
-by (REPEAT (assume_tac 1));
-val flip_in_quniv = result();
-
-val [prem] = goal LListFn.thy "l : llist(bool) ==> flip(l): llist(bool)";
-by (res_inst_tac [("X", "{flip(l) . l:llist(bool)}")]
-       LList.coinduct 1);
-by (rtac (prem RS RepFunI) 1);
-by (fast_tac (ZF_cs addSIs [flip_in_quniv]) 1);
-by (etac RepFunE 1);
-by (etac LList.elim 1);
-by (asm_simp_tac flip_ss 1);
-by (asm_simp_tac flip_ss 1);
-by (fast_tac (ZF_cs addSIs [not_type]) 1);
-val flip_type = result();
-
-val [prem] = goal LListFn.thy
-    "l : llist(bool) ==> flip(flip(l)) = l";
-by (res_inst_tac [("X1", "{<flip(flip(l)),l> . l:llist(bool)}")]
-       (LList_Eq.coinduct RS lleq_implies_equal) 1);
-by (rtac (prem RS RepFunI) 1);
-by (fast_tac (ZF_cs addSIs [flip_type]) 1);
-by (etac RepFunE 1);
-by (etac LList.elim 1);
-by (asm_simp_tac flip_ss 1);
-by (asm_simp_tac (flip_ss addsimps [flip_type, not_not]) 1);
-by (fast_tac (ZF_cs addSIs [not_type]) 1);
-val flip_flip = result();
--- a/src/ZF/ex/LListFn.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-(*  Title: 	ZF/ex/llist-fn.thy
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-Functions for Lazy Lists in Zermelo-Fraenkel Set Theory 
-
-STILL NEEDS:
-co_recursion for defining lconst, flip, etc.
-a typing rule for it, based on some notion of "productivity..."
-*)
-
-LListFn = LList + LList_Eq +
-consts
-  lconst   :: "i => i"
-  flip     :: "i => i"
-
-rules
-  lconst_def  "lconst(a) == lfp(univ(a), %l. LCons(a,l))"
-
-  flip_LNil   "flip(LNil) = LNil"
-
-  flip_LCons  "[| x:bool; l: llist(bool) |] ==> \
-\              flip(LCons(x,l)) = LCons(not(x), flip(l))"
-
-end
--- a/src/ZF/ex/LList_Eq.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-(*  Title: 	ZF/ex/llist_eq.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-Equality for llist(A) as a greatest fixed point
-***)
-
-(*Previously used <*> in the domain and variant pairs as elements.  But
-  standard pairs work just as well.  To use variant pairs, must change prefix
-  a q/Q to the Sigma, Pair and converse rules.*)
-
-structure LList_Eq = CoInductive_Fun
- (val thy 	 = LList.thy |> add_consts [("lleq","i=>i",NoSyn)]
-  val thy_name 	 = "LList_Eq"
-  val rec_doms   = [("lleq", "llist(A) * llist(A)")]
-  val sintrs     = 
-        ["<LNil, LNil> : lleq(A)",
-         "[| a:A; <l,l'>: lleq(A) |] ==> <LCons(a,l), LCons(a,l')>: lleq(A)"]
-  val monos      = []
-  val con_defs   = []
-  val type_intrs = LList.intrs
-  val type_elims = []);
-
-(** Alternatives for above:
-  val con_defs = LList.con_defs
-  val type_intrs = codatatype_intrs
-  val type_elims = [quniv_QPair_E]
-**)
-
-val lleq_cs = subset_cs
-	addSIs [QPair_Int_Vset_subset_UN RS subset_trans, QPair_mono]
-        addSEs [Ord_in_Ord, Pair_inject];
-
-(*Lemma for proving finality.  Unfold the lazy list; use induction hypothesis*)
-goal LList_Eq.thy
-   "!!i. Ord(i) ==> ALL l l'. <l,l'> : lleq(A) --> l Int Vset(i) <= l'";
-by (etac trans_induct 1);
-by (REPEAT (resolve_tac [allI, impI] 1));
-by (etac LList_Eq.elim 1);
-by (rewrite_goals_tac (QInr_def::LList.con_defs));
-by (safe_tac lleq_cs);
-by (fast_tac (subset_cs addSEs [Ord_trans, make_elim bspec]) 1);
-val lleq_Int_Vset_subset_lemma = result();
-
-val lleq_Int_Vset_subset = standard
-	(lleq_Int_Vset_subset_lemma RS spec RS spec RS mp);
-
-
-(*lleq(A) is a symmetric relation because qconverse(lleq(A)) is a fixedpoint*)
-val [prem] = goal LList_Eq.thy "<l,l'> : lleq(A) ==> <l',l> : lleq(A)";
-by (rtac (prem RS converseI RS LList_Eq.coinduct) 1);
-by (rtac (LList_Eq.dom_subset RS converse_type) 1);
-by (safe_tac converse_cs);
-by (etac LList_Eq.elim 1);
-by (ALLGOALS (fast_tac qconverse_cs));
-val lleq_symmetric = result();
-
-goal LList_Eq.thy "!!l l'. <l,l'> : lleq(A) ==> l=l'";
-by (rtac equalityI 1);
-by (REPEAT (ares_tac [lleq_Int_Vset_subset RS Int_Vset_subset] 1
-     ORELSE etac lleq_symmetric 1));
-val lleq_implies_equal = result();
-
-val [eqprem,lprem] = goal LList_Eq.thy
-    "[| l=l';  l: llist(A) |] ==> <l,l'> : lleq(A)";
-by (res_inst_tac [("X", "{<l,l>. l: llist(A)}")] LList_Eq.coinduct 1);
-by (rtac (lprem RS RepFunI RS (eqprem RS subst)) 1);
-by (safe_tac qpair_cs);
-by (etac LList.elim 1);
-by (ALLGOALS (fast_tac pair_cs));
-val equal_llist_implies_leq = result();
-
--- a/src/ZF/ex/ParContract.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-(*  Title: 	ZF/ex/parcontract.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson
-    Copyright   1993  University of Cambridge
-
-Parallel contraction
-
-HOL system proofs may be found in
-/usr/groups/theory/hvg-aftp/contrib/rule-induction/cl.ml
-*)
-
-structure ParContract = Inductive_Fun
- (val thy	 = Contract.thy;
-  val thy_name	 = "ParContract";
-  val rec_doms	 = [("parcontract","comb*comb")];
-  val sintrs	 = 
-      ["[| p:comb |] ==> p =1=> p",
-       "[| p:comb;  q:comb |] ==> K#p#q =1=> p",
-       "[| p:comb;  q:comb;  r:comb |] ==> S#p#q#r =1=> (p#r)#(q#r)",
-       "[| p=1=>q;  r=1=>s |] ==> p#r =1=> q#s"];
-  val monos	 = [];
-  val con_defs	 = [];
-  val type_intrs = Comb.intrs;
-  val type_elims = []);
-
-val [parcontract_refl,K_parcontract,S_parcontract,Ap_parcontract] = 
-    ParContract.intrs;
-
-val parcontract_induct = standard
-    (ParContract.mutual_induct RS spec RS spec RSN (2,rev_mp));
-
-(*For type checking: replaces a=1=>b by a,b:comb *)
-val parcontract_combE2 = ParContract.dom_subset RS subsetD RS SigmaE2;
-val parcontract_combD1 = ParContract.dom_subset RS subsetD RS SigmaD1;
-val parcontract_combD2 = ParContract.dom_subset RS subsetD RS SigmaD2;
-
-goal ParContract.thy "field(parcontract) = comb";
-by (fast_tac (ZF_cs addIs [equalityI,K_parcontract] 
-	            addSEs [parcontract_combE2]) 1);
-val field_parcontract_eq = result();
-
-val parcontract_caseE = standard
-     (ParContract.unfold RS equalityD1 RS subsetD RS CollectE);
-
-(*Derive a case for each combinator constructor*)
-val K_parcontract_case = ParContract.mk_cases Comb.con_defs "K =1=> r";
-val S_parcontract_case = ParContract.mk_cases Comb.con_defs "S =1=> r";
-val Ap_parcontract_case = ParContract.mk_cases Comb.con_defs "p#q =1=> r";
-
-val parcontract_cs =
-    ZF_cs addSIs Comb.intrs
-	  addIs  ParContract.intrs
-	  addSEs [Ap_E, K_parcontract_case, S_parcontract_case, 
-		  Ap_parcontract_case]
-	  addSEs [parcontract_combD1, parcontract_combD2]     (*type checking*)
-          addSEs Comb.free_SEs;
-
-(*** Basic properties of parallel contraction ***)
-
-goal ParContract.thy "!!p r. K#p =1=> r ==> (EX p'. r = K#p' & p =1=> p')";
-by (fast_tac parcontract_cs 1);
-val K1_parcontractD = result();
-
-goal ParContract.thy "!!p r. S#p =1=> r ==> (EX p'. r = S#p' & p =1=> p')";
-by (fast_tac parcontract_cs 1);
-val S1_parcontractD = result();
-
-goal ParContract.thy
- "!!p q r. S#p#q =1=> r ==> (EX p' q'. r = S#p'#q' & p =1=> p' & q =1=> q')";
-by (fast_tac (parcontract_cs addSDs [S1_parcontractD]) 1);
-val S2_parcontractD = result();
-
-(*Church-Rosser property for parallel contraction*)
-goalw ParContract.thy [diamond_def] "diamond(parcontract)";
-by (rtac (impI RS allI RS allI) 1);
-by (etac parcontract_induct 1);
-by (ALLGOALS 
-    (fast_tac (parcontract_cs addSDs [K1_parcontractD,S2_parcontractD])));
-val diamond_parcontract = result();
-
-(*** Transitive closure preserves the Church-Rosser property ***)
-
-goalw ParContract.thy [diamond_def]
-    "!!x y r. [| diamond(r);  <x,y>:r^+ |] ==> \
-\    ALL y'. <x,y'>:r --> (EX z. <y',z>: r^+ & <y,z>: r)";
-by (etac trancl_induct 1);
-by (fast_tac (ZF_cs addIs [r_into_trancl]) 1);
-by (slow_best_tac (ZF_cs addSDs [spec RS mp]
-		         addIs  [r_into_trancl, trans_trancl RS transD]) 1);
-val diamond_trancl_lemma = result();
-
-val diamond_lemmaE = diamond_trancl_lemma RS spec RS mp RS exE;
-
-val [major] = goal ParContract.thy "diamond(r) ==> diamond(r^+)";
-bw diamond_def;  (*unfold only in goal, not in premise!*)
-by (rtac (impI RS allI RS allI) 1);
-by (etac trancl_induct 1);
-by (ALLGOALS
-    (slow_best_tac (ZF_cs addIs [r_into_trancl, trans_trancl RS transD]
-		          addEs [major RS diamond_lemmaE])));
-val diamond_trancl = result();
-
-
-(*** Equivalence of p--->q and p===>q ***)
-
-goal ParContract.thy "!!p q. p-1->q ==> p=1=>q";
-by (etac contract_induct 1);
-by (ALLGOALS (fast_tac (parcontract_cs)));
-val contract_imp_parcontract = result();
-
-goal ParContract.thy "!!p q. p--->q ==> p===>q";
-by (forward_tac [rtrancl_type RS subsetD RS SigmaD1] 1);
-by (dtac (field_contract_eq RS equalityD1 RS subsetD) 1);
-by (etac rtrancl_induct 1);
-by (fast_tac (parcontract_cs addIs [r_into_trancl]) 1);
-by (fast_tac (ZF_cs addIs [contract_imp_parcontract, 
-			   r_into_trancl, trans_trancl RS transD]) 1);
-val reduce_imp_parreduce = result();
-
-
-goal ParContract.thy "!!p q. p=1=>q ==> p--->q";
-by (etac parcontract_induct 1);
-by (fast_tac (contract_cs addIs reduction_rls) 1);
-by (fast_tac (contract_cs addIs reduction_rls) 1);
-by (fast_tac (contract_cs addIs reduction_rls) 1);
-by (rtac (trans_rtrancl RS transD) 1);
-by (ALLGOALS 
-    (fast_tac 
-     (contract_cs addIs [Ap_reduce1, Ap_reduce2]
-                  addSEs [parcontract_combD1,parcontract_combD2])));
-val parcontract_imp_reduce = result();
-
-goal ParContract.thy "!!p q. p===>q ==> p--->q";
-by (forward_tac [trancl_type RS subsetD RS SigmaD1] 1);
-by (dtac (field_parcontract_eq RS equalityD1 RS subsetD) 1);
-by (etac trancl_induct 1);
-by (etac parcontract_imp_reduce 1);
-by (etac (trans_rtrancl RS transD) 1);
-by (etac parcontract_imp_reduce 1);
-val parreduce_imp_reduce = result();
-
-goal ParContract.thy "p===>q <-> p--->q";
-by (REPEAT (ares_tac [iffI, parreduce_imp_reduce, reduce_imp_parreduce] 1));
-val parreduce_iff_reduce = result();
-
-writeln"Reached end of file.";
--- a/src/ZF/ex/Primrec0.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,395 +0,0 @@
-(*  Title: 	ZF/ex/primrec
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-Primitive Recursive Functions
-
-Proof adopted from
-Nora Szasz, 
-A Machine Checked Proof that Ackermann's Function is not Primitive Recursive,
-In: Huet & Plotkin, eds., Logical Environments (CUP, 1993), 317-338.
-
-See also E. Mendelson, Introduction to Mathematical Logic.
-(Van Nostrand, 1964), page 250, exercise 11.
-*)
-
-open Primrec0;
-
-val pr0_typechecks = 
-    nat_typechecks @ List.intrs @ 
-    [lam_type, list_case_type, drop_type, map_type, apply_type, rec_type];
-
-(** Useful special cases of evaluation ***)
-
-val pr0_ss = arith_ss 
-    addsimps List.case_eqns
-    addsimps [list_rec_Nil, list_rec_Cons, 
-	      drop_0, drop_Nil, drop_succ_Cons,
-	      map_Nil, map_Cons]
-    setsolver (type_auto_tac pr0_typechecks);
-
-goalw Primrec0.thy [SC_def]
-    "!!x l. [| x:nat;  l: list(nat) |] ==> SC ` (Cons(x,l)) = succ(x)";
-by (asm_simp_tac pr0_ss 1);
-val SC = result();
-
-goalw Primrec0.thy [CONST_def]
-    "!!l. [| l: list(nat) |] ==> CONST(k) ` l = k";
-by (asm_simp_tac pr0_ss 1);
-val CONST = result();
-
-goalw Primrec0.thy [PROJ_def]
-    "!!l. [| x: nat;  l: list(nat) |] ==> PROJ(0) ` (Cons(x,l)) = x";
-by (asm_simp_tac pr0_ss 1);
-val PROJ_0 = result();
-
-goalw Primrec0.thy [COMP_def]
-    "!!l. [| l: list(nat) |] ==> COMP(g,[f]) ` l = g` [f`l]";
-by (asm_simp_tac pr0_ss 1);
-val COMP_1 = result();
-
-goalw Primrec0.thy [PREC_def]
-    "!!l. l: list(nat) ==> PREC(f,g) ` (Cons(0,l)) = f`l";
-by (asm_simp_tac pr0_ss 1);
-val PREC_0 = result();
-
-goalw Primrec0.thy [PREC_def]
-    "!!l. [| x:nat;  l: list(nat) |] ==>  \
-\         PREC(f,g) ` (Cons(succ(x),l)) = \
-\         g ` Cons(PREC(f,g)`(Cons(x,l)), Cons(x,l))";
-by (asm_simp_tac pr0_ss 1);
-val PREC_succ = result();
-
-(*** Inductive definition of the PR functions ***)
-
-structure Primrec = Inductive_Fun
- (val thy        = Primrec0.thy
-  val thy_name   = "Primrec"
-  val rec_doms   = [("primrec", "list(nat)->nat")]
-  val sintrs     = 
-      ["SC : primrec",
-       "k: nat ==> CONST(k) : primrec",
-       "i: nat ==> PROJ(i) : primrec",
-       "[| g: primrec; fs: list(primrec) |] ==> COMP(g,fs): primrec",
-       "[| f: primrec; g: primrec |] ==> PREC(f,g): primrec"]
-  val monos      = [list_mono]
-  val con_defs   = [SC_def,CONST_def,PROJ_def,COMP_def,PREC_def]
-  val type_intrs = pr0_typechecks
-  val type_elims = []);
-
-
-(* c: primrec ==> c: list(nat) -> nat *)
-val primrec_into_fun = Primrec.dom_subset RS subsetD;
-
-val pr_ss = pr0_ss 
-    setsolver (type_auto_tac ([primrec_into_fun] @ 
-			      pr0_typechecks @ Primrec.intrs));
-
-goalw Primrec.thy [ACK_def] "!!i. i:nat ==> ACK(i): primrec";
-by (etac nat_induct 1);
-by (ALLGOALS (asm_simp_tac pr_ss));
-val ACK_in_primrec = result();
-
-val ack_typechecks =
-    [ACK_in_primrec, primrec_into_fun RS apply_type,
-     add_type, list_add_type, nat_into_Ord] @ 
-    nat_typechecks @ List.intrs @ Primrec.intrs;
-
-(*strict typechecking for the Ackermann proof; instantiates no vars*)
-fun tc_tac rls =
-    REPEAT
-      (SOMEGOAL (test_assume_tac ORELSE' match_tac (rls @ ack_typechecks)));
-
-goal Primrec.thy "!!i j. [| i:nat;  j:nat |] ==>  ack(i,j): nat";
-by (tc_tac []);
-val ack_type = result();
-
-(** Ackermann's function cases **)
-
-(*PROPERTY A 1*)
-goalw Primrec0.thy [ACK_def] "!!j. j:nat ==> ack(0,j) = succ(j)";
-by (asm_simp_tac (pr0_ss addsimps [SC]) 1);
-val ack_0 = result();
-
-(*PROPERTY A 2*)
-goalw Primrec0.thy [ACK_def] "ack(succ(i), 0) = ack(i,1)";
-by (asm_simp_tac (pr0_ss addsimps [CONST,PREC_0]) 1);
-val ack_succ_0 = result();
-
-(*PROPERTY A 3*)
-(*Could be proved in Primrec0, like the previous two cases, but using
-  primrec_into_fun makes type-checking easier!*)
-goalw Primrec.thy [ACK_def]
-    "!!i j. [| i:nat;  j:nat |] ==> \
-\           ack(succ(i), succ(j)) = ack(i, ack(succ(i), j))";
-by (asm_simp_tac (pr_ss addsimps [CONST,PREC_succ,COMP_1,PROJ_0]) 1);
-val ack_succ_succ = result();
-
-val ack_ss = 
-    pr_ss addsimps [ack_0, ack_succ_0, ack_succ_succ, 
-		    ack_type, nat_into_Ord];
-
-(*PROPERTY A 4*)
-goal Primrec.thy "!!i. i:nat ==> ALL j:nat. j < ack(i,j)";
-by (etac nat_induct 1);
-by (asm_simp_tac ack_ss 1);
-by (rtac ballI 1);
-by (eres_inst_tac [("n","j")] nat_induct 1);
-by (DO_GOAL [rtac (nat_0I RS nat_0_le RS lt_trans),
-	     asm_simp_tac ack_ss] 1);
-by (DO_GOAL [etac (succ_leI RS lt_trans1),
-	     asm_simp_tac ack_ss] 1);
-val lt_ack2_lemma = result();
-val lt_ack2 = standard (lt_ack2_lemma RS bspec);
-
-(*PROPERTY A 5-, the single-step lemma*)
-goal Primrec.thy "!!i j. [| i:nat; j:nat |] ==> ack(i,j) < ack(i, succ(j))";
-by (etac nat_induct 1);
-by (ALLGOALS (asm_simp_tac (ack_ss addsimps [lt_ack2])));
-val ack_lt_ack_succ2 = result();
-
-(*PROPERTY A 5, monotonicity for < *)
-goal Primrec.thy "!!i j k. [| j<k; i:nat; k:nat |] ==> ack(i,j) < ack(i,k)";
-by (forward_tac [lt_nat_in_nat] 1 THEN assume_tac 1);
-by (etac succ_lt_induct 1);
-by (assume_tac 1);
-by (rtac lt_trans 2);
-by (REPEAT (ares_tac ([ack_lt_ack_succ2, ack_type] @ pr0_typechecks) 1));
-val ack_lt_mono2 = result();
-
-(*PROPERTY A 5', monotonicity for le *)
-goal Primrec.thy
-    "!!i j k. [| j le k;  i: nat;  k:nat |] ==> ack(i,j) le ack(i,k)";
-by (res_inst_tac [("f", "%j.ack(i,j)")] Ord_lt_mono_imp_le_mono 1);
-by (REPEAT (ares_tac [ack_lt_mono2, ack_type RS nat_into_Ord] 1));
-val ack_le_mono2 = result();
-
-(*PROPERTY A 6*)
-goal Primrec.thy
-    "!!i j. [| i:nat;  j:nat |] ==> ack(i, succ(j)) le ack(succ(i), j)";
-by (nat_ind_tac "j" [] 1);
-by (ALLGOALS (asm_simp_tac ack_ss));
-by (rtac ack_le_mono2 1);
-by (rtac (lt_ack2 RS succ_leI RS le_trans) 1);
-by (REPEAT (ares_tac (ack_typechecks) 1));
-val ack2_le_ack1 = result();
-
-(*PROPERTY A 7-, the single-step lemma*)
-goal Primrec.thy "!!i j. [| i:nat; j:nat |] ==> ack(i,j) < ack(succ(i),j)";
-by (rtac (ack_lt_mono2 RS lt_trans2) 1);
-by (rtac ack2_le_ack1 4);
-by (REPEAT (ares_tac ([nat_le_refl, ack_type] @ pr0_typechecks) 1));
-val ack_lt_ack_succ1 = result();
-
-(*PROPERTY A 7, monotonicity for < *)
-goal Primrec.thy "!!i j k. [| i<j; j:nat; k:nat |] ==> ack(i,k) < ack(j,k)";
-by (forward_tac [lt_nat_in_nat] 1 THEN assume_tac 1);
-by (etac succ_lt_induct 1);
-by (assume_tac 1);
-by (rtac lt_trans 2);
-by (REPEAT (ares_tac ([ack_lt_ack_succ1, ack_type] @ pr0_typechecks) 1));
-val ack_lt_mono1 = result();
-
-(*PROPERTY A 7', monotonicity for le *)
-goal Primrec.thy
-    "!!i j k. [| i le j; j:nat; k:nat |] ==> ack(i,k) le ack(j,k)";
-by (res_inst_tac [("f", "%j.ack(j,k)")] Ord_lt_mono_imp_le_mono 1);
-by (REPEAT (ares_tac [ack_lt_mono1, ack_type RS nat_into_Ord] 1));
-val ack_le_mono1 = result();
-
-(*PROPERTY A 8*)
-goal Primrec.thy "!!j. j:nat ==> ack(1,j) = succ(succ(j))";
-by (etac nat_induct 1);
-by (ALLGOALS (asm_simp_tac ack_ss));
-val ack_1 = result();
-
-(*PROPERTY A 9*)
-goal Primrec.thy "!!j. j:nat ==> ack(succ(1),j) = succ(succ(succ(j#+j)))";
-by (etac nat_induct 1);
-by (ALLGOALS (asm_simp_tac (ack_ss addsimps [ack_1, add_succ_right])));
-val ack_2 = result();
-
-(*PROPERTY A 10*)
-goal Primrec.thy
-    "!!i1 i2 j. [| i1:nat; i2:nat; j:nat |] ==> \
-\               ack(i1, ack(i2,j)) < ack(succ(succ(i1#+i2)), j)";
-by (rtac (ack2_le_ack1 RSN (2,lt_trans2)) 1);
-by (asm_simp_tac ack_ss 1);
-by (rtac (add_le_self RS ack_le_mono1 RS lt_trans1) 1);
-by (rtac (add_le_self2 RS ack_lt_mono1 RS ack_lt_mono2) 5);
-by (tc_tac []);
-val ack_nest_bound = result();
-
-(*PROPERTY A 11*)
-goal Primrec.thy
-    "!!i1 i2 j. [| i1:nat; i2:nat; j:nat |] ==> \
-\          ack(i1,j) #+ ack(i2,j) < ack(succ(succ(succ(succ(i1#+i2)))), j)";
-by (res_inst_tac [("j", "ack(succ(1), ack(i1 #+ i2, j))")] lt_trans 1);
-by (asm_simp_tac (ack_ss addsimps [ack_2]) 1);
-by (rtac (ack_nest_bound RS lt_trans2) 2);
-by (asm_simp_tac ack_ss 5);
-by (rtac (add_le_mono RS leI RS leI) 1);
-by (REPEAT (ares_tac ([add_le_self, add_le_self2, ack_le_mono1] @
-                      ack_typechecks) 1));
-val ack_add_bound = result();
-
-(*PROPERTY A 12.  Article uses existential quantifier but the ALF proof
-  used k#+4.  Quantified version must be nested EX k'. ALL i,j... *)
-goal Primrec.thy
-    "!!i j k. [| i < ack(k,j);  j:nat;  k:nat |] ==> \
-\             i#+j < ack(succ(succ(succ(succ(k)))), j)";
-by (res_inst_tac [("j", "ack(k,j) #+ ack(0,j)")] lt_trans 1);
-by (rtac (ack_add_bound RS lt_trans2) 2);
-by (asm_simp_tac (ack_ss addsimps [add_0_right]) 5);
-by (REPEAT (ares_tac ([add_lt_mono, lt_ack2] @ ack_typechecks) 1));
-val ack_add_bound2 = result();
-
-(*** MAIN RESULT ***)
-
-val ack2_ss =
-    ack_ss addsimps [list_add_Nil, list_add_Cons, list_add_type, nat_into_Ord];
-
-goalw Primrec.thy [SC_def]
-    "!!l. l: list(nat) ==> SC ` l < ack(1, list_add(l))";
-by (etac List.elim 1);
-by (asm_simp_tac (ack2_ss addsimps [succ_iff]) 1);
-by (asm_simp_tac (ack2_ss addsimps [ack_1, add_le_self]) 1);
-val SC_case = result();
-
-(*PROPERTY A 4'? Extra lemma needed for CONST case, constant functions*)
-goal Primrec.thy "!!j. [| i:nat; j:nat |] ==> i < ack(i,j)";
-by (etac nat_induct 1);
-by (asm_simp_tac (ack_ss addsimps [nat_0_le]) 1);
-by (etac ([succ_leI, ack_lt_ack_succ1] MRS lt_trans1) 1);
-by (tc_tac []);
-val lt_ack1 = result();
-
-goalw Primrec.thy [CONST_def]
-    "!!l. [| l: list(nat);  k: nat |] ==> CONST(k) ` l < ack(k, list_add(l))";
-by (asm_simp_tac (ack2_ss addsimps [lt_ack1]) 1);
-val CONST_case = result();
-
-goalw Primrec.thy [PROJ_def]
-    "!!l. l: list(nat) ==> ALL i:nat. PROJ(i) ` l < ack(0, list_add(l))";
-by (asm_simp_tac ack2_ss 1);
-by (etac List.induct 1);
-by (asm_simp_tac (ack2_ss addsimps [nat_0_le]) 1);
-by (asm_simp_tac ack2_ss 1);
-by (rtac ballI 1);
-by (eres_inst_tac [("n","x")] natE 1);
-by (asm_simp_tac (ack2_ss addsimps [add_le_self]) 1);
-by (asm_simp_tac ack2_ss 1);
-by (etac (bspec RS lt_trans2) 1);
-by (rtac (add_le_self2 RS succ_leI) 2);
-by (tc_tac []);
-val PROJ_case_lemma = result();
-val PROJ_case = PROJ_case_lemma RS bspec;
-
-(** COMP case **)
-
-goal Primrec.thy
- "!!fs. fs : list({f: primrec .					\
-\              	   EX kf:nat. ALL l:list(nat). 			\
-\		    	      f`l < ack(kf, list_add(l))})	\
-\      ==> EX k:nat. ALL l: list(nat). 				\
-\                list_add(map(%f. f ` l, fs)) < ack(k, list_add(l))";
-by (etac List.induct 1);
-by (DO_GOAL [res_inst_tac [("x","0")] bexI,
-	     asm_simp_tac (ack2_ss addsimps [lt_ack1, nat_0_le]),
-	     resolve_tac nat_typechecks] 1);
-by (safe_tac ZF_cs);
-by (asm_simp_tac ack2_ss 1);
-by (rtac (ballI RS bexI) 1);
-by (rtac (add_lt_mono RS lt_trans) 1);
-by (REPEAT (FIRSTGOAL (etac bspec)));
-by (rtac ack_add_bound 5);
-by (tc_tac []);
-val COMP_map_lemma = result();
-
-goalw Primrec.thy [COMP_def]
- "!!g. [| g: primrec;  kg: nat;					\
-\         ALL l:list(nat). g`l < ack(kg, list_add(l));		\
-\         fs : list({f: primrec .				\
-\                    EX kf:nat. ALL l:list(nat). 		\
-\		    	f`l < ack(kf, list_add(l))}) 		\
-\      |] ==> EX k:nat. ALL l: list(nat). COMP(g,fs)`l < ack(k, list_add(l))";
-by (asm_simp_tac ZF_ss 1);
-by (forward_tac [list_CollectD] 1);
-by (etac (COMP_map_lemma RS bexE) 1);
-by (rtac (ballI RS bexI) 1);
-by (etac (bspec RS lt_trans) 1);
-by (rtac lt_trans 2);
-by (rtac ack_nest_bound 3);
-by (etac (bspec RS ack_lt_mono2) 2);
-by (tc_tac [map_type]);
-val COMP_case = result();
-
-(** PREC case **)
-
-goalw Primrec.thy [PREC_def]
- "!!f g. [| ALL l:list(nat). f`l #+ list_add(l) < ack(kf, list_add(l));	\
-\           ALL l:list(nat). g`l #+ list_add(l) < ack(kg, list_add(l));	\
-\           f: primrec;  kf: nat;					\
-\           g: primrec;  kg: nat;					\
-\           l: list(nat)						\
-\        |] ==> PREC(f,g)`l #+ list_add(l) < ack(succ(kf#+kg), list_add(l))";
-by (etac List.elim 1);
-by (asm_simp_tac (ack2_ss addsimps [[nat_le_refl, lt_ack2] MRS lt_trans]) 1);
-by (asm_simp_tac ack2_ss 1);
-by (etac ssubst 1);  (*get rid of the needless assumption*)
-by (eres_inst_tac [("n","a")] nat_induct 1);
-(*base case*)
-by (DO_GOAL [asm_simp_tac ack2_ss, rtac lt_trans, etac bspec,
-	     assume_tac, rtac (add_le_self RS ack_lt_mono1),
-	     REPEAT o ares_tac (ack_typechecks)] 1);
-(*ind step*)
-by (asm_simp_tac (ack2_ss addsimps [add_succ_right]) 1);
-by (rtac (succ_leI RS lt_trans1) 1);
-by (res_inst_tac [("j", "g ` ?ll #+ ?mm")] lt_trans1 1);
-by (etac bspec 2);
-by (rtac (nat_le_refl RS add_le_mono) 1);
-by (tc_tac []);
-by (asm_simp_tac (ack2_ss addsimps [add_le_self2]) 1);
-(*final part of the simplification*)
-by (asm_simp_tac ack2_ss 1);
-by (rtac (add_le_self2 RS ack_le_mono1 RS lt_trans1) 1);
-by (etac ack_lt_mono2 5);
-by (tc_tac []);
-val PREC_case_lemma = result();
-
-goal Primrec.thy
- "!!f g. [| f: primrec;  kf: nat;				\
-\           g: primrec;  kg: nat;				\
-\           ALL l:list(nat). f`l < ack(kf, list_add(l));	\
-\           ALL l:list(nat). g`l < ack(kg, list_add(l)) 	\
-\        |] ==> EX k:nat. ALL l: list(nat). 			\
-\		    PREC(f,g)`l< ack(k, list_add(l))";
-by (rtac (ballI RS bexI) 1);
-by (rtac ([add_le_self, PREC_case_lemma] MRS lt_trans1) 1);
-by (REPEAT
-    (SOMEGOAL
-     (FIRST' [test_assume_tac,
-	      match_tac (ack_typechecks),
-	      rtac (ack_add_bound2 RS ballI) THEN' etac bspec])));
-val PREC_case = result();
-
-goal Primrec.thy
-    "!!f. f:primrec ==> EX k:nat. ALL l:list(nat). f`l < ack(k, list_add(l))";
-by (etac Primrec.induct 1);
-by (safe_tac ZF_cs);
-by (DEPTH_SOLVE
-    (ares_tac ([SC_case, CONST_case, PROJ_case, COMP_case, PREC_case,
-		       bexI, ballI] @ nat_typechecks) 1));
-val ack_bounds_primrec = result();
-
-goal Primrec.thy
-    "~ (lam l:list(nat). list_case(0, %x xs. ack(x,x), l)) : primrec";
-by (rtac notI 1);
-by (etac (ack_bounds_primrec RS bexE) 1);
-by (rtac lt_irrefl 1);
-by (dres_inst_tac [("x", "[x]")] bspec 1);
-by (asm_simp_tac ack2_ss 1);
-by (asm_full_simp_tac (ack2_ss addsimps [add_0_right]) 1);
-val ack_not_primrec = result();
-
--- a/src/ZF/ex/Primrec0.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-(*  Title: 	ZF/ex/primrec.thy
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-Primitive Recursive Functions
-
-Proof adopted from
-Nora Szasz, 
-A Machine Checked Proof that Ackermann's Function is not Primitive Recursive,
-In: Huet & Plotkin, eds., Logical Environments (CUP, 1993), 317-338.
-
-See also E. Mendelson, Introduction to Mathematical Logic.
-(Van Nostrand, 1964), page 250, exercise 11.
-*)
-
-Primrec0 = ListFn +
-consts
-    SC      :: "i"
-    CONST   :: "i=>i"
-    PROJ    :: "i=>i"
-    COMP    :: "[i,i]=>i"
-    PREC    :: "[i,i]=>i"
-    primrec :: "i"
-    ACK	    :: "i=>i"
-    ack	    :: "[i,i]=>i"
-
-translations
-  "ack(x,y)"  == "ACK(x) ` [y]"
-
-rules
-
-  SC_def    "SC == lam l:list(nat).list_case(0, %x xs.succ(x), l)"
-
-  CONST_def "CONST(k) == lam l:list(nat).k"
-
-  PROJ_def  "PROJ(i) == lam l:list(nat). list_case(0, %x xs.x, drop(i,l))"
-
-  COMP_def  "COMP(g,fs) == lam l:list(nat). g ` map(%f. f`l, fs)"
-
-  (*Note that g is applied first to PREC(f,g)`y and then to y!*)
-  PREC_def  "PREC(f,g) == \
-\            lam l:list(nat). list_case(0, \
-\                      %x xs. rec(x, f`xs, %y r. g ` Cons(r, Cons(y, xs))), l)"
-  
-  ACK_def   "ACK(i) == rec(i, SC, \
-\                      %z r. PREC (CONST (r`[1]), COMP(r,[PROJ(0)])))"
-
-end
--- a/src/ZF/ex/Prop.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-(*  Title: 	ZF/ex/prop.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson
-    Copyright   1993  University of Cambridge
-
-Datatype definition of propositional logic formulae and inductive definition
-of the propositional tautologies.
-*)
-
-(*Example of a datatype with mixfix syntax for some constructors*)
-structure Prop = Datatype_Fun
- (val thy = Univ.thy;
-  val thy_name = "Prop";
-  val rec_specs = 
-      [("prop", "univ(0)",
-	  [(["Fls"],	"i",NoSyn),
-	   (["Var"],	"i=>i", Mixfix ("#_", [100], 100)),
-	   (["=>"],	"[i,i]=>i", Infixr 90)])];
-  val rec_styp = "i";
-  val sintrs = 
-	  ["Fls : prop",
-	   "n: nat ==> #n : prop",
-	   "[| p: prop;  q: prop |] ==> p=>q : prop"];
-  val monos = [];
-  val type_intrs = datatype_intrs;
-  val type_elims = []);
-
-val [FlsI,VarI,ImpI] = Prop.intrs;
-
-
-(** Type-checking rules **)
-
-val ImpE = Prop.mk_cases Prop.con_defs "p=>q : prop";
-
-writeln"Reached end of file.";
--- a/src/ZF/ex/TF_Fn.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,225 +0,0 @@
-(*  Title: 	ZF/ex/tf.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1992  University of Cambridge
-
-For tf.thy.  Trees & forests, a mutually recursive type definition.
-
-Still needs
-
-"TF_reflect == (%z. TF_rec(z, %x ts r. Tcons(x,r), 0, 
-               %t ts r1 r2. TF_of_list(list_of_TF(r2) @ <r1,0>)))"
-*)
-
-open TF_Fn;
-
-
-(*** TF_rec -- by Vset recursion ***)
-
-(** conversion rules **)
-
-goal TF_Fn.thy "TF_rec(Tcons(a,f), b, c, d) = b(a, f, TF_rec(f,b,c,d))";
-by (rtac (TF_rec_def RS def_Vrec RS trans) 1);
-by (rewrite_goals_tac TF.con_defs);
-by (simp_tac rank_ss 1);
-val TF_rec_Tcons = result();
-
-goal TF_Fn.thy "TF_rec(Fnil, b, c, d) = c";
-by (rtac (TF_rec_def RS def_Vrec RS trans) 1);
-by (rewrite_goals_tac TF.con_defs);
-by (simp_tac rank_ss 1);
-val TF_rec_Fnil = result();
-
-goal TF_Fn.thy "TF_rec(Fcons(t,f), b, c, d) = \
-\      d(t, f, TF_rec(t, b, c, d), TF_rec(f, b, c, d))";
-by (rtac (TF_rec_def RS def_Vrec RS trans) 1);
-by (rewrite_goals_tac TF.con_defs);
-by (simp_tac rank_ss 1);
-val TF_rec_Fcons = result();
-
-(*list_ss includes list operations as well as arith_ss*)
-val TF_rec_ss = list_ss addsimps
-  [TF_rec_Tcons, TF_rec_Fnil, TF_rec_Fcons, TconsI, FnilI, FconsI];
-
-(** Type checking **)
-
-val major::prems = goal TF_Fn.thy
-    "[| z: tree_forest(A);  \
-\       !!x f r. [| x: A;  f: forest(A);  r: C(f) 		\
-\                 |] ==> b(x,f,r): C(Tcons(x,f));     	\
-\	c : C(Fnil);        					\
-\       !!t f r1 r2. [| t: tree(A);  f: forest(A);  r1: C(t); r2: C(f) \
-\                     |] ==> d(t,f,r1,r2): C(Fcons(t,f))    	\
-\    |] ==> TF_rec(z,b,c,d) : C(z)";
-by (rtac (major RS TF.induct) 1);
-by (ALLGOALS (asm_simp_tac (TF_rec_ss addsimps prems)));
-val TF_rec_type = result();
-
-(*Mutually recursive version*)
-val prems = goal TF_Fn.thy
-    "[| !!x f r. [| x: A;  f: forest(A);  r: D(f) 		\
-\                 |] ==> b(x,f,r): C(Tcons(x,f));    	 	\
-\	c : D(Fnil);        					\
-\       !!t f r1 r2. [| t: tree(A);  f: forest(A);  r1: C(t); r2: D(f) \
-\                     |] ==> d(t,f,r1,r2): D(Fcons(t,f))    	\
-\    |] ==> (ALL t:tree(A).    TF_rec(t,b,c,d)  : C(t)) &  	\
-\           (ALL f: forest(A). TF_rec(f,b,c,d) : D(f))";
-by (rewtac Ball_def);
-by (rtac TF.mutual_induct 1);
-by (ALLGOALS (asm_simp_tac (TF_rec_ss addsimps prems)));
-val tree_forest_rec_type = result();
-
-
-(** Versions for use with definitions **)
-
-val [rew] = goal TF_Fn.thy
-    "[| !!z. j(z)==TF_rec(z,b,c,d) |] ==> j(Tcons(a,f)) = b(a,f,j(f))";
-by (rewtac rew);
-by (rtac TF_rec_Tcons 1);
-val def_TF_rec_Tcons = result();
-
-val [rew] = goal TF_Fn.thy
-    "[| !!z. j(z)==TF_rec(z,b,c,d) |] ==> j(Fnil) = c";
-by (rewtac rew);
-by (rtac TF_rec_Fnil 1);
-val def_TF_rec_Fnil = result();
-
-val [rew] = goal TF_Fn.thy
-    "[| !!z. j(z)==TF_rec(z,b,c,d) |] ==> j(Fcons(t,f)) = d(t,f,j(t),j(f))";
-by (rewtac rew);
-by (rtac TF_rec_Fcons 1);
-val def_TF_rec_Fcons = result();
-
-fun TF_recs def = map standard 
-    	([def] RL [def_TF_rec_Tcons, def_TF_rec_Fnil, def_TF_rec_Fcons]);
-
-
-(** list_of_TF and TF_of_list **)
-
-val [list_of_TF_Tcons, list_of_TF_Fnil, list_of_TF_Fcons] =
-	TF_recs list_of_TF_def;
-
-goalw TF_Fn.thy [list_of_TF_def]
-    "!!z A. z: tree_forest(A) ==> list_of_TF(z) : list(tree(A))";
-by (REPEAT (ares_tac ([TF_rec_type,TconsI] @ list_typechecks) 1));
-val list_of_TF_type = result();
-
-val [TF_of_list_Nil,TF_of_list_Cons] = list_recs TF_of_list_def;
-
-goalw TF_Fn.thy [TF_of_list_def] 
-    "!!l A. l: list(tree(A)) ==> TF_of_list(l) : forest(A)";
-by (REPEAT (ares_tac [list_rec_type, FnilI, FconsI] 1));
-val TF_of_list_type = result();
-
-
-(** TF_map **)
-
-val [TF_map_Tcons, TF_map_Fnil, TF_map_Fcons] = TF_recs TF_map_def;
-
-val prems = goalw TF_Fn.thy [TF_map_def]
-    "[| !!x. x: A ==> h(x): B |] ==> \
-\      (ALL t:tree(A). TF_map(h,t) : tree(B)) &  \
-\      (ALL f: forest(A). TF_map(h,f) : forest(B))";
-by (REPEAT
-    (ares_tac ([tree_forest_rec_type, TconsI, FnilI, FconsI] @ prems) 1));
-val TF_map_type = result();
-
-
-(** TF_size **)
-
-val [TF_size_Tcons, TF_size_Fnil, TF_size_Fcons] = TF_recs TF_size_def;
-
-goalw TF_Fn.thy [TF_size_def]
-    "!!z A. z: tree_forest(A) ==> TF_size(z) : nat";
-by (REPEAT (ares_tac [TF_rec_type, add_type, nat_0I, nat_succI] 1));
-val TF_size_type = result();
-
-
-(** TF_preorder **)
-
-val [TF_preorder_Tcons, TF_preorder_Fnil, TF_preorder_Fcons] =
-	TF_recs TF_preorder_def;
-
-goalw TF_Fn.thy [TF_preorder_def]
-    "!!z A. z: tree_forest(A) ==> TF_preorder(z) : list(A)";
-by (REPEAT (ares_tac [TF_rec_type, app_type,NilI, ConsI] 1));
-val TF_preorder_type = result();
-
-
-(** Term simplification **)
-
-val treeI = tree_subset_TF RS subsetD
-and forestI = forest_subset_TF RS subsetD;
-
-val TF_typechecks =
-    [TconsI, FnilI, FconsI, treeI, forestI,
-     list_of_TF_type, TF_map_type, TF_size_type, TF_preorder_type];
-
-val TF_rewrites =
-   [TF_rec_Tcons, TF_rec_Fnil, TF_rec_Fcons,
-    list_of_TF_Tcons, list_of_TF_Fnil, list_of_TF_Fcons,
-    TF_of_list_Nil,TF_of_list_Cons,
-    TF_map_Tcons, TF_map_Fnil, TF_map_Fcons,
-    TF_size_Tcons, TF_size_Fnil, TF_size_Fcons,
-    TF_preorder_Tcons, TF_preorder_Fnil, TF_preorder_Fcons];
-
-val TF_ss = list_ss addsimps TF_rewrites
-                    setsolver type_auto_tac (list_typechecks@TF_typechecks);
-
-(** theorems about list_of_TF and TF_of_list **)
-
-(*essentially the same as list induction*)
-val major::prems = goal TF_Fn.thy 
-    "[| f: forest(A);  	\
-\       R(Fnil);        \
-\       !!t f. [| t: tree(A);  f: forest(A);  R(f) |] ==> R(Fcons(t,f))  \
-\    |] ==> R(f)";
-by (rtac (major RS (TF.mutual_induct RS conjunct2 RS spec RSN (2,rev_mp))) 1);
-by (REPEAT (ares_tac (TrueI::prems) 1));
-val forest_induct = result();
-
-goal TF_Fn.thy "!!f A. f: forest(A) ==> TF_of_list(list_of_TF(f)) = f";
-by (etac forest_induct 1);
-by (ALLGOALS (asm_simp_tac TF_ss));
-val forest_iso = result();
-
-goal TF_Fn.thy
-    "!!ts. ts: list(tree(A)) ==> list_of_TF(TF_of_list(ts)) = ts";
-by (etac List.induct 1);
-by (ALLGOALS (asm_simp_tac TF_ss));
-val tree_list_iso = result();
-
-(** theorems about TF_map **)
-
-goal TF_Fn.thy "!!z A. z: tree_forest(A) ==> TF_map(%u.u, z) = z";
-by (etac TF.induct 1);
-by (ALLGOALS (asm_simp_tac TF_ss));
-val TF_map_ident = result();
-
-goal TF_Fn.thy
- "!!z A. z: tree_forest(A) ==> TF_map(h, TF_map(j,z)) = TF_map(%u.h(j(u)), z)";
-by (etac TF.induct 1);
-by (ALLGOALS (asm_simp_tac TF_ss));
-val TF_map_compose = result();
-
-(** theorems about TF_size **)
-
-goal TF_Fn.thy
-    "!!z A. z: tree_forest(A) ==> TF_size(TF_map(h,z)) = TF_size(z)";
-by (etac TF.induct 1);
-by (ALLGOALS (asm_simp_tac TF_ss));
-val TF_size_TF_map = result();
-
-goal TF_Fn.thy
-    "!!z A. z: tree_forest(A) ==> TF_size(z) = length(TF_preorder(z))";
-by (etac TF.induct 1);
-by (ALLGOALS (asm_simp_tac (TF_ss addsimps [length_app])));
-val TF_size_length = result();
-
-(** theorems about TF_preorder **)
-
-goal TF_Fn.thy "!!z A. z: tree_forest(A) ==> \
-\                      TF_preorder(TF_map(h,z)) = map(h, TF_preorder(z))";
-by (etac TF.induct 1);
-by (ALLGOALS (asm_simp_tac (TF_ss addsimps [map_app_distrib])));
-val TF_preorder_TF_map = result();
--- a/src/ZF/ex/TF_Fn.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-(*  Title: 	ZF/ex/TF.thy
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-Trees & forests, a mutually recursive type definition.
-*)
-
-TF_Fn = TF + ListFn +
-consts
-  TF_rec	 ::	"[i, [i,i,i]=>i, i, [i,i,i,i]=>i] => i"
-  TF_map      	 ::      "[i=>i, i] => i"
-  TF_size 	 ::      "i=>i"
-  TF_preorder 	 ::      "i=>i"
-  list_of_TF 	 ::      "i=>i"
-  TF_of_list 	 ::      "i=>i"
-
-rules
-  TF_rec_def
-    "TF_rec(z,b,c,d) == Vrec(z,  			\
-\      %z r. tree_forest_case(%x f. b(x, f, r`f), 	\
-\                             c, 			\
-\		              %t f. d(t, f, r`t, r`f), z))"
-
-  list_of_TF_def
-    "list_of_TF(z) == TF_rec(z, %x f r. [Tcons(x,f)], [], \
-\		             %t f r1 r2. Cons(t, r2))"
-
-  TF_of_list_def
-    "TF_of_list(f) == list_rec(f, Fnil,  %t f r. Fcons(t,r))"
-
-  TF_map_def
-    "TF_map(h,z) == TF_rec(z, %x f r.Tcons(h(x),r), Fnil, \
-\                           %t f r1 r2. Fcons(r1,r2))"
-
-  TF_size_def
-    "TF_size(z) == TF_rec(z, %x f r.succ(r), 0, %t f r1 r2. r1#+r2)"
-
-  TF_preorder_def
-    "TF_preorder(z) == TF_rec(z, %x f r.Cons(x,r), Nil, %t f r1 r2. r1@r2)"
-
-end
--- a/src/ZF/ex/TermFn.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +0,0 @@
-(*  Title: 	ZF/ex/term
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1992  University of Cambridge
-
-Terms over a given alphabet -- function applications; illustrates list functor
-  (essentially the same type as in Trees & Forests)
-*)
-
-writeln"File ZF/ex/term-fn.";
-
-open TermFn;
-
-(*** term_rec -- by Vset recursion ***)
-
-(*Lemma: map works correctly on the underlying list of terms*)
-val [major,ordi] = goal ListFn.thy
-    "[| l: list(A);  Ord(i) |] ==>  \
-\    rank(l)<i --> map(%z. (lam x:Vset(i).h(x)) ` z, l) = map(h,l)";
-by (rtac (major RS List.induct) 1);
-by (simp_tac list_ss 1);
-by (rtac impI 1);
-by (forward_tac [rank_Cons1 RS lt_trans] 1);
-by (dtac (rank_Cons2 RS lt_trans) 1);
-by (asm_simp_tac (list_ss addsimps [ordi, VsetI]) 1);
-val map_lemma = result();
-
-(*Typing premise is necessary to invoke map_lemma*)
-val [prem] = goal TermFn.thy
-    "ts: list(A) ==> \
-\    term_rec(Apply(a,ts), d) = d(a, ts, map (%z. term_rec(z,d), ts))";
-by (rtac (term_rec_def RS def_Vrec RS trans) 1);
-by (rewrite_goals_tac Term.con_defs);
-val term_rec_ss = ZF_ss addsimps [Ord_rank, rank_pair2, prem RS map_lemma];
-by (simp_tac term_rec_ss 1);
-val term_rec = result();
-
-(*Slightly odd typing condition on r in the second premise!*)
-val major::prems = goal TermFn.thy
-    "[| t: term(A);					\
-\       !!x zs r. [| x: A;  zs: list(term(A)); 		\
-\                    r: list(UN t:term(A). C(t)) |]	\
-\                 ==> d(x, zs, r): C(Apply(x,zs))  	\
-\    |] ==> term_rec(t,d) : C(t)";
-by (rtac (major RS Term.induct) 1);
-by (forward_tac [list_CollectD] 1);
-by (rtac (term_rec RS ssubst) 1);
-by (REPEAT (ares_tac prems 1));
-by (etac List.induct 1);
-by (ALLGOALS (asm_simp_tac (list_ss addsimps [term_rec])));
-by (etac CollectE 1);
-by (REPEAT (ares_tac [ConsI, UN_I] 1));
-val term_rec_type = result();
-
-val [rew,tslist] = goal TermFn.thy
-    "[| !!t. j(t)==term_rec(t,d);  ts: list(A) |] ==> \
-\    j(Apply(a,ts)) = d(a, ts, map(%Z.j(Z), ts))";
-by (rewtac rew);
-by (rtac (tslist RS term_rec) 1);
-val def_term_rec = result();
-
-val prems = goal TermFn.thy
-    "[| t: term(A);					     \
-\       !!x zs r. [| x: A;  zs: list(term(A));  r: list(C) |]  \
-\                 ==> d(x, zs, r): C  		     \
-\    |] ==> term_rec(t,d) : C";
-by (REPEAT (ares_tac (term_rec_type::prems) 1));
-by (etac (subset_refl RS UN_least RS list_mono RS subsetD) 1);
-val term_rec_simple_type = result();
-
-
-(** term_map **)
-
-val term_map = standard (term_map_def RS def_term_rec);
-
-val prems = goalw TermFn.thy [term_map_def]
-    "[| t: term(A);  !!x. x: A ==> f(x): B |] ==> term_map(f,t) : term(B)";
-by (REPEAT (ares_tac ([term_rec_simple_type, ApplyI] @ prems) 1));
-val term_map_type = result();
-
-val [major] = goal TermFn.thy
-    "t: term(A) ==> term_map(f,t) : term({f(u). u:A})";
-by (rtac (major RS term_map_type) 1);
-by (etac RepFunI 1);
-val term_map_type2 = result();
-
-
-(** term_size **)
-
-val term_size = standard (term_size_def RS def_term_rec);
-
-goalw TermFn.thy [term_size_def] "!!t A. t: term(A) ==> term_size(t) : nat";
-by (REPEAT (ares_tac [term_rec_simple_type, list_add_type, nat_succI] 1));
-val term_size_type = result();
-
-
-(** reflect **)
-
-val reflect = standard (reflect_def RS def_term_rec);
-
-goalw TermFn.thy [reflect_def] "!!t A. t: term(A) ==> reflect(t) : term(A)";
-by (REPEAT (ares_tac [term_rec_simple_type, rev_type, ApplyI] 1));
-val reflect_type = result();
-
-(** preorder **)
-
-val preorder = standard (preorder_def RS def_term_rec);
-
-goalw TermFn.thy [preorder_def]
-    "!!t A. t: term(A) ==> preorder(t) : list(A)";
-by (REPEAT (ares_tac [term_rec_simple_type, ConsI, flat_type] 1));
-val preorder_type = result();
-
-
-(** Term simplification **)
-
-val term_typechecks =
-    [ApplyI, term_map_type, term_map_type2, term_size_type, reflect_type, 
-     preorder_type];
-
-(*map_type2 and term_map_type2 instantiate variables*)
-val term_ss = list_ss 
-      addsimps [term_rec, term_map, term_size, reflect, preorder]
-      setsolver type_auto_tac (list_typechecks@term_typechecks);
-
-
-(** theorems about term_map **)
-
-goal TermFn.thy "!!t A. t: term(A) ==> term_map(%u.u, t) = t";
-by (etac term_induct_eqn 1);
-by (asm_simp_tac (term_ss addsimps [map_ident]) 1);
-val term_map_ident = result();
-
-goal TermFn.thy
-  "!!t A. t: term(A) ==> term_map(f, term_map(g,t)) = term_map(%u.f(g(u)), t)";
-by (etac term_induct_eqn 1);
-by (asm_simp_tac (term_ss addsimps [map_compose]) 1);
-val term_map_compose = result();
-
-goal TermFn.thy
-    "!!t A. t: term(A) ==> term_map(f, reflect(t)) = reflect(term_map(f,t))";
-by (etac term_induct_eqn 1);
-by (asm_simp_tac (term_ss addsimps [rev_map_distrib RS sym, map_compose]) 1);
-val term_map_reflect = result();
-
-
-(** theorems about term_size **)
-
-goal TermFn.thy
-    "!!t A. t: term(A) ==> term_size(term_map(f,t)) = term_size(t)";
-by (etac term_induct_eqn 1);
-by (asm_simp_tac (term_ss addsimps [map_compose]) 1);
-val term_size_term_map = result();
-
-goal TermFn.thy "!!t A. t: term(A) ==> term_size(reflect(t)) = term_size(t)";
-by (etac term_induct_eqn 1);
-by (asm_simp_tac (term_ss addsimps [rev_map_distrib RS sym, map_compose,
-				    list_add_rev]) 1);
-val term_size_reflect = result();
-
-goal TermFn.thy "!!t A. t: term(A) ==> term_size(t) = length(preorder(t))";
-by (etac term_induct_eqn 1);
-by (asm_simp_tac (term_ss addsimps [length_flat, map_compose]) 1);
-val term_size_length = result();
-
-
-(** theorems about reflect **)
-
-goal TermFn.thy "!!t A. t: term(A) ==> reflect(reflect(t)) = t";
-by (etac term_induct_eqn 1);
-by (asm_simp_tac (term_ss addsimps [rev_map_distrib, map_compose,
-				    map_ident, rev_rev_ident]) 1);
-val reflect_reflect_ident = result();
-
-
-(** theorems about preorder **)
-
-goal TermFn.thy
-    "!!t A. t: term(A) ==> preorder(term_map(f,t)) = map(f, preorder(t))";
-by (etac term_induct_eqn 1);
-by (asm_simp_tac (term_ss addsimps [map_compose, map_flat]) 1);
-val preorder_term_map = result();
-
-(** preorder(reflect(t)) = rev(postorder(t)) **)
-
-writeln"Reached end of file.";
--- a/src/ZF/ex/TermFn.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-(*  Title: 	ZF/ex/term-fn.thy
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-Terms over an alphabet.
-Illustrates the list functor (essentially the same type as in Trees & Forests)
-*)
-
-TermFn = Term + ListFn +
-consts
-    term_rec    :: "[i, [i,i,i]=>i] => i"
-    term_map    :: "[i=>i, i] => i"
-    term_size   :: "i=>i"
-    reflect     :: "i=>i"
-    preorder    :: "i=>i"
-
-rules
-  term_rec_def
-   "term_rec(t,d) == \
-\   Vrec(t, %t g. term_case(%x zs. d(x, zs, map(%z.g`z, zs)), t))"
-
-  term_map_def	"term_map(f,t) == term_rec(t, %x zs rs. Apply(f(x), rs))"
-
-  term_size_def	"term_size(t) == term_rec(t, %x zs rs. succ(list_add(rs)))"
-
-  reflect_def	"reflect(t) == term_rec(t, %x zs rs. Apply(x, rev(rs)))"
-
-  preorder_def	"preorder(t) == term_rec(t, %x zs rs. Cons(x, flat(rs)))"
-
-end
--- a/src/ZF/ex/acc.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-(*  Title: 	ZF/ex/acc
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-Inductive definition of acc(r)
-
-See Ch. Paulin-Mohring, Inductive Definitions in the System Coq.
-Research Report 92-49, LIP, ENS Lyon.  Dec 1992.
-*)
-
-structure Acc = Inductive_Fun
- (val thy        = WF.thy addconsts [(["acc"],"i=>i")]
-  val rec_doms   = [("acc", "field(r)")]
-  val sintrs     = ["[| r-``{a}: Pow(acc(r)); a: field(r) |] ==> a: acc(r)"]
-  val monos      = [Pow_mono]
-  val con_defs   = []
-  val type_intrs = []
-  val type_elims = []);
-
-goal Acc.thy "!!a b r. [| b: acc(r);  <a,b>: r |] ==> a: acc(r)";
-by (etac Acc.elim 1);
-by (fast_tac ZF_cs 1);
-val acc_downward = result();
-
-val [major] = goal Acc.thy "field(r) <= acc(r) ==> wf(r)";
-by (rtac (major RS wfI2) 1);
-by (rtac subsetI 1);
-by (etac Acc.induct 1);
-by (etac (bspec RS mp) 1);
-by (resolve_tac Acc.intrs 1);
-by (assume_tac 2);
-by (ALLGOALS (fast_tac ZF_cs));
-val acc_wfI = result();
-
-goal ZF.thy "!!r A. field(r Int A*A) <= field(r) Int A";
-by (fast_tac ZF_cs 1);
-val field_Int_prodself = result();
-
-goal Acc.thy "wf(r Int (acc(r)*acc(r)))";
-by (rtac (field_Int_prodself RS wfI2) 1);
-by (rtac subsetI 1);
-by (etac IntE 1);
-by (etac Acc.induct 1);
-by (etac (bspec RS mp) 1);
-by (rtac IntI 1);
-by (assume_tac 1);
-by (resolve_tac Acc.intrs 1);
-by (assume_tac 2);
-by (ALLGOALS (fast_tac ZF_cs));
-val wf_acc_Int = result();
-
-val [major] = goal Acc.thy "wf(r) ==> field(r) <= acc(r)";
-by (rtac subsetI 1);
-by (etac (major RS wf_induct2) 1);
-by (rtac subset_refl 1);
-by (resolve_tac Acc.intrs 1);
-by (assume_tac 2);
-by (fast_tac ZF_cs 1);
-val acc_wfD = result();
-
-goal Acc.thy "wf(r) <-> field(r) <= acc(r)";
-by (EVERY1 [rtac iffI, etac acc_wfD, etac acc_wfI]);
-val wf_acc_iff = result();
--- a/src/ZF/ex/bin.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-(*  Title: 	ZF/ex/bin.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-Datatype of binary integers
-*)
-
-(*Example of a datatype with an infix constructor*)
-structure Bin = Datatype_Fun
- (val thy = Univ.thy;
-  val rec_specs = 
-      [("bin", "univ(0)",
-	  [(["Plus", "Minus"],	"i"),
-	   (["op $$"],		"[i,i]=>i")])];
-  val rec_styp = "i";
-  val ext = Some (Syntax.simple_sext [Infixl("$$", "[i,i] => i", 60)]);
-  val sintrs = 
-	  ["Plus : bin",
-	   "Minus : bin",
-	   "[| w: bin;  b: bool |] ==> w$$b : bin"];
-  val monos = [];
-  val type_intrs = datatype_intrs @ [bool_into_univ];
-  val type_elims = []);
-
-(*Perform induction on l, then prove the major premise using prems. *)
-fun bin_ind_tac a prems i = 
-    EVERY [res_inst_tac [("x",a)] Bin.induct i,
-	   rename_last_tac a ["1"] (i+3),
-	   ares_tac prems i];
-
--- a/src/ZF/ex/binfn.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,450 +0,0 @@
-(*  Title: 	ZF/ex/bin.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-For bin.thy.  Arithmetic on binary integers.
-*)
-
-open BinFn;
-
-
-(** bin_rec -- by Vset recursion **)
-
-goal BinFn.thy "bin_rec(Plus,a,b,h) = a";
-by (rtac (bin_rec_def RS def_Vrec RS trans) 1);
-by (rewrite_goals_tac Bin.con_defs);
-by (simp_tac rank_ss 1);
-val bin_rec_Plus = result();
-
-goal BinFn.thy "bin_rec(Minus,a,b,h) = b";
-by (rtac (bin_rec_def RS def_Vrec RS trans) 1);
-by (rewrite_goals_tac Bin.con_defs);
-by (simp_tac rank_ss 1);
-val bin_rec_Minus = result();
-
-goal BinFn.thy "bin_rec(w$$x,a,b,h) = h(w, x, bin_rec(w,a,b,h))";
-by (rtac (bin_rec_def RS def_Vrec RS trans) 1);
-by (rewrite_goals_tac Bin.con_defs);
-by (simp_tac rank_ss 1);
-val bin_rec_Bcons = result();
-
-(*Type checking*)
-val prems = goal BinFn.thy
-    "[| w: bin;    \
-\       a: C(Plus);   b: C(Minus);       \
-\       !!w x r. [| w: bin;  x: bool;  r: C(w) |] ==> h(w,x,r): C(w$$x)  \
-\    |] ==> bin_rec(w,a,b,h) : C(w)";
-by (bin_ind_tac "w" prems 1);
-by (ALLGOALS 
-    (asm_simp_tac (ZF_ss addsimps (prems@[bin_rec_Plus,bin_rec_Minus,
-					 bin_rec_Bcons]))));
-val bin_rec_type = result();
-
-(** Versions for use with definitions **)
-
-val [rew] = goal BinFn.thy
-    "[| !!w. j(w)==bin_rec(w,a,b,h) |] ==> j(Plus) = a";
-by (rewtac rew);
-by (rtac bin_rec_Plus 1);
-val def_bin_rec_Plus = result();
-
-val [rew] = goal BinFn.thy
-    "[| !!w. j(w)==bin_rec(w,a,b,h) |] ==> j(Minus) = b";
-by (rewtac rew);
-by (rtac bin_rec_Minus 1);
-val def_bin_rec_Minus = result();
-
-val [rew] = goal BinFn.thy
-    "[| !!w. j(w)==bin_rec(w,a,b,h) |] ==> j(w$$x) = h(w,x,j(w))";
-by (rewtac rew);
-by (rtac bin_rec_Bcons 1);
-val def_bin_rec_Bcons = result();
-
-fun bin_recs def = map standard
-	([def] RL [def_bin_rec_Plus, def_bin_rec_Minus, def_bin_rec_Bcons]);
-
-(** Type checking **)
-
-val bin_typechecks0 = bin_rec_type :: Bin.intrs;
-
-goalw BinFn.thy [integ_of_bin_def]
-    "!!w. w: bin ==> integ_of_bin(w) : integ";
-by (typechk_tac (bin_typechecks0@integ_typechecks@
-		 nat_typechecks@[bool_into_nat]));
-val integ_of_bin_type = result();
-
-goalw BinFn.thy [bin_succ_def]
-    "!!w. w: bin ==> bin_succ(w) : bin";
-by (typechk_tac (bin_typechecks0@bool_typechecks));
-val bin_succ_type = result();
-
-goalw BinFn.thy [bin_pred_def]
-    "!!w. w: bin ==> bin_pred(w) : bin";
-by (typechk_tac (bin_typechecks0@bool_typechecks));
-val bin_pred_type = result();
-
-goalw BinFn.thy [bin_minus_def]
-    "!!w. w: bin ==> bin_minus(w) : bin";
-by (typechk_tac ([bin_pred_type]@bin_typechecks0@bool_typechecks));
-val bin_minus_type = result();
-
-goalw BinFn.thy [bin_add_def]
-    "!!v w. [| v: bin; w: bin |] ==> bin_add(v,w) : bin";
-by (typechk_tac ([bin_succ_type,bin_pred_type]@bin_typechecks0@
-		 bool_typechecks@ZF_typechecks));
-val bin_add_type = result();
-
-goalw BinFn.thy [bin_mult_def]
-    "!!v w. [| v: bin; w: bin |] ==> bin_mult(v,w) : bin";
-by (typechk_tac ([bin_minus_type,bin_add_type]@bin_typechecks0@
-		 bool_typechecks));
-val bin_mult_type = result();
-
-val bin_typechecks = bin_typechecks0 @
-    [integ_of_bin_type, bin_succ_type, bin_pred_type, 
-     bin_minus_type, bin_add_type, bin_mult_type];
-
-val bin_ss = integ_ss 
-    addsimps([bool_1I, bool_0I,
-	     bin_rec_Plus, bin_rec_Minus, bin_rec_Bcons] @ 
-	     bin_recs integ_of_bin_def @ bool_simps @ bin_typechecks);
-
-val typechecks = bin_typechecks @ integ_typechecks @ nat_typechecks @
-                 [bool_subset_nat RS subsetD];
-
-(**** The carry/borrow functions, bin_succ and bin_pred ****)
-
-(** Lemmas **)
-
-goal Integ.thy 
-    "!!z v. [| z $+ v = z' $+ v';  \
-\       z: integ; z': integ;  v: integ; v': integ;  w: integ |]   \
-\    ==> z $+ (v $+ w) = z' $+ (v' $+ w)";
-by (asm_simp_tac (integ_ss addsimps ([zadd_assoc RS sym])) 1);
-val zadd_assoc_cong = result();
-
-goal Integ.thy 
-    "!!z v w. [| z: integ;  v: integ;  w: integ |]   \
-\    ==> z $+ (v $+ w) = v $+ (z $+ w)";
-by (REPEAT (ares_tac [zadd_commute RS zadd_assoc_cong] 1));
-val zadd_assoc_swap = result();
-
-val zadd_cong = 
-    read_instantiate_sg (sign_of Integ.thy) [("t","op $+")] subst_context2;
-
-val zadd_kill = (refl RS zadd_cong);
-val zadd_assoc_swap_kill = zadd_kill RSN (4, zadd_assoc_swap RS trans);
-
-(*Pushes 'constants' of the form $#m to the right -- LOOPS if two!*)
-val zadd_assoc_znat = standard (znat_type RS zadd_assoc_swap);
-
-goal Integ.thy 
-    "!!z w. [| z: integ;  w: integ |]   \
-\    ==> w $+ (z $+ (w $+ z)) = w $+ (w $+ (z $+ z))";
-by (REPEAT (ares_tac [zadd_kill, zadd_assoc_swap] 1));
-val zadd_swap_pairs = result();
-
-
-val carry_ss = bin_ss addsimps 
-               (bin_recs bin_succ_def @ bin_recs bin_pred_def);
-
-goal BinFn.thy
-    "!!w. w: bin ==> integ_of_bin(bin_succ(w)) = $#1 $+ integ_of_bin(w)";
-by (etac Bin.induct 1);
-by (simp_tac (carry_ss addsimps [zadd_0_right]) 1);
-by (simp_tac (carry_ss addsimps [zadd_zminus_inverse]) 1);
-by (etac boolE 1);
-by (ALLGOALS (asm_simp_tac (carry_ss addsimps [zadd_assoc])));
-by (REPEAT (ares_tac (zadd_swap_pairs::typechecks) 1));
-val integ_of_bin_succ = result();
-
-goal BinFn.thy
-    "!!w. w: bin ==> integ_of_bin(bin_pred(w)) = $~ ($#1) $+ integ_of_bin(w)";
-by (etac Bin.induct 1);
-by (simp_tac (carry_ss addsimps [zadd_0_right]) 1);
-by (simp_tac (carry_ss addsimps [zadd_zminus_inverse]) 1);
-by (etac boolE 1);
-by (ALLGOALS 
-    (asm_simp_tac 
-     (carry_ss addsimps [zadd_assoc RS sym,
-			zadd_zminus_inverse, zadd_zminus_inverse2])));
-by (REPEAT (ares_tac ([zadd_commute, zadd_cong, refl]@typechecks) 1));
-val integ_of_bin_pred = result();
-
-(*These two results replace the definitions of bin_succ and bin_pred*)
-
-
-(*** bin_minus: (unary!) negation of binary integers ***)
-
-val bin_minus_ss =
-    bin_ss addsimps (bin_recs bin_minus_def @
-		    [integ_of_bin_succ, integ_of_bin_pred]);
-
-goal BinFn.thy
-    "!!w. w: bin ==> integ_of_bin(bin_minus(w)) = $~ integ_of_bin(w)";
-by (etac Bin.induct 1);
-by (simp_tac (bin_minus_ss addsimps [zminus_0]) 1);
-by (simp_tac (bin_minus_ss addsimps [zadd_0_right]) 1);
-by (etac boolE 1);
-by (ALLGOALS 
-    (asm_simp_tac (bin_minus_ss addsimps [zminus_zadd_distrib, zadd_assoc])));
-val integ_of_bin_minus = result();
-
-
-(*** bin_add: binary addition ***)
-
-goalw BinFn.thy [bin_add_def] "!!w. w: bin ==> bin_add(Plus,w) = w";
-by (asm_simp_tac bin_ss 1);
-val bin_add_Plus = result();
-
-goalw BinFn.thy [bin_add_def] "!!w. w: bin ==> bin_add(Minus,w) = bin_pred(w)";
-by (asm_simp_tac bin_ss 1);
-val bin_add_Minus = result();
-
-goalw BinFn.thy [bin_add_def] "bin_add(v$$x,Plus) = v$$x";
-by (simp_tac bin_ss 1);
-val bin_add_Bcons_Plus = result();
-
-goalw BinFn.thy [bin_add_def] "bin_add(v$$x,Minus) = bin_pred(v$$x)";
-by (simp_tac bin_ss 1);
-val bin_add_Bcons_Minus = result();
-
-goalw BinFn.thy [bin_add_def]
-    "!!w y. [| w: bin;  y: bool |] ==> \
-\           bin_add(v$$x, w$$y) = \
-\           bin_add(v, cond(x and y, bin_succ(w), w)) $$ (x xor y)";
-by (asm_simp_tac bin_ss 1);
-val bin_add_Bcons_Bcons = result();
-
-val bin_add_rews = [bin_add_Plus, bin_add_Minus, bin_add_Bcons_Plus,
-		    bin_add_Bcons_Minus, bin_add_Bcons_Bcons,
-		    integ_of_bin_succ, integ_of_bin_pred];
-
-val bin_add_ss = bin_ss addsimps ([bool_subset_nat RS subsetD] @ bin_add_rews);
-
-goal BinFn.thy
-    "!!v. v: bin ==> \
-\         ALL w: bin. integ_of_bin(bin_add(v,w)) = \
-\                     integ_of_bin(v) $+ integ_of_bin(w)";
-by (etac Bin.induct 1);
-by (simp_tac bin_add_ss 1);
-by (simp_tac bin_add_ss 1);
-by (rtac ballI 1);
-by (bin_ind_tac "wa" [] 1);
-by (asm_simp_tac (bin_add_ss addsimps [zadd_0_right]) 1);
-by (asm_simp_tac bin_add_ss 1);
-by (REPEAT (ares_tac (zadd_commute::typechecks) 1));
-by (etac boolE 1);
-by (asm_simp_tac (bin_add_ss addsimps [zadd_assoc, zadd_swap_pairs]) 2);
-by (REPEAT (ares_tac ([refl, zadd_kill, zadd_assoc_swap_kill]@typechecks) 2));
-by (etac boolE 1);
-by (ALLGOALS (asm_simp_tac (bin_add_ss addsimps [zadd_assoc,zadd_swap_pairs])));
-by (REPEAT (ares_tac ([refl, zadd_kill, zadd_assoc_swap_kill RS sym]@
-		      typechecks) 1));
-val integ_of_bin_add_lemma = result();
-
-val integ_of_bin_add = integ_of_bin_add_lemma RS bspec;
-
-
-(*** bin_add: binary multiplication ***)
-
-val bin_mult_ss =
-    bin_ss addsimps (bin_recs bin_mult_def @ 
-		       [integ_of_bin_minus, integ_of_bin_add]);
-
-
-val major::prems = goal BinFn.thy
-    "[| v: bin; w: bin |] ==>	\
-\    integ_of_bin(bin_mult(v,w)) = \
-\    integ_of_bin(v) $* integ_of_bin(w)";
-by (cut_facts_tac prems 1);
-by (bin_ind_tac "v" [major] 1);
-by (asm_simp_tac (bin_mult_ss addsimps [zmult_0]) 1);
-by (asm_simp_tac (bin_mult_ss addsimps [zmult_1,zmult_zminus]) 1);
-by (etac boolE 1);
-by (asm_simp_tac (bin_mult_ss addsimps [zadd_zmult_distrib]) 2);
-by (asm_simp_tac 
-    (bin_mult_ss addsimps [zadd_zmult_distrib, zmult_1, zadd_assoc]) 1);
-by (REPEAT (ares_tac ([zadd_commute, zadd_assoc_swap_kill RS sym]@
-		      typechecks) 1));
-val integ_of_bin_mult = result();
-
-(**** Computations ****)
-
-(** extra rules for bin_succ, bin_pred **)
-
-val [bin_succ_Plus, bin_succ_Minus, _] = bin_recs bin_succ_def;
-val [bin_pred_Plus, bin_pred_Minus, _] = bin_recs bin_pred_def;
-
-goal BinFn.thy "bin_succ(w$$1) = bin_succ(w) $$ 0";
-by (simp_tac carry_ss 1);
-val bin_succ_Bcons1 = result();
-
-goal BinFn.thy "bin_succ(w$$0) = w$$1";
-by (simp_tac carry_ss 1);
-val bin_succ_Bcons0 = result();
-
-goal BinFn.thy "bin_pred(w$$1) = w$$0";
-by (simp_tac carry_ss 1);
-val bin_pred_Bcons1 = result();
-
-goal BinFn.thy "bin_pred(w$$0) = bin_pred(w) $$ 1";
-by (simp_tac carry_ss 1);
-val bin_pred_Bcons0 = result();
-
-(** extra rules for bin_minus **)
-
-val [bin_minus_Plus, bin_minus_Minus, _] = bin_recs bin_minus_def;
-
-goal BinFn.thy "bin_minus(w$$1) = bin_pred(bin_minus(w) $$ 0)";
-by (simp_tac bin_minus_ss 1);
-val bin_minus_Bcons1 = result();
-
-goal BinFn.thy "bin_minus(w$$0) = bin_minus(w) $$ 0";
-by (simp_tac bin_minus_ss 1);
-val bin_minus_Bcons0 = result();
-
-(** extra rules for bin_add **)
-
-goal BinFn.thy 
-    "!!w. w: bin ==> bin_add(v$$1, w$$1) = bin_add(v, bin_succ(w)) $$ 0";
-by (asm_simp_tac bin_add_ss 1);
-val bin_add_Bcons_Bcons11 = result();
-
-goal BinFn.thy 
-    "!!w. w: bin ==> bin_add(v$$1, w$$0) = bin_add(v,w) $$ 1";
-by (asm_simp_tac bin_add_ss 1);
-val bin_add_Bcons_Bcons10 = result();
-
-goal BinFn.thy 
-    "!!w y.[| w: bin;  y: bool |] ==> bin_add(v$$0, w$$y) = bin_add(v,w) $$ y";
-by (asm_simp_tac bin_add_ss 1);
-val bin_add_Bcons_Bcons0 = result();
-
-(** extra rules for bin_mult **)
-
-val [bin_mult_Plus, bin_mult_Minus, _] = bin_recs bin_mult_def;
-
-goal BinFn.thy "bin_mult(v$$1, w) = bin_add(bin_mult(v,w)$$0, w)";
-by (simp_tac bin_mult_ss 1);
-val bin_mult_Bcons1 = result();
-
-goal BinFn.thy "bin_mult(v$$0, w) = bin_mult(v,w)$$0";
-by (simp_tac bin_mult_ss 1);
-val bin_mult_Bcons0 = result();
-
-
-(*** The computation simpset ***)
-
-val bin_comp_ss = integ_ss 
-    addsimps [bin_succ_Plus, bin_succ_Minus,
-	     bin_succ_Bcons1, bin_succ_Bcons0,
-	     bin_pred_Plus, bin_pred_Minus,
-	     bin_pred_Bcons1, bin_pred_Bcons0,
-	     bin_minus_Plus, bin_minus_Minus,
-	     bin_minus_Bcons1, bin_minus_Bcons0,
-	     bin_add_Plus, bin_add_Minus, bin_add_Bcons_Plus, 
-	     bin_add_Bcons_Minus, bin_add_Bcons_Bcons0, 
-	     bin_add_Bcons_Bcons10, bin_add_Bcons_Bcons11,
-	     bin_mult_Plus, bin_mult_Minus,
-	     bin_mult_Bcons1, bin_mult_Bcons0]
-    setsolver (type_auto_tac ([bool_1I, bool_0I] @ bin_typechecks0));
-
-(*** Examples of performing binary arithmetic by simplification ***)
-
-proof_timing := true;
-(*All runtimes below are on a SPARCserver 10*)
-
-(* 13+19 = 32 *)
-goal BinFn.thy
-    "bin_add(Plus$$1$$1$$0$$1, Plus$$1$$0$$0$$1$$1) = Plus$$1$$0$$0$$0$$0$$0";
-by (simp_tac bin_comp_ss 1);	(*0.6 secs*)
-result();
-
-bin_add(binary_of_int 13, binary_of_int 19);
-
-(* 1234+5678 = 6912 *)
-goal BinFn.thy
-    "bin_add(Plus$$1$$0$$0$$1$$1$$0$$1$$0$$0$$1$$0, \
-\	     Plus$$1$$0$$1$$1$$0$$0$$0$$1$$0$$1$$1$$1$$0) = \
-\    Plus$$1$$1$$0$$1$$1$$0$$0$$0$$0$$0$$0$$0$$0";
-by (simp_tac bin_comp_ss 1);	(*2.6 secs*)
-result();
-
-bin_add(binary_of_int 1234, binary_of_int 5678);
-
-(* 1359-2468 = ~1109 *)
-goal BinFn.thy
-    "bin_add(Plus$$1$$0$$1$$0$$1$$0$$0$$1$$1$$1$$1,		\
-\	     Minus$$0$$1$$1$$0$$0$$1$$0$$1$$1$$1$$0$$0) = 	\
-\    Minus$$1$$0$$1$$1$$1$$0$$1$$0$$1$$0$$1$$1";
-by (simp_tac bin_comp_ss 1);	(*2.3 secs*)
-result();
-
-bin_add(binary_of_int 1359, binary_of_int ~2468);
-
-(* 93746-46375 = 47371 *)
-goal BinFn.thy
-    "bin_add(Plus$$1$$0$$1$$1$$0$$1$$1$$1$$0$$0$$0$$1$$1$$0$$0$$1$$0, \
-\	     Minus$$0$$1$$0$$0$$1$$0$$1$$0$$1$$1$$0$$1$$1$$0$$0$$1) = \
-\    Plus$$0$$1$$0$$1$$1$$1$$0$$0$$1$$0$$0$$0$$0$$1$$0$$1$$1";
-by (simp_tac bin_comp_ss 1);	(*3.9 secs*)
-result();
-
-bin_add(binary_of_int 93746, binary_of_int ~46375);
-
-(* negation of 65745 *)
-goal BinFn.thy
-    "bin_minus(Plus$$1$$0$$0$$0$$0$$0$$0$$0$$0$$1$$1$$0$$1$$0$$0$$0$$1) = \
-\    Minus$$0$$1$$1$$1$$1$$1$$1$$1$$1$$0$$0$$1$$0$$1$$1$$1$$1";
-by (simp_tac bin_comp_ss 1);	(*0.6 secs*)
-result();
-
-bin_minus(binary_of_int 65745);
-
-(* negation of ~54321 *)
-goal BinFn.thy
-    "bin_minus(Minus$$0$$0$$1$$0$$1$$0$$1$$1$$1$$1$$0$$0$$1$$1$$1$$1) = \
-\    Plus$$0$$1$$1$$0$$1$$0$$1$$0$$0$$0$$0$$1$$1$$0$$0$$0$$1";
-by (simp_tac bin_comp_ss 1);	(*0.7 secs*)
-result();
-
-bin_minus(binary_of_int ~54321);
-
-(* 13*19 = 247 *)
-goal BinFn.thy "bin_mult(Plus$$1$$1$$0$$1, Plus$$1$$0$$0$$1$$1) = \
-\               Plus$$1$$1$$1$$1$$0$$1$$1$$1";
-by (simp_tac bin_comp_ss 1);	(*1.5 secs*)
-result();
-
-bin_mult(binary_of_int 13, binary_of_int 19);
-
-(* ~84 * 51 = ~4284 *)
-goal BinFn.thy
-    "bin_mult(Minus$$0$$1$$0$$1$$1$$0$$0, Plus$$1$$1$$0$$0$$1$$1) = \
-\    Minus$$0$$1$$1$$1$$1$$0$$1$$0$$0$$0$$1$$0$$0";
-by (simp_tac bin_comp_ss 1);	(*2.6 secs*)
-result();
-
-bin_mult(binary_of_int ~84, binary_of_int 51);
-
-(* 255*255 = 65025;  the worst case for 8-bit operands *)
-goal BinFn.thy
-    "bin_mult(Plus$$1$$1$$1$$1$$1$$1$$1$$1, \
-\             Plus$$1$$1$$1$$1$$1$$1$$1$$1) = \
-\        Plus$$1$$1$$1$$1$$1$$1$$1$$0$$0$$0$$0$$0$$0$$0$$0$$1";
-by (simp_tac bin_comp_ss 1);	(*9.8 secs*)
-result();
-
-bin_mult(binary_of_int 255, binary_of_int 255);
-
-(* 1359 * ~2468 = ~3354012 *)
-goal BinFn.thy
-    "bin_mult(Plus$$1$$0$$1$$0$$1$$0$$0$$1$$1$$1$$1, 		\
-\	      Minus$$0$$1$$1$$0$$0$$1$$0$$1$$1$$1$$0$$0) = 	\
-\    Minus$$0$$0$$1$$1$$0$$0$$1$$1$$0$$1$$0$$0$$1$$0$$0$$1$$1$$0$$0$$1$$0$$0";
-by (simp_tac bin_comp_ss 1);	(*13.7 secs*)
-result();
-
-bin_mult(binary_of_int 1359, binary_of_int ~2468);
--- a/src/ZF/ex/binfn.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-(*  Title: 	ZF/bin
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-Arithmetic on binary integers.
-*)
-
-BinFn = Integ + Bin +
-consts
-  bin_rec          :: "[i, i, i, [i,i,i]=>i] => i"
-  integ_of_bin     :: "i=>i"
-  bin_succ         :: "i=>i"
-  bin_pred         :: "i=>i"
-  bin_minus        :: "i=>i"
-  bin_add,bin_mult :: "[i,i]=>i"
-
-rules
-
-  bin_rec_def
-      "bin_rec(z,a,b,h) == \
-\      Vrec(z, %z g. bin_case(a, b, %w x. h(w, x, g`w), z))"
-
-  integ_of_bin_def 
-      "integ_of_bin(w) == bin_rec(w, $#0, $~($#1), %w x r. $#x $+ r $+ r)"
-
-  bin_succ_def
-      "bin_succ(w0) == bin_rec(w0, Plus$$1, Plus, %w x r. cond(x, r$$0, w$$1))"
-
-  bin_pred_def
-      "bin_pred(w0) == \
-\	bin_rec(w0, Minus, Minus$$0, %w x r. cond(x, w$$0, r$$1))"
-
-  bin_minus_def
-      "bin_minus(w0) == \
-\	bin_rec(w0, Plus, Plus$$1, %w x r. cond(x, bin_pred(r$$0), r$$0))"
-
-  bin_add_def
-      "bin_add(v0,w0) == 			\
-\       bin_rec(v0, 				\
-\         lam w:bin. w,       		\
-\         lam w:bin. bin_pred(w),	\
-\         %v x r. lam w1:bin. 		\
-\	           bin_rec(w1, v$$x, bin_pred(v$$x),	\
-\		     %w y s. (r`cond(x and y, bin_succ(w), w)) \
-\		             $$ (x xor y)))    ` w0"
-
-  bin_mult_def
-      "bin_mult(v0,w) == 			\
-\       bin_rec(v0, Plus, bin_minus(w),		\
-\         %v x r. cond(x, bin_add(r$$0,w), r$$0))"
-end
--- a/src/ZF/ex/bt.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-(*  Title: 	ZF/ex/bt.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-Datatype definition of binary trees
-*)
-
-structure BT = Datatype_Fun
- (val thy = Univ.thy;
-  val rec_specs = 
-      [("bt", "univ(A)",
-	  [(["Lf"],"i"), (["Br"],"[i,i,i]=>i")])];
-  val rec_styp = "i=>i";
-  val ext = None
-  val sintrs = 
-	  ["Lf : bt(A)",
-	   "[| a: A;  t1: bt(A);  t2: bt(A) |] ==> Br(a,t1,t2) : bt(A)"];
-  val monos = [];
-  val type_intrs = datatype_intrs
-  val type_elims = []);
-
-val [LfI, BrI] = BT.intrs;
-
-(*Perform induction on l, then prove the major premise using prems. *)
-fun bt_ind_tac a prems i = 
-    EVERY [res_inst_tac [("x",a)] BT.induct i,
-	   rename_last_tac a ["1","2"] (i+2),
-	   ares_tac prems i];
-
-
-(**  Lemmas to justify using "bt" in other recursive type definitions **)
-
-goalw BT.thy BT.defs "!!A B. A<=B ==> bt(A) <= bt(B)";
-by (rtac lfp_mono 1);
-by (REPEAT (rtac BT.bnd_mono 1));
-by (REPEAT (ares_tac (univ_mono::basic_monos) 1));
-val bt_mono = result();
-
-goalw BT.thy (BT.defs@BT.con_defs) "bt(univ(A)) <= univ(A)";
-by (rtac lfp_lowerbound 1);
-by (rtac (A_subset_univ RS univ_mono) 2);
-by (fast_tac (ZF_cs addSIs [zero_in_univ, Inl_in_univ, Inr_in_univ,
-			    Pair_in_univ]) 1);
-val bt_univ = result();
-
-val bt_subset_univ = standard ([bt_mono, bt_univ] MRS subset_trans);
-
--- a/src/ZF/ex/bt_fn.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-(*  Title: 	ZF/bt.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1992  University of Cambridge
-
-For bt.thy.  Binary trees
-*)
-
-open BT_Fn;
-
-
-
-(** bt_rec -- by Vset recursion **)
-
-goalw BT.thy BT.con_defs "rank(l) < rank(Br(a,l,r))";
-by (simp_tac rank_ss 1);
-val rank_Br1 = result();
-
-goalw BT.thy BT.con_defs "rank(r) < rank(Br(a,l,r))";
-by (simp_tac rank_ss 1);
-val rank_Br2 = result();
-
-goal BT_Fn.thy "bt_rec(Lf,c,h) = c";
-by (rtac (bt_rec_def RS def_Vrec RS trans) 1);
-by (simp_tac (ZF_ss addsimps BT.case_eqns) 1);
-val bt_rec_Lf = result();
-
-goal BT_Fn.thy
-    "bt_rec(Br(a,l,r), c, h) = h(a, l, r, bt_rec(l,c,h), bt_rec(r,c,h))";
-by (rtac (bt_rec_def RS def_Vrec RS trans) 1);
-by (simp_tac (rank_ss addsimps (BT.case_eqns @ [rank_Br1, rank_Br2])) 1);
-val bt_rec_Br = result();
-
-(*Type checking -- proved by induction, as usual*)
-val prems = goal BT_Fn.thy
-    "[| t: bt(A);    \
-\       c: C(Lf);       \
-\       !!x y z r s. [| x:A;  y:bt(A);  z:bt(A);  r:C(y);  s:C(z) |] ==> \
-\		     h(x,y,z,r,s): C(Br(x,y,z))  \
-\    |] ==> bt_rec(t,c,h) : C(t)";
-by (bt_ind_tac "t" prems 1);
-by (ALLGOALS (asm_simp_tac (ZF_ss addsimps
-			    (prems@[bt_rec_Lf,bt_rec_Br]))));
-val bt_rec_type = result();
-
-(** Versions for use with definitions **)
-
-val [rew] = goal BT_Fn.thy "[| !!t. j(t)==bt_rec(t, c, h) |] ==> j(Lf) = c";
-by (rewtac rew);
-by (rtac bt_rec_Lf 1);
-val def_bt_rec_Lf = result();
-
-val [rew] = goal BT_Fn.thy
-    "[| !!t. j(t)==bt_rec(t, c, h) |] ==> j(Br(a,l,r)) = h(a,l,r,j(l),j(r))";
-by (rewtac rew);
-by (rtac bt_rec_Br 1);
-val def_bt_rec_Br = result();
-
-fun bt_recs def = map standard ([def] RL [def_bt_rec_Lf, def_bt_rec_Br]);
-
-(** n_nodes **)
-
-val [n_nodes_Lf,n_nodes_Br] = bt_recs n_nodes_def;
-
-val prems = goalw BT_Fn.thy [n_nodes_def] 
-    "xs: bt(A) ==> n_nodes(xs) : nat";
-by (REPEAT (ares_tac (prems @ [bt_rec_type, nat_0I, nat_succI, add_type]) 1));
-val n_nodes_type = result();
-
-
-(** n_leaves **)
-
-val [n_leaves_Lf,n_leaves_Br] = bt_recs n_leaves_def;
-
-val prems = goalw BT_Fn.thy [n_leaves_def] 
-    "xs: bt(A) ==> n_leaves(xs) : nat";
-by (REPEAT (ares_tac (prems @ [bt_rec_type, nat_0I, nat_succI, add_type]) 1));
-val n_leaves_type = result();
-
-(** bt_reflect **)
-
-val [bt_reflect_Lf, bt_reflect_Br] = bt_recs bt_reflect_def;
-
-val prems = goalw BT_Fn.thy [bt_reflect_def] 
-    "xs: bt(A) ==> bt_reflect(xs) : bt(A)";
-by (REPEAT (ares_tac (prems @ [bt_rec_type, LfI, BrI]) 1));
-val bt_reflect_type = result();
-
-
-(** BT_Fn simplification **)
-
-
-val bt_typechecks =
-      [LfI, BrI, bt_rec_type, n_nodes_type, n_leaves_type, bt_reflect_type];
-
-val bt_ss = arith_ss 
-    addsimps BT.case_eqns
-    addsimps bt_typechecks
-    addsimps [bt_rec_Lf, bt_rec_Br, 
-	     n_nodes_Lf, n_nodes_Br,
-	     n_leaves_Lf, n_leaves_Br,
-	     bt_reflect_Lf, bt_reflect_Br];
-
-
-(*** theorems about n_leaves ***)
-
-val prems = goal BT_Fn.thy
-    "t: bt(A) ==> n_leaves(bt_reflect(t)) = n_leaves(t)";
-by (bt_ind_tac "t" prems 1);
-by (ALLGOALS (asm_simp_tac bt_ss));
-by (REPEAT (ares_tac [add_commute, n_leaves_type] 1));
-val n_leaves_reflect = result();
-
-val prems = goal BT_Fn.thy
-    "t: bt(A) ==> n_leaves(t) = succ(n_nodes(t))";
-by (bt_ind_tac "t" prems 1);
-by (ALLGOALS (asm_simp_tac (bt_ss addsimps [add_succ_right])));
-val n_leaves_nodes = result();
-
-(*** theorems about bt_reflect ***)
-
-val prems = goal BT_Fn.thy
-    "t: bt(A) ==> bt_reflect(bt_reflect(t))=t";
-by (bt_ind_tac "t" prems 1);
-by (ALLGOALS (asm_simp_tac bt_ss));
-val bt_reflect_bt_reflect_ident = result();
-
-
--- a/src/ZF/ex/bt_fn.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-(*  Title: 	ZF/ex/bt-fn.thy
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1992  University of Cambridge
-
-Binary trees
-*)
-
-BT_Fn = BT +
-consts
-    bt_rec    	:: "[i, i, [i,i,i,i,i]=>i] => i"
-    n_nodes	:: "i=>i"
-    n_leaves   	:: "i=>i"
-    bt_reflect 	:: "i=>i"
-
-rules
-  bt_rec_def
-    "bt_rec(t,c,h) == Vrec(t, %t g.bt_case(c, %x y z. h(x,y,z,g`y,g`z), t))"
-
-  n_nodes_def	"n_nodes(t) == bt_rec(t,  0,  %x y z r s. succ(r#+s))"
-  n_leaves_def	"n_leaves(t) == bt_rec(t,  succ(0),  %x y z r s. r#+s)"
-  bt_reflect_def "bt_reflect(t) == bt_rec(t,  Lf,  %x y z r s. Br(x,s,r))"
-
-end
--- a/src/ZF/ex/comb.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-(*  Title: 	ZF/ex/comb.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson
-    Copyright   1993  University of Cambridge
-
-Datatype definition of combinators S and K
-
-J. Camilleri and T. F. Melham.
-Reasoning with Inductively Defined Relations in the HOL Theorem Prover.
-Report 265, University of Cambridge Computer Laboratory, 1992.
-*)
-
-
-(*Example of a datatype with mixfix syntax for some constructors*)
-structure Comb = Datatype_Fun
- (val thy = Univ.thy;
-  val rec_specs = 
-      [("comb", "univ(0)",
-	  [(["K","S"],	"i"),
-	   (["op #"],	"[i,i]=>i")])];
-  val rec_styp = "i";
-  val ext = Some (Syntax.simple_sext [Infixl("#", "[i,i] => i", 90)]);
-  val sintrs = 
-	  ["K : comb",
-	   "S : comb",
-	   "[| p: comb;  q: comb |] ==> p#q : comb"];
-  val monos = [];
-  val type_intrs = datatype_intrs;
-  val type_elims = []);
-
-val [K_comb,S_comb,Ap_comb] = Comb.intrs;
-
-val Ap_E = Comb.mk_cases Comb.con_defs "p#q : comb";
-
--- a/src/ZF/ex/contract0.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-(*  Title: 	ZF/ex/contract.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson
-    Copyright   1993  University of Cambridge
-
-For ex/contract.thy.
-*)
-
-open Contract0;
-
-structure Contract = Inductive_Fun
- (val thy = Contract0.thy;
-  val rec_doms = [("contract","comb*comb")];
-  val sintrs = 
-      ["[| p:comb;  q:comb |] ==> K#p#q -1-> p",
-       "[| p:comb;  q:comb;  r:comb |] ==> S#p#q#r -1-> (p#r)#(q#r)",
-       "[| p-1->q;  r:comb |] ==> p#r -1-> q#r",
-       "[| p-1->q;  r:comb |] ==> r#p -1-> r#q"];
-  val monos = [];
-  val con_defs = [];
-  val type_intrs = Comb.intrs@[SigmaI];
-  val type_elims = [SigmaE2]);
-
-val [K_contract,S_contract,Ap_contract1,Ap_contract2] = Contract.intrs;
-
-val contract_induct = standard
-    (Contract.mutual_induct RS spec RS spec RSN (2,rev_mp));
-
-(*For type checking: replaces a-1->b by a,b:comb *)
-val contract_combE2 = Contract.dom_subset RS subsetD RS SigmaE2;
-val contract_combD1 = Contract.dom_subset RS subsetD RS SigmaD1;
-val contract_combD2 = Contract.dom_subset RS subsetD RS SigmaD2;
-
-goal Contract.thy "field(contract) = comb";
-by (fast_tac (ZF_cs addIs [equalityI,K_contract] addSEs [contract_combE2]) 1);
-val field_contract_eq = result();
-
-val reduction_refl = standard
-    (field_contract_eq RS equalityD2 RS subsetD RS rtrancl_refl);
-
-val rtrancl_into_rtrancl2 = standard
-    (r_into_rtrancl RS (trans_rtrancl RS transD));
-
-val reduction_rls = [reduction_refl, K_contract, S_contract, 
-		     K_contract RS rtrancl_into_rtrancl2,
-		     S_contract RS rtrancl_into_rtrancl2,
-		     Ap_contract1 RS rtrancl_into_rtrancl2,
-		     Ap_contract2 RS rtrancl_into_rtrancl2];
-
-goalw Contract.thy [I_def] "!!p. p:comb ==> I#p ---> p";
-by (REPEAT (ares_tac (Comb.intrs @ reduction_rls) 1));
-val I_reduce = result();
-
-goalw Contract.thy [I_def] "I: comb";
-by (REPEAT (ares_tac Comb.intrs 1));
-val I_comb = result();
-
-(** Non-contraction results **)
-
-(*Derive a case for each combinator constructor*)
-val K_contract_case = Contract.mk_cases Comb.con_defs "K -1-> r";
-val S_contract_case = Contract.mk_cases Comb.con_defs "S -1-> r";
-val Ap_contract_case = Contract.mk_cases Comb.con_defs "p#q -1-> r";
-
-val contract_cs =
-    ZF_cs addSIs Comb.intrs
-	  addIs  Contract.intrs
-	  addSEs [contract_combD1,contract_combD2]     (*type checking*)
-	  addSEs [K_contract_case, S_contract_case, Ap_contract_case]
-	  addSEs Comb.free_SEs;
-
-goalw Contract.thy [I_def] "!!r. I -1-> r ==> P";
-by (fast_tac contract_cs 1);
-val I_contract_case = result();
-
-goal Contract.thy "!!p r. K#p -1-> r ==> (EX q. r = K#q & p -1-> q)";
-by (fast_tac contract_cs 1);
-val K1_contractD = result();
-
-goal Contract.thy "!!p r. [| p ---> q;  r: comb |] ==> p#r ---> q#r";
-by (forward_tac [rtrancl_type RS subsetD RS SigmaD1] 1);
-by (dtac (field_contract_eq RS equalityD1 RS subsetD) 1);
-by (etac rtrancl_induct 1);
-by (fast_tac (contract_cs addIs reduction_rls) 1);
-by (etac (trans_rtrancl RS transD) 1);
-by (fast_tac (contract_cs addIs reduction_rls) 1);
-val Ap_reduce1 = result();
-
-goal Contract.thy "!!p r. [| p ---> q;  r: comb |] ==> r#p ---> r#q";
-by (forward_tac [rtrancl_type RS subsetD RS SigmaD1] 1);
-by (dtac (field_contract_eq RS equalityD1 RS subsetD) 1);
-by (etac rtrancl_induct 1);
-by (fast_tac (contract_cs addIs reduction_rls) 1);
-by (etac (trans_rtrancl RS transD) 1);
-by (fast_tac (contract_cs addIs reduction_rls) 1);
-val Ap_reduce2 = result();
-
-(** Counterexample to the diamond property for -1-> **)
-
-goal Contract.thy "K#I#(I#I) -1-> I";
-by (REPEAT (ares_tac [K_contract, I_comb, Ap_comb] 1));
-val KIII_contract1 = result();
-
-goalw Contract.thy [I_def] "K#I#(I#I) -1-> K#I#((K#I)#(K#I))";
-by (DEPTH_SOLVE (resolve_tac (Comb.intrs @ Contract.intrs) 1));
-val KIII_contract2 = result();
-
-goal Contract.thy "K#I#((K#I)#(K#I)) -1-> I";
-by (REPEAT (ares_tac (Comb.intrs @ [K_contract, I_comb]) 1));
-val KIII_contract3 = result();
-
-goalw Contract.thy [diamond_def] "~ diamond(contract)";
-by (fast_tac (ZF_cs addIs [KIII_contract1,KIII_contract2,KIII_contract3]
-                    addSEs [I_contract_case]) 1);
-val not_diamond_contract = result();
-
-writeln"Reached end of file.";
--- a/src/ZF/ex/contract0.thy	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-(*  Title: 	ZF/ex/contract.thy
-    ID:         $Id$
-    Author: 	Lawrence C Paulson
-    Copyright   1993  University of Cambridge
-
-Inductive definition of (1-step) contractions and (mult-step) reductions
-*)
-
-Contract0 = Comb +
-consts
-  diamond   :: "i => o"
-  I         :: "i"
-
-  contract  :: "i"
-  "-1->"    :: "[i,i] => o"    			(infixl 50)
-  "--->"    :: "[i,i] => o"    			(infixl 50)
-
-  parcontract :: "i"
-  "=1=>"    :: "[i,i] => o"    			(infixl 50)
-  "===>"    :: "[i,i] => o"    			(infixl 50)
-
-translations
-  "p -1-> q" == "<p,q> : contract"
-  "p ---> q" == "<p,q> : contract^*"
-  "p =1=> q" == "<p,q> : parcontract"
-  "p ===> q" == "<p,q> : parcontract^+"
-
-rules
-
-  diamond_def "diamond(r) == ALL x y. <x,y>:r --> \
-\                            (ALL y'. <x,y'>:r --> \
-\                                 (EX z. <y,z>:r & <y',z> : r))"
-
-  I_def       "I == S#K#K"
-
-end
--- a/src/ZF/ex/counit.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-(*  Title: 	ZF/ex/counit.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-Trivial codatatype definitions, one of which goes wrong!
-
-Need to find sufficient conditions for codatatypes to work correctly!
-*)
-
-(*This degenerate definition does not work well because the one constructor's
-  definition is trivial!  The same thing occurs with Aczel's Special Final
-  Coalgebra Theorem
-*)
-structure CoUnit = CoDatatype_Fun
- (val thy = QUniv.thy;
-  val rec_specs = 
-      [("counit", "quniv(0)",
-	  [(["Con"],	"i=>i")])];
-  val rec_styp = "i";
-  val ext = None
-  val sintrs = ["x: counit ==> Con(x) : counit"];
-  val monos = [];
-  val type_intrs = codatatype_intrs
-  val type_elims = codatatype_elims);
-  
-val [ConI] = CoUnit.intrs;
-
-(*USELESS because folding on Con(?xa) == ?xa fails*)
-val ConE = CoUnit.mk_cases CoUnit.con_defs "Con(x) : counit";
-
-(*Proving freeness results*)
-val Con_iff = CoUnit.mk_free "Con(x)=Con(y) <-> x=y";
-
-(*Should be a singleton, not everything!*)
-goal CoUnit.thy "counit = quniv(0)";
-by (rtac (CoUnit.dom_subset RS equalityI) 1);
-by (rtac subsetI 1);
-by (etac CoUnit.coinduct 1);
-by (rtac subset_refl 1);
-by (rewrite_goals_tac CoUnit.con_defs);
-by (fast_tac ZF_cs 1);
-val counit_eq_univ = result();
-
-
-(*****************************************************************)
-
-(*A similar example, but the constructor is non-degenerate and it works!
-  The resulting set is a singleton.
-*)
-
-structure CoUnit2 = CoDatatype_Fun
- (val thy = QUniv.thy;
-  val rec_specs = 
-      [("counit2", "quniv(0)",
-	  [(["Con2"],	"[i,i]=>i")])];
-  val rec_styp = "i";
-  val ext = None
-  val sintrs = ["[| x: counit2;  y: counit2 |] ==> Con2(x,y) : counit2"];
-  val monos = [];
-  val type_intrs = codatatype_intrs
-  val type_elims = codatatype_elims);
-
-val [Con2I] = CoUnit2.intrs;
-
-val Con2E = CoUnit2.mk_cases CoUnit2.con_defs "Con2(x,y) : counit2";
-
-(*Proving freeness results*)
-val Con2_iff = CoUnit2.mk_free "Con2(x,y)=Con2(x',y') <-> x=x' & y=y'";
-
-goalw CoUnit2.thy CoUnit2.con_defs "bnd_mono(univ(0), %x. Con2(x,x))";
-by (rtac bnd_monoI 1);
-by (REPEAT (ares_tac [subset_refl, QPair_subset_univ, QPair_mono] 1));
-val Con2_bnd_mono = result();
-
-goal CoUnit2.thy "lfp(univ(0), %x. Con2(x,x)) : counit2";
-by (rtac (singletonI RS CoUnit2.coinduct) 1);
-by (rtac (qunivI RS singleton_subsetI) 1);
-by (rtac ([lfp_subset, empty_subsetI RS univ_mono] MRS subset_trans) 1);
-by (fast_tac (ZF_cs addSIs [Con2_bnd_mono RS lfp_Tarski]) 1);
-val lfp_Con2_in_counit2 = result();
-
-(*Lemma for proving finality.  Borrowed from ex/llist_eq.ML!*)
-goal CoUnit2.thy
-    "!!i. Ord(i) ==> ALL x y. x: counit2 & y: counit2 --> x Int Vset(i) <= y";
-by (etac trans_induct 1);
-by (safe_tac subset_cs);
-by (etac CoUnit2.elim 1);
-by (etac CoUnit2.elim 1);
-by (rewrite_goals_tac CoUnit2.con_defs);
-by (fast_tac lleq_cs 1);
-val counit2_Int_Vset_subset_lemma = result();
-
-val counit2_Int_Vset_subset = standard
-	(counit2_Int_Vset_subset_lemma RS spec RS spec RS mp);
-
-goal CoUnit2.thy "!!x y. [| x: counit2;  y: counit2 |] ==> x=y";
-by (rtac equalityI 1);
-by (REPEAT (ares_tac [conjI, counit2_Int_Vset_subset RS Int_Vset_subset] 1));
-val counit2_implies_equal = result();
-
-goal CoUnit2.thy "counit2 = {lfp(univ(0), %x. Con2(x,x))}";
-by (rtac equalityI 1);
-by (rtac (lfp_Con2_in_counit2 RS singleton_subsetI) 2);
-by (rtac subsetI 1);
-by (dtac (lfp_Con2_in_counit2 RS counit2_implies_equal) 1);
-by (etac subst 1);
-by (rtac singletonI 1);
-val counit2_eq_univ = result();
--- a/src/ZF/ex/data.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-(*  Title: 	ZF/ex/data.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-Sample datatype definition.  
-It has four contructors, of arities 0-3, and two parameters A and B.
-*)
-
-structure Data = Datatype_Fun
- (val thy        = Univ.thy
-  val rec_specs  = [("data", "univ(A Un B)",
-                       [(["Con0"],   "i"),
-                        (["Con1"],   "i=>i"),
-                        (["Con2"],   "[i,i]=>i"),
-                        (["Con3"],   "[i,i,i]=>i")])]
-  val rec_styp   = "[i,i]=>i"
-  val ext        = None
-  val sintrs     = 
-          ["Con0 : data(A,B)",
-           "[| a: A |] ==> Con1(a) : data(A,B)",
-           "[| a: A; b: B |] ==> Con2(a,b) : data(A,B)",
-           "[| a: A; b: B;  d: data(A,B) |] ==> Con3(a,b,d) : data(A,B)"]
-  val monos      = []
-  val type_intrs = datatype_intrs
-  val type_elims = datatype_elims);
-
-
-(**  Lemmas to justify using "data" in other recursive type definitions **)
-
-goalw Data.thy Data.defs "!!A B. [| A<=C; B<=D |] ==> data(A,B) <= data(C,D)";
-by (rtac lfp_mono 1);
-by (REPEAT (rtac Data.bnd_mono 1));
-by (REPEAT (ares_tac (univ_mono::Un_mono::basic_monos) 1));
-val data_mono = result();
-
-goalw Data.thy (Data.defs@Data.con_defs) "data(univ(A),univ(A)) <= univ(A)";
-by (rtac lfp_lowerbound 1);
-by (rtac ([A_subset_univ, Un_upper1] MRS subset_trans RS univ_mono) 2);
-by (fast_tac (ZF_cs addSIs [zero_in_univ, Inl_in_univ, Inr_in_univ,
-			    Pair_in_univ]) 1);
-val data_univ = result();
-
-val data_subset_univ = standard ([data_mono, data_univ] MRS subset_trans);
-
-
--- a/src/ZF/ex/enum.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-(*  Title: 	ZF/ex/enum
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-Example of a BIG enumeration type
-
-Can go up to at least 100 constructors, but it takes nearly 7 minutes...
-*)
-
-
-(*An enumeration type with 60 contructors!  -- takes about 150 seconds!*)
-fun mk_ids a 0 = []
-  | mk_ids a n = a :: mk_ids (bump_string a) (n-1);
-
-val consts = mk_ids "con1" 60;
-
-structure Enum = Datatype_Fun
- (val thy = Univ.thy;
-  val rec_specs = 
-      [("enum", "univ(0)",
-	  [(consts, "i")])];
-  val rec_styp = "i";
-  val ext = None
-  val sintrs = map (fn const => const ^ " : enum") consts;
-  val monos = [];
-  val type_intrs = datatype_intrs
-  val type_elims = []);
-
-goal Enum.thy "con59 ~= con60";
-by (simp_tac (ZF_ss addsimps Enum.free_iffs) 1);
-result();
-
--- a/src/ZF/ex/equiv.ML	Sat Apr 05 16:18:58 2003 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,268 +0,0 @@
-(*  Title: 	ZF/ex/equiv.ML
-    ID:         $Id$
-    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
-    Copyright   1993  University of Cambridge
-
-For equiv.thy.  Equivalence relations in Zermelo-Fraenkel Set Theory 
-*)
-
-val RSLIST = curry (op MRS);
-
-open Equiv;
-
-(*** Suppes, Theorem 70: r is an equiv relation iff converse(r) O r = r ***)
-
-(** first half: equiv(A,r) ==> converse(r) O r = r **)
-
-goalw Equiv.thy [trans_def,sym_def]
-    "!!r. [| sym(r); trans(r) |] ==> converse(r) O r <= r";
-by (fast_tac (ZF_cs addSEs [converseD,compE]) 1);
-val sym_trans_comp_subset = result();
-
-goalw Equiv.thy [refl_def]
-    "!!A r. refl(A,r) ==> r <= converse(r) O r";
-by (fast_tac (ZF_cs addSIs [converseI] addIs [compI]) 1);
-val refl_comp_subset = result();
-
-goalw Equiv.thy [equiv_def]
-    "!!A r. equiv(A,r) ==> converse(r) O r = r";
-by (rtac equalityI 1);
-by (REPEAT (ares_tac [sym_trans_comp_subset, refl_comp_subset] 1
-     ORELSE etac conjE 1));
-val equiv_comp_eq = result();
-
-(*second half*)
-goalw Equiv.thy [equiv_def,refl_def,sym_def,trans_def]
-    "!!A r. [| converse(r) O r = r;  domain(r) = A |] ==> equiv(A,r)";
-by (etac equalityE 1);
-by (subgoal_tac "ALL x y. <x,y> : r --> <y,x> : r" 1);
-by (safe_tac ZF_cs);
-by (fast_tac (ZF_cs addSIs [converseI] addIs [compI]) 3);
-by (ALLGOALS (fast_tac 
-	      (ZF_cs addSIs [converseI] addIs [compI] addSEs [compE])));
-by flexflex_tac;
-val comp_equivI = result();
-
-(** Equivalence classes **)
-
-(*Lemma for the next result*)
-goalw Equiv.thy [equiv_def,trans_def,sym_def]
-    "!!A r. [| equiv(A,r);  <a,b>: r |] ==> r``{a} <= r``{b}";
-by (fast_tac ZF_cs 1);
-val equiv_class_subset = result();
-
-goal Equiv.thy "!!A r. [| equiv(A,r);  <a,b>: r |] ==> r``{a} = r``{b}";
-by (REPEAT (ares_tac [equalityI, equiv_class_subset] 1));
-by (rewrite_goals_tac [equiv_def,sym_def]);
-by (fast_tac ZF_cs 1);
-val equiv_class_eq = result();
-
-val prems = goalw Equiv.thy [equiv_def,refl_def]
-    "[| equiv(A,r);  a: A |] ==> a: r``{a}";
-by (cut_facts_tac prems 1);
-by (fast_tac ZF_cs 1);
-val equiv_class_self = result();
-