Library CoLoR.Term.Lambda.LCompRewrite

CoLoR, a Coq library on rewriting and termination.
See the COPYRIGHTS and LICENSE files.
  • Frederic Blanqui, 2013-05-06

Higher-order rewriting and its associated CP structure


Set Implicit Arguments.


Rewrite system structure.


Module Type RS_Struct.

  Declare Module Export L : L_Struct.

We assume given a set of rules preserving free variables and whose left-hand sides are of the form apps (Fun f) ls.

  Parameter rule : relation Te.

  Declare Instance fv_rule : Proper (rule --> Subset) fv.

  Parameter lhs_fun : forall l r, rule l r -> F.
  Parameter lhs_nb_args : forall l r, rule l r -> nat.
  Parameter lhs_args : forall l r (h : rule l r), Tes (lhs_nb_args h).
  Parameter lhs_ok : forall l r (h : rule l r),
    l = apps (Fun (lhs_fun h)) (lhs_args h).

End RS_Struct.

Rewrite relation associated to a rewrite system and some of its properties.


Module Make (Export RS : RS_Struct).

  Module Export A := LAlpha.Make L.

  Lemma rule_ok : forall l r, rule l r ->
    exists f n (ls : Tes n), l = apps (Fun f) ls.

Equations satisfied by lhs_fun, lhs_nb_args and lhs_args.

  Lemma lhs_fun_eq : forall f n (ts : Tes n) r
    (h : rule (apps (Fun f) ts) r), lhs_fun h = f.


  Lemma lhs_nb_args_eq : forall f n (ts : Tes n) r
    (h : rule (apps (Fun f) ts) r), lhs_nb_args h = n.


  Lemma lhs_nb_args_eq_sym : forall f n (ts : Tes n) r
    (h : rule (apps (Fun f) ts) r), n = lhs_nb_args h.


  Lemma lhs_args_eq : forall f n (ts : Tes n) r (h : rule (apps (Fun f) ts) r),
    lhs_args h = Vcast ts (lhs_nb_args_eq_sym h).


Rewriting is defined as the alpha-closure of the monotone closure of the substitution closure of the set of rules.

  Notation Sh := (clos_subs rule).
  Infix "->Sh" := (clos_subs rule) (at level 70).

  Notation succ := Datatypes.S.
  Notation S := (clos_mon Sh).
  Infix "->S" := (clos_mon Sh) (at level 70).

  Notation S_aeq := (clos_aeq S).
  Infix "=>S" := (clos_aeq S) (at level 70).

Rewriting is stable by substitution.
Term vector rewriting modulo alpha-equivalence.

  Infix "-->S" := (Vrel1 S) (at level 70).
  Infix "==>S" := (clos_vaeq S) (at level 70).

Inversion lemma when rewriting a term of the form apps (Fun f) us.

  Lemma rewrite_apps_fun : forall f n (us : Tes n) t,
    apps (Fun f) us ->S t ->
    (exists vs, t = apps (Fun f) vs /\ us -->S vs)
    \/ (exists p (ls : Tes p) r s q (vs : Tes q) (h : p+q=n),
      rule (apps (Fun f) ls) r
      /\ us = Vcast (Vapp (Vmap (subs s) ls) vs) h
      /\ t = apps (subs s r) vs).


  Lemma rewrite_aeq_apps_fun : forall f n (us : Tes n) t,
    apps (Fun f) us =>S t ->
    (exists vs, t = apps (Fun f) vs /\ us ==>S vs)
    \/ (exists p (ls : Tes p) r s q (vs : Tes q) (h : p+q=n),
      rule (apps (Fun f) ls) r
      /\ us ~~~ Vcast (Vapp (Vmap (subs s) ls) vs) h
      /\ t ~~ apps (subs s r) vs).


End Make.

CP structure associated to a rewrite system.



Module CP_beta_eta_rewrite (Import RS : RS_Struct) <: LComp.CP_Struct.

  Module L := L.

  Module Import S := Make RS.
  Module Import B := LBeta.Make L.
  Module Import E := LEta.Make L.

