reserve i,j,n,n1,n2,m,k,l,u for Nat,
        r,r1,r2 for Real,
        x,y for Integer,
        a,b for non trivial Nat,
        F for XFinSequence,
        cF,cF1,cF2 for complex-valued XFinSequence,
        c,c1,c2 for Complex;
reserve x,y,x1,u,w for Nat;

theorem Th20:
  for x,y,x1 being Nat st x1 >= 1 holds
    y = Product (1+(x1 * idseq x)) iff
      ex u,w,y1,y2,y3,y4,y5 being Nat st
        u > y &
        x1*w, 1 are_congruent_mod u &
        y1 = x1|^x &
        y2 = x! &
        y3 = (w+x) choose x &
        y1*y2*y3, y are_congruent_mod u &
        y4 = 1+x1*x &
        y5 = y4|^x &
        u > y5
proof
  let x,y,x1 be Nat;
  assume
A1:  x1>=1;
  defpred P[Nat] means (1+x1*$1)|^$1 >= Product (1+(x1 * idseq $1));
A2: P[0] by RVSUM_1:94;
A3: P[n] implies P[n+1]
  proof
    assume
A4:   P[n];
    set n1=n+1;
A5: (1+x1*<*n1*>) = 1+<*x1*n1*> by RVSUM_1:47
      .= <*1+x1*n1*> by BASEL_1:2;
    idseq n1 = (idseq n)^<*n+1*> by FINSEQ_2:51;
    then x1*(idseq n1) = (x1*(idseq n))^(x1*<*n+1*>) by NEWTON04:43;
    then 1+ x1*(idseq n1) = (1+x1*(idseq n))^(1+x1*<*n+1*>) by BASEL_1:3;
    then
A6:   Product (1+(x1*(idseq n1)))= Product (1+(x1*(idseq n))) * (1+x1*n1)
      by A5,RVSUM_1:96;
    x1*n <= x1*n1 by NAT_1:11,XREAL_1:64;
    then (1+x1*n) <= (1+x1*n1) by XREAL_1:7;
    then (1+x1*n)|^n <= (1+x1*n1)|^n by PREPOWER:9;
    then (1+x1*n)|^n * (1+x1*n1) <= (1+x1*n1)|^n * (1+x1*n1) by XREAL_1:64;
    then
A7:   (1+x1*n)|^n * (1+x1*n1) <= (1+x1*n1)|^n1 by NEWTON:6;
    Product (1+(x1*(idseq n))) * (1+x1*n1) <= (1+x1*n)|^n * (1+x1*n1)
      by A4,XREAL_1:64;
    hence thesis by A7,A6,XXREAL_0:2;
  end;
A8:P[n] from NAT_1:sch 2(A2,A3);
  thus y = Product (1+(x1 * idseq x)) implies
    ex u,w,y1,y2,y3,y4,y5 be Nat st u > y & x1*w,1 are_congruent_mod u &
    y1 = x1|^x & y2= x! & y3 = (w+x) choose x &
    y1*y2*y3,y are_congruent_mod u & y4=1+x1*x & y5 = y4|^x & u > y5
  proof
    assume
A9:   y = Product (1+(x1 * idseq x));
    set u = x1 *(1+x1*x)|^x +1;
    u gcd x1 = 1 gcd x1 by EULER_1:16
      .= 1 by WSIERP_1:8;
    then consider w be Nat such that
A10:  (x1*w - 1) mod u = 0 by INT_4:16,INT_2:def 3;
    take u,w, y1 = x1|^x, y2= x!, y3 = (w+x) choose x, y4 = 1+x1*x,
         y5 = y4|^x;
A11:  x1*w - 1 = ((x1*w - 1) div u) * u +0 by A10,INT_1:59;
    then y, x1|^x * (x!) * ((w+x) choose x) are_congruent_mod u
      by A9,Th19,INT_1:def 5;
    then consider e be Integer such that
A12:  x1|^x * (x!) * ((w+x) choose x)-y = u*e by INT_1:def 5,14;
    (1+x1*x)|^x >= Product (1+(x1 * idseq x)) by A8;
    then x1* (1+x1*x)|^x >= 1* Product (1+(x1 * idseq x)) by A1,XREAL_1:66;
    hence u > y by A9,NAT_1:13;
    thus x1*w,1 are_congruent_mod u by A11,INT_1:def 5;
A13:  x1 *(1+x1*x)|^x+1> x1 *(1+x1*x)|^x+0 by XREAL_1:6;
      x1 *(1+x1*x)|^x  >= 1*(1+x1*x)|^x by A1,XREAL_1:66;
    hence thesis by A12,INT_1:def 5,A13,XXREAL_0:2;
  end;
  given u,w,y1,y2,y3,y4,y5 be Nat such that
A14:  u > y & x1*w,1 are_congruent_mod u and
A15:  y1 = x1|^x & y2= x! & y3 = (w+x) choose x and
A16:  y1*y2*y3,y are_congruent_mod u and
A17:  y4=1+x1*x & y5 = y4|^x & u > y5;
  set U = x1|^x * (x!) * ((w+x) choose x);
  Product (1+(x1 * idseq x)),U are_congruent_mod u by A14,Th19;
  then
A18: U,Product (1+(x1 * idseq x)) are_congruent_mod u by INT_1:14;
A19: Product (1+(x1 * idseq x)) is Nat by TARSKI:1;
  Product (1+(x1 * idseq x)) <=(1+x1*x)|^x by A8;
  then Product (1+(x1 * idseq x)) < u by A17,XXREAL_0:2;
  hence thesis by A19,A18,A15,A16,A14,NAT_6:14;
end;
