author  huffman 
Sat, 06 Dec 2008 20:26:51 0800  
changeset 29014  e515f42d1db7 
parent 29012  9140227dc8c5 
child 29023  ef3adebc6d98 
permissions  rwrr 
11355  1 
(* Title: HOL/Library/Nat_Infinity.thy 
2 
ID: $Id$ 

27110  3 
Author: David von Oheimb, TU Muenchen; Florian Haftmann, 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 

15131  8 
theory Nat_Infinity 
27487  9 
imports Plain "~~/src/HOL/Presburger" 
15131  10 
begin 
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

11 

27110  12 
subsection {* Type definition *} 
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

13 

c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

14 
text {* 
11355  15 
We extend the standard natural numbers by a special value indicating 
27110  16 
infinity. 
11351
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 

c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

19 
datatype inat = Fin nat  Infty 
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

20 

21210  21 
notation (xsymbols) 
19736  22 
Infty ("\<infinity>") 
23 

21210  24 
notation (HTML output) 
19736  25 
Infty ("\<infinity>") 
26 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

27 

27110  28 
subsection {* Constructors and numbers *} 
29 

30 
instantiation inat :: "{zero, one, number}" 

25594  31 
begin 
32 

33 
definition 

27110  34 
"0 = Fin 0" 
25594  35 

36 
definition 

27110  37 
[code inline]: "1 = Fin 1" 
25594  38 

39 
definition 

28562  40 
[code inline, code del]: "number_of k = Fin (number_of k)" 
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

41 

25594  42 
instance .. 
43 

44 
end 

45 

27110  46 
definition iSuc :: "inat \<Rightarrow> inat" where 
47 
"iSuc i = (case i of Fin n \<Rightarrow> Fin (Suc n)  \<infinity> \<Rightarrow> \<infinity>)" 

11351
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 
lemma Fin_0: "Fin 0 = 0" 
27110  50 
by (simp add: zero_inat_def) 
51 

52 
lemma Fin_1: "Fin 1 = 1" 

53 
by (simp add: one_inat_def) 

54 

55 
lemma Fin_number: "Fin (number_of k) = number_of k" 

56 
by (simp add: number_of_inat_def) 

57 

58 
lemma one_iSuc: "1 = iSuc 0" 

59 
by (simp add: zero_inat_def one_inat_def iSuc_def) 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

60 

c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

61 
lemma Infty_ne_i0 [simp]: "\<infinity> \<noteq> 0" 
27110  62 
by (simp add: zero_inat_def) 
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

63 

c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

64 
lemma i0_ne_Infty [simp]: "0 \<noteq> \<infinity>" 
27110  65 
by (simp add: zero_inat_def) 
66 

67 
lemma zero_inat_eq [simp]: 

68 
"number_of k = (0\<Colon>inat) \<longleftrightarrow> number_of k = (0\<Colon>nat)" 

69 
"(0\<Colon>inat) = number_of k \<longleftrightarrow> number_of k = (0\<Colon>nat)" 

70 
unfolding zero_inat_def number_of_inat_def by simp_all 

71 

72 
lemma one_inat_eq [simp]: 

73 
"number_of k = (1\<Colon>inat) \<longleftrightarrow> number_of k = (1\<Colon>nat)" 

74 
"(1\<Colon>inat) = number_of k \<longleftrightarrow> number_of k = (1\<Colon>nat)" 

75 
unfolding one_inat_def number_of_inat_def by simp_all 

76 

77 
lemma zero_one_inat_neq [simp]: 

78 
"\<not> 0 = (1\<Colon>inat)" 

79 
"\<not> 1 = (0\<Colon>inat)" 

80 
unfolding zero_inat_def one_inat_def by simp_all 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

81 

27110  82 
lemma Infty_ne_i1 [simp]: "\<infinity> \<noteq> 1" 
83 
by (simp add: one_inat_def) 

84 

85 
lemma i1_ne_Infty [simp]: "1 \<noteq> \<infinity>" 

86 
by (simp add: one_inat_def) 

87 

88 
lemma Infty_ne_number [simp]: "\<infinity> \<noteq> number_of k" 

89 
by (simp add: number_of_inat_def) 

90 

91 
lemma number_ne_Infty [simp]: "number_of k \<noteq> \<infinity>" 

92 
by (simp add: number_of_inat_def) 

93 

94 
lemma iSuc_Fin: "iSuc (Fin n) = Fin (Suc n)" 

95 
by (simp add: iSuc_def) 

96 

97 
lemma iSuc_number_of: "iSuc (number_of k) = Fin (Suc (number_of k))" 

98 
by (simp add: iSuc_Fin number_of_inat_def) 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

99 

c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

100 
lemma iSuc_Infty [simp]: "iSuc \<infinity> = \<infinity>" 
27110  101 
by (simp add: iSuc_def) 
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

102 

c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

103 
lemma iSuc_ne_0 [simp]: "iSuc n \<noteq> 0" 
27110  104 
by (simp add: iSuc_def zero_inat_def split: inat.splits) 
105 

106 
lemma zero_ne_iSuc [simp]: "0 \<noteq> iSuc n" 

107 
by (rule iSuc_ne_0 [symmetric]) 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

108 

27110  109 
lemma iSuc_inject [simp]: "iSuc m = iSuc n \<longleftrightarrow> m = n" 
110 
by (simp add: iSuc_def split: inat.splits) 

111 

112 
lemma number_of_inat_inject [simp]: 

113 
"(number_of k \<Colon> inat) = number_of l \<longleftrightarrow> (number_of k \<Colon> nat) = number_of l" 

114 
by (simp add: number_of_inat_def) 

11351
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 

27110  117 
subsection {* Addition *} 
118 

119 
instantiation inat :: comm_monoid_add 

120 
begin 

121 

122 
definition 

123 
[code del]: "m + n = (case m of \<infinity> \<Rightarrow> \<infinity>  Fin m \<Rightarrow> (case n of \<infinity> \<Rightarrow> \<infinity>  Fin n \<Rightarrow> Fin (m + n)))" 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

124 

27110  125 
lemma plus_inat_simps [simp, code]: 
126 
"Fin m + Fin n = Fin (m + n)" 

127 
"\<infinity> + q = \<infinity>" 

128 
"q + \<infinity> = \<infinity>" 

129 
by (simp_all add: plus_inat_def split: inat.splits) 

130 

131 
instance proof 

132 
fix n m q :: inat 

133 
show "n + m + q = n + (m + q)" 

134 
by (cases n, auto, cases m, auto, cases q, auto) 

135 
show "n + m = m + n" 

136 
by (cases n, auto, cases m, auto) 

137 
show "0 + n = n" 

138 
by (cases n) (simp_all add: zero_inat_def) 

26089  139 
qed 
140 

27110  141 
end 
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

142 

27110  143 
lemma plus_inat_0 [simp]: 
144 
"0 + (q\<Colon>inat) = q" 

145 
"(q\<Colon>inat) + 0 = q" 

146 
by (simp_all add: plus_inat_def zero_inat_def split: inat.splits) 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

147 

27110  148 
lemma plus_inat_number [simp]: 
29012  149 
"(number_of k \<Colon> inat) + number_of l = (if k < Int.Pls then number_of l 
150 
else if l < Int.Pls then number_of k else number_of (k + l))" 

27110  151 
unfolding number_of_inat_def plus_inat_simps nat_arith(1) if_distrib [symmetric, of _ Fin] .. 
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

152 

27110  153 
lemma iSuc_number [simp]: 
154 
"iSuc (number_of k) = (if neg (number_of k \<Colon> int) then 1 else number_of (Int.succ k))" 

155 
unfolding iSuc_number_of 

156 
unfolding one_inat_def number_of_inat_def Suc_nat_number_of if_distrib [symmetric] .. 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

157 

27110  158 
lemma iSuc_plus_1: 
159 
"iSuc n = n + 1" 

160 
by (cases n) (simp_all add: iSuc_Fin one_inat_def) 

161 

162 
lemma plus_1_iSuc: 

163 
"1 + q = iSuc q" 

164 
"q + 1 = iSuc q" 

165 
unfolding iSuc_plus_1 by (simp_all add: add_ac) 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

166 

c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

167 

29014  168 
subsection {* Multiplication *} 
169 

170 
instantiation inat :: comm_semiring_1 

171 
begin 

172 

173 
definition 

174 
times_inat_def [code del]: 

175 
"m * n = (case m of \<infinity> \<Rightarrow> if n = 0 then 0 else \<infinity>  Fin m \<Rightarrow> 

176 
(case n of \<infinity> \<Rightarrow> if m = 0 then 0 else \<infinity>  Fin n \<Rightarrow> Fin (m * n)))" 

