src/HOL/NatDef.thy
author kleing
Mon, 15 Oct 2001 21:04:32 +0200
changeset 11787 85b3735a51e1
parent 11701 3d51fbf81c17
child 12338 de0f4a63baa5
permissions -rw-r--r--
canonical 'cases'/'induct' rules for n-tuples (n=3..7) (really belongs to theory Product_Type, but doesn't work there yet)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2608
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
     1
(*  Title:      HOL/NatDef.thy
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
     2
    ID:         $Id$
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
     3
    Author:     Tobias Nipkow, Cambridge University Computer Laboratory
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
     4
    Copyright   1991  University of Cambridge
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
     5
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
     6
Definition of types ind and nat.
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
     7
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
     8
Type nat is defined as a set Nat over type ind.
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
     9
*)
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    10
10212
33fe2d701ddd *** empty log message ***
nipkow
parents: 8943
diff changeset
    11
NatDef = Wellfounded_Recursion +
2608
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    12
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    13
(** type ind **)
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    14
3947
eb707467f8c5 adapted to qualified names;
wenzelm
parents: 3842
diff changeset
    15
global
eb707467f8c5 adapted to qualified names;
wenzelm
parents: 3842
diff changeset
    16
2608
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    17
types
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    18
  ind
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    19
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    20
arities
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    21
  ind :: term
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    22
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    23
consts
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    24
  Zero_Rep      :: ind
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    25
  Suc_Rep       :: ind => ind
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    26
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    27
rules
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    28
  (*the axiom of infinity in 2 parts*)
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    29
  inj_Suc_Rep           "inj(Suc_Rep)"
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    30
  Suc_Rep_not_Zero_Rep  "Suc_Rep(x) ~= Zero_Rep"
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    31
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    32
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    33
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    34
(** type nat **)
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    35
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    36
(* type definition *)
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    37
11326
680ebd093cfe Representing set for type nat is now defined via "inductive".
berghofe
parents: 10832
diff changeset
    38
consts
680ebd093cfe Representing set for type nat is now defined via "inductive".
berghofe
parents: 10832
diff changeset
    39
  Nat' :: "ind set"
680ebd093cfe Representing set for type nat is now defined via "inductive".
berghofe
parents: 10832
diff changeset
    40
680ebd093cfe Representing set for type nat is now defined via "inductive".
berghofe
parents: 10832
diff changeset
    41
inductive Nat'
680ebd093cfe Representing set for type nat is now defined via "inductive".
berghofe
parents: 10832
diff changeset
    42
intrs
680ebd093cfe Representing set for type nat is now defined via "inductive".
berghofe
parents: 10832
diff changeset
    43
  Zero_RepI "Zero_Rep : Nat'"
680ebd093cfe Representing set for type nat is now defined via "inductive".
berghofe
parents: 10832
diff changeset
    44
  Suc_RepI  "i : Nat' ==> Suc_Rep i : Nat'"
680ebd093cfe Representing set for type nat is now defined via "inductive".
berghofe
parents: 10832
diff changeset
    45
2608
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    46
typedef (Nat)
11326
680ebd093cfe Representing set for type nat is now defined via "inductive".
berghofe
parents: 10832
diff changeset
    47
  nat = "Nat'"   (Nat'.Zero_RepI)
2608
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    48
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    49
instance
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 11464
diff changeset
    50
  nat :: {ord, zero, one}
2608
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    51
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    52
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    53
(* abstract constants and syntax *)
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    54
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    55
consts
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    56
  Suc       :: nat => nat
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    57
  pred_nat  :: "(nat * nat) set"
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    58
3947
eb707467f8c5 adapted to qualified names;
wenzelm
parents: 3842
diff changeset
    59
local
eb707467f8c5 adapted to qualified names;
wenzelm
parents: 3842
diff changeset
    60
2608
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    61
defs
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 11464
diff changeset
    62
  Zero_nat_def  "0 == Abs_Nat(Zero_Rep)"
2608
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    63
  Suc_def       "Suc == (%n. Abs_Nat(Suc_Rep(Rep_Nat(n))))"
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 11464
diff changeset
    64
  One_nat_def	"1 == Suc 0"
2608
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    65
7872
2e2d7e80fb07 Removed obsolete comment.
berghofe
parents: 5187
diff changeset
    66
  (*nat operations*)
3236
882e125ed7da New pattern-matching definition of pred_nat
paulson
parents: 2608
diff changeset
    67
  pred_nat_def  "pred_nat == {(m,n). n = Suc m}"
2608
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    68
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    69
  less_def      "m<n == (m,n):trancl(pred_nat)"
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    70
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    71
  le_def        "m<=(n::nat) == ~(n<m)"
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    72
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents:
diff changeset
    73
end