
theorem Th44:
  for n being Element of NAT holds
  Product Sgm {p where p is prime Element of NAT: p <= n+1} <= 4 to_power n
proof
  defpred P[Nat] means Product Sgm{p where p is prime Element of NAT:p<=$1+1}
  <=(4 to_power $1);
  let n be Element of NAT;
A1: for m being Nat st (for n being Nat st n < m holds P[n]) holds P[m]
  proof
    let m be Nat;
    assume
A2: for n being Nat st n < m holds P[n];
    per cases by XXREAL_0:1;
    suppose
A3:   m<1;
A4:   now
        assume {p where p is prime Element of NAT:p<=0+1}<>{};
        then consider y being object such that
A5:     y in {p where p is prime Element of NAT:p<=1} by XBOOLE_0:def 1;
        ex y9 being prime Element of NAT st y9=y & y9<=1 by A5;
        hence contradiction by Lm1;
      end;
      m=0 by A3,NAT_1:14;
      hence thesis by A4,FINSEQ_3:43,POWER:24,RVSUM_1:94;
    end;
    suppose
A6:   m=1;
A7:   4 to_power 1=4 by POWER:25;
A8:   now
        let y be object;
        assume y in {p where p is prime Element of NAT:p<=2};
        then consider y9 being prime Element of NAT such that
A9:     y9=y & y9<=2;
        y9>1 by Lm1;
        then y9>=1+1 by NAT_1:13;
        hence y=2 by A9,XXREAL_0:1;
      end;
      for y being object st y = 2 holds y in {p where p is prime Element of
      NAT:p<=2} by INT_2:28;
      then
A10:  {p where p is prime Element of NAT:p<=2}={2} by A8,TARSKI:def 1;
      Product Sgm{2}=Product <*2*> by FINSEQ_3:44
        .=2;
      hence thesis by A6,A10,A7;
    end;
    suppose
A11:  m>1;
      per cases;
      suppose
        m+1 is odd;
        then consider k being Nat such that
A12:    m+1=2*k+1 by ABIAN:9;
A13:    (2*k+1) choose k<=2 to_power (2*k)
        proof
          defpred Q[Nat] means (2*$1+1) choose $1<=2 to_power (2*$1
          );
A14:      for k being Nat st Q[k] holds Q[k+1]
          proof
            let k be Nat;
            set r=2*k+1-k;
            set r9=2*k+3-(k+1);
            set r99=k+1;
A15:        2*((2 to_power (2*k))*2)= 2*((2 to_power (2*k))*(2 to_power
            1)) by POWER:25
              .= 2*(2 to_power (2*k+1)) by POWER:27
              .= (2 to_power 1)*(2 to_power (2*k+1)) by POWER:25
              .= (2 to_power (1+2*k+1)) by POWER:27;
A16:        k+1>=0;
            then reconsider r as Element of NAT;
A17:        2*k+1-k+k>=0+k by A16,XREAL_1:6;
            2*k+3<2*k+4 by XREAL_1:6;
            then (2*k+3)/(k+2)<(2*(k+2))/(k+2) by XREAL_1:74;
            then (2*k+3)/(k+2)<2*((k+2)/(k+2)) by XCMPLX_1:74;
            then
A18:        (2*k+3)/(k+2)<2*1 by XCMPLX_1:60;
            assume (2*k+1) choose k<=2 to_power (2*k);
            then ((2*k+1) choose k)*((2*k+3)/(k+2))<=(2 to_power (2*k))*2 by
A18,XREAL_1:66;
            then
A19:        2*(((2*k+1) choose k)*((2*k+3)/(k+2)))<=2*((2 to_power (2*k
            ))*2) by XREAL_1:64;
A20:        k+2>=0;
            then reconsider r9 as Element of NAT;
            (r99!)*(r9!) = (k!)*(k+1)*((r+1)!) by NEWTON:15
              .=(k!)*(k+1)*((r!)*(r+1)) by NEWTON:15
              .=(k!)*(r!)*(k+1)*(r+1);
            then
A21:        ((k!)*(r!))/((r99!)*(r9!)) =((k!)*(r!))/(((k!)*(r!))*((k+1)*
            (r+1)))
              .=((k!)*(r!))/((k!)*(r!))/((k+1)*(r+1)) by XCMPLX_1:78
              .= 1/((k+1)*(r+1)) by XCMPLX_1:60;
