Section Confluence.
Variable X: Type.
Implicit Types (x y z : X) (R S : X -> X -> Prop).
Notation "R <<= S" := (subrelation R S) (at level 70).
Notation "R === S" := (R <<= S /\ S <<= R) (at level 70).
Definition joinable R x y := exists2 z, R x z & R y z.
Definition diamond R := forall x y z, R x y -> R x z -> joinable R y z.
Definition confluent R := diamond (star R).
Definition semi_confluent R :=
forall x y z, R x y -> star R x z -> joinable (star R) y z.
Fact diamond_semi_confluent R :
diamond R -> semi_confluent R.
Fact confluent_semi R :
confluent R <-> semi_confluent R.
Fact diamond_confluent R :
diamond R -> confluent R.
Fact joinable_ext R S x y:
R === S -> joinable R x y -> joinable S x y.
Fact diamond_ext R S:
R === S -> diamond S -> diamond R.

Lemma church_rosser (R: X -> X -> Prop) s t:
confluent R -> equiv R s t -> exists v: X, star R s v /\ star R t v.