src/FOL/ex/NatClass.thy
author wenzelm
Tue, 13 Sep 2005 22:19:23 +0200
changeset 17339 ab97ccef124a
parent 17274 746bb4c56800
child 19819 14de4d05d275
permissions -rw-r--r--
tuned Isar interfaces; tuned IsarThy.theorem_i;
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
17245
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
     6
theory NatClass
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
     7
imports FOL
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
     8
begin
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
     9
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
    10
text {*
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
    11
  This is an abstract version of theory @{text "Nat"}. Instead of
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
    12
  axiomatizing a single type @{text nat} we define the class of all
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
    13
  these types (up to isomorphism).
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
    14
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
    15
  Note: The @{text rec} operator had to be made \emph{monomorphic},
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
    16
  because class axioms may not contain more than one type variable.
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
    17
*}
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    18
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    19
consts
17245
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
    20
  0 :: 'a    ("0")
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
    21
  Suc :: "'a => 'a"
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
    22
  rec :: "['a, 'a, ['a, 'a] => 'a] => 'a"
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    23
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    24
axclass
17245
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
    25
  nat < "term"
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
    26
  induct:        "[| P(0); !!x. P(x) ==> P(Suc(x)) |] ==> P(n)"
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
    27
  Suc_inject:    "Suc(m) = Suc(n) ==> m = n"
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
    28
  Suc_neq_0:     "Suc(m) = 0 ==> R"
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
    29
  rec_0:         "rec(0, a, f) = a"
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
    30
  rec_Suc:       "rec(Suc(m), a, f) = f(m, rec(m, a, f))"
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    31
17245
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
    32
constdefs
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
    33
  add :: "['a::nat, 'a] => 'a"    (infixl "+" 60)
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
    34
  "m + n == rec(m, n, %x y. Suc(y))"
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    35
17245
1c519a3cca59 converted to Isar theory format;
wenzelm
parents: 1322
diff changeset
    36
ML {* use_legacy_bindings (the_context ()) *}
17274
746bb4c56800 axclass: name space prefix is now "c_class" instead of just "c";
wenzelm
parents: 17245
diff changeset
    37
ML {* open nat_class *}
1246
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    38
706cfddca75c the NatClass demo of the axclass tutorial;
wenzelm
parents:
diff changeset
    39
end