equal
deleted
inserted
replaced
102 "snds x = {snd x}" |
102 "snds x = {snd x}" |
103 |
103 |
104 lemmas prod_set_defs = fsts_def[abs_def] snds_def[abs_def] |
104 lemmas prod_set_defs = fsts_def[abs_def] snds_def[abs_def] |
105 |
105 |
106 definition |
106 definition |
107 prod_rel :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> ('c \<Rightarrow> 'd \<Rightarrow> bool) \<Rightarrow> 'a \<times> 'c \<Rightarrow> 'b \<times> 'd \<Rightarrow> bool" |
107 rel_prod :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> ('c \<Rightarrow> 'd \<Rightarrow> bool) \<Rightarrow> 'a \<times> 'c \<Rightarrow> 'b \<times> 'd \<Rightarrow> bool" |
108 where |
108 where |
109 "prod_rel R1 R2 = (\<lambda>(a, b) (c, d). R1 a c \<and> R2 b d)" |
109 "rel_prod R1 R2 = (\<lambda>(a, b) (c, d). R1 a c \<and> R2 b d)" |
110 |
110 |
111 lemma prod_rel_apply [simp]: |
111 lemma rel_prod_apply [simp]: |
112 "prod_rel R1 R2 (a, b) (c, d) \<longleftrightarrow> R1 a c \<and> R2 b d" |
112 "rel_prod R1 R2 (a, b) (c, d) \<longleftrightarrow> R1 a c \<and> R2 b d" |
113 by (simp add: prod_rel_def) |
113 by (simp add: rel_prod_def) |
114 |
114 |
115 bnf "'a \<times> 'b" |
115 bnf "'a \<times> 'b" |
116 map: map_prod |
116 map: map_prod |
117 sets: fsts snds |
117 sets: fsts snds |
118 bd: natLeq |
118 bd: natLeq |
119 rel: prod_rel |
119 rel: rel_prod |
120 proof (unfold prod_set_defs) |
120 proof (unfold prod_set_defs) |
121 show "map_prod id id = id" by (rule map_prod.id) |
121 show "map_prod id id = id" by (rule map_prod.id) |
122 next |
122 next |
123 fix f1 f2 g1 g2 |
123 fix f1 f2 g1 g2 |
124 show "map_prod (g1 o f1) (g2 o f2) = map_prod g1 g2 o map_prod f1 f2" |
124 show "map_prod (g1 o f1) (g2 o f2) = map_prod g1 g2 o map_prod f1 f2" |
147 fix x |
147 fix x |
148 show "|{snd x}| \<le>o natLeq" |
148 show "|{snd x}| \<le>o natLeq" |
149 by (rule ordLess_imp_ordLeq) (simp add: finite_iff_ordLess_natLeq[symmetric]) |
149 by (rule ordLess_imp_ordLeq) (simp add: finite_iff_ordLess_natLeq[symmetric]) |
150 next |
150 next |
151 fix R1 R2 S1 S2 |
151 fix R1 R2 S1 S2 |
152 show "prod_rel R1 R2 OO prod_rel S1 S2 \<le> prod_rel (R1 OO S1) (R2 OO S2)" by auto |
152 show "rel_prod R1 R2 OO rel_prod S1 S2 \<le> rel_prod (R1 OO S1) (R2 OO S2)" by auto |
153 next |
153 next |
154 fix R S |
154 fix R S |
155 show "prod_rel R S = |
155 show "rel_prod R S = |
156 (Grp {x. {fst x} \<subseteq> Collect (split R) \<and> {snd x} \<subseteq> Collect (split S)} (map_prod fst fst))\<inverse>\<inverse> OO |
156 (Grp {x. {fst x} \<subseteq> Collect (split R) \<and> {snd x} \<subseteq> Collect (split S)} (map_prod fst fst))\<inverse>\<inverse> OO |
157 Grp {x. {fst x} \<subseteq> Collect (split R) \<and> {snd x} \<subseteq> Collect (split S)} (map_prod snd snd)" |
157 Grp {x. {fst x} \<subseteq> Collect (split R) \<and> {snd x} \<subseteq> Collect (split S)} (map_prod snd snd)" |
158 unfolding prod_set_defs prod_rel_def Grp_def relcompp.simps conversep.simps fun_eq_iff |
158 unfolding prod_set_defs rel_prod_def Grp_def relcompp.simps conversep.simps fun_eq_iff |
159 by auto |
159 by auto |
160 qed |
160 qed |
161 |
161 |
162 bnf "'a \<Rightarrow> 'b" |
162 bnf "'a \<Rightarrow> 'b" |
163 map: "op \<circ>" |
163 map: "op \<circ>" |