src/FOL/ex/NatClass.thy
author paulson
Fri, 29 Oct 2004 15:16:02 +0200
changeset 15270 8b3f707a78a7
parent 1322 9b3d3362a048
child 17245 1c519a3cca59
permissions -rw-r--r--
fixed reference to renamed theorem
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
     1
(*  Title:      FOL/ex/NatClass.thy
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
     3
    Author:     Markus Wenzel, TU Muenchen
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
     4
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
     5
This is an abstract version of Nat.thy. Instead of axiomatizing a
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
     6
single type "nat" we define the class of all these types (up to
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
     7
isomorphism).
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
     8
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
     9
Note: The "rec" operator had to be made 'monomorphic', because class
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    10
axioms may not contain more than one type variable.
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    11
*)
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    12
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    13
NatClass = FOL +
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    14
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    15
consts
1322
9b3d3362a048 removed quotes from types in consts section
clasohm
parents: 1246
diff changeset
    16
  "0"           :: 'a                                   ("0")
9b3d3362a048 removed quotes from types in consts section
clasohm
parents: 1246
diff changeset
    17
  Suc           :: 'a => 'a  
9b3d3362a048 removed quotes from types in consts section
clasohm
parents: 1246
diff changeset
    18
  rec           :: ['a, 'a, ['a, 'a] => 'a] => 'a  
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    19
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    20
axclass
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    21
  nat < term
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    22
  induct        "[| P(0); !!x. P(x) ==> P(Suc(x)) |] ==> P(n)"
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    23
  Suc_inject    "Suc(m) = Suc(n) ==> m = n"
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    24
  Suc_neq_0     "Suc(m) = 0 ==> R"
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    25
  rec_0         "rec(0, a, f) = a"
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    26
  rec_Suc       "rec(Suc(m), a, f) = f(m, rec(m, a, f))"
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    27
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    28
consts
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    29
  "+"           :: "['a::nat, 'a] => 'a"                (infixl 60)
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    30
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    31
defs
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    32
  add_def       "m + n == rec(m, n, %x y. Suc(y))"
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    33
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    34
end