reserve i,j,n,n1,n2,m,k,u for Nat,
        r,r1,r2 for Real,
        x,y for Integer,
        a,b for non trivial Nat;

theorem Th2:
  for f be complex-valued FinSequence
    ex e,o be complex-valued FinSequence st
      len e = [\len f/2/] & len o = [/len f/2 \] &
      Sum f = Sum e + Sum o &
      for n holds e.n = f.(2*n) & o.n = f.(2*n-1)
proof
  defpred P[Nat] means
  for f be complex-valued FinSequence st len f=$1
    ex e,o be complex-valued FinSequence st
      len e = [\len f/2/] & len o = [/len f/2 \] &
      Sum f = Sum e + Sum o &
      for n holds e.n = f.(2*n) & o.n = f.(2*n-1);
A1:P[0]
  proof
    let f be complex-valued FinSequence such that
A2:   len f=0;
    take f,f;
    thus len f = [\len f/2/] & len f = [/len f/2 \] by A2;
    f=<*>REAL by A2;
    hence Sum f=Sum f+Sum f by RVSUM_1:72;
    let n;
    f={} by A2;
    then f.n = 0=f.(2*n) & f.n = 0 = f.(2*n-1);
    hence thesis;
  end;
A3: P[n] implies P[n+1]
  proof
    assume
A4:   P[n];set n1=n+1;
    let f be complex-valued FinSequence such that
A5:   len f=n1;
    set fn=f|n;
A6:   f = fn^<*f.n1*> by A5,FINSEQ_3:55;
    n < n1 by NAT_1:13;
    then len fn = n by A5,FINSEQ_1:59;
    then consider e,o be complex-valued FinSequence such that
A7:   len e = [\n/2/] & len o = [/n/2 \] and
A8:   Sum (fn) = Sum e + Sum o and
A9:   for k holds e.k = fn.(2*k) & o.k = fn.(2*k-1) by A4;
    per cases;
    suppose n is even;
      then consider k such that
A10:    2*k=n by ABIAN:def 2;
      take e,oF=o^<*f.n1*>;
A11:    len oF = len o+1 by FINSEQ_2:16;
A12:    [\n/2/] = k = [\(n+1)/2/] & [/n/2 \] = k & [/(n+1)/2 \] =k+1
        by A10,Lm1,Lm2;
      hence len e = [\len f/2/] & len oF = [/len f/2 \]
        by FINSEQ_2:16,A5,A7;
      thus Sum f = Sum fn+f.n1 by A6,RVSUM_2:31
        .= Sum e + (Sum o+f.n1) by A8
        .= Sum e + Sum oF by RVSUM_2:31;
      let i be Nat;
      thus e.i = f.(2*i)
      proof
        per cases;
        suppose 2*i <=n;
          then fn.(2*i) = f.(2*i) by FINSEQ_3:112;
          hence thesis by A9;
        end;
        suppose 2*i > n;
          then
A13:        i > k by A10,XREAL_1:64;
          then i >= k+1 by NAT_1:13;
          then 2*i >= 2*(k+1) & 2*(k+1) = len f+1 by A10,A5,XREAL_1:64;
          then 2*i > len f by NAT_1:13;
          then not 2*i in dom f & not i in dom e
            by FINSEQ_3:25,A7,A12,A13;
          then f.(2*i) = 0 = e.i by FUNCT_1:def 2;
          hence thesis;
        end;
      end;
      thus oF.i = f.(2*i-1)
      proof
        per cases;
        suppose i=0;
          then not i in dom oF & not (2*i-1) in dom f
            by FINSEQ_3:25;
          then oF.i = 0 = f.(2*i-1) by FUNCT_1:def 2;
          hence thesis;
        end;
        suppose
A14:        i<>0 & 2*i <=n;
          then 1<= i <= k by A10,XREAL_1:68,NAT_1:14;
          then i in dom o by A7,A12,FINSEQ_3:25;
          then
A15:        oF.i = o.i by FINSEQ_1:def 7
            .= fn.(2*i-1) by A9;
          2*i-1 <=n-0 by XREAL_1:13,A14;
          hence thesis by A15,A14,FINSEQ_3:112;
        end;
        suppose 2*i > n;
          then i > k by A10,XREAL_1:64;
          then i >= k+1 by NAT_1:13;
          then 2*i >= 2*(k+1) & 2*(k+1) = len f+1 by A10,A5,XREAL_1:64;
          then
