reserve X for set;
reserve k,m,n for Nat;
reserve i for Integer;
reserve a,b,c,d,e,g,p,r,x,y for Real;
reserve z for Complex;

theorem
  Sum ((sqr x_r-seq(m))") <= Sum sqr cosec x_r-seq(m)
  proof
    set f = x_r-seq(m);
    set f1 = sqr cosec f;
    set f2 = (sqr f)";
A1: len f = m by Th19;
A2: len cosec f = len f by Lm15;
A3: len sqr f = len f by RVSUM_1:143;
    now
      let n;
      assume n in Seg m;
      then
A4:   1 <= n & n <= m by FINSEQ_1:1;
      then
A5:   n in dom f by A1,FINSEQ_3:25;
A6:   f1.n = ((cosec f).n)^2 by VALUED_1:11;
A7:   (cosec f).n = cosec(f.n) by A5,Def4;
A8:   f2.n = ((sqr f).n)" by VALUED_1:10;
A9:   (sqr f).n = (f.n)^2 by VALUED_1:11;
A10:  f.n < PI/2 by A4,Th21;
A11:  0 < f.n by A4,Th21;
A12:  ((sin.(f.n))^2)" = (cosec(f.n))^2 by XCMPLX_1:204;
      PI/2 < PI/1 by XREAL_1:76;
      then f.n < PI by A10,XXREAL_0:2;
      then f.n in ].0,PI.[ by A11,XXREAL_1:4;
      then
A13:  0 < sin(f.n) by COMPTRIG:7;
      sin.(f.n) <= f.n  by A11,Th17;
      then (sin.(f.n))^2 <= (f.n)^2 by A13,XREAL_1:66;
      hence f2.n <= f1.n by A6,A7,A8,A9,A12,A13,XREAL_1:85;
    end;
    hence thesis by A1,A2,A3,RVSUM_1:82;
  end;
