(**************************************************************)
(*   Copyright Dominique Larchey-Wendling [*]                 *)
(*                                                            *)
(*                             [*] Affiliation LORIA -- CNRS  *)
(**************************************************************)
(*      This file is distributed under the terms of the       *)
(*         CeCILL v2 FREE SOFTWARE LICENSE AGREEMENT          *)
(**************************************************************)
(** ** Solutions of Pell's equation *)
Set Implicit Arguments.
Section Zp_alpha_2.
Variable (ak am k l m : nat)
(H1 : m = (l*k)%nat)
(H2 : (ak*ak <> 0)%nat).
Notation "〚 u 〛" := (nat2Zp H2 u).
Infix "⊗" := (Zp_mult H2) (at level 40, left associativity).
Hypothesis (H3 : (m <> 0)%nat)
(H4 : exists q, Zp_invertible H2 q /\〚am〛 = q⊗〚l〛⊗〚ak〛).
Let Hak : ak <> 0.  Proof. intro; subst; destruct H2; auto. Qed.
Let Hl : l <> 0.    Proof. contradict H3; subst; ring. Qed.
Let Hk : k <> 0.    Proof. contradict H3; subst; ring. Qed.

Lemma Zp_alpha_congruence_2 : divides (ak*ak) am <-> divides (k*ak) m.
End Zp_alpha_2.