equal
deleted
inserted
replaced
59 (*Commutative law for addition*) |
59 (*Commutative law for addition*) |
60 val add_commute = prove_goal Arith.thy "m + n = n + m::nat" |
60 val add_commute = prove_goal Arith.thy "m + n = n + m::nat" |
61 (fn _ => [nat_ind_tac "m" 1, ALLGOALS(asm_simp_tac arith_ss)]); |
61 (fn _ => [nat_ind_tac "m" 1, ALLGOALS(asm_simp_tac arith_ss)]); |
62 |
62 |
63 val add_left_commute = prove_goal Arith.thy "x+(y+z)=y+(x+z)::nat" |
63 val add_left_commute = prove_goal Arith.thy "x+(y+z)=y+(x+z)::nat" |
64 (fn _ => [rtac trans 1, rtac add_commute 1, rtac trans 1, |
64 (fn _ => [rtac (add_commute RS trans) 1, rtac (add_assoc RS trans) 1, |
65 rtac add_assoc 1, rtac (add_commute RS arg_cong) 1]); |
65 rtac (add_commute RS arg_cong) 1]); |
66 |
66 |
|
67 (*Addition is an AC-operator*) |
67 val add_ac = [add_assoc, add_commute, add_left_commute]; |
68 val add_ac = [add_assoc, add_commute, add_left_commute]; |
68 |
69 |
69 |
70 |
70 (*** Multiplication ***) |
71 (*** Multiplication ***) |
71 |
72 |
81 val arith_ss = arith_ss addsimps [mult_0_right,mult_Suc_right]; |
82 val arith_ss = arith_ss addsimps [mult_0_right,mult_Suc_right]; |
82 |
83 |
83 (*Commutative law for multiplication*) |
84 (*Commutative law for multiplication*) |
84 val mult_commute = prove_goal Arith.thy "m * n = n * m::nat" |
85 val mult_commute = prove_goal Arith.thy "m * n = n * m::nat" |
85 (fn _ => [nat_ind_tac "m" 1, ALLGOALS (asm_simp_tac arith_ss)]); |
86 (fn _ => [nat_ind_tac "m" 1, ALLGOALS (asm_simp_tac arith_ss)]); |
86 |
|
87 (*addition distributes over multiplication*) |
|
88 val add_mult_distrib = prove_goal Arith.thy "(m + n)*k = (m*k) + (n*k)::nat" |
|
89 (fn _ => [nat_ind_tac "m" 1, |
|
90 ALLGOALS(asm_simp_tac (arith_ss addsimps add_ac))]); |
|
91 |
87 |
92 (*addition distributes over multiplication*) |
88 (*addition distributes over multiplication*) |
93 val add_mult_distrib = prove_goal Arith.thy "(m + n)*k = (m*k) + (n*k)::nat" |
89 val add_mult_distrib = prove_goal Arith.thy "(m + n)*k = (m*k) + (n*k)::nat" |
94 (fn _ => [nat_ind_tac "m" 1, |
90 (fn _ => [nat_ind_tac "m" 1, |
95 ALLGOALS(asm_simp_tac (arith_ss addsimps add_ac))]); |
91 ALLGOALS(asm_simp_tac (arith_ss addsimps add_ac))]); |