-
Notifications
You must be signed in to change notification settings - Fork 0
/
Weaken_Bisimulation.thy
243 lines (213 loc) · 11.1 KB
/
Weaken_Bisimulation.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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
(*
Title: Psi-calculi
Based on the AFP entry by Jesper Bengtson ([email protected]), 2012
*)
theory Weaken_Bisimulation
imports Weaken_Simulation Weaken_Stat_Imp
begin
context weak
begin
lemma weakenMonoCoinduct: "\<And>x y xa xb xc P Q \<Psi>.
x \<le> y \<Longrightarrow>
(\<Psi> \<rhd> Q \<leadsto>\<^sub>w<{(xc, xb, xa). x xc xb xa}> P) \<longrightarrow>
(\<Psi> \<rhd> Q \<leadsto>\<^sub>w<{(xb, xa, xc). y xb xa xc}> P)"
apply auto
apply(rule weakenSimMonotonic)
by(auto dest: le_funE)
lemma weakenMonoCoinduct2: "\<And>x y xa xb xc P Q \<Psi>.
x \<le> y \<Longrightarrow>
(\<Psi> \<rhd> Q \<lessapprox>\<^sub>w<{(xc, xb, xa). x xc xb xa}> P) \<longrightarrow>
(\<Psi> \<rhd> Q \<lessapprox>\<^sub>w<{(xb, xa, xc). y xb xa xc}> P)"
apply auto
apply(rule weakenStatImpMonotonic)
by(auto dest: le_funE)
coinductive_set weakenBisim :: "('b \<times> ('a, 'b, 'c) psi \<times> ('a, 'b, 'c) psi) set"
where
step: "\<lbrakk>\<Psi> \<rhd> P \<lessapprox>\<^sub>w<weakenBisim> Q; \<Psi> \<rhd> P \<leadsto>\<^sub>w<weakenBisim> Q;
\<forall>\<Psi>'. (\<Psi> \<otimes> \<Psi>', P, Q) \<in> weakenBisim; (\<Psi>, Q, P) \<in> weakenBisim\<rbrakk> \<Longrightarrow> (\<Psi>, P, Q) \<in> weakenBisim"
monos weakenMonoCoinduct weakenMonoCoinduct2
abbreviation
weakenBisimJudge ("_ \<rhd> _ \<approx>\<^sub>w _" [70, 70, 70] 65) where "\<Psi> \<rhd> P \<approx>\<^sub>w Q \<equiv> (\<Psi>, P, Q) \<in> weakenBisim"
abbreviation
weakenBisimNilJudge ("_ \<approx>\<^sub>w _" [70, 70] 65) where "P \<approx>\<^sub>w Q \<equiv> \<one> \<rhd> P \<approx>\<^sub>w Q"
lemma weakenBisimCoinductAux[consumes 1]:
fixes F :: 'b
and P :: "('a, 'b, 'c) psi"
and Q :: "('a, 'b, 'c) psi"
and X :: "('b \<times> ('a, 'b, 'c) psi \<times> ('a, 'b, 'c) psi) set"
assumes "(\<Psi>, P, Q) \<in> X"
and "\<And>\<Psi> P Q. (\<Psi>, P, Q) \<in> X \<Longrightarrow> (\<Psi> \<rhd> P \<lessapprox>\<^sub>w<(X \<union> weakenBisim)> Q) \<and>
(\<Psi> \<rhd> P \<leadsto>\<^sub>w<(X \<union> weakenBisim)> Q) \<and>
(\<forall>\<Psi>'. (\<Psi> \<otimes> \<Psi>', P, Q) \<in> X \<or> (\<Psi> \<otimes> \<Psi>', P, Q) \<in> weakenBisim) \<and>
((\<Psi>, Q, P) \<in> X \<or> (\<Psi>, Q, P) \<in> weakenBisim)"
shows "(\<Psi>, P, Q) \<in> weakenBisim"
proof -
have "X \<union> weakenBisim = {(\<Psi>, P, Q). (\<Psi>, P, Q) \<in> X \<or> (\<Psi>, P, Q) \<in> weakenBisim}" by auto
with assms show ?thesis
by coinduct (simp add: rtrancl_def)
qed
lemma weakenBisimCoinduct[consumes 1, case_names cStatImp cSim cExt cSym]:
fixes F :: 'b
and P :: "('a, 'b, 'c) psi"
and Q :: "('a, 'b, 'c) psi"
and X :: "('b \<times> ('a, 'b, 'c) psi \<times> ('a, 'b, 'c) psi) set"
assumes "(\<Psi>, P, Q) \<in> X"
and "\<And>\<Psi>' R S. (\<Psi>', R, S) \<in> X \<Longrightarrow> \<Psi>' \<rhd> R \<lessapprox>\<^sub>w<(X \<union> weakenBisim)> S"
and "\<And>\<Psi>' R S. (\<Psi>', R, S) \<in> X \<Longrightarrow> \<Psi>' \<rhd> R \<leadsto>\<^sub>w<(X \<union> weakenBisim)> S"
and "\<And>\<Psi>' R S \<Psi>''. (\<Psi>', R, S) \<in> X \<Longrightarrow> (\<Psi>' \<otimes> \<Psi>'', R, S) \<in> X \<or> \<Psi>' \<otimes> \<Psi>'' \<rhd> R \<approx>\<^sub>w S"
and "\<And>\<Psi>' R S. (\<Psi>', R, S) \<in> X \<Longrightarrow> (\<Psi>', S, R) \<in> X \<or> \<Psi>' \<rhd> S \<approx>\<^sub>w R"
shows "\<Psi> \<rhd> P \<approx>\<^sub>w Q"
proof -
have "X \<union> weakenBisim = {(\<Psi>, P, Q). (\<Psi>, P, Q) \<in> X \<or> (\<Psi>, P, Q) \<in> weakenBisim}" by auto
with assms show ?thesis
by coinduct (simp add: rtrancl_def)
qed
lemma weakenBisimWeakCoinductAux[consumes 1]:
fixes \<Psi> :: 'b
and P :: "('a, 'b, 'c) psi"
and Q :: "('a, 'b, 'c) psi"
and X :: "('b \<times> ('a, 'b, 'c) psi \<times> ('a, 'b, 'c) psi) set"
assumes "(\<Psi>, P, Q) \<in> X"
and "\<And>\<Psi> P Q. (\<Psi>, P, Q) \<in> X \<Longrightarrow> \<Psi> \<rhd> P \<lessapprox>\<^sub>w<X> Q \<and>
\<Psi> \<rhd> P \<leadsto>\<^sub>w<X> Q \<and> (\<forall>\<Psi>'. (\<Psi> \<otimes> \<Psi>', P, Q) \<in> X) \<and>
(\<Psi>, Q, P) \<in> X"
shows "\<Psi> \<rhd> P \<approx>\<^sub>w Q"
using assms
by(coinduct rule: weakenBisimCoinductAux) (blast intro: weakenSimMonotonic weakenStatImpMonotonic)
lemma weakenBisimE:
fixes P :: "('a, 'b, 'c) psi"
and Q :: "('a, 'b, 'c) psi"
and \<Psi> :: 'b
and \<Psi>' :: 'b
assumes "\<Psi> \<rhd> P \<approx>\<^sub>w Q"
shows "\<Psi> \<rhd> P \<lessapprox>\<^sub>w<weakenBisim> Q"
and "\<Psi> \<rhd> P \<leadsto>\<^sub>w<weakenBisim> Q"
and "\<Psi> \<otimes> \<Psi>' \<rhd> P \<approx>\<^sub>w Q"
and "\<Psi> \<rhd> Q \<approx>\<^sub>w P"
using assms
by(auto intro: weakenBisim.cases simp add: rtrancl_def)
lemma weakenBisimWeakCoinduct[consumes 1, case_names cStatImp cSim cExt cSym]:
fixes F :: 'b
and P :: "('a, 'b, 'c) psi"
and Q :: "('a, 'b, 'c) psi"
and X :: "('b \<times> ('a, 'b, 'c) psi \<times> ('a, 'b, 'c) psi) set"
assumes "(\<Psi>, P, Q) \<in> X"
and "\<And>\<Psi> P Q. (\<Psi>, P, Q) \<in> X \<Longrightarrow> \<Psi> \<rhd> P \<lessapprox>\<^sub>w<X> Q"
and "\<And>\<Psi> P Q. (\<Psi>, P, Q) \<in> X \<Longrightarrow> \<Psi> \<rhd> P \<leadsto>\<^sub>w<X> Q"
and "\<And>\<Psi> P Q \<Psi>'. (\<Psi>, P, Q) \<in> X \<Longrightarrow> (\<Psi> \<otimes> \<Psi>', P, Q) \<in> X"
and "\<And>\<Psi> P Q. (\<Psi>, P, Q) \<in> X \<Longrightarrow> (\<Psi>, Q, P) \<in> X"
shows "(\<Psi>, P, Q) \<in> weakenBisim"
proof -
have "X \<union> weakenBisim = {(\<Psi>, P, Q). (\<Psi>, P, Q) \<in> X \<or> (\<Psi>, P, Q) \<in> weakenBisim}" by auto
with assms show ?thesis
by(coinduct rule: weakenBisimWeakCoinductAux) blast
qed
lemma weakenBisimEqWeakBisim[simp]: "weakenBisim = weakBisim"
proof auto
fix \<Psi> P Q
assume "\<Psi> \<rhd> P \<approx>\<^sub>w Q" thus "\<Psi> \<rhd> P \<approx> Q"
proof(coinduct rule: weakBisimWeakCoinduct)
case(cStatImp \<Psi> P Q)
from `\<Psi> \<rhd> P \<approx>\<^sub>w Q` have "\<Psi> \<rhd> P \<lessapprox>\<^sub>w<weakenBisim> Q" by(rule weakenBisimE)
thus ?case using weakenBisimE(3) by(rule weakenStatImpWeakStatImp)
next
case(cSim \<Psi> P Q)
from `\<Psi> \<rhd> P \<approx>\<^sub>w Q` weakenBisimE
show ?case by(rule weakenSimWeakSim)
next
case(cExt \<Psi> P Q \<Psi>')
thus ?case by(rule weakenBisimE)
next
case(cSym \<Psi> P Q)
thus ?case by(rule weakenBisimE)
qed
next
fix \<Psi> P Q
assume "\<Psi> \<rhd> P \<approx> Q" thus "\<Psi> \<rhd> P \<approx>\<^sub>w Q"
proof(coinduct rule: weakenBisimWeakCoinduct)
case(cStatImp \<Psi> P Q)
from `\<Psi> \<rhd> P \<approx> Q` have "\<Psi> \<rhd> P \<lessapprox><weakBisim> Q" by(rule weakBisimE)
thus ?case using statEqWeakBisim by(rule weak_stat_impWeakenStatImp)
next
case(cSim \<Psi> P Q)
from `\<Psi> \<rhd> P \<approx> Q` have "\<Psi> \<rhd> P \<leadsto><weakBisim> Q" by(rule weakBisimE)
thus ?case using statEqWeakBisim by(rule weakSimWeakenSim)
next
case(cExt \<Psi> P Q \<Psi>')
thus ?case by(rule weakBisimE)
next
case(cSym \<Psi> P Q)
thus ?case by(rule weakBisimE)
qed
qed
lemma weakenTransitiveWeakCoinduct[case_names cStatImp cSim cExt cSym, case_conclusion bisim step, consumes 2]:
fixes \<Psi> :: 'b
and P :: "('a, 'b, 'c) psi"
and Q :: "('a, 'b, 'c) psi"
and X :: "('b \<times> ('a, 'b, 'c) psi \<times> ('a, 'b, 'c) psi) set"
assumes p: "(\<Psi>, P, Q) \<in> X"
and Eqvt: "eqvt X"
and rStatImp: "\<And>\<Psi> P Q. (\<Psi>, P, Q) \<in> X \<Longrightarrow> \<Psi> \<rhd> P \<lessapprox>\<^sub>w<X> Q"
and rSim: "\<And>\<Psi> P Q. (\<Psi>, P, Q) \<in> X \<Longrightarrow> \<Psi> \<rhd> P \<leadsto>\<^sub>w<({(\<Psi>, P, Q) | \<Psi> P Q. \<exists>P' Q'. \<Psi> \<rhd> P \<sim> P' \<and>
(\<Psi>, P', Q') \<in> X \<and>
\<Psi> \<rhd> Q' \<sim> Q})> Q"
and rExt: "\<And>\<Psi> P Q \<Psi>'. (\<Psi>, P, Q) \<in> X \<Longrightarrow> (\<Psi> \<otimes> \<Psi>', P, Q) \<in> X"
and rSym: "\<And>\<Psi> P Q. (\<Psi>, P, Q) \<in> X \<Longrightarrow> (\<Psi>, Q, P) \<in> X"
shows "\<Psi> \<rhd> P \<approx>\<^sub>w Q"
proof -
from p `eqvt X` have "\<Psi> \<rhd> P \<approx> Q"
proof(coinduct rule: weakTransitiveWeakCoinduct)
case(cStatImp \<Psi> P Q)
from `(\<Psi>, P, Q) \<in> X` have "\<Psi> \<rhd> P \<lessapprox>\<^sub>w<X> Q" by(rule rStatImp)
thus ?case using rExt by(rule weakenStatImpWeakStatImp)
next
case(cSim \<Psi> P Q)
let ?Y = "{(\<Psi>, P, Q) | \<Psi> P Q. \<exists>P' Q'. \<Psi> \<rhd> P \<sim> P' \<and> (\<Psi>, P', Q') \<in> X \<and> \<Psi> \<rhd> Q' \<sim> Q}"
note `(\<Psi>, P, Q) \<in> X`
moreover note rStatImp rSim
moreover have "\<And>\<Psi> P Q \<Psi>'. (\<Psi>, P, Q) \<in> ?Y \<Longrightarrow> (\<Psi> \<otimes> \<Psi>', P, Q) \<in> ?Y"
by(blast dest: bisimE rExt)
ultimately show ?case using rSym by(rule weakenSimWeakSim)
next
case(cExt \<Psi> P Q \<Psi>')
thus ?case by(rule rExt)
next
case(cSym \<Psi> P Q)
thus ?case by(rule rSym)
qed
thus ?thesis by(simp add: weakenBisimEqWeakBisim)
qed
lemma weakenTransitiveCoinduct[case_names cStatImp cSim cExt cSym, case_conclusion bisim step, consumes 2]:
fixes \<Psi> :: 'b
and P :: "('a, 'b, 'c) psi"
and Q :: "('a, 'b, 'c) psi"
and X :: "('b \<times> ('a, 'b, 'c) psi \<times> ('a, 'b, 'c) psi) set"
assumes p: "(\<Psi>, P, Q) \<in> X"
and Eqvt: "eqvt X"
and rStatImp: "\<And>\<Psi> P Q. (\<Psi>, P, Q) \<in> X \<Longrightarrow> \<Psi> \<rhd> P \<lessapprox>\<^sub>w<(X \<union> weakenBisim)> Q"
and rSim: "\<And>\<Psi> P Q. (\<Psi>, P, Q) \<in> X \<Longrightarrow> \<Psi> \<rhd> P \<leadsto>\<^sub>w<({(\<Psi>, P, Q) | \<Psi> P Q. \<exists>P' Q'. \<Psi> \<rhd> P \<sim> P' \<and>
(\<Psi>, P', Q') \<in> (X \<union> weakenBisim) \<and>
\<Psi> \<rhd> Q' \<sim> Q})> Q"
and rExt: "\<And>\<Psi> P Q \<Psi>'. (\<Psi>, P, Q) \<in> X \<Longrightarrow> (\<Psi> \<otimes> \<Psi>', P, Q) \<in> X \<union> weakenBisim"
and rSym: "\<And>\<Psi> P Q. (\<Psi>, P, Q) \<in> X \<Longrightarrow> (\<Psi>, Q, P) \<in> X \<union> weakenBisim"
shows "\<Psi> \<rhd> P \<approx>\<^sub>w Q"
proof -
from p have "(\<Psi>, P, Q) \<in> X \<union> weakenBisim" by auto
moreover from `eqvt X` have "eqvt(X \<union> weakenBisim)" by auto
ultimately show ?thesis
proof(coinduct rule: weakenTransitiveWeakCoinduct)
case(cStatImp \<Psi> P Q)
thus ?case by(fastforce intro: rStatImp weakenBisimE(1) weakenStatImpMonotonic)
next
case(cSim \<Psi> P Q)
thus ?case by(fastforce intro: rSim weakenBisimE(2) weakenSimMonotonic bisim_reflexive)
next
case(cExt \<Psi> P Q \<Psi>')
thus ?case by(blast dest: weakenBisimE rExt)
next
case(cSym \<Psi> P Q)
thus ?case by(blast dest: weakenBisimE rSym)
qed
qed
end
end