Skip to content

Commit c05131d

Browse files
committed
Completed integration of scene space complete lattice with frames
1 parent d3a4c90 commit c05131d

2 files changed

Lines changed: 41 additions & 84 deletions

File tree

Frames.thy

Lines changed: 38 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ lemma compat_frames [simp]: "\<lbrakk>A\<rbrakk>\<^sub>F ##\<^sub>S \<lbrakk>B\<
2525

2626
lift_definition frame_scene :: "'s::scene_space scene \<Rightarrow> 's frame" ("[_]\<^sub>F")
2727
is "\<lambda> s. if s \<in> scene_space then s else \<bottom>\<^sub>S"
28-
by auto
28+
by (metis scene_space_class.scene_space.bot_scene_space)
2929

3030
named_theorems frame
3131

@@ -42,8 +42,8 @@ instance
4242
apply (intro_classes; transfer)
4343
apply (simp add: less_scene_def)
4444
apply (simp_all add: less_scene_def subscene_refl)
45+
using ss_clat.le_trans apply blast
4546
using idem_scene_space subscene_trans apply auto[1]
46-
apply (simp add: idem_scene_space subscene_antisym)
4747
done
4848

4949
end
@@ -54,18 +54,18 @@ instantiation frame :: (scene_space) lattice
5454
begin
5555

5656
lift_definition sup_frame :: "'a frame \<Rightarrow> 'a frame \<Rightarrow> 'a frame" is "(\<squnion>\<^sub>S)"
57-
by (simp add: union_scene_space)
57+
by (fact union_scene_space)
5858

5959
lift_definition inf_frame :: "'a frame \<Rightarrow> 'a frame \<Rightarrow> 'a frame" is "(\<sqinter>\<^sub>S)"
60-
by (simp add: scene_space_inter)
60+
by (fact scene_space_inter)
6161

6262
instance
6363
apply (intro_classes; transfer)
64-
apply (metis scene_compl_subset_iff scene_demorgan2 scene_space_inter scene_space_ub scene_space_uminus)
65-
apply (metis inf_scene_def scene_indep_sym scene_le_iff_indep_inv scene_space_ub scene_space_uminus scene_union_commute)
66-
apply (metis idem_scene_space scene_compl_subset_iff scene_demorgan2 scene_space_compat scene_space_inter scene_space_uminus scene_union_mono)
64+
apply (metis scene_compl_subset_iff scene_demorgan2 scene_space_inter scene_space_ub scene_space_uminus)
65+
apply (metis inf_scene_def scene_indep_sym scene_le_iff_indep_inv scene_space_ub scene_space_uminus scene_union_commute)
66+
apply (metis idem_scene_space scene_compl_subset_iff scene_demorgan2 scene_space_compat scene_space_inter scene_space_uminus scene_union_mono)
6767
using scene_space_ub apply blast
68-
apply (simp add: scene_space_ub scene_union_commute)
68+
apply (simp add: scene_space_ub scene_union_commute)
6969
apply (meson idem_scene_space scene_space_compat scene_union_mono)
7070
done
7171

@@ -84,24 +84,24 @@ lemma frame_scene_union: "\<lbrakk> A \<in> scene_space; B \<in> scene_space \<r
8484
instantiation frame :: (scene_space) bounded_lattice
8585
begin
8686

87-
lift_definition bot_frame :: "'a frame" is "\<bottom>\<^sub>S" by (simp add: bot_scene_space)
88-
lift_definition top_frame :: "'a frame" is "\<top>\<^sub>S" by (simp add: top_scene_space)
87+
lift_definition bot_frame :: "'a frame" is "\<bottom>\<^sub>S" by simp
88+
lift_definition top_frame :: "'a frame" is "\<top>\<^sub>S" by simp
8989

9090
instance by (intro_classes; transfer; simp add: scene_bot_least scene_top_greatest)
9191

9292
end
9393

9494
abbreviation frame_UNIV :: "'s::scene_space frame" ("\<top>\<^sub>F")
95-
where "\<top>\<^sub>F \<equiv> top"
95+
where "\<top>\<^sub>F \<equiv> top_class.top"
9696

9797
abbreviation frame_empty :: "'s::scene_space frame" ("\<lbrace>\<rbrace>\<^sub>F")
98-
where "\<lbrace>\<rbrace>\<^sub>F \<equiv> bot"
98+
where "\<lbrace>\<rbrace>\<^sub>F \<equiv> bot_class.bot"
9999

