Section RelationProperties.
(** Caveat: reflexive should not be used to state lemmas, as auto and trivial will not expand the constant.                                               **)
Variable T : Type.
Variable R : rel T.
Definition total := forall x y, R x y || R y x.
Definition transitive := forall y x z, R x y -> R y z -> R x z.
Definition symmetric := forall x y, R x y = R y x.
Definition antisymmetric := forall x y, R x y && R y x -> x = y.
Definition pre_symmetric := forall x y, R x y -> R y x.

(* Specifications: *)
Lemma symmetric_from_pre : pre_symmetric -> symmetric.
End RelationProperties.
Lemma rev_trans T (R : rel T) : transitive R -> transitive (fun x y => R y x).
Lemma subon_bij (D2' : pred T2) :
{subset D2 <= D2'} -> {on D2', bijective f} -> {on D2, bijective f}.
Lemma in_on1P : {in D1, {on D2, allQ1 f}} <->
{in [pred x in D1 | f x \in D2], allQ1 f}.
Lemma in_on1lP : {in D1, {on D2, allQ1l f & h}} <->
{in [pred x in D1 | f x \in D2], allQ1l f h}.
Lemma in_on2P : {in D1 &, {on D2 &, allQ2 f}} <->
{in [pred x in D1 | f x \in D2] &, allQ2 f}.
Lemma on1W_in : {in D1, allQ1 f} -> {in D1, {on D2, allQ1 f}}.
Lemma can_in_comp [A B C : Type] (D : {pred B}) (D' : {pred C})
[f : B -> A] [h : C -> B] [f' : A -> B] [h' : B -> C] :
{homo h : x / x \in D' >-> x \in D} ->
{in D, cancel f f'} -> {in D', cancel h h'} ->
{in D', cancel (f \o h) (h' \o f')}.