src/HOL/Library/Extended_Nat.thy
changeset 60636 ee18efe9b246
parent 60500 903bb1495239
child 60679 ade12ef2773c
equal deleted inserted replaced
60635:22830a64358f 60636:ee18efe9b246
     4 *)
     4 *)
     5 
     5 
     6 section \<open>Extended natural numbers (i.e. with infinity)\<close>
     6 section \<open>Extended natural numbers (i.e. with infinity)\<close>
     7 
     7 
     8 theory Extended_Nat
     8 theory Extended_Nat
     9 imports Main Countable
     9 imports Main Countable Order_Continuity
    10 begin
    10 begin
    11 
    11 
    12 class infinity =
    12 class infinity =
    13   fixes infinity :: "'a"
    13   fixes infinity :: "'a"
    14 
    14 
   470 apply (rule eSuc_enat [THEN subst])
   470 apply (rule eSuc_enat [THEN subst])
   471 apply (rule exI)
   471 apply (rule exI)
   472 apply (erule (1) le_less_trans)
   472 apply (erule (1) le_less_trans)
   473 done
   473 done
   474 
   474 
       
   475 lemma eSuc_max: "eSuc (max x y) = max (eSuc x) (eSuc y)"
       
   476   by (simp add: eSuc_def split: enat.split)
       
   477 
       
   478 lemma eSuc_Max: 
       
   479   assumes "finite A" "A \<noteq> {}"
       
   480   shows "eSuc (Max A) = Max (eSuc ` A)"
       
   481 using assms proof induction
       
   482   case (insert x A)
       
   483   thus ?case by(cases "A = {}")(simp_all add: eSuc_max)
       
   484 qed simp
       
   485 
   475 instantiation enat :: "{order_bot, order_top}"
   486 instantiation enat :: "{order_bot, order_top}"
   476 begin
   487 begin
   477 
   488 
   478 definition bot_enat :: enat where
   489 definition bot_enat :: enat where
   479   "bot_enat = 0"
   490   "bot_enat = 0"
   645  inf_enat_def sup_enat_def bot_enat_def top_enat_def Inf_enat_def Sup_enat_def)
   656  inf_enat_def sup_enat_def bot_enat_def top_enat_def Inf_enat_def Sup_enat_def)
   646 end
   657 end
   647 
   658 
   648 instance enat :: complete_linorder ..
   659 instance enat :: complete_linorder ..
   649 
   660 
       
   661 lemma eSuc_Sup: "A \<noteq> {} \<Longrightarrow> eSuc (Sup A) = Sup (eSuc ` A)"
       
   662   by(auto simp add: Sup_enat_def eSuc_Max inj_on_def dest: finite_imageD)
       
   663 
       
   664 lemma sup_continuous_eSuc: "sup_continuous f \<Longrightarrow> sup_continuous (\<lambda>x. eSuc (f x))"
       
   665   using  eSuc_Sup[of "_ ` UNIV"] by (auto simp: sup_continuous_def)
       
   666 
   650 subsection \<open>Traditional theorem names\<close>
   667 subsection \<open>Traditional theorem names\<close>
   651 
   668 
   652 lemmas enat_defs = zero_enat_def one_enat_def eSuc_def
   669 lemmas enat_defs = zero_enat_def one_enat_def eSuc_def
   653   plus_enat_def less_eq_enat_def less_enat_def
   670   plus_enat_def less_eq_enat_def less_enat_def
   654 
   671