src/HOL/BNF_Def.thy
changeset 58104 c5316f843f72
parent 57802 9c065009cd8a
child 58106 c8cba801c483
--- a/src/HOL/BNF_Def.thy	Mon Sep 01 13:23:05 2014 +0200
+++ b/src/HOL/BNF_Def.thy	Mon Sep 01 13:23:39 2014 +0200
@@ -15,6 +15,9 @@
   "bnf" :: thy_goal
 begin
 
+lemma Collect_splitD: "x \<in> Collect (split A) \<Longrightarrow> A (fst x) (snd x)"
+  by auto
+
 definition
   rel_fun :: "('a \<Rightarrow> 'c \<Rightarrow> bool) \<Rightarrow> ('b \<Rightarrow> 'd \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> ('c \<Rightarrow> 'd) \<Rightarrow> bool"
 where
@@ -30,6 +33,20 @@
   shows "B (f x) (g y)"
   using assms by (simp add: rel_fun_def)
 
+definition rel_set :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> 'a set \<Rightarrow> 'b set \<Rightarrow> bool"
+  where "rel_set R = (\<lambda>A B. (\<forall>x\<in>A. \<exists>y\<in>B. R x y) \<and> (\<forall>y\<in>B. \<exists>x\<in>A. R x y))"
+
+lemma rel_setI:
+  assumes "\<And>x. x \<in> A \<Longrightarrow> \<exists>y\<in>B. R x y"
+  assumes "\<And>y. y \<in> B \<Longrightarrow> \<exists>x\<in>A. R x y"
+  shows "rel_set R A B"
+  using assms unfolding rel_set_def by simp
+
+lemma predicate2_transferD:
+   "\<lbrakk>rel_fun R1 (rel_fun R2 (op =)) P Q; a \<in> A; b \<in> B; A \<subseteq> {(x, y). R1 x y}; B \<subseteq> {(x, y). R2 x y}\<rbrakk> \<Longrightarrow>
+   P (fst a) (fst b) \<longleftrightarrow> Q (snd a) (snd b)"
+  unfolding rel_fun_def by (blast dest!: Collect_splitD)
+
 definition collect where
 "collect F x = (\<Union>f \<in> F. f x)"