177 

178 
lemma times_inat_simps [simp, code]: 

179 
"Fin m * Fin n = Fin (m * n)" 

180 
"\<infinity> * \<infinity> = \<infinity>" 

181 
"\<infinity> * Fin n = (if n = 0 then 0 else \<infinity>)" 

182 
"Fin m * \<infinity> = (if m = 0 then 0 else \<infinity>)" 

183 
unfolding times_inat_def zero_inat_def 

184 
by (simp_all split: inat.split) 

185 

186 
instance proof 

187 
fix a b c :: inat 

188 
show "(a * b) * c = a * (b * c)" 

189 
unfolding times_inat_def zero_inat_def 

190 
by (simp split: inat.split) 

191 
show "a * b = b * a" 

192 
unfolding times_inat_def zero_inat_def 

193 
by (simp split: inat.split) 

194 
show "1 * a = a" 

195 
unfolding times_inat_def zero_inat_def one_inat_def 

196 
by (simp split: inat.split) 

197 
show "(a + b) * c = a * c + b * c" 

198 
unfolding times_inat_def zero_inat_def 

199 
by (simp split: inat.split add: left_distrib) 

200 
show "0 * a = 0" 

201 
unfolding times_inat_def zero_inat_def 

202 
by (simp split: inat.split) 

