
theorem Th20:
  for i being Integer
    holds -1,1 are_congruent_mod i iff (i = 2 or i = 1 or i = -2 or i = -1)
proof
let n be Integer;
hereby assume A1: -1,1 are_congruent_mod n;
   then consider k being Integer such that A2: n * k = -2;
   now per cases;
   case n >= 0;
     then n in NAT by INT_1:3;
     then reconsider m = n as Nat;
     m = 1 or m = 2 by A1,Th19;
     hence n = 2 or n = 1 or n = -2 or n = -1;
    end;
   case A3: n < 0;
     then A4: k > 0 by A2;
     then A5: k >= 0 + 1 by INT_1:7;
     now assume A6: n <> -2;
       now assume A7: n <> -1;
         n <= -1 by A3,INT_1:8;
         then n < -1 by A7,XXREAL_0:1;
         then n + 1 <= -1 by INT_1:7;
         then n + 1 - 1 <= -1 - 1 by XREAL_1:9;
         then n < -2 by A6,XXREAL_0:1;
         then n + 1 <= -2 by INT_1:7;
         then n + 1 - 1 <= -2 - 1 by XREAL_1:9;
         then A8: n * k <= (-3) * k by A4,XREAL_1:64;
         (-3) * k <= (-3) * 1 by A5,XREAL_1:65;
         hence contradiction by A2,A8,XXREAL_0:2;
         end;
       hence n = -1;
       end;
     hence n = 2 or n = 1 or n = -2 or n = -1;
     end;
   end;
   hence n = 2 or n = 1 or n = -2 or n = -1;
   end;
assume A9: n = 2 or n = 1 or n = -2 or n = -1;
   per cases by A9;
   suppose n = 2;
     then n * (-1) = -2;
     hence -1,1 are_congruent_mod n;
     end;
   suppose n = 1;
     hence -1,1 are_congruent_mod n by INT_1:13;
     end;
   suppose n = -2;
     hence -1,1 are_congruent_mod n;
     end;
   suppose n = -1;
     then n * (-1) = 1;
     hence -1,1 are_congruent_mod n by INT_1:20,INT_1:13;
     end;
end;
