240 val abss = foldl (fn (t, T) => Abs ("", T, t)) |
242 val abss = foldl (fn (t, T) => Abs ("", T, t)) |
241 in |
243 in |
242 term_lift_inst_rule (state, i, ixnTs, [((P2, T), abss (cntxt, Ts))], thm) |
244 term_lift_inst_rule (state, i, ixnTs, [((P2, T), abss (cntxt, Ts))], thm) |
243 end; |
245 end; |
244 |
246 |
245 |
|
246 (***************************************************************************** |
247 (***************************************************************************** |
247 The split-tactic |
248 The split-tactic |
248 |
249 |
249 splits : list of split-theorems to be tried |
250 splits : list of split-theorems to be tried |
250 i : number of subgoal the tactic should be applied to |
251 i : number of subgoal the tactic should be applied to |
254 | split_tac splits i = |
255 | split_tac splits i = |
255 let fun const(thm) = |
256 let fun const(thm) = |
256 (case concl_of thm of _$(t as _$lhs)$_ => |
257 (case concl_of thm of _$(t as _$lhs)$_ => |
257 (case strip_comb lhs of (Const(a,_),args) => |
258 (case strip_comb lhs of (Const(a,_),args) => |
258 (a,(thm,fastype_of t,length args)) |
259 (a,(thm,fastype_of t,length args)) |
259 | _ => error("Wrong format for split rule")) |
260 | _ => split_format_err()) |
260 | _ => error("Wrong format for split rule")) |
261 | _ => split_format_err()) |
261 val cmap = map const splits; |
262 val cmap = map const splits; |
262 fun lift_tac Ts t p st = (rtac (inst_lift Ts t p st trlift i) i) st |
263 fun lift_tac Ts t p st = (rtac (inst_lift Ts t p st trlift i) i) st |
263 fun lift_split_tac st = st |> |
264 fun lift_split_tac st = st |> |
264 let val (Ts,t,splits) = select cmap st i |
265 let val (Ts,t,splits) = select cmap st i |
265 in case splits of |
266 in case splits of |
276 (rtac iffD i THEN lift_split_tac) |
277 (rtac iffD i THEN lift_split_tac) |
277 end; |
278 end; |
278 |
279 |
279 in split_tac end; |
280 in split_tac end; |
280 |
281 |
|
282 (* FIXME: this junk is only HOL specific and should therefore not go here! *) |
|
283 (* const_of_split_thm is used in HOL/simpdata.ML *) |
|
284 |
|
285 fun const_of_split_thm thm = |
|
286 (case concl_of thm of |
|
287 Const("Trueprop",_) $ (Const("op =", _)$(Var _$t)$_) => |
|
288 (case strip_comb t of |
|
289 (Const(a,_),_) => a |
|
290 | _ => split_format_err()) |
|
291 | _ => split_format_err()); |
281 |
292 |
282 fun mk_case_split_asm_tac split_tac |
293 fun mk_case_split_asm_tac split_tac |
283 (disjE,conjE,exE,contrapos,contrapos2,notnotD) = |
294 (disjE,conjE,exE,contrapos,contrapos2,notnotD) = |
284 let |
295 let |
285 |
296 |
290 i : number of subgoal the tactic should be applied to |
301 i : number of subgoal the tactic should be applied to |
291 *****************************************************************************) |
302 *****************************************************************************) |
292 |
303 |
293 fun split_asm_tac [] = K no_tac |
304 fun split_asm_tac [] = K no_tac |
294 | split_asm_tac splits = |
305 | split_asm_tac splits = |
295 let fun const thm = |
306 let val cname_list = map const_of_split_thm splits; |
296 (case concl_of thm of Const ("Trueprop",_)$ |
|
297 (Const ("op =", _)$(Var _$t)$_) => |
|
298 (case strip_comb t of (Const(a,_),_) => a |
|
299 | _ => error("Wrong format for split rule")) |
|
300 | _ => error("Wrong format for split rule")) |
|
301 val cname_list = map const splits; |
|
302 fun is_case (a,_) = a mem cname_list; |
307 fun is_case (a,_) = a mem cname_list; |
303 fun tac (t,i) = |
308 fun tac (t,i) = |
304 let val n = find_index (exists_Const is_case) |
309 let val n = find_index (exists_Const is_case) |
305 (Logic.strip_assums_hyp t); |
310 (Logic.strip_assums_hyp t); |
306 fun first_prem_is_disj (Const ("==>", _) $ (Const ("Trueprop", _) |
311 fun first_prem_is_disj (Const ("==>", _) $ (Const ("Trueprop", _) |
328 in split_asm_tac end; |
333 in split_asm_tac end; |
329 |
334 |
330 |
335 |
331 in |
336 in |
332 |
337 |
|
338 val const_of_split_thm = const_of_split_thm; |
|
339 |
333 fun mk_case_split_tac iffD = mk_case_split_tac_2 iffD int_ord; |
340 fun mk_case_split_tac iffD = mk_case_split_tac_2 iffD int_ord; |
334 |
341 |
335 fun mk_case_split_inside_tac iffD = mk_case_split_tac_2 iffD (rev_order o int_ord); |
342 fun mk_case_split_inside_tac iffD = mk_case_split_tac_2 iffD (rev_order o int_ord); |
336 |
343 |
337 val mk_case_split_asm_tac = mk_case_split_asm_tac; |
344 val mk_case_split_asm_tac = mk_case_split_asm_tac; |