203 
show "a * 0 = 0" 

204 
unfolding times_inat_def zero_inat_def 

205 
by (simp split: inat.split) 

206 
show "(0::inat) \<noteq> 1" 

207 
unfolding zero_inat_def one_inat_def 

208 
by simp 

209 
qed 

210 

211 
end 

212 

213 
lemma mult_iSuc: "iSuc m * n = n + m * n" 

214 
unfolding iSuc_plus_1 by (simp add: ring_simps) 

215 

216 
lemma mult_iSuc_right: "m * iSuc n = m + m * n" 

217 
unfolding iSuc_plus_1 by (simp add: ring_simps) 

218 

219 

27110  220 
subsection {* Ordering *} 
221 

222 
instantiation inat :: ordered_ab_semigroup_add 

223 
begin 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

224 

27110  225 
definition 
226 
[code del]: "m \<le> n = (case n of Fin n1 \<Rightarrow> (case m of Fin m1 \<Rightarrow> m1 \<le> n1  \<infinity> \<Rightarrow> False) 

227 
 \<infinity> \<Rightarrow> True)" 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

228 

27110  229 
definition 
230 
[code del]: "m < n = (case m of Fin m1 \<Rightarrow> (case n of Fin n1 \<Rightarrow> m1 < n1  \<infinity> \<Rightarrow> True) 

231 
 \<infinity> \<Rightarrow> False)" 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

232 

27110  233 
lemma inat_ord_simps [simp]: 
234 
"Fin m \<le> Fin n \<longleftrightarrow> m \<le> n" 

235 
"Fin m < Fin n \<longleftrightarrow> m < n" 

236 
"q \<le> \<infinity>" 

237 
"q < \<infinity> \<longleftrightarrow> q \<noteq> \<infinity>" 

238 
"\<infinity> \<le> q \<longleftrightarrow> q = \<infinity>" 

239 
"\<infinity> < q \<longleftrightarrow> False" 

240 
by (simp_all add: less_eq_inat_def less_inat_def split: inat.splits) 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

241 

