269 |
269 |
270 (* match tha with some premise of thb *) |
270 (* match tha with some premise of thb *) |
271 fun matchsome tha thb = |
271 fun matchsome tha thb = |
272 let fun hmatch 0 = raise THM("matchsome: no match", 0, [tha,thb]) |
272 let fun hmatch 0 = raise THM("matchsome: no match", 0, [tha,thb]) |
273 | hmatch n = matchres tha n thb handle THM _ => hmatch (n-1) |
273 | hmatch n = matchres tha n thb handle THM _ => hmatch (n-1) |
274 in hmatch (nprems_of thb) end |
274 in hmatch (Thm.nprems_of thb) end |
275 |
275 |
276 fun hflatten t = |
276 fun hflatten t = |
277 case (concl_of t) of |
277 case Thm.concl_of t of |
278 Const _ $ (Const (@{const_name HOL.implies}, _) $ _ $ _) => hflatten (t RS mp) |
278 Const _ $ (Const (@{const_name HOL.implies}, _) $ _ $ _) => hflatten (t RS mp) |
279 | _ => (hflatten (matchsome conjI t)) handle THM _ => zero_var_indexes t |
279 | _ => (hflatten (matchsome conjI t)) handle THM _ => zero_var_indexes t |
280 in |
280 in |
281 hflatten t |
281 hflatten t |
282 end |
282 end |
283 |
283 |
284 fun int_use ctxt th = |
284 fun int_use ctxt th = |
285 case (concl_of th) of |
285 case Thm.concl_of th of |
286 Const _ $ (Const (@{const_name Valid}, _) $ _) => |
286 Const _ $ (Const (@{const_name Valid}, _) $ _) => |
287 (flatten (int_unlift ctxt th) handle THM _ => th) |
287 (flatten (int_unlift ctxt th) handle THM _ => th) |
288 | _ => th |
288 | _ => th |
289 *} |
289 *} |
290 |
290 |