src/HOL/Nat.thy
author oheimb
Tue, 23 Apr 1996 16:58:21 +0200
changeset 1672 2c109cd2fdd0
parent 1660 8cb42cd97579
child 1674 33aff4d854e4
permissions -rw-r--r--
repaired critical proofs depending on the order inside non-confluent SimpSets, (temporarily) removed problematic rule less_Suc_eq form simpset_of "Nat"
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
1370
7361ac9b024d removed quotes from types in consts and syntax sections
clasohm
parents: 1151
diff changeset
    22
  Zero_Rep      :: ind
7361ac9b024d removed quotes from types in consts and syntax sections
clasohm
parents: 1151
diff changeset
    23
  Suc_Rep       :: ind => ind
923
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
1475
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1370
diff changeset
    36
typedef (Nat)
923
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
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1475
diff changeset
    46
  "0"       :: nat                ("0")
1625
40501958d0f6 Translations for 1 and 2 moved from Hoare/Examples.thy to Nat.thy
paulson
parents: 1540
diff changeset
    47
  "1"       :: nat                ("1")
40501958d0f6 Translations for 1 and 2 moved from Hoare/Examples.thy to Nat.thy
paulson
parents: 1540
diff changeset
    48
  "2"       :: nat                ("2")
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1475
diff changeset
    49
  Suc       :: nat => nat
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1475
diff changeset
    50
  nat_case  :: ['a, nat => 'a, nat] => 'a
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1475
diff changeset
    51
  pred_nat  :: "(nat * nat) set"
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1475
diff changeset
    52
  nat_rec   :: [nat, 'a, [nat, 'a] => 'a] => 'a
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1475
diff changeset
    53
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1475
diff changeset
    54
  Least     :: (nat=>bool) => nat    (binder "LEAST " 10)
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    55
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    56
translations
1625
40501958d0f6 Translations for 1 and 2 moved from Hoare/Examples.thy to Nat.thy
paulson
parents: 1540
diff changeset
    57
   "1"  == "Suc(0)"
40501958d0f6 Translations for 1 and 2 moved from Hoare/Examples.thy to Nat.thy
paulson
parents: 1540
diff changeset
    58
   "2"  == "Suc(1)"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    59
  "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
    60
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    61
defs
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    62
  Zero_def      "0 == Abs_Nat(Zero_Rep)"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    63
  Suc_def       "Suc == (%n. Abs_Nat(Suc_Rep(Rep_Nat(n))))"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    64
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    65
  (*nat operations and recursion*)
1151
c820b3cc3df0 removed \...\ inside strings
clasohm
parents: 972
diff changeset
    66
  nat_case_def  "nat_case a f n == @z.  (n=0 --> z=a)  
c820b3cc3df0 removed \...\ inside strings
clasohm
parents: 972
diff changeset
    67
                                        & (!x. n=Suc(x) --> z=f(x))"
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
    68
  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
    69
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1475
diff changeset
    70
  less_def      "m<n == (m,n):trancl(pred_nat)"
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1475
diff changeset
    71
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1475
diff changeset
    72
  le_def        "m<=(n::nat) == ~(n<m)"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    73
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1475
diff changeset
    74
  nat_rec_def   "nat_rec n c d ==
1540
eacaa07e9078 Converted TABs to spaces
paulson
parents: 1531
diff changeset
    75
                 wfrec pred_nat (%f. nat_case c (%m. d m (f m))) n"
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1475
diff changeset
    76
  (*least number operator*)
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1475
diff changeset
    77
  Least_def     "Least(P) == @k. P(k) & (ALL j. j<k --> ~P(j))"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    78
1660
8cb42cd97579 *** empty log message ***
oheimb
parents: 1625
diff changeset
    79
(* start 8bit 1 *)
1672
2c109cd2fdd0 repaired critical proofs depending on the order inside non-confluent SimpSets,
oheimb
parents: 1660
diff changeset
    80
syntax
2c109cd2fdd0 repaired critical proofs depending on the order inside non-confluent SimpSets,
oheimb
parents: 1660
diff changeset
    81
  "Gmu"	:: (nat => bool) => nat				(binder "´" 10)
2c109cd2fdd0 repaired critical proofs depending on the order inside non-confluent SimpSets,
oheimb
parents: 1660
diff changeset
    82
2c109cd2fdd0 repaired critical proofs depending on the order inside non-confluent SimpSets,
oheimb
parents: 1660
diff changeset
    83
translations
2c109cd2fdd0 repaired critical proofs depending on the order inside non-confluent SimpSets,
oheimb
parents: 1660
diff changeset
    84
  "´x.P"	== "LEAST x. P"
1660
8cb42cd97579 *** empty log message ***
oheimb
parents: 1625
diff changeset
    85
(* end 8bit 1 *)
8cb42cd97579 *** empty log message ***
oheimb
parents: 1625
diff changeset
    86
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    87
end