100100
syntax "_frame_UNIV" :: "type \<Rightarrow> logic" ("UNIV\<^sub>F'(_')")
101101

102102
translations "UNIV\<^sub>F('a)" == "\<top>\<^sub>F :: 'a frame"
103103

104-
lemma frame_top: "top = frame_scene \<top>\<^sub>S"
104+
lemma frame_top: "top_class.top = frame_scene \<top>\<^sub>S"
105105
by (transfer, simp add: top_scene_space)
106106

107107
instance frame :: (scene_space) distrib_lattice
@@ -112,10 +112,10 @@ instantiation frame :: (scene_space) boolean_algebra
112112
begin
113113

114114
lift_definition minus_frame :: "'a frame \<Rightarrow> 'a frame \<Rightarrow> 'a frame" is "\<lambda> a b. a \<sqinter>\<^sub>S - b"
115-
by (simp add: scene_space_inter scene_space_uminus)
115+
by (blast intro: scene_space_inter scene_space_uminus)
116116

117117
lift_definition uminus_frame :: "'a frame \<Rightarrow> 'a frame" is "uminus"
118-
by (simp add: scene_space_uminus)
118+
by (blast intro: scene_space_uminus)
119119

120120
instance
121121
by (intro_classes; transfer)
@@ -126,25 +126,11 @@ end
126126
instantiation frame :: (scene_space) "{Inf, Sup}"
127127
begin
128128

129-
lift_definition Sup_frame :: "'a frame set \<Rightarrow> 'a frame" is "\<lambda> A. \<Squnion>\<^sub>S (SOME xs. set xs = A)"
130-
proof -
131-
fix A :: "'a scene set"
132-
assume a: "\<And>x. x \<in> A \<Longrightarrow> x \<in> scene_space"
133-
have A_ss: "A \<subseteq> scene_space"
134-
by (simp add: a subsetI)
135-
hence "finite A"
136-
using finite_scene_space rev_finite_subset by blast
137-
then obtain xs where A: "A = set xs"
138-
using finite_list by blast
139-
hence "\<Squnion>\<^sub>S xs \<in> scene_space"
140-
using A_ss scene_space_foldr by blast
141-
moreover have "\<Squnion>\<^sub>S (SOME xs. set xs = A) = \<Squnion>\<^sub>S xs"
142-
by (metis (mono_tags, lifting) A A_ss foldr_scene_union_eq_scene_space someI)
143-
ultimately show "\<Squnion>\<^sub>S (SOME xs. set xs = A) \<in> scene_space"
144-
by simp
145-
qed
129+
lift_definition Sup_frame :: "'a frame set \<Rightarrow> 'a frame" is "(\<Union>\<^sub>S)"
130+
by (rule Sup_scene_closed)
146131

147-
definition Inf_frame :: "'a frame set \<Rightarrow> 'a frame" where "Inf_frame A = - (Sup (uminus ` A))"
132+
lift_definition Inf_frame :: "'a frame set \<Rightarrow> 'a frame" is "(\<Inter>\<^sub>S)"
133+
by (metis ss_clat.inf_closed subsetI)
148134

149135
instance ..
150136

@@ -158,69 +144,37 @@ abbreviation frame_Inter :: "'a::scene_space frame set \<Rightarrow> 'a frame"
158144

