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;
reserve b for Integer;
reserve m for Integer;
reserve fp for FinSequence of NAT;

theorem
  p>2 & p mod 4 = 1 implies (-1) is_quadratic_residue_mod p
proof
  assume that
A1: p>2 and
A2: p mod 4 = 1;
  p>1 by INT_2:def 4;
  then
A3: p-'1 = p-1 by XREAL_1:233;
  p = (p div 4)*4 + 1 by A2,NAT_D:2;
  then p-'1 = 2*(2*(p div 4)) by A3;
  then (-1)|^((p-'1) div 2) = (-1)|^(2*(p div 4))
    .= ((-1)|^2)|^(p div 4) by NEWTON:9
    .= (1|^2)|^(p div 4) by WSIERP_1:1
    .= 1;
  then Lege(-1,p) = 1 by A1,Th36;
  hence thesis by Def3;
end;
