The problem with your type is that Zmod seed n2 is a positive integer, which can be 0, so seed' can be 0, which means that seed' * n1 can also be 0.
In the end, your CoFixpoint not typical, the seed should be in some Z_ge0 , and not in Z_gt0 .
EDIT: to answer part of the library, you might be interested in the positive type, which is a binary integer type strictly greater than 0. In fact, Z is defined as:
Inductive Z : Set := Z0 : Z (* 0 *) | Zpos : positive -> Z (* z > 0 *) | Zneg : positive -> Z (* z < 0 *)
However, the problem is the same: taking modulo a positive integer can exit positive , since you can get 0.
source share