 reserve X,Y for set,
         n,m,k,i for Nat,
         r for Real,
         R for Element of F_Real,
         K for Field,
         f,f1,f2,g1,g2 for FinSequence,
         rf,rf1,rf2 for real-valued FinSequence,
         cf,cf1,cf2 for complex-valued FinSequence,
         F for Function;

theorem Th5:
  rf is nonnegative-yielding implies sqrt Sum rf <= Sum sqrt rf
proof
  defpred P[Nat] means
    for f be real-valued FinSequence st len f=$1 & f is nonnegative-yielding
    holds sqrt Sum f<=Sum sqrt f & 0<=Sum f;
A1: P[n] implies P[n+1]
    proof
      assume
A2:  P[n];
      set n1=n+1;
      let f be real-valued FinSequence such that
A3:     len f=n1 and
A4:     f is nonnegative-yielding;
      rng f c=REAL;
      then reconsider F=f as FinSequence of REAL by FINSEQ_1:def 4;
      reconsider fn=F|n as FinSequence of REAL;
A5:     F=fn^<*F.n1*> by A3,FINSEQ_3:55;
      then sqrt F = (sqrt fn)^sqrt<*F.n1*> by Th2
                 .= (sqrt fn)^<*sqrt(F.n1)*> by Th3;
      then
A6:     Sum sqrt F=Sum(sqrt fn)+sqrt(F.n1) by RVSUM_1:74;
A7:     len fn=n by A3,FINSEQ_3:53;
      then sqrt(Sum fn)<=Sum sqrt fn by A2,A4;
      then
A8:     sqrt(Sum fn)+sqrt(f.n1)<=Sum sqrt F by A6,XREAL_1:6;
A9:     Sum f=(Sum fn)+(f.n1) by A5,RVSUM_1:74;
      n1>=1 by NAT_1:11;
      then n1 in dom f by A3,FINSEQ_3:25;
      then f.n1 in rng f by FUNCT_1:def 3;
      then
A10:    f.n1>=0 by A4;
A11:    (Sum fn)>=0 by A2,A4,A7;
      then sqrt Sum f<=sqrt(Sum fn)+sqrt(f.n1) by A9,A10,SQUARE_1:59;
      hence thesis by A9,A11,A10,A8,XXREAL_0:2;
    end;
A12: P[0 qua Nat]
    proof
      let f be real-valued FinSequence such that
A13:    len f=0 and
        f is nonnegative-yielding;
      dom f=dom sqrt f by PARTFUN3:def 5;
      then len f=len sqrt f by FINSEQ_3:29;
      then
A14:    sqrt f=<*>REAL by A13;
      f=<*>REAL by A13;
      hence thesis by A14,RVSUM_1:72,SQUARE_1:17;
    end;
  P[n] from NAT_1:sch 2(A12,A1);
  then P[len rf];
  hence thesis;
end;
