reserve n for Nat,
        i,j,i1,i2,i3,i4,i5,i6 for Element of n,
        p,q,r for n-element XFinSequence of NAT;
reserve i,j,n,n1,n2,m,k,l,u,e,p,t for Nat,
        a,b for non trivial Nat,
        x,y for Integer,
        r,q for Real;

theorem Th24:
  0 < i <= n & Px(a,i),Px(a,j) are_congruent_mod Px(a,n)
      implies j,i are_congruent_mod 4*n or j,-i are_congruent_mod 4*n
proof
  set m = j mod (4*n), d = j div (4*n);
  assume
A1: 0 < i <= n & Px(a,i),Px(a,j) are_congruent_mod Px(a,n);
  then
A2: j= d*(4*n) + m by INT_1:59;
  then
A3: Px(a,|.j.|),Px(a,|.m.|) are_congruent_mod Px(a,|.n.|) by Th23;
  m < 4*n by A1,INT_1:58;
  then per cases by A3,Th22,A1,INT_1:15;
  suppose m=i;
    then (4*n) divides (j-i) by A1,PEPIN:8;
    hence thesis by INT_2:15;
  end;
  suppose m + i = 4*n;
    then (4*n) divides (m--i);
    then
A4:   m,-i are_congruent_mod 4*n by INT_2:15;
    j-m =d*(4*n) by A2;
    then j,m are_congruent_mod 4*n by INT_1:def 5;
    hence thesis by A4,INT_1:15;
  end;
end;
