reserve i,i1,i2,i3,i4,i5,j,r,a,b,x,y for Integer,
  d,e,k,n for Nat,
  fp,fk for FinSequence of INT,
  f,f1,f2 for FinSequence of REAL,
  p for Prime;
reserve fr for FinSequence of REAL;
reserve fr,f for FinSequence of INT;
reserve b,m for Nat;

theorem
  p > 2 & a gcd p = 1 & a is_quadratic_residue_mod p implies ex x,y
  being Integer st (x^2 - a) mod p = 0 & (y^2 - a) mod p = 0 & not x,y
  are_congruent_mod p
proof
  assume that
A1: p > 2 and
A2: a gcd p = 1 and
A3: a is_quadratic_residue_mod p;
  consider x such that
A4: (x^2 - a) mod p = 0 by A3;
  take x;
  take -x;
  not x,(-x) are_congruent_mod p
  proof
    assume x,(-x) are_congruent_mod p;
    then
A5: p divides 2*x;
    2,p are_coprime by A1,INT_2:28,30;
    then 2 gcd p = 1 by INT_2:def 3;
    then p divides x by A5,WSIERP_1:29;
    then consider i being Integer such that
A6: x = p * i;
    x gcd p = p*i gcd p*1 by A6
      .= p*(i gcd 1) by EULER_1:15
      .= p*1 by WSIERP_1:8;
    then x gcd p <> 1 by INT_2:def 4;
    then not x,p are_coprime by INT_2:def 3;
    hence contradiction by A2,A4,Th14;
  end;
  hence thesis by A4;
end;
