src/HOL/Library/Efficient_Nat.thy
changeset 28228 7ebe8dc06cbb
parent 27673 52056ddac194
child 28346 b8390cd56b8f
equal deleted inserted replaced
28227:77221ee0f7b9 28228:7ebe8dc06cbb
     4 *)
     4 *)
     5 
     5 
     6 header {* Implementation of natural numbers by target-language integers *}
     6 header {* Implementation of natural numbers by target-language integers *}
     7 
     7 
     8 theory Efficient_Nat
     8 theory Efficient_Nat
     9 imports Plain Code_Integer Code_Index
     9 imports Plain Code_Index Code_Integer
    10 begin
    10 begin
    11 
    11 
    12 text {*
    12 text {*
    13   When generating code for functions on natural numbers, the
    13   When generating code for functions on natural numbers, the
    14   canonical representation using @{term "0::nat"} and
    14   canonical representation using @{term "0::nat"} and
   422   "op * \<Colon>  nat \<Rightarrow> nat \<Rightarrow> nat"   ("(_ */ _)")
   422   "op * \<Colon>  nat \<Rightarrow> nat \<Rightarrow> nat"   ("(_ */ _)")
   423   "op \<le> \<Colon>  nat \<Rightarrow> nat \<Rightarrow> bool"  ("(_ <=/ _)")
   423   "op \<le> \<Colon>  nat \<Rightarrow> nat \<Rightarrow> bool"  ("(_ <=/ _)")
   424   "op < \<Colon>  nat \<Rightarrow> nat \<Rightarrow> bool"  ("(_ </ _)")
   424   "op < \<Colon>  nat \<Rightarrow> nat \<Rightarrow> bool"  ("(_ </ _)")
   425 
   425 
   426 
   426 
       
   427 text {* Evaluation *}
       
   428 
       
   429 lemma [code func, code func del]:
       
   430   "(Code_Eval.term_of \<Colon> nat \<Rightarrow> term) = Code_Eval.term_of" ..
       
   431 
       
   432 code_const "Code_Eval.term_of \<Colon> nat \<Rightarrow> term"
       
   433   (SML "HOLogic.mk'_number/ HOLogic.natT")
       
   434 
       
   435 
   427 text {* Module names *}
   436 text {* Module names *}
   428 
   437 
   429 code_modulename SML
   438 code_modulename SML
   430   Nat Integer
   439   Nat Integer
   431   Divides Integer
   440   Divides Integer