A22:        (2*k+1)! = (2*k+1)!/((k!)*(r!))*((k!)*(r!)) by XCMPLX_1:87
              .=((2*k+1) choose k)*((k!)*(r!)) by A17,NEWTON:def 3;
            2*k+3-r99+r99>=0+r99 by A20,XREAL_1:6;
            then
(2*(k+1)+1) choose (k+1) = (2*k+2+1)!/((r99!)*(r9!)) by NEWTON:def 3
              .= (((2*k+1+1)!)*(2*k+3))/((r99!)*(r9!)) by NEWTON:15
              .= (((2*k+1)!)*(2*k+2)*(2*k+3))/((r99!)*(r9!)) by NEWTON:15
              .= ((2*k+2)*(2*k+3))*((2*k+1)!)/((r99!)*(r9!))
              .= 2*(k+1)*(2*k+3)* ((((2*k+1) choose k)* ((k!)*(r!))/((r99!)*
            (r9!)))) by A22,XCMPLX_1:74
              .= 2*(k+1)*(2*k+3)*(((2*k+1) choose k)* ((((k!)*(r!))/((r99!)*
            (r9!))))) by XCMPLX_1:74
              .= 2*(k+1)*(2*k+3)*((2*k+1) choose k)*(1/((k+1)*(r+1))) by A21
              .= (2*((2*k+1) choose k))* ((k+1)*(2*k+3))/((k+1)*(r+1)) by
XCMPLX_1:99
              .= (2*((2*k+1) choose k))*(((k+1)*(2*k+3))/((k+1)*(r+1))) by
XCMPLX_1:74
              .= 2*((2*k+1) choose k)*(((k+1)/(k+1))*((2*k+3)/(r+1))) by
XCMPLX_1:76
              .= 2*((2*k+1) choose k)*(1*((2*k+3)/(r+1))) by XCMPLX_1:60
              .= 2*((2*k+1) choose k)*((2*k+3)/(k+2));
            hence thesis by A15,A19;
          end;
          (2*0+1) choose 0 = 1 by NEWTON:19;
          then
A23:      Q[0] by POWER:24;
          for k being Nat holds Q[k] from NAT_1:sch 2(A23,A14);
          hence thesis;
        end;
        set Y={p where p is prime Element of NAT:p>k+1 & p<=2*k+1};
        set SY = Sgm Y;
A24:    rng SY c= REAL;
        set X={p where p is prime Element of NAT:p<=k+1};
        set SX = Sgm X;
        rng SX c= REAL;
        then reconsider SX as FinSequence of REAL by FINSEQ_1:def 4;
        m/2=(k*2)/2 by A12;
        then
A25:    Product SX<=(4 to_power k) by A2,A11,XREAL_1:216;
        for y being object holds y in X implies y in Seg (k+1)
        proof
          let y be object;
          assume y in X;
          then
A26:      ex y9 being prime Element of NAT st y9=y & y9<=k+1;
          then reconsider y as prime Element of NAT;
          y>=1 by Lm1;
          hence thesis by A26,FINSEQ_1:1;
        end;
        then X c= Seg (k+1);
        then
a27:    X is included_in_Seg by FINSEQ_1:def 13;
        for k9 being Element of NAT st k9 in dom SX holds SX.k9 > 0
        proof
          let k9 be Element of NAT;
          assume
A28:      k9 in dom SX;
          rng SX = X by a27,FINSEQ_1:def 14;
          then SX.k9 in X by A28,FUNCT_1:3;
          then ex y9 being prime Element of NAT st y9=SX.k9 & y9<=k+1;
          hence thesis;
        end;
        then
A29:    0<=Product SX by Th41;
        reconsider SY as FinSequence of REAL by A24,FINSEQ_1:def 4;
A30:    for a,b being Nat st a in X & b in Y holds a < b
        proof
          let a,b be Nat;
          assume a in X;
          then
A31:      ex y9 being prime Element of NAT st y9=a & y9<=k+1;
          assume b in Y;
          then
          ex y99 being prime Element of NAT st y99=b & y99>k+1 & y99<=2*k +1;
          hence thesis by A31,XXREAL_0:2;
        end;
        for y being object holds y in Y implies y in Seg (2*k+1)
        proof
          let y be object;
          assume y in Y;
          then
