author | Christian Urban <urbanc@in.tum.de> |
Sat, 21 Aug 2010 16:20:10 +0800 | |
changeset 2424 | 621ebd8b13c4 |
parent 2410 | 2bbdb9c427b5 |
child 2428 | 58e60df1ff79 |
permissions | -rw-r--r-- |
1911
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
1 |
theory SingleLet |
2024
d974059827ad
Equivariance fails for single let?
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1911
diff
changeset
|
2 |
imports "../NewParser" |
1596
c69d9fb16785
Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
3 |
begin |
c69d9fb16785
Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
4 |
|
c69d9fb16785
Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
5 |
atom_decl name |
c69d9fb16785
Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
6 |
|
2400
c6d30d5f5ba1
defined qperms and qsizes
Christian Urban <urbanc@in.tum.de>
parents:
2398
diff
changeset
|
7 |
declare [[STEPS = 20]] |
2294
72ad4e766acf
properly exported bn_descr
Christian Urban <urbanc@in.tum.de>
parents:
2293
diff
changeset
|
8 |
|
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
|
9 |
|
2336
f2d545b77b31
added definition of the quotient types
Christian Urban <urbanc@in.tum.de>
parents:
2330
diff
changeset
|
10 |
nominal_datatype trm = |
1911
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
11 |
Var "name" |
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
12 |
| App "trm" "trm" |
2424
621ebd8b13c4
changed parser so that the binding mode is indicated as "bind (list)", "bind (set)" or "bind (res)"; if only "bind" is given, then bind (list) is assumed as default
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
13 |
| Lam x::"name" t::"trm" bind x in t |
621ebd8b13c4
changed parser so that the binding mode is indicated as "bind (list)", "bind (set)" or "bind (res)"; if only "bind" is given, then bind (list) is assumed as default
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
14 |
| Let a::"assg" t::"trm" bind (set) "bn a" in t |
621ebd8b13c4
changed parser so that the binding mode is indicated as "bind (list)", "bind (set)" or "bind (res)"; if only "bind" is given, then bind (list) is assumed as default
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
15 |
| Foo x::"name" y::"name" t::"trm" t1::"trm" t2::"trm" bind (set) x in y t t1 t2 |
2296 | 16 |
| Bar x::"name" y::"name" t::"trm" bind y x in t x y |
2316 | 17 |
| Baz x::"name" t1::"trm" t2::"trm" bind x in t1, bind x in t2 |
1911
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
18 |
and assg = |
2320
d835a2771608
prove that alpha implies alpha_bn (needed for rsp proofs)
Christian Urban <urbanc@in.tum.de>
parents:
2318
diff
changeset
|
19 |
As "name" x::"name" t::"trm" bind x in t |
1596
c69d9fb16785
Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
20 |
binder |
1911
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
21 |
bn::"assg \<Rightarrow> atom set" |
1596
c69d9fb16785
Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
22 |
where |
2320
d835a2771608
prove that alpha implies alpha_bn (needed for rsp proofs)
Christian Urban <urbanc@in.tum.de>
parents:
2318
diff
changeset
|
23 |
"bn (As x y t) = {atom x}" |
1911
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
24 |
|
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
|
25 |
|
2bbdb9c427b5
improved runtime slightly, by constructing an explicit size measure for the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2409
diff
changeset
|
26 |
|
2424
621ebd8b13c4
changed parser so that the binding mode is indicated as "bind (list)", "bind (set)" or "bind (res)"; if only "bind" is given, then bind (list) is assumed as default
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
27 |
|
2409
83990a42a068
more tuning of the code
Christian Urban <urbanc@in.tum.de>
parents:
2407
diff
changeset
|
28 |
ML {* Function.prove_termination *} |
83990a42a068
more tuning of the code
Christian Urban <urbanc@in.tum.de>
parents:
2407
diff
changeset
|
29 |
|
83990a42a068
more tuning of the code
Christian Urban <urbanc@in.tum.de>
parents:
2407
diff
changeset
|
30 |
text {* can lift *} |
2401
7645e18e8b19
modified the code for class instantiations (with help from Florian)
Christian Urban <urbanc@in.tum.de>
parents:
2400
diff
changeset
|
31 |
|
2397
c670a849af65
more experiments with lifting
Christian Urban <urbanc@in.tum.de>
parents:
2395
diff
changeset
|
32 |
thm distinct |
c670a849af65
more experiments with lifting
Christian Urban <urbanc@in.tum.de>
parents:
2395
diff
changeset
|
33 |
thm trm_raw_assg_raw.inducts |
2407 | 34 |
thm trm_raw.exhaust |
35 |
thm assg_raw.exhaust |
|
2424
621ebd8b13c4
changed parser so that the binding mode is indicated as "bind (list)", "bind (set)" or "bind (res)"; if only "bind" is given, then bind (list) is assumed as default
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
36 |
thm fv_defs |
2384
841b7e34e70a
fixed order of fold_union to make alpha and fv agree
Christian Urban <urbanc@in.tum.de>
parents:
2382
diff
changeset
|
37 |
thm perm_simps |
841b7e34e70a
fixed order of fold_union to make alpha and fv agree
Christian Urban <urbanc@in.tum.de>
parents:
2382
diff
changeset
|
38 |
thm perm_laws |
2397
c670a849af65
more experiments with lifting
Christian Urban <urbanc@in.tum.de>
parents:
2395
diff
changeset
|
39 |
thm trm_raw_assg_raw.size(9 - 16) |
2398 | 40 |
thm eq_iff |
41 |
thm eq_iff_simps |
|
2406
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
parents:
2405
diff
changeset
|
42 |
thm bn_defs |
2424
621ebd8b13c4
changed parser so that the binding mode is indicated as "bind (list)", "bind (set)" or "bind (res)"; if only "bind" is given, then bind (list) is assumed as default
Christian Urban <urbanc@in.tum.de>
parents:
2410
diff
changeset
|
43 |
thm fv_eqvt |
2406
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
parents:
2405
diff
changeset
|
44 |
thm bn_eqvt |
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
parents:
2405
diff
changeset
|
45 |
thm size_eqvt |
2405
29ebbe56f450
also able to lift the bn_defs
Christian Urban <urbanc@in.tum.de>
parents:
2404
diff
changeset
|
46 |
|
2406
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
parents:
2405
diff
changeset
|
47 |
|
2398 | 48 |
ML {* |
49 |
val thms_d = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms distinct} |
|
50 |
*} |
|
2397
c670a849af65
more experiments with lifting
Christian Urban <urbanc@in.tum.de>
parents:
2395
diff
changeset
|
51 |
|
2398 | 52 |
ML {* |
53 |
val thms_i = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms trm_raw_assg_raw.inducts} |
|
54 |
*} |
|
55 |
||
2407 | 56 |
ML {* |
57 |
val thms_i = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms trm_raw.exhaust} |
|
58 |
*} |
|
59 |
||
60 |
ML {* |
|
61 |
val thms_i = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms assg_raw.exhaust} |
|
62 |
*} |
|
63 |
||
2398 | 64 |
ML {* |
65 |
val thms_f = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms fv_defs} |
|
66 |
*} |
|
67 |
||
68 |
ML {* |
|
69 |
val thms_i = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms trm_raw_assg_raw.size(9 - 16)} |
|
70 |
*} |
|
71 |
||
72 |
ML {* |
|
73 |
val thms_p = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms perm_simps} |
|
74 |
*} |
|
75 |
||
76 |
ML {* |
|
77 |
val thms_f = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms perm_laws} |
|
78 |
*} |
|
79 |
||
2402 | 80 |
ML {* |
2403
a92d2c915004
cezary made the eq_iff lemmas to lift (still needs some infrastructure in quotient)
Christian Urban <urbanc@in.tum.de>
parents:
2402
diff
changeset
|
81 |
val thms_e = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) |
a92d2c915004
cezary made the eq_iff lemmas to lift (still needs some infrastructure in quotient)
Christian Urban <urbanc@in.tum.de>
parents:
2402
diff
changeset
|
82 |
@{thms eq_iff[unfolded alphas permute_prod.simps prod_fv.simps prod_alpha_def prod_rel.simps |
a92d2c915004
cezary made the eq_iff lemmas to lift (still needs some infrastructure in quotient)
Christian Urban <urbanc@in.tum.de>
parents:
2402
diff
changeset
|
83 |
prod.cases]} |
2402 | 84 |
*} |
2397
c670a849af65
more experiments with lifting
Christian Urban <urbanc@in.tum.de>
parents:
2395
diff
changeset
|
85 |
|
2405
29ebbe56f450
also able to lift the bn_defs
Christian Urban <urbanc@in.tum.de>
parents:
2404
diff
changeset
|
86 |
ML {* |
29ebbe56f450
also able to lift the bn_defs
Christian Urban <urbanc@in.tum.de>
parents:
2404
diff
changeset
|
87 |
val thms_e = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) |
29ebbe56f450
also able to lift the bn_defs
Christian Urban <urbanc@in.tum.de>
parents:
2404
diff
changeset
|
88 |
@{thms eq_iff_simps[unfolded alphas permute_prod.simps prod_fv.simps prod_alpha_def prod_rel.simps |
29ebbe56f450
also able to lift the bn_defs
Christian Urban <urbanc@in.tum.de>
parents:
2404
diff
changeset
|
89 |
prod.cases]} |
29ebbe56f450
also able to lift the bn_defs
Christian Urban <urbanc@in.tum.de>
parents:
2404
diff
changeset
|
90 |
*} |
2397
c670a849af65
more experiments with lifting
Christian Urban <urbanc@in.tum.de>
parents:
2395
diff
changeset
|
91 |
|
2405
29ebbe56f450
also able to lift the bn_defs
Christian Urban <urbanc@in.tum.de>
parents:
2404
diff
changeset
|
92 |
ML {* |
29ebbe56f450
also able to lift the bn_defs
Christian Urban <urbanc@in.tum.de>
parents:
2404
diff
changeset
|
93 |
val thms_f = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms bn_defs} |
29ebbe56f450
also able to lift the bn_defs
Christian Urban <urbanc@in.tum.de>
parents:
2404
diff
changeset
|
94 |
*} |
2361 | 95 |
|
2406
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
parents:
2405
diff
changeset
|
96 |
ML {* |
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
parents:
2405
diff
changeset
|
97 |
val thms_f = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms bn_eqvt} |
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
parents:
2405
diff
changeset
|
98 |
*} |
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
parents:
2405
diff
changeset
|
99 |
|
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
parents:
2405
diff
changeset
|
100 |
ML {* |
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
parents:
2405
diff
changeset
|
101 |
val thms_f = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms fv_eqvt} |
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
parents:
2405
diff
changeset
|
102 |
*} |
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
parents:
2405
diff
changeset
|
103 |
|
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
parents:
2405
diff
changeset
|
104 |
ML {* |
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
parents:
2405
diff
changeset
|
105 |
val thms_f = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms size_eqvt} |
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
parents:
2405
diff
changeset
|
106 |
*} |
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
parents:
2405
diff
changeset
|
107 |
|
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
parents:
2405
diff
changeset
|
108 |
|
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
parents:
2405
diff
changeset
|
109 |
|
2361 | 110 |
lemma supp_fv: |
111 |
"supp t = fv_trm t" |
|
112 |
"supp b = fv_bn b" |
|
113 |
apply(induct t and b rule: i1) |
|
114 |
apply(simp_all add: f1) |
|
115 |
apply(simp_all add: supp_def) |
|
2365 | 116 |
apply(simp_all add: b1) |
117 |
sorry |
|
118 |
||
119 |
consts perm_bn_trm :: "perm \<Rightarrow> trm \<Rightarrow> trm" |
|
120 |
consts perm_bn_assg :: "perm \<Rightarrow> assg \<Rightarrow> assg" |
|
121 |
||
122 |
lemma y: |
|
123 |
"perm_bn_trm p (Var x) = (Var x)" |
|
124 |
"perm_bn_trm p (App t1 t2) = (App t1 t2)" |
|
125 |
"perm_bn_trm p (" |
|
126 |
||
127 |
||
2361 | 128 |
|
2336
f2d545b77b31
added definition of the quotient types
Christian Urban <urbanc@in.tum.de>
parents:
2330
diff
changeset
|
129 |
typ trm |
f2d545b77b31
added definition of the quotient types
Christian Urban <urbanc@in.tum.de>
parents:
2330
diff
changeset
|
130 |
typ assg |
f2d545b77b31
added definition of the quotient types
Christian Urban <urbanc@in.tum.de>
parents:
2330
diff
changeset
|
131 |
|
1911
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
132 |
thm trm_assg.fv |
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
133 |
thm trm_assg.supp |
2024
d974059827ad
Equivariance fails for single let?
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1911
diff
changeset
|
134 |
thm trm_assg.eq_iff |
1911
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
135 |
thm trm_assg.bn |
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
136 |
thm trm_assg.perm |
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
137 |
thm trm_assg.induct |
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
138 |
thm trm_assg.inducts |
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
139 |
thm trm_assg.distinct |
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
140 |
ML {* Sign.of_sort @{theory} (@{typ trm}, @{sort fs}) *} |
2024
d974059827ad
Equivariance fails for single let?
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1911
diff
changeset
|
141 |
|
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:
2146
diff
changeset
|
142 |
(* TEMPORARY |
2024
d974059827ad
Equivariance fails for single let?
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1911
diff
changeset
|
143 |
thm trm_assg.fv[simplified trm_assg.supp(1-2)] |
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:
2146
diff
changeset
|
144 |
*) |
2064
2725853f43b9
solved the problem with equivariance by first eta-normalising the goal
Christian Urban <urbanc@in.tum.de>
parents:
2028
diff
changeset
|
145 |
|
1596
c69d9fb16785
Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
146 |
end |
c69d9fb16785
Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
147 |
|
c69d9fb16785
Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
148 |
|
c69d9fb16785
Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
149 |