66 Goal "(m < Suc n) = (m=0 | (EX j. m = Suc j & j < n))"; |
66 Goal "(m < Suc n) = (m=0 | (EX j. m = Suc j & j < n))"; |
67 by (case_tac "m" 1); |
67 by (case_tac "m" 1); |
68 by Auto_tac; |
68 by Auto_tac; |
69 qed "less_Suc_eq_0_disj"; |
69 qed "less_Suc_eq_0_disj"; |
70 |
70 |
71 val prems = Goal "[| P 0; P(1'); !!k. P k ==> P (Suc (Suc k)) |] ==> P n"; |
71 val prems = Goal "[| P 0; P(Suc 0); !!k. P k ==> P (Suc (Suc k)) |] ==> P n"; |
72 by (rtac nat_less_induct 1); |
72 by (rtac nat_less_induct 1); |
73 by (case_tac "n" 1); |
73 by (case_tac "n" 1); |
74 by (case_tac "nat" 2); |
74 by (case_tac "nat" 2); |
75 by (ALLGOALS (blast_tac (claset() addIs prems@[less_trans]))); |
75 by (ALLGOALS (blast_tac (claset() addIs prems@[less_trans]))); |
76 qed "nat_induct2"; |
76 qed "nat_induct2"; |
155 Addsimps [diff_0_eq_0, diff_Suc_Suc]; |
155 Addsimps [diff_0_eq_0, diff_Suc_Suc]; |
156 |
156 |
157 (* Could be (and is, below) generalized in various ways; |
157 (* Could be (and is, below) generalized in various ways; |
158 However, none of the generalizations are currently in the simpset, |
158 However, none of the generalizations are currently in the simpset, |
159 and I dread to think what happens if I put them in *) |
159 and I dread to think what happens if I put them in *) |
160 Goal "0 < n ==> Suc(n-1') = n"; |
160 Goal "0 < n ==> Suc(n - Suc 0) = n"; |
161 by (asm_simp_tac (simpset() addsplits [nat.split]) 1); |
161 by (asm_simp_tac (simpset() addsplits [nat.split]) 1); |
162 qed "Suc_pred"; |
162 qed "Suc_pred"; |
163 Addsimps [Suc_pred]; |
163 Addsimps [Suc_pred]; |
164 |
164 |
165 Delsimps [diff_Suc]; |
165 Delsimps [diff_Suc]; |
394 by (ALLGOALS(asm_simp_tac (simpset() addsimps add_ac))); |
394 by (ALLGOALS(asm_simp_tac (simpset() addsimps add_ac))); |
395 qed "mult_Suc_right"; |
395 qed "mult_Suc_right"; |
396 |
396 |
397 Addsimps [mult_0_right, mult_Suc_right]; |
397 Addsimps [mult_0_right, mult_Suc_right]; |
398 |
398 |
399 Goal "1 * n = n"; |
399 Goal "(1::nat) * n = n"; |
400 by (Asm_simp_tac 1); |
400 by (Asm_simp_tac 1); |
401 qed "mult_1"; |
401 qed "mult_1"; |
402 |
402 |
403 Goal "n * 1 = n"; |
403 Goal "n * (1::nat) = n"; |
404 by (Asm_simp_tac 1); |
404 by (Asm_simp_tac 1); |
405 qed "mult_1_right"; |
405 qed "mult_1_right"; |
406 |
406 |
407 (*Commutative law for multiplication*) |
407 (*Commutative law for multiplication*) |
408 Goal "m * n = n * (m::nat)"; |
408 Goal "m * n = n * (m::nat)"; |
636 by (case_tac "n" 2); |
636 by (case_tac "n" 2); |
637 by (ALLGOALS Asm_simp_tac); |
637 by (ALLGOALS Asm_simp_tac); |
638 qed "zero_less_mult_iff"; |
638 qed "zero_less_mult_iff"; |
639 Addsimps [zero_less_mult_iff]; |
639 Addsimps [zero_less_mult_iff]; |
640 |
640 |
641 Goal "(1' <= m*n) = (1<=m & 1<=n)"; |
641 Goal "(Suc 0 <= m*n) = (1<=m & 1<=n)"; |
642 by (induct_tac "m" 1); |
642 by (induct_tac "m" 1); |
643 by (case_tac "n" 2); |
643 by (case_tac "n" 2); |
644 by (ALLGOALS Asm_simp_tac); |
644 by (ALLGOALS Asm_simp_tac); |
645 qed "one_le_mult_iff"; |
645 qed "one_le_mult_iff"; |
646 Addsimps [one_le_mult_iff]; |
646 Addsimps [one_le_mult_iff]; |
647 |
647 |
648 Goal "(m*n = 1') = (m=1 & n=1)"; |
648 Goal "(m*n = Suc 0) = (m=1 & n=1)"; |
649 by (induct_tac "m" 1); |
649 by (induct_tac "m" 1); |
650 by (Simp_tac 1); |
650 by (Simp_tac 1); |
651 by (induct_tac "n" 1); |
651 by (induct_tac "n" 1); |
652 by (Simp_tac 1); |
652 by (Simp_tac 1); |
653 by (fast_tac (claset() addss simpset()) 1); |
653 by (fast_tac (claset() addss simpset()) 1); |
654 qed "mult_eq_1_iff"; |
654 qed "mult_eq_1_iff"; |
655 Addsimps [mult_eq_1_iff]; |
655 Addsimps [mult_eq_1_iff]; |
656 |
656 |
657 Goal "(1' = m*n) = (m=1 & n=1)"; |
657 Goal "(Suc 0 = m*n) = (m=1 & n=1)"; |
658 by(rtac (mult_eq_1_iff RSN (2,trans)) 1); |
658 by(rtac (mult_eq_1_iff RSN (2,trans)) 1); |
659 by (fast_tac (claset() addss simpset()) 1); |
659 by (fast_tac (claset() addss simpset()) 1); |
660 qed "one_eq_mult_iff"; |
660 qed "one_eq_mult_iff"; |
661 Addsimps [one_eq_mult_iff]; |
661 Addsimps [one_eq_mult_iff]; |
662 |
662 |