src/FOLP/ex/Nat.thy
author clasohm
Thu, 16 Sep 1993 12:20:38 +0200
changeset 0 a5a9c433f639
child 353 b5030aaca2ab
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: 	FOLP/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
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    11
Nat = IFOLP +
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    12
types   nat 0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    13
arities nat         :: term
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    14
consts  "0"         :: "nat"    ("0")
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    15
        Suc         :: "nat=>nat"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    16
        rec         :: "[nat, 'a, [nat,'a]=>'a] => 'a"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    17
        "+"         :: "[nat, nat] => nat"              (infixl 60)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    18
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    19
  (*Proof terms*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    20
       nrec         :: "[nat,p,[nat,p]=>p]=>p"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    21
       ninj,nneq    :: "p=>p"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    22
       rec0, recSuc :: "p"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    23
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    24
rules   
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    25
  induct     "[| b:P(0); !!x u. u:P(x) ==> c(x,u):P(Suc(x)) \
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    26
\             |] ==> nrec(n,b,c):P(n)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    27
  
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    28
  Suc_inject "p:Suc(m)=Suc(n) ==> ninj(p) : m=n"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    29
  Suc_neq_0  "p:Suc(m)=0      ==> nneq(p) : R"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    30
  rec_0      "rec0 : rec(0,a,f) = a"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    31
  rec_Suc    "recSuc : rec(Suc(m), a, f) = f(m, rec(m,a,f))"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    32
  add_def    "m+n == rec(m, n, %x y. Suc(y))"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    33
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    34
  nrecB0     "b: A ==> nrec(0,b,c) = b : A"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    35
  nrecBSuc   "c(n,nrec(n,b,c)) : A ==> nrec(Suc(n),b,c) = c(n,nrec(n,b,c)) : A"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    36
end