ignore .lib and .exe
[prop.git] / prop-src / timespace.ph
blob6b591f9c07f07f0c3ec2248230a1fd21a6f17332
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 //  This file describes the structure of the time and space complexity
4 //  datatypes.  These datatypes are used to represent time and space
5 //  complexity in the SETL-like extension language. 
6 //
7 ///////////////////////////////////////////////////////////////////////////////
8 #ifndef time_and_space_complexity_h
9 #define time_and_space_complexity_h
11 #include "basics.ph"
13 ///////////////////////////////////////////////////////////////////////////////
15 //  Forward type declaration
17 ///////////////////////////////////////////////////////////////////////////////
18 class std::ostream;
20 ///////////////////////////////////////////////////////////////////////////////
22 //  Complexity expression is represented by the datatype Complexity.
24 ///////////////////////////////////////////////////////////////////////////////
25 datatype Complexity : MEM =
26      Var      Id                           // variable
27    | Add      (Complexity, Complexity)     // f(x) + g(x)
28    | Mul      (Complexity, Complexity)     // f(x) * g(x)
29    | Div      (Complexity, Complexity)     // f(x) / g(x)
30    | Power    (Complexity, Complexity)     // f(x) ^ g(x)
31    | Log      (Complexity)                 // log f(x)
32    | Const    (double)                     // constant
33    | BigOh    Complexity                   // O(f(x))
34    | Omega    Complexity                   // Omega(f(x))
35    | LittleOh Complexity                   // o(f(x))
37 ///////////////////////////////////////////////////////////////////////////////
39 //  Time complexity is represented by the datatype Time.
41 ///////////////////////////////////////////////////////////////////////////////
42 and      Time  : MEM = TIME Complexity
44 ///////////////////////////////////////////////////////////////////////////////
46 //  Similarly, space complexity is represented by the datatype Space.
48 ///////////////////////////////////////////////////////////////////////////////
49 and      Space : MEM = SPACE Complexity
52 ///////////////////////////////////////////////////////////////////////////////
54 //  Pretty printing routines.
56 ///////////////////////////////////////////////////////////////////////////////
57 extern std::ostream& operator << (std::ostream&, Complexity);
58 extern std::ostream& operator << (std::ostream&, Time);
59 extern std::ostream& operator << (std::ostream&, Space);
61 ///////////////////////////////////////////////////////////////////////////////
63 //  Functions to simplify and manipulate complexity expressions.
65 ///////////////////////////////////////////////////////////////////////////////
66 extern Complexity simplify (Complexity);
68 #endif