Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
Open Scope nat_scope.
Definition sum_of_two_square :=
[qualify a x |
[exists a : 'I_x.+1, exists b : 'I_x.+1, x == a ^ 2 + b ^ 2]].
Fact sum2s0 : 0 \is a sum_of_two_square.

(** 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).