src/HOL/BNF_Composition.thy
changeset 62324 ae44f16dcea5
parent 61032 b57df8eecad6
child 62777 596baa1a3251
equal deleted inserted replaced
62323:8c3eec5812d8 62324:ae44f16dcea5
    76   by blast
    76   by blast
    77 
    77 
    78 lemma comp_set_bd_Union_o_collect: "|\<Union>\<Union>((\<lambda>f. f x) ` X)| \<le>o hbd \<Longrightarrow> |(Union \<circ> collect X) x| \<le>o hbd"
    78 lemma comp_set_bd_Union_o_collect: "|\<Union>\<Union>((\<lambda>f. f x) ` X)| \<le>o hbd \<Longrightarrow> |(Union \<circ> collect X) x| \<le>o hbd"
    79   by (unfold comp_apply collect_def) simp
    79   by (unfold comp_apply collect_def) simp
    80 
    80 
    81 lemma wpull_cong:
    81 lemma Collect_inj: "Collect P = Collect Q \<Longrightarrow> P = Q"
    82   "\<lbrakk>A' = A; B1' = B1; B2' = B2; wpull A B1 B2 f1 f2 p1 p2\<rbrakk> \<Longrightarrow> wpull A' B1' B2' f1 f2 p1 p2"
    82   by blast
    83   by simp
    83 
       
    84 lemma Ball_Collect: "Ball A P = (A \<subseteq> (Collect P))"
       
    85 by auto
    84 
    86 
    85 lemma Grp_fst_snd: "(Grp (Collect (case_prod R)) fst)^--1 OO Grp (Collect (case_prod R)) snd = R"
    87 lemma Grp_fst_snd: "(Grp (Collect (case_prod R)) fst)^--1 OO Grp (Collect (case_prod R)) snd = R"
    86   unfolding Grp_def fun_eq_iff relcompp.simps by auto
    88   unfolding Grp_def fun_eq_iff relcompp.simps by auto
    87 
    89 
    88 lemma OO_Grp_cong: "A = B \<Longrightarrow> (Grp A f)^--1 OO Grp A g = (Grp B f)^--1 OO Grp B g"
    90 lemma OO_Grp_cong: "A = B \<Longrightarrow> (Grp A f)^--1 OO Grp A g = (Grp B f)^--1 OO Grp B g"
    98 lemma type_copy_set_bd: "(\<And>y. |S y| \<le>o bd) \<Longrightarrow> |(S o Rep) x| \<le>o bd"
   100 lemma type_copy_set_bd: "(\<And>y. |S y| \<le>o bd) \<Longrightarrow> |(S o Rep) x| \<le>o bd"
    99   by auto
   101   by auto
   100 
   102 
   101 lemma vimage2p_cong: "R = S \<Longrightarrow> vimage2p f g R = vimage2p f g S"
   103 lemma vimage2p_cong: "R = S \<Longrightarrow> vimage2p f g R = vimage2p f g S"
   102   by simp
   104   by simp
       
   105 
       
   106 lemma Ball_comp_iff: "(\<lambda>x. Ball (A x) f) o g = (\<lambda>x. Ball ((A o g) x) f)"
       
   107   unfolding o_def by auto
       
   108 
       
   109 lemma conj_comp_iff: "(\<lambda>x. P x \<and> Q x) o g = (\<lambda>x. (P o g) x \<and> (Q o g) x)"
       
   110   unfolding o_def by auto
   103 
   111 
   104 context
   112 context
   105   fixes Rep Abs
   113   fixes Rep Abs
   106   assumes type_copy: "type_definition Rep Abs UNIV"
   114   assumes type_copy: "type_definition Rep Abs UNIV"
   107 begin
   115 begin
   148 
   156 
   149 bnf DEADID: 'a
   157 bnf DEADID: 'a
   150   map: "id :: 'a \<Rightarrow> 'a"
   158   map: "id :: 'a \<Rightarrow> 'a"
   151   bd: natLeq
   159   bd: natLeq
   152   rel: "op = :: 'a \<Rightarrow> 'a \<Rightarrow> bool"
   160   rel: "op = :: 'a \<Rightarrow> 'a \<Rightarrow> bool"
   153   by (auto simp add: Grp_def natLeq_card_order natLeq_cinfinite)
   161   by (auto simp add: natLeq_card_order natLeq_cinfinite)
   154 
   162 
   155 definition id_bnf :: "'a \<Rightarrow> 'a" where
   163 definition id_bnf :: "'a \<Rightarrow> 'a" where
   156   "id_bnf \<equiv> (\<lambda>x. x)"
   164   "id_bnf \<equiv> (\<lambda>x. x)"
   157 
   165 
   158 lemma id_bnf_apply: "id_bnf x = x"
   166 lemma id_bnf_apply: "id_bnf x = x"
   161 bnf ID: 'a
   169 bnf ID: 'a
   162   map: "id_bnf :: ('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'b"
   170   map: "id_bnf :: ('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'b"
   163   sets: "\<lambda>x. {x}"
   171   sets: "\<lambda>x. {x}"
   164   bd: natLeq
   172   bd: natLeq
   165   rel: "id_bnf :: ('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> bool"
   173   rel: "id_bnf :: ('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> bool"
       
   174   pred: "id_bnf :: ('a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> bool"
   166   unfolding id_bnf_def
   175   unfolding id_bnf_def
   167   apply (auto simp: Grp_def fun_eq_iff relcompp.simps natLeq_card_order natLeq_cinfinite)
   176   apply (auto simp: Grp_def fun_eq_iff relcompp.simps natLeq_card_order natLeq_cinfinite)
   168   apply (rule ordLess_imp_ordLeq[OF finite_ordLess_infinite[OF _ natLeq_Well_order]])
   177   apply (rule ordLess_imp_ordLeq[OF finite_ordLess_infinite[OF _ natLeq_Well_order]])
   169   apply (auto simp add: Field_card_of Field_natLeq card_of_well_order_on)[3]
   178   apply (auto simp add: Field_card_of Field_natLeq card_of_well_order_on)[3]
   170   done
   179   done