159145
instance frame :: (scene_space) complete_lattice
160146
proof
161-
show Sup: "\<Union>\<^sub>F {} = bot"
147+
show Sup: "\<Union>\<^sub>F {} = bot_class.bot"
148+
by (transfer, simp)
149+
show Inf: "\<Inter>\<^sub>F {} = top_class.top"
162150
by (transfer, simp)
163-
show Inf: "\<Inter>\<^sub>F {} = top"
164-
by (simp add: Inf_frame_def Sup)
165151
show le_Sup: "\<And>(x::'a frame) A. x \<in> A \<Longrightarrow> x \<le> \<Union>\<^sub>F A"
166-
proof -
167-
fix x and A :: "'a frame set"
168-
assume "x \<in> A"
169-
thus "x \<le> Sup A"
170-
proof (transfer)
171-
fix x and A :: "'a scene set"
172-
assume x: "x \<in> scene_space" "\<forall>x\<in>A. x \<in> scene_space" "x \<in> A"
173-
then obtain xs where xs: "set xs = A"
174-
by (metis finite_list finite_scene_space rev_finite_subset subsetI)
175-
thus "x \<subseteq>\<^sub>S \<Squnion>\<^sub>S (SOME xs. set xs = A)"
176-
by (metis (mono_tags, lifting) scene_space_in_foldr someI subset_iff x(2) x(3))
177-
qed
178-
qed
152+
by (transfer, metis le_Sup_scene subsetI)
179153
show "\<And>(x:: 'a frame) A. x \<in> A \<Longrightarrow> \<Inter>\<^sub>F A \<le> x"
180-
proof -
181-
fix x and A :: "'a frame set"
182-
assume xA: "x \<in> A"
183-
have "Inf A \<le> x \<longleftrightarrow> (- \<Union>\<^sub>F (uminus ` A) \<le> x)"
184-
by (simp add: Inf_frame_def)
185-
also have "... \<longleftrightarrow> (- x \<le> \<Union>\<^sub>F (uminus ` A))"
186-
using compl_le_swap2 by blast
187-
also have "..."
188-
by (simp add: le_Sup xA)
189-
finally show "\<Inter>\<^sub>F A \<le> x" .
190-
qed
154+
by (transfer, meson ss_clat.inf_lower subsetI)
191155
show Sup_le: "\<And>(A::'a frame set) z. (\<And>x. x \<in> A \<Longrightarrow> x \<le> z) \<Longrightarrow> \<Union>\<^sub>F A \<le> z"
192-
proof transfer
193-
fix z and A :: "'a scene set"
194-
assume a: "\<forall>x\<in>A. x \<in> scene_space" "z \<in> scene_space" "\<And>x. x \<in> scene_space \<Longrightarrow> x \<in> A \<Longrightarrow> x \<subseteq>\<^sub>S z"
195-
then obtain xs where xs: "set xs = A"
196-
by (metis finite_list finite_scene_space rev_finite_subset subsetI)
197-
with a show "\<Squnion>\<^sub>S (SOME xs. set xs = A) \<subseteq>\<^sub>S z"
198-
by (metis (mono_tags, lifting) scene_space_foldr_lb subset_iff tfl_some)
199-
qed
156+
by (transfer, meson Sup_scene_le subsetI)
200157
show "\<And>(A :: 'a frame set) z. (\<And>x. x \<in> A \<Longrightarrow> z \<le> x) \<Longrightarrow> z \<le> \<Inter>\<^sub>F A"
201-
proof -
202-
fix A :: "'a frame set" and z :: "'a frame"
203-
assume a: "\<And>x. x \<in> A \<Longrightarrow> z \<le> x"
204-
have "z \<le> Inf A \<longleftrightarrow> \<Union>\<^sub>F (uminus ` A) \<le> - z"
205-
by (metis Inf_frame_def compl_le_swap1)
206-
also have "..."
207-
using a compl_le_compl_iff by (blast intro: Sup_le)
208-
finally show "z \<le> Inf A" .
209-
qed
158+
by (transfer, metis ss_clat.inf_greatest subsetI)
210159
qed
211160

161+
212162
lemma frame_scene_foldr: "\<lbrakk> set xs \<subseteq> scene_space \<rbrakk> \<Longrightarrow> [\<Squnion>\<^sub>S xs]\<^sub>F = \<Union>\<^sub>F (set (map frame_scene xs))"
213-
by (transfer, auto simp add: image_constant_conv Int_absorb2 scene_space_foldr)
214-
(metis (mono_tags, lifting) foldr_scene_union_eq_scene_space tfl_some)
163+
apply transfer
164+
apply simp
165+
apply (simp add: scene_space_foldr)
166+
apply (metis (no_types, lifting) Int_Un_eq(3) Sup_scene_is_foldr_scene disjoint_iff
167+
image_is_empty inf.order_iff mem_Collect_eq subset_iff)
168+
done
215169

216170
lemma frame_scene_top: "\<top>\<^sub>F = [\<Squnion>\<^sub>S Vars]\<^sub>F"
217171
by (simp add: frame_top top_scene_eq)
218172

219173
lemma uminus_frame_Inf: "- \<Inter>\<^sub>F A = \<Union>\<^sub>F (uminus ` A)"
220-
by (simp add: Inf_frame_def)
174+
by (transfer, simp add: uminus_scene_Inf)
221175

222176
lemma uminus_frame_Sup: "- \<Union>\<^sub>F A = \<Inter>\<^sub>F (uminus ` A)"
223-
by (simp add: Inf_frame_def SUP_image)
177+
by (transfer, simp add: uminus_scene_Sup)
224178

