reserve k,n,m,l,p for Nat;
reserve n0,m0 for non zero Nat;
reserve f for FinSequence;
reserve x,X,Y for set;
reserve f1,f2,f3 for FinSequence of REAL;
reserve n1,n2,m1,m2 for Nat;

theorem Th20:
  0 <> l & p > l & p > n1 & p > n2 & l*n1 mod p = l*n2 mod p & p
  is prime implies n1=n2
proof
  assume that
A1: l<>0 & p > l and
A2: p > n1 and
A3: p > n2;
  assume
A4: l*n1 mod p = l*n2 mod p;
  assume
A5: p is prime;
  then (l*n1-l*n2) mod p = 0 by A4,INT_4:22;
  then
A6: p divides l*(n1-n2) by A5,INT_1:62;
  per cases by A5,A6,INT_5:7;
  suppose
    p divides l;
    hence thesis by A1,NAT_D:7;
  end;
  suppose
A7: p divides n1-n2;
    per cases;
    suppose
A8:   n1-n2 > 0;
      then p divides n1-'n2 & n1-'n2>0 by A7,XREAL_0:def 2;
      then p <= n1-'n2 by NAT_D:7;
      then p+n2 <= n1-'n2+n2 by XREAL_1:6;
      then p+n2 <= n1-n2+n2 by A8,XREAL_0:def 2;
      then p+n2 < p by A2,XXREAL_0:2;
      then p+n2-p < p-p by XREAL_1:9;
      then n2 < 0;
      hence thesis;
    end;
    suppose
      n1-n2 = 0;
      hence thesis;
    end;
    suppose
      n1-n2 < 0;
      then
A9:   (-(n1-n2)) > 0;
      then
A10:  n2-n1 > 0;
      then
A11:  n2-'n1>0 by XREAL_0:def 2;
      p divides -(n1-n2) by A7,INT_2:10;
      then p divides n2-'n1 by A10,XREAL_0:def 2;
      then p <= n2-'n1 by A11,NAT_D:7;
      then p+n1 <= n2-'n1+n1 by XREAL_1:6;
      then p+n1 <= n2-n1+n1 by A9,XREAL_0:def 2;
      then p+n1 < p by A3,XXREAL_0:2;
      then p+n1-p < p-p by XREAL_1:9;
      then n1 < 0;
      hence thesis;
    end;
  end;
end;
