author | Christian Urban <urbanc@in.tum.de> |
Sun, 25 Jul 2010 22:42:21 +0200 | |
changeset 2382 | e8b9c0ebf5dd |
parent 2365 | 467123396e5a |
child 2384 | 841b7e34e70a |
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 |
|
2338 | 7 |
declare [[STEPS = 16]] |
2294
72ad4e766acf
properly exported bn_descr
Christian Urban <urbanc@in.tum.de>
parents:
2293
diff
changeset
|
8 |
|
2336
f2d545b77b31
added definition of the quotient types
Christian Urban <urbanc@in.tum.de>
parents:
2330
diff
changeset
|
9 |
nominal_datatype trm = |
1911
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
10 |
Var "name" |
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
11 |
| App "trm" "trm" |
2024
d974059827ad
Equivariance fails for single let?
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1911
diff
changeset
|
12 |
| Lam x::"name" t::"trm" bind_set x in t |
d974059827ad
Equivariance fails for single let?
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1911
diff
changeset
|
13 |
| Let a::"assg" t::"trm" bind_set "bn a" in t |
2311
4da5c5c29009
work on transitivity proof
Christian Urban <urbanc@in.tum.de>
parents:
2308
diff
changeset
|
14 |
| Foo x::"name" y::"name" t::"trm" t1::"trm" t2::"trm" bind_set x in y t t1 t2 |
2296 | 15 |
| Bar x::"name" y::"name" t::"trm" bind y x in t x y |
2316 | 16 |
| 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
|
17 |
and assg = |
2320
d835a2771608
prove that alpha implies alpha_bn (needed for rsp proofs)
Christian Urban <urbanc@in.tum.de>
parents:
2318
diff
changeset
|
18 |
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
|
19 |
binder |
1911
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
20 |
bn::"assg \<Rightarrow> atom set" |
1596
c69d9fb16785
Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
21 |
where |
2320
d835a2771608
prove that alpha implies alpha_bn (needed for rsp proofs)
Christian Urban <urbanc@in.tum.de>
parents:
2318
diff
changeset
|
22 |
"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
|
23 |
|
2359 | 24 |
typ trm |
25 |
typ assg |
|
2338 | 26 |
term Var |
27 |
term App |
|
28 |
term Baz |
|
2339
1e0b3992189c
more quotient-definitions
Christian Urban <urbanc@in.tum.de>
parents:
2338
diff
changeset
|
29 |
term bn |
1e0b3992189c
more quotient-definitions
Christian Urban <urbanc@in.tum.de>
parents:
2338
diff
changeset
|
30 |
term fv_trm |
2338 | 31 |
|
2361 | 32 |
lemma a1: |
33 |
shows "alpha_trm_raw x1 y1 \<Longrightarrow> True" |
|
34 |
and "alpha_assg_raw x2 y2 \<Longrightarrow> alpha_bn_raw x2 y2" |
|
35 |
and "alpha_bn_raw x3 y3 \<Longrightarrow> True" |
|
36 |
apply(induct rule: alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.inducts) |
|
2382
e8b9c0ebf5dd
added paper by james; some minor cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2365
diff
changeset
|
37 |
apply(rule TrueI)+ |
2361 | 38 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros) |
2382
e8b9c0ebf5dd
added paper by james; some minor cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2365
diff
changeset
|
39 |
sorry |
2361 | 40 |
|
41 |
lemma a2: |
|
42 |
shows "alpha_trm_raw x1 y1 \<Longrightarrow> fv_trm_raw x1 = fv_trm_raw y1" |
|
43 |
and "alpha_assg_raw x2 y2 \<Longrightarrow> fv_assg_raw x2 = fv_assg_raw y2 \<and> bn_raw x2 = bn_raw y2" |
|
44 |
and "alpha_bn_raw x3 y3 \<Longrightarrow> fv_bn_raw x3 = fv_bn_raw y3" |
|
45 |
apply(induct rule: alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.inducts) |
|
2382
e8b9c0ebf5dd
added paper by james; some minor cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2365
diff
changeset
|
46 |
apply(simp_all only: fv_trm_raw.simps fv_assg_raw.simps fv_bn_raw.simps) |
e8b9c0ebf5dd
added paper by james; some minor cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2365
diff
changeset
|
47 |
apply(simp_all only: alphas prod_alpha_def) |
e8b9c0ebf5dd
added paper by james; some minor cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2365
diff
changeset
|
48 |
apply(auto)[1] |
e8b9c0ebf5dd
added paper by james; some minor cleaning
Christian Urban <urbanc@in.tum.de>
parents:
2365
diff
changeset
|
49 |
apply(auto simp add: prod_alpha_def) |
2361 | 50 |
done |
51 |
||
2359 | 52 |
lemma [quot_respect]: |
2361 | 53 |
"(op= ===> alpha_trm_raw) Var_raw Var_raw" |
2359 | 54 |
"(alpha_trm_raw ===> alpha_trm_raw ===> alpha_trm_raw) App_raw App_raw" |
2361 | 55 |
"(op= ===> alpha_trm_raw ===> alpha_trm_raw) Lam_raw Lam_raw" |
56 |
"(alpha_assg_raw ===> alpha_trm_raw ===> alpha_trm_raw) Let_raw Let_raw" |
|
57 |
"(op= ===> op= ===> alpha_trm_raw ===> alpha_trm_raw ===> alpha_trm_raw ===> alpha_trm_raw) |
|
58 |
Foo_raw Foo_raw" |
|
59 |
"(op= ===> op= ===> alpha_trm_raw ===> alpha_trm_raw) Bar_raw Bar_raw" |
|
60 |
"(op= ===> alpha_trm_raw ===> alpha_trm_raw ===> alpha_trm_raw) Baz_raw Baz_raw" |
|
61 |
"(op = ===> op = ===> alpha_trm_raw ===> alpha_assg_raw) As_raw As_raw" |
|
2359 | 62 |
apply(auto) |
63 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros) |
|
64 |
apply(rule refl) |
|
65 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros) |
|
66 |
apply(assumption) |
|
67 |
apply(assumption) |
|
2361 | 68 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros) |
69 |
apply(rule_tac x="0" in exI) |
|
70 |
apply(simp add: alphas fresh_star_def fresh_zero_perm a2) |
|
71 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros) |
|
72 |
apply(rule_tac x="0" in exI) |
|
73 |
apply(simp add: alphas fresh_star_def fresh_zero_perm a2) |
|
74 |
apply(simp add: a1) |
|
75 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros) |
|
76 |
apply(rule_tac x="0" in exI) |
|
77 |
apply(simp add: alphas fresh_star_def fresh_zero_perm a2 prod_alpha_def) |
|
78 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros) |
|
79 |
apply(rule_tac x="0" in exI) |
|
80 |
apply(simp add: alphas fresh_star_def fresh_zero_perm a2 prod_alpha_def) |
|
81 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros) |
|
82 |
apply(rule_tac x="0" in exI) |
|
83 |
apply(simp add: alphas fresh_star_def fresh_zero_perm a2 prod_alpha_def) |
|
84 |
apply(rule_tac x="0" in exI) |
|
85 |
apply(simp add: alphas fresh_star_def fresh_zero_perm a2 prod_alpha_def) |
|
86 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros) |
|
87 |
apply(rule_tac x="0" in exI) |
|
88 |
apply(simp add: alphas fresh_star_def fresh_zero_perm a2 prod_alpha_def) |
|
89 |
apply(rule refl) |
|
2359 | 90 |
done |
91 |
||
2361 | 92 |
lemma [quot_respect]: |
93 |
"(alpha_trm_raw ===> op =) fv_trm_raw fv_trm_raw" |
|
94 |
"(alpha_assg_raw ===> op =) fv_bn_raw fv_bn_raw" |
|
95 |
"(alpha_assg_raw ===> op =) bn_raw bn_raw" |
|
96 |
"(alpha_assg_raw ===> op =) fv_assg_raw fv_assg_raw" |
|
97 |
"(op = ===> alpha_trm_raw ===> alpha_trm_raw) permute permute" |
|
98 |
apply(simp_all add: a2 a1) |
|
99 |
sorry |
|
100 |
||
101 |
ML {* |
|
102 |
val thms_d = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms distinct} |
|
103 |
*} |
|
104 |
||
105 |
ML {* |
|
106 |
val thms_i = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms trm_raw_assg_raw.inducts} |
|
107 |
*} |
|
108 |
||
109 |
ML {* |
|
110 |
val thms_f = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms fv_defs} |
|
111 |
*} |
|
112 |
||
113 |
thm perm_defs[no_vars] |
|
114 |
||
115 |
instance trm :: pt sorry |
|
116 |
instance assg :: pt sorry |
|
117 |
||
2365 | 118 |
lemma b1: |
2361 | 119 |
"p \<bullet> Var name = Var (p \<bullet> name)" |
120 |
"p \<bullet> App trm1 trm2 = App (p \<bullet> trm1) (p \<bullet> trm2)" |
|
121 |
"p \<bullet> Lam name trm = Lam (p \<bullet> name) (p \<bullet> trm)" |
|
122 |
"p \<bullet> Let assg trm = Let (p \<bullet> assg) (p \<bullet> trm)" |
|
123 |
"p \<bullet> Foo name1 name2 trm1 trm2 trm3 = |
|
124 |
Foo (p \<bullet> name1) (p \<bullet> name2) (p \<bullet> trm1) (p \<bullet> trm2) (p \<bullet> trm3)" |
|
125 |
"p \<bullet> Bar name1 name2 trm = Bar (p \<bullet> name1) (p \<bullet> name2) (p \<bullet> trm)" |
|
126 |
"p \<bullet> Baz name trm1 trm2 = Baz (p \<bullet> name) (p \<bullet> trm1) (p \<bullet> trm2)" |
|
127 |
"p \<bullet> As name1 name2 trm = As (p \<bullet> name1) (p \<bullet> name2) (p \<bullet> trm)" |
|
128 |
sorry |
|
129 |
||
130 |
||
131 |
(* |
|
132 |
ML {* |
|
133 |
val thms_p = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms perm_defs} |
|
134 |
*} |
|
135 |
*) |
|
136 |
||
2365 | 137 |
thm eq_iff[no_vars] |
138 |
||
139 |
ML {* |
|
140 |
val q1 = lift_thm [@{typ trm}, @{typ assg}] @{context} @{thm "eq_iff"(1)} |
|
141 |
*} |
|
142 |
||
2361 | 143 |
local_setup {* Local_Theory.note ((@{binding d1}, []), thms_d) #> snd *} |
144 |
local_setup {* Local_Theory.note ((@{binding i1}, []), thms_i) #> snd *} |
|
145 |
local_setup {* Local_Theory.note ((@{binding f1}, []), thms_f) #> snd *} |
|
2365 | 146 |
local_setup {* Local_Theory.note ((@{binding q1}, []), [q1]) #> snd *} |
147 |
||
2361 | 148 |
|
149 |
thm perm_defs |
|
150 |
thm perm_simps |
|
151 |
||
152 |
lemma supp_fv: |
|
153 |
"supp t = fv_trm t" |
|
154 |
"supp b = fv_bn b" |
|
155 |
apply(induct t and b rule: i1) |
|
156 |
apply(simp_all add: f1) |
|
157 |
apply(simp_all add: supp_def) |
|
2365 | 158 |
apply(simp_all add: b1) |
159 |
sorry |
|
160 |
||
161 |
consts perm_bn_trm :: "perm \<Rightarrow> trm \<Rightarrow> trm" |
|
162 |
consts perm_bn_assg :: "perm \<Rightarrow> assg \<Rightarrow> assg" |
|
163 |
||
164 |
lemma y: |
|
165 |
"perm_bn_trm p (Var x) = (Var x)" |
|
166 |
"perm_bn_trm p (App t1 t2) = (App t1 t2)" |
|
167 |
"perm_bn_trm p (" |
|
168 |
||
169 |
||
2361 | 170 |
|
171 |
ML {* |
|
172 |
map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms eq_iff} |
|
173 |
*} |
|
174 |
||
175 |
||
176 |
||
2359 | 177 |
|
178 |
||
179 |
lemma "Var x \<noteq> App y1 y2" |
|
180 |
apply(descending) |
|
181 |
apply(simp add: trm_raw.distinct) |
|
182 |
||
183 |
||
184 |
||
185 |
ML {* |
|
186 |
map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms trm_raw.distinct(1)} |
|
187 |
*} |
|
188 |
||
189 |
||
190 |
||
2338 | 191 |
|
2336
f2d545b77b31
added definition of the quotient types
Christian Urban <urbanc@in.tum.de>
parents:
2330
diff
changeset
|
192 |
typ trm |
f2d545b77b31
added definition of the quotient types
Christian Urban <urbanc@in.tum.de>
parents:
2330
diff
changeset
|
193 |
typ assg |
f2d545b77b31
added definition of the quotient types
Christian Urban <urbanc@in.tum.de>
parents:
2330
diff
changeset
|
194 |
|
1911
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
195 |
thm trm_assg.fv |
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
196 |
thm trm_assg.supp |
2024
d974059827ad
Equivariance fails for single let?
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1911
diff
changeset
|
197 |
thm trm_assg.eq_iff |
1911
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
198 |
thm trm_assg.bn |
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
199 |
thm trm_assg.perm |
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
200 |
thm trm_assg.induct |
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
201 |
thm trm_assg.inducts |
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
202 |
thm trm_assg.distinct |
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
203 |
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
|
204 |
|
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
|
205 |
(* TEMPORARY |
2024
d974059827ad
Equivariance fails for single let?
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1911
diff
changeset
|
206 |
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
|
207 |
*) |
2064
2725853f43b9
solved the problem with equivariance by first eta-normalising the goal
Christian Urban <urbanc@in.tum.de>
parents:
2028
diff
changeset
|
208 |
|
1596
c69d9fb16785
Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
209 |
end |
c69d9fb16785
Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
210 |
|
c69d9fb16785
Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
211 |
|
c69d9fb16785
Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
212 |