Example of a setoid: Z

Z

The term Z_as_CSetoid is of type CSetoid. Hence we have proven that Z is a constructive setoid.

Addition

We will prove now that the addition on the integers is a setoid function.
What's more: the addition is also associative and commutative.

Opposite

Taking the opposite of an integer is a setoid function.

Lemma Zopp_wd : fun_wd (S1:=Z_as_CSetoid) (S2:=Z_as_CSetoid) Zopp.

Lemma Zopp_strext :
 fun_strext (S1:=Z_as_CSetoid) (S2:=Z_as_CSetoid) Zopp.

Definition Zopp_is_fun :=
  Build_CSetoid_fun Z_as_CSetoid Z_as_CSetoid Zopp Zopp_strext.
Canonical Structure Zopp_is_fun.

Multiplication

Finally the multiplication is a setoid function and is associative and commutative.

Zero