| author | nipkow |
| Mon, 16 Aug 2004 14:21:54 +0200 | |
| changeset 15130 | dc6be28d7f4e |
| parent 14981 | e73f8140af78 |
| child 15131 | c69542757a4d |
| permissions | -rw-r--r-- |
| 11355 | 1 |
(* Title: HOL/Library/Nat_Infinity.thy |
2 |
ID: $Id$ |
|
3 |
Author: David von Oheimb, TU Muenchen |
|
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
4 |
*) |
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
5 |
|
| 14706 | 6 |
header {* Natural numbers with infinity *}
|
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
7 |
|
| 11355 | 8 |
theory Nat_Infinity = Main: |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
9 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
10 |
subsection "Definitions" |
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
11 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
12 |
text {*
|
| 11355 | 13 |
We extend the standard natural numbers by a special value indicating |
14 |
infinity. This includes extending the ordering relations @{term "op
|
|
15 |
<"} and @{term "op \<le>"}.
|
|
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
16 |
*} |
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
17 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
18 |
datatype inat = Fin nat | Infty |
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
19 |
|
| 14691 | 20 |
instance inat :: "{ord, zero}" ..
|
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
21 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
22 |
consts |
| 11355 | 23 |
iSuc :: "inat => inat" |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
24 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
25 |
syntax (xsymbols) |
| 11355 | 26 |
Infty :: inat ("\<infinity>")
|
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
27 |
|
| 14565 | 28 |
syntax (HTML output) |
29 |
Infty :: inat ("\<infinity>")
|
|
30 |
||
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
31 |
defs |
|
11701
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents:
11655
diff
changeset
|
32 |
Zero_inat_def: "0 == Fin 0" |
| 11355 | 33 |
iSuc_def: "iSuc i == case i of Fin n => Fin (Suc n) | \<infinity> => \<infinity>" |
34 |
iless_def: "m < n == |
|
35 |
case m of Fin m1 => (case n of Fin n1 => m1 < n1 | \<infinity> => True) |
|
36 |
| \<infinity> => False" |
|
37 |
ile_def: "(m::inat) \<le> n == \<not> (n < m)" |
|
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
38 |
|
|
11701
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents:
11655
diff
changeset
|
39 |
lemmas inat_defs = Zero_inat_def iSuc_def iless_def ile_def |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
40 |
lemmas inat_splits = inat.split inat.split_asm |
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
41 |
|
| 11355 | 42 |
text {*
|
| 11357 | 43 |
Below is a not quite complete set of theorems. Use the method |
44 |
@{text "(simp add: inat_defs split:inat_splits, arith?)"} to prove
|
|
45 |
new theorems or solve arithmetic subgoals involving @{typ inat} on
|
|
46 |
the fly. |
|
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
47 |
*} |
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
48 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
49 |
subsection "Constructors" |
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
50 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
51 |
lemma Fin_0: "Fin 0 = 0" |
| 11357 | 52 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
53 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
54 |
lemma Infty_ne_i0 [simp]: "\<infinity> \<noteq> 0" |
| 11357 | 55 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
56 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
57 |
lemma i0_ne_Infty [simp]: "0 \<noteq> \<infinity>" |
| 11357 | 58 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
59 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
60 |
lemma iSuc_Fin [simp]: "iSuc (Fin n) = Fin (Suc n)" |
| 11357 | 61 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
62 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
63 |
lemma iSuc_Infty [simp]: "iSuc \<infinity> = \<infinity>" |
| 11357 | 64 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
65 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
66 |
lemma iSuc_ne_0 [simp]: "iSuc n \<noteq> 0" |
| 11357 | 67 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
68 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
69 |
lemma iSuc_inject [simp]: "(iSuc x = iSuc y) = (x = y)" |
| 11357 | 70 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
71 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
72 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
73 |
subsection "Ordering relations" |
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
74 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
75 |
lemma Infty_ilessE [elim!]: "\<infinity> < Fin m ==> R" |
| 11357 | 76 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
77 |
|
| 11355 | 78 |
lemma iless_linear: "m < n \<or> m = n \<or> n < (m::inat)" |
| 11357 | 79 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
80 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
81 |
lemma iless_not_refl [simp]: "\<not> n < (n::inat)" |
| 11357 | 82 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
83 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
84 |
lemma iless_trans: "i < j ==> j < k ==> i < (k::inat)" |
| 11357 | 85 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
86 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
87 |
lemma iless_not_sym: "n < m ==> \<not> m < (n::inat)" |
| 11357 | 88 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
89 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
90 |
lemma Fin_iless_mono [simp]: "(Fin n < Fin m) = (n < m)" |
| 11357 | 91 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
92 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
93 |
lemma Fin_iless_Infty [simp]: "Fin n < \<infinity>" |
| 11357 | 94 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
95 |
|
| 11655 | 96 |
lemma Infty_eq [simp]: "(n < \<infinity>) = (n \<noteq> \<infinity>)" |
| 11357 | 97 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
98 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
99 |
lemma i0_eq [simp]: "((0::inat) < n) = (n \<noteq> 0)" |
| 11357 | 100 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
101 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
102 |
lemma i0_iless_iSuc [simp]: "0 < iSuc n" |
| 11357 | 103 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
104 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
105 |
lemma not_ilessi0 [simp]: "\<not> n < (0::inat)" |
| 11357 | 106 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
107 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
108 |
lemma Fin_iless: "n < Fin m ==> \<exists>k. n = Fin k" |
| 11357 | 109 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
110 |
|
| 11655 | 111 |
lemma iSuc_mono [simp]: "(iSuc n < iSuc m) = (n < m)" |
| 11357 | 112 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
113 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
114 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
115 |
(* ----------------------------------------------------------------------- *) |
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
116 |
|
| 11655 | 117 |
lemma ile_def2: "(m \<le> n) = (m < n \<or> m = (n::inat))" |
| 11357 | 118 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
119 |
|
| 11355 | 120 |
lemma ile_refl [simp]: "n \<le> (n::inat)" |
| 11357 | 121 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
122 |
|
| 11355 | 123 |
lemma ile_trans: "i \<le> j ==> j \<le> k ==> i \<le> (k::inat)" |
| 11357 | 124 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
125 |
|
| 11355 | 126 |
lemma ile_iless_trans: "i \<le> j ==> j < k ==> i < (k::inat)" |
| 11357 | 127 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
128 |
|
| 11355 | 129 |
lemma iless_ile_trans: "i < j ==> j \<le> k ==> i < (k::inat)" |
| 11357 | 130 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
131 |
|
| 11355 | 132 |
lemma Infty_ub [simp]: "n \<le> \<infinity>" |
| 11357 | 133 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
134 |
|
| 11355 | 135 |
lemma i0_lb [simp]: "(0::inat) \<le> n" |
| 11357 | 136 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
137 |
|
| 11355 | 138 |
lemma Infty_ileE [elim!]: "\<infinity> \<le> Fin m ==> R" |
| 11357 | 139 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
140 |
|
| 11355 | 141 |
lemma Fin_ile_mono [simp]: "(Fin n \<le> Fin m) = (n \<le> m)" |
| 11357 | 142 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
143 |
|
| 11355 | 144 |
lemma ilessI1: "n \<le> m ==> n \<noteq> m ==> n < (m::inat)" |
| 11357 | 145 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
146 |
|
| 11355 | 147 |
lemma ileI1: "m < n ==> iSuc m \<le> n" |
| 11357 | 148 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
149 |
|
| 11655 | 150 |
lemma Suc_ile_eq: "(Fin (Suc m) \<le> n) = (Fin m < n)" |
| 11357 | 151 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
152 |
|
| 11655 | 153 |
lemma iSuc_ile_mono [simp]: "(iSuc n \<le> iSuc m) = (n \<le> m)" |
| 11357 | 154 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
155 |
|
| 11655 | 156 |
lemma iless_Suc_eq [simp]: "(Fin m < iSuc n) = (Fin m \<le> n)" |
| 11357 | 157 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
158 |
|
| 11355 | 159 |
lemma not_iSuc_ilei0 [simp]: "\<not> iSuc n \<le> 0" |
| 11357 | 160 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
161 |
|
| 11355 | 162 |
lemma ile_iSuc [simp]: "n \<le> iSuc n" |
| 11357 | 163 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
164 |
|
| 11355 | 165 |
lemma Fin_ile: "n \<le> Fin m ==> \<exists>k. n = Fin k" |
| 11357 | 166 |
by (simp add: inat_defs split:inat_splits, arith?) |
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
167 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
168 |
lemma chain_incr: "\<forall>i. \<exists>j. Y i < Y j ==> \<exists>j. Fin k < Y j" |
| 11355 | 169 |
apply (induct_tac k) |
170 |
apply (simp (no_asm) only: Fin_0) |
|
171 |
apply (fast intro: ile_iless_trans i0_lb) |
|
172 |
apply (erule exE) |
|
173 |
apply (drule spec) |
|
174 |
apply (erule exE) |
|
175 |
apply (drule ileI1) |
|
176 |
apply (rule iSuc_Fin [THEN subst]) |
|
177 |
apply (rule exI) |
|
178 |
apply (erule (1) ile_iless_trans) |
|
179 |
done |
|
|
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
180 |
|
|
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset
|
181 |
end |