 reserve i,j, k,v, w for Nat;
 reserve j1,j2, m, n, s, t, x, y for Integer;
 reserve p for odd Prime;
 reserve a for Real;
 reserve b for Integer;

theorem lem5:
  for p be odd Prime, s be Nat, j1, j2
    st 2*s = p+1 & j1 in rng LAG4SQg s & j2 in rng LAG4SQg s holds
    j1 = j2 or j1 mod p <> j2 mod p
    proof
      let p;
      consider s such that
A1:   p+1 = 2 * s by ABIAN:11;
      s > 0 by A1; then
      s in NAT by INT_1:3; then
      reconsider s as Nat;
A4:   2*(p - s) = p - 1 by A1;
      p -1 > 2 -1 by lem3, XREAL_1:14; then
      p - s > 0 by A4; then
A7:   p -s + s > 0 + s by XREAL_1:8;
A8:   dom LAG4SQg s = Seg len LAG4SQg s by FINSEQ_1:def 3
      .= Seg s by Def3;
      for j1, j2 st j1 in rng LAG4SQg s
      & j2 in rng LAG4SQg s & j1 <> j2 holds j1 mod p <> j2 mod p
      proof
        let j1, j2 such that
A9:     j1 in rng LAG4SQg s and
A10:    j2 in rng LAG4SQg s and
A11:    j1 <> j2;
        consider i1 be object such that
A12:    i1 in dom LAG4SQg s and
A13:    j1 = (LAG4SQg s).i1 by A9,FUNCT_1:def 3;
        consider i2 be object such that
A14:    i2 in dom (LAG4SQg s) and
A15:    j2 = (LAG4SQg s).i2 by A10,FUNCT_1:def 3;
        reconsider i1,i2 as Nat by A12,A14;
A16:    j2 = -1-(i2-1)^2 by A14,A15,Def3;
A17:    j2 - j1 = -1-(i2-1)^2 -(-1- (i1-1)^2) by A12,A13,A16,Def3
          .= (i1 + i2 -2)*(i1-i2);
A18:    j1 - j2 = -1-(i1-1)^2 - (-1-(i2-1)^2) by A12,A13,A16,Def3
          .= (i2 + i1 -2)*(i2-i1);
        consider i9 be Nat such that
A19:    i1 = i9 and
A20:    1 <= i9 and
A21:    i9 <= s by A8,A12;
        consider i0 be Nat such that
A28:    i2 = i0 and
A29:    1 <= i0 and
A30:    i0 <= s by A8,A14;
A31:    i1 + i2 -2 < p
        proof
          s + s = p+1 by A1; then
          i1 + i2 <= p+1 by A19,A21,A28,A30,XREAL_1:7; then
          i1 + i2 + -2 < p+1 + -1 by XREAL_1:8;
          hence thesis;
        end;
A34:    i1 + i2 -2 > 0
          proof
          per cases by A28,A29,XXREAL_0:1;
            suppose i2 = 1; then
            i1 > 1 by A11,A13,A15,A19,A20,XXREAL_0:1; then
            i1 + i2 > 1 + 1 by A28,A29,XREAL_1:8; then
            i1 + i2 + (-2) > 2 + (-2) by XREAL_1:8;
            hence i1 + i2 -2 > 0;
          end;
          suppose i2 > 1; then
            i1 + i2 > 1 + 1 by A19,A20,XREAL_1:8; then
            i1 + i2 + (-2) > 2 + (-2) by XREAL_1:8;
            hence i1 + i2 -2 > 0;
          end;
        end;
A40:    i1 - i2 < p & i2 -i1 < p
        proof
          i1 - i2 <= i1 by XREAL_1:43; then
A41:      i1 - i2 <= s by A19,A21,XXREAL_0:2;
          i2 - i1 <= i2 by XREAL_1:43; then
          i2 - i1 <= s by A28,A30,XXREAL_0:2;
          hence thesis by A7,A41,XXREAL_0:2;
        end;
        j1 mod p <> j2 mod p
        proof
          per cases by A11,A13,A15,XXREAL_0:1;
          suppose i1 > i2; then
A45:        i1 - i2 > 0 by XREAL_1:50;
            reconsider i1,i2 as Nat;
            reconsider p as Nat;
A46:        i1 + i2 -2 in NAT by A34,INT_1:3;
A47:        i1 - i2 in NAT by A45, INT_1:3;
A48:        (i1 + i2 -2)*(i1-i2) mod p <> 0
            proof
              assume
A49:          (i1 + i2 -2)*(i1-i2) mod p = 0;
A51:          (i1 + i2 -2)*(i1-i2) div p in NAT by A46,A47,INT_1:3,55;
              (i1 + i2 -2)*(i1-i2) = p*((i1 + i2 -2)*(i1-i2) div p)+0
                by A46,A47,A49,NAT_D:2; then
              p divides (i1 + i2 -2) or p divides (i1-i2)
                by A46,A47,A51,NAT_D:def 3,NEWTON:80;
              hence contradiction by A31,A34,A40,A45,A46,A47,NAT_D:7;
            end;
            j1 mod p = j2 mod p implies (j2 -j1) mod p = 0
            proof
              assume
A53:          j1 mod p = j2 mod p;
              (j2 - j1) mod p = ((j2 mod p) - (j1 mod p)) mod p by INT_6:7
                .= 0 by NAT_D:26,A53;
              hence thesis;
            end;
            hence thesis by A17,A48;
         end;
         suppose i2 > i1; then
A55:       i2 - i1 > 0 by XREAL_1:50;
A56:       i2 + i1 -2 in NAT by A34,INT_1:3;
A57:       i2 - i1 in NAT by A55,INT_1:3;
A58:       (i2 + i1 -2)*(i2-i1) mod p <> 0
           proof
             assume
A59:         (i2 + i1 -2)*(i2-i1) mod p = 0;
A61:         (i2 + i1 -2)*(i2-i1) div p in NAT by A56,A57,INT_1:3,55;
             (i2 + i1 -2)*(i2-i1) = p * ((i2 + i1 -2)*(i2-i1) div p) + 0
               by A56,A57,A59,NAT_D:2; then
             p divides (i2 + i1 -2) or p divides (i2-i1)
               by A56,A57,A61,NAT_D:def 3,NEWTON:80;
             hence contradiction by A31,A34,A40,A55,A56,A57,NAT_D:7;
          end;
          j1 mod p = j2 mod p implies (j1 -j2) mod p = 0
          proof
           assume
A63:       j1 mod p = j2 mod p;
           (j1 - j2) mod p = ((j1 mod p) - (j2 mod p)) mod p by INT_6:7
           .= 0 by NAT_D:26,A63;
           hence thesis;
         end;
         hence thesis by A18,A58;
       end;
     end;
     hence thesis;
     end;
     hence thesis by A1;
    end;