A32:      ex y9 being prime Element of NAT st y9=y & y9>k+1 & y9<=2*k+1;
          then reconsider y as prime Element of NAT;
          y>=1 by Lm1;
          hence thesis by A32,FINSEQ_1:1;
        end;
        then Y c= Seg (2*k+1);
        then
a33:    Y is included_in_Seg by FINSEQ_1:def 13;
A34:    for k9 being Element of NAT st k9 in dom SY holds SY.k9 > 0
        proof
          let k9 be Element of NAT;
          assume
A35:      k9 in dom SY;
          rng SY = Y by a33,FINSEQ_1:def 14;
          then SY.k9 in Y by A35,FUNCT_1:3;
          then
          ex y9 being prime Element of NAT st y9=SY.k9 & y9>k+1 & y9<=2*k +1;
          hence thesis;
        end;
A36:    Product SY<=(2*k+1) choose k
        proof
          set r=2*k+1-k;
          set b=(2*k+1) choose k;
          reconsider SY as FinSequence of NAT;
          set a=Product SY;
A37:      k+1>=0;
          then reconsider r as Element of NAT;
A38:      2*k+1-k+k>=0+k by A37,XREAL_1:6;
          then
      b = (2*k+1)!/((k!)*(r!)) by NEWTON:def 3;
then A39:      b>0;
A40:      for p being Element of NAT st p is prime holds p |-count a <= p
          |-count b
          proof
            now
              let y be object;
              assume y in Y;
              then
              ex y9 being prime Element of NAT st y9=y & y9>k+1 & y9<=2*k +1;
              hence y in SetPrimes by NEWTON:def 6;
            end;
            then Y c= SetPrimes;
            then rng SY c= SetPrimes by a33,FINSEQ_1:def 14;
            then reconsider SY as FinSequence of SetPrimes by FINSEQ_1:def 4;
            let p be Element of NAT;
            assume
A41:        p is prime;
A42:        rng Sgm Y = Y by a33,FINSEQ_1:def 14;
A43:        p divides a implies p>k+1 & p<=2*k+1
            proof
              assume p divides a;
              then p in rng SY by A41,NAT_3:8;
              then
              ex y9 being prime Element of NAT st y9=p & y9>k+1 & y9<=2*k
              +1 by A42;
              hence thesis;
            end;
            per cases;
            suppose
A44:          p>k+1 & p<=2*k+1;
              set c = ((k!)*(r!));
A45:          b*c = ((2*k+1)!)/c*c by A38,NEWTON:def 3
                .= (2*k+1)! by XCMPLX_1:87;
A46:          p divides b
              proof
                assume not p divides b;
                then
A47:            p divides c by A41,A44,A45,NEWTON:41,80;
                per cases by A41,A47,NEWTON:80;
                suppose
A48:              p divides k!;
                  k+0<k+1 by XREAL_1:6;
                  then k<p by A44,XXREAL_0:2;
                  hence contradiction by A41,A48,Th19;
                end;
                suppose
                  p divides r!;
                  hence contradiction by A41,A44,Th19;
                end;
              end;
              p<>1 by A41,INT_2:def 4;
              then p |-count b <> 0 by A39,A46,NAT_3:27;
              then 0+1 < p |-count b +1 by XREAL_1:6;
              then
A49:          1 <= p |-count b by NAT_1:13;
              now
                let y be object;
                assume y in Y;
                then
                ex y9 being prime Element of NAT st y9=y & y9>k+1 & y9<=2 *k+1;
                hence y in SetPrimes by NEWTON:def 6;
              end;
              then
A50:          Y c= SetPrimes;
              p in rng SY by A41,A42,A44;
              hence thesis by a33,A41,A50,A49,Th43;
            end;
            suppose
              not(p>k+1 & p<=2*k+1);
              then
A51:          not p |^ (0+1) divides a by A43;
              1 divides a by NAT_D:6;
              then
