reserve c, c1, d for Real,
  k for Nat,
  n, m, N, n1, N1, N2, N3, N4, N5, M for Element of NAT,
  x for set;

theorem Th19: :: Duality Rule (page 86)
  for f,g being eventually-nonnegative Real_Sequence holds f in
  Big_Omega(g) iff g in Big_Oh(f)
proof
  let f,g be eventually-nonnegative Real_Sequence;
A1: g is Element of Funcs(NAT, REAL) by FUNCT_2:8;
  hereby
    consider N1 being Nat such that
A2: for n being Nat st n >= N1 holds g.n >= 0 by Def2;
    assume f in Big_Omega(g);
    then consider t being Element of Funcs(NAT, REAL) such that
A3: f = t and
A4: ex d,N st d > 0 & for n st n >= N holds t.n >= d*g.n & t.n >= 0;
    consider d,N such that
A5: d > 0 and
A6: for n st n >= N holds t.n >= d*g.n & t.n >= 0 by A4;
    reconsider a = max(N, N1) as Element of NAT by ORDINAL1:def 12;
A7: a >= N1 by XXREAL_0:25;
A8: a >= N by XXREAL_0:25;
    now
      take a;
      let n;
      assume
A9:   n >= a;
      then n >= N by A8,XXREAL_0:2;
      then t.n >= d*g.n by A6;
      then d"*t.n >= d"*(d*g.n) by A5,XREAL_1:64;
      then d"*t.n >= (d"*d)*g.n;
      then d"*t.n >= 1*g.n by A5,XCMPLX_0:def 7;
      hence g.n <= d"*f.n by A3;
      n >= N1 by A7,A9,XXREAL_0:2;
      hence g.n >= 0 by A2;
    end;
    hence g in Big_Oh(f) by A1,A5;
  end;
  assume g in Big_Oh(f);
  then consider t being Element of Funcs(NAT, REAL) such that
A10: g = t and
A11: ex c,N st c > 0 & for n st n >= N holds t.n <= c*f.n & t.n >= 0;
  consider c,N such that
A12: c > 0 and
A13: for n st n >= N holds t.n <= c*f.n & t.n >= 0 by A11;
  consider N1 being Nat such that
A14: for n being Nat st n >= N1 holds f.n >= 0 by Def2;
  reconsider a = max(N, N1) as Element of NAT by ORDINAL1:def 12;
A15: a >= N1 by XXREAL_0:25;
A16: a >= N by XXREAL_0:25;
A17: now
    take a;
    let n;
    assume
A18: n >= a;
    then n >= N by A16,XXREAL_0:2;
    then t.n <= c*f.n by A13;
    then c"*t.n <= c"*(c*f.n) by A12,XREAL_1:64;
    then c"*t.n <= (c"*c)*f.n;
    then c"*t.n <= 1*f.n by A12,XCMPLX_0:def 7;
    hence f.n >= c"*g.n by A10;
    n >= N1 by A15,A18,XXREAL_0:2;
    hence f.n >= 0 by A14;
  end;
  f is Element of Funcs(NAT, REAL) by FUNCT_2:8;
  hence thesis by A12,A17;
end;
