author | Christian Urban <urbanc@in.tum.de> |
Tue, 07 Aug 2012 16:55:17 +0100 | |
changeset 3195 | deef21dc972f |
parent 3192 | 14c7d7e29c44 |
child 3197 | 25d11b449e92 |
permissions | -rw-r--r-- |
3097
b27e94db1b8a
included Pi theory in tests
Christian Urban <urbanc@in.tum.de>
parents:
3096
diff
changeset
|
1 |
(* Theory be Kirstin Peters *) |
3096 | 2 |
|
3097
b27e94db1b8a
included Pi theory in tests
Christian Urban <urbanc@in.tum.de>
parents:
3096
diff
changeset
|
3 |
theory Pi |
3096 | 4 |
imports "../Nominal2" |
5 |
begin |
|
6 |
||
7 |
atom_decl name |
|
8 |
||
9 |
subsection {* Capture-Avoiding Substitution of Names *} |
|
10 |
||
11 |
definition |
|
12 |
subst_name :: "name \<Rightarrow> name \<Rightarrow> name \<Rightarrow> name" ("_[_:::=_]" [110, 110, 110] 110) |
|
13 |
where |
|
14 |
"a[b:::=c] \<equiv> if (a = b) then c else a" |
|
15 |
||
16 |
declare subst_name_def[simp] |
|
17 |
||
18 |
lemma subst_name_mix_eqvt[eqvt]: |
|
19 |
fixes p :: perm |
|
20 |
and a :: name |
|
21 |
and b :: name |
|
22 |
and c :: name |
|
23 |
||
24 |
shows "p \<bullet> (a[b:::=c]) = (p \<bullet> a)[(p \<bullet> b):::=(p \<bullet> c)]" |
|
25 |
proof - |
|
26 |
show ?thesis |
|
27 |
by(auto) |
|
28 |
qed |
|
29 |
||
30 |
nominal_primrec |
|
31 |
subst_name_list :: "name \<Rightarrow> (name \<times> name) list \<Rightarrow> name" |
|
32 |
where |
|
33 |
"subst_name_list a [] = a" |
|
34 |
| "subst_name_list a ((b, c)#xs) = (if (a = b) then c else (subst_name_list a xs))" |
|
35 |
apply(auto) |
|
36 |
apply(subgoal_tac "\<And>p x r. subst_name_list_graph x r \<Longrightarrow> subst_name_list_graph (p \<bullet> x) (p \<bullet> r)") |
|
37 |
unfolding eqvt_def |
|
3183
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3097
diff
changeset
|
38 |
apply(simp only: permute_fun_def) |
3096 | 39 |
apply(rule allI) |
40 |
apply(rule ext) |
|
41 |
apply(rule ext) |
|
3183
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3097
diff
changeset
|
42 |
apply(simp only: permute_bool_def) |
3096 | 43 |
apply(rule iffI) |
44 |
apply(drule_tac x="p" in meta_spec) |
|
45 |
apply(drule_tac x="- p \<bullet> x" in meta_spec) |
|
46 |
apply(drule_tac x="- p \<bullet> xa" in meta_spec) |
|
47 |
apply(simp) |
|
48 |
apply(drule_tac x="-p" in meta_spec) |
|
49 |
apply(drule_tac x="x" in meta_spec) |
|
50 |
apply(drule_tac x="xa" in meta_spec) |
|
51 |
apply(simp) |
|
52 |
apply(erule subst_name_list_graph.induct) |
|
53 |
apply(perm_simp) |
|
54 |
apply(rule subst_name_list_graph.intros) |
|
55 |
apply(perm_simp) |
|
56 |
apply(rule subst_name_list_graph.intros) |
|
57 |
apply(simp) |
|
58 |
apply(rule_tac y="b" in list.exhaust) |
|
59 |
by(auto) |
|
60 |
||
61 |
termination (eqvt) |
|
3097
b27e94db1b8a
included Pi theory in tests
Christian Urban <urbanc@in.tum.de>
parents:
3096
diff
changeset
|
62 |
by (lexicographic_order) |
3096 | 63 |
|
64 |
||
65 |
section {* The Synchronous Pi-Calculus *} |
|
66 |
||
67 |
subsection {* Syntax: Synchronous, Monadic Pi-Calculus with n-ary, Mixed Choice *} |
|
68 |
||
69 |
nominal_datatype |
|
70 |
guardedTerm_mix = Output name name piMix ("_!<_>\<onesuperior>._" [120, 120, 110] 110) |
|
71 |
| Input name b::name P::piMix binds b in P ("_?<_>\<onesuperior>._" [120, 120, 110] 110) |
|
72 |
| Tau piMix ("<\<tau>\<onesuperior>>._" [110] 110) |
|
73 |
and sumList_mix = SumNil ("\<zero>\<onesuperior>") |
|
74 |
| AddSummand guardedTerm_mix sumList_mix (infixr "\<oplus>\<onesuperior>" 65) |
|
75 |
and piMix = Res a::name P::piMix binds a in P ("<\<nu>_>\<onesuperior>_" [100, 100] 100) |
|
76 |
| Par piMix piMix (infixr "\<parallel>\<onesuperior>" 85) |
|
77 |
| Match name name piMix ("[_\<frown>\<onesuperior>_]_" [120, 120, 110] 110) |
|
78 |
| Sum sumList_mix ("\<oplus>\<onesuperior>{_}" 90) |
|
79 |
| Rep name b::name P::piMix binds b in P ("\<infinity>_?<_>\<onesuperior>._" [120, 120, 110] 110) |
|
80 |
| Succ ("succ\<onesuperior>") |
|
81 |
||
82 |
lemmas piMix_strong_induct = guardedTerm_mix_sumList_mix_piMix.strong_induct |
|
83 |
lemmas piMix_fresh = guardedTerm_mix_sumList_mix_piMix.fresh |
|
84 |
lemmas piMix_eq_iff = guardedTerm_mix_sumList_mix_piMix.eq_iff |
|
85 |
lemmas piMix_distinct = guardedTerm_mix_sumList_mix_piMix.distinct |
|
86 |
lemmas piMix_size = guardedTerm_mix_sumList_mix_piMix.size |
|
87 |
||
88 |
subsection {* Alpha-Conversion Lemmata *} |
|
89 |
||
90 |
lemma alphaRes_mix: |
|
91 |
fixes a :: name |
|
92 |
and P :: piMix |
|
93 |
and z :: name |
|
94 |
||
95 |
assumes "atom z \<sharp> P" |
|
96 |
||
97 |
shows "<\<nu>a>\<onesuperior>P = <\<nu>z>\<onesuperior>((atom a \<rightleftharpoons> atom z) \<bullet> P)" |
|
98 |
proof(cases "a = z") |
|
99 |
assume "a = z" |
|
100 |
thus ?thesis |
|
101 |
by(simp) |
|
102 |
next |
|
103 |
assume "a \<noteq> z" |
|
104 |
thus ?thesis |
|
105 |
using assms |
|
3191
0440bc1a2438
streamlined definition of alpha-equivalence for single binders (used flip instead of swap)
Christian Urban <urbanc@in.tum.de>
parents:
3183
diff
changeset
|
106 |
by (simp add: flip_def piMix_eq_iff Abs1_eq_iff fresh_permute_left) |
3096 | 107 |
qed |
108 |
||
109 |
lemma alphaInput_mix: |
|
110 |
fixes a :: name |
|
111 |
and b :: name |
|
112 |
and P :: piMix |
|
113 |
and z :: name |
|
114 |
||
115 |
assumes "atom z \<sharp> P" |
|
116 |
||
117 |
shows "a?<b>\<onesuperior>.P = a?<z>\<onesuperior>.((atom b \<rightleftharpoons> atom z) \<bullet> P)" |
|
118 |
proof(cases "b = z") |
|
119 |
assume "b = z" |
|
120 |
thus ?thesis |
|
121 |
by(simp) |
|
122 |
next |
|
123 |
assume "b \<noteq> z" |
|
124 |
thus ?thesis |
|
125 |
using assms |
|
3191
0440bc1a2438
streamlined definition of alpha-equivalence for single binders (used flip instead of swap)
Christian Urban <urbanc@in.tum.de>
parents:
3183
diff
changeset
|
126 |
by(simp add: flip_def piMix_eq_iff Abs1_eq_iff fresh_permute_left) |
3096 | 127 |
qed |
128 |
||
129 |
lemma alphaRep_mix: |
|
130 |
fixes a :: name |
|
131 |
and b :: name |
|
132 |
and P :: piMix |
|
133 |
and z :: name |
|
134 |
||
135 |
assumes "atom z \<sharp> P" |
|
136 |
||
137 |
shows "\<infinity>a?<b>\<onesuperior>.P = \<infinity>a?<z>\<onesuperior>.((atom b \<rightleftharpoons> atom z) \<bullet> P)" |
|
138 |
proof(cases "b = z") |
|
139 |
assume "b = z" |
|
140 |
thus ?thesis |
|
141 |
by(simp) |
|
142 |
next |
|
143 |
assume "b \<noteq> z" |
|
144 |
thus ?thesis |
|
145 |
using assms |
|
3191
0440bc1a2438
streamlined definition of alpha-equivalence for single binders (used flip instead of swap)
Christian Urban <urbanc@in.tum.de>
parents:
3183
diff
changeset
|
146 |
by(simp add: flip_def piMix_eq_iff Abs1_eq_iff fresh_permute_left) |
3096 | 147 |
qed |
148 |
||
149 |
subsection {* Capture-Avoiding Substitution of Names *} |
|
150 |
||
151 |
lemma testl: |
|
152 |
assumes a: "\<exists>y. f = Inl y" |
|
153 |
shows "(p \<bullet> (Sum_Type.Projl f)) = Sum_Type.Projl (p \<bullet> f)" |
|
154 |
using a by auto |
|
155 |
||
156 |
lemma testrr: |
|
157 |
assumes a: "\<exists>y. f = Inr (Inr y)" |
|
158 |
shows "(p \<bullet> (Sum_Type.Projr (Sum_Type.Projr f))) = Sum_Type.Projr (Sum_Type.Projr (p \<bullet> f))" |
|
159 |
using a by auto |
|
160 |
||
161 |
lemma testlr: |
|
162 |
assumes a: "\<exists>y. f = Inr (Inl y)" |
|
163 |
shows "(p \<bullet> (Sum_Type.Projl (Sum_Type.Projr f))) = Sum_Type.Projl (Sum_Type.Projr (p \<bullet> f))" |
|
164 |
using a by auto |
|
165 |
||
166 |
nominal_primrec (default "sum_case (\<lambda>x. Inl undefined) (sum_case (\<lambda>x. Inr (Inl undefined)) (\<lambda>x. Inr (Inr undefined)))") |
|
167 |
subsGuard_mix :: "guardedTerm_mix \<Rightarrow> name \<Rightarrow> name \<Rightarrow> guardedTerm_mix" ("_[_::=\<onesuperior>\<onesuperior>_]" [100, 100, 100] 100) and |
|
168 |
subsList_mix :: "sumList_mix \<Rightarrow> name \<Rightarrow> name \<Rightarrow> sumList_mix" ("_[_::=\<onesuperior>\<twosuperior>_]" [100, 100, 100] 100) and |
|
169 |
subs_mix :: "piMix \<Rightarrow> name \<Rightarrow> name \<Rightarrow> piMix" ("_[_::=\<onesuperior>_]" [100, 100, 100] 100) |
|
170 |
where |
|
171 |
"(a!<b>\<onesuperior>.P)[x::=\<onesuperior>\<onesuperior>y] = (a[x:::=y])!<(b[x:::=y])>\<onesuperior>.(P[x::=\<onesuperior>y])" |
|
172 |
| "\<lbrakk>atom b \<sharp> (x, y)\<rbrakk> \<Longrightarrow> (a?<b>\<onesuperior>.P)[x::=\<onesuperior>\<onesuperior>y] = (a[x:::=y])?<b>\<onesuperior>.(P[x::=\<onesuperior>y])" |
|
173 |
| "(<\<tau>\<onesuperior>>.P)[x::=\<onesuperior>\<onesuperior>y] = <\<tau>\<onesuperior>>.(P[x::=\<onesuperior>y])" |
|
174 |
| "(\<zero>\<onesuperior>)[x::=\<onesuperior>\<twosuperior>y] = \<zero>\<onesuperior>" |
|
175 |
| "(g \<oplus>\<onesuperior> xg)[x::=\<onesuperior>\<twosuperior>y] = (g[x::=\<onesuperior>\<onesuperior>y]) \<oplus>\<onesuperior> (xg[x::=\<onesuperior>\<twosuperior>y])" |
|
176 |
| "\<lbrakk>atom a \<sharp> (x, y)\<rbrakk> \<Longrightarrow> (<\<nu>a>\<onesuperior>P)[x::=\<onesuperior>y] = <\<nu>a>\<onesuperior>(P[x::=\<onesuperior>y])" |
|
177 |
| "(P \<parallel>\<onesuperior> Q)[x::=\<onesuperior>y] = (P[x::=\<onesuperior>y]) \<parallel>\<onesuperior> (Q[x::=\<onesuperior>y])" |
|
178 |
| "([a\<frown>\<onesuperior>b]P)[x::=\<onesuperior>y] = ([(a[x:::=y])\<frown>\<onesuperior>(b[x:::=y])](P[x::=\<onesuperior>y]))" |
|
179 |
| "(\<oplus>\<onesuperior>{xg})[x::=\<onesuperior>y] = \<oplus>\<onesuperior>{(xg[x::=\<onesuperior>\<twosuperior>y])}" |
|
180 |
| "\<lbrakk>atom b \<sharp> (x, y)\<rbrakk> \<Longrightarrow> (\<infinity>a?<b>\<onesuperior>.P)[x::=\<onesuperior>y] = \<infinity>(a[x:::=y])?<b>\<onesuperior>.(P[x::=\<onesuperior>y])" |
|
181 |
| "(succ\<onesuperior>)[x::=\<onesuperior>y] = succ\<onesuperior>" |
|
3192
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
182 |
using [[simproc del: alpha_lst]] |
3096 | 183 |
apply(auto simp add: piMix_distinct piMix_eq_iff) |
184 |
apply(subgoal_tac "\<And>p x r. subsGuard_mix_subsList_mix_subs_mix_graph x r \<Longrightarrow> subsGuard_mix_subsList_mix_subs_mix_graph (p \<bullet> x) (p \<bullet> r)") |
|
185 |
unfolding eqvt_def |
|
186 |
apply(rule allI) |
|
3183
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3097
diff
changeset
|
187 |
apply(simp only: permute_fun_def) |
3096 | 188 |
apply(rule ext) |
189 |
apply(rule ext) |
|
3183
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3097
diff
changeset
|
190 |
apply(simp only: permute_bool_def) |
3096 | 191 |
apply(rule iffI) |
192 |
apply(drule_tac x="p" in meta_spec) |
|
193 |
apply(drule_tac x="- p \<bullet> x" in meta_spec) |
|
194 |
apply(drule_tac x="- p \<bullet> xa" in meta_spec) |
|
195 |
apply(simp) |
|
196 |
apply(drule_tac x="-p" in meta_spec) |
|
197 |
apply(drule_tac x="x" in meta_spec) |
|
198 |
apply(drule_tac x="xa" in meta_spec) |
|
199 |
apply(simp) |
|
200 |
--"Equivariance" |
|
201 |
apply(erule subsGuard_mix_subsList_mix_subs_mix_graph.induct) |
|
202 |
apply(simp (no_asm_use) only: eqvts) |
|
203 |
apply(subst testrr) |
|
204 |
apply(erule subsGuard_mix_subsList_mix_subs_mix_graph.cases) |
|
205 |
apply(blast)+ |
|
206 |
apply(rule subsGuard_mix_subsList_mix_subs_mix_graph.intros) |
|
207 |
apply(simp) |
|
208 |
apply(simp (no_asm_use) only: eqvts) |
|
209 |
apply(subst testrr) |
|
210 |
apply(erule subsGuard_mix_subsList_mix_subs_mix_graph.cases) |
|
211 |
apply(blast)+ |
|
212 |
apply(rule subsGuard_mix_subsList_mix_subs_mix_graph.intros) |
|
213 |
apply(simp only: atom_eqvt[symmetric] Pair_eqvt[symmetric] fresh_eqvt[symmetric] permute_bool_def) |
|
214 |
apply(simp) |
|
215 |
apply(simp (no_asm_use) only: eqvts) |
|
216 |
apply(subst testrr) |
|
217 |
apply(erule subsGuard_mix_subsList_mix_subs_mix_graph.cases) |
|
218 |
apply(blast)+ |
|
219 |
apply(rule subsGuard_mix_subsList_mix_subs_mix_graph.intros) |
|
220 |
apply(simp) |
|
221 |
apply(simp (no_asm_use) only: eqvts) |
|
222 |
apply(rule subsGuard_mix_subsList_mix_subs_mix_graph.intros) |
|
223 |
apply(simp (no_asm_use) only: eqvts) |
|
224 |
apply(subst testl) |
|
225 |
apply(erule subsGuard_mix_subsList_mix_subs_mix_graph.cases) |
|
226 |
apply(blast)+ |
|
227 |
apply(subst testlr) |
|
228 |
apply(rotate_tac 2) |
|
229 |
apply(erule subsGuard_mix_subsList_mix_subs_mix_graph.cases) |
|
230 |
apply(blast)+ |
|
231 |
apply(perm_simp) |
|
232 |
apply(rule subsGuard_mix_subsList_mix_subs_mix_graph.intros) |
|
233 |
apply(blast) |
|
234 |
apply(blast) |
|
235 |
apply(simp (no_asm_use) only: eqvts) |
|
236 |
apply(subst testrr) |
|
237 |
apply(erule subsGuard_mix_subsList_mix_subs_mix_graph.cases) |
|
238 |
apply(blast)+ |
|
239 |
apply(rule subsGuard_mix_subsList_mix_subs_mix_graph.intros) |
|
240 |
apply(simp only: atom_eqvt[symmetric] Pair_eqvt[symmetric] fresh_eqvt[symmetric] permute_bool_def) |
|
241 |
apply(simp) |
|
242 |
apply(simp (no_asm_use) only: eqvts) |
|
243 |
apply(subst testrr) |
|
244 |
apply(erule subsGuard_mix_subsList_mix_subs_mix_graph.cases) |
|
245 |
apply(blast)+ |
|
246 |
apply(subst testrr) |
|
247 |
apply(rotate_tac 2) |
|
248 |
apply(erule subsGuard_mix_subsList_mix_subs_mix_graph.cases) |
|
249 |
apply(blast)+ |
|
250 |
apply(perm_simp) |
|
251 |
apply(rule subsGuard_mix_subsList_mix_subs_mix_graph.intros) |
|
252 |
apply(blast) |
|
253 |
apply(blast) |
|
254 |
apply(simp (no_asm_use) only: eqvts) |
|
255 |
apply(subst testrr) |
|
256 |
apply(erule subsGuard_mix_subsList_mix_subs_mix_graph.cases) |
|
257 |
apply(blast)+ |
|
258 |
apply(rule subsGuard_mix_subsList_mix_subs_mix_graph.intros) |
|
259 |
apply(blast) |
|
260 |
apply(simp (no_asm_use) only: eqvts) |
|
261 |
apply(subst testlr) |
|
262 |
apply(erule subsGuard_mix_subsList_mix_subs_mix_graph.cases) |
|
263 |
apply(blast)+ |
|
264 |
apply(rule subsGuard_mix_subsList_mix_subs_mix_graph.intros) |
|
265 |
apply(blast) |
|
266 |
apply(simp (no_asm_use) only: eqvts) |
|
267 |
apply(subst testrr) |
|
268 |
apply(erule subsGuard_mix_subsList_mix_subs_mix_graph.cases) |
|
269 |
apply(blast)+ |
|
270 |
apply(rule subsGuard_mix_subsList_mix_subs_mix_graph.intros) |
|
271 |
apply(simp only: atom_eqvt[symmetric] Pair_eqvt[symmetric] fresh_eqvt[symmetric] permute_bool_def) |
|
272 |
apply(blast) |
|
273 |
apply(perm_simp) |
|
274 |
apply(rule subsGuard_mix_subsList_mix_subs_mix_graph.intros) |
|
275 |
--"Covered all cases" |
|
276 |
apply(case_tac x) |
|
277 |
apply(simp) |
|
278 |
apply(case_tac a) |
|
279 |
apply(simp) |
|
280 |
apply (rule_tac y="aa" and c="(b, c)" in guardedTerm_mix_sumList_mix_piMix.strong_exhaust(1)) |
|
281 |
apply(blast) |
|
282 |
apply(auto simp add: fresh_star_def)[1] |
|
283 |
apply(blast) |
|
284 |
apply(simp) |
|
285 |
apply(blast) |
|
286 |
apply(simp) |
|
287 |
apply(case_tac b) |
|
288 |
apply(simp) |
|
289 |
apply(case_tac a) |
|
290 |
apply(simp) |
|
291 |
apply (rule_tac ya="aa" in guardedTerm_mix_sumList_mix_piMix.strong_exhaust(2)) |
|
292 |
apply(blast) |
|
293 |
apply(blast) |
|
294 |
apply(simp) |
|
295 |
apply(case_tac ba) |
|
296 |
apply(simp) |
|
297 |
apply (rule_tac yb="a" and c="(bb,c)" in guardedTerm_mix_sumList_mix_piMix.strong_exhaust(3)) |
|
3192
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
298 |
using [[simproc del: alpha_lst]] |
3096 | 299 |
apply(auto simp add: fresh_star_def)[1] |
300 |
apply(blast) |
|
301 |
apply(blast) |
|
302 |
apply(blast) |
|
3192
14c7d7e29c44
added a simproc for alpha-equivalence to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
3191
diff
changeset
|
303 |
using [[simproc del: alpha_lst]] |
3096 | 304 |
apply(auto simp add: fresh_star_def)[1] |
305 |
apply(blast) |
|
306 |
apply(simp) |
|
307 |
apply(blast) |
|
308 |
--"compatibility" |
|
3183
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3097
diff
changeset
|
309 |
apply (simp only: meta_eq_to_obj_eq[OF subs_mix_def, symmetric, unfolded fun_eq_iff]) |
3096 | 310 |
apply (subgoal_tac "eqvt_at (\<lambda>(a, b, c). subs_mix a b c) (P, xa, ya)") |
311 |
apply (thin_tac "eqvt_at subsGuard_mix_subsList_mix_subs_mix_sumC (Inr (Inr (P, xa, ya)))") |
|
312 |
apply (thin_tac "eqvt_at subsGuard_mix_subsList_mix_subs_mix_sumC (Inr (Inr (Pa, xa, ya)))") |
|
313 |
prefer 2 |
|
3183
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3097
diff
changeset
|
314 |
apply (simp only: eqvt_at_def subs_mix_def) |
3096 | 315 |
apply rule |
3183
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3097
diff
changeset
|
316 |
apply(simp (no_asm)) |
3096 | 317 |
apply (subst testrr) |
318 |
apply (simp add: subsGuard_mix_subsList_mix_subs_mix_sumC_def) |
|
319 |
apply (simp add: THE_default_def) |
|
320 |
apply (case_tac "Ex1 (subsGuard_mix_subsList_mix_subs_mix_graph (Inr (Inr (P, xa, ya))))") |
|
321 |
apply simp_all[2] |
|
322 |
apply auto[1] |
|
323 |
apply (erule_tac x="x" in allE) |
|
324 |
apply simp |
|
325 |
apply (thin_tac "\<forall>p\<Colon>perm. |
|
326 |
p \<bullet> The (subsGuard_mix_subsList_mix_subs_mix_graph (Inr (Inr (P, xa, ya)))) = |
|
327 |
(if \<exists>!x\<Colon>guardedTerm_mix + sumList_mix + piMix. |
|
328 |
subsGuard_mix_subsList_mix_subs_mix_graph (Inr (Inr (p \<bullet> P, p \<bullet> xa, p \<bullet> ya))) x |
|
329 |
then THE x\<Colon>guardedTerm_mix + sumList_mix + piMix. |
|
330 |
subsGuard_mix_subsList_mix_subs_mix_graph (Inr (Inr (p \<bullet> P, p \<bullet> xa, p \<bullet> ya))) x |
|
331 |
else Inr (Inr undefined))") |
|
332 |
apply (thin_tac "\<forall>p\<Colon>perm. |
|
333 |
p \<bullet> (if \<exists>!x\<Colon>guardedTerm_mix + sumList_mix + piMix. |
|
334 |
subsGuard_mix_subsList_mix_subs_mix_graph (Inr (Inr (Pa, xa, ya))) x |
|
335 |
then THE x\<Colon>guardedTerm_mix + sumList_mix + piMix. |
|
336 |
subsGuard_mix_subsList_mix_subs_mix_graph (Inr (Inr (Pa, xa, ya))) x |
|
337 |
else Inr (Inr undefined)) = |
|
338 |
(if \<exists>!x\<Colon>guardedTerm_mix + sumList_mix + piMix. |
|
339 |
subsGuard_mix_subsList_mix_subs_mix_graph (Inr (Inr (p \<bullet> Pa, p \<bullet> xa, p \<bullet> ya))) x |
|
340 |
then THE x\<Colon>guardedTerm_mix + sumList_mix + piMix. |
|
341 |
subsGuard_mix_subsList_mix_subs_mix_graph (Inr (Inr (p \<bullet> Pa, p \<bullet> xa, p \<bullet> ya))) x |
|
342 |
else Inr (Inr undefined))") |
|
343 |
apply (thin_tac "atom b \<sharp> (xa, ya)") |
|
344 |
apply (thin_tac "atom ba \<sharp> (xa, ya)") |
|
345 |
apply (thin_tac "[[atom b]]lst. P = [[atom ba]]lst. Pa") |
|
346 |
apply(cases rule: subsGuard_mix_subsList_mix_subs_mix_graph.cases) |
|
347 |
apply assumption |
|
348 |
apply (metis Inr_not_Inl) |
|
349 |
apply (metis Inr_not_Inl) |
|
350 |
apply (metis Inr_not_Inl) |
|
351 |
apply (metis Inr_inject Inr_not_Inl) |
|
352 |
apply (metis Inr_inject Inr_not_Inl) |
|
353 |
apply (rule_tac x="<\<nu>a>\<onesuperior>Sum_Type.Projr |
|
354 |
(Sum_Type.Projr |
|
355 |
(subsGuard_mix_subsList_mix_subs_mix_sum (Inr (Inr (Pb, xb, y)))))" in exI) |
|
356 |
apply clarify |
|
357 |
apply (rule the1_equality) |
|
358 |
apply blast apply assumption |
|
359 |
apply (rule_tac x="Sum_Type.Projr |
|
360 |
(Sum_Type.Projr (subsGuard_mix_subsList_mix_subs_mix_sum (Inr (Inr (Pb, xb, y))))) \<parallel>\<onesuperior> |
|
361 |
Sum_Type.Projr |
|
362 |
(Sum_Type.Projr (subsGuard_mix_subsList_mix_subs_mix_sum (Inr (Inr (Q, xb, y)))))" in exI) |
|
363 |
apply clarify |
|
364 |
apply (rule the1_equality) |
|
365 |
apply blast apply assumption |
|
366 |
apply (rule_tac x="[(a[xb:::=y])\<frown>\<onesuperior>(bb[xb:::=y])]Sum_Type.Projr |
|
367 |
(Sum_Type.Projr |
|
368 |
(subsGuard_mix_subsList_mix_subs_mix_sum (Inr (Inr (Pb, xb, y)))))" in exI) |
|
369 |
apply clarify |
|
370 |
apply (rule the1_equality) |
|
371 |
apply blast apply assumption |
|
372 |
apply (rule_tac x="\<oplus>\<onesuperior>{Sum_Type.Projl |
|
373 |
(Sum_Type.Projr |
|
374 |
(subsGuard_mix_subsList_mix_subs_mix_sum (Inr (Inl (xg, xb, y)))))}" in exI) |
|
375 |
apply clarify |
|
376 |
apply (rule the1_equality) |
|
377 |
apply blast apply assumption |
|
378 |
apply (rule_tac x="\<infinity>(a[xb:::=y])?<bb>\<onesuperior>.Sum_Type.Projr |
|
379 |
(Sum_Type.Projr |
|
380 |
(subsGuard_mix_subsList_mix_subs_mix_sum |
|
381 |
(Inr (Inr (Pb, xb, y)))))" in exI) |
|
382 |
apply clarify |
|
383 |
apply (rule the1_equality) |
|
384 |
apply blast apply assumption |
|
385 |
apply (rule_tac x="succ\<onesuperior>" in exI) |
|
386 |
apply clarify |
|
387 |
apply (rule the1_equality) |
|
388 |
apply blast apply assumption |
|
389 |
apply simp |
|
390 |
(* Here the only real goal compatibility is left *) |
|
391 |
apply (erule Abs_lst1_fcb) |
|
392 |
apply (simp_all add: Abs_fresh_iff fresh_fun_eqvt_app) |
|
393 |
apply (subgoal_tac "atom ba \<sharp> (\<lambda>(a, x, y). subs_mix a x y) (P, xa, ya)") |
|
394 |
apply simp |
|
395 |
apply (erule fresh_eqvt_at) |
|
3183
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3097
diff
changeset
|
396 |
apply(simp add: finite_supp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3097
diff
changeset
|
397 |
apply(simp) |
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3097
diff
changeset
|
398 |
apply(simp add: eqvt_at_def) |
3191
0440bc1a2438
streamlined definition of alpha-equivalence for single binders (used flip instead of swap)
Christian Urban <urbanc@in.tum.de>
parents:
3183
diff
changeset
|
399 |
apply(drule_tac x="(b \<leftrightarrow> ba)" in spec) |
3183
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3097
diff
changeset
|
400 |
apply(simp) |
3096 | 401 |
done |
402 |
||
403 |
termination (eqvt) |
|
3097
b27e94db1b8a
included Pi theory in tests
Christian Urban <urbanc@in.tum.de>
parents:
3096
diff
changeset
|
404 |
by (lexicographic_order) |
3096 | 405 |
|
406 |
lemma forget_mix: |
|
407 |
fixes g :: guardedTerm_mix |
|
408 |
and xg :: sumList_mix |
|
409 |
and P :: piMix |
|
410 |
and x :: name |
|
411 |
and y :: name |
|
412 |
||
413 |
shows "atom x \<sharp> g \<longrightarrow> g[x::=\<onesuperior>\<onesuperior>y] = g" |
|
414 |
and "atom x \<sharp> xg \<longrightarrow> xg[x::=\<onesuperior>\<twosuperior>y] = xg" |
|
415 |
and "atom x \<sharp> P \<longrightarrow> P[x::=\<onesuperior>y] = P" |
|
416 |
proof - |
|
417 |
show "atom x \<sharp> g \<longrightarrow> g[x::=\<onesuperior>\<onesuperior>y] = g" |
|
418 |
and "atom x \<sharp> xg \<longrightarrow> xg[x::=\<onesuperior>\<twosuperior>y] = xg" |
|
419 |
and "atom x \<sharp> P \<longrightarrow> P[x::=\<onesuperior>y] = P" |
|
420 |
using assms |
|
421 |
apply(nominal_induct g and xg and P avoiding: x y rule: piMix_strong_induct) |
|
422 |
by(auto simp add: piMix_eq_iff piMix_fresh fresh_at_base) |
|
423 |
qed |
|
424 |
||
425 |
lemma fresh_fact_mix: |
|
426 |
fixes g :: guardedTerm_mix |
|
427 |
and xg :: sumList_mix |
|
428 |
and P :: piMix |
|
429 |
and x :: name |
|
430 |
and y :: name |
|
431 |
and z :: name |
|
432 |
||
433 |
assumes "atom z \<sharp> y" |
|
434 |
||
435 |
shows "(z = x \<or> atom z \<sharp> g) \<longrightarrow> atom z \<sharp> g[x::=\<onesuperior>\<onesuperior>y]" |
|
436 |
and "(z = x \<or> atom z \<sharp> xg) \<longrightarrow> atom z \<sharp> xg[x::=\<onesuperior>\<twosuperior>y]" |
|
437 |
and "(z = x \<or> atom z \<sharp> P) \<longrightarrow> atom z \<sharp> P[x::=\<onesuperior>y]" |
|
438 |
proof - |
|
439 |
show "(z = x \<or> atom z \<sharp> g) \<longrightarrow> atom z \<sharp> g[x::=\<onesuperior>\<onesuperior>y]" |
|
440 |
and "(z = x \<or> atom z \<sharp> xg) \<longrightarrow> atom z \<sharp> xg[x::=\<onesuperior>\<twosuperior>y]" |
|
441 |
and "(z = x \<or> atom z \<sharp> P) \<longrightarrow> atom z \<sharp> P[x::=\<onesuperior>y]" |
|
442 |
using assms |
|
443 |
apply(nominal_induct g and xg and P avoiding: x y z rule: piMix_strong_induct) |
|
444 |
by(auto simp add: piMix_fresh fresh_at_base) |
|
445 |
qed |
|
446 |
||
447 |
lemma substitution_lemma_mix: |
|
448 |
fixes g :: guardedTerm_mix |
|
449 |
and xg :: sumList_mix |
|
450 |
and P :: piMix |
|
451 |
and s :: name |
|
452 |
and u :: name |
|
453 |
and x :: name |
|
454 |
and y :: name |
|
455 |
||
456 |
assumes "x \<noteq> y" |
|
457 |
and "atom x \<sharp> u" |
|
458 |
||
459 |
shows "g[x::=\<onesuperior>\<onesuperior>s][y::=\<onesuperior>\<onesuperior>u] = g[y::=\<onesuperior>\<onesuperior>u][x::=\<onesuperior>\<onesuperior>s[y:::=u]]" |
|
460 |
and "xg[x::=\<onesuperior>\<twosuperior>s][y::=\<onesuperior>\<twosuperior>u] = xg[y::=\<onesuperior>\<twosuperior>u][x::=\<onesuperior>\<twosuperior>s[y:::=u]]" |
|
461 |
and "P[x::=\<onesuperior>s][y::=\<onesuperior>u] = P[y::=\<onesuperior>u][x::=\<onesuperior>s[y:::=u]]" |
|
462 |
proof - |
|
463 |
show "g[x::=\<onesuperior>\<onesuperior>s][y::=\<onesuperior>\<onesuperior>u] = g[y::=\<onesuperior>\<onesuperior>u][x::=\<onesuperior>\<onesuperior>s[y:::=u]]" |
|
464 |
and "xg[x::=\<onesuperior>\<twosuperior>s][y::=\<onesuperior>\<twosuperior>u] = xg[y::=\<onesuperior>\<twosuperior>u][x::=\<onesuperior>\<twosuperior>s[y:::=u]]" |
|
465 |
and "P[x::=\<onesuperior>s][y::=\<onesuperior>u] = P[y::=\<onesuperior>u][x::=\<onesuperior>s[y:::=u]]" |
|
466 |
using assms |
|
467 |
apply(nominal_induct g and xg and P avoiding: x y s u rule: piMix_strong_induct) |
|
468 |
apply(simp_all add: fresh_fact_mix forget_mix) |
|
469 |
by(auto simp add: fresh_at_base) |
|
470 |
qed |
|
471 |
||
472 |
lemma perm_eq_subst_mix: |
|
473 |
fixes g :: guardedTerm_mix |
|
474 |
and xg :: sumList_mix |
|
475 |
and P :: piMix |
|
476 |
and x :: name |
|
477 |
and y :: name |
|
478 |
||
479 |
shows "atom y \<sharp> g \<longrightarrow> (atom x \<rightleftharpoons> atom y) \<bullet> g = g[x::=\<onesuperior>\<onesuperior>y]" |
|
480 |
and "atom y \<sharp> xg \<longrightarrow> (atom x \<rightleftharpoons> atom y) \<bullet> xg = xg[x::=\<onesuperior>\<twosuperior>y]" |
|
481 |
and "atom y \<sharp> P \<longrightarrow> (atom x \<rightleftharpoons> atom y) \<bullet> P = P[x::=\<onesuperior>y]" |
|
482 |
proof - |
|
483 |
show "atom y \<sharp> g \<longrightarrow> (atom x \<rightleftharpoons> atom y) \<bullet> g = g[x::=\<onesuperior>\<onesuperior>y]" |
|
484 |
and "atom y \<sharp> xg \<longrightarrow> (atom x \<rightleftharpoons> atom y) \<bullet> xg = xg[x::=\<onesuperior>\<twosuperior>y]" |
|
485 |
and "atom y \<sharp> P \<longrightarrow> (atom x \<rightleftharpoons> atom y) \<bullet> P = P[x::=\<onesuperior>y]" |
|
486 |
apply(nominal_induct g and xg and P avoiding: x y rule: piMix_strong_induct) |
|
487 |
by(auto simp add: piMix_fresh fresh_at_base) |
|
488 |
qed |
|
489 |
||
490 |
lemma subst_id_mix: |
|
491 |
fixes g :: guardedTerm_mix |
|
492 |
and xg :: sumList_mix |
|
493 |
and P :: piMix |
|
494 |
and x :: name |
|
495 |
||
496 |
shows "g[x::=\<onesuperior>\<onesuperior>x] = g" and "xg[x::=\<onesuperior>\<twosuperior>x] = xg" and "P[x::=\<onesuperior>x] = P" |
|
497 |
proof - |
|
498 |
show "g[x::=\<onesuperior>\<onesuperior>x] = g" and "xg[x::=\<onesuperior>\<twosuperior>x] = xg" and "P[x::=\<onesuperior>x] = P" |
|
499 |
apply(nominal_induct g and xg and P avoiding: x rule: piMix_strong_induct) |
|
500 |
by(auto) |
|
501 |
qed |
|
502 |
||
503 |
lemma alphaRes_subst_mix: |
|
504 |
fixes a :: name |
|
505 |
and P :: piMix |
|
506 |
and z :: name |
|
507 |
||
508 |
assumes "atom z \<sharp> P" |
|
509 |
||
510 |
shows "<\<nu>a>\<onesuperior>P = <\<nu>z>\<onesuperior>(P[a::=\<onesuperior>z])" |
|
511 |
proof(cases "a = z") |
|
512 |
assume "a = z" |
|
513 |
thus ?thesis |
|
514 |
by(simp add: subst_id_mix) |
|
515 |
next |
|
516 |
assume "a \<noteq> z" |
|
517 |
thus ?thesis |
|
518 |
using assms |
|
519 |
by(simp add: alphaRes_mix perm_eq_subst_mix) |
|
520 |
qed |
|
521 |
||
522 |
lemma alphaInput_subst_mix: |
|
523 |
fixes a :: name |
|
524 |
and b :: name |
|
525 |
and P :: piMix |
|
526 |
and z :: name |
|
527 |
||
528 |
assumes "atom z \<sharp> P" |
|
529 |
||
530 |
shows "a?<b>\<onesuperior>.P = a?<z>\<onesuperior>.(P[b::=\<onesuperior>z])" |
|
531 |
proof(cases "b = z") |
|
532 |
assume "b = z" |
|
533 |
thus ?thesis |
|
534 |
by(simp add: subst_id_mix) |
|
535 |
next |
|
536 |
assume "b \<noteq> z" |
|
537 |
thus ?thesis |
|
538 |
using assms |
|
539 |
by(simp add: alphaInput_mix perm_eq_subst_mix) |
|
540 |
qed |
|
541 |
||
542 |
lemma alphaRep_subst_mix: |
|
543 |
fixes a :: name |
|
544 |
and b :: name |
|
545 |
and P :: piMix |
|
546 |
and z :: name |
|
547 |
||
548 |
assumes "atom z \<sharp> P" |
|
549 |
||
550 |
shows "\<infinity>a?<b>\<onesuperior>.P = \<infinity>a?<z>\<onesuperior>.(P[b::=\<onesuperior>z])" |
|
551 |
proof(cases "b = z") |
|
552 |
assume "b = z" |
|
553 |
thus ?thesis |
|
554 |
by(simp add: subst_id_mix) |
|
555 |
next |
|
556 |
assume "b \<noteq> z" |
|
557 |
thus ?thesis |
|
558 |
using assms |
|
559 |
by(simp add: alphaRep_mix perm_eq_subst_mix) |
|
560 |
qed |
|
561 |
||
562 |
inductive |
|
563 |
fresh_list_guard_mix :: "name list \<Rightarrow> guardedTerm_mix \<Rightarrow> bool" |
|
564 |
where |
|
565 |
"fresh_list_guard_mix [] g" |
|
566 |
| "\<lbrakk>atom n \<sharp> g; fresh_list_guard_mix xn g\<rbrakk> \<Longrightarrow> fresh_list_guard_mix (n#xn) g" |
|
567 |
||
568 |
equivariance fresh_list_guard_mix |
|
569 |
nominal_inductive fresh_list_guard_mix |
|
570 |
done |
|
571 |
||
572 |
inductive |
|
573 |
fresh_list_sumList_mix :: "name list \<Rightarrow> sumList_mix \<Rightarrow> bool" |
|
574 |
where |
|
575 |
"fresh_list_sumList_mix [] xg" |
|
576 |
| "\<lbrakk>atom n \<sharp> xg; fresh_list_sumList_mix xn xg\<rbrakk> \<Longrightarrow> fresh_list_sumList_mix (n#xn) xg" |
|
577 |
||
578 |
equivariance fresh_list_sumList_mix |
|
579 |
nominal_inductive fresh_list_sumList_mix |
|
580 |
done |
|
581 |
||
582 |
inductive |
|
583 |
fresh_list_mix :: "name list \<Rightarrow> piMix \<Rightarrow> bool" |
|
584 |
where |
|
585 |
"fresh_list_mix [] P" |
|
586 |
| "\<lbrakk>atom n \<sharp> P; fresh_list_mix xn P\<rbrakk> \<Longrightarrow> fresh_list_mix (n#xn) P" |
|
587 |
||
588 |
equivariance fresh_list_mix |
|
589 |
nominal_inductive fresh_list_mix |
|
590 |
done |
|
591 |
||
592 |
end |