Section lagrange_prelim_odd.
Variable (p n : nat) (Hp1 : prime p) (Hp2 : p = 2*n+1).
Let Hn : 0 < n.
Let Hp : p <> 0.
(* Let us defined two injective functions from [0,n] to Z/Z(2n+1)  f := x => x² g := x => -(1+x²)  *)
Let f x := nat2Zp Hp (x*x).
Let g y := Zp_opp Hp (Zp_plus Hp (Zp_one Hp) (f y)).
Let Hf x y : In x l -> In y l -> f x = f y -> x = y.
Let Hg x y : In x l -> In y l -> g x = g y -> x = y.
(* Since |map f l| = n+1 and |map g l| = n+1 and the domain has cardinal 2*n+1, they must intersect *)
Let intersection : exists y, In y (map f l) /\ In y (map g l).
Local Lemma lagrange_prelim_odd :
exists a b, divides p (1+a*a+b*b)
/\ 2*a <= p-1
/\ 2*b <= p-1.
End lagrange_prelim_odd.
(* Preliminary lemma : any prime p has a (small) multiple n*p of the form 1+a²+b² with 0 < n < p *)

Lemma lagrange_prelim p : prime p -> exists n a b, n*p = 1+a*a+b*b /\ 0 < n < p.