Theory Ground_Reduction_on_LLRG

section ‹Reducing Rewrite Properties to Properties on Ground Terms over Left-Linear Right-Ground Systems›
theory Ground_Reduction_on_LLRG
  imports
    Rewriting_Properties
    Rewriting_LLRG_LV_Mondaic
begin

lemma llrg_linear_sys:
  "llrg   linear_sys "
  by (auto simp: llrg_def)

section ‹LLRG results›

lemma llrg_commute:
  assumes sig: "funas_rel   " "funas_rel 𝒮  "
   and fresh: "(c, 0)  "
   and llrg: "llrg " "llrg 𝒮"
   and com: "commute (gsrstep (insert (c, 0) ) ) (gsrstep (insert (c, 0) ) 𝒮)"
  shows "commute (srstep  ) (srstep  𝒮)"
proof -
  let  = "λ _. Fun c []" let ?ℋ = "insert (c, 0) "
  from fresh have fresh_sys: "(c, 0)  funas_rel 𝒮" "(c, 0)  funas_rel (¯)" using sig
    by (auto simp: funas_rel_def)
  have linear: "linear_sys 𝒮" "linear_sys (¯)" using llrg unfolding llrg_def by auto
  have sig': "funas_rel 𝒮  " "funas_rel (¯)  " using sig by (auto simp: funas_rel_def)
  have mono: "  ?ℋ" by auto
  {fix s t assume ass: "(s, t)  comp_rrstep_rel'  (¯) 𝒮"
    from ass have funas: "funas_term s  " "funas_term t  "
      by (metis Un_iff relcomp.cases srstepsD srsteps_with_root_step_srstepsD)+
    from ass have m: "(s, t)  (srstep ?ℋ (¯))* O (srstep ?ℋ 𝒮)*"
      using rtrancl_mono[OF sig_step_mono[OF mono]]
      by (auto dest!: srsteps_with_root_step_sresteps_eqD trancl_into_rtrancl)
    have gr: "ground s  ground t" using ass llrg 
      unfolding srstep_converse_dist trancl_converse
      by (auto simp: llrg_srsteps_with_root_step_inv_ground llrg_srsteps_with_root_step_ground)
    have gstep: "(s  , t  )  (gsrstep ?ℋ 𝒮)* O (gsrstep ?ℋ (¯))*"
      using srsteps_eq_subst_relcomp_closed[OF m, THEN srsteps_eq_relcomp_gsrsteps_relcomp, of ,
        THEN subsetD[OF com[unfolded commute_def], unfolded rew_converse_inwards]]
      by (auto simp: ground_substI)
    have [simp]: "ground s  (c, 0)  funas_term s" "ground t  (c, 0)  funas_term t"
      using funas fresh by auto
    have "(s, t)  (rstep 𝒮)* O (rstep (¯))*"
      using remove_const_subst_relcomp_lhs[OF linear fresh_sys, of t s]
      using gsrsteps_eq_relcomp_to_rsteps_relcomp[OF gstep] gr
      using remove_const_subst_relcomp_lhs[OF linear fresh_sys, of t s]
      using remove_const_subst_relcomp_rhs[OF linear fresh_sys, of s t]
        by (cases "ground s") (simp_all add: ground_subst_apply)
    from rsteps_eq_relcomp_srsteps_eq_relcompI[OF sig' funas 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 llrg_CR:
  assumes sig: "funas_rel   "
   and fresh: "(c, 0)  "
   and llrg: "llrg "
   and com: "CR (gsrstep (insert (c, 0) ) )"
  shows "CR (srstep  )"
  using assms llrg_commute unfolding CR_iff_self_commute
  by metis


lemma llrg_SCR:
  assumes sig: "funas_rel   " and fresh: "(c, 0)  "
   and llrg: "llrg "
   and scr: "SCR (gsrstep (insert (c, 0) ) )"
  shows "SCR (srstep  )"
proof -
  let  = "const_subst c" let ?ℋ = "insert (c, 0) "
  from fresh have fresh_sys: "(c, 0)  funas_rel " using sig
    by (auto simp: funas_rel_def)
  have mono: "  ?ℋ" by auto note sig_trans = subsetD[OF srstep_monp[OF mono]]
  {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 (force dest: sig_stepE)+
    from root have gr: "ground t  ground u" using ass llrg llrg_rrsteps_groundness
      unfolding srstep_converse_dist trancl_converse by blast
    have *: "ground (s  )" "ground (t  )" "ground (u  )" by auto
    from this scr obtain v where v: "(t  , v)  (gsrstep ?ℋ )=  (u  , v)  (gsrstep ?ℋ )*"
      using srstep_subst_closed[OF sig_trans[OF ass(1)], of ]
      using srstep_subst_closed[OF sig_trans[OF ass(2)], of ]
      using ass unfolding SCR_on_def
      by auto (metis (no_types, lifting) * )
    then have fv: "funas_term v  " using gr llrg_funas_term_step_pres[OF llrg, of _ v]
      using llrg_funas_term_steps_pres[OF llrg, of _ v] funas sig
      by (auto simp: ground_subst_apply elim!: sig_stepE dest!: gsrsteps_eq_to_rsteps_eq) blast+
    then have c_free: "(c, 0)  funas_term v" using fresh by blast
    then have "v = t  const_subst c  ground t" using arg_cong[of v "t  " funas_term]
      by (auto simp: funas_term_subst vars_term_empty_ground split: if_splits)
    from this v have "(t, v)  (srstep  )=" "(u, v)  (srstep  )*"
      using remove_const_subst_steps_eq_lhs[OF llrg_linear_sys[OF llrg] fresh_sys c_free, of u,
        THEN rsteps_eq_srsteps_eqI[OF sig funas(3) fv]]
      using remove_const_subst_step_lhs[OF llrg_linear_sys[OF llrg] fresh_sys c_free, of t,
        THEN sig_stepI[OF funas(2) fv]]
      by (auto simp: ground_subst_apply dest: srstepD gsrsteps_eq_to_rsteps_eq)
    then have "SCRp   t u" by blast}
  then show ?thesis by (intro SCR_rrstep_intro) (metis srrstep_to_srestep)+ 
qed

lemma llrg_WCR:
  assumes sig: "funas_rel   " and fresh: "(c, 0)  "
   and llrg: "llrg "
   and wcr: "WCR (gsrstep (insert (c, 0) ) )"
  shows "WCR (srstep  )"
proof -
  let  = "const_subst c" let ?ℋ = "insert (c, 0) "
  from fresh have fresh_sys: "(c, 0)  funas_rel " "(c, 0)  funas_rel (¯)" using sig
    by (auto simp: funas_rel_def)
  have lin: "linear_sys " "linear_sys (¯)" using llrg unfolding llrg_def by auto
  have mono: "  ?ℋ" by auto note sig_trans = subsetD[OF srstep_monp[OF mono]]
  {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+
    then have c_free: "(c, 0)  funas_term t" using fresh by blast
    from ass have gr: "ground t" using ass llrg llrg_rrsteps_groundness by blast
    have *: "ground (s  )" "ground (u  )" by auto
    from this wcr have w: "(t, u  )  (gsrstep ?ℋ )"
      using srstep_subst_closed[OF sig_trans[OF srrstep_to_srestep[OF ass(1)]], of ]
      using srstep_subst_closed[OF sig_trans[OF ass(2)], of ]
      using ass unfolding WCR_on_def
      by auto (metis * gr ground_subst_apply)
    have "(t, u)  (srstep  )" unfolding join_def
      using remove_const_subst_relcomp_rhs[OF lin fresh_sys c_free
        gsrsteps_eq_relcomp_to_rsteps_relcomp[OF w[unfolded join_def rew_converse_inwards]],
        THEN rsteps_eq_relcomp_srsteps_eq_relcompI[OF sig funas_rel_converse[OF sig] funas(2-)]]
      by (metis (no_types, lifting) srstep_converse_dist)}
  then show ?thesis by (intro WCR_rrstep_intro) simp
qed


lemma llrg_UNF:
  assumes sig: "funas_rel   " and fresh: "(c, 0)  "
   and llrg: "llrg "
   and unf: "UNF (gsrstep (insert (c, 0) ) )"
  shows "UNF (srstep  )"
proof -
  let  = "const_subst c" let ?ℋ = "insert (c, 0) "
  from fresh have fresh_sys: "(c, 0)  funas_rel " using sig
    by (auto simp: funas_rel_def)
  have mono: "  ?ℋ" by auto
  {fix s t assume ass: "(s, t)  comp_rrstep_rel'  (¯) "
    from ass have funas: "funas_term s  " "funas_term t  "
      by (metis Un_iff relcomp.cases srstepsD srsteps_with_root_step_srstepsD)+
    from ass have m: "(s, t)  (srstep ?ℋ (¯))* O (srstep ?ℋ )*"
      using rtrancl_mono[OF sig_step_mono[OF mono]]
      by (auto dest!: srsteps_with_root_step_sresteps_eqD trancl_into_rtrancl)
    have gr: "ground s  ground t" using ass llrg 
      unfolding srstep_converse_dist trancl_converse
      by (auto simp: llrg_srsteps_with_root_step_inv_ground llrg_srsteps_with_root_step_ground)
    have wit: "s    NF (gsrstep ?ℋ )  t    NF (gsrstep ?ℋ )  s   = t  " using unf
      using srsteps_eq_subst_relcomp_closed[OF m, THEN srsteps_eq_relcomp_gsrsteps_relcomp, of ]
      by (auto simp: UNF_on_def rew_converse_outwards normalizability_def)
    from funas NF_to_fresh_const_subst_NF[OF llrg_linear_sys[OF llrg] fresh_sys sig(1)]
    have "s  NF (srstep  )  s    NF (gsrstep ?ℋ )" "t  NF (srstep  )  t    NF (gsrstep ?ℋ )"
      by auto
    moreover have "s   = t    s = t" using gr funas fresh
      by (cases "ground s") (auto simp: ground_subst_apply funas_term_subst vars_term_empty_ground split: if_splits)
    ultimately have "UN_redp   s t" using wit unfolding UN_redp_def
      by auto}
  then show ?thesis by (intro UNF_rrstep_intro) simp
qed


lemma llrg_NFP:
  assumes sig: "funas_rel   " and fresh: "(c, 0)  "
   and llrg: "llrg "
   and nfp: "NFP (gsrstep (insert (c, 0) ) )"
  shows "NFP (srstep  )"
proof -
  let  = "const_subst c" let ?ℋ = "insert (c, 0) "
  from fresh have fresh_sys: "(c, 0)  funas_rel "
    using sig by (auto simp: funas_rel_def)
  have mono: "  ?ℋ" by auto
  {fix s t assume ass: "(s, t)  comp_rrstep_rel'  (¯) "
    from ass have funas: "funas_term s  " "funas_term t  "
      by (metis Un_iff relcomp.cases srstepsD srsteps_with_root_step_srstepsD)+
    from ass have m: "(s, t)  (srstep ?ℋ (¯))* O (srstep ?ℋ )*"
      using rtrancl_mono[OF sig_step_mono[OF mono]]
      by (auto dest!: srsteps_with_root_step_sresteps_eqD trancl_into_rtrancl)
    have gr: "ground s  ground t" using ass llrg 
      unfolding srstep_converse_dist trancl_converse
      by (auto simp: llrg_srsteps_with_root_step_inv_ground llrg_srsteps_with_root_step_ground)
    have wit: "t    NF (gsrstep ?ℋ )  (s  , t  )  (gsrstep (insert (c, 0) ) )*"
      using NFP_stepD[OF nfp]
      using srsteps_eq_subst_relcomp_closed[OF m, THEN srsteps_eq_relcomp_gsrsteps_relcomp, of ]
      by (auto simp: rew_converse_outwards)
    from funas NF_to_fresh_const_subst_NF[OF llrg_linear_sys[OF llrg] fresh_sys(1) sig(1)]
    have "t  NF (srstep  )  t    NF (gsrstep ?ℋ )" by auto
    moreover have "(s  , t  )  (rstep )*  (s, t)  (srstep  )*" using gr funas fresh
      using remove_const_subst_steps_eq_lhs[OF llrg_linear_sys[OF llrg] fresh_sys, THEN rsteps_eq_srsteps_eqI[OF sig funas]]
      using remove_const_subst_steps_eq_rhs[OF llrg_linear_sys[OF llrg] fresh_sys, THEN rsteps_eq_srsteps_eqI[OF sig funas]]
      by (cases "ground s") (auto simp: ground_subst_apply)
    ultimately have "NFP_redp   s t" using wit unfolding NFP_redp_def
      by (auto dest: gsrsteps_eq_to_rsteps_eq)}
  then show ?thesis by (intro NFP_rrstep_intro) simp
qed



lemma llrg_NE_aux:
  assumes "(s, t)  srsteps_with_root_step  "
   and  sig: "funas_rel   " "funas_rel 𝒮  " and fresh: "(c, 0)  "
   and llrg: "llrg " "llrg 𝒮"
   and ne: "NE (gsrstep (insert (c, 0) ) ) (gsrstep (insert (c, 0) ) 𝒮)"
  shows "NE_redp   𝒮 s t"
proof -
  from fresh have fresh_sys: "(c, 0)  funas_rel " "(c, 0)  funas_rel 𝒮"
    using sig by (auto simp: funas_rel_def)
  let  = "const_subst c" let ?ℋ = "insert (c, 0) "
  let ?ℋ = "insert (c, 0) "  have mono: "  ?ℋ" by auto
  from assms(1) have gr: "ground t" and funas: "funas_term s  " "funas_term t  "
    using llrg_srsteps_with_root_step_ground[OF llrg(1)]
    by (meson srstepsD srsteps_with_root_step_srstepsD)+
  from funas have fresh_t: "(c, 0)  funas_term t" using fresh by auto
  from srsteps_subst_closed[OF srsteps_monp[OF mono, THEN subsetD, OF srsteps_with_root_step_srstepsD[OF assms(1)]], of ]
  have "(s  , t)  (gsrstep?ℋ )+" using gr
    by (auto simp: ground_subst_apply intro!: ground_srsteps_gsrsteps)
  then have "t  NF (srstep  )  (s  , t)  (gsrstep (insert (c, 0) ) 𝒮)*"
    using NF_to_fresh_const_subst_NF[OF llrg_linear_sys[OF llrg(1)] fresh_sys(1) sig(1) funas(2), of ?ℋ]
    using gr NE_NF_eq[OF ne, symmetric] ne unfolding NE_on_def
    by (auto simp: normalizability_def ground_subst_apply dest!: trancl_into_rtrancl)
  then show "NE_redp   𝒮 s t" unfolding NE_redp_def
    using remove_const_subst_steps_eq_lhs[OF llrg_linear_sys[OF llrg(2)] fresh_sys(2) fresh_t,
      THEN rsteps_eq_srsteps_eqI[OF sig(2) funas]]
    by (auto dest: gsrsteps_eq_to_rsteps_eq)
qed

lemma llrg_NE:
  assumes sig: "funas_rel   " "funas_rel 𝒮  " and fresh: "(c, 0)  "
   and llrg: "llrg " "llrg 𝒮"
   and ne: "NE (gsrstep (insert (c, 0) ) ) (gsrstep (insert (c, 0) ) 𝒮)"
  shows "NE (srstep  ) (srstep  𝒮)"
proof -
  have f: "(c, 0)  funas_rel " "(c, 0)  funas_rel 𝒮" using fresh sig
    by (auto simp: funas_rel_def)
  {fix s t assume "(s, t)  srsteps_with_root_step  "
    from llrg_NE_aux[OF this sig fresh llrg ne] have "NE_redp   𝒮 s t"
      by simp}
  moreover
  {fix s t assume "(s, t)  srsteps_with_root_step  𝒮"
    from llrg_NE_aux[OF this sig(2, 1) fresh llrg(2, 1) NE_symmetric[OF ne]]
    have "NE_redp  𝒮  s t" by simp}
  ultimately show ?thesis using linear_sys_gNF_eq_NF_eq[OF llrg_linear_sys[OF llrg(1)]
    llrg_linear_sys[OF llrg(2)] sig f _ _ NE_NF_eq[OF ne]]
    by (intro NE_rrstep_intro) auto
qed

subsection ‹Specialized for monadic signature›

lemma monadic_commute:
  assumes "llrg " "llrg 𝒮" "monadic "
   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" using steps assms(1 - 3)
      unfolding rew_converse_outwards
      by (auto simp: llrg_srsteps_with_root_step_ground llrg_monadic_rsteps_groundness)
    from steps(1) have f: "funas_term s  " using srstepsD by blast 
    let  = "λ _. s"
    from steps gr have "(s, u  )  (gsrstep  (¯))+" "(u  , t)  (gsrstep  𝒮)+"
      unfolding rew_converse_outwards
      using srsteps_subst_closed[where  =  and ?s = u, of _ ] f
      by (force simp: ground_subst_apply intro: ground_srsteps_gsrsteps)+
    then have "(s, t)  (gsrstep  𝒮)* O (gsrstep  (¯))*" using com
      unfolding commute_def rew_converse_inwards
      by (meson relcomp.relcompI subsetD trancl_into_rtrancl)
    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 monadic_CR:
  assumes "llrg " "monadic "
   and "CR (gsrstep  )"
  shows "CR (srstep  )" using monadic_commute assms
  unfolding CR_iff_self_commute
  by blast


lemma monadic_SCR:
  assumes sig: "funas_rel   " "monadic "
   and llrg: "llrg "
   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 t" "ground u" using ass sig(2) llrg
      by (metis llrg_monadic_rstep_pres_groundness)+
    let  = "λ _. t" have grs: "ground (s  )" using gr by auto
    from this scr obtain v where v: "(t, v)  (gsrstep  )=  (u, v)  (gsrstep  )*"
      using srstep_subst_closed[OF ass(1), of ]
      using srstep_subst_closed[OF ass(2), of ]
      using gr unfolding SCR_on_def
      by (metis Int_iff UNIV_I funas(2) ground_subst_apply mem_Collect_eq mem_Sigma_iff)
    then have "SCRp   t u"
      by (metis Int_iff Un_iff gsrsteps_eq_to_srsteps_eq)}
  then show ?thesis by (intro SCR_rrstep_intro) (metis srrstep_to_srestep)+ 
qed

lemma monadic_WCR:
  assumes sig: "funas_rel   " "monadic "
   and llrg: "llrg "
   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_to_srestep ass have gr: "ground t" "ground u"using ass sig(2) llrg
      by (metis llrg_monadic_rstep_pres_groundness)+
    let  = "λ _. t" have grs: "ground (s  )" using gr by auto
    from this wcr have w: "(t, u)  (gsrstep  )" using gr ass(2) funas
      using srstep_subst_closed[OF srrstep_to_srestep[OF ass(1)], of ]
      using srstep_subst_closed[OF ass(2), of ]
      unfolding WCR_on_def
      by (metis IntI SigmaI UNIV_I ground_subst_apply mem_Collect_eq)
    then have "(t, u)  (srstep  )" unfolding join_def
      by (metis gsrsteps_eq_to_srsteps_eq joinD joinI join_def)}
  then show ?thesis by (intro WCR_rrstep_intro) simp
