src/FOLP/ex/Nat.thy
changeset 17480 fd19f77dcf60
parent 1477 4c51ab632cda
child 25991 31b38a39e589
--- a/src/FOLP/ex/Nat.thy	Sat Sep 17 20:49:14 2005 +0200
+++ b/src/FOLP/ex/Nat.thy	Sun Sep 18 14:25:48 2005 +0200
@@ -2,15 +2,16 @@
     ID:         $Id$
     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     Copyright   1992  University of Cambridge
-
-Examples for the manual "Introduction to Isabelle"
-
-Theory of the natural numbers: Peano's axioms, primitive recursion
 *)
 
-Nat = IFOLP +
-types   nat
-arities nat         :: term
+header {* Theory of the natural numbers: Peano's axioms, primitive recursion *}
+
+theory Nat
+imports FOLP
+begin
+
+typedecl nat
+arities nat         :: "term"
 consts  "0"         :: "nat"    ("0")
         Suc         :: "nat=>nat"
         rec         :: "[nat, 'a, [nat,'a]=>'a] => 'a"
@@ -18,19 +19,24 @@
 
   (*Proof terms*)
        nrec         :: "[nat,p,[nat,p]=>p]=>p"
-       ninj,nneq    :: "p=>p"
-       rec0, recSuc :: "p"
+       ninj         :: "p=>p"
+       nneq         :: "p=>p"
+       rec0         :: "p"
+       recSuc       :: "p"
+
+axioms
+  induct:     "[| b:P(0); !!x u. u:P(x) ==> c(x,u):P(Suc(x))
+              |] ==> nrec(n,b,c):P(n)"
 
-rules   
-  induct     "[| b:P(0); !!x u. u:P(x) ==> c(x,u):P(Suc(x)) 
-             |] ==> nrec(n,b,c):P(n)"
-  
-  Suc_inject "p:Suc(m)=Suc(n) ==> ninj(p) : m=n"
-  Suc_neq_0  "p:Suc(m)=0      ==> nneq(p) : R"
-  rec_0      "rec0 : rec(0,a,f) = a"
-  rec_Suc    "recSuc : rec(Suc(m), a, f) = f(m, rec(m,a,f))"
-  add_def    "m+n == rec(m, n, %x y. Suc(y))"
+  Suc_inject: "p:Suc(m)=Suc(n) ==> ninj(p) : m=n"
+  Suc_neq_0:  "p:Suc(m)=0      ==> nneq(p) : R"
+  rec_0:      "rec0 : rec(0,a,f) = a"
+  rec_Suc:    "recSuc : rec(Suc(m), a, f) = f(m, rec(m,a,f))"
+  add_def:    "m+n == rec(m, n, %x y. Suc(y))"
 
-  nrecB0     "b: A ==> nrec(0,b,c) = b : A"
-  nrecBSuc   "c(n,nrec(n,b,c)) : A ==> nrec(Suc(n),b,c) = c(n,nrec(n,b,c)) : A"
+  nrecB0:     "b: A ==> nrec(0,b,c) = b : A"
+  nrecBSuc:   "c(n,nrec(n,b,c)) : A ==> nrec(Suc(n),b,c) = c(n,nrec(n,b,c)) : A"
+
+ML {* use_legacy_bindings (the_context ()) *}
+
 end