Example of a setoid: N+



Setoid

The positive natural numbers N+ will be defined as a subsetoid of the natural numbers.

Definition N+ := Build_SubCSetoid nat_as_CSetoid (fun n : N => n <> 0).

Definition NposP := (fun n : nat_as_CSetoid => n <> 0).

One and two are elements of it.

Definition ONEpos := Build_subcsetoid_crr _ NposP 1 (S_O 0).

Definition TWOpos := Build_subcsetoid_crr _ NposP 2 (S_O 1).

Addition and multiplication

Because addition and multiplication preserve positivity, we can define them on this subsetoid.
The addition has no right unit on this set.

Lemma no_rht_unit_Npos1 : forall y : N+, ~ (forall x : N+, Npos_plus x y[=]x).

And the multiplication doesn't have an inverse, because there can't be an inverse for 2.

Lemma no_inverse_Nposmult1 : forall n : N+, ~ (Npos_mult TWOpos n[=]ONEpos).