111 |
111 |
112 subsection {* A naive proof procedure to lift really trivial arithmetic stuff from the basis of the vector space. *} |
112 subsection {* A naive proof procedure to lift really trivial arithmetic stuff from the basis of the vector space. *} |
113 |
113 |
114 method_setup vector = {* |
114 method_setup vector = {* |
115 let |
115 let |
116 val ss1 = HOL_basic_ss addsimps [@{thm setsum_addf} RS sym, |
116 val ss1 = |
117 @{thm setsum_subtractf} RS sym, @{thm setsum_right_distrib}, |
117 simpset_of (put_simpset HOL_basic_ss @{context} |
118 @{thm setsum_left_distrib}, @{thm setsum_negf} RS sym] |
118 addsimps [@{thm setsum_addf} RS sym, |
119 val ss2 = @{simpset} addsimps |
119 @{thm setsum_subtractf} RS sym, @{thm setsum_right_distrib}, |
|
120 @{thm setsum_left_distrib}, @{thm setsum_negf} RS sym]) |
|
121 val ss2 = |
|
122 simpset_of (@{context} addsimps |
120 [@{thm plus_vec_def}, @{thm times_vec_def}, |
123 [@{thm plus_vec_def}, @{thm times_vec_def}, |
121 @{thm minus_vec_def}, @{thm uminus_vec_def}, |
124 @{thm minus_vec_def}, @{thm uminus_vec_def}, |
122 @{thm one_vec_def}, @{thm zero_vec_def}, @{thm vec_def}, |
125 @{thm one_vec_def}, @{thm zero_vec_def}, @{thm vec_def}, |
123 @{thm scaleR_vec_def}, |
126 @{thm scaleR_vec_def}, |
124 @{thm vec_lambda_beta}, @{thm vector_scalar_mult_def}] |
127 @{thm vec_lambda_beta}, @{thm vector_scalar_mult_def}]) |
125 fun vector_arith_tac ths = |
128 fun vector_arith_tac ctxt ths = |
126 simp_tac ss1 |
129 simp_tac (put_simpset ss1 ctxt) |
127 THEN' (fn i => rtac @{thm setsum_cong2} i |
130 THEN' (fn i => rtac @{thm setsum_cong2} i |
128 ORELSE rtac @{thm setsum_0'} i |
131 ORELSE rtac @{thm setsum_0'} i |
129 ORELSE simp_tac (HOL_basic_ss addsimps [@{thm vec_eq_iff}]) i) |
132 ORELSE simp_tac (put_simpset HOL_basic_ss ctxt addsimps [@{thm vec_eq_iff}]) i) |
130 (* THEN' TRY o clarify_tac HOL_cs THEN' (TRY o rtac @{thm iffI}) *) |
133 (* THEN' TRY o clarify_tac HOL_cs THEN' (TRY o rtac @{thm iffI}) *) |
131 THEN' asm_full_simp_tac (ss2 addsimps ths) |
134 THEN' asm_full_simp_tac (put_simpset ss2 ctxt addsimps ths) |
132 in |
135 in |
133 Attrib.thms >> (fn ths => K (SIMPLE_METHOD' (vector_arith_tac ths))) |
136 Attrib.thms >> (fn ths => fn ctxt => SIMPLE_METHOD' (vector_arith_tac ctxt ths)) |
134 end |
137 end |
135 *} "lift trivial vector statements to real arith statements" |
138 *} "lift trivial vector statements to real arith statements" |
136 |
139 |
137 lemma vec_0[simp]: "vec 0 = 0" by (vector zero_vec_def) |
140 lemma vec_0[simp]: "vec 0 = 0" by (vector zero_vec_def) |
138 lemma vec_1[simp]: "vec 1 = 1" by (vector one_vec_def) |
141 lemma vec_1[simp]: "vec 1 = 1" by (vector one_vec_def) |