diff --git a/thys/Ordered_Resolution_Prover/Standard_Redundancy.thy b/thys/Ordered_Resolution_Prover/Standard_Redundancy.thy --- a/thys/Ordered_Resolution_Prover/Standard_Redundancy.thy +++ b/thys/Ordered_Resolution_Prover/Standard_Redundancy.thy @@ -1,339 +1,339 @@ (* Title: The Standard Redundancy Criterion Author: Jasmin Blanchette , 2014, 2017 Author: Dmitriy Traytel , 2014 Author: Anders Schlichtkrull , 2017 Maintainer: Anders Schlichtkrull *) section \The Standard Redundancy Criterion\ theory Standard_Redundancy imports Proving_Process begin text \ This material is based on Section 4.2.2 (``The Standard Redundancy Criterion'') of Bachmair and Ganzinger's chapter. \ locale standard_redundancy_criterion = inference_system \ for \ :: "('a :: wellorder) inference set" begin definition redundant_infer :: "'a clause set \ 'a inference \ bool" where - "redundant_infer N \ \ - \DD. set_mset DD \ N \ (\I. I \m DD + side_prems_of \ \ I \ concl_of \) - \ (\D. D \# DD \ D < main_prem_of \)" + "redundant_infer N \ \ + (\DD. set_mset DD \ N \ (\I. I \m DD + side_prems_of \ \ I \ concl_of \) + \ (\D. D \# DD \ D < main_prem_of \))" definition Rf :: "'a clause set \ 'a clause set" where "Rf N = {C. \DD. set_mset DD \ N \ (\I. I \m DD \ I \ C) \ (\D. D \# DD \ D < C)}" definition Ri :: "'a clause set \ 'a inference set" where "Ri N = {\ \ \. redundant_infer N \}" lemma tautology_Rf: assumes "Pos A \# C" assumes "Neg A \# C" shows "C \ Rf N" proof - have "set_mset {#} \ N \ (\I. I \m {#} \ I \ C) \ (\D. D \# {#} \ D < C)" using assms by auto then show "C \ Rf N" unfolding Rf_def by blast qed lemma tautology_redundant_infer: assumes pos: "Pos A \# concl_of \" and neg: "Neg A \# concl_of \" shows "redundant_infer N \" by (metis empty_iff empty_subsetI neg pos pos_neg_in_imp_true redundant_infer_def set_mset_empty) lemma contradiction_Rf: "{#} \ N \ Rf N = UNIV - {{#}}" unfolding Rf_def by force text \ The following results correspond to Lemma 4.5. The lemma \wlog_non_Rf\ generalizes the core of the argument. \ lemma Rf_mono: "N \ N' \ Rf N \ Rf N'" unfolding Rf_def by auto lemma wlog_non_Rf: assumes ex: "\DD. set_mset DD \ N \ (\I. I \m DD + CC \ I \ E) \ (\D'. D' \# DD \ D' < D)" shows "\DD. set_mset DD \ N - Rf N \ (\I. I \m DD + CC \ I \ E) \ (\D'. D' \# DD \ D' < D)" proof - from ex obtain DD0 where dd0: "DD0 \ {DD. set_mset DD \ N \ (\I. I \m DD + CC \ I \ E) \ (\D'. D' \# DD \ D' < D)}" by blast have "\DD. set_mset DD \ N \ (\I. I \m DD + CC \ I \ E) \ (\D'. D' \# DD \ D' < D) \ (\DD'. set_mset DD' \ N \ (\I. I \m DD' + CC \ I \ E) \ (\D'. D' \# DD' \ D' < D) \ DD \ DD')" using wf_eq_minimal[THEN iffD1, rule_format, OF wf_less_multiset dd0] unfolding not_le[symmetric] by blast then obtain DD where dd_subs_n: "set_mset DD \ N" and ddcc_imp_e: "\I. I \m DD + CC \ I \ E" and dd_lt_d: "\D'. D' \# DD \ D' < D" and d_min: "\DD'. set_mset DD' \ N \ (\I. I \m DD' + CC \ I \ E) \ (\D'. D' \# DD' \ D' < D) \ DD \ DD'" by blast have "\Da. Da \# DD \ Da \ Rf N" proof clarify fix Da assume da_in_dd: "Da \# DD" and da_rf: "Da \ Rf N" from da_rf obtain DD' where dd'_subs_n: "set_mset DD' \ N" and dd'_imp_da: "\I. I \m DD' \ I \ Da" and dd'_lt_da: "\D'. D' \# DD' \ D' < Da" unfolding Rf_def by blast define DDa where "DDa = DD - {#Da#} + DD'" have "set_mset DDa \ N" unfolding DDa_def using dd_subs_n dd'_subs_n by (meson contra_subsetD in_diffD subsetI union_iff) moreover have "\I. I \m DDa + CC \ I \ E" using dd'_imp_da ddcc_imp_e da_in_dd unfolding DDa_def true_cls_mset_def by (metis in_remove1_mset_neq union_iff) moreover have "\D'. D' \# DDa \ D' < D" using dd_lt_d dd'_lt_da da_in_dd unfolding DDa_def by (metis insert_DiffM2 order.strict_trans union_iff) moreover have "DDa < DD" unfolding DDa_def by (meson da_in_dd dd'_lt_da mset_lt_single_right_iff single_subset_iff union_le_diff_plus) ultimately show False using d_min unfolding less_eq_multiset_def by (auto intro!: antisym) qed then show ?thesis using dd_subs_n ddcc_imp_e dd_lt_d by auto qed lemma Rf_imp_ex_non_Rf: assumes "C \ Rf N" shows "\CC. set_mset CC \ N - Rf N \ (\I. I \m CC \ I \ C) \ (\C'. C' \# CC \ C' < C)" using assms by (auto simp: Rf_def intro: wlog_non_Rf[of _ "{#}", simplified]) lemma Rf_subs_Rf_diff_Rf: "Rf N \ Rf (N - Rf N)" proof fix C assume c_rf: "C \ Rf N" then obtain CC where cc_subs: "set_mset CC \ N - Rf N" and cc_imp_c: "\I. I \m CC \ I \ C" and cc_lt_c: "\C'. C' \# CC \ C' < C" using Rf_imp_ex_non_Rf by blast have "\D. D \# CC \ D \ Rf N" using cc_subs by (simp add: subset_iff) then have cc_nr: "\C DD. C \# CC \ set_mset DD \ N \ \I. I \m DD \ I \ C \ \D. D \# DD \ ~ D < C" unfolding Rf_def by auto metis have "set_mset CC \ N" using cc_subs by auto then have "set_mset CC \ N - {C. \DD. set_mset DD \ N \ (\I. I \m DD \ I \ C) \ (\D. D \# DD \ D < C)}" using cc_nr by auto then show "C \ Rf (N - Rf N)" using cc_imp_c cc_lt_c unfolding Rf_def by auto qed lemma Rf_eq_Rf_diff_Rf: "Rf N = Rf (N - Rf N)" by (metis Diff_subset Rf_mono Rf_subs_Rf_diff_Rf subset_antisym) text \ The following results correspond to Lemma 4.6. \ lemma Ri_mono: "N \ N' \ Ri N \ Ri N'" unfolding Ri_def redundant_infer_def by auto lemma Ri_subs_Ri_diff_Rf: "Ri N \ Ri (N - Rf N)" proof fix \ assume \_ri: "\ \ Ri N" then obtain CC D E where \: "\ = Infer CC D E" by (cases \) have cc: "CC = side_prems_of \" and d: "D = main_prem_of \" and e: "E = concl_of \" unfolding \ by simp_all obtain DD where "set_mset DD \ N" and "\I. I \m DD + CC \ I \ E" and "\C. C \# DD \ C < D" using \_ri unfolding Ri_def redundant_infer_def cc d e by blast then obtain DD' where "set_mset DD' \ N - Rf N" and "\I. I \m DD' + CC \ I \ E" and "\D'. D' \# DD' \ D' < D" using wlog_non_Rf by atomize_elim blast then show "\ \ Ri (N - Rf N)" using \_ri unfolding Ri_def redundant_infer_def d cc e by blast qed lemma Ri_eq_Ri_diff_Rf: "Ri N = Ri (N - Rf N)" by (metis Diff_subset Ri_mono Ri_subs_Ri_diff_Rf subset_antisym) lemma Ri_subset_\: "Ri N \ \" unfolding Ri_def by blast lemma Rf_indep: "N' \ Rf N \ Rf N \ Rf (N - N')" by (metis Diff_cancel Diff_eq_empty_iff Diff_mono Rf_eq_Rf_diff_Rf Rf_mono) lemma Ri_indep: "N' \ Rf N \ Ri N \ Ri (N - N')" by (metis Diff_mono Ri_eq_Ri_diff_Rf Ri_mono order_refl) lemma Rf_model: assumes "I \s N - Rf N" shows "I \s N" proof - have "I \s Rf (N - Rf N)" unfolding true_clss_def by (subst Rf_def, simp add: true_cls_mset_def, metis assms subset_eq true_clss_def) then have "I \s Rf N" using Rf_subs_Rf_diff_Rf true_clss_mono by blast then show ?thesis using assms by (metis Un_Diff_cancel true_clss_union) qed lemma Rf_sat: "satisfiable (N - Rf N) \ satisfiable N" by (metis Rf_model) text \ The following corresponds to Theorem 4.7: \ sublocale redundancy_criterion \ Rf Ri by unfold_locales (rule Ri_subset_\, (elim Rf_mono Ri_mono Rf_indep Ri_indep Rf_sat)+) end locale standard_redundancy_criterion_reductive = standard_redundancy_criterion + reductive_inference_system begin text \ The following corresponds to Theorem 4.8: \ lemma Ri_effective: assumes in_\: "\ \ \" and concl_of_in_n_un_rf_n: "concl_of \ \ N \ Rf N" shows "\ \ Ri N" proof - obtain CC D E where \: "\ = Infer CC D E" by (cases \) then have cc: "CC = side_prems_of \" and d: "D = main_prem_of \" and e: "E = concl_of \" unfolding \ by simp_all note e_in_n_un_rf_n = concl_of_in_n_un_rf_n[folded e] { assume "E \ N" moreover have "E < D" using \_reductive e d in_\ by auto ultimately have "set_mset {#E#} \ N" and "\I. I \m {#E#} + CC \ I \ E" and "\D'. D' \# {#E#} \ D' < D" by simp_all then have "redundant_infer N \" using redundant_infer_def cc d e by blast } moreover { assume "E \ Rf N" then obtain DD where dd_sset: "set_mset DD \ N" and dd_imp_e: "\I. I \m DD \ I \ E" and dd_lt_e: "\C'. C' \# DD \ C' < E" unfolding Rf_def by blast from dd_lt_e have "\Da. Da \# DD \ Da < D" using d e in_\ \_reductive less_trans by blast then have "redundant_infer N \" using redundant_infer_def dd_sset dd_imp_e cc d e by blast } ultimately show "\ \ Ri N" using in_\ e_in_n_un_rf_n unfolding Ri_def by blast qed sublocale effective_redundancy_criterion \ Rf Ri unfolding effective_redundancy_criterion_def by (intro conjI redundancy_criterion_axioms, unfold_locales, rule Ri_effective) lemma contradiction_Rf: "{#} \ N \ Ri N = \" unfolding Ri_def redundant_infer_def using \_reductive le_multiset_empty_right by (force intro: exI[of _ "{#{#}#}"] le_multiset_empty_left) end locale standard_redundancy_criterion_counterex_reducing = standard_redundancy_criterion + counterex_reducing_inference_system begin text \ The following result corresponds to Theorem 4.9. \ lemma saturated_upto_complete_if: assumes satur: "saturated_upto N" and unsat: "\ satisfiable N" shows "{#} \ N" proof (rule ccontr) assume ec_ni_n: "{#} \ N" define M where "M = N - Rf N" have ec_ni_m: "{#} \ M" unfolding M_def using ec_ni_n by fast have "I_of M \s M" proof (rule ccontr) assume "\ I_of M \s M" then obtain D where d_in_m: "D \ M" and d_cex: "\ I_of M \ D" and d_min: "\C. C \ M \ C < D \ I_of M \ C" using ex_min_counterex by meson then obtain \ CC E where \: "\ = Infer CC D E" and cc_subs_m: "set_mset CC \ M" and cc_true: "I_of M \m CC" and \_in: "\ \ \" and e_cex: "\ I_of M \ E" and e_lt_d: "E < D" using \_counterex_reducing[OF ec_ni_m] not_less by metis have cc: "CC = side_prems_of \" and d: "D = main_prem_of \" and e: "E = concl_of \" unfolding \ by simp_all have "\ \ Ri N" by (rule subsetD[OF satur[unfolded saturated_upto_def inferences_from_def infer_from_def]]) (simp add: \_in d_in_m cc_subs_m cc[symmetric] d[symmetric] M_def[symmetric]) then have "\ \ Ri M" unfolding M_def using Ri_indep by fast then obtain DD where dd_subs_m: "set_mset DD \ M" and dd_cc_imp_d: "\I. I \m DD + CC \ I \ E" and dd_lt_d: "\C. C \# DD \ C < D" unfolding Ri_def redundant_infer_def cc d e by blast from dd_subs_m dd_lt_d have "I_of M \m DD" using d_min unfolding true_cls_mset_def by (metis contra_subsetD) then have "I_of M \ E" using dd_cc_imp_d cc_true by auto then show False using e_cex by auto qed then have "I_of M \s N" using M_def Rf_model by blast then show False using unsat by blast qed theorem saturated_upto_complete: assumes "saturated_upto N" shows "\ satisfiable N \ {#} \ N" using assms saturated_upto_complete_if true_clss_def by auto end end diff --git a/thys/Saturation_Framework/Calculi.thy b/thys/Saturation_Framework/Calculi.thy --- a/thys/Saturation_Framework/Calculi.thy +++ b/thys/Saturation_Framework/Calculi.thy @@ -1,920 +1,920 @@ (* Title: Calculi of the Saturation Framework * Author: Sophie Tourret , 2018-2020 *) section \Calculi\ text \In this section, the section 2.2 to 2.4 of the report are covered. This includes results on calculi equipped with a redundancy criterion or with a family of redundancy criteria, as well as a proof that various notions of redundancy are equivalent\ theory Calculi imports Consequence_Relations_and_Inference_Systems Ordered_Resolution_Prover.Lazy_List_Liminf Ordered_Resolution_Prover.Lazy_List_Chain begin subsection \Calculi with a Redundancy Criterion\ locale calculus_with_red_crit = inference_system Inf + consequence_relation Bot entails for Bot :: "'f set" and Inf :: \'f inference set\ and entails :: "'f set \ 'f set \ bool" (infix "\" 50) + fixes Red_Inf :: "'f set \ 'f inference set" and Red_F :: "'f set \ 'f set" assumes Red_Inf_to_Inf: "Red_Inf N \ Inf" and Red_F_Bot: "B \ Bot \ N \ {B} \ N - Red_F N \ {B}" and Red_F_of_subset: "N \ N' \ Red_F N \ Red_F N'" and Red_Inf_of_subset: "N \ N' \ Red_Inf N \ Red_Inf N'" and Red_F_of_Red_F_subset: "N' \ Red_F N \ Red_F N \ Red_F (N - N')" and Red_Inf_of_Red_F_subset: "N' \ Red_F N \ Red_Inf N \ Red_Inf (N - N')" and Red_Inf_of_Inf_to_N: "\ \ Inf \ concl_of \ \ N \ \ \ Red_Inf N" begin -lemma Red_Inf_of_Inf_to_N_subset: "{\ \ Inf. (concl_of \ \ N)} \ Red_Inf N" +lemma Red_Inf_of_Inf_to_N_subset: "{\ \ Inf. concl_of \ \ N} \ Red_Inf N" using Red_Inf_of_Inf_to_N by blast (* lem:red-concl-implies-red-inf *) lemma red_concl_to_red_inf: assumes i_in: "\ \ Inf" and concl: "concl_of \ \ Red_F N" shows "\ \ Red_Inf N" proof - have "\ \ Red_Inf (Red_F N)" by (simp add: Red_Inf_of_Inf_to_N i_in concl) then have i_in_Red: "\ \ Red_Inf (N \ Red_F N)" by (simp add: Red_Inf_of_Inf_to_N concl i_in) have red_n_subs: "Red_F N \ Red_F (N \ Red_F N)" by (simp add: Red_F_of_subset) then have "\ \ Red_Inf ((N \ Red_F N) - (Red_F N - N))" using Red_Inf_of_Red_F_subset i_in_Red by (meson Diff_subset subsetCE subset_trans) then show ?thesis by (metis Diff_cancel Diff_subset Un_Diff Un_Diff_cancel contra_subsetD calculus_with_red_crit.Red_Inf_of_subset calculus_with_red_crit_axioms sup_bot.right_neutral) qed definition saturated :: "'f set \ bool" where "saturated N \ Inf_from N \ Red_Inf N" definition reduc_saturated :: "'f set \ bool" where "reduc_saturated N \ Inf_from (N - Red_F N) \ Red_Inf N" lemma Red_Inf_without_red_F: "Red_Inf (N - Red_F N) = Red_Inf N" using Red_Inf_of_subset [of "N - Red_F N" N] and Red_Inf_of_Red_F_subset [of "Red_F N" N] by blast lemma saturated_without_red_F: assumes saturated: "saturated N" shows "saturated (N - Red_F N)" proof - have "Inf_from (N - Red_F N) \ Inf_from N" unfolding Inf_from_def by auto also have "Inf_from N \ Red_Inf N" using saturated unfolding saturated_def by auto also have "Red_Inf N \ Red_Inf (N - Red_F N)" using Red_Inf_of_Red_F_subset by auto finally have "Inf_from (N - Red_F N) \ Red_Inf (N - Red_F N)" by auto then show ?thesis unfolding saturated_def by auto qed definition Sup_Red_Inf_llist :: "'f set llist \ 'f inference set" where "Sup_Red_Inf_llist D = (\i \ {i. enat i < llength D}. Red_Inf (lnth D i))" lemma Sup_Red_Inf_unit: "Sup_Red_Inf_llist (LCons X LNil) = Red_Inf X" using Sup_Red_Inf_llist_def enat_0_iff(1) by simp definition fair :: "'f set llist \ bool" where "fair D \ Inf_from (Liminf_llist D) \ Sup_Red_Inf_llist D" inductive "derive" :: "'f set \ 'f set \ bool" (infix "\Red" 50) where derive: "M - N \ Red_F N \ M \Red N" lemma gt_Max_notin: \finite A \ A \ {} \ x > Max A \ x \ A\ by auto lemma equiv_Sup_Liminf: assumes in_Sup: "C \ Sup_llist D" and not_in_Liminf: "C \ Liminf_llist D" shows "\ i \ {i. enat (Suc i) < llength D}. C \ lnth D i - lnth D (Suc i)" proof - obtain i where C_D_i: "C \ Sup_upto_llist D i" and "i < llength D" using elem_Sup_llist_imp_Sup_upto_llist in_Sup by fast then obtain j where j: "j \ i \ enat j < llength D \ C \ lnth D j" using not_in_Liminf unfolding Sup_llist_def chain_def Liminf_llist_def by auto obtain k where k: "C \ lnth D k" "enat k < llength D" "k \ i" using C_D_i unfolding Sup_upto_llist_def by auto let ?S = "{i. i < j \ i \ k \ C \ lnth D i}" define l where "l \ Max ?S" have \k \ {i. i < j \ k \ i \ C \ lnth D i}\ using k j by (auto simp: order.order_iff_strict) then have nempty: "{i. i < j \ k \ i \ C \ lnth D i} \ {}" by auto then have l_prop: "l < j \ l \ k \ C \ (lnth D l)" using Max_in[of ?S, OF _ nempty] unfolding l_def by auto then have "C \ lnth D l - lnth D (Suc l)" using j gt_Max_notin[OF _ nempty, of "Suc l"] unfolding l_def[symmetric] by (auto intro: Suc_lessI) then show ?thesis proof (rule bexI[of _ l]) show "l \ {i. enat (Suc i) < llength D}" using l_prop j by (clarify, metis Suc_leI dual_order.order_iff_strict enat_ord_simps(2) less_trans) qed qed (* lem:nonpersistent-is-redundant *) lemma Red_in_Sup: assumes deriv: "chain (\Red) D" shows "Sup_llist D - Liminf_llist D \ Red_F (Sup_llist D)" proof fix C assume C_in_subset: "C \ Sup_llist D - Liminf_llist D" { fix C i assume in_ith_elem: "C \ lnth D i - lnth D (Suc i)" and i: "enat (Suc i) < llength D" have "lnth D i \Red lnth D (Suc i)" using i deriv in_ith_elem chain_lnth_rel by auto then have "C \ Red_F (lnth D (Suc i))" using in_ith_elem derive.cases by blast then have "C \ Red_F (Sup_llist D)" using Red_F_of_subset by (meson contra_subsetD i lnth_subset_Sup_llist) } then show "C \ Red_F (Sup_llist D)" using equiv_Sup_Liminf[of C] C_in_subset by fast qed (* lem:redundant-remains-redundant-during-run 1/2 *) lemma Red_Inf_subset_Liminf: assumes deriv: \chain (\Red) D\ and i: \enat i < llength D\ shows \Red_Inf (lnth D i) \ Red_Inf (Liminf_llist D)\ proof - have Sup_in_diff: \Red_Inf (Sup_llist D) \ Red_Inf (Sup_llist D - (Sup_llist D - Liminf_llist D))\ using Red_Inf_of_Red_F_subset[OF Red_in_Sup] deriv by auto also have \Sup_llist D - (Sup_llist D - Liminf_llist D) = Liminf_llist D\ by (simp add: Liminf_llist_subset_Sup_llist double_diff) then have Red_Inf_Sup_in_Liminf: \Red_Inf (Sup_llist D) \ Red_Inf (Liminf_llist D)\ using Sup_in_diff by auto have \lnth D i \ Sup_llist D\ unfolding Sup_llist_def using i by blast then have "Red_Inf (lnth D i) \ Red_Inf (Sup_llist D)" using Red_Inf_of_subset unfolding Sup_llist_def by auto then show ?thesis using Red_Inf_Sup_in_Liminf by auto qed (* lem:redundant-remains-redundant-during-run 2/2 *) lemma Red_F_subset_Liminf: assumes deriv: \chain (\Red) D\ and i: \enat i < llength D\ shows \Red_F (lnth D i) \ Red_F (Liminf_llist D)\ proof - have Sup_in_diff: \Red_F (Sup_llist D) \ Red_F (Sup_llist D - (Sup_llist D - Liminf_llist D))\ using Red_F_of_Red_F_subset[OF Red_in_Sup] deriv by auto also have \Sup_llist D - (Sup_llist D - Liminf_llist D) = Liminf_llist D\ by (simp add: Liminf_llist_subset_Sup_llist double_diff) then have Red_F_Sup_in_Liminf: \Red_F (Sup_llist D) \ Red_F (Liminf_llist D)\ using Sup_in_diff by auto have \lnth D i \ Sup_llist D\ unfolding Sup_llist_def using i by blast then have "Red_F (lnth D i) \ Red_F (Sup_llist D)" using Red_F_of_subset unfolding Sup_llist_def by auto then show ?thesis using Red_F_Sup_in_Liminf by auto qed (* lem:N-i-is-persistent-or-redundant *) lemma i_in_Liminf_or_Red_F: assumes deriv: \chain (\Red) D\ and i: \enat i < llength D\ shows \lnth D i \ Red_F (Liminf_llist D) \ Liminf_llist D\ proof (rule,rule) fix C assume C: \C \ lnth D i\ and C_not_Liminf: \C \ Liminf_llist D\ have \C \ Sup_llist D\ unfolding Sup_llist_def using C i by auto then obtain j where j: \C \ lnth D j - lnth D (Suc j)\ \enat (Suc j) < llength D\ using equiv_Sup_Liminf[of C D] C_not_Liminf by auto then have \C \ Red_F (lnth D (Suc j))\ using deriv by (meson chain_lnth_rel contra_subsetD derive.cases) then show \C \ Red_F (Liminf_llist D)\ using Red_F_subset_Liminf[of D "Suc j"] deriv j(2) by blast qed (* lem:fairness-implies-saturation *) lemma fair_implies_Liminf_saturated: assumes deriv: \chain (\Red) D\ and fair: \fair D\ shows \saturated (Liminf_llist D)\ unfolding saturated_def proof fix \ assume \: \\ \ Inf_from (Liminf_llist D)\ have \\ \ Sup_Red_Inf_llist D\ using fair \ unfolding fair_def by auto then obtain i where i: \enat i < llength D\ \\ \ Red_Inf (lnth D i)\ unfolding Sup_Red_Inf_llist_def by auto then show \\ \ Red_Inf (Liminf_llist D)\ using deriv i_in_Liminf_or_Red_F[of D i] Red_Inf_subset_Liminf by blast qed end locale static_refutational_complete_calculus = calculus_with_red_crit + assumes static_refutational_complete: "B \ Bot \ saturated N \ N \ {B} \ \B'\Bot. B' \ N" locale dynamic_refutational_complete_calculus = calculus_with_red_crit + assumes dynamic_refutational_complete: "B \ Bot \ chain (\Red) D \ fair D \ lnth D 0 \ {B} \ \i \ {i. enat i < llength D}. \B'\Bot. B' \ lnth D i" begin (* lem:dynamic-ref-compl-implies-static *) sublocale static_refutational_complete_calculus proof fix B N assume bot_elem: \B \ Bot\ and saturated_N: "saturated N" and refut_N: "N \ {B}" define D where "D = LCons N LNil" have[simp]: \\ lnull D\ by (auto simp: D_def) have deriv_D: \chain (\Red) D\ by (simp add: chain.chain_singleton D_def) have liminf_is_N: "Liminf_llist D = N" by (simp add: D_def Liminf_llist_LCons) have head_D: "N = lnth D 0" by (simp add: D_def) have "Sup_Red_Inf_llist D = Red_Inf N" by (simp add: D_def Sup_Red_Inf_unit) then have fair_D: "fair D" using saturated_N by (simp add: fair_def saturated_def liminf_is_N) obtain i B' where B'_is_bot: \B' \ Bot\ and B'_in: "B' \ (lnth D i)" and \i < llength D\ using dynamic_refutational_complete[of B D] bot_elem fair_D head_D saturated_N deriv_D refut_N by auto then have "i = 0" by (auto simp: D_def enat_0_iff) show \\B'\Bot. B' \ N\ using B'_is_bot B'_in unfolding \i = 0\ head_D[symmetric] by auto qed end (* lem:static-ref-compl-implies-dynamic *) sublocale static_refutational_complete_calculus \ dynamic_refutational_complete_calculus proof fix B D assume bot_elem: \B \ Bot\ and deriv: \chain (\Red) D\ and fair: \fair D\ and - unsat: \(lnth D 0) \ {B}\ + unsat: \lnth D 0 \ {B}\ have non_empty: \\ lnull D\ using chain_not_lnull[OF deriv] . - have subs: \(lnth D 0) \ Sup_llist D\ + have subs: \lnth D 0 \ Sup_llist D\ using lhd_subset_Sup_llist[of D] non_empty by (simp add: lhd_conv_lnth) have \Sup_llist D \ {B}\ using unsat subset_entailed[OF subs] entails_trans[of "Sup_llist D" "lnth D 0"] by auto then have Sup_no_Red: \Sup_llist D - Red_F (Sup_llist D) \ {B}\ using bot_elem Red_F_Bot by auto have Sup_no_Red_in_Liminf: \Sup_llist D - Red_F (Sup_llist D) \ Liminf_llist D\ using deriv Red_in_Sup by auto have Liminf_entails_Bot: \Liminf_llist D \ {B}\ using Sup_no_Red subset_entailed[OF Sup_no_Red_in_Liminf] entails_trans by blast have \saturated (Liminf_llist D)\ using deriv fair fair_implies_Liminf_saturated unfolding saturated_def by auto then have \\B'\Bot. B' \ (Liminf_llist D)\ using bot_elem static_refutational_complete Liminf_entails_Bot by auto then show \\i\{i. enat i < llength D}. \B'\Bot. B' \ lnth D i\ unfolding Liminf_llist_def by auto qed subsection \Calculi with a Family of Redundancy Criteria\ locale calculus_with_red_crit_family = inference_system Inf + consequence_relation_family Bot Q entails_q for Bot :: "'f set" and Inf :: \'f inference set\ and Q :: "'q itself" and entails_q :: "'q \ ('f set \ 'f set \ bool)" + fixes Red_Inf_q :: "'q \ ('f set \ 'f inference set)" and Red_F_q :: "'q \ ('f set \ 'f set)" assumes all_red_crit: "calculus_with_red_crit Bot Inf (entails_q q) (Red_Inf_q q) (Red_F_q q)" begin definition Red_Inf_Q :: "'f set \ 'f inference set" where "Red_Inf_Q N = \ {X N |X. X \ (Red_Inf_q ` UNIV)}" definition Red_F_Q :: "'f set \ 'f set" where "Red_F_Q N = \ {X N |X. X \ (Red_F_q ` UNIV)}" (* lem:intersection-of-red-crit *) lemma inter_red_crit: "calculus_with_red_crit Bot Inf entails_Q Red_Inf_Q Red_F_Q" unfolding calculus_with_red_crit_def calculus_with_red_crit_axioms_def proof (intro conjI) show "consequence_relation Bot entails_Q" using intersect_cons_rel_family . next show "\N. Red_Inf_Q N \ Inf" unfolding Red_Inf_Q_def proof fix N show "\ {X N |X. X \ Red_Inf_q ` UNIV} \ Inf" proof (intro Inter_subset) fix Red_Infs assume one_red_inf: "Red_Infs \ {X N |X. X \ Red_Inf_q ` UNIV}" show "Red_Infs \ Inf" using one_red_inf proof assume "\Red_Inf_qi. Red_Infs = Red_Inf_qi N \ Red_Inf_qi \ Red_Inf_q ` UNIV" then obtain Red_Inf_qi where red_infs_def: "Red_Infs = Red_Inf_qi N" and red_inf_qi_in: "Red_Inf_qi \ Red_Inf_q ` UNIV" by blast obtain qi where red_inf_qi_def: "Red_Inf_qi = Red_Inf_q qi" and qi_in: "qi \ UNIV" using red_inf_qi_in by blast show "Red_Infs \ Inf" using all_red_crit calculus_with_red_crit.Red_Inf_to_Inf red_inf_qi_def red_infs_def by blast qed next show "{X N |X. X \ Red_Inf_q ` UNIV} \ {}" by blast qed qed next show "\B N. B \ Bot \ N \Q {B} \ N - Red_F_Q N \Q {B}" proof (intro allI impI) fix B N assume B_in: "B \ Bot" and N_unsat: "N \Q {B}" show "N - Red_F_Q N \Q {B}" unfolding entails_Q_def Red_F_Q_def proof fix qi define entails_qi (infix "\qi" 50) where "entails_qi = entails_q qi" have cons_rel_qi: "consequence_relation Bot entails_qi" unfolding entails_qi_def using all_red_crit calculus_with_red_crit.axioms(1) by blast define Red_F_qi where "Red_F_qi = Red_F_q qi" have red_qi_in_Q: "Red_F_Q N \ Red_F_qi N" unfolding Red_F_Q_def Red_F_qi_def using image_iff by blast then have "N - (Red_F_qi N) \ N - (Red_F_Q N)" by blast then have entails_1: "(N - Red_F_Q N) \qi (N - Red_F_qi N)" using all_red_crit unfolding calculus_with_red_crit_def consequence_relation_def entails_qi_def by metis have N_unsat_qi: "N \qi {B}" using N_unsat unfolding entails_qi_def entails_Q_def by simp then have N_unsat_qi: "(N - Red_F_qi N) \qi {B}" using all_red_crit Red_F_qi_def calculus_with_red_crit.Red_F_Bot[OF _ B_in] entails_qi_def by fastforce show "(N - \ {X N |X. X \ Red_F_q ` UNIV}) \qi {B}" using consequence_relation.entails_trans[OF cons_rel_qi entails_1 N_unsat_qi] unfolding Red_F_Q_def . qed qed next show "\N1 N2. N1 \ N2 \ Red_F_Q N1 \ Red_F_Q N2" proof (intro allI impI) fix N1 :: "'f set" and N2 :: "'f set" assume N1_in_N2: "N1 \ N2" show "Red_F_Q N1 \ Red_F_Q N2" proof fix x assume x_in: "x \ Red_F_Q N1" then have "\qi. x \ Red_F_q qi N1" unfolding Red_F_Q_def by blast then have "\qi. x \ Red_F_q qi N2" using N1_in_N2 all_red_crit calculus_with_red_crit.axioms(2) calculus_with_red_crit.Red_F_of_subset by blast then show "x \ Red_F_Q N2" unfolding Red_F_Q_def by blast qed qed next show "\N1 N2. N1 \ N2 \ Red_Inf_Q N1 \ Red_Inf_Q N2" proof (intro allI impI) fix N1 :: "'f set" and N2 :: "'f set" assume N1_in_N2: "N1 \ N2" show "Red_Inf_Q N1 \ Red_Inf_Q N2" proof fix x assume x_in: "x \ Red_Inf_Q N1" then have "\qi. x \ Red_Inf_q qi N1" unfolding Red_Inf_Q_def by blast then have "\qi. x \ Red_Inf_q qi N2" using N1_in_N2 all_red_crit calculus_with_red_crit.axioms(2) calculus_with_red_crit.Red_Inf_of_subset by blast then show "x \ Red_Inf_Q N2" unfolding Red_Inf_Q_def by blast qed qed next show "\N2 N1. N2 \ Red_F_Q N1 \ Red_F_Q N1 \ Red_F_Q (N1 - N2)" proof (intro allI impI) fix N2 N1 assume N2_in_Red_N1: "N2 \ Red_F_Q N1" show "Red_F_Q N1 \ Red_F_Q (N1 - N2)" proof fix x assume x_in: "x \ Red_F_Q N1" then have "\qi. x \ Red_F_q qi N1" unfolding Red_F_Q_def by blast moreover have "\qi. N2 \ Red_F_q qi N1" using N2_in_Red_N1 unfolding Red_F_Q_def by blast ultimately have "\qi. x \ Red_F_q qi (N1 - N2)" using all_red_crit calculus_with_red_crit.axioms(2) calculus_with_red_crit.Red_F_of_Red_F_subset by blast then show "x \ Red_F_Q (N1 - N2)" unfolding Red_F_Q_def by blast qed qed next show "\N2 N1. N2 \ Red_F_Q N1 \ Red_Inf_Q N1 \ Red_Inf_Q (N1 - N2)" proof (intro allI impI) fix N2 N1 assume N2_in_Red_N1: "N2 \ Red_F_Q N1" show "Red_Inf_Q N1 \ Red_Inf_Q (N1 - N2)" proof fix x assume x_in: "x \ Red_Inf_Q N1" then have "\qi. x \ Red_Inf_q qi N1" unfolding Red_Inf_Q_def by blast moreover have "\qi. N2 \ Red_F_q qi N1" using N2_in_Red_N1 unfolding Red_F_Q_def by blast ultimately have "\qi. x \ Red_Inf_q qi (N1 - N2)" using all_red_crit calculus_with_red_crit.axioms(2) calculus_with_red_crit.Red_Inf_of_Red_F_subset by blast then show "x \ Red_Inf_Q (N1 - N2)" unfolding Red_Inf_Q_def by blast qed qed next show "\\ N. \ \ Inf \ concl_of \ \ N \ \ \ Red_Inf_Q N" proof (intro allI impI) fix \ N assume i_in: "\ \ Inf" and concl_in: "concl_of \ \ N" then have "\qi. \ \ Red_Inf_q qi N" using all_red_crit calculus_with_red_crit.axioms(2) calculus_with_red_crit.Red_Inf_of_Inf_to_N by blast then show "\ \ Red_Inf_Q N" unfolding Red_Inf_Q_def by blast qed qed sublocale inter_red_crit_calculus: calculus_with_red_crit where Bot=Bot and Inf=Inf and entails=entails_Q and Red_Inf=Red_Inf_Q and Red_F=Red_F_Q using inter_red_crit . (* lem:satur-wrt-intersection-of-red *) lemma sat_int_to_sat_q: "calculus_with_red_crit.saturated Inf Red_Inf_Q N \ (\qi. calculus_with_red_crit.saturated Inf (Red_Inf_q qi) N)" for N proof fix N assume inter_sat: "calculus_with_red_crit.saturated Inf Red_Inf_Q N" show "\qi. calculus_with_red_crit.saturated Inf (Red_Inf_q qi) N" proof fix qi interpret one: calculus_with_red_crit Bot Inf "entails_q qi" "Red_Inf_q qi" "Red_F_q qi" by (rule all_red_crit) show "one.saturated N" using inter_sat unfolding one.saturated_def inter_red_crit_calculus.saturated_def Red_Inf_Q_def by blast qed next fix N assume all_sat: "\qi. calculus_with_red_crit.saturated Inf (Red_Inf_q qi) N" show "inter_red_crit_calculus.saturated N" unfolding inter_red_crit_calculus.saturated_def Red_Inf_Q_def proof fix x assume x_in: "x \ Inf_from N" have "\Red_Inf_qi \ Red_Inf_q ` UNIV. x \ Red_Inf_qi N" proof fix Red_Inf_qi assume red_inf_in: "Red_Inf_qi \ Red_Inf_q ` UNIV" then obtain qi where red_inf_qi_def: "Red_Inf_qi = Red_Inf_q qi" by blast interpret one: calculus_with_red_crit Bot Inf "entails_q qi" "Red_Inf_q qi" "Red_F_q qi" by (rule all_red_crit) have "one.saturated N" using all_sat red_inf_qi_def by blast then show "x \ Red_Inf_qi N" unfolding one.saturated_def using x_in red_inf_qi_def by blast qed then show "x \ \ {X N |X. X \ Red_Inf_q ` UNIV}" by blast qed qed (* lem:checking-static-ref-compl-for-intersections *) lemma stat_ref_comp_from_bot_in_sat: "\N. (calculus_with_red_crit.saturated Inf Red_Inf_Q N \ (\B \ Bot. B \ N)) \ (\B \ Bot. \qi. \ entails_q qi N {B}) \ static_refutational_complete_calculus Bot Inf entails_Q Red_Inf_Q Red_F_Q" proof (rule ccontr) assume N_saturated: "\N. (calculus_with_red_crit.saturated Inf Red_Inf_Q N \ (\B \ Bot. B \ N)) \ (\B \ Bot. \qi. \ entails_q qi N {B})" and no_stat_ref_comp: "\ static_refutational_complete_calculus Bot Inf (\Q) Red_Inf_Q Red_F_Q" obtain N1 B1 where B1_in: "B1 \ Bot" and N1_saturated: "calculus_with_red_crit.saturated Inf Red_Inf_Q N1" and N1_unsat: "N1 \Q {B1}" and no_B_in_N1: "\B \ Bot. B \ N1" using no_stat_ref_comp by (metis inter_red_crit static_refutational_complete_calculus.intro static_refutational_complete_calculus_axioms.intro) obtain B2 qi where no_qi:"\ entails_q qi N1 {B2}" using N_saturated N1_saturated no_B_in_N1 by blast have "N1 \Q {B2}" using N1_unsat B1_in intersect_cons_rel_family unfolding consequence_relation_def by metis then have "entails_q qi N1 {B2}" unfolding entails_Q_def by blast then show "False" using no_qi by simp qed end subsection \Variations on a Theme\ locale calculus_with_reduced_red_crit = calculus_with_red_crit Bot Inf entails Red_Inf Red_F for Bot :: "'f set" and Inf :: \'f inference set\ and entails :: "'f set \ 'f set \ bool" (infix "\" 50) and Red_Inf :: "'f set \ 'f inference set" and Red_F :: "'f set \ 'f set" + assumes inf_in_red_inf: "Inf_from2 UNIV (Red_F N) \ Red_Inf N" begin (* lem:reduced-rc-implies-sat-equiv-reduced-sat *) lemma sat_eq_reduc_sat: "saturated N \ reduc_saturated N" proof fix N assume "saturated N" then show "reduc_saturated N" using Red_Inf_without_red_F saturated_without_red_F unfolding saturated_def reduc_saturated_def by blast next fix N assume red_sat_n: "reduc_saturated N" show "saturated N" unfolding saturated_def proof fix \ assume i_in: "\ \ Inf_from N" show "\ \ Red_Inf N" using i_in red_sat_n inf_in_red_inf unfolding reduc_saturated_def Inf_from_def Inf_from2_def by blast qed qed end locale reduc_static_refutational_complete_calculus = calculus_with_red_crit + assumes reduc_static_refutational_complete: "B \ Bot \ reduc_saturated N \ N \ {B} \ \B'\Bot. B' \ N" locale reduc_static_refutational_complete_reduc_calculus = calculus_with_reduced_red_crit + assumes reduc_static_refutational_complete: "B \ Bot \ reduc_saturated N \ N \ {B} \ \B'\Bot. B' \ N" begin sublocale reduc_static_refutational_complete_calculus by (simp add: calculus_with_red_crit_axioms reduc_static_refutational_complete reduc_static_refutational_complete_calculus_axioms.intro reduc_static_refutational_complete_calculus_def) (* cor:reduced-rc-implies-st-ref-comp-equiv-reduced-st-ref-comp 1/2 *) sublocale static_refutational_complete_calculus proof fix B N assume bot_elem: \B \ Bot\ and saturated_N: "saturated N" and refut_N: "N \ {B}" have reduc_saturated_N: "reduc_saturated N" using saturated_N sat_eq_reduc_sat by blast show "\B'\Bot. B' \ N" using reduc_static_refutational_complete[OF bot_elem reduc_saturated_N refut_N] . qed end context calculus_with_reduced_red_crit begin (* cor:reduced-rc-implies-st-ref-comp-equiv-reduced-st-ref-comp 2/2 *) lemma stat_ref_comp_imp_red_stat_ref_comp: "static_refutational_complete_calculus Bot Inf entails Red_Inf Red_F \ reduc_static_refutational_complete_calculus Bot Inf entails Red_Inf Red_F" proof fix B N assume stat_ref_comp: "static_refutational_complete_calculus Bot Inf (\) Red_Inf Red_F" and bot_elem: \B \ Bot\ and saturated_N: "reduc_saturated N" and refut_N: "N \ {B}" have reduc_saturated_N: "saturated N" using saturated_N sat_eq_reduc_sat by blast show "\B'\Bot. B' \ N" using Calculi.static_refutational_complete_calculus.static_refutational_complete[OF stat_ref_comp bot_elem reduc_saturated_N refut_N] . qed end context calculus_with_red_crit begin definition Red_Red_Inf :: "'f set \ 'f inference set" where "Red_Red_Inf N = Red_Inf N \ Inf_from2 UNIV (Red_F N)" lemma reduced_calc_is_calc: "calculus_with_red_crit Bot Inf entails Red_Red_Inf Red_F" proof fix N show "Red_Red_Inf N \ Inf" unfolding Red_Red_Inf_def Inf_from2_def Inf_from_def using Red_Inf_to_Inf by auto next fix B N assume b_in: "B \ Bot" and n_entails: "N \ {B}" show "N - Red_F N \ {B}" by (simp add: Red_F_Bot b_in n_entails) next fix N N' :: "'f set" assume "N \ N'" then show "Red_F N \ Red_F N'" by (simp add: Red_F_of_subset) next fix N N' :: "'f set" assume n_in: "N \ N'" then have "Inf_from (UNIV - (Red_F N')) \ Inf_from (UNIV - (Red_F N))" using Red_F_of_subset[OF n_in] unfolding Inf_from_def by auto then have "Inf_from2 UNIV (Red_F N) \ Inf_from2 UNIV (Red_F N')" unfolding Inf_from2_def by auto then show "Red_Red_Inf N \ Red_Red_Inf N'" unfolding Red_Red_Inf_def using Red_Inf_of_subset[OF n_in] by blast next fix N N' :: "'f set" assume "N' \ Red_F N" then show "Red_F N \ Red_F (N - N')" by (simp add: Red_F_of_Red_F_subset) next fix N N' :: "'f set" assume np_subs: "N' \ Red_F N" have "Red_F N \ Red_F (N - N')" by (simp add: Red_F_of_Red_F_subset np_subs) then have "Inf_from (UNIV - (Red_F (N - N'))) \ Inf_from (UNIV - (Red_F N))" by (metis Diff_subset Red_F_of_subset eq_iff) then have "Inf_from2 UNIV (Red_F N) \ Inf_from2 UNIV (Red_F (N - N'))" unfolding Inf_from2_def by auto then show "Red_Red_Inf N \ Red_Red_Inf (N - N')" unfolding Red_Red_Inf_def using Red_Inf_of_Red_F_subset[OF np_subs] by blast next fix \ N assume "\ \ Inf" "concl_of \ \ N" then show "\ \ Red_Red_Inf N" by (simp add: Red_Inf_of_Inf_to_N Red_Red_Inf_def) qed lemma inf_subs_reduced_red_inf: "Inf_from2 UNIV (Red_F N) \ Red_Red_Inf N" unfolding Red_Red_Inf_def by simp (* lem:red'-is-reduced-redcrit *) text \The following is a lemma and not a sublocale as was previously used in similar cases. Here, a sublocale cannot be used because it would create an infinitely descending chain of sublocales. \ lemma reduc_calc: "calculus_with_reduced_red_crit Bot Inf entails Red_Red_Inf Red_F" using inf_subs_reduced_red_inf reduced_calc_is_calc by (simp add: calculus_with_reduced_red_crit.intro calculus_with_reduced_red_crit_axioms_def) interpretation reduc_calc : calculus_with_reduced_red_crit Bot Inf entails Red_Red_Inf Red_F using reduc_calc by simp (* lem:saturation-red-vs-red'-1 *) lemma sat_imp_red_calc_sat: "saturated N \ reduc_calc.saturated N" unfolding saturated_def reduc_calc.saturated_def Red_Red_Inf_def by blast (* lem:saturation-red-vs-red'-2 1/2 (i) \ (ii) *) lemma red_sat_eq_red_calc_sat: "reduc_saturated N \ reduc_calc.saturated N" proof assume red_sat_n: "reduc_saturated N" show "reduc_calc.saturated N" unfolding reduc_calc.saturated_def proof fix \ assume i_in: "\ \ Inf_from N" show "\ \ Red_Red_Inf N" using i_in red_sat_n unfolding reduc_saturated_def Inf_from2_def Inf_from_def Red_Red_Inf_def by blast qed next assume red_sat_n: "reduc_calc.saturated N" show "reduc_saturated N" unfolding reduc_saturated_def proof fix \ assume i_in: "\ \ Inf_from (N - Red_F N)" show "\ \ Red_Inf N" using i_in red_sat_n unfolding Inf_from_def reduc_calc.saturated_def Red_Red_Inf_def Inf_from2_def by blast qed qed (* lem:saturation-red-vs-red'-2 2/2 (i) \ (iii) *) lemma red_sat_eq_sat: "reduc_saturated N \ saturated (N - Red_F N)" unfolding reduc_saturated_def saturated_def by (simp add: Red_Inf_without_red_F) (* thm:reduced-stat-ref-compl 1/3 (i) \ (iii) *) theorem stat_is_stat_red: "static_refutational_complete_calculus Bot Inf entails Red_Inf Red_F \ static_refutational_complete_calculus Bot Inf entails Red_Red_Inf Red_F" proof assume stat_ref1: "static_refutational_complete_calculus Bot Inf entails Red_Inf Red_F" show "static_refutational_complete_calculus Bot Inf entails Red_Red_Inf Red_F" using reduc_calc.calculus_with_red_crit_axioms unfolding static_refutational_complete_calculus_def static_refutational_complete_calculus_axioms_def proof show "\B N. B \ Bot \ reduc_calc.saturated N \ N \ {B} \ (\B'\Bot. B' \ N)" proof (clarify) fix B N assume b_in: "B \ Bot" and n_sat: "reduc_calc.saturated N" and n_imp_b: "N \ {B}" have "saturated (N - Red_F N)" using red_sat_eq_red_calc_sat[of N] red_sat_eq_sat[of N] n_sat by blast moreover have "(N - Red_F N) \ {B}" using n_imp_b b_in by (simp add: reduc_calc.Red_F_Bot) ultimately show "\B'\Bot. B'\ N" using stat_ref1 by (meson DiffD1 b_in static_refutational_complete_calculus.static_refutational_complete) qed qed next assume stat_ref3: "static_refutational_complete_calculus Bot Inf entails Red_Red_Inf Red_F" show "static_refutational_complete_calculus Bot Inf entails Red_Inf Red_F" unfolding static_refutational_complete_calculus_def static_refutational_complete_calculus_axioms_def using calculus_with_red_crit_axioms proof show "\B N. B \ Bot \ saturated N \ N \ {B} \ (\B'\Bot. B' \ N)" proof clarify fix B N assume b_in: "B \ Bot" and n_sat: "saturated N" and n_imp_b: "N \ {B}" then show "\B'\ Bot. B' \ N" using stat_ref3 sat_imp_red_calc_sat[OF n_sat] by (meson static_refutational_complete_calculus.static_refutational_complete) qed qed qed (* thm:reduced-stat-ref-compl 2/3 (iv) \ (iii) *) theorem red_stat_red_is_stat_red: "reduc_static_refutational_complete_calculus Bot Inf entails Red_Red_Inf Red_F \ static_refutational_complete_calculus Bot Inf entails Red_Red_Inf Red_F" using reduc_calc.stat_ref_comp_imp_red_stat_ref_comp by (metis reduc_calc.sat_eq_reduc_sat reduc_static_refutational_complete_calculus.axioms(2) reduc_static_refutational_complete_calculus_axioms_def reduced_calc_is_calc static_refutational_complete_calculus.intro static_refutational_complete_calculus_axioms.intro) (* thm:reduced-stat-ref-compl 3/3 (ii) \ (iii) *) theorem red_stat_is_stat_red: "reduc_static_refutational_complete_calculus Bot Inf entails Red_Inf Red_F \ static_refutational_complete_calculus Bot Inf entails Red_Red_Inf Red_F" using reduc_calc.calculus_with_red_crit_axioms calculus_with_red_crit_axioms red_sat_eq_red_calc_sat unfolding static_refutational_complete_calculus_def static_refutational_complete_calculus_axioms_def reduc_static_refutational_complete_calculus_def reduc_static_refutational_complete_calculus_axioms_def by blast definition Sup_Red_F_llist :: "'f set llist \ 'f set" where "Sup_Red_F_llist D = (\i \ {i. enat i < llength D}. Red_F (lnth D i))" lemma Sup_Red_F_unit: "Sup_Red_F_llist (LCons X LNil) = Red_F X" using Sup_Red_F_llist_def enat_0_iff(1) by simp lemma sup_red_f_in_red_liminf: "chain derive D \ Sup_Red_F_llist D \ Red_F (Liminf_llist D)" proof fix N assume deriv: "chain derive D" and n_in_sup: "N \ Sup_Red_F_llist D" obtain i0 where i_smaller: "enat i0 < llength D" and n_in: "N \ Red_F (lnth D i0)" using n_in_sup unfolding Sup_Red_F_llist_def by blast have "Red_F (lnth D i0) \ Red_F (Liminf_llist D)" using i_smaller by (simp add: deriv Red_F_subset_Liminf) then show "N \ Red_F (Liminf_llist D)" using n_in by fast qed lemma sup_red_inf_in_red_liminf: "chain derive D \ Sup_Red_Inf_llist D \ Red_Inf (Liminf_llist D)" proof fix \ assume deriv: "chain derive D" and i_in_sup: "\ \ Sup_Red_Inf_llist D" obtain i0 where i_smaller: "enat i0 < llength D" and n_in: "\ \ Red_Inf (lnth D i0)" using i_in_sup unfolding Sup_Red_Inf_llist_def by blast have "Red_Inf (lnth D i0) \ Red_Inf (Liminf_llist D)" using i_smaller by (simp add: deriv Red_Inf_subset_Liminf) then show "\ \ Red_Inf (Liminf_llist D)" using n_in by fast qed definition reduc_fair :: "'f set llist \ bool" where "reduc_fair D \ Inf_from (Liminf_llist D - (Sup_Red_F_llist D)) \ Sup_Red_Inf_llist D" (* lem:red-fairness-implies-red-saturation *) lemma reduc_fair_imp_Liminf_reduc_sat: "chain derive D \ reduc_fair D \ reduc_saturated (Liminf_llist D)" unfolding reduc_saturated_def proof - fix D assume deriv: "chain derive D" and red_fair: "reduc_fair D" have "Inf_from (Liminf_llist D - Red_F (Liminf_llist D)) \ Inf_from (Liminf_llist D - Sup_Red_F_llist D)" using sup_red_f_in_red_liminf[OF deriv] unfolding Inf_from_def by blast then have "Inf_from (Liminf_llist D - Red_F (Liminf_llist D)) \ Sup_Red_Inf_llist D" using red_fair unfolding reduc_fair_def by simp then show "Inf_from (Liminf_llist D - Red_F (Liminf_llist D)) \ Red_Inf (Liminf_llist D)" using sup_red_inf_in_red_liminf[OF deriv] by fast qed end locale reduc_dynamic_refutational_complete_calculus = calculus_with_red_crit + assumes reduc_dynamic_refutational_complete: "B \ Bot \ chain derive D \ reduc_fair D \ lnth D 0 \ {B} \ \i \ {i. enat i < llength D}. \ B'\Bot. B' \ lnth D i" begin sublocale reduc_static_refutational_complete_calculus proof fix B N assume bot_elem: \B \ Bot\ and saturated_N: "reduc_saturated N" and refut_N: "N \ {B}" define D where "D = LCons N LNil" have[simp]: \\ lnull D\ by (auto simp: D_def) have deriv_D: \chain (\Red) D\ by (simp add: chain.chain_singleton D_def) have liminf_is_N: "Liminf_llist D = N" by (simp add: D_def Liminf_llist_LCons) have head_D: "N = lnth D 0" by (simp add: D_def) have "Sup_Red_F_llist D = Red_F N" by (simp add: D_def Sup_Red_F_unit) moreover have "Sup_Red_Inf_llist D = Red_Inf N" by (simp add: D_def Sup_Red_Inf_unit) ultimately have fair_D: "reduc_fair D" using saturated_N liminf_is_N unfolding reduc_fair_def reduc_saturated_def by (simp add: reduc_fair_def reduc_saturated_def liminf_is_N) obtain i B' where B'_is_bot: \B' \ Bot\ and B'_in: "B' \ (lnth D i)" and \i < llength D\ using reduc_dynamic_refutational_complete[of B D] bot_elem fair_D head_D saturated_N deriv_D refut_N by auto then have "i = 0" by (auto simp: D_def enat_0_iff) show \\B'\Bot. B' \ N\ using B'_is_bot B'_in unfolding \i = 0\ head_D[symmetric] by auto qed end sublocale reduc_static_refutational_complete_calculus \ reduc_dynamic_refutational_complete_calculus proof fix B D assume bot_elem: \B \ Bot\ and deriv: \chain (\Red) D\ and fair: \reduc_fair D\ and unsat: \(lnth D 0) \ {B}\ have non_empty: \\ lnull D\ using chain_not_lnull[OF deriv] . have subs: \(lnth D 0) \ Sup_llist D\ using lhd_subset_Sup_llist[of D] non_empty by (simp add: lhd_conv_lnth) have \Sup_llist D \ {B}\ using unsat subset_entailed[OF subs] entails_trans[of "Sup_llist D" "lnth D 0"] by auto then have Sup_no_Red: \Sup_llist D - Red_F (Sup_llist D) \ {B}\ using bot_elem Red_F_Bot by auto have Sup_no_Red_in_Liminf: \Sup_llist D - Red_F (Sup_llist D) \ Liminf_llist D\ using deriv Red_in_Sup by auto have Liminf_entails_Bot: \Liminf_llist D \ {B}\ using Sup_no_Red subset_entailed[OF Sup_no_Red_in_Liminf] entails_trans by blast have \reduc_saturated (Liminf_llist D)\ using deriv fair reduc_fair_imp_Liminf_reduc_sat unfolding reduc_saturated_def by auto then have \\B'\Bot. B' \ (Liminf_llist D)\ using bot_elem reduc_static_refutational_complete Liminf_entails_Bot by auto then show \\i\{i. enat i < llength D}. \B'\Bot. B' \ lnth D i\ unfolding Liminf_llist_def by auto qed context calculus_with_red_crit begin lemma dyn_equiv_stat: "dynamic_refutational_complete_calculus Bot Inf entails Red_Inf Red_F = static_refutational_complete_calculus Bot Inf entails Red_Inf Red_F" proof assume "dynamic_refutational_complete_calculus Bot Inf entails Red_Inf Red_F" then interpret dynamic_refutational_complete_calculus Bot Inf entails Red_Inf Red_F by simp show "static_refutational_complete_calculus Bot Inf entails Red_Inf Red_F" by (simp add: static_refutational_complete_calculus_axioms) next assume "static_refutational_complete_calculus Bot Inf entails Red_Inf Red_F" then interpret static_refutational_complete_calculus Bot Inf entails Red_Inf Red_F by simp show "dynamic_refutational_complete_calculus Bot Inf entails Red_Inf Red_F" by (simp add: dynamic_refutational_complete_calculus_axioms) qed lemma red_dyn_equiv_red_stat: "reduc_dynamic_refutational_complete_calculus Bot Inf entails Red_Inf Red_F = reduc_static_refutational_complete_calculus Bot Inf entails Red_Inf Red_F" proof assume "reduc_dynamic_refutational_complete_calculus Bot Inf entails Red_Inf Red_F" then interpret reduc_dynamic_refutational_complete_calculus Bot Inf entails Red_Inf Red_F by simp show "reduc_static_refutational_complete_calculus Bot Inf entails Red_Inf Red_F" by (simp add: reduc_static_refutational_complete_calculus_axioms) next assume "reduc_static_refutational_complete_calculus Bot Inf entails Red_Inf Red_F" then interpret reduc_static_refutational_complete_calculus Bot Inf entails Red_Inf Red_F by simp show "reduc_dynamic_refutational_complete_calculus Bot Inf entails Red_Inf Red_F" by (simp add: reduc_dynamic_refutational_complete_calculus_axioms) qed interpretation reduc_calc : calculus_with_reduced_red_crit Bot Inf entails Red_Red_Inf Red_F using reduc_calc by simp (* thm:reduced-dyn-ref-compl 1/3 (v) \ (vii) *) theorem dyn_ref_eq_dyn_ref_red: "dynamic_refutational_complete_calculus Bot Inf entails Red_Inf Red_F \ dynamic_refutational_complete_calculus Bot Inf entails Red_Red_Inf Red_F" using dyn_equiv_stat stat_is_stat_red reduc_calc.dyn_equiv_stat by meson (* thm:reduced-dyn-ref-compl 2/3 (viii) \ (vii) *) theorem red_dyn_ref_red_eq_dyn_ref_red: "reduc_dynamic_refutational_complete_calculus Bot Inf entails Red_Red_Inf Red_F \ dynamic_refutational_complete_calculus Bot Inf entails Red_Red_Inf Red_F" using red_dyn_equiv_red_stat dyn_equiv_stat red_stat_red_is_stat_red by (simp add: reduc_calc.dyn_equiv_stat reduc_calc.red_dyn_equiv_red_stat) (* thm:reduced-dyn-ref-compl 3/3 (vi) \ (vii) *) theorem red_dyn_ref_eq_dyn_ref_red: "reduc_dynamic_refutational_complete_calculus Bot Inf entails Red_Inf Red_F \ dynamic_refutational_complete_calculus Bot Inf entails Red_Red_Inf Red_F" using red_dyn_equiv_red_stat dyn_equiv_stat red_stat_is_stat_red reduc_calc.dyn_equiv_stat reduc_calc.red_dyn_equiv_red_stat by blast end end