
theorem :: MOD5:
  for a,b be Nat st a,b are_coprime holds (a|^4 - b|^4) mod 5 is square
  proof
    let a,b be Nat such that
    A1: a,b are_coprime;
    A3: not 5 divides a or not 5 divides b by A1,PEPIN:59,PYTHTRIP:def 2;
    (a|^(5 -1) mod 5 = 0 or a|^(5-1) mod 5 = 1) &
    (b|^(5-1) mod 5 = 0 or b|^(5-1) mod 5 = 1) by PEPIN:59,MOP; then
    per cases;
    suppose
      a|^4 mod 5 = 0 & b|^4 mod 5 = 0; then
      B1: 5 divides a|^4 & 5 divides b|^4 by INT_1:62;
      a|^4 divides a|^(4 + 1) & b|^4 divides b|^(4 + 1) by NEWTON:89; then
      5 divides a|^5 & 5 divides b|^5 by B1,INT_2:9;
      hence thesis by A3,PEPIN:59,NEWTON02:160;
    end;
    suppose
      B1: a|^4 mod 5 = 0 & b|^4 mod 5 = 1; then
      (-b|^4) mod 5 = (1*5 - (1 mod (1+4))) mod (4+1) by NEWTON02:86
      .= 4; then
      (a|^4 + (-b|^4)) mod 5 = (0 + 4) mod (4 + 1) by B1,NAT_D:66
      .= 2*2;
      hence thesis;
    end;
    suppose
      B1: a|^4 mod 5 = 1 & b|^4 mod 5 = 0; then
      (-b|^4) mod 5 = (1*5 - (0 mod 5)) mod 5 by NEWTON02:86
      .= 0; then
      (a|^4 + (-b|^4)) mod 5 = (1 + 0) mod (1 + 4) by B1,NAT_D:66
      .= 1*1;
      hence thesis;
    end;
    suppose
      B1: a|^4 mod 5 = 1 & b|^4 mod 5 = 1; then
      (-b|^4) mod 5 = (1*5 - (1 mod (1+4))) mod (4+1) by NEWTON02:86
      .= 4; then
      (a|^4 + (-b|^4)) mod 5 = (1 + 4) mod 5 by B1,NAT_D:66;
      hence thesis;
    end;
  end;
