168 let val tac = rtac eq_reflection 1 THEN rtac iffI 1 THEN |
168 let val tac = rtac eq_reflection 1 THEN rtac iffI 1 THEN |
169 ALLGOALS(EVERY'[etac exE, REPEAT o (etac conjE), |
169 ALLGOALS(EVERY'[etac exE, REPEAT o (etac conjE), |
170 rtac exI, REPEAT o (ares_tac [conjI] ORELSE' etac sym)]) |
170 rtac exI, REPEAT o (ares_tac [conjI] ORELSE' etac sym)]) |
171 in rule_by_tactic tac (trivial ceqt) end; |
171 in rule_by_tactic tac (trivial ceqt) end; |
172 |
172 |
173 fun rearrange sg (F as ex $ Abs(x,T,P)) = |
173 fun rearrange sg _ (F as ex $ Abs(x,T,P)) = |
174 (case extract P of |
174 (case extract P of |
175 None => None |
175 None => None |
176 | Some(eq,Q) => |
176 | Some(eq,Q) => |
177 let val ceqt = cterm_of sg |
177 let val ceqt = cterm_of sg |
178 (Logic.mk_equals(F,ex $ Abs(x,T,HOLogic.conj$eq$Q))) |
178 (Logic.mk_equals(F,ex $ Abs(x,T,HOLogic.conj$eq$Q))) |
179 in Some(prove_eq ceqt) end) |
179 in Some(prove_eq ceqt) end) |
180 | rearrange _ _ = None; |
180 | rearrange _ _ _ = None; |
181 |
181 |
182 val pattern = read_cterm (sign_of HOL.thy) ("? x.P(x) & Q(x)",HOLogic.boolT) |
182 val pattern = read_cterm (sign_of HOL.thy) ("? x.P(x) & Q(x)",HOLogic.boolT) |
183 |
183 |
184 in |
184 in |
185 val defEX_regroup = mk_simproc "defined EX" [pattern] rearrange; |
185 val defEX_regroup = mk_simproc "defined EX" [pattern] rearrange; |