src/HOL/BNF_Def.thy
changeset 58104 c5316f843f72
parent 57802 9c065009cd8a
child 58106 c8cba801c483
equal deleted inserted replaced
58103:c23bdb4ed2f6 58104:c5316f843f72
    13 keywords
    13 keywords
    14   "print_bnfs" :: diag and
    14   "print_bnfs" :: diag and
    15   "bnf" :: thy_goal
    15   "bnf" :: thy_goal
    16 begin
    16 begin
    17 
    17 
       
    18 lemma Collect_splitD: "x \<in> Collect (split A) \<Longrightarrow> A (fst x) (snd x)"
       
    19   by auto
       
    20 
    18 definition
    21 definition
    19   rel_fun :: "('a \<Rightarrow> 'c \<Rightarrow> bool) \<Rightarrow> ('b \<Rightarrow> 'd \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> ('c \<Rightarrow> 'd) \<Rightarrow> bool"
    22   rel_fun :: "('a \<Rightarrow> 'c \<Rightarrow> bool) \<Rightarrow> ('b \<Rightarrow> 'd \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> ('c \<Rightarrow> 'd) \<Rightarrow> bool"
    20 where
    23 where
    21   "rel_fun A B = (\<lambda>f g. \<forall>x y. A x y \<longrightarrow> B (f x) (g y))"
    24   "rel_fun A B = (\<lambda>f g. \<forall>x y. A x y \<longrightarrow> B (f x) (g y))"
    22 
    25 
    28 lemma rel_funD:
    31 lemma rel_funD:
    29   assumes "rel_fun A B f g" and "A x y"
    32   assumes "rel_fun A B f g" and "A x y"
    30   shows "B (f x) (g y)"
    33   shows "B (f x) (g y)"
    31   using assms by (simp add: rel_fun_def)
    34   using assms by (simp add: rel_fun_def)
    32 
    35 
       
    36 definition rel_set :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> 'a set \<Rightarrow> 'b set \<Rightarrow> bool"
       
    37   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))"
       
    38 
       
    39 lemma rel_setI:
       
    40   assumes "\<And>x. x \<in> A \<Longrightarrow> \<exists>y\<in>B. R x y"
       
    41   assumes "\<And>y. y \<in> B \<Longrightarrow> \<exists>x\<in>A. R x y"
       
    42   shows "rel_set R A B"
       
    43   using assms unfolding rel_set_def by simp
       
    44 
       
    45 lemma predicate2_transferD:
       
    46    "\<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>
       
    47    P (fst a) (fst b) \<longleftrightarrow> Q (snd a) (snd b)"
       
    48   unfolding rel_fun_def by (blast dest!: Collect_splitD)
       
    49 
    33 definition collect where
    50 definition collect where
    34 "collect F x = (\<Union>f \<in> F. f x)"
    51 "collect F x = (\<Union>f \<in> F. f x)"
    35 
    52 
    36 lemma fstI: "x = (y, z) \<Longrightarrow> fst x = y"
    53 lemma fstI: "x = (y, z) \<Longrightarrow> fst x = y"
    37 by simp
    54 by simp