27110  242 
lemma inat_ord_code [code]: 
243 
"Fin m \<le> Fin n \<longleftrightarrow> m \<le> n" 

244 
"Fin m < Fin n \<longleftrightarrow> m < n" 

245 
"q \<le> \<infinity> \<longleftrightarrow> True" 

246 
"Fin m < \<infinity> \<longleftrightarrow> True" 

247 
"\<infinity> \<le> Fin n \<longleftrightarrow> False" 

248 
"\<infinity> < q \<longleftrightarrow> False" 

249 
by simp_all 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

250 

27110  251 
instance by default 
252 
(auto simp add: less_eq_inat_def less_inat_def plus_inat_def split: inat.splits) 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

253 

27110  254 
end 
255 

29014  256 
instance inat :: pordered_comm_semiring 
257 
proof 

258 
fix a b c :: inat 

259 
assume "a \<le> b" and "0 \<le> c" 

260 
thus "c * a \<le> c * b" 

261 
unfolding times_inat_def less_eq_inat_def zero_inat_def 

262 
by (simp split: inat.splits) 

263 
qed 

264 

27110  265 
lemma inat_ord_number [simp]: 
266 
"(number_of m \<Colon> inat) \<le> number_of n \<longleftrightarrow> (number_of m \<Colon> nat) \<le> number_of n" 

267 
"(number_of m \<Colon> inat) < number_of n \<longleftrightarrow> (number_of m \<Colon> nat) < number_of n" 

268 
by (simp_all add: number_of_inat_def) 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

269 

27110  270 
lemma i0_lb [simp]: "(0\<Colon>inat) \<le> n" 
271 
by (simp add: zero_inat_def less_eq_inat_def split: inat.splits) 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

272 

27110  273 
lemma i0_neq [simp]: "n \<le> (0\<Colon>inat) \<longleftrightarrow> n = 0" 
274 
by (simp add: zero_inat_def less_eq_inat_def split: inat.splits) 

275 

276 
lemma Infty_ileE [elim!]: "\<infinity> \<le> Fin m \<Longrightarrow> R" 

277 
by (simp add: zero_inat_def less_eq_inat_def split: inat.splits) 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

278 

27110  279 
lemma Infty_ilessE [elim!]: "\<infinity> < Fin m \<Longrightarrow> R" 
280 
by simp 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

281 

27110  282 
lemma not_ilessi0 [simp]: "\<not> n < (0\<Colon>inat)" 
283 
by (simp add: zero_inat_def less_inat_def split: inat.splits) 

284 

285 
lemma i0_eq [simp]: "(0\<Colon>inat) < n \<longleftrightarrow> n \<noteq> 0" 

286 
by (simp add: zero_inat_def less_inat_def split: inat.splits) 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

287 

27110  288 
lemma iSuc_ile_mono [simp]: "iSuc n \<le> iSuc m \<longleftrightarrow> n \<le> m" 
289 
by (simp add: iSuc_def less_eq_inat_def split: inat.splits) 

290 

291 
lemma iSuc_mono [simp]: "iSuc n < iSuc m \<longleftrightarrow> n < m" 

292 
by (simp add: iSuc_def less_inat_def split: inat.splits) 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

293 

27110  294 
lemma ile_iSuc [simp]: "n \<le> iSuc n" 
295 
by (simp add: iSuc_def less_eq_inat_def split: inat.splits) 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

296 

11355  297 
lemma not_iSuc_ilei0 [simp]: "\<not> iSuc n \<le> 0" 
27110  298 
by (simp add: zero_inat_def iSuc_def less_eq_inat_def split: inat.splits) 
299 

300 
lemma i0_iless_iSuc [simp]: "0 < iSuc n" 

301 
by (simp add: zero_inat_def iSuc_def less_inat_def split: inat.splits) 

302 

303 
lemma ileI1: "m < n \<Longrightarrow> iSuc m \<le> n" 

304 
by (simp add: iSuc_def less_eq_inat_def less_inat_def split: inat.splits) 

305 

306 
lemma Suc_ile_eq: "Fin (Suc m) \<le> n \<longleftrightarrow> Fin m < n" 

