(** ** Union of relations *)

Definition rel_union {A B} (R1 R2: rel A B): rel A B :=
  fun x y => R1 x y \/ R2 x y.Infix "\/" := rel_union : rel_scope.Global Instance rel_union_subrel_params:
  Params (@rel_union) 4.

(* Specifications: *)
Lemma rel_union_rexists_l {A B} (R1 R2: rel A B) x y: RExists (R1 x y) (R1 \/ R2) x y.
Lemma rel_union_rexists_r {A B} (R1 R2: rel A B) x y: RExists (R2 x y) (R1 \/ R2) x y.
Lemma rel_union_subrel_rexists_l {A B} (R R1 R2: rel A B): RExists (subrel R R1) subrel R (R1 \/ R2)%rel.
Lemma rel_union_subrel_rexists_r {A B} (R R1 R2: rel A B): RExists (subrel R R2) subrel R (R1 \/ R2)%rel.
Lemma rel_union_lub {A B} (R1 R2 R: rel A B): RIntro (subrel R1 R /\ subrel R2 R) subrel (R1 \/ R2)%rel R.
Lemma rel_union_refl_l {A} (R1 R2: rel A A): Reflexive R1 -> Reflexive (R1 \/ R2).
Lemma rel_union_refl_r {A} (R1 R2: rel A A): Reflexive R2 -> Reflexive (R1 \/ R2).
Lemma rel_union_corefl {A} (R1 R2: rel A A): Coreflexive R1 -> Coreflexive R2 -> Coreflexive (R1 \/ R2).
Lemma rel_union_sym {A} (R1 R2: rel A A): Symmetric R1 -> Symmetric R2 -> Symmetric (R1 \/ R2).