reserve d,i,j,k,m,n,p,q,x,k1,k2 for Nat,
  a,c,i1,i2,i3,i5 for Integer;

theorem Th10:
  (a*p + 1) mod p = 1 mod p
proof
  per cases;
  suppose
A1: p <> 0;
    reconsider p as Integer;
    (a*p + 1) mod p = (a*p + 1) - ((a*p + 1) div p)*p by A1,INT_1:def 10
      .= (a*p + 1) - ([\(a*p/p)+(1/p)/])*p
      .= (a*p + 1) - ([\(a)+(1/p)/])*p by A1,XCMPLX_1:89
      .= (a*p + 1) - (a+[\(1/p)/])*p by INT_1:28
      .= 1 - (1 div p)*p;
    hence thesis by A1,INT_1:def 10;
  end;
  suppose
    p = 0;
    hence thesis;
  end;
end;
