reserve A for non trivial Nat,
        B,C,n,m,k for Nat,
        e for Nat;
reserve a for non trivial Nat;

theorem Th20:
 for A be non trivial Nat, C be Nat, B,L be positive Nat holds
   C = Py(A,B) iff
     ex i,j be positive Nat, D,E,F,G,H,I be Integer st
       D*F*I is square & F divides (H - C) & B <= C &

  D = (A^2-1)*C^2+1 & E = 2*i*C^2*L*D & F = (A^2 -1) *E^2+1 &
  G = A+F*(F-A) & H = B+2*(j-1)*C & I = (G^2-1)*H^2+1
proof
  let A be non trivial Nat, C be Nat, B,L be positive Nat;
  reconsider L1=L-1 as Nat;
  thus C = Py(A,B) implies
    ex i,j be positive Nat, D,E,F,G,H,I be Integer st
      D*F*I is square & F divides (H - C) & B <= C &
    D = (A^2-1)*C^2+1 & E = 2*i*C^2*L*D & F = (A^2 -1) *E^2+1 &
    G = A+F*(F-A) & H = B+2*(j-1)*C & I = (G^2-1)*H^2+1
  proof
    assume C = Py(A,B);
    then consider i,j be Nat, D,E,F,G,H,I be Nat such that
A1: D*F*I is square & F divides (H - C) & B <= C &
    D= (A^2-1)*C^2+1 & E= 2*(i+1)*D*(L1+1)*C^2 & F= (A^2 -1) *E^2+1 &
    G = A+F*(F-A) & H = B+2*j*C & I = (G^2-1)*H^2+1 by Th17;
    take i+1,j+1,D,E,F,G,H,I;
    thus thesis by A1;
  end;
  given i,j be positive Nat, D,E,F,G,H,I be Integer such that
A2:D*F*I is square & F divides (H - C) & B <= C & D= (A^2-1)*C^2+1 and
A3: E= 2*i*C^2*L*D and
A4: F= (A^2 -1) *E^2+1 & G = A+F*(F-A) and
A5: H = B+2*(j-1)*C and
A6: I = (G^2-1)*H^2+1;
  reconsider ii=i-1,jj=j-1 as Nat;
  E= 2*(ii+1)*D*(L1+1)*C^2 & H = B+2*(jj)*C by A3,A5;
  hence thesis by A2,A4,A6,Th18;
end;
