133 |
133 |
134 val defALL_regroup = |
134 val defALL_regroup = |
135 Simplifier.simproc (Theory.sign_of (the_context ())) |
135 Simplifier.simproc (Theory.sign_of (the_context ())) |
136 "defined ALL" ["ALL x. P x"] Quantifier1.rearrange_all; |
136 "defined ALL" ["ALL x. P x"] Quantifier1.rearrange_all; |
137 |
137 |
|
138 |
|
139 (*** simproc for proving "(y = x) == False" from prmise "~(x = y)" ***) |
|
140 |
|
141 val use_neq_simproc = ref true; |
|
142 |
|
143 local |
|
144 |
|
145 val neq_to_EQ_False = thm "not_sym" RS Eq_FalseI; |
|
146 |
|
147 fun neq_prover sg ss (eq $ lhs $ rhs) = |
|
148 let |
|
149 fun test thm = (case #prop(rep_thm thm) of |
|
150 _ $ (Not $ (eq' $ l' $ r')) => |
|
151 Not = HOLogic.Not andalso eq' = eq andalso |
|
152 r' aconv lhs andalso l' aconv rhs |
|
153 | _ => false) |
|
154 in |
|
155 if !use_neq_simproc then |
|
156 case Library.find_first test (prems_of_ss ss) of NONE => NONE |
|
157 | SOME thm => SOME (thm RS neq_to_EQ_False) |
|
158 else NONE |
|
159 end |
|
160 |
|
161 in |
|
162 |
|
163 val neq_simproc = |
|
164 Simplifier.simproc (the_context ()) "neq_simproc" ["x = y"] neq_prover; |
|
165 |
|
166 end; |
|
167 |
|
168 |
|
169 |
|
170 |
138 (*** Simproc for Let ***) |
171 (*** Simproc for Let ***) |
139 |
172 |
140 val use_let_simproc = ref true; |
173 val use_let_simproc = ref true; |
141 |
174 |
142 local |
175 local |
334 imp_disjL, conj_assoc, disj_assoc, |
367 imp_disjL, conj_assoc, disj_assoc, |
335 de_Morgan_conj, de_Morgan_disj, imp_disj1, imp_disj2, not_imp, |
368 de_Morgan_conj, de_Morgan_disj, imp_disj1, imp_disj2, not_imp, |
336 disj_not1, not_all, not_ex, cases_simp, |
369 disj_not1, not_all, not_ex, cases_simp, |
337 thm "the_eq_trivial", the_sym_eq_trivial] |
370 thm "the_eq_trivial", the_sym_eq_trivial] |
338 @ ex_simps @ all_simps @ simp_thms) |
371 @ ex_simps @ all_simps @ simp_thms) |
339 addsimprocs [defALL_regroup,defEX_regroup,let_simproc] |
372 addsimprocs [defALL_regroup,defEX_regroup,neq_simproc,let_simproc] |
340 addcongs [imp_cong, simp_implies_cong] |
373 addcongs [imp_cong, simp_implies_cong] |
341 addsplits [split_if]; |
374 addsplits [split_if]; |
342 |
375 |
343 fun hol_simplify rews = Simplifier.full_simplify (HOL_basic_ss addsimps rews); |
376 fun hol_simplify rews = Simplifier.full_simplify (HOL_basic_ss addsimps rews); |
344 |
377 |