We consider the union of eexists p (ls : RSh

  exists p (h

  exists p (us.

   p (S) (at level 70).

Reid" aef" hrefta_rew.l"CoLoR.Term.Lambda.LCompRewrite.html#MakRan class="id"9aitle="notation">"=>S" := (clos_aeq us.

  =
"=>S" := (clos_aeq S) (at level 70).

Reid" aef" hrefta_rew.lf3ca6db2b3c070e90669efbf5af1fa0d">
  Instance id" aef" hrefta_rew.ib/8.7.0/stdlib//Coq.Classes.Morphisms.html#5bcff5fca4c3a87e683dd8ca07bab63f">==>us
.

  "=>S" := (==>S) (at level 70).


a07bab63f">==>
h

==>h

  exists p (h

  exists p (is neutral if it>is not aTerm.Lambda.LCompRewrite.html#RS.L.Fun">is headedismsaTerm.Lambda.LCompRewrite.html#RS.L.Fun">n nr|writ>natTes r|"idref" href="CoLoR.Term.Lambd_ class="uctivn class="id" title="variable">r"id" title="vpan class="id"9an class="idt;nls) r="variable">r|writ>natTes r="variable">r|"idref" href="CoLoR.Term.Lambd_ class="uctivan class="id" title="abbreviation">Tes r="variable">//coq.inria.fr/distrib/8="idt; subties not involve">newrite.L"fca4c3a87e683dd8ca07bab63f">==>
a07bab63f">subs
.


p
(S) (at level 70).
  Sgram.Basiclass="iimplss="idt;
a0ef="CoLoR.Term.Lambda.LCompRewriariable">us
"=>S" := (
"
=>S" := (/\>a0ef="CoLoR.Term.Lambda.LCompRewriariable">us us
ls) = "=>S" := (hls) RS_Struct)ref" href="Class="ia_rewriss="idref" href="CoLoR.Term.Lambda.LCompRewrite.html#f">
a0ef="CoLoR.Term.Lambda.LCompRewriariable">us
us"=>S" := ("=>S" := (h
ls
)
a0ef="CoLoR.Term.Lambda.LCompRewriariable">us
us
"=>S" := ("=>S" := ("=>S" := (h
ls
) RS_Struct)ref" href="Class="i a_rewriss="idref" href="CoLoR.Term.Lambda.LCompRewrite.html#f">f) f
span> us
n"=>S" := (~~~ Vcast (Vapp
(RS_Struct
f" href="http)" hrefta_rewrite.L">subties involve">newrite.L"fca4c3a87e683dd8ca07bab63f">==>
a07bab63f">subs
.


S) (at level 70).
  ==>
hS) (at level 70).
  ==>

MFun
a07bab63f">subs
.


p
( RS_Struct< class="id" tifv"keyword">MFun usa07bab63f">
"
=>S" := (Vcast
(Vcast
(ls) level
70).

us
n"=>S" := (h
ls
) Vcast (= "=>S" := (h
ls
) =
=
level 70).

us
us
n"=>S" := ("=>S" := (h
ls
) RS_Struct)ref" href=":/coq.inria.fr/distrib/8write.html#RS_Struct">Vcast (= "=>S" := ("=>S" := (hls) RS_Struct)ref" href=":/coq.inria.fr/distrib/8write.html#RS_Struchtml#us"><9f55686171f1d5c1034e03575401f0b (Vcast (<9f55686171f1d5c1034e03575401f0b (level 70).

us
us nls) = hls) RS_Struct)ref" href=":/coq.inria.fr/distrib/8write.html#RS_Struct">Vcast ("=>S" := (==>S) (at level 70).

"=>S" := (==>==>h
"=>S" := (==>==>
h


  exis@tle="notation">"=>S" := (==>p (
h


  exis@tle="notation">"=>S" := (==>p (
f" hr fR.aspans hre/7"ifR.mTerm.Lambda.LCompRewrite.html#RS.L.Fun">) () id"9an class="idt;f) f
a0pan class="id"9an class="idt;us
n "=>S" := (~~~ Vcast (Vapp ( 70).
&html#vs">h
RS_Structf href="http:/coq.inria.fr/distrib/8.7.0/stdlib//Coq.Init.Logic.html#1c39bf187a.LCcc609e83c0a0ba5a372">= "LComp.CP_Struct.

   &html#vs">hRS_Structf href="http:/coq.inria.fr/distrib/8.7.0/stdlib//Coq.Init.Logic.html#1c39bf187a.LCcc609e83c0a0ba5a1c39bf1874trucc609e83c0a0ba5a37lass="idref" href="http://coq.inria.f#a87e683dd8ca07bab63f">==>~~~ Vcast (Vapp (RS_Struct) <: vshRS_Struct) <: LComp.CP_Struct.

   "LComp.CP_Struct.

  LComp.CP_Struct.

   &html#vs">nppRewrite.htm.Term.Lambda.LCompRewrite.htmlmcode"> .Term.Lambda.LCompRewrite.htmlscode"> .Term.Lambda.LCompRewrite.htmlqef143c4e55694817241160784054b7dc">n"code"> nppRewrite.hthtml#vs">
"=>S" := ("=>S" := (~~~ Vcast (Vapp (RS_Structlsid" title="definition">Vapp
( "vs~~~
"<.LambVoLoR.bVoL.Lambda.LCVma05ffe732283716822">~~~

M.0/stdlib//Coq.Init.Logic.html#7a45dffb109c3069e5c675be68643class="idref" href="CoLoR.Term.Lambdasid" title="definition">Vapp
(RS_Struct
lsid" title="definition">Vapp
(RS_Struct
) <: Vapp
(h"id" title=span> "vsRS_Struct
f href="http:/coq.inria.fr/distrib/8c.html#7a45dffb109cAlphaa0ba5a402fd29b2de3dd0fcb27d1f06 c40179R.Term.Lambda.LCompRewrite.html#h">==>~~~

M.0/stdlib//Coq.Init.Logic.html#7a45dffb109c3069e5c675be68643class="idref" href="CoLoR.Term.Lambdasid" title="efinition">Vapp
(Vapp (RS_Struct
) <: LComp.CP_Struct.

   ) iass="id" title="keyword">level 70).


title="notation">")
subs.


p
(S) (at level 70).
  Sgram.Basiclass="iimplss="idt;) (level 70).


ti@tle="notation">"
=>S" := (
~~~

~~~
==> level 70).


ti@tle="notation">"
=>S" := (
~~~

~~~
==> level 70).

"
=>S" := (~~~

~~~
==>
hn
level 70).

"
=>S" := (hls)
~~~ ==>==>
hn
70).

hn