equal
deleted
inserted
replaced
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 |