Section ZpDef.
(***********************************************************************)
(*                                                                     *)
(*  Mod p arithmetic on the finite set {0, 1, 2, ..., p - 1}           *)
(*                                                                     *)
(***********************************************************************)
Variable p' : nat.
Local Notation p := p'.+1.
Implicit Types x y z : 'I_p.
(* Standard injection; val (inZp i) = i %% p *)
Definition inZp i := Ordinal (ltn_pmod i (ltn0Sn p')).

Lemma Zp_inv_out x : ~~ coprime p x -> Zp_inv x = x.