reserve Omega for non empty set,
        Sigma for SigmaField of Omega,
        Prob for Probability of Sigma,
        A for SetSequence of Sigma,
        n,n1,n2 for Nat;

theorem Th16:
(Partial_Sums(Prob*A) is convergent
 implies Prob.lim_sup A = 0 & Prob.lim_inf Complement A = 1) &
(A is_all_independent_wrt Prob &
 Partial_Sums(Prob*A) is divergent_to+infty implies
   Prob.lim_inf Complement A = 0 & Prob.lim_sup A = 1)
proof
     A1: Partial_Sums(Prob*A) is convergent
     implies Prob.lim_inf Complement A = 1
     proof
      assume A2: Partial_Sums(Prob*A) is convergent;
      A3: Prob.lim_inf Complement A = Prob.@lim_inf Complement A by Lemma;
      for A being SetSequence of Sigma holds
           Partial_Sums(Prob*A) is convergent
           implies (Prob.@lim_inf Complement A = 1
                   & lim(Sum_Shift_Seq(Prob,A))=0 &
                  Sum_Shift_Seq(Prob,A) is convergent)
      proof
       let A be SetSequence of Sigma;
       assume A4: Partial_Sums(Prob*A) is convergent;
       (Prob.@lim_sup A + Prob.(@lim_inf Complement A) =
        0 + Prob.(@lim_inf Complement A) &
       lim(Sum_Shift_Seq(Prob,A))=0 &
       Sum_Shift_Seq(Prob,A) is convergent) by A4,Th13;
      hence thesis by Th15;
      end;
      hence thesis by A2,A3;
     end;
     A5: for A being SetSequence of Sigma st
      Partial_Sums(Prob*A) is convergent holds Prob.lim_sup A = 0
     proof
      let A be SetSequence of Sigma;
      assume A6: Partial_Sums(Prob*A) is convergent;
      Prob.lim_sup A = Prob.@lim_sup A;
      hence thesis by A6,Th13;
     end;
     for B being SetSequence of Sigma st
         B is_all_independent_wrt Prob &
         Partial_Sums(Prob*B) is divergent_to+infty
         holds Prob.lim_inf Complement B = 0 & Prob.lim_sup B = 1
     proof
      let B be SetSequence of Sigma;
      assume that A7: B is_all_independent_wrt Prob
              and A8: Partial_Sums(Prob*B) is divergent_to+infty;
      A9: Prob.@lim_sup B = Prob.lim_sup B;
      A10: Prob.@lim_inf Complement B = Prob.lim_inf Complement B by Lemma;
      for B being SetSequence of Sigma st
      B is_all_independent_wrt Prob &
      Partial_Sums(Prob*B) is divergent_to+infty
      holds Prob.@lim_inf Complement B = 0 & Prob.@lim_sup B = 1
      proof
       let B be SetSequence of Sigma;
       assume that
       A11: B is_all_independent_wrt Prob and
       A12: Partial_Sums(Prob*B) is divergent_to+infty;
      reconsider CB = Complement B as SetSequence of Sigma;
      A15: Prob.(@lim_inf CB)=
            lim (Prob*(inferior_setsequence (Complement B))) by PROB_2:10;
      A16: for n being Nat holds
           (Prob*(inferior_setsequence (Complement B))).n = 0
           proof
            let n be Nat;
            dom(Prob*(inferior_setsequence (Complement B) )) = NAT
             by FUNCT_2:def 1; then
            A18: (Prob*(inferior_setsequence (Complement B) )).n =
             Prob.( (inferior_setsequence (Complement B)).n )
             by FUNCT_1:12,ORDINAL1:def 12;
            (inferior_setsequence (Complement B)).n =
              Intersection ((Complement B)^\n) by Def9; then
            A19: (Prob*(inferior_setsequence (Complement B) )).n =
            Prob.(Intersection Partial_Intersection
                  ((Complement B)^\n) ) by A18,PROB_3:29;
      Partial_Intersection ((Complement B)^\n) is non-ascending
       by PROB_3:27; then
      A20: (Prob*(inferior_setsequence (Complement B) )).n =
             lim (Prob*(Partial_Intersection ((Complement B)^\n)))
               by A19,PROB_1:def 8;
      A21: for k being Nat holds
        (Prob*(Partial_Intersection (Complement (B^\n)))).k <=
        ((1+(Partial_Sums(Prob*(B^\n))))").k
       proof
        let k be Nat;
        A22: for k being Nat holds (B^\k) is_all_independent_wrt Prob
        proof
         let k be Nat;
          for C being SetSequence of Sigma st
             (ex e being sequence of NAT st
              (e is one-to-one &
               (for n being Nat holds
                  ((B^\k)).(e.n) = C.n))) holds
              (for n being Nat holds (Partial_Product(Prob*C)).n=
               Prob.((Partial_Intersection C).n) )
          proof
           let C be SetSequence of Sigma;
           given e being sequence of NAT such that
           A23: e is one-to-one and
           A24: for n being Nat holds ((B^\k)).(e.n) = C.n;
           A25: (B^\k)=(B*Special_Function2(k))
           proof
            for n being object st n in NAT holds
             ((B^\k)).n=(B*Special_Function2(k)).n
            proof
             let n be object;
             assume n in NAT;
             then reconsider n as Element of NAT;
             dom(B*Special_Function2(k))=NAT by FUNCT_2:def 1; then
             A26: (B*Special_Function2(k)).n =
                   B.((Special_Function2(k)).n) by FUNCT_1:12;
             (Special_Function2(k)).n = n+k by Def3;
             hence thesis by A26,NAT_1:def 3;
            end;
            hence thesis;
           end;
          A27:for n being Nat holds
           (B*Special_Function2(k)).(e.n) = B.( (Special_Function2(k)*e).n )
          proof
           let n be Nat;
         reconsider n as Element of NAT by ORDINAL1:def 12;
           dom(B*Special_Function2(k))=NAT &
           dom(Special_Function2(k)*e)=NAT by FUNCT_2:def 1; then
           (B*Special_Function2(k)).(e.n) =
            B.((Special_Function2(k)).(e.n)) &
            (Special_Function2(k)*e).n = (Special_Function2(k)).(e.n)
             by FUNCT_1:12;
           hence thesis;
          end;
          A28: for n being Nat holds
           B.( ( (Special_Function2(k)*e) ).n ) = C.n
          proof
           let n be Nat;
           (B*Special_Function2(k)).(e.n) = C.n by A25,A24;
           hence thesis by A27;
          end;
          (Special_Function2(k))*e is one-to-one by A23,FUNCT_1:24;
          hence thesis by A11,A28;
          end;
          hence thesis by Def6;
         end;
          A29: for A being SetSequence of Sigma holds
                for n being Nat holds
                Partial_Product(Prob*(Complement A)).n <=
                ((1+(Partial_Sums(Prob*A))).n)"
          proof
          let A be SetSequence of Sigma;
          let n be Nat;
            reconsider n as Element of NAT by ORDINAL1:def 12;
          A30: Partial_Product(Prob*(Complement A)).n <=
                1/(1+Partial_Sums(Prob*A).n)
          proof
           Partial_Product(Prob*(Complement A)).n <=
             Partial_Product(JSum(Prob*A)).n by Th4; then
           A31: Partial_Product(Prob*(Complement A)).n <=
           exp_R.(-Partial_Sums(Prob*A).n) by Th3;
           exp_R.(-Partial_Sums(Prob*A).n) <= 1/(1+Partial_Sums(Prob*A).n)
           proof
            A32: for n being Nat holds (Prob*A).n >=0
           proof
             let n be Nat;
              reconsider n as Element of NAT by ORDINAL1:def 12;
              dom(Prob*A)=NAT by FUNCT_2:def 1; then
             (Prob*A).n=Prob.(A.n) by FUNCT_1:12;
             hence thesis by PROB_1:def 8;
           end;
            A33: for n being Nat holds Partial_Sums(Prob*A).n >=0
           proof
             let n be Nat;
             defpred J[Nat] means Partial_Sums(Prob*A).$1 >= 0;
             Partial_Sums(Prob*A).0 = (Prob*A).0 by SERIES_1:def 1; then
             A34: J[0] by A32;
             A35: for k being Nat st J[k] holds J[k+1]
             proof
              let k be Nat;
              assume A36: J[k];
              A37: (Prob*A).(k+1)>=0 by A32;
              Partial_Sums(Prob*A).(k+1) = Partial_Sums(Prob*A).k
               +(Prob*A).(k+1) by SERIES_1:def 1;
              hence thesis by A36,A37;
             end;
             for k being Nat holds J[k] from NAT_1:sch 2(A34,A35);
            hence thesis;
           end;
           for x being Element of REAL st x>=0 holds exp_R.(-x) <= 1/(1+x)
           proof
              let x be Element of REAL;
              assume A38: x>=0;
              per cases;
            suppose A39: x>0;
              A40: exp_R.(-x) >= 0 by SIN_COS:54;
               set z=-x;
               A41: exp_R(x)*exp_R(z) = exp_R(x+z) by SIN_COS:50;
              exp_R.(-x)*(1+x) <= 1 by Th2,A40,A41,SIN_COS:51,XREAL_1:64;
            hence thesis by A39,XREAL_1:77;
            end;
            suppose x<=0;
              then x=0 by A38;
              hence thesis by SIN_COS:51;
            end;
           end;
           hence thesis by A33;
           end;
           hence thesis by A31,XXREAL_0:2;
          end;
          for A being SetSequence of Sigma holds
               for n being Nat holds
              1/(1+Partial_Sums(Prob*A).n) = ((1+(Partial_Sums(Prob*A))).n)"
          proof
           let A be SetSequence of Sigma;
           let n be Nat;
           n in NAT by ORDINAL1:def 12; then
           1/(1+Partial_Sums(Prob*A).n) = 1/((1+(Partial_Sums(Prob*A))).n)
           by VALUED_1:2; then
           1/(1+Partial_Sums(Prob*A).n) = 1*((1+(Partial_Sums(Prob*A))).n)"
            by XCMPLX_0:def 9;
           hence thesis;
          end;
          hence thesis by A30;
          end;
          reconsider k as Element of NAT by ORDINAL1:def 12;
          dom(Prob*(Partial_Intersection (Complement (B^\n))))
                 =NAT by FUNCT_2:def 1; then
          (Prob*(Partial_Intersection (Complement (B^\n)))).k =
           Prob.((Partial_Intersection (Complement (B^\n))).k)
            by FUNCT_1:12; then
          (Prob*(Partial_Intersection (Complement (B^\n)))).k =
           Partial_Product(Prob*Complement (B^\n)).k by A22,Th10; then
          (Prob*(Partial_Intersection (Complement (B^\n)))).k <=
            ((1+(Partial_Sums(Prob*(B^\n)))).k)" by A29;
         hence thesis by VALUED_1:10;
         end;
 A42: Partial_Sums(Prob*(B^\n)) is divergent_to+infty
 proof
   per cases;
   suppose n=0;
     hence thesis by A12,NAT_1:47; end;
   suppose n<>0; then
     reconsider y=n-1 as Element of NAT by NAT_1:20;
     set B2 = NAT --> -(Partial_Sums(Prob*B)).y;
      A44: Partial_Sums(Prob*B) + B2 is divergent_to+infty
           by A12,LIMFUNC1:18;
       for r being Real ex q being Nat st
        for m being Nat st q<=m holds r<(Partial_Sums(Prob*(B^\n))).m
       proof
        let r be Real;
       for r being Real ex q being Nat st
        for m being Nat st q<=m holds
        r<(Partial_Sums(Prob*(B^\n))).m
       proof
        let r be Real;
         A45: for m being Nat st n<=m holds
          (Partial_Sums(Prob*B) + B2).m = (Partial_Sums(Prob*(B^\n))).(m-n)
         proof
          let m be Nat;
          assume n<=m; then
          consider knat being Nat such that A46: m=n+knat by NAT_1:10;
          reconsider knat as Nat;
          defpred J[Nat] means
          (Partial_Sums(Prob*B) + B2).(n+$1) =
          (Partial_Sums(Prob*(B^\n))).((n+$1)-n);
          A47: J[0]
          proof
           dom((Partial_Sums(Prob*B) + B2))=NAT by FUNCT_2:def 1; then
           (Partial_Sums(Prob*B) + B2).n =
             (Partial_Sums(Prob*B)).n + B2.n
               by VALUED_1:def 1,ORDINAL1:def 12; then
           (Partial_Sums(Prob*B) + B2).n =
            (Partial_Sums(Prob*B)).n + (-(Partial_Sums(Prob*B)).(n-1))
             by FUNCOP_1:7,ORDINAL1:def 12; then
           (Partial_Sums(Prob*B) + B2).n =
            (Partial_Sums(Prob*B)).n -(Partial_Sums(Prob*B)).(n-1); then
           A49: (Partial_Sums(Prob*B) + B2).n =
            ( (Partial_Sums(Prob*B)).(n-1) + (Prob*B).((n-1)+1) )
              -(Partial_Sums(Prob*B)).(n-1) by SERIES_1:def 1;
           dom(Prob*(B^\n))=NAT by FUNCT_2:def 1; then
           A50: (Prob*(B^\n)).0 = Prob.( ((B^\n)).0 ) by FUNCT_1:12;
           A51: ((B^\n)).0 = B.(0+n) by NAT_1:def 3;
           dom(Prob*B)=NAT by FUNCT_2:def 1; then
           (Partial_Sums(Prob*B) + B2).n = (Prob*(B^\n)).0
             by A51,A50,A49,FUNCT_1:12,ORDINAL1:def 12;
           hence thesis by SERIES_1:def 1;
         end;
          A52: for k being Nat st J[k] holds J[k+1]
          proof
           let k be Nat;
           assume A54: J[k];
           A55: dom((Partial_Sums(Prob*B) + B2))=NAT by FUNCT_2:def 1;
           (Partial_Sums(Prob*B) + B2).(n+k+1) =
            (Partial_Sums(Prob*B)).((n+k)+1) + B2.((n+k)+1)
             by A55,VALUED_1:def 1; then
           (Partial_Sums(Prob*B) + B2).(n+k+1) =
           ( (Partial_Sums(Prob*B)).(n+k) + (Prob*B).((n+k)+1) )
                + B2.((n+k)+1) by SERIES_1:def 1; then
           (Partial_Sums(Prob*B) + B2).(n+k+1) =
            (Partial_Sums(Prob*B)).(n+k) + (Prob*B).((n+k)+1)
             + B2.(n+k) by FUNCOP_1:7,ORDINAL1:def 12; then
           (Partial_Sums(Prob*B) + B2).(n+k+1) =
           ( (Partial_Sums(Prob*B)).(n+k) + B2.(n+k) )
             + (Prob*B).((n+k)+1); then
           A56: (Partial_Sums(Prob*B) + B2).(n+k+1) =
            (Partial_Sums(Prob*(B^\n))).((n+k)-n)
             + (Prob*B).((n+k)+1) by A55,A54,VALUED_1:def 1,ORDINAL1:def 12;
           (Prob*(B^\n)).((n+k-n)+1) = (Prob*B).((n+k)+1)
           proof
            dom(Prob*(B^\n))=NAT by FUNCT_2:def 1; then
            A57: (Prob*(B^\n)).((n+k-n)+1) =
            Prob.(((B^\n)).(k+1)) by FUNCT_1:12;
            A58: ((B^\n)).(k+1) = B.(n+(k+1)) by NAT_1:def 3;
            dom(Prob*B)=NAT by FUNCT_2:def 1;
           hence thesis by A58,A57,FUNCT_1:12;
           end;
           hence thesis by A56,SERIES_1:def 1;
          end;
          for k being Nat holds J[k] from NAT_1:sch 2(A47,A52);
          hence thesis by A46;
         end;
        A59: ex q being Nat st
              for m being Nat st (q+n)<=(m+n) holds
               r<(Partial_Sums(Prob*B) + B2).(m+n)
        proof
         consider q being Nat such that
          A60: for m being Nat st q<=m holds
                r<(Partial_Sums(Prob*B) + B2).m by A44,LIMFUNC1:def 4;
          take q;
           let m be Nat;
           assume q+n<=m+n; then
           q<=(q+n) & (q+n)<=(m+n) by NAT_1:11; then
           q<=(m+n) by XXREAL_0:2;
           hence thesis by A60;
         end;
          consider q being Nat such that
           A61: for m being Nat st (q+n)<=(m+n) holds
                 r<(Partial_Sums(Prob*B) + B2).(m+n) by A59;
           take s=q+n;
           let m be Nat;
           assume A62: s<=m;
           set z=m+n;
           (Partial_Sums(Prob*B) + B2).z =
           (Partial_Sums(Prob*(B^\n))).(z-n) by A45,NAT_1:12;
           hence thesis by A62,A61,NAT_1:12;
        end;
        hence thesis;
         end;
        hence thesis by LIMFUNC1:def 4;
       end;
     end;
       A63: for A being SetSequence of Sigma holds
             Partial_Sums(Prob*A) is divergent_to+infty
             implies lim( (1+(Partial_Sums(Prob*A)))") = 0 &
                     (1+(Partial_Sums(Prob*A)))" is convergent
       proof
       let A be SetSequence of Sigma;
       A64: for A being SetSequence of Sigma holds
           (for r being Real ex n being Nat st
            for m being Nat st n <= m holds
             r < (Partial_Sums(Prob*A)).m) implies
           (for r being Real ex n being Nat st
             for m being Nat st n <= m holds
              r < (1+(Partial_Sums(Prob*A))).m )
       proof
        let A be SetSequence of Sigma;
        assume A65: (for r being Real ex n being Nat st
        for m being Nat st n <= m holds r < (Partial_Sums(Prob*A)).m);
        let r be Real;
        consider n being Nat such that
        A66: for m being Nat st n <= m holds
        r < (Partial_Sums(Prob*A)).m by A65;
        take n;
        for m being Nat st n<=m holds r < (1+(Partial_Sums(Prob*A))).m
        proof
         let m be Nat;
A67:     m in NAT by ORDINAL1:def 12;
         assume n<=m; then
         A68: r < (Partial_Sums(Prob*A)).m by A66;
         A69: (Partial_Sums(Prob*A)).m <
               ((Partial_Sums(Prob*A)).m+1) by XREAL_1:29;
         (1+(Partial_Sums(Prob*A))).m = (Partial_Sums(Prob*A)).m + 1
           by VALUED_1:2,A67;
         hence thesis by A68,A69,XXREAL_0:2;
        end;
        hence thesis;
       end;
       assume Partial_Sums(Prob*A) is divergent_to+infty; then
       for r being Real ex n being Nat st
        for m being Nat st n <= m holds
        r < (Partial_Sums(Prob*A)).m by LIMFUNC1:def 4; then
       for r being Real ex n being Nat st
        for m being Nat st n <= m holds
        r < (1+(Partial_Sums(Prob*A))).m by A64; then
        1+(Partial_Sums(Prob*A)) is divergent_to+infty by LIMFUNC1:def 4;
       hence thesis by LIMFUNC1:34;
       end;
       (Partial_Intersection (Complement (B^\n)))
        is non-ascending by PROB_3:27; then
       A70: (Prob*(Partial_Intersection (Complement (B^\n))))
             is convergent &
        (1+(Partial_Sums(Prob*(B^\n))))" is convergent
         by A42,A63,PROB_1:def 8;
       A71: lim( (1+(Partial_Sums(Prob*(B^\n))))" ) = 0 by A42,A63;
       A72: for k being Nat holds
        0<=(Prob*(Partial_Intersection (Complement (B^\n)))).k
       proof
        let k be Nat;
        dom(Prob*(Partial_Intersection (Complement (B^\n)))) = NAT
         by FUNCT_2:def 1; then
        (Prob*(Partial_Intersection (Complement (B^\n)))).k =
         Prob.( (Partial_Intersection (Complement (B^\n))).k)
           by FUNCT_1:12,ORDINAL1:def 12;
        hence thesis by PROB_1:def 8;
       end;
       A74: lim (Prob*(Partial_Intersection (Complement (B^\n))))
            <= 0 by A70,A21,A71,SEQ_2:18;
       Complement (B^\n) = ((Complement B)^\n)
       proof
        for k being object st k in NAT holds
              (Complement (B^\n)).k = (((Complement B)^\n)).k
        proof
         let k be object;
         assume k in NAT;
         then reconsider k as Nat;
         A75: (Complement (B^\n)).k = ( ( B^\n ).k )` by PROB_1:def 2;
         (((Complement B)^\n)).k = (Complement B).(k+n) by NAT_1:def 3; then
         (((Complement B)^\n)).k = (B.(k+n))` by PROB_1:def 2;
         hence thesis by A75,NAT_1:def 3;
        end;
        hence thesis;
       end;
      hence thesis by A72,A70,A74,A20,SEQ_2:17;
    end;
    set B2 = seq_const 0;
       ex n being Nat st B2.n=0
       proof
        take 1;
        thus thesis;
       end; then
       A77: lim B2 = 0 by SEQ_4:25;
      A78: B2 is convergent & ex k being Nat
                               st for n being Nat st k<=n
            holds B2.n = (Prob*(inferior_setsequence (Complement B) )).n
      proof
       ex k being Nat st for n being Nat st k<=n
            holds B2.n = (Prob*(inferior_setsequence (Complement B) )).n
        proof
          take 0;
          thus thesis by A16;
        end;
       hence thesis;
      end;
      Prob.(@lim_inf Complement B)=0 &
       Prob.(@lim_inf Complement B) + Prob.(@lim_sup B) = 1
       by A15,A78,A77,Th15,SEQ_4:19;
      hence thesis;
      end;
      hence thesis by A9,A10,A7,A8;
     end;
 hence thesis by A5,A1;
end;
