equal
deleted
inserted
replaced
1 (* Title: HOL/Tools/function_package/inductive_wrap.ML |
1 (* Title: HOL/Tools/function_package/inductive_wrap.ML |
2 ID: $Id$ |
2 ID: $Id$ |
3 Author: Alexander Krauss, TU Muenchen |
3 Author: Alexander Krauss, TU Muenchen |
4 |
4 |
5 |
5 |
6 This is a wrapper around the inductive package which corrects some of its |
6 A wrapper around the inductive package, restoring the quantifiers in |
7 slightly annoying behaviours and makes the whole business more controllable. |
7 the introduction and elimination rules. |
8 |
|
9 Specifically: |
|
10 |
|
11 - Following newer Isar conventions, declaration and definition are done in one step |
|
12 |
|
13 - The specification is expected in fully quantified form. This allows the client to |
|
14 control the variable order. The variables will appear in the result in the same order. |
|
15 This is especially relevant for the elimination rule, where the order usually *does* matter. |
|
16 |
|
17 |
|
18 All this will probably become obsolete in the near future, when the new "predicate" package |
|
19 is in place. |
|
20 |
|
21 *) |
8 *) |
22 |
9 |
23 signature FUNDEF_INDUCTIVE_WRAP = |
10 signature FUNDEF_INDUCTIVE_WRAP = |
24 sig |
11 sig |
25 val inductive_def : term list |
12 val inductive_def : term list |
34 |
21 |
35 fun requantify ctxt lfix (qs, t) thm = |
22 fun requantify ctxt lfix (qs, t) thm = |
36 let |
23 let |
37 val thy = theory_of_thm thm |
24 val thy = theory_of_thm thm |
38 val frees = frees_in_term ctxt t |
25 val frees = frees_in_term ctxt t |
39 |> remove (op =) lfix |
26 |> remove (op =) lfix |
40 val vars = Term.add_vars (prop_of thm) [] |> rev |
27 val vars = Term.add_vars (prop_of thm) [] |> rev |
41 |
28 |
42 val varmap = frees ~~ vars |
29 val varmap = frees ~~ vars |
43 in |
30 in |
44 fold_rev (fn Free (n, T) => |
31 fold_rev (fn Free (n, T) => |