
theorem Th3:
  for q, a, b being Element of NAT
  st 0 < a & 1 < q & (q |^ a) -' 1 divides (q |^ b)-'1 holds a divides b
proof
  let q,a,b be Element of NAT such that
A1: 0 < a and
A2: 1 < q and
A3: (q |^ a)-'1 divides (q |^ b)-'1;
  set r = b mod a;
  set qNa = q |^ a;
  set qNr = q |^ r;
  defpred P[Nat] means qNa-'1 divides (q |^ (a*$1 + r))-'1;
A4: b = a*(b div a) + r by A1,NAT_D:2;
  then
A5: ex k being Nat st P[k] by A3;
  consider k being Nat such that
A6: P[k] and
A7: for n being Nat st P[n] holds k <= n from NAT_1:sch 5(A5);
  now per cases;
    suppose
A8:   k = 0;
A9:   now
        assume
A10:    0 <> qNr-'1;
        r < a by A1,NAT_D:1;
        then consider m being Nat such that
A11:    a = r + m by NAT_1:10;
A12:    m <> 0 by A1,A11,NAT_D:1;
A13:    (q |^ (r + m)) = (q #Z (r + m)) by PREPOWER:36;
A14:    (q #Z (r + m)) = (q #Z r)*(q #Z m) by A2,PREPOWER:44;
A15:    (q #Z r) = (q |^ r) by PREPOWER:36;
A16:    (q #Z m) = (q |^ m) by PREPOWER:36;
A17:    (q |^ m) >= 1 by A2,PREPOWER:11;
        m in NAT by ORDINAL1:def 12;
        then (q |^ m) <> 1 by A2,A12,Th1;
        then (q |^ m) > 1 by A17,XXREAL_0:1;
        then
A18:    qNr < qNa by A2,A11,A13,A14,A15,A16,PREPOWER:39,XREAL_1:155;
        then 0+ 1 <= qNa by NAT_1:13;
        then qNa-'1 = qNa-1 by XREAL_1:233;
        then
A19:    qNa-'1 = qNa+(-1);
        0+1 <= qNr by A10,NAT_2:8;
        then qNr-'1 = qNr-1 by XREAL_1:233;
        then qNr-'1 = qNr+(-1);
        then qNr-'1 < qNa-'1 by A18,A19,XREAL_1:8;
        hence contradiction by A6,A8,A10,NAT_D:7;
      end;
      0 < qNr by A2,PREPOWER:6;
      then 0+1<=qNr by NAT_1:13;
      then qNr-1+1 = 1 by A9,XREAL_1:233;
      then r = 0 by A2,Th1;
      hence thesis by A4,NAT_D:3;
    end;
    suppose
A20:  k <> 0;
      then consider j being Nat such that
A21:  k = j + 1 by NAT_1:6;
A22:  k-1 = j by A21;
      0+1<=k by A20,NAT_1:13;
      then
A23:  k-'1 = j by A22,XREAL_1:233;
      set qNaj = (q |^ (a*j + r));
      set qNak = (q |^ (a*k + r));
      set qNak1= (q |^ (a*(k-'1)+r));
A24:  not qNa-'1 divides qNaj-'1 by A7,A21,XREAL_1:29;
      (qNa-'1) divides -(qNa-'1) by INT_2:10;
      then
A25:  (qNa-'1) divides (qNak-'1)+(-(qNa-'1)) by A6,WSIERP_1:4;
A26:  0 < qNak by A2,PREPOWER:6;
A27:  0 < qNa by A2,PREPOWER:6;
      0+1<=qNak by A26,NAT_1:13;
      then
A28:  (qNak-'1)=(qNak-1) by XREAL_1:233;
A29:  0+1<=qNa by A27,NAT_1:13;
      (qNak-1) - (qNa-1) = qNak-qNa;
      then (qNak-1) - (qNa-1) = qNa*qNak1-qNa*1 by A2,A20,Th2;
      then
A30:  (qNak-'1)-(qNa-'1) = qNa*(qNak1-1) by A28,A29,XREAL_1:233;
      0 < qNak1 by A2,PREPOWER:6;
      then 0+1<= qNak1 by NAT_1:13;
      then
A31:  (qNak-'1)-(qNa-'1)= qNa*(qNak1-'1) by A30,XREAL_1:233;
      0 < qNa by A2,PREPOWER:6;
      then 0+1 <= qNa by NAT_1:13;
      then qNa-'1+1 = qNa by XREAL_1:235;
      then qNa-'1,qNa are_coprime by PEPIN:1;
      hence thesis by A23,A24,A25,A31,INT_2:25;
    end;
  end;
  hence thesis;
end;
