src/HOL/Tools/res_axioms.ML
author paulson
Tue Nov 30 18:25:55 2004 +0100 (2004-11-30)
changeset 15347 14585bc8fa09
child 15359 8bad1f42fec0
permissions -rw-r--r--
resolution package tools by Jia Meng
paulson@15347
     1
(*  Author: Jia Meng, Cambridge University Computer Laboratory
paulson@15347
     2
    ID: $Id$
paulson@15347
     3
    Copyright 2004 University of Cambridge
paulson@15347
     4
paulson@15347
     5
Transformation of axiom rules (elim/intro/etc) into CNF forms.    
paulson@15347
     6
*)
paulson@15347
     7
paulson@15347
     8
paulson@15347
     9
paulson@15347
    10
signature RES_ELIM_RULE =
paulson@15347
    11
sig
paulson@15347
    12
paulson@15347
    13
exception ELIMR2FOL of string
paulson@15347
    14
val elimRule_tac : Thm.thm -> Tactical.tactic
paulson@15347
    15
val elimR2Fol : Thm.thm -> Term.term
paulson@15347
    16
val transform_elim : Thm.thm -> Thm.thm
paulson@15347
    17
paulson@15347
    18
end;
paulson@15347
    19
paulson@15347
    20
structure ResElimRule: RES_ELIM_RULE =
paulson@15347
    21
paulson@15347
    22
struct
paulson@15347
    23
paulson@15347
    24
paulson@15347
    25
fun elimRule_tac thm =
paulson@15347
    26
    ((rtac impI 1) ORELSE (rtac notI 1)) THEN (etac thm 1) THEN
paulson@15347
    27
    REPEAT(Blast_tac 1);
paulson@15347
    28
paulson@15347
    29
paulson@15347
    30
(* This following version fails sometimes, need to investigate, do not use it now. *)
paulson@15347
    31
fun elimRule_tac' thm =
paulson@15347
    32
   ((rtac impI 1) ORELSE (rtac notI 1)) THEN (etac thm 1) THEN
paulson@15347
    33
   REPEAT(SOLVE((etac exI 1) ORELSE (rtac conjI 1) ORELSE (rtac disjI1 1) ORELSE (rtac disjI2 1))); 
paulson@15347
    34
paulson@15347
    35
paulson@15347
    36
exception ELIMR2FOL of string;
paulson@15347
    37
paulson@15347
    38
fun make_imp (prem,concl) = Const("op -->", Type("fun",[Type("bool",[]),Type("fun",[Type("bool",[]),Type("bool",[])])])) $ prem $ concl;
paulson@15347
    39
paulson@15347
    40
paulson@15347
    41
fun make_disjs [x] = x
paulson@15347
    42
  | make_disjs (x :: xs) = Const("op |",Type("fun",[Type("bool",[]),Type("fun",[Type("bool",[]),Type("bool",[])])])) $ x $ (make_disjs xs)
paulson@15347
    43
paulson@15347
    44
paulson@15347
    45
fun make_conjs [x] = x
paulson@15347
    46
  | make_conjs (x :: xs) = Const("op &", Type("fun",[Type("bool",[]),Type("fun",[Type("bool",[]),Type("bool",[])])])) $ x $ (make_conjs xs)
paulson@15347
    47
paulson@15347
    48
paulson@15347
    49
fun add_EX term [] = term
paulson@15347
    50
  | add_EX term ((x,xtp)::xs) = add_EX (Const ("Ex",Type("fun",[Type("fun",[xtp,Type("bool",[])]),Type("bool",[])])) $ Abs (x,xtp,term)) xs;
paulson@15347
    51
paulson@15347
    52
paulson@15347
    53
exception TRUEPROP of string; 
paulson@15347
    54
paulson@15347
    55
fun strip_trueprop (Const ("Trueprop", Type("fun",[Type("bool",[]),Type("prop",[])])) $ P) = P
paulson@15347
    56
  | strip_trueprop _ = raise TRUEPROP("not a prop!");
paulson@15347
    57
paulson@15347
    58
paulson@15347
    59
paulson@15347
    60
exception STRIP_CONCL;
paulson@15347
    61
paulson@15347
    62
paulson@15347
    63
fun strip_concl prems bvs (Const ("all", _) $ Abs (x,xtp,body))  = strip_concl prems ((x,xtp)::bvs) body
paulson@15347
    64
  | strip_concl prems bvs (Const ("==>",_) $ P $ Q) =