A16:        2*i-1 >= len f by XREAL_1:19;
          per cases by A16,XXREAL_0:1;
          suppose 2*i-1 = len f;
            hence thesis by A5,A10,A7,A12;
          end;
          suppose
A17:          2*i -1 > len f;
            then not (2*i-1) in dom f by FINSEQ_3:25;
            then
A18:          f.(2*i-1) = 0 by FUNCT_1:def 2;
            2*i > len f+1 by A17,XREAL_1:20;
            then 2*i > 2*(k+1) by A10,A5;
            then i > k+1 by XREAL_1:64;
            then not i in dom oF by A11,A12,A7,FINSEQ_3:25;
            hence thesis by A18,FUNCT_1:def 2;
          end;
        end;
      end;
    end;
    suppose n is odd;
      then consider k such that
A19:    n =2*k+1 by ABIAN:9;
      take eF=e^<*f.n1*>,o;
A20:    len eF = len e+1 by FINSEQ_2:16;
A21:    [\n/2/] = k & [\(n+1)/2/]=k+1 & [/n/2 \] = k+1 &
      [/(n+1)/2 \] =k+1 by A19,Lm1,Lm2;
      hence len eF = [\len f/2/] & len o = [/len f/2 \] by FINSEQ_2:16,A5,A7;
      thus Sum f = Sum fn+f.n1 by A6,RVSUM_2:31
        .= (Sum e + f.n1) + Sum o by A8
        .= Sum eF + Sum o by RVSUM_2:31;
      let i be Nat;
      thus eF.i = f.(2*i)
      proof
        per cases;
        suppose i=0;
          hence thesis;
        end;
        suppose i <>0 & i <= k;
          then 1<=i<=k & 2*i <= 2*k by NAT_1:14,XREAL_1:64;
          then i in dom e & 2*i < n by A19,NAT_1:13,FINSEQ_3:25,A7,A21;
          then eF.i =e.i & fn.(2*i) = f.(2*i) by FINSEQ_1:def 7,FINSEQ_3:112;
          hence thesis by A9;
        end;
        suppose i > k;
          then
A22:        i >= k+1 by NAT_1:13;
          per cases by A22,XXREAL_0:1;
          suppose i = k+1;
            hence thesis by A19,A7,A21;
          end;
          suppose
A23:          i > k+1;
            then not i in dom eF by FINSEQ_3:25,A7,A20,A21;
            then
A24:          eF.i = 0 by FUNCT_1:def 2;
            2*i > 2*(k+1) by A23,XREAL_1:68;
            then not 2*i in dom f by A5,A19,FINSEQ_3:25;
            hence thesis by A24,FUNCT_1:def 2;
          end;
        end;
      end;
      thus o.i = f.(2*i-1)
      proof
        per cases;
        suppose i =0;
          then not i in dom o & not (2*i-1) in dom f by FINSEQ_3:25;
          then o.i= 0 = f.(2*i-1) by FUNCT_1:def 2;
          hence thesis;
        end;
        suppose
A25:        i<>0 & 2*i-1 <=n;
          fn.(2*i-1) = f.(2*i-1) by A25,FINSEQ_3:112;
          hence thesis by A9;
        end;
        suppose 2*i-1 > n;
          then 2*i > n+1 by XREAL_1:20;
          then 2*i > 2*(k+1) by A19;
          then
A26:        i > k+1 by XREAL_1:64;
          then not i in dom o by FINSEQ_3:25,A7,A21;
          then
A27:        o.i = 0 by FUNCT_1:def 2;
          i >= k+1+1 by A26,NAT_1:13;
          then 2*i >= 2*(k+1+1) by XREAL_1:64;
          then 2*i >= len f+1+1 by A19,A5;
          then 2*i > len f+1 by NAT_1:13;
          then not 2*i-1 in dom f by XREAL_1:20,FINSEQ_3:25;
          hence thesis by A27,FUNCT_1:def 2;
        end;
      end;
    end;
  end;
  P[n] from NAT_1:sch 2(A1,A3);
  hence thesis;
end;
