115 |
115 |
116 val dummy = assert_all (is_some o lookup_const sign) rec_names |
116 val dummy = assert_all (is_some o lookup_const sign) rec_names |
117 (fn a => "Name of recursive set not declared as constant: " ^ a); |
117 (fn a => "Name of recursive set not declared as constant: " ^ a); |
118 |
118 |
119 val intr_tms = map (Sign.term_of o rd propT) sintrs; |
119 val intr_tms = map (Sign.term_of o rd propT) sintrs; |
120 val (Const(_,recT),rec_params) = strip_comb (#2 (rule_concl(hd intr_tms))) |
120 |
|
121 local (*Checking the introduction rules*) |
|
122 val intr_sets = map (#2 o rule_concl) intr_tms; |
|
123 |
|
124 fun intr_ok set = |
|
125 case head_of set of Const(a,recT) => a mem rec_names | _ => false; |
|
126 |
|
127 val dummy = assert_all intr_ok intr_sets |
|
128 (fn t => "Conclusion of rule does not name a recursive set: " ^ |
|
129 Sign.string_of_term sign t); |
|
130 in |
|
131 val (Const(_,recT),rec_params) = strip_comb (hd intr_sets) |
|
132 end; |
|
133 |
121 val rec_hds = map (fn a=> Const(a,recT)) rec_names; |
134 val rec_hds = map (fn a=> Const(a,recT)) rec_names; |
122 val rec_tms = map (fn rec_hd=> list_comb(rec_hd,rec_params)) rec_hds; |
135 val rec_tms = map (fn rec_hd=> list_comb(rec_hd,rec_params)) rec_hds; |
123 |
136 |
124 val dummy = assert_all is_Free rec_params |
137 val dummy = assert_all is_Free rec_params |
125 (fn t => "Param in recursion term not a free variable: " ^ |
138 (fn t => "Param in recursion term not a free variable: " ^ |
260 ORELSE' bound_hyp_subst_tac)) |
273 ORELSE' bound_hyp_subst_tac)) |
261 THEN prune_params_tac; |
274 THEN prune_params_tac; |
262 |
275 |
263 val elim = rule_by_tactic basic_elim_tac (unfold RS equals_CollectD); |
276 val elim = rule_by_tactic basic_elim_tac (unfold RS equals_CollectD); |
264 |
277 |
265 (*Applies freeness of the given constructors. |
278 (*Applies freeness of the given constructors, which *must* be unfolded by |
266 NB for datatypes, defs=con_defs; for inference systems, con_defs=[]! *) |
279 the given defs. Cannot simply use the local con_defs because con_defs=[] |
|
280 for inference systems. *) |
267 fun con_elim_tac defs = |
281 fun con_elim_tac defs = |
268 rewrite_goals_tac defs THEN basic_elim_tac THEN fold_con_tac defs; |
282 rewrite_goals_tac defs THEN basic_elim_tac THEN fold_con_tac defs; |
269 |
283 |
270 (*String s should have the form t:Si where Si is an inductive set*) |
284 (*String s should have the form t:Si where Si is an inductive set*) |
271 fun mk_cases defs s = |
285 fun mk_cases defs s = |