author | Christian Urban <urbanc@in.tum.de> |
Mon, 31 May 2010 19:57:29 +0200 | |
changeset 2304 | 8a98171ba1fc |
parent 2296 | 45a69c9cc4cc |
child 2311 | 4da5c5c29009 |
permissions | -rw-r--r-- |
1833
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1 |
(* Title: nominal_library.ML |
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
2 |
Author: Christian Urban |
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
3 |
|
1979
760257a66604
added basic functions for constructing supp-terms
Christian Urban <urbanc@in.tum.de>
parents:
1963
diff
changeset
|
4 |
Basic functions for nominal. |
1833
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
5 |
*) |
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
6 |
|
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
7 |
signature NOMINAL_LIBRARY = |
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
8 |
sig |
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
9 |
val dest_listT: typ -> typ |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
10 |
|
1833
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
11 |
val mk_minus: term -> term |
1896
996d4411e95e
tuned; fleshed out some library functions about permutations; closed Datatype_Aux structure (increases readability)
Christian Urban <urbanc@in.tum.de>
parents:
1871
diff
changeset
|
12 |
val mk_plus: term -> term -> term |
996d4411e95e
tuned; fleshed out some library functions about permutations; closed Datatype_Aux structure (increases readability)
Christian Urban <urbanc@in.tum.de>
parents:
1871
diff
changeset
|
13 |
|
1899
8e0bfb14f6bf
optimised the code of define_raw_perm
Christian Urban <urbanc@in.tum.de>
parents:
1896
diff
changeset
|
14 |
val perm_ty: typ -> typ |
1871
c704d129862b
moved some general function into nominal_library.ML
Christian Urban <urbanc@in.tum.de>
parents:
1834
diff
changeset
|
15 |
val mk_perm_ty: typ -> term -> term -> term |
1833
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
16 |
val mk_perm: term -> term -> term |
1834
9909cc3566c5
moved a couple of more functions to the library
Christian Urban <urbanc@in.tum.de>
parents:
1833
diff
changeset
|
17 |
val dest_perm: term -> term * term |
9909cc3566c5
moved a couple of more functions to the library
Christian Urban <urbanc@in.tum.de>
parents:
1833
diff
changeset
|
18 |
|
1962
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1899
diff
changeset
|
19 |
val mk_sort_of: term -> term |
1979
760257a66604
added basic functions for constructing supp-terms
Christian Urban <urbanc@in.tum.de>
parents:
1963
diff
changeset
|
20 |
val atom_ty: typ -> typ |
1962
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1899
diff
changeset
|
21 |
val mk_atom_ty: typ -> term -> term |
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1899
diff
changeset
|
22 |
val mk_atom: term -> term |
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1899
diff
changeset
|
23 |
|
1979
760257a66604
added basic functions for constructing supp-terms
Christian Urban <urbanc@in.tum.de>
parents:
1963
diff
changeset
|
24 |
val supp_ty: typ -> typ |
2296 | 25 |
val supp_const: typ -> term |
1979
760257a66604
added basic functions for constructing supp-terms
Christian Urban <urbanc@in.tum.de>
parents:
1963
diff
changeset
|
26 |
val mk_supp_ty: typ -> term -> term |
760257a66604
added basic functions for constructing supp-terms
Christian Urban <urbanc@in.tum.de>
parents:
1963
diff
changeset
|
27 |
val mk_supp: term -> term |
760257a66604
added basic functions for constructing supp-terms
Christian Urban <urbanc@in.tum.de>
parents:
1963
diff
changeset
|
28 |
|
1834
9909cc3566c5
moved a couple of more functions to the library
Christian Urban <urbanc@in.tum.de>
parents:
1833
diff
changeset
|
29 |
val mk_equiv: thm -> thm |
9909cc3566c5
moved a couple of more functions to the library
Christian Urban <urbanc@in.tum.de>
parents:
1833
diff
changeset
|
30 |
val safe_mk_equiv: thm -> thm |
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
31 |
|
2289
bf748be70109
moved some mk_union and mk_diff into the library
Christian Urban <urbanc@in.tum.de>
parents:
2288
diff
changeset
|
32 |
val mk_diff: term * term -> term |
2296 | 33 |
val mk_append: term * term -> term |
2289
bf748be70109
moved some mk_union and mk_diff into the library
Christian Urban <urbanc@in.tum.de>
parents:
2288
diff
changeset
|
34 |
val mk_union: term * term -> term |
bf748be70109
moved some mk_union and mk_diff into the library
Christian Urban <urbanc@in.tum.de>
parents:
2288
diff
changeset
|
35 |
val fold_union: term list -> term |
bf748be70109
moved some mk_union and mk_diff into the library
Christian Urban <urbanc@in.tum.de>
parents:
2288
diff
changeset
|
36 |
|
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
37 |
(* datatype operations *) |
2296 | 38 |
val all_dtyps: Datatype_Aux.descr -> (string * sort) list -> typ list |
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
39 |
val nth_dtyp: Datatype_Aux.descr -> (string * sort) list -> int -> typ |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
40 |
val all_dtyp_constrs_types: Datatype_Aux.descr -> (string * sort) list -> |
2296 | 41 |
(term * typ * typ list * bool list) list list |
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
42 |
val nth_dtyp_constrs_types: Datatype_Aux.descr -> (string * sort) list -> int -> |
2296 | 43 |
(term * typ * typ list * bool list) list |
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
44 |
val prefix_dt_names: Datatype_Aux.descr -> (string * sort) list -> string -> string list |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
45 |
|
2304
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
46 |
(* tactics for function package *) |
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
47 |
val pat_completeness_auto: Proof.context -> tactic |
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
48 |
val pat_completeness_simp: thm list -> Proof.context -> tactic |
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
49 |
val prove_termination: Proof.context -> Function.info * local_theory |
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
50 |
|
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
51 |
|
1833
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
52 |
end |
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
53 |
|
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
54 |
|
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
55 |
structure Nominal_Library: NOMINAL_LIBRARY = |
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
56 |
struct |
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
57 |
|
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
58 |
(* this function should be in hologic.ML *) |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
59 |
fun dest_listT (Type (@{type_name list}, [T])) = T |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
60 |
| dest_listT T = raise TYPE ("dest_listT: list type expected", [T], []) |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
61 |
|
1979
760257a66604
added basic functions for constructing supp-terms
Christian Urban <urbanc@in.tum.de>
parents:
1963
diff
changeset
|
62 |
fun mk_minus p = @{term "uminus::perm => perm"} $ p; |
760257a66604
added basic functions for constructing supp-terms
Christian Urban <urbanc@in.tum.de>
parents:
1963
diff
changeset
|
63 |
|
760257a66604
added basic functions for constructing supp-terms
Christian Urban <urbanc@in.tum.de>
parents:
1963
diff
changeset
|
64 |
fun mk_plus p q = @{term "plus::perm => perm => perm"} $ p $ q; |
1896
996d4411e95e
tuned; fleshed out some library functions about permutations; closed Datatype_Aux structure (increases readability)
Christian Urban <urbanc@in.tum.de>
parents:
1871
diff
changeset
|
65 |
|
1979
760257a66604
added basic functions for constructing supp-terms
Christian Urban <urbanc@in.tum.de>
parents:
1963
diff
changeset
|
66 |
fun perm_ty ty = @{typ "perm"} --> ty --> ty; |
760257a66604
added basic functions for constructing supp-terms
Christian Urban <urbanc@in.tum.de>
parents:
1963
diff
changeset
|
67 |
fun mk_perm_ty ty p trm = Const (@{const_name "permute"}, perm_ty ty) $ p $ trm; |
760257a66604
added basic functions for constructing supp-terms
Christian Urban <urbanc@in.tum.de>
parents:
1963
diff
changeset
|
68 |
fun mk_perm p trm = mk_perm_ty (fastype_of trm) p trm; |
1833
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
69 |
|
1834
9909cc3566c5
moved a couple of more functions to the library
Christian Urban <urbanc@in.tum.de>
parents:
1833
diff
changeset
|
70 |
fun dest_perm (Const (@{const_name "permute"}, _) $ p $ t) = (p, t) |
1979
760257a66604
added basic functions for constructing supp-terms
Christian Urban <urbanc@in.tum.de>
parents:
1963
diff
changeset
|
71 |
| dest_perm t = raise TERM ("dest_perm", [t]); |
1833
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
72 |
|
1962
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1899
diff
changeset
|
73 |
fun mk_sort_of t = @{term "sort_of"} $ t; |
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1899
diff
changeset
|
74 |
|
1979
760257a66604
added basic functions for constructing supp-terms
Christian Urban <urbanc@in.tum.de>
parents:
1963
diff
changeset
|
75 |
fun atom_ty ty = ty --> @{typ "atom"}; |
1963 | 76 |
fun mk_atom_ty ty t = Const (@{const_name "atom"}, atom_ty ty) $ t; |
1962
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1899
diff
changeset
|
77 |
fun mk_atom t = mk_atom_ty (fastype_of t) t; |
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1899
diff
changeset
|
78 |
|
1979
760257a66604
added basic functions for constructing supp-terms
Christian Urban <urbanc@in.tum.de>
parents:
1963
diff
changeset
|
79 |
|
760257a66604
added basic functions for constructing supp-terms
Christian Urban <urbanc@in.tum.de>
parents:
1963
diff
changeset
|
80 |
fun supp_ty ty = ty --> @{typ "atom set"}; |
2296 | 81 |
fun supp_const ty = Const (@{const_name "supp"}, supp_ty ty) |
82 |
fun mk_supp_ty ty t = supp_const ty $ t; |
|
1979
760257a66604
added basic functions for constructing supp-terms
Christian Urban <urbanc@in.tum.de>
parents:
1963
diff
changeset
|
83 |
fun mk_supp t = mk_supp_ty (fastype_of t) t; |
760257a66604
added basic functions for constructing supp-terms
Christian Urban <urbanc@in.tum.de>
parents:
1963
diff
changeset
|
84 |
|
760257a66604
added basic functions for constructing supp-terms
Christian Urban <urbanc@in.tum.de>
parents:
1963
diff
changeset
|
85 |
|
1834
9909cc3566c5
moved a couple of more functions to the library
Christian Urban <urbanc@in.tum.de>
parents:
1833
diff
changeset
|
86 |
fun mk_equiv r = r RS @{thm eq_reflection}; |
9909cc3566c5
moved a couple of more functions to the library
Christian Urban <urbanc@in.tum.de>
parents:
1833
diff
changeset
|
87 |
fun safe_mk_equiv r = mk_equiv r handle Thm.THM _ => r; |
1833
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
88 |
|
1962
84a13d1e2511
moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents:
1899
diff
changeset
|
89 |
|
2296 | 90 |
(* functions that construct differences, appends and unions |
91 |
but avoid producing empty atom sets or empty atom lists *) |
|
2289
bf748be70109
moved some mk_union and mk_diff into the library
Christian Urban <urbanc@in.tum.de>
parents:
2288
diff
changeset
|
92 |
|
bf748be70109
moved some mk_union and mk_diff into the library
Christian Urban <urbanc@in.tum.de>
parents:
2288
diff
changeset
|
93 |
fun mk_diff (@{term "{}::atom set"}, _) = @{term "{}::atom set"} |
bf748be70109
moved some mk_union and mk_diff into the library
Christian Urban <urbanc@in.tum.de>
parents:
2288
diff
changeset
|
94 |
| mk_diff (t1, @{term "{}::atom set"}) = t1 |
bf748be70109
moved some mk_union and mk_diff into the library
Christian Urban <urbanc@in.tum.de>
parents:
2288
diff
changeset
|
95 |
| mk_diff (t1, t2) = HOLogic.mk_binop @{const_name minus} (t1, t2) |
bf748be70109
moved some mk_union and mk_diff into the library
Christian Urban <urbanc@in.tum.de>
parents:
2288
diff
changeset
|
96 |
|
2296 | 97 |
fun mk_append (@{term "[]::atom list"}, @{term "[]::atom list"}) = @{term "[]::atom list"} |
98 |
| mk_append (t1, @{term "[]::atom list"}) = t1 |
|
99 |
| mk_append (@{term "[]::atom list"}, t2) = t2 |
|
100 |
| mk_append (t1, t2) = HOLogic.mk_binop @{const_name "append"} (t1, t2) |
|
101 |
||
2289
bf748be70109
moved some mk_union and mk_diff into the library
Christian Urban <urbanc@in.tum.de>
parents:
2288
diff
changeset
|
102 |
fun mk_union (@{term "{}::atom set"}, @{term "{}::atom set"}) = @{term "{}::atom set"} |
bf748be70109
moved some mk_union and mk_diff into the library
Christian Urban <urbanc@in.tum.de>
parents:
2288
diff
changeset
|
103 |
| mk_union (t1 , @{term "{}::atom set"}) = t1 |
bf748be70109
moved some mk_union and mk_diff into the library
Christian Urban <urbanc@in.tum.de>
parents:
2288
diff
changeset
|
104 |
| mk_union (@{term "{}::atom set"}, t2) = t2 |
2296 | 105 |
| mk_union (t1, t2) = HOLogic.mk_binop @{const_name "sup"} (t1, t2) |
2289
bf748be70109
moved some mk_union and mk_diff into the library
Christian Urban <urbanc@in.tum.de>
parents:
2288
diff
changeset
|
106 |
|
bf748be70109
moved some mk_union and mk_diff into the library
Christian Urban <urbanc@in.tum.de>
parents:
2288
diff
changeset
|
107 |
fun fold_union trms = fold (curry mk_union) trms @{term "{}::atom set"} |
bf748be70109
moved some mk_union and mk_diff into the library
Christian Urban <urbanc@in.tum.de>
parents:
2288
diff
changeset
|
108 |
|
bf748be70109
moved some mk_union and mk_diff into the library
Christian Urban <urbanc@in.tum.de>
parents:
2288
diff
changeset
|
109 |
|
2296 | 110 |
|
111 |
||
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
112 |
(** datatypes **) |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
113 |
|
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
114 |
|
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
115 |
(* returns the type of the nth datatype *) |
2296 | 116 |
fun all_dtyps descr sorts = |
117 |
map (fn n => Datatype_Aux.typ_of_dtyp descr sorts (Datatype_Aux.DtRec n)) (0 upto (length descr - 1)) |
|
118 |
||
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
119 |
fun nth_dtyp descr sorts n = |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
120 |
Datatype_Aux.typ_of_dtyp descr sorts (Datatype_Aux.DtRec n); |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
121 |
|
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
122 |
(* returns info about constructors in a datatype *) |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
123 |
fun all_dtyp_constrs_info descr = |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
124 |
map (fn (_, (ty, vs, constrs)) => map (pair (ty, vs)) constrs) descr |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
125 |
|
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
126 |
(* returns the constants of the constructors plus the |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
127 |
corresponding type and types of arguments *) |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
128 |
fun all_dtyp_constrs_types descr sorts = |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
129 |
let |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
130 |
fun aux ((ty_name, vs), (cname, args)) = |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
131 |
let |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
132 |
val vs_tys = map (Datatype_Aux.typ_of_dtyp descr sorts) vs |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
133 |
val ty = Type (ty_name, vs_tys) |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
134 |
val arg_tys = map (Datatype_Aux.typ_of_dtyp descr sorts) args |
2296 | 135 |
val is_rec = map Datatype_Aux.is_rec_type args |
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
136 |
in |
2296 | 137 |
(Const (cname, arg_tys ---> ty), ty, arg_tys, is_rec) |
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
138 |
end |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
139 |
in |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
140 |
map (map aux) (all_dtyp_constrs_info descr) |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
141 |
end |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
142 |
|
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
143 |
fun nth_dtyp_constrs_types descr sorts n = |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
144 |
nth (all_dtyp_constrs_types descr sorts) n |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
145 |
|
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
146 |
|
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
147 |
(* generates for every datatype a name str ^ dt_name |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
148 |
plus and index for multiple occurences of a string *) |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
149 |
fun prefix_dt_names descr sorts str = |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
150 |
let |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
151 |
fun get_nth_name (i, _) = |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
152 |
Datatype_Aux.name_of_typ (nth_dtyp descr sorts i) |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
153 |
in |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
154 |
Datatype_Prop.indexify_names |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
155 |
(map (prefix str o get_nth_name) descr) |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
156 |
end |
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
157 |
|
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
parents:
1979
diff
changeset
|
158 |
|
2304
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
159 |
(** function package **) |
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
160 |
fun pat_completeness_auto lthy = |
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
161 |
Pat_Completeness.pat_completeness_tac lthy 1 |
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
162 |
THEN auto_tac (clasimpset_of lthy) |
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
163 |
|
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
164 |
fun pat_completeness_simp simps lthy = |
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
165 |
let |
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
166 |
val simp_set = HOL_basic_ss addsimps (@{thms sum.inject sum.distinct} @ simps) |
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
167 |
in |
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
168 |
Pat_Completeness.pat_completeness_tac lthy 1 |
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
169 |
THEN ALLGOALS (asm_full_simp_tac simp_set) |
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
170 |
end |
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
171 |
|
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
172 |
fun prove_termination lthy = |
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
173 |
Function.prove_termination NONE |
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
174 |
(Lexicographic_Order.lexicographic_order_tac true lthy) lthy |
8a98171ba1fc
all raw definitions are defined using function
Christian Urban <urbanc@in.tum.de>
parents:
2296
diff
changeset
|
175 |
|
1833
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
176 |
end (* structure *) |
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
177 |
|
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
178 |
open Nominal_Library; |