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 Th36: :: Alternate definition for Big_Theta_Cond
  for f being eventually-nonnegative Real_Sequence, X being set
  holds Big_Theta(f,X) = Big_Oh(f,X) /\ Big_Omega(f,X)
proof
  let f be eventually-nonnegative Real_Sequence, X be set;
  now
    let x be object;
    hereby
      consider N1 being Nat such that
A1:   for n being Nat st n >= N1 holds f.n >= 0 by Def2;
      assume x in Big_Theta(f,X);
      then consider t being Element of Funcs(NAT, REAL) such that
A2:   x = t and
A3:   ex c,d,N st c > 0 & d > 0 & for n st n >= N & n in X holds d*f.n
      <= t.n & t.n <= c*f.n;
      consider c,d,N such that
A4:   c > 0 and
A5:   d > 0 and
A6:   for n st n >= N & n in X holds d*f.n <= t.n & t.n <= c*f.n by A3;
      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 that
A9:     n >= a and
A10:    n in X;
A11:    n >= N by A8,A9,XXREAL_0:2;
        hence d*f.n <= t.n by A6,A10;
        n >= N1 by A7,A9,XXREAL_0:2;
        then f.n >= 0 by A1;
        then d*f.n >= d*0 by A5;
        hence t.n >= 0 by A6,A10,A11;
      end;
      then
A12:  x in Big_Omega(f,X) by A2,A5;
      now
        take a;
        let n;
        assume that
A13:    n >= a and
A14:    n in X;
A15:    n >= N by A8,A13,XXREAL_0:2;
        hence t.n <= c*f.n by A6,A14;
        n >= N1 by A7,A13,XXREAL_0:2;
        then f.n >= 0 by A1;
        then d*f.n >= d*0 by A5;
        hence t.n >= 0 by A6,A14,A15;
      end;
      then x in Big_Oh(f,X) by A2,A4;
      hence x in Big_Oh(f,X) /\ Big_Omega(f,X) by A12,XBOOLE_0:def 4;
    end;
    assume
A16: x in Big_Oh(f,X) /\ Big_Omega(f,X);
    then x in Big_Oh(f,X) by XBOOLE_0:def 4;
    then consider t being Element of Funcs(NAT, REAL) such that
A17: x = t and
A18: ex c,N st c > 0 & for n st n >= N & n in X holds t.n <= c*f.n & t .n>= 0;
    x in Big_Omega(f,X) by A16,XBOOLE_0:def 4;
    then consider s being Element of Funcs(NAT, REAL) such that
A19: x = s and
A20: ex d,N st d > 0 & for n st n >= N & n in X holds s.n >= d*f.n & s .n >= 0;
    consider c,N such that
A21: c > 0 and
A22: for n st n >= N & n in X holds t.n <= c*f.n & t.n >= 0 by A18;
    consider d,N1 such that
A23: d > 0 and
A24: for n st n >= N1 & n in X holds s.n >= d*f.n & s.n >= 0 by A20;
    set a = max(N, N1);
A25: a >= N & a >= N1 by XXREAL_0:25;
    now
      take a;
      let n;
      assume that
A26:  n >= a and
A27:  n in X;
      n >= N & n >= N1 by A25,A26,XXREAL_0:2;
      hence d*f.n <= t.n & t.n <= c*f.n by A17,A19,A22,A24,A27;
    end;
    hence x in Big_Theta(f,X) by A17,A21,A23;
  end;
  hence thesis by TARSKI:2;
end;
