-
Notifications
You must be signed in to change notification settings - Fork 0
/
Weak_Cong_Simulation.thy
213 lines (176 loc) · 10.2 KB
/
Weak_Cong_Simulation.thy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
(*
Title: Psi-calculi
Based on the AFP entry by Jesper Bengtson ([email protected]), 2012
*)
theory Weak_Cong_Simulation
imports Weak_Simulation Tau_Chain
begin
context env begin
definition
"weakCongSimulation" :: "'b \<Rightarrow> ('a, 'b, 'c) psi \<Rightarrow>
('b \<times> ('a, 'b, 'c) psi \<times> ('a, 'b, 'c) psi) set \<Rightarrow>
('a, 'b, 'c) psi \<Rightarrow> bool" ("_ \<rhd> _ \<leadsto>\<guillemotleft>_\<guillemotright> _" [80, 80, 80, 80] 80)
where
"\<Psi> \<rhd> P \<leadsto>\<guillemotleft>Rel\<guillemotright> Q \<equiv> \<forall>Q'. \<Psi> \<rhd> Q \<longmapsto>None @ \<tau> \<prec> Q' \<longrightarrow> (\<exists>P'. \<Psi> \<rhd> P \<Longrightarrow>\<^sub>\<tau> P' \<and> (\<Psi>, P', Q') \<in> Rel)"
abbreviation
weakCongSimulationNilJudge ("_ \<leadsto>\<guillemotleft>_\<guillemotright> _" [80, 80, 80] 80) where "P \<leadsto>\<guillemotleft>Rel\<guillemotright> Q \<equiv> \<one> \<rhd> P \<leadsto>\<guillemotleft>Rel\<guillemotright> Q"
lemma weakCongSimI[case_names c_tau]:
fixes \<Psi> :: 'b
and P :: "('a, 'b, 'c) psi"
and Rel :: "('b \<times> ('a, 'b, 'c) psi \<times> ('a, 'b, 'c) psi) set"
and Q :: "('a, 'b, 'c) psi"
and C :: "'d::fs_name"
assumes rTau: "\<And>Q'. \<Psi> \<rhd> Q \<longmapsto>None @ \<tau> \<prec> Q' \<Longrightarrow> \<exists>P'. \<Psi> \<rhd> P \<Longrightarrow>\<^sub>\<tau> P' \<and> (\<Psi>, P', Q') \<in> Rel"
shows "\<Psi> \<rhd> P \<leadsto>\<guillemotleft>Rel\<guillemotright> Q"
using assms
by(auto simp add: weakCongSimulation_def)
lemma weakCongSimE:
fixes F :: 'b
and P :: "('a, 'b, 'c) psi"
and Rel :: "('b \<times> ('a, 'b, 'c) psi \<times> ('a, 'b, 'c) psi) set"
and Q :: "('a, 'b, 'c) psi"
assumes "\<Psi> \<rhd> P \<leadsto>\<guillemotleft>Rel\<guillemotright> Q"
and "\<Psi> \<rhd> Q \<longmapsto>None @ \<tau> \<prec> Q'"
obtains P' where "\<Psi> \<rhd> P \<Longrightarrow>\<^sub>\<tau> P'" and "(\<Psi>, P', Q') \<in> Rel"
using assms
by(auto simp add: weakCongSimulation_def)
lemma weakCongSimClosedAux:
fixes \<Psi> :: 'b
and P :: "('a, 'b, 'c) psi"
and Rel :: "('b \<times> ('a, 'b, 'c) psi \<times> ('a, 'b, 'c) psi) set"
and Q :: "('a, 'b, 'c) psi"
and p :: "name prm"
assumes EqvtRel: "eqvt Rel"
and PSimQ: "\<Psi> \<rhd> P \<leadsto>\<guillemotleft>Rel\<guillemotright> Q"
shows "(p \<bullet> \<Psi>) \<rhd> (p \<bullet> P) \<leadsto>\<guillemotleft>Rel\<guillemotright> (p \<bullet> Q)"
proof(induct rule: weakCongSimI)
case(c_tau Q')
from `p \<bullet> \<Psi> \<rhd> p \<bullet> Q \<longmapsto>None @ \<tau> \<prec> Q'`
have "(rev p \<bullet> p \<bullet> \<Psi>) \<rhd> (rev p \<bullet> p \<bullet> Q) \<longmapsto>(rev p\<bullet> None) @ (rev p \<bullet> (\<tau> \<prec> Q'))"
by(blast dest: semantics.eqvt)
hence "\<Psi> \<rhd> Q \<longmapsto>None @ \<tau> \<prec> (rev p \<bullet> Q')" by(simp add: eqvts)
with PSimQ obtain P' where PChain: "\<Psi> \<rhd> P \<Longrightarrow>\<^sub>\<tau> P'" and P'RelQ': "(\<Psi>, P', rev p \<bullet> Q') \<in> Rel"
by(blast dest: weakCongSimE)
from PChain have "(p \<bullet> \<Psi>) \<rhd> (p \<bullet> P) \<Longrightarrow>\<^sub>\<tau> (p \<bullet> P')" by(rule tau_step_chainEqvt)
moreover from P'RelQ' EqvtRel have "(p \<bullet> (\<Psi>, P', rev p \<bullet> Q')) \<in> Rel"
by(simp only: eqvt_def)
hence "(p \<bullet> \<Psi>, p \<bullet> P', Q') \<in> Rel" by(simp add: eqvts)
ultimately show ?case
by blast
qed
lemma weakCongSimClosed:
fixes \<Psi> :: 'b
and P :: "('a, 'b, 'c) psi"
and Rel :: "('b \<times> ('a, 'b, 'c) psi \<times> ('a, 'b, 'c) psi) set"
and Q :: "('a, 'b, 'c) psi"
and p :: "name prm"
assumes EqvtRel: "eqvt Rel"
shows "\<Psi> \<rhd> P \<leadsto>\<guillemotleft>Rel\<guillemotright> Q \<Longrightarrow> (p \<bullet> \<Psi>) \<rhd> (p \<bullet> P) \<leadsto>\<guillemotleft>Rel\<guillemotright> (p \<bullet> Q)"
and "P \<leadsto>\<guillemotleft>Rel\<guillemotright> Q \<Longrightarrow> (p \<bullet> P) \<leadsto>\<guillemotleft>Rel\<guillemotright> (p \<bullet> Q)"
using EqvtRel
by(force dest: weakCongSimClosedAux simp add: perm_bottom)+
lemma weakCongSimReflexive:
fixes Rel :: "('b \<times> ('a, 'b, 'c) psi \<times> ('a, 'b, 'c) psi) set"
and \<Psi> :: 'b
and P :: "('a, 'b, 'c) psi"
assumes "{(\<Psi>, P, P) | \<Psi> P. True} \<subseteq> Rel"
shows "\<Psi> \<rhd> P \<leadsto>\<guillemotleft>Rel\<guillemotright> P"
using assms
by(auto simp add: weakCongSimulation_def dest: rtrancl_into_rtrancl)
lemma weakStepSimTauChain:
fixes \<Psi> :: 'b
and Q :: "('a, 'b, 'c) psi"
and Q' :: "('a, 'b, 'c) psi"
and P :: "('a, 'b, 'c) psi"
and Rel :: "('b \<times> ('a, 'b, 'c) psi \<times> ('a, 'b, 'c) psi) set"
assumes "\<Psi> \<rhd> Q \<Longrightarrow>\<^sub>\<tau> Q'"
and "\<Psi> \<rhd> P \<leadsto>\<guillemotleft>Rel\<guillemotright> Q"
and Sim: "\<And>\<Psi> P Q. (\<Psi>, P, Q) \<in> Rel \<Longrightarrow> \<Psi> \<rhd> P \<leadsto><Rel> Q"
obtains P' where "\<Psi> \<rhd> P \<Longrightarrow>\<^sub>\<tau> P'" and "(\<Psi>, P', Q') \<in> Rel"
proof -
assume A: "\<And>P'. \<lbrakk>\<Psi> \<rhd> P \<Longrightarrow>\<^sub>\<tau> P'; (\<Psi>, P', Q') \<in> Rel\<rbrakk> \<Longrightarrow> thesis"
from `\<Psi> \<rhd> Q \<Longrightarrow>\<^sub>\<tau> Q'` `\<Psi> \<rhd> P \<leadsto>\<guillemotleft>Rel\<guillemotright> Q` A show ?thesis
proof(induct arbitrary: P thesis rule: tau_step_chain_induct)
case(tau_base Q Q' P)
with `\<Psi> \<rhd> P \<leadsto>\<guillemotleft>Rel\<guillemotright> Q` `\<Psi> \<rhd> Q \<longmapsto>None @ \<tau> \<prec> Q'` obtain P' where PChain: "\<Psi> \<rhd> P \<Longrightarrow>\<^sub>\<tau> P'" and P'RelQ': "(\<Psi>, P', Q') \<in> Rel"
by(rule_tac weakCongSimE)
thus ?case by(rule tau_base)
next
case(tau_step Q Q' Q'' P)
from `\<Psi> \<rhd> P \<leadsto>\<guillemotleft>Rel\<guillemotright> Q` obtain P' where PChain: "\<Psi> \<rhd> P \<Longrightarrow>\<^sub>\<tau> P'" and "(\<Psi>, P', Q') \<in> Rel"
by(rule tau_step)
from `(\<Psi>, P', Q') \<in> Rel` have "\<Psi> \<rhd> P' \<leadsto><Rel> Q'" by(rule Sim)
then obtain P'' where P'Chain: "\<Psi> \<rhd> P' \<Longrightarrow>\<^sup>^\<^sub>\<tau> P''" and "(\<Psi>, P'', Q'') \<in> Rel"
using `\<Psi> \<rhd> Q' \<longmapsto>None @ \<tau> \<prec> Q''` by(blast dest: weakSimE)
from PChain P'Chain have "\<Psi> \<rhd> P \<Longrightarrow>\<^sub>\<tau> P''" by simp
thus ?case using `(\<Psi>, P'', Q'') \<in> Rel` by(rule tau_step)
qed
qed
lemma weakCongSimTransitive:
fixes \<Psi> :: 'b
and P :: "('a, 'b, 'c) psi"
and Rel :: "('b \<times> ('a, 'b, 'c) psi \<times> ('a, 'b, 'c) psi) set"
and Q :: "('a, 'b, 'c) psi"
and Rel' :: "('b \<times> ('a, 'b, 'c) psi \<times> ('a, 'b, 'c) psi) set"
and T :: "('a, 'b, 'c) psi"
and Rel'' :: "('b \<times> ('a, 'b, 'c) psi \<times> ('a, 'b, 'c) psi) set"
assumes PRelQ: "(\<Psi>, P, Q) \<in> Rel"
and PSimQ: "\<Psi> \<rhd> P \<leadsto>\<guillemotleft>Rel\<guillemotright> Q"
and QSimR: "\<Psi> \<rhd> Q \<leadsto>\<guillemotleft>Rel'\<guillemotright> R"
and Set: "{(\<Psi>, P, R) | \<Psi> P R. \<exists>Q. (\<Psi>, P, Q) \<in> Rel \<and> (\<Psi>, Q, R) \<in> Rel'} \<subseteq> Rel''"
and Sim: "\<And>\<Psi> P Q. (\<Psi>, P, Q) \<in> Rel \<Longrightarrow> \<Psi> \<rhd> P \<leadsto><Rel> Q"
shows "\<Psi> \<rhd> P \<leadsto>\<guillemotleft>Rel''\<guillemotright> R"
proof(induct rule: weakCongSimI)
case(c_tau R')
from QSimR `\<Psi> \<rhd> R \<longmapsto>None @ \<tau> \<prec> R'` obtain Q' where QChain: "\<Psi> \<rhd> Q \<Longrightarrow>\<^sub>\<tau> Q'" and Q'RelR': "(\<Psi>, Q', R') \<in> Rel'"
by(blast dest: weakCongSimE)
from QChain PSimQ Sim obtain P' where PChain: "\<Psi> \<rhd> P \<Longrightarrow>\<^sub>\<tau> P'" and P'RelQ': "(\<Psi>, P', Q') \<in> Rel"
by(rule weakStepSimTauChain)
moreover from P'RelQ' Q'RelR' Set have "(\<Psi>, P', R') \<in> Rel''" by blast
ultimately show ?case by blast
qed
lemma weakCongSimStatEq:
fixes \<Psi> :: 'b
and P :: "('a, 'b, 'c) psi"
and Rel :: "('b \<times> ('a, 'b, 'c) psi \<times> ('a, 'b, 'c) psi) set"
and Q :: "('a, 'b, 'c) psi"
and \<Psi>' :: 'b
assumes PSimQ: "\<Psi> \<rhd> P \<leadsto>\<guillemotleft>Rel\<guillemotright> Q"
and "\<Psi> \<simeq> \<Psi>'"
and C1: "\<And>\<Psi> P Q \<Psi>'. \<lbrakk>(\<Psi>, P, Q) \<in> Rel; \<Psi> \<simeq> \<Psi>'\<rbrakk> \<Longrightarrow> (\<Psi>', P, Q) \<in> Rel'"
shows "\<Psi>' \<rhd> P \<leadsto>\<guillemotleft>Rel'\<guillemotright> Q"
proof(induct rule: weakCongSimI)
case(c_tau Q')
from `\<Psi>' \<rhd> Q \<longmapsto>None @ \<tau> \<prec> Q'` `\<Psi> \<simeq> \<Psi>'`
have "\<Psi> \<rhd> Q \<longmapsto>None @ \<tau> \<prec> Q'" by(metis stat_eq_transition Assertion_stat_eq_sym)
with PSimQ obtain P' where PChain: "\<Psi> \<rhd> P \<Longrightarrow>\<^sub>\<tau> P'" and P'RelQ': "(\<Psi>, P', Q') \<in> Rel"
by(blast dest: weakCongSimE)
from PChain `\<Psi> \<simeq> \<Psi>'` have "\<Psi>' \<rhd> P \<Longrightarrow>\<^sub>\<tau> P'" by(rule tau_step_chain_stat_eq)
moreover from `(\<Psi>, P', Q') \<in> Rel` `\<Psi> \<simeq> \<Psi>'` have "(\<Psi>', P', Q') \<in> Rel'"
by(rule C1)
ultimately show ?case by blast
qed
lemma weakCongSimMonotonic:
fixes \<Psi> :: 'b
and P :: "('a, 'b, 'c) psi"
and A :: "('b \<times> ('a, 'b, 'c) psi \<times> ('a, 'b, 'c) psi) set"
and Q :: "('a, 'b, 'c) psi"
and B :: "('b \<times> ('a, 'b, 'c) psi \<times> ('a, 'b, 'c) psi) set"
assumes "\<Psi> \<rhd> P \<leadsto>\<guillemotleft>A\<guillemotright> Q"
and "A \<subseteq> B"
shows "\<Psi> \<rhd> P \<leadsto>\<guillemotleft>B\<guillemotright> Q"
using assms
by(simp (no_asm) add: weakCongSimulation_def) (blast dest: weakCongSimE)+
lemma strongSimWeakCongSim:
fixes \<Psi> :: 'b
and P :: "('a, 'b, 'c) psi"
and Rel :: "('b \<times> ('a, 'b, 'c) psi \<times> ('a, 'b, 'c) psi) set"
and Q :: "('a, 'b, 'c) psi"
assumes "\<Psi> \<rhd> P \<leadsto>[Rel] Q"
and "Rel \<subseteq> Rel'"
shows "\<Psi> \<rhd> P \<leadsto>\<guillemotleft>Rel'\<guillemotright> Q"
using assms
apply(auto simp add: simulation_def weakCongSimulation_def)
by(erule_tac x=\<tau> in allE) (fastforce elim: tau_no_provenance')
end
end