
theorem lembag2b:
for f being FinSequence of NAT, i,j being Nat
st i in dom f & j in dom f & i <> j holds Sum f >= f.i + f.j
proof
let f be FinSequence of NAT, i,j be Nat;
assume AS: i in dom f & j in dom f & i <> j; then
A: f <> {};
   now assume len f = 1;
   then B: dom f = {1} by FINSEQ_1:def 3,FINSEQ_1:2;
   then i = 1 by AS,TARSKI:def 1 .= j by AS,B,TARSKI:def 1;
   hence contradiction by AS;
   end; then
B: len f >= 2 by A,NAT_1:23;
defpred P[Nat] means
  for f being FinSequence of NAT, i being Nat
  st i in dom f & j in dom f & i<>j & len f = $1 holds Sum f >= f.i+f.j;
IA: P[2]
    proof
    now let f be FinSequence of NAT, i be Nat;
      assume A1: i in dom f & j in dom f & i <> j & len f = 2; then
      f.i = f/.i & f.j = f/.j by PARTFUN1:def 6; then
      reconsider ni = f.i, nj = f.j as Element of NAT;
      A0: dom f = {1,2} by A1,FINSEQ_1:def 3,FINSEQ_1:2; then
      per cases by A1,TARSKI:def 2;
      suppose A2: i = 1;
        then nj = f.2 by A1,A0,TARSKI:def 2;
        then Sum f = Sum <*ni,nj*> by A1,A2,FINSEQ_1:44
                  .= ni + nj by RVSUM_1:77;
        hence Sum f >= f.i + f.j;
        end;
      suppose A2: i = 2;
        then nj = f.1 by A1,A0,TARSKI:def 2;
        then Sum f = Sum <*nj,ni*> by A1,A2,FINSEQ_1:44
                  .= nj + ni by RVSUM_1:77;
        hence Sum f >= f.i + f.j;
        end;
      end;
    hence thesis;
    end;
IS: now let k be Nat;
    assume 2 <= k;
    assume I2: P[k];
    now let f be FinSequence of NAT, i be Nat;
      assume I3: i in dom f & j in dom f & i <> j & len f = k+1; then
      consider g being FinSequence of NAT, d being Element of NAT such that
      I4: f = g^<*d*> by FINSEQ_2:19;
      I5: len f = len g + 1 by I4,FINSEQ_2:16; then
      I7: dom g = Seg k by I3,FINSEQ_1:def 3;
      I6: Sum f = Sum g + d by I4,RVSUM_1:74;
      dom f = Seg(k + 1) by I3,FINSEQ_1:def 3; then
      I8: 1 <= i & i <= k + 1 &
          1 <= j & j <= k + 1 by I3,FINSEQ_1:1; then
      per cases by XXREAL_0:1;
      suppose J1: i = k + 1;
        then J2: f.i = d by I3,I4,I5,FINSEQ_1:42;
        j < k + 1 by J1,I3,I8,XXREAL_0:1;
        then j <= k by NAT_1:13;
        then H: j in dom g by I7,I8,FINSEQ_1:1;
        Sum g >= g.j by NEWTON04:21;
        then Sum g >= f.j by I4,H,FINSEQ_1:def 7;
        hence Sum f >= f.i + f.j by I6,J2,XREAL_1:6;
        end;
      suppose J1: j = k + 1;
        then J2: f.j = d by I3,I4,I5,FINSEQ_1:42;
        i < k + 1 by J1,I3,I8,XXREAL_0:1;
        then i <= k by NAT_1:13;
        then H: i in dom g by I7,I8,FINSEQ_1:1;
        Sum g >= g.i by NEWTON04:21;
        then Sum g >= f.i by I4,H,FINSEQ_1:def 7;
        hence Sum f >= f.i + f.j by I6,J2,XREAL_1:6;
        end;
      suppose i < k + 1 & j < k + 1;
        then i <= k & j <= k by NAT_1:13;
        then H: i in dom g & j in dom g by I7,I8,FINSEQ_1:1;
        then Sum g >= g.i + g.j by I2,I5,I3;
        then Sum g >= f.i + g.j by I4,H,FINSEQ_1:def 7;
        then Sum g >= f.i + f.j by I4,H,FINSEQ_1:def 7;
        then Sum g + d >= f.i + f.j + 0 by XREAL_1:7;
        hence Sum f >= f.i + f.j by I4,RVSUM_1:74;
        end;
      end;
    hence P[k+1];
    end;
for k being Nat holds 2 <= k implies P[k] from NAT_1:sch 8(IA,IS);
hence thesis by AS,B;
end;
