author | Christian Urban <urbanc@in.tum.de> |
Mon, 15 Nov 2010 01:10:02 +0000 | |
changeset 2569 | 94750b31a97d |
parent 2560 | 82e37a4595c7 |
child 2571 | f0252365936c |
permissions | -rw-r--r-- |
2297 | 1 |
(* Title: nominal_dt_rawfuns.ML |
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:
diff
changeset
|
2 |
Author: Cezary Kaliszyk |
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:
diff
changeset
|
3 |
Author: Christian Urban |
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:
diff
changeset
|
4 |
|
2297 | 5 |
Definitions of the raw fv and fv_bn functions |
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:
diff
changeset
|
6 |
*) |
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:
diff
changeset
|
7 |
|
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:
diff
changeset
|
8 |
signature NOMINAL_DT_RAWFUNS = |
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:
diff
changeset
|
9 |
sig |
2431
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
10 |
(* info of raw datatypes *) |
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
11 |
type dt_info = string list * binding * mixfix * ((binding * typ list * mixfix) list) list |
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
12 |
|
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
13 |
(* info of raw binding functions *) |
2560
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
14 |
type bn_info = term * int * (int * term option) 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:
diff
changeset
|
15 |
|
2431
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
16 |
|
2295
8aff3f3ce47f
started to work on alpha
Christian Urban <urbanc@in.tum.de>
parents:
2294
diff
changeset
|
17 |
(* binding modes and binding clauses *) |
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:
diff
changeset
|
18 |
datatype bmode = Lst | Res | Set |
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:
diff
changeset
|
19 |
datatype bclause = BC of bmode * (term option * int) list * int 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:
diff
changeset
|
20 |
|
2296 | 21 |
val is_atom: Proof.context -> typ -> bool |
22 |
val is_atom_set: Proof.context -> typ -> bool |
|
23 |
val is_atom_fset: Proof.context -> typ -> bool |
|
24 |
val is_atom_list: Proof.context -> typ -> bool |
|
25 |
val mk_atom_set: term -> term |
|
26 |
val mk_atom_fset: term -> term |
|
27 |
||
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:
diff
changeset
|
28 |
val setify: Proof.context -> term -> term |
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:
diff
changeset
|
29 |
val listify: Proof.context -> term -> term |
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:
diff
changeset
|
30 |
|
2560
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
31 |
(* FIXME: should be here - currently in Nominal2.thy |
2431
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
32 |
val define_raw_bns: string list -> dt_info -> (binding * typ option * mixfix) list -> |
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
33 |
(Attrib.binding * term) list -> thm list -> thm list -> local_theory -> |
2560
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
34 |
(term list * thm list * bn_info list * thm list * local_theory) |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
35 |
*) |
2431
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
36 |
|
2560
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
37 |
val define_raw_fvs: string list -> typ list -> cns_info list -> bn_info list -> bclause list list list -> |
2410
2bbdb9c427b5
improved runtime slightly, by constructing an explicit size measure for the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2409
diff
changeset
|
38 |
thm list -> thm list -> Proof.context -> term list * term list * thm list * thm list * local_theory |
2560
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
39 |
|
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
40 |
val define_raw_bn_perms: typ list -> bn_info list -> cns_info list -> thm list -> thm list -> |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
41 |
local_theory -> (term list * thm list * local_theory) |
2305
93ab397f5980
smaller code for raw-eqvt proofs
Christian Urban <urbanc@in.tum.de>
parents:
2304
diff
changeset
|
42 |
|
93ab397f5980
smaller code for raw-eqvt proofs
Christian Urban <urbanc@in.tum.de>
parents:
2304
diff
changeset
|
43 |
val raw_prove_eqvt: term list -> thm list -> thm list -> Proof.context -> thm 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:
diff
changeset
|
44 |
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:
diff
changeset
|
45 |
|
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:
diff
changeset
|
46 |
|
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:
diff
changeset
|
47 |
structure Nominal_Dt_RawFuns: NOMINAL_DT_RAWFUNS = |
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:
diff
changeset
|
48 |
struct |
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:
diff
changeset
|
49 |
|
2431
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
50 |
(* string list - type variables of a datatype |
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
51 |
binding - name of the datatype |
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
52 |
mixfix - its mixfix |
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
53 |
(binding * typ list * mixfix) list - datatype constructors of the type |
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
54 |
*) |
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
55 |
type dt_info = string list * binding * mixfix * ((binding * typ list * mixfix) list) list |
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
56 |
|
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
57 |
|
2375 | 58 |
(* term - is constant of the bn-function |
59 |
int - is datatype number over which the bn-function is defined |
|
60 |
int * term option - is number of the corresponding argument with possibly |
|
61 |
recursive call with bn-function term |
|
62 |
*) |
|
2560
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
63 |
type bn_info = term * int * (int * term option) list list |
2295
8aff3f3ce47f
started to work on alpha
Christian Urban <urbanc@in.tum.de>
parents:
2294
diff
changeset
|
64 |
|
2431
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
65 |
|
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:
diff
changeset
|
66 |
datatype bmode = Lst | Res | Set |
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:
diff
changeset
|
67 |
datatype bclause = BC of bmode * (term option * int) list * int 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:
diff
changeset
|
68 |
|
2438
abafea9b39bb
corrected bug with fv-function generation (that was the problem with recursive binders)
Christian Urban <urbanc@in.tum.de>
parents:
2431
diff
changeset
|
69 |
fun lookup xs x = the (AList.lookup (op=) xs x) |
abafea9b39bb
corrected bug with fv-function generation (that was the problem with recursive binders)
Christian Urban <urbanc@in.tum.de>
parents:
2431
diff
changeset
|
70 |
|
abafea9b39bb
corrected bug with fv-function generation (that was the problem with recursive binders)
Christian Urban <urbanc@in.tum.de>
parents:
2431
diff
changeset
|
71 |
|
2292 | 72 |
(* testing for concrete atom types *) |
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:
diff
changeset
|
73 |
fun is_atom ctxt ty = |
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:
diff
changeset
|
74 |
Sign.of_sort (ProofContext.theory_of ctxt) (ty, @{sort at_base}) |
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:
diff
changeset
|
75 |
|
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:
diff
changeset
|
76 |
fun is_atom_set ctxt (Type ("fun", [t, @{typ bool}])) = is_atom ctxt 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:
diff
changeset
|
77 |
| is_atom_set _ _ = false; |
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:
diff
changeset
|
78 |
|
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:
diff
changeset
|
79 |
fun is_atom_fset ctxt (Type (@{type_name "fset"}, [t])) = is_atom ctxt 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:
diff
changeset
|
80 |
| is_atom_fset _ _ = false; |
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:
diff
changeset
|
81 |
|
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:
diff
changeset
|
82 |
fun is_atom_list ctxt (Type (@{type_name "list"}, [t])) = is_atom ctxt 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:
diff
changeset
|
83 |
| is_atom_list _ _ = false |
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:
diff
changeset
|
84 |
|
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:
diff
changeset
|
85 |
|
2292 | 86 |
(* functions for producing sets, fsets and lists of general atom type |
87 |
out from concrete atom types *) |
|
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:
diff
changeset
|
88 |
fun mk_atom_set t = |
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
89 |
let |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
90 |
val ty = fastype_of t; |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
91 |
val atom_ty = HOLogic.dest_setT ty --> @{typ "atom"}; |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
92 |
val img_ty = atom_ty --> ty --> @{typ "atom set"}; |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
93 |
in |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
94 |
Const (@{const_name image}, img_ty) $ mk_atom_ty atom_ty t |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
95 |
end |
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:
diff
changeset
|
96 |
|
2321
e9b0728061a8
cleaned up the FSet (noise was introduced by error)
Christian Urban <urbanc@in.tum.de>
parents:
2311
diff
changeset
|
97 |
|
e9b0728061a8
cleaned up the FSet (noise was introduced by error)
Christian Urban <urbanc@in.tum.de>
parents:
2311
diff
changeset
|
98 |
fun dest_fsetT (Type (@{type_name fset}, [T])) = T |
e9b0728061a8
cleaned up the FSet (noise was introduced by error)
Christian Urban <urbanc@in.tum.de>
parents:
2311
diff
changeset
|
99 |
| dest_fsetT T = raise TYPE ("dest_fsetT: fset type expected", [T], []); |
e9b0728061a8
cleaned up the FSet (noise was introduced by error)
Christian Urban <urbanc@in.tum.de>
parents:
2311
diff
changeset
|
100 |
|
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:
diff
changeset
|
101 |
fun mk_atom_fset t = |
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
102 |
let |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
103 |
val ty = fastype_of t; |
2569
94750b31a97d
fixed bug in fv function where a shallow binder binds lists of names
Christian Urban <urbanc@in.tum.de>
parents:
2560
diff
changeset
|
104 |
val atom_ty = dest_fsetT ty |
94750b31a97d
fixed bug in fv function where a shallow binder binds lists of names
Christian Urban <urbanc@in.tum.de>
parents:
2560
diff
changeset
|
105 |
val fmap_ty = (atom_ty --> @{typ atom}) --> ty --> @{typ "atom fset"}; |
2524
693562f03eee
major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents:
2476
diff
changeset
|
106 |
val fset = @{term "fset :: atom fset => atom set"} |
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
107 |
in |
2569
94750b31a97d
fixed bug in fv function where a shallow binder binds lists of names
Christian Urban <urbanc@in.tum.de>
parents:
2560
diff
changeset
|
108 |
fset $ (Const (@{const_name map_fset}, fmap_ty) $ (atom_const atom_ty) $ t) |
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
109 |
end |
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:
diff
changeset
|
110 |
|
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
111 |
fun mk_atom_list t = |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
112 |
let |
2569
94750b31a97d
fixed bug in fv function where a shallow binder binds lists of names
Christian Urban <urbanc@in.tum.de>
parents:
2560
diff
changeset
|
113 |
val ty = fastype_of t |
94750b31a97d
fixed bug in fv function where a shallow binder binds lists of names
Christian Urban <urbanc@in.tum.de>
parents:
2560
diff
changeset
|
114 |
val atom_ty = dest_listT ty |
94750b31a97d
fixed bug in fv function where a shallow binder binds lists of names
Christian Urban <urbanc@in.tum.de>
parents:
2560
diff
changeset
|
115 |
val map_ty = (atom_ty --> @{typ atom}) --> ty --> @{typ "atom list"} |
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
116 |
in |
2569
94750b31a97d
fixed bug in fv function where a shallow binder binds lists of names
Christian Urban <urbanc@in.tum.de>
parents:
2560
diff
changeset
|
117 |
Const (@{const_name map}, map_ty) $ (atom_const atom_ty) $ t |
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
118 |
end |
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:
diff
changeset
|
119 |
|
2295
8aff3f3ce47f
started to work on alpha
Christian Urban <urbanc@in.tum.de>
parents:
2294
diff
changeset
|
120 |
(* functions that coerces singletons, sets and fsets of concrete atoms |
8aff3f3ce47f
started to work on alpha
Christian Urban <urbanc@in.tum.de>
parents:
2294
diff
changeset
|
121 |
into sets of general atoms *) |
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:
diff
changeset
|
122 |
fun setify ctxt t = |
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
123 |
let |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
124 |
val ty = fastype_of t; |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
125 |
in |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
126 |
if is_atom ctxt ty |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
127 |
then HOLogic.mk_set @{typ atom} [mk_atom t] |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
128 |
else if is_atom_set ctxt ty |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
129 |
then mk_atom_set t |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
130 |
else if is_atom_fset ctxt ty |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
131 |
then mk_atom_fset t |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
132 |
else raise TERM ("setify", [t]) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
133 |
end |
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:
diff
changeset
|
134 |
|
2295
8aff3f3ce47f
started to work on alpha
Christian Urban <urbanc@in.tum.de>
parents:
2294
diff
changeset
|
135 |
(* functions that coerces singletons and lists of concrete atoms |
8aff3f3ce47f
started to work on alpha
Christian Urban <urbanc@in.tum.de>
parents:
2294
diff
changeset
|
136 |
into lists of general atoms *) |
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:
diff
changeset
|
137 |
fun listify ctxt t = |
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
138 |
let |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
139 |
val ty = fastype_of t; |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
140 |
in |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
141 |
if is_atom ctxt ty |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
142 |
then HOLogic.mk_list @{typ atom} [mk_atom t] |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
143 |
else if is_atom_list ctxt ty |
2569
94750b31a97d
fixed bug in fv function where a shallow binder binds lists of names
Christian Urban <urbanc@in.tum.de>
parents:
2560
diff
changeset
|
144 |
then mk_atom_list t |
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
145 |
else raise TERM ("listify", [t]) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
146 |
end |
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:
diff
changeset
|
147 |
|
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:
diff
changeset
|
148 |
(* coerces a list into a set *) |
2290 | 149 |
fun to_set t = |
150 |
if fastype_of t = @{typ "atom list"} |
|
2569
94750b31a97d
fixed bug in fv function where a shallow binder binds lists of names
Christian Urban <urbanc@in.tum.de>
parents:
2560
diff
changeset
|
151 |
then @{term "set :: atom list => atom set"} $ t |
2290 | 152 |
else t |
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:
diff
changeset
|
153 |
|
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:
diff
changeset
|
154 |
|
2295
8aff3f3ce47f
started to work on alpha
Christian Urban <urbanc@in.tum.de>
parents:
2294
diff
changeset
|
155 |
(** functions that construct the equations for fv and fv_bn **) |
2292 | 156 |
|
2464
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
parents:
2438
diff
changeset
|
157 |
fun mk_fv_rhs lthy fv_map fv_bn_map args (BC (bmode, binders, bodies)) = |
2295
8aff3f3ce47f
started to work on alpha
Christian Urban <urbanc@in.tum.de>
parents:
2294
diff
changeset
|
158 |
let |
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
159 |
fun mk_fv_body fv_map args i = |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
160 |
let |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
161 |
val arg = nth args i |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
162 |
val ty = fastype_of arg |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
163 |
in |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
164 |
case AList.lookup (op=) fv_map ty of |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
165 |
NONE => mk_supp arg |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
166 |
| SOME fv => fv $ arg |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
167 |
end |
2295
8aff3f3ce47f
started to work on alpha
Christian Urban <urbanc@in.tum.de>
parents:
2294
diff
changeset
|
168 |
|
2464
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
parents:
2438
diff
changeset
|
169 |
fun mk_fv_binder lthy fv_bn_map args binders = |
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
170 |
let |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
171 |
fun bind_set lthy args (NONE, i) = (setify lthy (nth args i), @{term "{}::atom set"}) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
172 |
| bind_set _ args (SOME bn, i) = (bn $ (nth args i), |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
173 |
if member (op=) bodies i then @{term "{}::atom set"} |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
174 |
else lookup fv_bn_map bn $ (nth args i)) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
175 |
fun bind_lst lthy args (NONE, i) = (listify lthy (nth args i), @{term "[]::atom list"}) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
176 |
| bind_lst _ args (SOME bn, i) = (bn $ (nth args i), |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
177 |
if member (op=) bodies i then @{term "[]::atom list"} |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
178 |
else lookup fv_bn_map bn $ (nth args i)) |
2464
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
parents:
2438
diff
changeset
|
179 |
|
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
180 |
val (combine_fn, bind_fn) = |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
181 |
case bmode of |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
182 |
Lst => (fold_append, bind_lst) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
183 |
| Set => (fold_union, bind_set) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
184 |
| Res => (fold_union, bind_set) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
185 |
in |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
186 |
binders |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
187 |
|> map (bind_fn lthy args) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
188 |
|> split_list |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
189 |
|> pairself combine_fn |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
190 |
end |
2295
8aff3f3ce47f
started to work on alpha
Christian Urban <urbanc@in.tum.de>
parents:
2294
diff
changeset
|
191 |
|
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
192 |
val t1 = map (mk_fv_body fv_map args) bodies |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
193 |
val (t2, t3) = mk_fv_binder lthy fv_bn_map args binders |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
194 |
in |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
195 |
mk_union (mk_diff (fold_union t1, to_set t2), to_set t3) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
196 |
end |
2292 | 197 |
|
2293
aecebd5ed424
hving a working fv-definition without the export
Christian Urban <urbanc@in.tum.de>
parents:
2292
diff
changeset
|
198 |
(* in case of fv_bn we have to treat the case special, where an |
aecebd5ed424
hving a working fv-definition without the export
Christian Urban <urbanc@in.tum.de>
parents:
2292
diff
changeset
|
199 |
"empty" binding clause is given *) |
2292 | 200 |
fun mk_fv_bn_rhs lthy fv_map fv_bn_map bn_args args bclause = |
2295
8aff3f3ce47f
started to work on alpha
Christian Urban <urbanc@in.tum.de>
parents:
2294
diff
changeset
|
201 |
let |
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
202 |
fun mk_fv_bn_body i = |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
203 |
let |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
204 |
val arg = nth args i |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
205 |
val ty = fastype_of arg |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
206 |
in |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
207 |
case AList.lookup (op=) bn_args i of |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
208 |
NONE => (case (AList.lookup (op=) fv_map ty) of |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
209 |
NONE => mk_supp arg |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
210 |
| SOME fv => fv $ arg) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
211 |
| SOME (NONE) => @{term "{}::atom set"} |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
212 |
| SOME (SOME bn) => lookup fv_bn_map bn $ arg |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
213 |
end |
2295
8aff3f3ce47f
started to work on alpha
Christian Urban <urbanc@in.tum.de>
parents:
2294
diff
changeset
|
214 |
in |
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
215 |
case bclause of |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
216 |
BC (_, [], bodies) => fold_union (map mk_fv_bn_body bodies) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
217 |
| _ => mk_fv_rhs lthy fv_map fv_bn_map args bclause |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
218 |
end |
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:
diff
changeset
|
219 |
|
2296 | 220 |
fun mk_fv_eq lthy fv_map fv_bn_map (constr, ty, arg_tys, _) bclauses = |
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
221 |
let |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
222 |
val arg_names = Datatype_Prop.make_tnames arg_tys |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
223 |
val args = map Free (arg_names ~~ arg_tys) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
224 |
val fv = lookup fv_map ty |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
225 |
val lhs = fv $ list_comb (constr, args) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
226 |
val rhs_trms = map (mk_fv_rhs lthy fv_map fv_bn_map args) bclauses |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
227 |
val rhs = fold_union rhs_trms |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
228 |
in |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
229 |
HOLogic.mk_Trueprop (HOLogic.mk_eq (lhs, rhs)) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
230 |
end |
2292 | 231 |
|
2296 | 232 |
fun mk_fv_bn_eq lthy bn_trm fv_map fv_bn_map (bn_args, (constr, _, arg_tys, _)) bclauses = |
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
233 |
let |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
234 |
val arg_names = Datatype_Prop.make_tnames arg_tys |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
235 |
val args = map Free (arg_names ~~ arg_tys) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
236 |
val fv_bn = lookup fv_bn_map bn_trm |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
237 |
val lhs = fv_bn $ list_comb (constr, args) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
238 |
val rhs_trms = map (mk_fv_bn_rhs lthy fv_map fv_bn_map bn_args args) bclauses |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
239 |
val rhs = fold_union rhs_trms |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
240 |
in |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
241 |
HOLogic.mk_Trueprop (HOLogic.mk_eq (lhs, rhs)) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
242 |
end |
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:
diff
changeset
|
243 |
|
2292 | 244 |
fun mk_fv_bn_eqs lthy fv_map fv_bn_map constrs_info bclausesss (bn_trm, bn_n, bn_argss) = |
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
245 |
let |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
246 |
val nth_constrs_info = nth constrs_info bn_n |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
247 |
val nth_bclausess = nth bclausesss bn_n |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
248 |
in |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
249 |
map2 (mk_fv_bn_eq lthy bn_trm fv_map fv_bn_map) (bn_argss ~~ nth_constrs_info) nth_bclausess |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
250 |
end |
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:
diff
changeset
|
251 |
|
2410
2bbdb9c427b5
improved runtime slightly, by constructing an explicit size measure for the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2409
diff
changeset
|
252 |
fun define_raw_fvs raw_full_ty_names raw_tys cns_info bn_info bclausesss constr_thms size_simps lthy = |
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
253 |
let |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
254 |
val fv_names = map (prefix "fv_" o Long_Name.base_name) raw_full_ty_names |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
255 |
val fv_tys = map (fn ty => ty --> @{typ "atom set"}) raw_tys |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
256 |
val fv_frees = map Free (fv_names ~~ fv_tys); |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
257 |
val fv_map = raw_tys ~~ fv_frees |
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:
diff
changeset
|
258 |
|
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
259 |
val (bns, bn_tys) = split_list (map (fn (bn, i, _) => (bn, i)) bn_info) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
260 |
val bn_names = map (fn bn => Long_Name.base_name (fst (dest_Const bn))) bns |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
261 |
val fv_bn_names = map (prefix "fv_") bn_names |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
262 |
val fv_bn_arg_tys = map (nth raw_tys) bn_tys |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
263 |
val fv_bn_tys = map (fn ty => ty --> @{typ "atom set"}) fv_bn_arg_tys |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
264 |
val fv_bn_frees = map Free (fv_bn_names ~~ fv_bn_tys) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
265 |
val fv_bn_map = bns ~~ fv_bn_frees |
2292 | 266 |
|
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
267 |
val fv_eqs = map2 (map2 (mk_fv_eq lthy fv_map fv_bn_map)) cns_info bclausesss |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
268 |
val fv_bn_eqs = map (mk_fv_bn_eqs lthy fv_map fv_bn_map cns_info bclausesss) bn_info |
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:
diff
changeset
|
269 |
|
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
270 |
val all_fun_names = map (fn s => (Binding.name s, NONE, NoSyn)) (fv_names @ fv_bn_names) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
271 |
val all_fun_eqs = map (pair Attrib.empty_binding) (flat fv_eqs @ flat fv_bn_eqs) |
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:
diff
changeset
|
272 |
|
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
273 |
val (_, lthy') = Function.add_function all_fun_names all_fun_eqs |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
274 |
Function_Common.default_config (pat_completeness_simp constr_thms) lthy |
2569
94750b31a97d
fixed bug in fv function where a shallow binder binds lists of names
Christian Urban <urbanc@in.tum.de>
parents:
2560
diff
changeset
|
275 |
|
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
276 |
val (info, lthy'') = prove_termination size_simps (Local_Theory.restore lthy') |
2410
2bbdb9c427b5
improved runtime slightly, by constructing an explicit size measure for the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2409
diff
changeset
|
277 |
|
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
278 |
val {fs, simps, inducts, ...} = info; |
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:
diff
changeset
|
279 |
|
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
280 |
val morphism = ProofContext.export_morphism lthy'' lthy |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
281 |
val simps_exp = map (Morphism.thm morphism) (the simps) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
282 |
val inducts_exp = map (Morphism.thm morphism) (the inducts) |
2431
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
283 |
|
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
284 |
val (fvs', fv_bns') = chop (length fv_frees) fs |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
285 |
in |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
286 |
(fvs', fv_bns', simps_exp, inducts_exp, lthy'') |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
287 |
end |
2305
93ab397f5980
smaller code for raw-eqvt proofs
Christian Urban <urbanc@in.tum.de>
parents:
2304
diff
changeset
|
288 |
|
93ab397f5980
smaller code for raw-eqvt proofs
Christian Urban <urbanc@in.tum.de>
parents:
2304
diff
changeset
|
289 |
|
2560
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
290 |
(** definition of raw permute_bn functions **) |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
291 |
|
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
292 |
fun mk_perm_bn_eq_rhs p perm_bn_map bn_args (i, arg) = |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
293 |
case AList.lookup (op=) bn_args i of |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
294 |
NONE => arg |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
295 |
| SOME (NONE) => mk_perm p arg |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
296 |
| SOME (SOME bn) => (lookup perm_bn_map bn) $ p $ arg |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
297 |
|
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
298 |
|
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
299 |
fun mk_perm_bn_eq lthy bn_trm perm_bn_map bn_args (constr, _, arg_tys, _) = |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
300 |
let |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
301 |
val p = Free ("p", @{typ perm}) |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
302 |
val arg_names = Datatype_Prop.make_tnames arg_tys |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
303 |
val args = map Free (arg_names ~~ arg_tys) |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
304 |
val perm_bn = lookup perm_bn_map bn_trm |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
305 |
val lhs = perm_bn $ p $ list_comb (constr, args) |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
306 |
val rhs = list_comb (constr, map_index (mk_perm_bn_eq_rhs p perm_bn_map bn_args) args) |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
307 |
in |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
308 |
HOLogic.mk_Trueprop (HOLogic.mk_eq (lhs, rhs)) |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
309 |
end |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
310 |
|
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
311 |
fun mk_perm_bn_eqs lthy perm_bn_map cns_info (bn_trm, bn_n, bn_argss) = |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
312 |
let |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
313 |
val nth_cns_info = nth cns_info bn_n |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
314 |
in |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
315 |
map2 (mk_perm_bn_eq lthy bn_trm perm_bn_map) bn_argss nth_cns_info |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
316 |
end |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
317 |
|
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
318 |
fun define_raw_bn_perms raw_tys bn_info cns_info cns_thms size_thms lthy = |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
319 |
if null bn_info |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
320 |
then ([], [], lthy) |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
321 |
else |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
322 |
let |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
323 |
val (bns, bn_tys) = split_list (map (fn (bn, i, _) => (bn, i)) bn_info) |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
324 |
val bn_names = map (fn bn => Long_Name.base_name (fst (dest_Const bn))) bns |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
325 |
val perm_bn_names = map (prefix "permute_") bn_names |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
326 |
val perm_bn_arg_tys = map (nth raw_tys) bn_tys |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
327 |
val perm_bn_tys = map (fn ty => @{typ "perm"} --> ty --> ty) perm_bn_arg_tys |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
328 |
val perm_bn_frees = map Free (perm_bn_names ~~ perm_bn_tys) |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
329 |
val perm_bn_map = bns ~~ perm_bn_frees |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
330 |
|
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
331 |
val perm_bn_eqs = map (mk_perm_bn_eqs lthy perm_bn_map cns_info) bn_info |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
332 |
|
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
333 |
val all_fun_names = map (fn s => (Binding.name s, NONE, NoSyn)) perm_bn_names |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
334 |
val all_fun_eqs = map (pair Attrib.empty_binding) (flat perm_bn_eqs) |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
335 |
|
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
336 |
val prod_simps = @{thms prod.inject HOL.simp_thms} |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
337 |
|
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
338 |
val (_, lthy') = Function.add_function all_fun_names all_fun_eqs |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
339 |
Function_Common.default_config (pat_completeness_simp (prod_simps @ cns_thms)) lthy |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
340 |
|
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
341 |
val (info, lthy'') = prove_termination size_thms (Local_Theory.restore lthy') |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
342 |
|
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
343 |
val {fs, simps, ...} = info; |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
344 |
|
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
345 |
val morphism = ProofContext.export_morphism lthy'' lthy |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
346 |
val simps_exp = map (Morphism.thm morphism) (the simps) |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
347 |
in |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
348 |
(fs, simps_exp, lthy'') |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
349 |
end |
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
350 |
|
82e37a4595c7
automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents:
2542
diff
changeset
|
351 |
|
2305
93ab397f5980
smaller code for raw-eqvt proofs
Christian Urban <urbanc@in.tum.de>
parents:
2304
diff
changeset
|
352 |
(** equivarance proofs **) |
93ab397f5980
smaller code for raw-eqvt proofs
Christian Urban <urbanc@in.tum.de>
parents:
2304
diff
changeset
|
353 |
|
2311
4da5c5c29009
work on transitivity proof
Christian Urban <urbanc@in.tum.de>
parents:
2309
diff
changeset
|
354 |
val eqvt_apply_sym = @{thm eqvt_apply[symmetric]} |
4da5c5c29009
work on transitivity proof
Christian Urban <urbanc@in.tum.de>
parents:
2309
diff
changeset
|
355 |
|
4da5c5c29009
work on transitivity proof
Christian Urban <urbanc@in.tum.de>
parents:
2309
diff
changeset
|
356 |
fun subproof_tac const_names simps = |
2388 | 357 |
SUBPROOF (fn {prems, context, ...} => |
2311
4da5c5c29009
work on transitivity proof
Christian Urban <urbanc@in.tum.de>
parents:
2309
diff
changeset
|
358 |
HEADGOAL |
4da5c5c29009
work on transitivity proof
Christian Urban <urbanc@in.tum.de>
parents:
2309
diff
changeset
|
359 |
(simp_tac (HOL_basic_ss addsimps simps) |
4da5c5c29009
work on transitivity proof
Christian Urban <urbanc@in.tum.de>
parents:
2309
diff
changeset
|
360 |
THEN' Nominal_Permeq.eqvt_tac context [] const_names |
2388 | 361 |
THEN' simp_tac (HOL_basic_ss addsimps (prems @ [eqvt_apply_sym])))) |
2311
4da5c5c29009
work on transitivity proof
Christian Urban <urbanc@in.tum.de>
parents:
2309
diff
changeset
|
362 |
|
4da5c5c29009
work on transitivity proof
Christian Urban <urbanc@in.tum.de>
parents:
2309
diff
changeset
|
363 |
fun prove_eqvt_tac insts ind_thms const_names simps ctxt = |
4da5c5c29009
work on transitivity proof
Christian Urban <urbanc@in.tum.de>
parents:
2309
diff
changeset
|
364 |
HEADGOAL |
4da5c5c29009
work on transitivity proof
Christian Urban <urbanc@in.tum.de>
parents:
2309
diff
changeset
|
365 |
(Object_Logic.full_atomize_tac |
4da5c5c29009
work on transitivity proof
Christian Urban <urbanc@in.tum.de>
parents:
2309
diff
changeset
|
366 |
THEN' (DETERM o (InductTacs.induct_rules_tac ctxt insts ind_thms)) |
4da5c5c29009
work on transitivity proof
Christian Urban <urbanc@in.tum.de>
parents:
2309
diff
changeset
|
367 |
THEN_ALL_NEW subproof_tac const_names simps ctxt) |
4da5c5c29009
work on transitivity proof
Christian Urban <urbanc@in.tum.de>
parents:
2309
diff
changeset
|
368 |
|
2305
93ab397f5980
smaller code for raw-eqvt proofs
Christian Urban <urbanc@in.tum.de>
parents:
2304
diff
changeset
|
369 |
fun mk_eqvt_goal pi const arg = |
2476
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
370 |
let |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
371 |
val lhs = mk_perm pi (const $ arg) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
372 |
val rhs = const $ (mk_perm pi arg) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
373 |
in |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
374 |
HOLogic.mk_Trueprop (HOLogic.mk_eq (lhs, rhs)) |
8f8652a8107f
tuned (to conform with indentation policy of Markus)
Christian Urban <urbanc@in.tum.de>
parents:
2464
diff
changeset
|
375 |
end |
2305
93ab397f5980
smaller code for raw-eqvt proofs
Christian Urban <urbanc@in.tum.de>
parents:
2304
diff
changeset
|
376 |
|
93ab397f5980
smaller code for raw-eqvt proofs
Christian Urban <urbanc@in.tum.de>
parents:
2304
diff
changeset
|
377 |
fun raw_prove_eqvt consts ind_thms simps ctxt = |
2308
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2305
diff
changeset
|
378 |
if null consts then [] |
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2305
diff
changeset
|
379 |
else |
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2305
diff
changeset
|
380 |
let |
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2305
diff
changeset
|
381 |
val ([p], ctxt') = Variable.variant_fixes ["p"] ctxt |
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2305
diff
changeset
|
382 |
val p = Free (p, @{typ perm}) |
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2305
diff
changeset
|
383 |
val arg_tys = |
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2305
diff
changeset
|
384 |
consts |
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2305
diff
changeset
|
385 |
|> map fastype_of |
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2305
diff
changeset
|
386 |
|> map domain_type |
2311
4da5c5c29009
work on transitivity proof
Christian Urban <urbanc@in.tum.de>
parents:
2309
diff
changeset
|
387 |
val (arg_names, ctxt'') = |
4da5c5c29009
work on transitivity proof
Christian Urban <urbanc@in.tum.de>
parents:
2309
diff
changeset
|
388 |
Variable.variant_fixes (Datatype_Prop.make_tnames arg_tys) ctxt' |
2308
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2305
diff
changeset
|
389 |
val args = map Free (arg_names ~~ arg_tys) |
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2305
diff
changeset
|
390 |
val goals = map2 (mk_eqvt_goal p) consts args |
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2305
diff
changeset
|
391 |
val insts = map (single o SOME) arg_names |
2311
4da5c5c29009
work on transitivity proof
Christian Urban <urbanc@in.tum.de>
parents:
2309
diff
changeset
|
392 |
val const_names = map (fst o dest_Const) consts |
2308
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2305
diff
changeset
|
393 |
in |
2311
4da5c5c29009
work on transitivity proof
Christian Urban <urbanc@in.tum.de>
parents:
2309
diff
changeset
|
394 |
Goal.prove_multi ctxt'' [] [] goals (fn {context, ...} => |
4da5c5c29009
work on transitivity proof
Christian Urban <urbanc@in.tum.de>
parents:
2309
diff
changeset
|
395 |
prove_eqvt_tac insts ind_thms const_names simps context) |
2308
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2305
diff
changeset
|
396 |
|> ProofContext.export ctxt'' ctxt |
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2305
diff
changeset
|
397 |
end |
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:
diff
changeset
|
398 |
|
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:
diff
changeset
|
399 |
end (* structure *) |
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:
diff
changeset
|
400 |