143 val bool_options : string list |
143 val bool_options : string list |
144 val print_step : options -> string -> unit |
144 val print_step : options -> string -> unit |
145 (* conversions *) |
145 (* conversions *) |
146 val imp_prems_conv : conv -> conv |
146 val imp_prems_conv : conv -> conv |
147 (* simple transformations *) |
147 (* simple transformations *) |
|
148 val split_conjuncts_in_assms : Proof.context -> thm -> thm |
148 val expand_tuples : theory -> thm -> thm |
149 val expand_tuples : theory -> thm -> thm |
149 val eta_contract_ho_arguments : theory -> thm -> thm |
150 val eta_contract_ho_arguments : theory -> thm -> thm |
150 val remove_equalities : theory -> thm -> thm |
151 val remove_equalities : theory -> thm -> thm |
151 val remove_pointless_clauses : thm -> thm list |
152 val remove_pointless_clauses : thm -> thm list |
152 val peephole_optimisation : theory -> thm -> thm option |
153 val peephole_optimisation : theory -> thm -> thm option |
819 fun rewrite_prem atom = |
820 fun rewrite_prem atom = |
820 let |
821 let |
821 val (_, args) = strip_comb atom |
822 val (_, args) = strip_comb atom |
822 in rewrite_args args end |
823 in rewrite_args args end |
823 |
824 |
|
825 fun split_conjuncts_in_assms ctxt th = |
|
826 let |
|
827 val ((_, [fixed_th]), ctxt') = Variable.import false [th] ctxt |
|
828 fun split_conjs i nprems th = |
|
829 if i > nprems then th |
|
830 else |
|
831 case try Drule.RSN (@{thm conjI}, (i, th)) of |
|
832 SOME th' => split_conjs i (nprems+1) th' |
|
833 | NONE => split_conjs (i+1) nprems th |
|
834 in |
|
835 singleton (Variable.export ctxt' ctxt) (split_conjs 1 (Thm.nprems_of fixed_th) fixed_th) |
|
836 end |
|
837 |
824 fun expand_tuples thy intro = |
838 fun expand_tuples thy intro = |
825 let |
839 let |
826 val ctxt = ProofContext.init_global thy |
840 val ctxt = ProofContext.init_global thy |
827 val (((T_insts, t_insts), [intro']), ctxt1) = Variable.import false [intro] ctxt |
841 val (((T_insts, t_insts), [intro']), ctxt1) = Variable.import false [intro] ctxt |
828 val intro_t = prop_of intro' |
842 val intro_t = prop_of intro' |
838 val [intro'''] = Variable.export ctxt3 ctxt [intro''] |
852 val [intro'''] = Variable.export ctxt3 ctxt [intro''] |
839 val intro'''' = Simplifier.full_simplify |
853 val intro'''' = Simplifier.full_simplify |
840 (HOL_basic_ss addsimps [@{thm fst_conv}, @{thm snd_conv}, @{thm Pair_eq}]) |
854 (HOL_basic_ss addsimps [@{thm fst_conv}, @{thm snd_conv}, @{thm Pair_eq}]) |
841 intro''' |
855 intro''' |
842 (* splitting conjunctions introduced by Pair_eq*) |
856 (* splitting conjunctions introduced by Pair_eq*) |
843 fun split_conj prem = |
857 val intro''''' = split_conjuncts_in_assms ctxt intro'''' |
844 map HOLogic.mk_Trueprop (conjuncts (HOLogic.dest_Trueprop prem)) |
|
845 val intro''''' = map_term thy (maps_premises split_conj) intro'''' |
|
846 in |
858 in |
847 intro''''' |
859 intro''''' |
848 end |
860 end |
849 |
861 |
850 (*** conversions ***) |
862 (*** conversions ***) |