paulson@15347
    65
    let val P' = strip_trueprop P
paulson@15347
    66
	val prems' = P'::prems
paulson@15347
    67
    in
paulson@15347
    68
	strip_concl prems' bvs  Q
paulson@15347
    69
    end
paulson@15347
    70
  | strip_concl prems bvs _ = add_EX (make_conjs prems) bvs;
paulson@15347
    71
 
paulson@15347
    72
paulson@15347
    73
paulson@15347
    74
fun trans_elim (main,others) =
paulson@15347
    75
    let val others' = map (strip_concl [] []) others
paulson@15347
    76
	val disjs = make_disjs others'
paulson@15347
    77
    in
paulson@15347
    78
	make_imp(strip_trueprop main,disjs)
paulson@15347
    79
    end;
paulson@15347
    80
paulson@15347
    81
paulson@15347
    82
fun neg P = Const ("Not", Type("fun",[Type("bool",[]),Type("bool",[])])) $ P;
paulson@15347
    83
paulson@15347
    84
paulson@15347
    85
fun elimR2Fol_aux prems = 
paulson@15347
    86
    let val nprems = length prems
paulson@15347
    87
	val main = hd prems
paulson@15347
    88
    in
paulson@15347
    89
	if (nprems = 1) then neg (strip_trueprop main)
paulson@15347
    90
        else trans_elim (main, tl prems)
paulson@15347
    91
    end;
paulson@15347
    92
paulson@15347
    93
paulson@15347
    94
fun trueprop term = Const ("Trueprop", Type("fun",[Type("bool",[]),Type("prop",[])])) $ term; 
paulson@15347
    95
	    
paulson@15347
    96
paulson@15347
    97
fun elimR2Fol elimR = 
paulson@15347
    98
    let val elimR' = Drule.freeze_all elimR
paulson@15347
    99
	val (prems,concl) = (prems_of elimR', concl_of elimR')
paulson@15347
   100
    in
paulson@15347
   101
	case concl of Const("Trueprop",_) $ Free(_,Type("bool",[])) 
paulson@15347
   102
		      => trueprop (elimR2Fol_aux prems)
paulson@15347
   103
                    | Free(x,Type("prop",[])) => trueprop(elimR2Fol_aux prems) 
paulson@15347
   104
		    | _ => raise ELIMR2FOL("Not an elimination rule!")
paulson@15347
   105
    end;
paulson@15347
   106
paulson@15347
   107
paulson@15347
   108
paulson@15347
   109
paulson@15347
   110
(**** use prove_goalw_cterm to prove ****)
paulson@15347
   111
paulson@15347
   112
fun transform_elim thm =
paulson@15347
   113
    let val tm = elimR2Fol thm
paulson@15347
   114
	val ctm = cterm_of (sign_of_thm thm) tm	
paulson@15347
   115
    in
paulson@15347
   116
	prove_goalw_cterm [] ctm (fn prems => [elimRule_tac thm])
paulson@15347
   117
    end;	
paulson@15347
   118
paulson@15347
   119
paulson@15347
   120
end;
paulson@15347
   121
paulson@15347
   122
paulson@15347
   123
(* some lemmas *)
paulson@15347
   124
paulson@15347
   125
(* TO BE FIXED: the names of these lemmas should be made local, to avoid confusion with external global lemmas. *)
paulson@15347
   126
paulson@15347
   127
Goal "(P==True) ==> P";
paulson@15347
   128
by(Blast_tac 1);
paulson@15347
   129
qed "Eq_TrueD1";
paulson@15347
   130
paulson@15347
   131
Goal "(P=True) ==> P";
paulson@15347
   132
by(Blast_tac 1);
paulson@15347
   133
qed "Eq_TrueD2";
paulson@15347
   134
paulson@15347
   135
paulson@15347
   136
Goal "(P==False) ==> ~P";
paulson@15347
   137
by(Blast_tac 1);
paulson@15347
   138
qed "Eq_FalseD1";
paulson@15347
   139
paulson@15347
   140
Goal "(P=False) ==> ~P";
paulson@15347
   141
by(Blast_tac 1);
paulson@15347
   142
qed "Eq_FalseD2";
paulson@15347
   143
paulson@15347
   144
Goal "(P | True) == True";
paulson@15347
   145
by(Simp_tac 1);
paulson@15347
   146
qed "s1";
paulson@15347
   147
paulson@15347
   148
Goal "(True | P) == True";
paulson@15347
   149
by(Simp_tac 1);
paulson@15347
   150