qed

lemma monadic_UNF:
  assumes "llrg " "monadic "
   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" using steps assms(1, 2)
      unfolding rew_converse_outwards
      by (auto simp: llrg_srsteps_with_root_step_ground llrg_monadic_rsteps_groundness)
    from steps(1) have f: "funas_term s  " using srstepsD by blast 
    let  = "λ _. s"
    from steps gr have "(s, u  )  (gsrstep  (¯))+" "(u  , t)  (gsrstep  )+"
      unfolding rew_converse_outwards
      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 monadic_UNC:
  assumes "llrg " "monadic "
   and well: "funas_rel   "
   and unc: "UNC (gsrstep  )"
  shows "UNC (srstep  )"
proof -
  {fix s t assume ass: "(s, t)  (srstep  )*" "s  NF (srstep  )" "t  NF (srstep  )"
    then have "s = t"
    proof (cases "s = t")
      case False
      then have " s' t'. (s, t)  (srstep  )*  (s', s)  (srstep  )  (t', t)  (srstep  )"
        using ass by (auto simp: conversion_def rtrancl_eq_or_trancl dest: tranclD tranclD2)
      then obtain s' t' where split: "(s, t)  (srstep  )*" "(s', s)  (srstep  )" "(t', t)  (srstep  )" by blast
      from split(2, 3) have gr: "ground s" "ground t" using llrg_monadic_rstep_pres_groundness[OF assms(1, 2)]
        by blast+
      from ground_srsteps_eq_gsrsteps_eq[OF this ass(1)[unfolded sig_step_conversion_dist]]
      have "(s, t)  (gsrstep  )*"
        unfolding conversion_def Restr_smycl_dist
        by (simp add: rstep_converse_dist srstep_symcl_dist)
      then show ?thesis using ass(2-) unc gr
        by (auto simp: UNC_def ground_NF_srstep_gsrstep)
    qed auto}
  then show ?thesis by (auto simp: UNC_def UN_redp_def)