A52:          p |^ 0 divides a by NEWTON:4;
              p<>1 & a<>0 by A34,A41,Th41,INT_2:def 4;
              hence thesis by A52,A51,NAT_3:def 7;
            end;
          end;
          a is non zero Nat by A34,Th41;
          then ex n being Element of NAT st b=a*n by A39,A40,Th20;
          then a divides b by NAT_D:def 3;
          hence thesis by A39,NAT_D:7;
        end;
        for y being object holds y in {p where p is prime Element of NAT:p<=
        2*k+1} iff y in X \/ Y
        proof
          let y be object;
A53:      now
            assume
A54:        y in X \/ Y;
            per cases by A54,XBOOLE_0:def 3;
            suppose
              y in X;
              then consider y9 being prime Element of NAT such that
A55:          y9=y and
A56:          y9<=k+1;
              1*k<=2*k by XREAL_1:68;
              then k+1<=2*k+1 by XREAL_1:6;
              then y9<=2*k+1 by A56,XXREAL_0:2;
              hence y in {p where p is prime Element of NAT:p<=2*k+1} by A55;
            end;
            suppose
              y in Y;
              then
              ex y9 being prime Element of NAT st y9=y & y9>k+1 & y9<=2*k +1;
              hence y in {p where p is prime Element of NAT:p<=2*k+1};
            end;
          end;
          now
            assume y in {p where p is prime Element of NAT:p<=2*k+1};
            then consider y9 being prime Element of NAT such that
A57:        y9=y & y9<=2*k+1;
            y in X or y in Y
            proof
              per cases by A57;
              suppose
                y9=y & y9<=k+1;
                hence thesis;
              end;
              suppose
                y9=y & y9>k+1 & y9<=2*k+1;
                hence thesis;
              end;
            end;
            hence y in X \/ Y by XBOOLE_0:def 3;
          end;
          hence thesis by A53;
        end;
        then
A58:    {p where p is prime Element of NAT: p<=2*k+1}=X \/ Y by TARSKI:2;
        2 to_power (2*k)=2 to_power (k+k)
          .=(2 to_power k)*(2 to_power k) by POWER:27
          .=(2*2) to_power k by POWER:30;
        then
A59:    Product SY<=(4 to_power k) by A36,A13,XXREAL_0:2;
        0<Product SY by A34,Th41;
        then Product (SX^SY) = (Product SX)*(Product SY) & (Product SX)*(
        Product SY)<=(4 to_power k)*(4 to_power k) by A25,A59,A29,RVSUM_1:97
,XREAL_1:66;
        then Product (SX^SY)<=4 to_power (k+k) by POWER:27;
        hence thesis by A12,a27,a33,A58,A30,FINSEQ_3:42;
      end;
      suppose
A60:    m+1 is even;
        set k=m-1;
        m-1>1-1 by A11,XREAL_1:9;
        then reconsider k as Element of NAT by INT_1:3;
        for y being object holds y in {p where p is prime Element of NAT:p
        <=m+1 } iff y in {p where p is prime Element of NAT:p<=m}
        proof
          let y be object;
A61:      now
            assume y in {p where p is prime Element of NAT:p<=m+1};
            then consider y9 being prime Element of NAT such that
A62:        y=y9 and
A63:        y9<=m+1;
            m+1>1+1 by A11,XREAL_1:6;
            then not m+1 is Prime by A60,PEPIN:17;
            then y9<m+1 by A63,XXREAL_0:1;
            then y9<=m by NAT_1:13;
            hence y in {p where p is prime Element of NAT:p<=m} by A62;
          end;
          now
            assume y in {p where p is prime Element of NAT:p<=m};
            then consider y9 being prime Element of NAT such that
A64:        y=y9 and
A65:        y9<=m;
            0+m<=1+m by XREAL_1:6;
            then y9<=m+1 by A65,XXREAL_0:2;
            hence y in {p where p is prime Element of NAT:p<=m+1} by A64;
          end;
          hence thesis by A61;
        end;
        then
A66:    {p where p is prime Element of NAT:p<=m+1}= {p where p is prime
        Element of NAT:p<=m} by TARSKI:2;
        k+1=m;
        then k<m by NAT_1:13;
        then Product Sgm {p where p is prime Element of NAT:p<=k+1}<= 4
        to_power k & 4 to_power k <= 4 to_power m by A2,POWER:39;
        hence thesis by A66,XXREAL_0:2;
      end;
    end;
  end;
  for n being Nat holds P[n] from NAT_1:sch 4(A1);
  hence thesis;
end;
