@@ -138,52 +138,83 @@ definition chan_names :: "'a itself \<Rightarrow> String.literal list" where
138
138
lemma distinct_chan_names [ simp ]: "distinct (chan_names TYPE('a))"
139
139
using chan_names_def local.wf_chantyperep wf_chantyperep_def by auto
140
140
141
- definition chanrep_of :: "'a \<Rightarrow> 'a chanrep" where
142
- "chanrep_of e = the (find_chanrep CHANTYPEREP('a) e)"
141
+ definition ev_chanrep :: "'a \<Rightarrow> 'a chanrep" where
142
+ "ev_chanrep e = the (find_chanrep CHANTYPEREP('a) e)"
143
143
144
- lemma range_chanrep_of : "range chanrep_of = set CHANTYPEREP('a)"
145
- apply ( auto simp add : chanrep_of_def image_def )
144
+ lemma range_ev_chanrep : "range ev_chanrep = set CHANTYPEREP('a)"
145
+ apply ( auto simp add : ev_chanrep_def image_def )
146
146
apply ( metis find_chanrep_Some local.wf_chantyperep option.sel )
147
147
apply ( metis find_Some_iff find_chanrep_Some find_chanrep_def local.wf_chantyperep option.sel wf_chantyperep_def )
148
148
done
149
149
150
- lemma finite_chanreps : "finite (range chanrep_of)"
151
- using range_chanrep_of by auto
150
+ lemma finite_chanreps : "finite (range ev_chanrep)"
151
+ using range_ev_chanrep by auto
152
+
153
+ definition ev_set_of :: "'a \<Rightarrow> 'a set" where
154
+ "ev_set_of e = Collect (is_chan (ev_chanrep e))"
152
155
153
156
text \<open> An independent family of events, each corresponding to one set of channels. \<close>
154
157
155
158
definition ChanBasis :: "'a set set" where
156
- "ChanBasis = evs_of ` range chanrep_of "
159
+ "ChanBasis = evs_of ` range ev_chanrep "
157
160
158
161
lemma family_chan_basis : "\<Union> ChanBasis = UNIV"
159
162
apply ( auto simp add : ChanBasis_def evs_of_def )
160
- apply ( metis chantyperep_ev_has_chan image_iff local.wf_chantyperep range_chanrep_of )
163
+ apply ( metis chantyperep_ev_has_chan image_iff local.wf_chantyperep range_ev_chanrep )
161
164
done
162
165
163
166
lemma indep_chan_basis : "\<lbrakk> A \<in> ChanBasis; B \<in> ChanBasis; A \<noteq> B \<rbrakk> \<Longrightarrow> A \<inter> B = {}"
164
167
apply ( auto simp add : ChanBasis_def evs_of_def )
165
- apply ( metis local.wf_chantyperep rangeI range_chanrep_of wf_chantyperep_def )+
168
+ apply ( metis local.wf_chantyperep rangeI range_ev_chanrep wf_chantyperep_def )+
166
169
done
167
170
168
171
end
169
172
170
173
subsection \<open> Prisms with a Channel Representation \<close>
171
174
172
- definition prism_chanrep :: "('a \<Longrightarrow>\<^sub>\<triangle> 'e::chantyperep) \<Rightarrow> 'e chanrep" where
173
- "prism_chanrep c = (SOME d. d \<in> set CHANTYPEREP('e) \<and> evs_of d = dom (match\<^bsub>c\<^esub>))"
175
+ definition has_chanrep :: "('a \<Longrightarrow>\<^sub>\<triangle> 'e::chantyperep) \<Rightarrow> bool" where
176
+ "has_chanrep c = (\<exists> d. d \<in> set CHANTYPEREP('e) \<and> evs_of d = dom (match\<^bsub>c\<^esub>))"
177
+
178
+ definition chanrep_of :: "('a \<Longrightarrow>\<^sub>\<triangle> 'e::chantyperep) \<Rightarrow> 'e chanrep" where
179
+ "chanrep_of c = (SOME d. d \<in> set CHANTYPEREP('e) \<and> evs_of d = dom (match\<^bsub>c\<^esub>))"
174
180
175
- lemma prism_chanrep_eqI :
181
+ lemma chanrep_of_eqI :
176
182
fixes c :: "'a \<Longrightarrow>\<^sub>\<triangle> 'e::chantyperep" and d :: "'e chanrep"
177
183
assumes "wb_prism c" "d \<in> set CHANTYPEREP('e)" "dom match\<^bsub>c\<^esub> = evs_of d"
178
- shows "prism_chanrep c = d"
184
+ shows "chanrep_of c = d"
179
185
using assms
180
- apply ( simp add : prism_chanrep_def )
186
+ apply ( simp add : chanrep_of_def )
181
187
apply ( rule some_equality )
182
188
apply simp
183
189
using evs_of_inj wf_chantyperep apply blast
184
190
done
185
191
186
- method prism_chanrep = ( rule prism_chanrep_eqI , simp , simp add : chantyperep_defs , simp add : chan_defs )
192
+ lemma ev_chanrep_build [ simp ]:
193
+ fixes c :: "'a \<Longrightarrow>\<^sub>\<triangle> 'e::chantyperep"
194
+ assumes "wb_prism c" "has_chanrep c"
195
+ shows "ev_chanrep (build\<^bsub>c\<^esub> v) = chanrep_of c"
196
+ proof -
197
+ obtain d where d : "d \<in> set CHANTYPEREP('e)" "evs_of d = dom (match\<^bsub>c\<^esub>)"
198
+ by ( meson assms has_chanrep_def )
199
+ hence chanrep_c : "chanrep_of c = d"
200
+ by ( metis ( mono_tags , lifting ) chanrep_of_def evs_of_inj someI_ex wf_chantyperep )
201
+ have "is_chan d (build\<^bsub>c\<^esub> v)"
202
+ using assms ( 1 ) d ( 2 ) evs_of_def by fastforce
203
+ hence "find (\<lambda>Q. is_chan Q (build\<^bsub>c\<^esub> v)) CHANTYPEREP('e) = Some d"
204
+ by ( metis d ( 1 ) find_Some_iff find_chanrep_Some find_chanrep_def wf_chantyperep wf_chantyperep_def )
205
+ thus ?thesis
206
+ by ( simp add : chanrep_c ev_chanrep_def find_chanrep_def )
207
+ qed
208
+
209
+ lemma ev_set_of_build [ simp ]:
210
+ fixes c :: "'a \<Longrightarrow>\<^sub>\<triangle> 'e::chantyperep"
211
+ assumes "wb_prism c" "has_chanrep c"
212
+ shows "ev_set_of (build\<^bsub>c\<^esub> v) = Collect (is_chan (chanrep_of c))"
213
+ by ( simp add : assms ( 1 ) assms ( 2 ) ev_set_of_def )
214
+
215
+ method prism_has_chanrep for ct :: "'e chanrep" = ( simp add : has_chanrep_def , rule exI [ where x = "ct" ], rule conjI , simp add : chantyperep_defs , simp add : chan_defs )
216
+
217
+ method prism_chanrep = ( rule chanrep_of_eqI , simp , simp add : chantyperep_defs , simp add : chan_defs )
187
218
188
219
subsection \<open> Channel Type Command \<close>
189
220
0 commit comments