src/HOL/Nat.thy
changeset 22473 753123c89d72
parent 22348 ab505d281015
child 22483 86064f2f2188
equal deleted inserted replaced
22472:bfd9c0fd70b1 22473:753123c89d72
   104 lemma nat_not_singleton: "(\<forall>x. x = (0::nat)) = False"
   104 lemma nat_not_singleton: "(\<forall>x. x = (0::nat)) = False"
   105   by auto
   105   by auto
   106 
   106 
   107 text {* size of a datatype value *}
   107 text {* size of a datatype value *}
   108 
   108 
   109 class size =
   109 class size = type +
   110   fixes size :: "'a \<Rightarrow> nat"
   110   fixes size :: "'a \<Rightarrow> nat"
   111 
   111 
   112 text {* @{typ nat} is a datatype *}
   112 text {* @{typ nat} is a datatype *}
   113 
   113 
   114 rep_datatype nat
   114 rep_datatype nat
   474   by auto
   474   by auto
   475 
   475 
   476 
   476 
   477 subsection {* Arithmetic operators *}
   477 subsection {* Arithmetic operators *}
   478 
   478 
   479 class power =
   479 class power = type +
   480   fixes power :: "'a \<Rightarrow> nat \<Rightarrow> 'a"            (infixr "\<^loc>^" 80)
   480   fixes power :: "'a \<Rightarrow> nat \<Rightarrow> 'a"            (infixr "\<^loc>^" 80)
   481 
   481 
   482 text {* arithmetic operators @{text "+ -"} and @{text "*"} *}
   482 text {* arithmetic operators @{text "+ -"} and @{text "*"} *}
   483 
   483 
   484 instance nat :: "{plus, minus, times}" ..
   484 instance nat :: "{plus, minus, times}" ..