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 Th20:
  p > 2 & a gcd p = 1 & a is_quadratic_residue_mod p implies (a|^(
  (p-'1) div 2) - 1) mod p = 0
proof
  assume that
A1: p > 2 and
A2: a gcd p = 1 and
A3: a is_quadratic_residue_mod p;
A4: p>1 by INT_2:def 4;
  a|^((p-'1) div 2) mod p = 1 by A1,A2,A3,Th17;
  then a|^((p-'1) div 2) mod p = 1 mod p by A4,NAT_D:14;
  then a|^((p-'1) div 2),1 are_congruent_mod p by NAT_D:64;
  hence thesis by INT_1:62;
end;
