src/HOL/Basic_BNFs.thy
changeset 75624 22d1c5f2b9f4
parent 67399 eab6ce8368fa
child 75625 0dd3ac5fdbaa
equal deleted inserted replaced
75623:7a6301d01199 75624:22d1c5f2b9f4
     1 (*  Title:      HOL/Basic_BNFs.thy
     1 (*  Title:      HOL/Basic_BNFs.thy
     2     Author:     Dmitriy Traytel, TU Muenchen
     2     Author:     Dmitriy Traytel, TU Muenchen
     3     Author:     Andrei Popescu, TU Muenchen
     3     Author:     Andrei Popescu, TU Muenchen
     4     Author:     Jasmin Blanchette, TU Muenchen
     4     Author:     Jasmin Blanchette, TU Muenchen
     5     Copyright   2012
     5     Author:     Jan van Brügge
       
     6     Copyright   2012, 2022
     6 
     7 
     7 Registration of basic types as bounded natural functors.
     8 Registration of basic types as bounded natural functors.
     8 *)
     9 *)
     9 
    10 
    10 section \<open>Registration of Basic Types as Bounded Natural Functors\<close>
    11 section \<open>Registration of Basic Types as Bounded Natural Functors\<close>
    75 next
    76 next
    76   show "card_order natLeq" by (rule natLeq_card_order)
    77   show "card_order natLeq" by (rule natLeq_card_order)
    77 next
    78 next
    78   show "cinfinite natLeq" by (rule natLeq_cinfinite)
    79   show "cinfinite natLeq" by (rule natLeq_cinfinite)
    79 next
    80 next
       
    81   show "regularCard natLeq" by (rule regularCard_natLeq)
       
    82 next
    80   fix x :: "'o + 'p"
    83   fix x :: "'o + 'p"
    81   show "|setl x| \<le>o natLeq"
    84   show "|setl x| <o natLeq"
    82     apply (rule ordLess_imp_ordLeq)
       
    83     apply (rule finite_iff_ordLess_natLeq[THEN iffD1])
    85     apply (rule finite_iff_ordLess_natLeq[THEN iffD1])
    84     by (simp add: sum_set_defs(1) split: sum.split)
    86     by (simp add: sum_set_defs(1) split: sum.split)
    85 next
    87 next
    86   fix x :: "'o + 'p"
    88   fix x :: "'o + 'p"
    87   show "|setr x| \<le>o natLeq"
    89   show "|setr x| <o natLeq"
    88     apply (rule ordLess_imp_ordLeq)
       
    89     apply (rule finite_iff_ordLess_natLeq[THEN iffD1])
    90     apply (rule finite_iff_ordLess_natLeq[THEN iffD1])
    90     by (simp add: sum_set_defs(2) split: sum.split)
    91     by (simp add: sum_set_defs(2) split: sum.split)
    91 next
    92 next
    92   fix R1 R2 S1 S2
    93   fix R1 R2 S1 S2
    93   show "rel_sum R1 R2 OO rel_sum S1 S2 \<le> rel_sum (R1 OO S1) (R2 OO S2)"
    94   show "rel_sum R1 R2 OO rel_sum S1 S2 \<le> rel_sum (R1 OO S1) (R2 OO S2)"
   166 next
   167 next
   167   show "card_order natLeq" by (rule natLeq_card_order)
   168   show "card_order natLeq" by (rule natLeq_card_order)
   168 next
   169 next
   169   show "cinfinite natLeq" by (rule natLeq_cinfinite)
   170   show "cinfinite natLeq" by (rule natLeq_cinfinite)
   170 next
   171 next
       
   172   show "regularCard natLeq" by (rule regularCard_natLeq)
       
   173 next
   171   fix x
   174   fix x
   172   show "|{fst x}| \<le>o natLeq"
   175   show "|{fst x}| <o natLeq"
   173     by (rule ordLess_imp_ordLeq) (simp add: finite_iff_ordLess_natLeq[symmetric])
   176     by (simp add: finite_iff_ordLess_natLeq[symmetric])
   174 next
   177 next
   175   fix x
   178   fix x
   176   show "|{snd x}| \<le>o natLeq"
   179   show "|{snd x}| <o natLeq"
   177     by (rule ordLess_imp_ordLeq) (simp add: finite_iff_ordLess_natLeq[symmetric])
   180     by (simp add: finite_iff_ordLess_natLeq[symmetric])
   178 next
   181 next
   179   fix R1 R2 S1 S2
   182   fix R1 R2 S1 S2
   180   show "rel_prod R1 R2 OO rel_prod S1 S2 \<le> rel_prod (R1 OO S1) (R2 OO S2)" by auto
   183   show "rel_prod R1 R2 OO rel_prod S1 S2 \<le> rel_prod (R1 OO S1) (R2 OO S2)" by auto
   181 next
   184 next
   182   fix R S
   185   fix R S
   188 qed auto
   191 qed auto
   189 
   192 
   190 bnf "'a \<Rightarrow> 'b"
   193 bnf "'a \<Rightarrow> 'b"
   191   map: "(\<circ>)"
   194   map: "(\<circ>)"
   192   sets: range
   195   sets: range
   193   bd: "natLeq +c |UNIV :: 'a set|"
   196   bd: "card_suc (natLeq +c |UNIV::'a set|)"
   194   rel: "rel_fun (=)"
   197   rel: "rel_fun (=)"
   195   pred: "pred_fun (\<lambda>_. True)"
   198   pred: "pred_fun (\<lambda>_. True)"
   196 proof
   199 proof
   197   fix f show "id \<circ> f = id f" by simp
   200   fix f show "id \<circ> f = id f" by simp
   198 next
   201 next
   204   thus "f \<circ> x = g \<circ> x" by auto
   207   thus "f \<circ> x = g \<circ> x" by auto
   205 next
   208 next
   206   fix f show "range \<circ> (\<circ>) f = (`) f \<circ> range"
   209   fix f show "range \<circ> (\<circ>) f = (`) f \<circ> range"
   207     by (auto simp add: fun_eq_iff)
   210     by (auto simp add: fun_eq_iff)
   208 next
   211 next
   209   show "card_order (natLeq +c |UNIV| )" (is "_ (_ +c ?U)")
   212   show "card_order (card_suc (natLeq +c |UNIV|))"
   210   apply (rule card_order_csum)
   213     apply (rule card_order_card_suc)
   211   apply (rule natLeq_card_order)
   214     apply (rule card_order_csum)
   212   by (rule card_of_card_order_on)
   215      apply (rule natLeq_card_order)
   213 (*  *)
   216     by (rule card_of_card_order_on)
   214   show "cinfinite (natLeq +c ?U)"
   217 next
   215     apply (rule cinfinite_csum)
   218   have "Cinfinite (card_suc (natLeq +c |UNIV| ))"
       
   219     apply (rule Cinfinite_card_suc)
       
   220      apply (rule Cinfinite_csum)
       
   221      apply (rule disjI1)
       
   222      apply (rule natLeq_Cinfinite)
       
   223     apply (rule card_order_csum)
       
   224      apply (rule natLeq_card_order)
       
   225     by (rule card_of_card_order_on)
       
   226   then show "cinfinite (card_suc (natLeq +c |UNIV|))" by blast
       
   227 next
       
   228   show "regularCard (card_suc (natLeq +c |UNIV|))"
       
   229     apply (rule regular_card_suc)
       
   230      apply (rule card_order_csum)
       
   231       apply (rule natLeq_card_order)
       
   232      apply (rule card_of_card_order_on)
       
   233     apply (rule Cinfinite_csum)
   216     apply (rule disjI1)
   234     apply (rule disjI1)
   217     by (rule natLeq_cinfinite)
   235     by (rule natLeq_Cinfinite)
   218 next
   236 next
   219   fix f :: "'d => 'a"
   237   fix f :: "'d => 'a"
   220   have "|range f| \<le>o | (UNIV::'d set) |" (is "_ \<le>o ?U") by (rule card_of_image)
   238   have "|range f| \<le>o | (UNIV::'d set) |" (is "_ \<le>o ?U") by (rule card_of_image)
   221   also have "?U \<le>o natLeq +c ?U" by (rule ordLeq_csum2) (rule card_of_Card_order)
   239   then have 1: "|range f| \<le>o natLeq +c ?U" using ordLeq_transitive ordLeq_csum2 card_of_Card_order by blast
   222   finally show "|range f| \<le>o natLeq +c ?U" .
   240   have "natLeq +c ?U <o card_suc (natLeq +c ?U)" using card_of_card_order_on card_order_csum natLeq_card_order card_suc_greater by blast
       
   241   then have "|range f| <o card_suc (natLeq +c ?U)" by (rule ordLeq_ordLess_trans[OF 1])
       
   242   then show "|range f| <o card_suc (natLeq +c ?U)"
       
   243     using ordLess_ordLeq_trans ordLeq_csum2 card_of_card_order_on Card_order_card_suc by blast
   223 next
   244 next
   224   fix R S
   245   fix R S
   225   show "rel_fun (=) R OO rel_fun (=) S \<le> rel_fun (=) (R OO S)" by (auto simp: rel_fun_def)
   246   show "rel_fun (=) R OO rel_fun (=) S \<le> rel_fun (=) (R OO S)" by (auto simp: rel_fun_def)
   226 next
   247 next
   227   fix R
   248   fix R