Fact sum2s0 : 0 \is a sum_of_two_square.

(* Specifications: *)
Lemma sum2sGP x :
reflect (exists m : GI, x = normGI m)
(x \is a sum_of_two_square).
Lemma sum2sM x y :
x \is  a sum_of_two_square ->
y \is  a sum_of_two_square ->
x * y \is  a sum_of_two_square.
Lemma sum2s_dvd_prime p a b :
prime p -> coprime a b ->
p %| a ^ 2 + b ^ 2 -> p \is  a sum_of_two_square.
Lemma sum2sX x n :
x \is  a sum_of_two_square  -> x ^ n \is  a sum_of_two_square.
Lemma sum2sX_prime x n :
prime x -> odd n ->
x ^ n \is  a sum_of_two_square -> x  \is  a sum_of_two_square.
Lemma sum2sM_coprime x y :
coprime x y ->
x * y \is  a sum_of_two_square ->  x \is  a sum_of_two_square.
Lemma modn_prod I r (P : pred I) F d :
\prod_(i <- r | P i) (F i %% d) = \prod_(i <- r | P i) F i %[mod d].
Lemma sum2sprime p :
odd p -> prime p -> p \is a sum_of_two_square = (p %% 4 == 1).
(** Main theorem **)
Lemma sum2stest n :
reflect
(forall p,  prime p -> odd p -> p %| n -> odd (logn p n) -> p %% 4 = 1)
(n \is a sum_of_two_square).