src/HOL/Library/Efficient_Nat.thy
changeset 24423 ae9cd0e92423
parent 24222 a8a28c15c5cc
child 24630 351a308ab58d
equal deleted inserted replaced
24422:c0b5ff9e9e4d 24423:ae9cd0e92423
    60   "nat_of_int (int' n) = n"
    60   "nat_of_int (int' n) = n"
    61   using nat_of_int_def int'_def by simp
    61   using nat_of_int_def int'_def by simp
    62 
    62 
    63 lemma eq_nat_of_int: "int' n = x \<Longrightarrow> n = nat_of_int x"
    63 lemma eq_nat_of_int: "int' n = x \<Longrightarrow> n = nat_of_int x"
    64 by (erule subst, simp only: nat_of_int_int)
    64 by (erule subst, simp only: nat_of_int_int)
       
    65 
       
    66 code_datatype nat_of_int
    65 
    67 
    66 text {*
    68 text {*
    67   Case analysis on natural numbers is rephrased using a conditional
    69   Case analysis on natural numbers is rephrased using a conditional
    68   expression:
    70   expression:
    69 *}
    71 *}
   159 
   161 
   160 text {*
   162 text {*
   161   @{typ nat} is no longer a datatype but embedded into the integers.
   163   @{typ nat} is no longer a datatype but embedded into the integers.
   162 *}
   164 *}
   163 
   165 
   164 code_datatype nat_of_int
       
   165 
       
   166 code_type nat
   166 code_type nat
   167   (SML "IntInf.int")
   167   (SML "IntInf.int")
   168   (OCaml "Big'_int.big'_int")
   168   (OCaml "Big'_int.big'_int")
   169   (Haskell "Integer")
   169   (Haskell "Integer")
   170 
   170