| author | wenzelm | 
| Wed, 07 Jun 2006 01:51:22 +0200 | |
| changeset 19803 | aa2581752afb | 
| parent 17274 | 746bb4c56800 | 
| permissions | -rw-r--r-- | 
| 1459 | 1 | (* Title: FOL/ex/NatClass.ML | 
| 1246 | 2 | ID: $Id$ | 
| 2469 | 3 | Author: Markus Wenzel, TU Muenchen | 
| 1246 | 4 | |
| 5 | This is Nat.ML trivially modified to make it work with NatClass.thy. | |
| 6 | *) | |
| 7 | ||
| 5050 | 8 | Goal "Suc(k) ~= (k::'a::nat)"; | 
| 17274 
746bb4c56800
axclass: name space prefix is now "c_class" instead of just "c";
 wenzelm parents: 
17260diff
changeset | 9 | by (res_inst_tac [("n","k")] induct 1);
 | 
| 1459 | 10 | by (rtac notI 1); | 
| 11 | by (etac Suc_neq_0 1); | |
| 12 | by (rtac notI 1); | |
| 13 | by (etac notE 1); | |
| 14 | by (etac Suc_inject 1); | |
| 1246 | 15 | qed "Suc_n_not_n"; | 
| 16 | ||
| 17 | ||
| 5050 | 18 | Goal "(k+m)+n = k+(m+n)"; | 
| 17274 
746bb4c56800
axclass: name space prefix is now "c_class" instead of just "c";
 wenzelm parents: 
17260diff
changeset | 19 | prths ([induct] RL [topthm()]); (*prints all 14 next states!*) | 
| 
746bb4c56800
axclass: name space prefix is now "c_class" instead of just "c";
 wenzelm parents: 
17260diff
changeset | 20 | by (rtac induct 1); | 
| 1246 | 21 | back(); | 
| 22 | back(); | |
| 23 | back(); | |
| 24 | back(); | |
| 25 | back(); | |
| 26 | back(); | |
| 27 | ||
| 5050 | 28 | Goalw [add_def] "0+n = n"; | 
| 1459 | 29 | by (rtac rec_0 1); | 
| 1246 | 30 | qed "add_0"; | 
| 31 | ||
| 5050 | 32 | Goalw [add_def] "Suc(m)+n = Suc(m+n)"; | 
| 1459 | 33 | by (rtac rec_Suc 1); | 
| 1246 | 34 | qed "add_Suc"; | 
| 35 | ||
| 2469 | 36 | Addsimps [add_0, add_Suc]; | 
| 1246 | 37 | |
| 5050 | 38 | Goal "(k+m)+n = k+(m+n)"; | 
| 17274 
746bb4c56800
axclass: name space prefix is now "c_class" instead of just "c";
 wenzelm parents: 
17260diff
changeset | 39 | by (res_inst_tac [("n","k")] induct 1);
 | 
| 2469 | 40 | by (Simp_tac 1); | 
| 41 | by (Asm_simp_tac 1); | |
| 1246 | 42 | qed "add_assoc"; | 
| 43 | ||
| 5050 | 44 | Goal "m+0 = m"; | 
| 17274 
746bb4c56800
axclass: name space prefix is now "c_class" instead of just "c";
 wenzelm parents: 
17260diff
changeset | 45 | by (res_inst_tac [("n","m")] induct 1);
 | 
| 2469 | 46 | by (Simp_tac 1); | 
| 47 | by (Asm_simp_tac 1); | |
| 1246 | 48 | qed "add_0_right"; | 
| 49 | ||
| 5050 | 50 | Goal "m+Suc(n) = Suc(m+n)"; | 
| 17274 
746bb4c56800
axclass: name space prefix is now "c_class" instead of just "c";
 wenzelm parents: 
17260diff
changeset | 51 | by (res_inst_tac [("n","m")] induct 1);
 | 
| 2469 | 52 | by (ALLGOALS (Asm_simp_tac)); | 
| 1246 | 53 | qed "add_Suc_right"; | 
| 54 | ||
| 17245 | 55 | val [prem] = goal (the_context ()) "(!!n. f(Suc(n)) = Suc(f(n))) ==> f(i+j) = i+f(j)"; | 
| 17274 
746bb4c56800
axclass: name space prefix is now "c_class" instead of just "c";
 wenzelm parents: 
17260diff
changeset | 56 | by (res_inst_tac [("n","i")] induct 1);
 | 
| 2469 | 57 | by (Simp_tac 1); | 
| 4091 | 58 | by (asm_simp_tac (simpset() addsimps [prem]) 1); | 
| 1246 | 59 | result(); |