qed "s2";
paulson@15347
   151
paulson@15347
   152
Goal "(P & True) == P";
paulson@15347
   153
by(Simp_tac 1);
paulson@15347
   154
qed "s3";
paulson@15347
   155
paulson@15347
   156
Goal "(True & P) == P";
paulson@15347
   157
by(Simp_tac 1);
paulson@15347
   158
qed "s4";
paulson@15347
   159
paulson@15347
   160
Goal "(False | P) == P";
paulson@15347
   161
by(Simp_tac 1);
paulson@15347
   162
qed "s5";
paulson@15347
   163
paulson@15347
   164
paulson@15347
   165
Goal "(P | False) == P";
paulson@15347
   166
by(Simp_tac 1);
paulson@15347
   167
qed "s6";
paulson@15347
   168
paulson@15347
   169
Goal "(False & P) == False";
paulson@15347
   170
by(Simp_tac 1);
paulson@15347
   171
qed "s7";
paulson@15347
   172
paulson@15347
   173
Goal "(P & False) == False";
paulson@15347
   174
by(Simp_tac 1);
paulson@15347
   175
qed "s8";
paulson@15347
   176
paulson@15347
   177
Goal "~True == False";
paulson@15347
   178
by(Simp_tac 1);
paulson@15347
   179
qed "s9";
paulson@15347
   180
paulson@15347
   181
Goal "~False == True";
paulson@15347
   182
by(Simp_tac 1);
paulson@15347
   183
qed "s10";
paulson@15347
   184
paulson@15347
   185
paulson@15347
   186
val small_simpset = empty_ss addsimps [s1,s2,s3,s4,s5,s6,s7,s8,s9,s10];
paulson@15347
   187
paulson@15347
   188
paulson@15347
   189
paulson@15347
   190
signature RES_AXIOMS =
paulson@15347
   191
sig
paulson@15347
   192
paulson@15347
   193
val clausify_axiom : Thm.thm -> ResClause.clause list
paulson@15347
   194
val cnf_axiom : Thm.thm -> Thm.thm list
paulson@15347
   195
val cnf_elim : Thm.thm -> Thm.thm list
paulson@15347
   196
val cnf_intro : Thm.thm -> Thm.thm list
paulson@15347
   197
val cnf_rule : Thm.thm -> Thm.thm list
paulson@15347
   198
val cnf_classical_rules_thy : Theory.theory -> Thm.thm list list * Thm.thm list
paulson@15347
   199
val clausify_classical_rules_thy 
paulson@15347
   200
: Theory.theory -> ResClause.clause list list * Thm.thm list
paulson@15347
   201
val cnf_simpset_rules_thy 
paulson@15347
   202
: Theory.theory -> Thm.thm list list * Thm.thm list
paulson@15347
   203
val clausify_simpset_rules_thy 
paulson@15347
   204
: Theory.theory -> ResClause.clause list list * Thm.thm list
paulson@15347
   205
val rm_Eps 
paulson@15347
   206
: (Term.term * Term.term) list -> Thm.thm list -> Term.term list
paulson@15347
   207
end;
paulson@15347
   208
paulson@15347
   209
structure ResAxioms : RES_AXIOMS =
paulson@15347
   210
 
paulson@15347
   211
struct
paulson@15347
   212
paulson@15347
   213
open ResElimRule;
paulson@15347
   214
paulson@15347
   215
(* to be fixed: cnf_intro, cnf_rule, is_introR *)
paulson@15347
   216
paulson@15347
   217
fun is_elimR thm = 
paulson@15347
   218
    case (concl_of thm) of (Const ("Trueprop", _) $ Var (idx,_)) => true
paulson@15347
   219
			 | Var(indx,Type("prop",[])) => true
paulson@15347
   220
			 | _ => false;
paulson@15347
   221
paulson@15347
   222
paulson@15347
   223
paulson@15347
   224
fun repeat_RS thm1 thm2 =
paulson@15347
   225
    let val thm1' =  thm1 RS thm2 handle THM _ => thm1
paulson@15347
   226
    in
