author | wenzelm |
Wed, 24 Jul 2002 22:13:02 +0200 | |
changeset 13419 | 902ec83c1ca9 |
parent 12338 | de0f4a63baa5 |
permissions | -rw-r--r-- |
2608 | 1 |
(* Title: HOL/NatDef.thy |
2 |
ID: $Id$ |
|
3 |
Author: Tobias Nipkow, Cambridge University Computer Laboratory |
|
4 |
Copyright 1991 University of Cambridge |
|
5 |
||
6 |
Definition of types ind and nat. |
|
7 |
||
8 |
Type nat is defined as a set Nat over type ind. |
|
9 |
*) |
|
10 |
||
10212 | 11 |
NatDef = Wellfounded_Recursion + |
2608 | 12 |
|
13 |
(** type ind **) |
|
14 |
||
12338
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
11701
diff
changeset
|
15 |
types ind |
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
11701
diff
changeset
|
16 |
arities ind :: type |
2608 | 17 |
|
18 |
consts |
|
19 |
Zero_Rep :: ind |
|
20 |
Suc_Rep :: ind => ind |
|
21 |
||
22 |
rules |
|
23 |
(*the axiom of infinity in 2 parts*) |
|
24 |
inj_Suc_Rep "inj(Suc_Rep)" |
|
25 |
Suc_Rep_not_Zero_Rep "Suc_Rep(x) ~= Zero_Rep" |
|
26 |
||
27 |
||
28 |
||
29 |
(** type nat **) |
|
30 |
||
31 |
(* type definition *) |
|
32 |
||
11326
680ebd093cfe
Representing set for type nat is now defined via "inductive".
berghofe
parents:
10832
diff
changeset
|
33 |
consts |
680ebd093cfe
Representing set for type nat is now defined via "inductive".
berghofe
parents:
10832
diff
changeset
|
34 |
Nat' :: "ind set" |
680ebd093cfe
Representing set for type nat is now defined via "inductive".
berghofe
parents:
10832
diff
changeset
|
35 |
|
680ebd093cfe
Representing set for type nat is now defined via "inductive".
berghofe
parents:
10832
diff
changeset
|
36 |
inductive Nat' |
680ebd093cfe
Representing set for type nat is now defined via "inductive".
berghofe
parents:
10832
diff
changeset
|
37 |
intrs |
680ebd093cfe
Representing set for type nat is now defined via "inductive".
berghofe
parents:
10832
diff
changeset
|
38 |
Zero_RepI "Zero_Rep : Nat'" |
680ebd093cfe
Representing set for type nat is now defined via "inductive".
berghofe
parents:
10832
diff
changeset
|
39 |
Suc_RepI "i : Nat' ==> Suc_Rep i : Nat'" |
680ebd093cfe
Representing set for type nat is now defined via "inductive".
berghofe
parents:
10832
diff
changeset
|
40 |
|
12338
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
11701
diff
changeset
|
41 |
global |
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
11701
diff
changeset
|
42 |
|
2608 | 43 |
typedef (Nat) |
11326
680ebd093cfe
Representing set for type nat is now defined via "inductive".
berghofe
parents:
10832
diff
changeset
|
44 |
nat = "Nat'" (Nat'.Zero_RepI) |
2608 | 45 |
|
46 |
instance |
|
11701
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents:
11464
diff
changeset
|
47 |
nat :: {ord, zero, one} |
2608 | 48 |
|
49 |
||
50 |
(* abstract constants and syntax *) |
|
51 |
||
52 |
consts |
|
53 |
Suc :: nat => nat |
|
54 |
pred_nat :: "(nat * nat) set" |
|
55 |
||
3947 | 56 |
local |
57 |
||
2608 | 58 |
defs |
11701
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents:
11464
diff
changeset
|
59 |
Zero_nat_def "0 == Abs_Nat(Zero_Rep)" |
2608 | 60 |
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
|
61 |
One_nat_def "1 == Suc 0" |
2608 | 62 |
|
7872 | 63 |
(*nat operations*) |
3236 | 64 |
pred_nat_def "pred_nat == {(m,n). n = Suc m}" |
2608 | 65 |
|
66 |
less_def "m<n == (m,n):trancl(pred_nat)" |
|
67 |
||
68 |
le_def "m<=(n::nat) == ~(n<m)" |
|
69 |
||
70 |
end |