qed


lemma monadic_NFP:
  assumes "llrg " "monadic "
   and nfp: "NFP (gsrstep  )"
  shows "NFP (srstep  )"
proof -
  {fix s t u assume ass: "(s, t)  (srstep  )*" "(s, u)  (srstep  )*" "u  NF (srstep  )"
    have "(t, u)  (srstep  )*"
    proof (cases "s = u  s = t")
      case [simp]: True show ?thesis using ass
        by (metis NF_not_suc True rtrancl.rtrancl_refl)
    next
      case False
      then have steps:"(s, t)  (srstep  )+" "(s, u)  (srstep  )+" using ass(1, 2)
        by (auto simp add: rtrancl_eq_or_trancl)
      then have gr: "ground t" "ground u" using assms(1, 2) llrg_monadic_rsteps_groundness
        by blast+
      let  = "λ _. t" from steps gr have "(s  , t)  (gsrstep  )+" "(s  , u)  (gsrstep  )+"
        by (auto intro!: ground_srsteps_gsrsteps)
           (metis ground_subst_apply srstepsD srsteps_subst_closed)+
      then have "(t, u)  (gsrstep  )*" using nfp ass(3) gr
        by (auto simp: NFP_on_def) (metis ground_NF_srstep_gsrstep normalizability_I trancl_into_rtrancl)
      then show ?thesis by (auto dest: gsrsteps_eq_to_srsteps_eq)
    qed}
  then show ?thesis unfolding NFP_on_def
    by auto
qed


end