4 HOL setup for linear arithmetic (see Provers/Arith/fast_lin_arith.ML). |
4 HOL setup for linear arithmetic (see Provers/Arith/fast_lin_arith.ML). |
5 *) |
5 *) |
6 |
6 |
7 signature LIN_ARITH = |
7 signature LIN_ARITH = |
8 sig |
8 sig |
9 val pre_tac: Proof.context -> int -> tactic |
9 val pre_tac: simpset -> int -> tactic |
10 val simple_tac: Proof.context -> int -> tactic |
10 val simple_tac: Proof.context -> int -> tactic |
11 val tac: Proof.context -> int -> tactic |
11 val tac: Proof.context -> int -> tactic |
12 val simproc: simpset -> term -> thm option |
12 val simproc: simpset -> term -> thm option |
13 val add_inj_thms: thm list -> Context.generic -> Context.generic |
13 val add_inj_thms: thm list -> Context.generic -> Context.generic |
14 val add_lessD: thm -> Context.generic -> Context.generic |
14 val add_lessD: thm -> Context.generic -> Context.generic |
703 val nnf_simpset = |
703 val nnf_simpset = |
704 empty_ss setmkeqTrue mk_eq_True |
704 empty_ss setmkeqTrue mk_eq_True |
705 setmksimps (mksimps mksimps_pairs) |
705 setmksimps (mksimps mksimps_pairs) |
706 addsimps [imp_conv_disj, iff_conv_conj_imp, de_Morgan_disj, de_Morgan_conj, |
706 addsimps [imp_conv_disj, iff_conv_conj_imp, de_Morgan_disj, de_Morgan_conj, |
707 not_all, not_ex, not_not] |
707 not_all, not_ex, not_not] |
708 fun prem_nnf_tac i st = |
708 fun prem_nnf_tac ss = full_simp_tac (Simplifier.inherit_context ss nnf_simpset) |
709 full_simp_tac (Simplifier.theory_context (Thm.theory_of_thm st) nnf_simpset) |
|
710 i st |
|
711 in |
709 in |
712 |
710 |
713 fun split_once_tac ctxt split_thms = |
711 fun split_once_tac ss split_thms = |
714 let |
712 let |
|
713 val ctxt = Simplifier.the_context ss |
715 val thy = ProofContext.theory_of ctxt |
714 val thy = ProofContext.theory_of ctxt |
716 val cond_split_tac = SUBGOAL (fn (subgoal, i) => |
715 val cond_split_tac = SUBGOAL (fn (subgoal, i) => |
717 let |
716 let |
718 val Ts = rev (map snd (Logic.strip_params subgoal)) |
717 val Ts = rev (map snd (Logic.strip_params subgoal)) |
719 val concl = HOLogic.dest_Trueprop (Logic.strip_assums_concl subgoal) |
718 val concl = HOLogic.dest_Trueprop (Logic.strip_assums_concl subgoal) |
744 (* remove irrelevant premises, then split the i-th subgoal (and all new *) |
743 (* remove irrelevant premises, then split the i-th subgoal (and all new *) |
745 (* subgoals) by using 'split_once_tac' repeatedly. Beta-eta-normalize new *) |
744 (* subgoals) by using 'split_once_tac' repeatedly. Beta-eta-normalize new *) |
746 (* subgoals and finally attempt to solve them by finding an immediate *) |
745 (* subgoals and finally attempt to solve them by finding an immediate *) |
747 (* contradiction (i.e., a term and its negation) in their premises. *) |
746 (* contradiction (i.e., a term and its negation) in their premises. *) |
748 |
747 |
749 fun pre_tac ctxt i = |
748 fun pre_tac ss i = |
750 let |
749 let |
|
750 val ctxt = Simplifier.the_context ss; |
751 val split_thms = filter is_split_thm (#splits (get_arith_data ctxt)) |
751 val split_thms = filter is_split_thm (#splits (get_arith_data ctxt)) |
752 fun is_relevant t = is_some (decomp ctxt t) |
752 fun is_relevant t = is_some (decomp ctxt t) |
753 in |
753 in |
754 DETERM ( |
754 DETERM ( |
755 TRY (filter_prems_tac is_relevant i) |
755 TRY (filter_prems_tac is_relevant i) |
756 THEN ( |
756 THEN ( |
757 (TRY o REPEAT_ALL_NEW (split_once_tac ctxt split_thms)) |
757 (TRY o REPEAT_ALL_NEW (split_once_tac ss split_thms)) |
758 THEN_ALL_NEW |
758 THEN_ALL_NEW |
759 (CONVERSION Drule.beta_eta_conversion |
759 (CONVERSION Drule.beta_eta_conversion |
760 THEN' |
760 THEN' |
761 (TRY o (etac notE THEN' eq_assume_tac))) |
761 (TRY o (etac notE THEN' eq_assume_tac))) |
762 ) i |
762 ) i |