src/HOL/Nat.ML
changeset 2441 decc46a5cdb5
parent 2268 79a2f085a7fd
child 2608 450c9b682a92
equal deleted inserted replaced
2440:b3ac45aba238 2441:decc46a5cdb5
     1 (*  Title:      HOL/nat
     1 (*  Title:      HOL/Nat.ML
     2     ID:         $Id$
     2     ID:         $Id$
     3     Author:     Tobias Nipkow, Cambridge University Computer Laboratory
     3     Author:     Tobias Nipkow, Cambridge University Computer Laboratory
     4     Copyright   1991  University of Cambridge
     4     Copyright   1991  University of Cambridge
     5 
     5 
     6 For nat.thy.  Type nat is defined as a set (Nat) over the type ind.
     6 For Nat.thy.  Type nat is defined as a set (Nat) over the type ind.
     7 *)
     7 *)
     8 
     8 
     9 open Nat;
     9 open Nat;
    10 
    10 
    11 goal Nat.thy "mono(%X. {Zero_Rep} Un (Suc_Rep``X))";
    11 goal Nat.thy "mono(%X. {Zero_Rep} Un (Suc_Rep``X))";
   378     "[| !!n. [| ! m::nat. m<n --> P(m) |] ==> P(n) |]  ==>  P(n)";
   378     "[| !!n. [| ! m::nat. m<n --> P(m) |] ==> P(n) |]  ==>  P(n)";
   379 by (wf_ind_tac "n" [wf_pred_nat RS wf_trancl] 1);
   379 by (wf_ind_tac "n" [wf_pred_nat RS wf_trancl] 1);
   380 by (eresolve_tac prems 1);
   380 by (eresolve_tac prems 1);
   381 qed "less_induct";
   381 qed "less_induct";
   382 
   382 
       
   383 qed_goal "nat_induct2" Nat.thy 
       
   384 "[| P 0; P 1; !!k. P k ==> P (Suc (Suc k)) |] ==> P n" (fn prems => [
       
   385 	cut_facts_tac prems 1,
       
   386 	rtac less_induct 1,
       
   387 	res_inst_tac [("n","n")] natE 1,
       
   388 	 hyp_subst_tac 1,
       
   389 	 atac 1,
       
   390 	hyp_subst_tac 1,
       
   391 	res_inst_tac [("n","x")] natE 1,
       
   392 	 hyp_subst_tac 1,
       
   393 	 atac 1,
       
   394 	hyp_subst_tac 1,
       
   395 	resolve_tac prems 1,
       
   396 	dtac spec 1,
       
   397 	etac mp 1,
       
   398 	rtac (lessI RS less_trans) 1,
       
   399 	rtac (lessI RS Suc_mono) 1]);
   383 
   400 
   384 (*** Properties of <= ***)
   401 (*** Properties of <= ***)
   385 
   402 
   386 goalw Nat.thy [le_def] "(m <= n) = (m < Suc n)";
   403 goalw Nat.thy [le_def] "(m <= n) = (m < Suc n)";
   387 by (rtac not_less_eq 1);
   404 by (rtac not_less_eq 1);
   470 
   487 
   471 goalw Nat.thy [le_def] "!!m. m <= n ==> m <= Suc n";
   488 goalw Nat.thy [le_def] "!!m. m <= n ==> m <= Suc n";
   472 by (fast_tac (!claset addDs [Suc_lessD]) 1);
   489 by (fast_tac (!claset addDs [Suc_lessD]) 1);
   473 qed "le_SucI";
   490 qed "le_SucI";
   474 Addsimps[le_SucI];
   491 Addsimps[le_SucI];
       
   492 
       
   493 bind_thm ("le_Suc", not_Suc_n_less_n RS leI);
   475 
   494 
   476 goalw Nat.thy [le_def] "!!m. m < n ==> m <= (n::nat)";
   495 goalw Nat.thy [le_def] "!!m. m < n ==> m <= (n::nat)";
   477 by (fast_tac (!claset addEs [less_asym]) 1);
   496 by (fast_tac (!claset addEs [less_asym]) 1);
   478 qed "less_imp_le";
   497 qed "less_imp_le";
   479 
   498