
theorem Th3:
  for p,q be FinSequence of REAL st len p = len q
   & (for j be Nat st j in dom p holds |. p.j .| <= q.j)
  holds |. Sum(p) .| <= Sum(q)
  proof
    let p, q be FinSequence of REAL;
    assume
    A1: len p = len q
     & (for j be Nat st j in dom p holds |. p.j .| <= q.j);
    defpred P1[Nat,set] means
    ex v be Real st v = p.$1 & $2 = |. v .|;
    A2: for i be Nat st i in Seg len p
        ex x be Element of REAL st P1[i,x]
    proof
      let i be Nat;
      assume i in Seg len p;
      reconsider w = |.p.i.| as Element of REAL by XREAL_0:def 1;
      take w;
      thus thesis;
    end;
    consider u be FinSequence of REAL such that
    A3: dom u = Seg len p & for i be Nat
        st i in Seg len p holds P1[i,u.i] from FINSEQ_1:sch 5(A2);
    A4: for i be Element of NAT st i in dom p holds
        ex v be Real st v = p.i & u.i = |. v .|
        proof
          let i be Element of NAT;
          assume i in dom p; then
          i in Seg len p by FINSEQ_1:def 3;
          hence ex v be Real st v = p.i & u.i = |. v .| by A3;
        end;
    A5: len u = len p by A3,FINSEQ_1:def 3; then
    A6: |.Sum p.| <= Sum u by A4,Th2;
    set i = len p;
    reconsider uu=u as Element of i-tuples_on REAL by A5,FINSEQ_2:92;
    reconsider qq=q as Element of i-tuples_on REAL by A1,FINSEQ_2:92;
    now
      let j be Nat;
      assume j in Seg i; then
      A7: j in dom p by FINSEQ_1:def 3; then
      ex v be Real st v = p.j & u.j = |. v .| by A4;
      hence uu.j <= qq.j by A1,A7;
    end; then
    Sum uu <= Sum qq by RVSUM_1:82;
    hence thesis by A6,XXREAL_0:2;
  end;
