src/FOL/ex/Nat.thy
author clasohm
Thu, 16 Sep 1993 12:20:38 +0200
changeset 0 a5a9c433f639
child 352 fd3ab8bcb69d
permissions -rw-r--r--
Initial revision
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     1
(*  Title: 	FOL/ex/nat.thy
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     4
    Copyright   1992  University of Cambridge
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     5
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     6
Examples for the manual "Introduction to Isabelle"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     8
Theory of the natural numbers: Peano's axioms, primitive recursion
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     9
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    10
INCOMPATIBLE with nat2.thy, Nipkow's example
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    11
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    12
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    13
Nat = FOL +
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    14
types   nat 0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    15
arities nat         :: term
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    16
consts  "0"         :: "nat"    ("0")
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    17
        Suc         :: "nat=>nat"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    18
        rec         :: "[nat, 'a, [nat,'a]=>'a] => 'a"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    19
        "+"         :: "[nat, nat] => nat"              (infixl 60)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    20
rules   induct      "[| P(0);  !!x. P(x) ==> P(Suc(x)) |]  ==> P(n)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    21
        Suc_inject  "Suc(m)=Suc(n) ==> m=n"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    22
        Suc_neq_0   "Suc(m)=0      ==> R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    23
        rec_0       "rec(0,a,f) = a"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    24
        rec_Suc     "rec(Suc(m), a, f) = f(m, rec(m,a,f))"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    25
        add_def     "m+n == rec(m, n, %x y. Suc(y))"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    26
end