added temp. nbe test
authornipkow
Mon, 27 Feb 2006 14:34:03 +0100
changeset 19148 f03a9a1cbe0e
parent 19147 0f584853b6a4
child 19149 1c31769f9796
added temp. nbe test
src/HOL/ex/ROOT.ML
src/HOL/ex/nbe.thy
--- a/src/HOL/ex/ROOT.ML	Mon Feb 27 14:03:31 2006 +0100
+++ b/src/HOL/ex/ROOT.ML	Mon Feb 27 14:34:03 2006 +0100
@@ -57,6 +57,7 @@
 
 time_use_thy "Refute_Examples";
 time_use_thy "Quickcheck_Examples";
+time_use_thy "nbe";
 
 no_document use_thy "Word";
 time_use_thy "Adder";
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/HOL/ex/nbe.thy	Mon Feb 27 14:34:03 2006 +0100
@@ -0,0 +1,34 @@
+(*  ID:         $Id$
+
+Temporary test of nbe module.
+*)
+
+theory nbe
+imports Main
+begin
+
+datatype n = Z | S n
+consts
+ add :: "n \<Rightarrow> n \<Rightarrow> n"
+ mul :: "n \<Rightarrow> n \<Rightarrow> n"
+ exp :: "n \<Rightarrow> n \<Rightarrow> n"
+primrec
+"add Z = id"
+"add (S m) = S o add m"
+primrec
+"mul Z = (%n. Z)"
+"mul (S m) = (%n. add (mul m n) n)"
+primrec
+"exp m Z = S Z"
+"exp m (S n) = mul (exp m n) m"
+
+(*ML"set Toplevel.timing"*)
+;norm_by_eval "exp (S(S(S(S(S(S(S Z))))))) (S(S(S(S(S Z)))))";
+norm_by_eval "0 + (n::nat)";
+norm_by_eval "0 + Suc(n)";
+norm_by_eval "Suc(n) + Suc m";
+norm_by_eval "[] @ xs";
+norm_by_eval "(x#xs) @ ys";
+norm_by_eval "[x,y,z] @ [a,b,c]";
+
+end