[/] [trunk/] [src/] [maketest/] [clock_expression.sig] - Blame information for rev 49

Line No. Rev Author Line
1 4 tbourke
(* $Id: clock_expression.sig 49 2008-07-21 07:02:40Z tbourke $ *)
2
 
3 35 tbourke
(* TODO:
4
 *    * It might be useful to define a type that carries around both a
5
 *      ClockExpression and its forall bindings (i.e. prenex form), the
6
 *      functions should be updated to handle this type properly.
7
 *)
8
 
9 4 tbourke
signature CLOCK_EXPRESSION = sig
10
 
11
  exception NonClockTerm
12
 
13
  type symbol    = Atom.atom
14
   and symbolset = AtomSet.set
15
 
16
  datatype clockrel = Lt | Leq | Eq | Geq | Gt
17
 
18
  datatype clockval = Simple  of int
19
                    | Complex of Expression.expr
20
 
21
  datatype clockterm = NonClock of Expression.expr
22
                     | CRel     of Expression.var * clockrel * clockval
23
                     | CDiff    of Expression.var * Expression.var
24
                                   * clockrel * clockval
25
 
26
  datatype t = Term of clockterm
27
             | And  of t * t
28
             | Or   of t * t
29
 
30 31 tbourke
  val trueExpr       : t
31
  val falseExpr      : t
32
 
33 49 tbourke
  val isConstant     : t -> bool option
34
 
35 4 tbourke
  val negate         : t -> t
36
  val getFree        : t -> symbolset
37
 
38
  val fromExpr       : symbolset * Environment.env * Expression.expr
39
                       -> t * (symbol * Expression.ty) list * symbolset
40
                       (* raises NonClockTerm *)
41
  (* usednames * environment * expression to convert
42
   *    -> result * forall bindings * usednames' -- now in prenex form *)
43
 
44
  val toExpr         : t * (symbol * Expression.ty) list -> Expression.expr
45
 
46
  val rename         : {old: symbol, new: symbol} * t -> t
47 19 tbourke
  val conflictExists : symbolset * symbolset * clockterm list list -> bool
48 4 tbourke
 
49 35 tbourke
  val ensureNoBindingConflict : (symbol * Expression.ty) list * t
50
                                -> (symbol * Expression.ty) list * t
51
                                -> (symbol * Expression.ty) list * t
52
  (* (l', e') = ensureNoBindingConflict (rl, re) (l, e)
53
   * Renames bound variables (l => l') in (e => e') to ensure that combination
54
   * with the reference expression will not capture names improperly.
55
   *
56
   * e.g. it would then be safe to and the reference and result expressions:
57
   *          (al, ae) = (rl @ l', andexpr (re, e'))
58
   * *)
59
 
60 4 tbourke
  val toDNF          : t -> clockterm list list
61
  val fromDNF        : clockterm list list -> t
62
  val andexpr        : t * t -> t
63
 
64
  val toString       : t -> string
65
 
66
end
67