Definition respectful_relation {A B} (f: A -> B) (R: relation B): relation A := fun x y => R (f x) (f y).
Definition fst_relation {A B}: relation A -> relation (A * B) := respectful_relation (@fst A B).
Definition snd_relation {A B}: relation B -> relation (A * B) := respectful_relation (@snd A B).
Instance respectful_relation_proper {A B} (f: A -> B): Proper (same_relation _ ==> same_relation _) (respectful_relation f).
Definition partial_functional {A: Type} (R: relation A): Prop :=
forall m n n', R m n -> R m n' -> n = n'.
Class PartialFunctional {A: Type} (R: relation A): Prop :=
partial_functionality: forall m n n', R m n -> R m n' -> n = n'.
Definition functional {A: Type} (R: relation A): Prop :=
forall m, exists n, forall n', R m n' <-> n' = n.
Class Functional {A: Type} (R: relation A): Prop :=
functionality: forall m, exists n, forall n', R m n' <-> n' = n.
Definition serial {A: Type} (R: relation A): Prop :=
forall m, exists n, R m n.
Class Serial {A: Type} (R: relation A): Prop :=
seriality: forall m, exists n, R m n.

(* Specifications: *)
Lemma function_Functional {A: Type} {f: A -> A}: Functional (fun a => eq (f a)).
Lemma SerialPartialFunctional_Functional {A: Type} {R: relation A}: Serial R -> PartialFunctional R -> Functional R.
Instance Functional_PartialFunctional {A: Type} {R: relation A} {_: Functional R}: PartialFunctional R.