Theory General_Rewriting

theory General_Rewriting
imports Terms_Extras
begin

locale rewriting =
  fixes R :: "'a::term  'a  bool"
  assumes R_fun: "R t t'  R (app t u) (app t' u)"
  assumes R_arg: "R u u'  R (app t u) (app t u')"
begin

lemma rt_fun:
  "R** t t'  R** (app t u) (app t' u)"
by (induct rule: rtranclp.induct) (auto intro: rtranclp.rtrancl_into_rtrancl R_fun)

lemma rt_arg:
  "R** u u'  R** (app t u) (app t u')"
by (induct rule: rtranclp.induct) (auto intro: rtranclp.rtrancl_into_rtrancl R_arg)

lemma rt_comb:
  "R** t1 u1  R** t2 u2  R** (app t1 t2) (app u1 u2)"
by (metis rt_fun rt_arg rtranclp_trans)

lemma rt_list_comb:
  assumes "list_all2 R** ts us" "R** t u"
  shows "R** (list_comb t ts) (list_comb u us)"
using assms
by (induction ts us arbitrary: t u rule: list.rel_induct) (auto intro: rt_comb)

end

end