225179
lift_definition frame_comp :: "'a::scene_space frame \<Rightarrow> ('a \<Longrightarrow> 'b) \<Rightarrow> 'b::scene_space frame" (infixl ";\<^sub>F" 80)
226180
is "\<lambda> A X. if composite_lens X then (A ;\<^sub>S X) else \<bottom>\<^sub>S"
@@ -257,7 +211,7 @@ lemma lens_not_member_empty: "var_lens x \<Longrightarrow> (x \<in>\<^sub>F \<lb
257211
lemma lens_not_member_empty_two [simp]: "evar_lens x \<Longrightarrow> x \<notin>\<^sub>F \<lbrace>\<rbrace>\<^sub>F"
258212
using ief_lens_iff_zero lens_not_member_empty no_ief_two_view var_lens.axioms(1) by blast
259213

260-
lemma lens_member_top [simp]: "x \<in>\<^sub>F top"
214+
lemma lens_member_top [simp]: "x \<in>\<^sub>F top_class.top"
261215
by (simp add: lens_member_def)
262216

263217
lemma FUn_iff [simp]: "basis_lens x \<Longrightarrow> (x \<in>\<^sub>F a \<union>\<^sub>F b) = (x \<in>\<^sub>F a \<or> x \<in>\<^sub>F b)"
@@ -266,7 +220,7 @@ lemma FUn_iff [simp]: "basis_lens x \<Longrightarrow> (x \<in>\<^sub>F a \<union
266220

267221
lemma FCompl_iff: "ebasis_lens x \<Longrightarrow> x \<in>\<^sub>F - A \<longleftrightarrow> x \<notin>\<^sub>F A"
268222
apply (simp add: lens_member_def, auto)
269-
apply (metis (no_types, opaque_lifting) basis_then_var boolean_algebra.disj_cancel_right boolean_algebra_class.boolean_algebra.double_compl bot.extremum compl_le_swap1 dual_order.trans lens_member_def lens_not_member_empty_two sup.absorb2)
223+
apply (metis (no_types, opaque_lifting) basis_then_var boolean_algebra.disj_cancel_right boolean_algebra_class.boolean_algebra.double_compl bot.extremum compl_le_swap1 dual_order.trans lens_member_def lens_not_member_empty_two sup.absorb2)
270224
apply (metis FUn_iff boolean_algebra.disj_cancel_right lens_member_def top_greatest)
271225
done
272226

@@ -279,7 +233,7 @@ text \<open> A basis lens is not a member of a frame when it is independent of t
279233

280234
lemma basis_lens_not_member_indep: "ebasis_lens x \<Longrightarrow> x \<notin>\<^sub>F A \<longleftrightarrow> \<lbrakk>x\<rbrakk>\<^sub>\<sim> \<bowtie>\<^sub>S \<lbrakk>A\<rbrakk>\<^sub>F"
281235
apply (auto simp add: lens_frame.rep_eq less_eq_frame.rep_eq FCompl_iff[THEN sym] indep_then_compl_in uminus_frame.rep_eq)
282-
apply (metis basis_then_var boolean_algebra_class.boolean_algebra.double_compl lens_frame.rep_eq lens_member_def less_eq_frame.rep_eq scene_le_iff_indep_inv uminus_frame.rep_eq)
236+
apply (metis basis_then_var boolean_algebra_class.boolean_algebra.double_compl lens_frame.rep_eq lens_member_def less_eq_frame.rep_eq scene_le_iff_indep_inv uminus_frame.rep_eq)
283237
apply (simp add: indep_then_compl_in lens_frame.rep_eq lens_member_def less_eq_frame.rep_eq uminus_frame.rep_eq)
284238
done
285239

Scene_Spaces.thy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,9 @@ interpretation ss_clat: complete_lattice scene_gorder
984984
and "Lattice.sup scene_gorder = (\<Union>\<^sub>S)" and "Lattice.inf scene_gorder = (\<Inter>\<^sub>S)" and "Lattice.join scene_gorder = (\<union>\<^sub>S)"
985985
by (auto simp add: scene_space_complete_lattice elem_def set_eq_def sup_scene_space_def fun_eq_iff join_def ss_union_def sup_scene_space_eq inf_scene_space_eq)
986986

987+
declare ss_clat.refl [simp del]
988+
declare ss_clat.mem_imp_elem [simp del]
989+
987990
subsection \<open> Scene space and basis lenses \<close>
988991

989992
locale var_lens = vwb_lens +

0 commit comments

Comments
 (0)