src/HOL/Tools/ATP/res_clasimpset.ML
author paulson
Mon Jan 23 11:41:54 2006 +0100 (2006-01-23)
changeset 18753 aa82bd41555d
parent 18677 01265301db7f
child 18792 fb427f4a01f2
permissions -rw-r--r--
ResClasimp.get_clasimp_lemmas now takes all subgoals rather than only the first
paulson@16795
     1
(*  ID:      $Id$
paulson@15789
     2
    Author:     Claire Quigley
paulson@15789
     3
    Copyright   2004  University of Cambridge
paulson@15789
     4
*)
paulson@15789
     5
paulson@16741
     6
structure ReduceAxiomsN =
paulson@16741
     7
(* Author: Jia Meng, Cambridge University Computer Laboratory
paulson@17234
     8
   Remove irrelevant axioms used for a proof of a goal, with with iteration control
paulson@17234
     9
   Initial version. Needs elaboration. *)
paulson@16741
    10
paulson@16741
    11
struct
paulson@16741
    12
paulson@18509
    13
fun add_term_consts_rm ncs (Const(c, _)) cs = if (c mem ncs) then cs else (c ins_string cs)
paulson@16795
    14
  | add_term_consts_rm ncs (t $ u) cs =
paulson@16795
    15
      add_term_consts_rm ncs t (add_term_consts_rm ncs u cs)
paulson@16741
    16
  | add_term_consts_rm ncs (Abs(_,_,t)) cs = add_term_consts_rm ncs t cs
paulson@16741
    17
  | add_term_consts_rm ncs _ cs = cs;
paulson@16741
    18
paulson@16741
    19
fun term_consts_rm ncs t = add_term_consts_rm ncs t [];
paulson@16741
    20
fun thm_consts_rm ncs thm = term_consts_rm ncs (prop_of thm);
paulson@16741
    21
fun consts_of_thm (n,thm) = thm_consts_rm ["Trueprop","==>","all","Ex","op &", "op |", "Not", "All", "op -->", "op =", "==", "True", "False"] thm;
paulson@16741
    22
fun consts_of_term term = term_consts_rm ["Trueprop","==>","all","Ex","op &", "op |", "Not", "All", "op -->", "op =", "==", "True", "False"] term;
paulson@16741
    23
paulson@16741
    24
fun make_pairs [] _ = []
paulson@16741
    25
  | make_pairs (x::xs) y = (x,y)::(make_pairs xs y);
paulson@16741
    26
paulson@16741
    27
fun const_thm_list_aux [] cthms = cthms
paulson@16741
    28
  | const_thm_list_aux (thm::thms) cthms =
paulson@16741
    29
    let val consts = consts_of_thm thm
paulson@16741
    30
	val cthms' = make_pairs consts thm 
