(* Definition of String rewriting with finite types *)
(*  String Rewriting **)
Variable sig: Type.
Definition rule : Type := list sig * list sig.
Definition srs := list rule.
Implicit Types (a b c: sig) (x y z u v: list sig)
(r: list sig* list sig) (R S: srs).
Inductive rew' : srs -> list sig -> list sig -> Prop:=
|rewR R x u y v : (u,v) el R -> rew' R (x++u++y) (x++v++y).
Hint Constructors rew'.
Inductive rewt' (S: srs) (x: list sig) : list sig -> Prop :=
|rewt'Refl : rewt' S x x
|rewt'Rule y z : rew' S x y -> rewt' S y z -> rewt' S x z.
Hint Constructors rewt'.
Instance rewt'Trans R :
PreOrder (rewt' R).

(* Specifications: *)
Lemma subset_rewriting S R x y:
S <<= R -> rewt' S x y -> rewt' R x y.
Lemma rewrite_app R x y z:
rewt' R x y -> rewt' R (z++x) (z++y).
Lemma rewrite_right R x y z :
rewt' R x y -> rew' R y z -> rewt' R x z.
Lemma rewt'_ind_left :
forall (S : srs) x (P : list sig -> Prop),
(P x) ->
(forall y z : list sig, rewt' S x y -> rew' S y z -> P y -> P z) -> forall l : list sig, rewt' S x l -> P l.