src/FOLP/ex/Nat.thy
author clasohm
Mon, 05 Feb 1996 21:33:14 +0100
changeset 1477 4c51ab632cda
parent 1149 5750eba8820d
child 17480 fd19f77dcf60
permissions -rw-r--r--
expanded tabs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1477
4c51ab632cda expanded tabs
clasohm
parents: 1149
diff changeset
     1
(*  Title:      FOLP/ex/nat.thy
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1477
4c51ab632cda expanded tabs
clasohm
parents: 1149
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
0
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 +
353
b5030aaca2ab removal of obsolete type-declaration syntax
lcp
parents: 0
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   
1149
5750eba8820d removed \...\ inside strings
clasohm
parents: 353
diff changeset
    25
  induct     "[| b:P(0); !!x u. u:P(x) ==> c(x,u):P(Suc(x)) 
5750eba8820d removed \...\ inside strings
clasohm
parents: 353
diff changeset
    26
             |] ==> nrec(n,b,c):P(n)"
0
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