307 
by (cases n) auto 

308 

309 
lemma iless_Suc_eq [simp]: "Fin m < iSuc n \<longleftrightarrow> Fin m \<le> n" 

310 
by (auto simp add: iSuc_def less_inat_def split: inat.splits) 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

311 

27110  312 
lemma min_inat_simps [simp]: 
313 
"min (Fin m) (Fin n) = Fin (min m n)" 

314 
"min q 0 = 0" 

315 
"min 0 q = 0" 

316 
"min q \<infinity> = q" 

317 
"min \<infinity> q = q" 

318 
by (auto simp add: min_def) 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

319 

27110  320 
lemma max_inat_simps [simp]: 
321 
"max (Fin m) (Fin n) = Fin (max m n)" 

322 
"max q 0 = q" 

323 
"max 0 q = q" 

324 
"max q \<infinity> = \<infinity>" 

325 
"max \<infinity> q = \<infinity>" 

326 
by (simp_all add: max_def) 

327 

328 
lemma Fin_ile: "n \<le> Fin m \<Longrightarrow> \<exists>k. n = Fin k" 

329 
by (cases n) simp_all 

330 

331 
lemma Fin_iless: "n < Fin m \<Longrightarrow> \<exists>k. n = Fin k" 

332 
by (cases n) simp_all 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

333 

c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

334 
lemma chain_incr: "\<forall>i. \<exists>j. Y i < Y j ==> \<exists>j. Fin k < Y j" 
25134
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset

335 
apply (induct_tac k) 
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset

336 
apply (simp (no_asm) only: Fin_0) 
27110  337 
apply (fast intro: le_less_trans [OF i0_lb]) 
25134
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset

338 
apply (erule exE) 
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset

339 
apply (drule spec) 
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset

340 
apply (erule exE) 
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset

341 
apply (drule ileI1) 
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset

342 
apply (rule iSuc_Fin [THEN subst]) 
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset

343 
apply (rule exI) 
27110  344 
apply (erule (1) le_less_trans) 
25134
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset

345 
done 
11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

346 

26089  347 

27110  348 
subsection {* Wellordering *} 
26089  349 

350 
lemma less_FinE: 

351 
"[ n < Fin m; !!k. n = Fin k ==> k < m ==> P ] ==> P" 

352 
by (induct n) auto 

353 

354 
lemma less_InftyE: 

355 
"[ n < Infty; !!k. n = Fin k ==> P ] ==> P" 

356 
by (induct n) auto 

357 

358 
lemma inat_less_induct: 

359 
assumes prem: "!!n. \<forall>m::inat. m < n > P m ==> P n" shows "P n" 

360 
proof  

361 
have P_Fin: "!!k. P (Fin k)" 

362 
apply (rule nat_less_induct) 

363 
apply (rule prem, clarify) 

364 
apply (erule less_FinE, simp) 

365 
done 

366 
show ?thesis 

367 
proof (induct n) 

368 
fix nat 

369 
show "P (Fin nat)" by (rule P_Fin) 

370 
next 

371 
show "P Infty" 

372 
apply (rule prem, clarify) 

373 
apply (erule less_InftyE) 

374 
apply (simp add: P_Fin) 

375 
done 

376 
qed 

377 
qed 

378 

379 
instance inat :: wellorder 

380 
proof 

27823  381 
fix P and n 
382 
assume hyp: "(\<And>n\<Colon>inat. (\<And>m\<Colon>inat. m < n \<Longrightarrow> P m) \<Longrightarrow> P n)" 

383 
show "P n" by (blast intro: inat_less_induct hyp) 

26089  384 
qed 
385 

27110  386 

387 
subsection {* Traditional theorem names *} 

388 

389 
lemmas inat_defs = zero_inat_def one_inat_def number_of_inat_def iSuc_def 

390 
plus_inat_def less_eq_inat_def less_inat_def 

391 

392 
lemmas inat_splits = inat.splits 

393 

11351
c5c403d30c77
added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff
changeset

394 
end 