Theory Ground_Reduction_on_GTRS
section โนReducing Rewrite Properties to Properties on Ground Terms over Ground Systemsโบ
theory Ground_Reduction_on_GTRS
imports
Rewriting_Properties
Rewriting_GTRS
Rewriting_LLRG_LV_Mondaic
begin
lemma ground_sys_nf_eq_lift:
fixes โ :: "('f, 'v) term rel"
assumes gtrs: "ground_sys โ" "ground_sys ๐ฎ"
and nf: "NF (gsrstep โฑ โ) = NF (gsrstep โฑ ๐ฎ)"
shows "NF (srstep โฑ โ) = NF (srstep โฑ ๐ฎ)"
proof -
{fix s ๐ฐ ๐ฑ assume ass: "ground_sys (๐ฐ :: ('f, 'v) term rel)" "ground_sys ๐ฑ"
"NF (gsrstep โฑ ๐ฐ) = NF (gsrstep โฑ ๐ฑ)" "s โ NF (srstep โฑ ๐ฐ)"
have "s โ NF (srstep โฑ ๐ฑ)"
proof (rule ccontr)
assume "s โ NF (srstep โฑ ๐ฑ)"
then obtain C l r ฯ where step: "(l, r) โ ๐ฑ" and rep: "s = Cโจl โ
ฯโฉ"
and funas: "funas_ctxt C โ โฑ" "funas_term l โ โฑ" "funas_term r โ โฑ" using ass(2)
by (auto simp: funas_term_subst NF_def sig_step_def dest!: rstep_imp_C_s_r) blast
from step ass(2) rep have rep: "s = Cโจlโฉ" "ground l" "ground r"
by (auto intro: ground_subst_apply)
from step rep(2-) funas have "l โ NF (gsrstep โฑ ๐ฑ)"
by (auto simp: NF_def sig_step_def Image_def)
from this ass(3) have "l โ NF (srstep โฑ ๐ฐ)" by auto
then obtain t where "(l, t) โ srstep โฑ ๐ฐ" by auto
from srstep_ctxt_closed[OF funas(1) this, unfolded rep(1)[symmetric]]
show False using ass(4)
by auto
qed}
then show ?thesis using assms
by (smt (verit, best) equalityI subsetI)
qed
lemma ground_sys_inv:
"ground_sys โ โน ground_sys (โยฏ)" by auto
lemma ground_sys_symcl:
"ground_sys โ โน ground_sys (โโงโ)" by auto
lemma ground_sys_comp_rrstep_rel'_ground:
assumes "ground_sys โ" "ground_sys ๐ฎ"
and "(s, t) โ comp_rrstep_rel' โฑ โ ๐ฎ"
shows "ground s" "ground t"
proof -
from assms(3) consider (a) "(s, t) โ srsteps_with_root_step โฑ โ O (srstep โฑ ๐ฎ)โง+" |
(b) "(s, t) โ (srstep โฑ โ)โง+ O srsteps_with_root_step โฑ ๐ฎ"
by auto
then have "ground s โง ground t"
proof cases
case a
then show ?thesis using srsteps_with_root_step_ground(1)[OF assms(1)]
using srsteps_with_root_step_ground(2)[OF assms(1), THEN srsteps_pres_ground_l[OF assms(2)]]
by blast
next
case b
then show ?thesis using srsteps_with_root_step_ground(2)[OF assms(2)]
using srsteps_with_root_step_ground(1)[OF assms(2), THEN srsteps_pres_ground_r[OF assms(1)]]
by blast
qed
then show "ground s" "ground t" by simp_all
qed
lemma GTRS_commute:
assumes "ground_sys โ" "ground_sys ๐ฎ"
and com: "commute (gsrstep โฑ โ) (gsrstep โฑ ๐ฎ)"
shows "commute (srstep โฑ โ) (srstep โฑ ๐ฎ)"
proof -
{fix s t assume ass: "(s, t) โ comp_rrstep_rel' โฑ (โยฏ) ๐ฎ"
then obtain u where steps: "(s, u) โ (srstep โฑ (โยฏ))โง+" "(u, t) โ (srstep โฑ ๐ฎ)โง+"
by (auto simp: sig_step_converse_rstep dest: srsteps_with_root_step_srstepsD)
have gr: "ground s" "ground t" "ground u"
using ground_sys_comp_rrstep_rel'_ground[OF ground_sys_inv[OF assms(1)] assms(2) ass]
using srsteps_pres_ground_r[OF assms(2) _ steps(2)] by auto
then have "(s, u) โ (gsrstep โฑ (โยฏ))โง*" "(u, t) โ (gsrstep โฑ ๐ฎ)โง*" using steps
by (auto dest!: trancl_into_rtrancl intro: ground_srsteps_eq_gsrsteps_eq)
then have "(s, t) โ (gsrstep โฑ ๐ฎ)โง* O (gsrstep โฑ (โยฏ))โง*" using com steps
by (auto simp: commute_def rew_converse_inwards)
from gsrsteps_eq_relcomp_srsteps_relcompD[OF this]
have "commute_redp โฑ โ ๐ฎ s t" unfolding commute_redp_def
by (simp add: rew_converse_inwards)}
then show ?thesis by (intro commute_rrstep_intro) simp
qed
lemma GTRS_CR:
assumes "ground_sys โ"
and "CR (gsrstep โฑ โ)"
shows "CR (srstep โฑ โ)" using GTRS_commute assms
unfolding CR_iff_self_commute
by blast
lemma GTRS_SCR:
assumes gtrs: "ground_sys โ"
and scr: "SCR (gsrstep โฑ โ)"
shows "SCR (srstep โฑ โ)"
proof -
{fix s t u assume ass: "(s, t) โ srstep โฑ โ" "(s, u) โ srstep โฑ โ"
and root: "(s, t) โ sig_step โฑ (rrstep โ) โจ (s, u) โ sig_step โฑ (rrstep โ)"
from ass have funas: "funas_term s โ โฑ" "funas_term t โ โฑ" "funas_term u โ โฑ" by blast+
from root have gr: "ground s" "ground t" "ground u" using ass gtrs
using srrstep_ground srstep_pres_ground_l srstep_pres_ground_r
by metis+
from scr obtain v where v: "(t, v) โ (gsrstep โฑ โ)โง= โง (u, v) โ (gsrstep โฑ โ)โง*"
using gr unfolding SCR_on_def
by (metis Int_iff UNIV_I ass mem_Collect_eq mem_Sigma_iff)
then have "SCRp โฑ โ t u"
by (metis (full_types) Int_iff Un_iff gsrsteps_eq_to_srsteps_eq)}
then show ?thesis by (intro SCR_rrstep_intro) (metis srrstep_to_srestep)+
qed
lemma GTRS_WCR:
assumes gtrs: "ground_sys โ"
and wcr: "WCR (gsrstep โฑ โ)"
shows "WCR (srstep โฑ โ)"
proof -
{fix s t u assume ass: "(s, t) โ sig_step โฑ (rrstep โ)" "(s, u) โ srstep โฑ โ"
from ass have funas: "funas_term s โ โฑ" "funas_term t โ โฑ" "funas_term u โ โฑ" by blast+
from srrstep_ground[OF gtrs ass(1)] have gr: "ground s" "ground t" "ground u"
using srstep_pres_ground_l[OF gtrs _ ass(2)]
by simp_all
from this wcr have w: "(t, u) โ (gsrstep โฑ โ)โงโ" using ass funas
unfolding WCR_on_def
by (metis IntI SigmaI UNIV_I mem_Collect_eq srrstep_to_srestep)
then have "(t, u) โ (srstep โฑ โ)โงโ" unfolding join_def
by (metis (full_types) gsrsteps_eq_to_srsteps_eq joinD joinI join_def)}
then show ?thesis by (intro WCR_rrstep_intro) simp
qed
lemma GTRS_UNF:
assumes gtrs: "ground_sys โ"
and unf: "UNF (gsrstep โฑ โ)"
shows "UNF (srstep โฑ โ)"
proof -
{fix s t assume ass: "(s, t) โ comp_rrstep_rel' โฑ (โยฏ) โ"
then obtain u where steps: "(s, u) โ (srstep โฑ (โยฏ))โง+" "(u, t) โ (srstep โฑ โ)โง+"
by (auto simp: sig_step_converse_rstep dest: srsteps_with_root_step_srstepsD)
have gr: "ground s" "ground t" "ground u"
using ground_sys_comp_rrstep_rel'_ground[OF ground_sys_inv[OF gtrs] gtrs ass]
using srsteps_pres_ground_r[OF gtrs _ steps(2)] by auto
from steps(1) have f: "funas_term s โ โฑ" by (simp add: srstepsD)
let ?ฯ = "ฮป _. s"
from steps gr have "(s, u โ
?ฯ) โ (gsrstep โฑ (โยฏ))โง+" "(u โ
?ฯ, t) โ (gsrstep โฑ โ)โง+"
unfolding srstep_converse_dist Restr_converse trancl_converse
using srsteps_subst_closed[where ?ฯ = ?ฯ and ?s = u, of _ โฑ] f
by (force simp: ground_subst_apply intro: ground_srsteps_gsrsteps)+
then have "UN_redp โฑ โ s t" using unf ground_NF_srstep_gsrstep[OF gr(1), of โฑ โ]
using ground_NF_srstep_gsrstep[OF gr(2), of โฑ โ]
by (auto simp: UNF_on_def UN_redp_def normalizability_def rew_converse_outwards)
(meson trancl_into_rtrancl)}
then show ?thesis by (intro UNF_rrstep_intro) simp
qed
lemma GTRS_UNC:
assumes gtrs: "ground_sys โ"
and unc: "UNC (gsrstep โฑ โ)"
shows "UNC (srstep โฑ โ)"
proof -
{fix s t assume ass: "(s, t) โ srsteps_with_root_step โฑ (โโงโ)"
from ass have funas: "funas_term s โ โฑ" "funas_term t โ โฑ"
by (meson srstepsD srsteps_with_root_step_srstepsD)+
from ass have "ground s" "ground t" using srsteps_with_root_step_ground[OF ground_sys_symcl[OF gtrs]]
by auto
then have "UN_redp โฑ โ s t" unfolding UN_redp_def using ass unc unfolding UNC_def
by (simp add: ground_NF_srstep_gsrstep ground_srsteps_eq_gsrsteps_eq gsrstep_conversion_dist srsteps_with_root_step_sresteps_eqD)}
then show ?thesis by (intro UNC_rrstep_intro) simp
qed
lemma GTRS_NFP:
assumes "ground_sys โ"
and nfp: "NFP (gsrstep โฑ โ)"
shows "NFP (srstep โฑ โ)"
proof -
{fix s t assume ass: "(s, t) โ comp_rrstep_rel' โฑ (โยฏ) โ"
from ass have funas: "funas_term s โ โฑ" "funas_term t โ โฑ"
by (meson Un_iff relcompEpair srstepsD srsteps_with_root_step_srstepsD)+
from ass have "ground s" "ground t"
by (metis assms(1) ground_sys_comp_rrstep_rel'_ground ground_sys_inv)+
from this ass have "(s, t) โ (gsrstep โฑ (โยฏ))โง* O (gsrstep โฑ โ)โง*"
by (intro srsteps_eq_relcomp_gsrsteps_relcomp) (auto dest!: srsteps_with_root_step_sresteps_eqD)
then have "t โ NF (gsrstep โฑ โ) โน (s, t) โ (gsrstep โฑ โ)โง*" using NFP_stepD[OF nfp]
by (auto simp: rew_converse_outwards)
then have "NFP_redp โฑ โ s t" unfolding NFP_redp_def
by (simp add: โนground tโบ ground_NF_srstep_gsrstep gsrsteps_eq_to_srsteps_eq)}
then show ?thesis by (intro NFP_rrstep_intro) simp
qed
lemma GTRS_NE_aux:
assumes "(s, t) โ srsteps_with_root_step โฑ โ"
and gtrs: "ground_sys โ" "ground_sys ๐ฎ"
and ne: "NE (gsrstep โฑ โ) (gsrstep โฑ ๐ฎ)"
shows "NE_redp โฑ โ ๐ฎ s t"
proof -
from assms(1) have gr: "ground s" "ground t"
using srsteps_with_root_step_ground[OF gtrs(1)] by simp_all
have "(s, t) โ (gsrstep โฑ โ)โง+" using gr assms(1)
by (auto dest: srsteps_with_root_step_srstepsD intro: ground_srsteps_gsrsteps)
then have "t โ NF (srstep โฑ โ) โน (s, t) โ (gsrstep โฑ ๐ฎ)โง*"
using gr ne unfolding NE_on_def
by (auto simp: normalizability_def ground_subst_apply dest!: trancl_into_rtrancl) blast
then show "NE_redp โฑ โ ๐ฎ s t" unfolding NE_redp_def
by (simp add: gsrsteps_eq_to_srsteps_eq)
qed
lemma GTRS_NE:
assumes gtrs: "ground_sys โ" "ground_sys ๐ฎ"
and ne: "NE (gsrstep โฑ โ) (gsrstep โฑ ๐ฎ)"
shows "NE (srstep โฑ โ) (srstep โฑ ๐ฎ)"
proof -
{fix s t assume "(s, t) โ srsteps_with_root_step โฑ โ"
from GTRS_NE_aux[OF this gtrs ne] have "NE_redp โฑ โ ๐ฎ s t"
by simp}
moreover
{fix s t assume "(s, t) โ srsteps_with_root_step โฑ ๐ฎ"
from GTRS_NE_aux[OF this gtrs(2, 1) NE_symmetric[OF ne]]
have "NE_redp โฑ ๐ฎ โ s t" by simp}
ultimately show ?thesis
using ground_sys_nf_eq_lift[OF gtrs NE_NF_eq[OF ne]]
by (intro NE_rrstep_intro) auto
qed
lemma gtrs_CE_aux:
assumes step:"(s, t) โ srsteps_with_root_step โฑ (โโงโ)"
and gtrs: "ground_sys โ" "ground_sys ๐ฎ"
and ce: "CE (gsrstep โฑ โ) (gsrstep โฑ ๐ฎ)"
shows "(s, t) โ (srstep โฑ ๐ฎ)โงโโง*"
proof -
from step gtrs(1) have "ground s" "ground t"
by (metis ground_sys_symcl srsteps_with_root_step_ground)+
then have "(s, t) โ (gsrstep โฑ โ)โงโโง*" using step
by (simp add: ground_srsteps_eq_gsrsteps_eq gsrstep_conversion_dist srsteps_with_root_step_sresteps_eqD)
then have "(s, t) โ (gsrstep โฑ ๐ฎ)โงโโง*" using ce unfolding CE_on_def
by blast
then show "(s, t) โ (srstep โฑ ๐ฎ)โงโโง*"
by (simp add: gsrstep_conversion_dist gsrsteps_eq_to_srsteps_eq symcl_srsteps_conversion)
qed
lemma gtrs_CE:
assumes gtrs: "ground_sys โ" "ground_sys ๐ฎ"
and ce: "CE (gsrstep โฑ โ) (gsrstep โฑ ๐ฎ)"
shows "CE (srstep โฑ โ) (srstep โฑ ๐ฎ)"
proof -
{fix s t assume "(s, t) โ srsteps_with_root_step โฑ (โโงโ)"
from gtrs_CE_aux[OF this gtrs ce] have "(s, t) โ (srstep โฑ ๐ฎ)โงโโง*" by simp}
moreover
{fix s t assume "(s, t) โ srsteps_with_root_step โฑ (๐ฎโงโ)"
from gtrs_CE_aux[OF this gtrs(2, 1) CE_symmetric[OF ce]]
have "(s, t) โ (srstep โฑ โ)โงโโง*" by simp}
ultimately show ?thesis
by (intro CE_rrstep_intro) auto
qed
end