author | Christian Urban <urbanc@in.tum.de> |
Fri, 16 Jul 2010 02:38:19 +0100 | |
changeset 2361 | d73d4d151cce |
parent 2359 | 46f753eeb0b8 |
child 2365 | 467123396e5a |
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) |
|
37 |
apply(simp_all) |
|
38 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros) |
|
39 |
apply(assumption) |
|
40 |
done |
|
41 |
||
42 |
lemma a2: |
|
43 |
shows "alpha_trm_raw x1 y1 \<Longrightarrow> fv_trm_raw x1 = fv_trm_raw y1" |
|
44 |
and "alpha_assg_raw x2 y2 \<Longrightarrow> fv_assg_raw x2 = fv_assg_raw y2 \<and> bn_raw x2 = bn_raw y2" |
|
45 |
and "alpha_bn_raw x3 y3 \<Longrightarrow> fv_bn_raw x3 = fv_bn_raw y3" |
|
46 |
apply(induct rule: alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.inducts) |
|
47 |
apply(simp_all add: alphas a1 prod_alpha_def) |
|
48 |
apply(auto) |
|
49 |
done |
|
50 |
||
2359 | 51 |
lemma [quot_respect]: |
2361 | 52 |
"(op= ===> alpha_trm_raw) Var_raw Var_raw" |
2359 | 53 |
"(alpha_trm_raw ===> alpha_trm_raw ===> alpha_trm_raw) App_raw App_raw" |
2361 | 54 |
"(op= ===> alpha_trm_raw ===> alpha_trm_raw) Lam_raw Lam_raw" |
55 |
"(alpha_assg_raw ===> alpha_trm_raw ===> alpha_trm_raw) Let_raw Let_raw" |
|
56 |
"(op= ===> op= ===> alpha_trm_raw ===> alpha_trm_raw ===> alpha_trm_raw ===> alpha_trm_raw) |
|
57 |
Foo_raw Foo_raw" |
|
58 |
"(op= ===> op= ===> alpha_trm_raw ===> alpha_trm_raw) Bar_raw Bar_raw" |
|
59 |
"(op= ===> alpha_trm_raw ===> alpha_trm_raw ===> alpha_trm_raw) Baz_raw Baz_raw" |
|
60 |
"(op = ===> op = ===> alpha_trm_raw ===> alpha_assg_raw) As_raw As_raw" |
|
2359 | 61 |
apply(auto) |
62 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros) |
|
63 |
apply(rule refl) |
|
64 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros) |
|
65 |
apply(assumption) |
|
66 |
apply(assumption) |
|
2361 | 67 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros) |
68 |
apply(rule_tac x="0" in exI) |
|
69 |
apply(simp add: alphas fresh_star_def fresh_zero_perm a2) |
|
70 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros) |
|
71 |
apply(rule_tac x="0" in exI) |
|
72 |
apply(simp add: alphas fresh_star_def fresh_zero_perm a2) |
|
73 |
apply(simp add: a1) |
|
74 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros) |
|
75 |
apply(rule_tac x="0" in exI) |
|
76 |
apply(simp add: alphas fresh_star_def fresh_zero_perm a2 prod_alpha_def) |
|
77 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros) |
|
78 |
apply(rule_tac x="0" in exI) |
|
79 |
apply(simp add: alphas fresh_star_def fresh_zero_perm a2 prod_alpha_def) |
|
80 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros) |
|
81 |
apply(rule_tac x="0" in exI) |
|
82 |
apply(simp add: alphas fresh_star_def fresh_zero_perm a2 prod_alpha_def) |
|
83 |
apply(rule_tac x="0" in exI) |
|
84 |
apply(simp add: alphas fresh_star_def fresh_zero_perm a2 prod_alpha_def) |
|
85 |
apply(rule alpha_trm_raw_alpha_assg_raw_alpha_bn_raw.intros) |
|
86 |
apply(rule_tac x="0" in exI) |
|
87 |
apply(simp add: alphas fresh_star_def fresh_zero_perm a2 prod_alpha_def) |
|
88 |
apply(rule refl) |
|
2359 | 89 |
done |
90 |
||
2361 | 91 |
lemma [quot_respect]: |
92 |
"(alpha_trm_raw ===> op =) fv_trm_raw fv_trm_raw" |
|
93 |
"(alpha_assg_raw ===> op =) fv_bn_raw fv_bn_raw" |
|
94 |
"(alpha_assg_raw ===> op =) bn_raw bn_raw" |
|
95 |
"(alpha_assg_raw ===> op =) fv_assg_raw fv_assg_raw" |
|
96 |
"(op = ===> alpha_trm_raw ===> alpha_trm_raw) permute permute" |
|
97 |
apply(simp_all add: a2 a1) |
|
98 |
sorry |
|
99 |
||
100 |
ML {* |
|
101 |
val thms_d = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms distinct} |
|
102 |
*} |
|
103 |
||
104 |
ML {* |
|
105 |
val thms_i = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms trm_raw_assg_raw.inducts} |
|
106 |
*} |
|
107 |
||
108 |
ML {* |
|
109 |
val thms_f = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms fv_defs} |
|
110 |
*} |
|
111 |
||
112 |
thm perm_defs[no_vars] |
|
113 |
||
114 |
instance trm :: pt sorry |
|
115 |
instance assg :: pt sorry |
|
116 |
||
117 |
lemma |
|
118 |
"p \<bullet> Var name = Var (p \<bullet> name)" |
|
119 |
"p \<bullet> App trm1 trm2 = App (p \<bullet> trm1) (p \<bullet> trm2)" |
|
120 |
"p \<bullet> Lam name trm = Lam (p \<bullet> name) (p \<bullet> trm)" |
|
121 |
"p \<bullet> Let assg trm = Let (p \<bullet> assg) (p \<bullet> trm)" |
|
122 |
"p \<bullet> Foo name1 name2 trm1 trm2 trm3 = |
|
123 |
Foo (p \<bullet> name1) (p \<bullet> name2) (p \<bullet> trm1) (p \<bullet> trm2) (p \<bullet> trm3)" |
|
124 |
"p \<bullet> Bar name1 name2 trm = Bar (p \<bullet> name1) (p \<bullet> name2) (p \<bullet> trm)" |
|
125 |
"p \<bullet> Baz name trm1 trm2 = Baz (p \<bullet> name) (p \<bullet> trm1) (p \<bullet> trm2)" |
|
126 |
"p \<bullet> As name1 name2 trm = As (p \<bullet> name1) (p \<bullet> name2) (p \<bullet> trm)" |
|
127 |
sorry |
|
128 |
||
129 |
||
130 |
(* |
|
131 |
ML {* |
|
132 |
val thms_p = map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms perm_defs} |
|
133 |
*} |
|
134 |
*) |
|
135 |
||
136 |
local_setup {* Local_Theory.note ((@{binding d1}, []), thms_d) #> snd *} |
|
137 |
local_setup {* Local_Theory.note ((@{binding i1}, []), thms_i) #> snd *} |
|
138 |
local_setup {* Local_Theory.note ((@{binding f1}, []), thms_f) #> snd *} |
|
139 |
||
140 |
thm perm_defs |
|
141 |
thm perm_simps |
|
142 |
||
143 |
instance trm :: pt sorry |
|
144 |
instance assg :: pt sorry |
|
145 |
||
146 |
lemma supp_fv: |
|
147 |
"supp t = fv_trm t" |
|
148 |
"supp b = fv_bn b" |
|
149 |
apply(induct t and b rule: i1) |
|
150 |
apply(simp_all add: f1) |
|
151 |
apply(simp_all add: supp_def) |
|
152 |
apply(simp add: supp_def permute_trm1 alpha1_INJ fv_trm1) |
|
153 |
apply(simp only: supp_at_base[simplified supp_def]) |
|
154 |
apply(simp add: supp_def permute_trm1 alpha1_INJ fv_trm1) |
|
155 |
apply(simp add: Collect_imp_eq Collect_neg_eq Un_commute) |
|
156 |
apply(subgoal_tac "supp (Lm1 name rtrm1) = supp (Abs {atom name} rtrm1)") |
|
157 |
apply(simp add: supp_Abs fv_trm1) |
|
158 |
apply(simp (no_asm) add: supp_def permute_set_eq atom_eqvt permute_trm1) |
|
159 |
apply(simp add: alpha1_INJ) |
|
160 |
apply(simp add: Abs_eq_iff) |
|
161 |
apply(simp add: alpha_gen.simps) |
|
162 |
apply(simp add: supp_eqvt[symmetric] fv_trm1_eqvt[symmetric]) |
|
163 |
apply(simp add: supp_fv_let fv_trm1 fv_eq_bv supp_Pair) |
|
164 |
apply blast |
|
165 |
apply(simp add: supp_def permute_trm1 alpha1_INJ fv_trm1) |
|
166 |
apply(simp add: supp_def permute_trm1 alpha1_INJ fv_trm1) |
|
167 |
apply(simp only: supp_at_base[simplified supp_def]) |
|
168 |
apply(simp (no_asm) only: supp_def permute_set_eq atom_eqvt permute_trm1 alpha1_INJ[simplified alpha_bp_eq]) |
|
169 |
apply(simp add: Collect_imp_eq Collect_neg_eq[symmetric]) |
|
170 |
apply(fold supp_def) |
|
171 |
apply simp |
|
172 |
done |
|
173 |
||
174 |
ML {* |
|
175 |
map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms eq_iff} |
|
176 |
*} |
|
177 |
||
178 |
||
179 |
||
2359 | 180 |
|
181 |
||
182 |
lemma "Var x \<noteq> App y1 y2" |
|
183 |
apply(descending) |
|
184 |
apply(simp add: trm_raw.distinct) |
|
185 |
||
186 |
||
187 |
||
188 |
ML {* |
|
189 |
map (lift_thm [@{typ trm}, @{typ assg}] @{context}) @{thms trm_raw.distinct(1)} |
|
190 |
*} |
|
191 |
||
192 |
||
193 |
||
2338 | 194 |
|
2336
f2d545b77b31
added definition of the quotient types
Christian Urban <urbanc@in.tum.de>
parents:
2330
diff
changeset
|
195 |
typ trm |
f2d545b77b31
added definition of the quotient types
Christian Urban <urbanc@in.tum.de>
parents:
2330
diff
changeset
|
196 |
typ assg |
f2d545b77b31
added definition of the quotient types
Christian Urban <urbanc@in.tum.de>
parents:
2330
diff
changeset
|
197 |
|
1911
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
198 |
thm trm_assg.fv |
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
199 |
thm trm_assg.supp |
2024
d974059827ad
Equivariance fails for single let?
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1911
diff
changeset
|
200 |
thm trm_assg.eq_iff |
1911
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
201 |
thm trm_assg.bn |
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
202 |
thm trm_assg.perm |
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
203 |
thm trm_assg.induct |
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
204 |
thm trm_assg.inducts |
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
205 |
thm trm_assg.distinct |
60b5c61d3de2
renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents:
1773
diff
changeset
|
206 |
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
|
207 |
|
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
|
208 |
(* TEMPORARY |
2024
d974059827ad
Equivariance fails for single let?
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1911
diff
changeset
|
209 |
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
|
210 |
*) |
2064
2725853f43b9
solved the problem with equivariance by first eta-normalising the goal
Christian Urban <urbanc@in.tum.de>
parents:
2028
diff
changeset
|
211 |
|
1596
c69d9fb16785
Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
212 |
end |
c69d9fb16785
Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
213 |
|
c69d9fb16785
Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
214 |
|
c69d9fb16785
Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
215 |