src/FOLP/ex/nat.thy
author clasohm
Thu Sep 16 12:20:38 1993 +0200 (1993-09-16)
changeset 0 a5a9c433f639
permissions -rw-r--r--
Initial revision
clasohm@0
     1
(*  Title: 	FOLP/ex/nat.thy
clasohm@0
     2
    ID:         $Id$
clasohm@0
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
clasohm@0
     4
    Copyright   1992  University of Cambridge
clasohm@0
     5
clasohm@0
     6
Examples for the manual "Introduction to Isabelle"
clasohm@0
     7
clasohm@0
     8
Theory of the natural numbers: Peano's axioms, primitive recursion
clasohm@0
     9
*)
clasohm@0
    10
clasohm@0
    11
Nat = IFOLP +
clasohm@0
    12
types   nat 0
clasohm@0
    13
arities nat         :: term
clasohm@0
    14
consts  "0"         :: "nat"    ("0")
clasohm@0
    15
        Suc         :: "nat=>nat"
clasohm@0
    16
        rec         :: "[nat, 'a, [nat,'a]=>'a] => 'a"
clasohm@0
    17
        "+"         :: "[nat, nat] => nat"              (infixl 60)
clasohm@0
    18
clasohm@0
    19
  (*Proof terms*)
clasohm@0
    20
       nrec         :: "[nat,p,[nat,p]=>p]=>p"
clasohm@0
    21
       ninj,nneq    :: "p=>p"
clasohm@0
    22
       rec0, recSuc :: "p"
clasohm@0
    23
clasohm@0
    24
rules   
clasohm@0
    25
  induct     "[| b:P(0); !!x u. u:P(x) ==> c(x,u):P(Suc(x)) \
clasohm@0
    26
\             |] ==> nrec(n,b,c):P(n)"
clasohm@0
    27
  
clasohm@0
    28
  Suc_inject "p:Suc(m)=Suc(n) ==> ninj(p) : m=n"
clasohm@0
    29
  Suc_neq_0  "p:Suc(m)=0      ==> nneq(p) : R"
clasohm@0
    30
  rec_0      "rec0 : rec(0,a,f) = a"
clasohm@0
    31
  rec_Suc    "recSuc : rec(Suc(m), a, f) = f(m, rec(m,a,f))"
clasohm@0
    32
  add_def    "m+n == rec(m, n, %x y. Suc(y))"
clasohm@0
    33
clasohm@0
    34
  nrecB0     "b: A ==> nrec(0,b,c) = b : A"
clasohm@0
    35
  nrecBSuc   "c(n,nrec(n,b,c)) : A ==> nrec(Suc(n),b,c) = c(n,nrec(n,b,c)) : A"
clasohm@0
    36
end