paulson@15347
   227
	if eq_thm(thm1,thm1') then thm1' else (repeat_RS thm1' thm2)
paulson@15347
   228
    end;
paulson@15347
   229
paulson@15347
   230
paulson@15347
   231
paulson@15347
   232
(* added this function to remove True/False in a theorem that is in NNF form. *)
paulson@15347
   233
fun rm_TF_nnf thm = simplify small_simpset thm;
paulson@15347
   234
paulson@15347
   235
fun skolem_axiom thm = 
paulson@15347
   236
    let val thm' = (skolemize o rm_TF_nnf o  make_nnf o ObjectLogic.atomize_thm o Drule.freeze_all) thm
paulson@15347
   237
    in 
paulson@15347
   238
	repeat_RS thm' someI_ex
paulson@15347
   239
    end;
paulson@15347
   240
paulson@15347
   241
paulson@15347
   242
fun isa_cls thm = 
paulson@15347
   243
    let val thm' = skolem_axiom thm 
paulson@15347
   244
    in
paulson@15347
   245
	map standard (make_clauses [thm'])
paulson@15347
   246
    end;
paulson@15347
   247
paulson@15347
   248
paulson@15347
   249
fun cnf_elim thm = 
paulson@15347
   250
    let val thm' = transform_elim thm;
paulson@15347
   251
    in
paulson@15347
   252
	isa_cls thm'
paulson@15347
   253
    end;
paulson@15347
   254
paulson@15347
   255
paulson@15347
   256
val cnf_intro = isa_cls;
paulson@15347
   257
val cnf_rule = isa_cls;	
paulson@15347
   258
paulson@15347
   259
paulson@15347
   260
fun is_introR thm = true;
paulson@15347
   261
paulson@15347
   262
paulson@15347
   263
paulson@15347
   264
(* transfer a theorem in to theory Main.thy if it is not already inside Main.thy *)
paulson@15347
   265
fun transfer_to_Main thm = transfer Main.thy thm handle THM _ => thm;
paulson@15347
   266
paulson@15347
   267
(* remove "True" clause *)
paulson@15347
   268
fun rm_redundant_cls [] = []
paulson@15347
   269
  | rm_redundant_cls (thm::thms) =
paulson@15347
   270
    let val t = prop_of thm
paulson@15347
   271
    in
paulson@15347
   272
	case t of (Const ("Trueprop", _) $ Const ("True", _)) => rm_redundant_cls thms
paulson@15347
   273
		| _ => thm::(rm_redundant_cls thms)
paulson@15347
   274
    end;
paulson@15347
   275
paulson@15347
   276
(* transform an Isabelle thm into CNF *)
paulson@15347
   277
fun cnf_axiom thm =
paulson@15347
   278
    let val thm' = transfer_to_Main thm
paulson@15347
   279
	val thm'' = if (is_elimR thm') then (cnf_elim thm')
paulson@15347
   280
		    else (if (is_introR thm') then cnf_intro thm' else cnf_rule thm')
paulson@15347
   281
    in
paulson@15347
   282
	rm_redundant_cls thm''
paulson@15347
   283
    end;
paulson@15347
   284
paulson@15347
   285
paulson@15347
   286
(* changed: with one extra case added *)
paulson@15347
   287
fun univ_vars_of_aux (Const ("Hilbert_Choice.Eps",_) $ Abs(_,_,body)) vars = univ_vars_of_aux body vars
paulson@15347
   288
  | univ_vars_of_aux (Const ("Ex",_) $ Abs(_,_,body)) vars = univ_vars_of_aux body vars (* EX x. body *)
paulson@15347
   289
  | univ_vars_of_aux (P $ Q) vars =
paulson@15347
   290
    let val vars' = univ_vars_of_aux P vars
paulson@15347
   291
    in
paulson@15347
   292
	univ_vars_of_aux Q vars'
paulson@15347
   293
    end
paulson@15347
   294
  | univ_vars_of_aux (t as Var(_,_)) vars = 
paulson@15347
   295
    if (t mem vars) then vars else (t::vars)
paulson@15347
   296
  | univ_vars_of_aux _ vars = vars;
paulson@15347
   297
  
paulson@15347
   298
paulson@15347
   299
fun univ_vars_of t = univ_vars_of_aux t [];
paulson@15347
   300
paulson@15347
   301
paulson@15347
   302
fun get_new_skolem epss (t as (Const ("Hilbert_Choice.Eps",_) $ Abs(_,tp,_)))  = 
paulson@15347
   303
    let val all_vars = univ_vars_of t
paulson@15347
   304
	val sk_term = ResSkolemFunction.gen_skolem all_vars tp
paulson@15347
   305
    in
paulson@15347
   306
	(sk_term,(t,sk_term)::epss)
paulson@15347
   307
    end;
paulson@15347
   308
paulson@15347
   309
paulson@15347
   310
fun sk_lookup [] t = None
paulson@15347
   311
  | sk_lookup ((tm,sk_tm)::tms) t = if (t = tm) then Some (sk_tm) else (sk_lookup tms t);
paulson@15347
   312
paulson@15347
   313
paulson@15347
   314
fun get_skolem epss t = 
paulson@15347
   315
    let val sk_fun = sk_lookup epss t
paulson@15347
   316
    in
paulson@15347
   317
	case sk_fun of None => get_new_skolem epss t
paulson@15347
   318
		     | Some sk => (sk,epss)
paulson@15347
   319
    end;
paulson@15347
   320
paulson@15347
   321
paulson@15347
   322
fun rm_Eps_cls_aux epss (t as (Const ("Hilbert_Choice.Eps",_) $ Abs(_,_,_))) = get_skolem epss t
paulson@15347
   323
  | rm_Eps_cls_aux epss (P $ Q) =
paulson@15347
   324
    let val (P',epss') = rm_Eps_cls_aux epss P
paulson@15347
   325
	val (Q',epss'') = rm_Eps_cls_aux epss' Q
paulson@15347
   326
    in
paulson@15347
   327
	(P' $ Q',epss'')
paulson@15347
   328
    end
paulson@15347
   329
  | rm_Eps_cls_aux epss t = (t,epss);
paulson@15347
   330
paulson@15347
   331
paulson@15347
   332
fun rm_Eps_cls epss thm =
paulson@15347
   333
    let val tm = prop_of thm
paulson@15347
   334
    in
paulson@15347
   335
	rm_Eps_cls_aux epss tm
paulson@15347
   336
    end;
paulson@15347
   337
paulson@15347
   338
paulson@15347
   339
paulson@15347
   340
fun rm_Eps _ [] = []
paulson@15347
   341
  | rm_Eps epss (thm::thms) = 
paulson@15347
   342
    let val (thm',epss') = rm_Eps_cls epss thm
paulson@15347
   343
    in
paulson@15347
   344
	thm' :: (rm_Eps epss' thms)
paulson@15347
   345
    end;
paulson@15347
   346
paulson@15347
   347
paulson@15347
   348
paulson@15347
   349
(* changed, now it also finds out the name of the theorem. *)
paulson@15347
   350
fun clausify_axiom thm =
paulson@15347
   351
    let val isa_clauses = cnf_axiom thm (*"isa_clauses" are already "standard"ed. *)
paulson@15347
   352
        val isa_clauses' = rm_Eps [] isa_clauses
paulson@15347
   353
        val thm_name = Thm.name_of_thm thm
paulson@15347
   354
	val clauses_n = length isa_clauses
paulson@15347
   355
	fun make_axiom_clauses _ [] = []
paulson@15347
   356
	  | make_axiom_clauses i (cls::clss) = (ResClause.make_axiom_clause cls (thm_name,i)) :: make_axiom_clauses (i+1) clss 
paulson@15347
   357
    in
paulson@15347
   358
	make_axiom_clauses 0 isa_clauses'
paulson@15347
   359
		
paulson@15347
   360
    end;
paulson@15347
   361
  
paulson@15347
   362
paulson@15347
   363
(******** Extracting and CNF/Clausify theorems from a classical reasoner and simpset of a given theory ******)
paulson@15347
   364
paulson@15347
   365
paulson@15347
   366
local
paulson@15347
   367
paulson@15347
   368
fun retr_thms ([]:MetaSimplifier.rrule list) = []
paulson@15347
   369
	  | retr_thms (r::rs) = (#thm r)::(retr_thms rs);
paulson@15347
   370
paulson@15347
   371
paulson@15347
   372
fun snds [] = []
paulson@15347
   373
  |   snds ((x,y)::l) = y::(snds l);
paulson@15347
   374
paulson@15347
   375
in
paulson@15347
   376
paulson@15347
   377
paulson@15347
   378
fun claset_rules_of_thy thy =
paulson@15347
   379
    let val clsset = rep_cs (claset_of thy)
paulson@15347
   380
	val safeEs = #safeEs clsset
paulson@15347
   381
	val safeIs = #safeIs clsset
paulson@15347
   382
	val hazEs = #hazEs clsset
paulson@15347
   383
	val hazIs = #hazIs clsset
paulson@15347
   384
    in
paulson@15347
   385
	safeEs @ safeIs @ hazEs @ hazIs
paulson@15347
   386
    end;
paulson@15347
   387
paulson@15347
   388
fun simpset_rules_of_thy thy =
paulson@15347
   389
    let val simpset = simpset_of thy
paulson@15347
   390
	val rules = #rules(fst (rep_ss simpset))
paulson@15347
   391
	val thms = retr_thms (snds(Net.dest rules))
paulson@15347
   392
    in
paulson@15347
   393
	thms
paulson@15347
   394
    end;
paulson@15347
   395
paulson@15347
   396
end;
paulson@15347
   397
paulson@15347
   398
paulson@15347
   399
(**** Translate a set of classical rules or simplifier rules into CNF (still as type "thm") from a given theory ****)
paulson@15347
   400
paulson@15347
   401
(* classical rules *)
paulson@15347
   402
fun cnf_classical_rules [] err_list = ([],err_list)
paulson@15347
   403
  | cnf_classical_rules (thm::thms) err_list = 
paulson@15347
   404
    let val (ts,es) = cnf_classical_rules thms err_list
paulson@15347
   405
    in
paulson@15347
   406
	((cnf_axiom thm)::ts,es) handle  _ => (ts,(thm::es))
paulson@15347
   407
    end;
paulson@15347
   408
paulson@15347
   409
paulson@15347
   410
(* CNF all rules from a given theory's classical reasoner *)
paulson@15347
   411
fun cnf_classical_rules_thy thy = 
paulson@15347
   412
    let val rules = claset_rules_of_thy thy
paulson@15347
   413
    in
paulson@15347
   414
        cnf_classical_rules rules []
paulson@15347
   415
    end;
paulson@15347
   416
paulson@15347
   417
paulson@15347
   418
(* simplifier rules *)
paulson@15347
   419
fun cnf_simpset_rules [] err_list = ([],err_list)
paulson@15347
   420
  | cnf_simpset_rules (thm::thms) err_list =
paulson@15347
   421
    let val (ts,es) = cnf_simpset_rules thms err_list
paulson@15347
   422
    in
paulson@15347
   423
	((cnf_axiom thm)::ts,es) handle _ => (ts,(thm::es))
paulson@15347
   424
    end;
paulson@15347
   425
paulson@15347
   426
paulson@15347
   427
(* CNF all simplifier rules from a given theory's simpset *)
paulson@15347
   428
fun cnf_simpset_rules_thy thy =
paulson@15347
   429
    let val thms = simpset_rules_of_thy thy
paulson@15347
   430
    in
paulson@15347
   431
	cnf_simpset_rules thms []
paulson@15347
   432
    end;
paulson@15347
   433
paulson@15347
   434
paulson@15347
   435
paulson@15347
   436
(**** Convert all theorems of a classical reason/simpset into clauses (ResClause.clause) ****)
paulson@15347
   437
paulson@15347
   438
(* classical rules *)
paulson@15347
   439
fun clausify_classical_rules [] err_list = ([],err_list)
paulson@15347
   440
  | clausify_classical_rules (thm::thms) err_list =
paulson@15347
   441
    let val (ts,es) = clausify_classical_rules thms err_list
paulson@15347
   442
    in
paulson@15347
   443
	((clausify_axiom thm)::ts,es) handle  _ => (ts,(thm::es))
paulson@15347
   444
    end;
paulson@15347
   445
paulson@15347
   446
fun clausify_classical_rules_thy thy =
paulson@15347
   447
    let val rules = claset_rules_of_thy thy
paulson@15347
   448
    in
paulson@15347
   449
	clausify_classical_rules rules []
paulson@15347
   450
    end;
paulson@15347
   451
paulson@15347
   452
paulson@15347
   453
(* simplifier rules *)
paulson@15347
   454
fun clausify_simpset_rules [] err_list = ([],err_list)
paulson@15347
   455
  | clausify_simpset_rules (thm::thms) err_list =
paulson@15347
   456
    let val (ts,es) = clausify_simpset_rules thms err_list
paulson@15347
   457
    in
paulson@15347
   458
	((clausify_axiom thm)::ts,es) handle _ => (ts,(thm::es))
paulson@15347
   459
    end;
paulson@15347
   460
paulson@15347
   461
paulson@15347
   462
fun clausify_simpset_rules_thy thy =
paulson@15347
   463
    let val thms = simpset_rules_of_thy thy
paulson@15347
   464
    in
paulson@15347
   465
	clausify_simpset_rules thms []
paulson@15347
   466
    end;
paulson@15347
   467
paulson@15347
   468
paulson@15347
   469
paulson@15347
   470
paulson@15347
   471
end;