equal
deleted
inserted
replaced
142 fun add_case (name, concls) (cs, i) = |
142 fun add_case (name, concls) (cs, i) = |
143 ((case try (fn () => |
143 ((case try (fn () => |
144 (Option.map (curry Logic.nth_prem i) rule_struct, Logic.nth_prem (i, prop))) () of |
144 (Option.map (curry Logic.nth_prem i) rule_struct, Logic.nth_prem (i, prop))) () of |
145 NONE => (name, NONE) |
145 NONE => (name, NONE) |
146 | SOME p => (name, extract_case is_open thy p name concls)) :: cs, i - 1); |
146 | SOME p => (name, extract_case is_open thy p name concls)) :: cs, i - 1); |
147 in fold_rev add_case ((uncurry drop) (n - nprems, cases)) ([], n) |> #1 end; |
147 in fold_rev add_case (drop (n - nprems) cases) ([], n) |> #1 end; |
148 |
148 |
149 in |
149 in |
150 |
150 |
151 fun make_common is_open = make is_open NONE; |
151 fun make_common is_open = make is_open NONE; |
152 fun make_nested is_open rule_struct = make is_open (SOME rule_struct); |
152 fun make_nested is_open rule_struct = make is_open (SOME rule_struct); |
203 fun consume defs facts ((xx, n), th) = |
203 fun consume defs facts ((xx, n), th) = |
204 let val m = Int.min (length facts, n) in |
204 let val m = Int.min (length facts, n) in |
205 th |
205 th |
206 |> unfold_prems n defs |
206 |> unfold_prems n defs |
207 |> unfold_prems_concls defs |
207 |> unfold_prems_concls defs |
208 |> Drule.multi_resolve ((uncurry take) (m, facts)) |
208 |> Drule.multi_resolve (take m facts) |
209 |> Seq.map (pair (xx, (n - m, (uncurry drop) (m, facts)))) |
209 |> Seq.map (pair (xx, (n - m, drop m facts))) |
210 end; |
210 end; |
211 |
211 |
212 end; |
212 end; |
213 |
213 |
214 val consumes_tagN = "consumes"; |
214 val consumes_tagN = "consumes"; |
343 is_equal (list_ord (TermOrd.fast_term_ord o pairself Thm.term_of) (ts, us)); |
343 is_equal (list_ord (TermOrd.fast_term_ord o pairself Thm.term_of) (ts, us)); |
344 |
344 |
345 fun prep_rule n th = |
345 fun prep_rule n th = |
346 let |
346 let |
347 val th' = Thm.permute_prems 0 n th; |
347 val th' = Thm.permute_prems 0 n th; |
348 val prems = (uncurry take) (Thm.nprems_of th' - n, Drule.cprems_of th'); |
348 val prems = take (Thm.nprems_of th' - n) (Drule.cprems_of th'); |
349 val th'' = Drule.implies_elim_list th' (map Thm.assume prems); |
349 val th'' = Drule.implies_elim_list th' (map Thm.assume prems); |
350 in (prems, (n, th'')) end; |
350 in (prems, (n, th'')) end; |
351 |
351 |
352 in |
352 in |
353 |
353 |