paulson@18509
    31
    in const_thm_list_aux thms (cthms' @ cthms) end;
paulson@16741
    32
paulson@16741
    33
fun const_thm_list thms = const_thm_list_aux thms [];
paulson@16741
    34
paulson@18509
    35
fun make_thm_table thms = Symtab.make_multi (const_thm_list thms);
paulson@16741
    36
paulson@16741
    37
fun consts_in_goal goal = consts_of_term goal;
paulson@16741
    38
paulson@16741
    39
fun axioms_having_consts_aux [] tab thms = thms
paulson@16741
    40
  | axioms_having_consts_aux (c::cs) tab thms =
paulson@18509
    41
    let val thms2 = Option.getOpt (Symtab.lookup tab c, [])
paulson@18509
    42
    in axioms_having_consts_aux cs tab (thms2 union thms) end;
paulson@16741
    43
paulson@16741
    44
fun axioms_having_consts cs tab = axioms_having_consts_aux cs tab [];
paulson@16741
    45
paulson@16741
    46
fun relevant_axioms goal thmTab n =  
paulson@18509
    47
    let fun relevant_axioms_aux1 cs k =
paulson@16741
    48
	    let val thms1 = axioms_having_consts cs thmTab
paulson@17764
    49
		val cs1 = foldl (op union_string) [] (map consts_of_thm thms1)
paulson@16741
    50
	    in
paulson@18509
    51
		if (cs1 subset cs) orelse n <= k then (k,thms1) 
paulson@18509
    52
		else relevant_axioms_aux1 (cs1 union cs) (k+1)
paulson@16741
    53
	    end
paulson@18509
    54
    in  relevant_axioms_aux1 (consts_in_goal goal) 1  end;
paulson@16741
    55
paulson@16795
    56
fun relevant_filter n goal thms = 
paulson@16795
    57
    if n<=0 then thms 
paulson@16795
    58
    else #2 (relevant_axioms goal (make_thm_table thms) n);
paulson@16741
    59
paulson@16741
    60
(* find the thms from thy that contain relevant constants, n is the iteration number *)
paulson@16741
    61
fun find_axioms_n thy goal n =
paulson@16741
    62
    let val clasetR = ResAxioms.claset_rules_of_thy thy
paulson@16741
    63
	val simpsetR = ResAxioms.simpset_rules_of_thy thy	  
paulson@16741
    64
	val table = make_thm_table (clasetR @ simpsetR)	
paulson@18509
    65
    in relevant_axioms goal table n end;
paulson@16741
    66
paulson@16741
    67
fun find_axioms_n_c thy goal n =
paulson@16741
    68
    let val current_thms = PureThy.thms_of thy
paulson@16741
    69
	val table = make_thm_table current_thms
paulson@18509
    70
    in relevant_axioms goal table n end;
paulson@16741
    71
paulson@16741
    72
end;
paulson@16741
    73
paulson@16741
    74
quigley@16156
    75
signature RES_CLASIMP = 
quigley@15919
    76
  sig
paulson@18509
    77
  val blacklist : string list ref (*Theorems forbidden in the output*)
paulson@18677
    78
  val theory_blacklist : string list ref (*entire blacklisted theories*)
paulson@16795
    79
  val relevant : int ref
quigley@16950
    80
  val use_simpset: bool ref
paulson@17305
    81
  val get_clasimp_lemmas : 
paulson@18753
    82
         Proof.context -> term list -> 
paulson@17484
    83
         (ResClause.clause * thm) Array.array * ResClause.clause list 
quigley@15919
    84
  end;
quigley@15919
    85
quigley@15919
    86
structure ResClasimp : RES_CLASIMP =
quigley@15919
    87
struct
paulson@17305
    88
val use_simpset = ref false;   (*Performance is much better without simprules*)
paulson@16957
    89
paulson@18509
    90
(*In general, these produce clauses that are prolific (match too many equality or
paulson@18677
    91
  membership literals) and relate to seldom-used facts. Some duplicate other rules.
paulson@18677
    92
  FIXME: this blacklist needs to be maintained using theory data and added to using
paulson@18677
    93
  an attribute.*)
paulson@18509
    94
val blacklist = ref
paulson@18677
    95
  ["Datatype.not_None_eq_iff2",
paulson@18677
    96
   "Datatype.not_Some_eq_D",
paulson@18677
    97
   "Datatype.not_Some_eq",
paulson@18677
    98
   "Datatype.option.size_1",
paulson@18677
    99
   "Datatype.option.size_2",
paulson@18677
   100
   "Datatype.prod.size",
paulson@18677
   101
   "Datatype.sum.size_1",
paulson@18677
   102
   "Datatype.sum.size_2",
paulson@18677
   103
   "Datatype.unit.size",
paulson@18677
   104
   "Divides.dvd_0_left_iff",
paulson@18677
   105
   "Finite_Set.card_0_eq",
paulson@18677
   106
   "Finite_Set.card_infinite",
paulson@18677
   107
   "Finite_Set.Max_ge",
paulson@18677
   108
   "Finite_Set.Max_in",
paulson@18509
   109
   "Finite_Set.Max_le_iff",
paulson@18509
   110
   "Finite_Set.Max_less_iff",
paulson@18677
   111
   "Finite_Set.max.f_below_strict_below.below_f_conv", (*duplicates in Orderings.*)
paulson@18677
   112
   "Finite_Set.max.f_below_strict_below.strict_below_f_conv", (*duplicates in Orderings.*)
paulson@18509
   113
   "Finite_Set.Min_ge_iff",
paulson@18509
   114
   "Finite_Set.Min_gr_iff",
paulson@18677
   115
   "Finite_Set.Min_in",
paulson@18677
   116
   "Finite_Set.Min_le",
paulson@18677
   117
   "Finite_Set.min_max.below_inf_sup_Inf_Sup.inf_Sup_absorb", 
paulson@18677
   118
   "Finite_Set.min_max.below_inf_sup_Inf_Sup.sup_Inf_absorb", 
paulson@18677
   119
   "Finite_Set.min.f_below_strict_below.below_f_conv",        (*duplicates in Orderings.*)
paulson@18677
   120
   "Finite_Set.min.f_below_strict_below.strict_below_f_conv", (*duplicates in Orderings.*)
paulson@18509
   121
   "Infinite_Set.atmost_one_unique",
paulson@18677
   122
   "IntArith.zabs_less_one_iff",
paulson@18677
   123
   "IntDef.Integ.Abs_Integ_inject",
paulson@18677
   124
   "IntDef.Integ.Abs_Integ_inverse",
paulson@18677
   125
   "IntDiv.zdvd_0_left",
paulson@18677
   126
   "IntDiv.zero_less_zpower_abs_iff",
paulson@18677
   127
   "List.append_eq_append_conv",
paulson@18677
   128
   "List.Cons_in_lex",
paulson@18509
   129
   "List.in_listsD",
paulson@18509
   130
   "List.in_listsI",
paulson@18677
   131
   "List.lists.Cons",
paulson@18509
   132
   "List.listsE",
paulson@18677
   133
   "List.take_eq_Nil",
paulson@18677
   134
   "Nat.less_one",
paulson@18677
   135
   "Nat.less_one", (*not directional? obscure*)
paulson@18677
   136
   "Nat.not_gr0",
paulson@18677
   137
   "Nat.one_eq_mult_iff", (*duplicate by symmetry*)
paulson@18677
   138
   "NatArith.of_nat_0_eq_iff",
paulson@18677
   139
   "NatArith.of_nat_eq_0_iff",
paulson@18677
   140
   "NatArith.of_nat_le_0_iff",
paulson@18677
   141
   "NatSimprocs.divide_le_0_iff_number_of",  (*seldom used; often prolific*)
paulson@18677
   142
   "NatSimprocs.divide_le_0_iff_number_of",  (*too many clauses*)
paulson@18677
   143
   "NatSimprocs.divide_less_0_iff_number_of",
paulson@18677
   144
   "NatSimprocs.divide_less_0_iff_number_of",   (*too many clauses*)
paulson@18677
   145
   "NatSimprocs.equation_minus_iff_1",  (*not directional*)
paulson@18677
   146
   "NatSimprocs.equation_minus_iff_number_of", (*not directional*)
paulson@18677
   147
   "NatSimprocs.le_minus_iff_1", (*not directional*)
paulson@18677
   148
   "NatSimprocs.le_minus_iff_number_of",  (*not directional*)
paulson@18677
   149
   "NatSimprocs.less_minus_iff_1", (*not directional*)
paulson@18677
   150
   "NatSimprocs.less_minus_iff_number_of", (*not directional*)
paulson@18677
   151
   "NatSimprocs.minus_equation_iff_number_of", (*not directional*)
paulson@18677
   152
   "NatSimprocs.minus_le_iff_1", (*not directional*)
paulson@18677
   153
   "NatSimprocs.minus_le_iff_number_of", (*not directional*)
paulson@18677
   154
   "NatSimprocs.minus_less_iff_1", (*not directional*)
paulson@18677
   155
   "NatSimprocs.mult_le_cancel_left_number_of", (*excessive case analysis*)
paulson@18677
   156
   "NatSimprocs.mult_le_cancel_right_number_of", (*excessive case analysis*)
paulson@18677
   157
   "NatSimprocs.mult_less_cancel_left_number_of", (*excessive case analysis*)
paulson@18677
   158
   "NatSimprocs.mult_less_cancel_right_number_of", (*excessive case analysis*)
paulson@18677
   159
   "NatSimprocs.zero_le_divide_iff_number_of",
paulson@18677
   160
   "NatSimprocs.zero_le_divide_iff_number_of", (*excessive case analysis*)
paulson@18677
   161
   "NatSimprocs.zero_less_divide_iff_number_of",
paulson@18677
   162
   "NatSimprocs.zero_less_divide_iff_number_of", (*excessive case analysis*)
paulson@18677
   163
   "OrderedGroup.abs_0_eq",
paulson@18677
   164
   "OrderedGroup.abs_0_eq", (*duplicate by symmetry*)
paulson@18677
   165
   "OrderedGroup.diff_eq_0_iff_eq", (*prolific?*)
paulson@18677
   166
   "OrderedGroup.join_0_eq_0",
paulson@18677
   167
   "OrderedGroup.meet_0_eq_0",
paulson@18677
   168
   "OrderedGroup.pprt_eq_0",   (*obscure*)
paulson@18677
   169
   "OrderedGroup.pprt_eq_id",   (*obscure*)
paulson@18677
   170
   "OrderedGroup.pprt_mono",   (*obscure*)
paulson@18677
   171
   "Parity.even_nat_power",   (*obscure, somewhat prolilfic*)
paulson@18677
   172
   "Parity.power_eq_0_iff_number_of",
paulson@18677
   173
   "Parity.power_eq_0_iff_number_of",
paulson@18677
   174
   "Parity.power_le_zero_eq_number_of",
paulson@18677
   175
   "Parity.power_le_zero_eq_number_of",   (*obscure and prolific*)
paulson@18677
   176
   "Parity.power_less_zero_eq_number_of",
paulson@18677
   177
   "Parity.zero_le_power_eq_number_of",   (*obscure and prolific*)
paulson@18677
   178
   "Parity.zero_less_power_eq_number_of",   (*obscure and prolific*)
paulson@18677
   179
   "Power.zero_less_power_abs_iff",
paulson@18677
   180
   "Relation.diagI",
paulson@18509
   181
   "Relation.ImageI",
paulson@18677
   182
   "Ring_and_Field.divide_cancel_left", (*fields are seldom used & often prolific*)
paulson@18677
   183
   "Ring_and_Field.divide_cancel_right",
paulson@18677
   184
   "Ring_and_Field.divide_divide_eq_left",
paulson@18677
   185
   "Ring_and_Field.divide_divide_eq_right",
paulson@18677
   186
   "Ring_and_Field.divide_eq_0_iff",
paulson@18677
   187
   "Ring_and_Field.divide_eq_1_iff",
paulson@18677
   188
   "Ring_and_Field.divide_eq_eq_1",
paulson@18677
   189
   "Ring_and_Field.divide_le_0_1_iff",
paulson@18677
   190
   "Ring_and_Field.divide_le_eq_1_neg",
paulson@18677
   191
   "Ring_and_Field.divide_le_eq_1_neg",  (*obscure and prolific*)
paulson@18677
   192
   "Ring_and_Field.divide_le_eq_1_pos",
paulson@18677
   193
   "Ring_and_Field.divide_le_eq_1_pos",  (*obscure and prolific*)
paulson@18677
   194
   "Ring_and_Field.divide_less_0_1_iff",
paulson@18677
   195
   "Ring_and_Field.divide_less_eq_1_neg",  (*obscure and prolific*)
paulson@18677
   196
   "Ring_and_Field.divide_less_eq_1_pos",
paulson@18677
   197
   "Ring_and_Field.divide_less_eq_1_pos",  (*obscure and prolific*)
paulson@18677
   198
   "Ring_and_Field.eq_divide_eq_1",
paulson@18677
   199
   "Ring_and_Field.eq_divide_eq_1", (*duplicate by symmetry*)
paulson@18677
   200
   "Ring_and_Field.field_mult_cancel_left",
paulson@18677
   201
   "Ring_and_Field.field_mult_cancel_right",
paulson@18677
   202
   "Ring_and_Field.inverse_le_iff_le_neg",
paulson@18677
   203
   "Ring_and_Field.inverse_le_iff_le",
paulson@18677
   204
   "Ring_and_Field.inverse_less_iff_less_neg",
paulson@18677
   205
   "Ring_and_Field.inverse_less_iff_less",
paulson@18677
   206
   "Ring_and_Field.le_divide_eq_1_neg",
paulson@18677
   207
   "Ring_and_Field.le_divide_eq_1_neg", (*obscure and prolific*)
paulson@18677
   208
   "Ring_and_Field.le_divide_eq_1_pos",
paulson@18677
   209
   "Ring_and_Field.le_divide_eq_1_pos", (*obscure and prolific*)
paulson@18677
   210
   "Ring_and_Field.less_divide_eq_1_neg",
paulson@18677
   211
   "Ring_and_Field.less_divide_eq_1_neg", (*obscure and prolific*)
paulson@18677
   212
   "Ring_and_Field.less_divide_eq_1_pos",
paulson@18677
   213
   "Ring_and_Field.less_divide_eq_1_pos", (*obscure and prolific*)
paulson@18677
   214
   "Ring_and_Field.one_eq_divide_iff",  (*duplicate by symmetry*)
paulson@18677
   215
   "Set.Diff_eq_empty_iff", (*redundant with paramodulation*)
paulson@18509
   216
   "Set.Diff_insert0",
paulson@18677
   217
   "Set.disjoint_insert_1",
paulson@18677
   218
   "Set.disjoint_insert_2",
paulson@18677
   219
   "Set.empty_Union_conv", (*redundant with paramodulation*)
paulson@18677
   220
   "Set.insert_disjoint_1",
paulson@18677
   221
   "Set.insert_disjoint_2",
paulson@18677
   222
   "Set.Int_UNIV", (*redundant with paramodulation*)
paulson@18677
   223
   "Set.Inter_iff",              (*We already have InterI, InterE*)
paulson@18509
   224
   "Set.Inter_UNIV_conv_1",
paulson@18509
   225
   "Set.Inter_UNIV_conv_2",
paulson@18677
   226
   "Set.psubsetE",    (*too prolific and obscure*)
paulson@18677
   227
   "Set.psubsetI",
paulson@18677
   228
   "Set.singleton_insert_inj_eq'",
paulson@18677
   229
   "Set.singleton_insert_inj_eq",
paulson@18677
   230
   "Set.singletonD",  (*these two duplicate some "insert" lemmas*)
paulson@18677
   231
   "Set.singletonI",
paulson@18677
   232
   "Set.Un_empty", (*redundant with paramodulation*)
paulson@18677
   233
   "Set.Union_empty_conv", (*redundant with paramodulation*)
paulson@18509
   234
   "Set.Union_iff",              (*We already have UnionI, UnionE*)
paulson@18677
   235
   "SetInterval.atLeastAtMost_iff", (*obscure and prolific*)
paulson@18677
   236
   "SetInterval.atLeastLessThan_iff", (*obscure and prolific*)
paulson@18677
   237
   "SetInterval.greaterThanAtMost_iff", (*obscure and prolific*)
paulson@18677
   238
   "SetInterval.greaterThanLessThan_iff", (*obscure and prolific*)
paulson@18677
   239
   "SetInterval.ivl_subset", (*excessive case analysis*)
paulson@18509
   240
   "Sum_Type.InlI",
paulson@18677
   241
   "Sum_Type.InrI"];
paulson@18677
   242
   
paulson@18677
   243
(*These might be prolific but are probably OK, and min and max are basic.
paulson@18677
   244
   "Orderings.max_less_iff_conj", 
paulson@18509
   245
   "Orderings.min_less_iff_conj",
paulson@18509
   246
   "Orderings.min_max.below_inf.below_inf_conv",
paulson@18509
   247
   "Orderings.min_max.below_sup.above_sup_conv",
paulson@18677
   248
Very prolific and somewhat obscure:
paulson@18677
   249
   "Set.InterD",
paulson@18677
   250
   "Set.UnionI",
paulson@18509
   251
*)
paulson@18509
   252
paulson@18677
   253
val theory_blacklist = ref
paulson@18677
   254
  ["Datatype_Universe.",    (*unnecessary in virtually all proofs*)
paulson@18677
   255
   "Equiv_Relations."]  
paulson@18677
   256
paulson@18677
   257
paulson@16957
   258
val relevant = ref 0;  (*Relevance filtering is off by default*)
paulson@16795
   259
paulson@16956
   260
(*The "name" of a theorem is its statement, if nothing else is available.*)
paulson@16956
   261
val plain_string_of_thm =
paulson@16956
   262
    setmp show_question_marks false 
paulson@16956
   263
      (setmp print_mode [] 
paulson@16956
   264
	(Pretty.setmp_margin 999 string_of_thm));
paulson@16957
   265
	
paulson@17828
   266
(*Returns the first substring enclosed in quotation marks, typically omitting 
paulson@17828
   267
  the [.] of meta-level assumptions.*)
paulson@17828
   268
val firstquoted = hd o (String.tokens (fn c => c = #"\""))
paulson@17828
   269
	
paulson@16957
   270
fun fake_thm_name th = 
paulson@17828
   271
    Context.theory_name (theory_of_thm th) ^ "." ^ firstquoted (plain_string_of_thm th);
paulson@16061
   272
paulson@17828
   273
fun put_name_pair ("",th) = (fake_thm_name th, th)
paulson@16956
   274
  | put_name_pair (a,th)  = (a,th);
quigley@16039
   275
quigley@16039
   276
(* outputs a list of (thm,clause) pairs *)
quigley@15643
   277
paulson@17305
   278
fun multi x 0 xlist = xlist
paulson@17305
   279
   |multi x n xlist = multi x (n-1) (x::xlist);
quigley@16156
   280
paulson@17305
   281
fun clause_numbering ((clause, theorem), num_of_cls) = 
paulson@17305
   282
    let val numbers = 0 upto (num_of_cls - 1)
paulson@16172
   283
    in 
paulson@17305
   284
	multi (clause, theorem) num_of_cls []
paulson@16172
   285
    end;
paulson@17234
   286
    
paulson@18677
   287
(*Hashing to detect duplicate and variant clauses, e.g. from the [iff] attribute*)
paulson@18420
   288
paulson@18449
   289
exception HASH_CLAUSE and HASH_STRING;
paulson@18449
   290
paulson@18449
   291
(*Catches (for deletion) theorems automatically generated from other theorems*)
paulson@18449
   292
fun insert_suffixed_names ht x = 
paulson@18449
   293
     (Polyhash.insert ht (x^"_iff1", ()); 
paulson@18449
   294
      Polyhash.insert ht (x^"_iff2", ()); 
paulson@18449
   295
      Polyhash.insert ht (x^"_dest", ())); 
paulson@18449
   296
paulson@18677
   297
fun banned_theory s = exists (fn thy => String.isPrefix thy s) (!theory_blacklist);
paulson@18677
   298
paulson@18509
   299
fun make_banned_test xs = 
paulson@18449
   300
  let val ht = Polyhash.mkTable (Polyhash.hash_string, op =)
paulson@18449
   301
                                (6000, HASH_STRING)
paulson@18677
   302
      fun banned s = isSome (Polyhash.peek ht s) orelse banned_theory s
paulson@18509
   303
  in  app (fn x => Polyhash.insert ht (x,())) (!blacklist);
paulson@18509
   304
      app (insert_suffixed_names ht) (!blacklist @ xs); 
paulson@18509
   305
      banned
paulson@18509
   306
  end;
paulson@18420
   307
paulson@18420
   308
(*Create a hash table for clauses, of the given size*)
paulson@18449
   309
fun mk_clause_table n =
paulson@18449
   310
      Polyhash.mkTable (ResClause.hash_clause, ResClause.clause_eq)
paulson@18449
   311
                       (n, HASH_CLAUSE);
paulson@18420
   312
paulson@18420
   313
(*Use a hash table to eliminate duplicates from xs*)
paulson@18449
   314
fun make_unique ht xs = 
paulson@18449
   315
      (app (ignore o Polyhash.peekInsert ht) xs;  Polyhash.listItems ht);
quigley@16950
   316
paulson@16741
   317
(*Write out the claset and simpset rules of the supplied theory.
paulson@16906
   318
  FIXME: argument "goal" is a hack to allow relevance filtering.
paulson@16906
   319
  To reduce the number of clauses produced, set ResClasimp.relevant:=1*)
paulson@18753
   320
fun get_clasimp_lemmas ctxt goals = 
paulson@18420
   321
  let val claset_thms =
paulson@18753
   322
	    map put_name_pair  (*FIXME: relevance filter should use ALL goals*)
paulson@18753
   323
	      (ReduceAxiomsN.relevant_filter (!relevant) (hd goals)
paulson@18420
   324
		(ResAxioms.claset_rules_of_ctxt ctxt))
paulson@18449
   325
      val simpset_thms = 
paulson@18420
   326
	    if !use_simpset then 
paulson@18449
   327
		  map put_name_pair 
paulson@18753
   328
		    (ReduceAxiomsN.relevant_filter (!relevant) (hd goals)
paulson@18449
   329
		      (ResAxioms.simpset_rules_of_ctxt ctxt))
paulson@18420
   330
	    else []
paulson@18509
   331
      val banned = make_banned_test (map #1 (claset_thms@simpset_thms))
paulson@18509
   332
      fun ok (a,_) = not (banned a)
paulson@18449
   333
      val claset_cls_thms = ResAxioms.clausify_rules_pairs (filter ok claset_thms)
paulson@18449
   334
      val simpset_cls_thms = ResAxioms.clausify_rules_pairs (filter ok simpset_thms)
paulson@18449
   335
      val cls_thms_list = make_unique (mk_clause_table 2200) 
paulson@18420
   336
                                      (List.concat (simpset_cls_thms@claset_cls_thms))
paulson@18420
   337
      (* Identify the set of clauses to be written out *)
paulson@18420
   338
      val clauses = map #1(cls_thms_list);
paulson@18420
   339
      val cls_nums = map ResClause.num_of_clauses clauses;
paulson@18420
   340
      (*Note: in every case, cls_num = 1.  I think that only conjecture clauses
paulson@18420
   341
	can have any other value.*)
paulson@18420
   342
      val whole_list = List.concat 
paulson@18420
   343
	    (map clause_numbering (ListPair.zip (cls_thms_list, cls_nums)));
paulson@18420
   344
      
paulson@17828
   345
  in  (* create array of put clausename, number pairs into it *)
paulson@17828
   346
      (Array.fromList whole_list, clauses)
paulson@16061
   347
  end;
quigley@15643
   348
quigley@16950
   349
quigley@15919
   350
end;
quigley@16039
   351
quigley@16156
   352
quigley@16156
   353