src/HOL/Nat.thy
author clasohm
Tue, 24 Oct 1995 14:45:35 +0100
changeset 1294 1358dc040edb
parent 1151 c820b3cc3df0
child 1370 7361ac9b024d
permissions -rw-r--r--
added calls of init_html and make_chart; added usage of qed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     1
(*  Title:      HOL/Nat.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     2
    ID:         $Id$
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     3
    Author:     Tobias Nipkow, Cambridge University Computer Laboratory
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     4
    Copyright   1991  University of Cambridge
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     5
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     6
Definition of types ind and nat.
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     7
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     8
Type nat is defined as a set Nat over type ind.
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     9
*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    10
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    11
Nat = WF +
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    12
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    13
(** type ind **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    14
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    15
types
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    16
  ind
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    17
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    18
arities
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    19
  ind :: term
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    20
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    21
consts
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    22
  Zero_Rep      :: "ind"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    23
  Suc_Rep       :: "ind => ind"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    24
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    25
rules
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    26
  (*the axiom of infinity in 2 parts*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    27
  inj_Suc_Rep           "inj(Suc_Rep)"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    28
  Suc_Rep_not_Zero_Rep  "Suc_Rep(x) ~= Zero_Rep"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    29
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    30
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    31
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    32
(** type nat **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    33
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    34
(* type definition *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    35
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    36
subtype (Nat)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    37
  nat = "lfp(%X. {Zero_Rep} Un (Suc_Rep``X))"   (lfp_def)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    38
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    39
instance
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    40
  nat :: ord
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    41
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    42
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    43
(* abstract constants and syntax *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    44
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    45
consts
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    46
  "0"           :: "nat"                ("0")
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    47
  Suc           :: "nat => nat"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    48
  nat_case      :: "['a, nat => 'a, nat] => 'a"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    49
  pred_nat      :: "(nat * nat) set"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    50
  nat_rec       :: "[nat, 'a, [nat, 'a] => 'a] => 'a"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    51
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    52
translations
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    53
  "case p of 0 => a | Suc(y) => b" == "nat_case a (%y.b) p"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    54
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    55
defs
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    56
  Zero_def      "0 == Abs_Nat(Zero_Rep)"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    57
  Suc_def       "Suc == (%n. Abs_Nat(Suc_Rep(Rep_Nat(n))))"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    58
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    59
  (*nat operations and recursion*)
1151
c820b3cc3df0 removed \...\ inside strings
clasohm
parents: 972
diff changeset
    60
  nat_case_def  "nat_case a f n == @z.  (n=0 --> z=a)  
c820b3cc3df0 removed \...\ inside strings
clasohm
parents: 972
diff changeset
    61
                                        & (!x. n=Suc(x) --> z=f(x))"
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
    62
  pred_nat_def  "pred_nat == {p. ? n. p = (n, Suc(n))}"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    63
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
    64
  less_def "m<n == (m,n):trancl(pred_nat)"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    65
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    66
  le_def   "m<=(n::nat) == ~(n<m)"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    67
1151
c820b3cc3df0 removed \...\ inside strings
clasohm
parents: 972
diff changeset
    68
  nat_rec_def   "nat_rec n c d == wfrec pred_nat n  
c820b3cc3df0 removed \...\ inside strings
clasohm
parents: 972
diff changeset
    69
                        (nat_case (%g.c) (%m g.(d m (g m))))"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    70
end