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

Line No. Rev Author Line
1 62 tbourke
(* $Id: clock_expression.sig 72 2009-03-14 11:44:10Z tbourke $
2
 *
3
 * Copyright (c) 2008 Timothy Bourke (University of NSW and NICTA)
4
 * All rights reserved.
5
 *
6
 * This program is free software; you can redistribute it and/or modify it
7
 * under the terms of the "BSD License" which is distributed with the
8
 * software in the file LICENSE.
9
 *
10
 * This program is distributed in the hope that it will be useful, but
11
 * WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the BSD
13
 * License for more details.
14
 *)
15 4 tbourke
 
16 35 tbourke
(* TODO:
17
 *    * It might be useful to define a type that carries around both a
18
 *      ClockExpression and its forall bindings (i.e. prenex form), the
19
 *      functions should be updated to handle this type properly.
20
 *)
21
 
22 4 tbourke
signature CLOCK_EXPRESSION = sig
23
 
24
  exception NonClockTerm
25
 
26
  type symbol    = Atom.atom
27
   and symbolset = AtomSet.set
28
 
29
  datatype clockrel = Lt | Leq | Eq | Geq | Gt
30
 
31
  datatype clockval = Simple  of int
32
                    | Complex of Expression.expr
33
 
34
  datatype clockterm = NonClock of Expression.expr
35
                     | CRel     of Expression.var * clockrel * clockval
36
                     | CDiff    of Expression.var * Expression.var
37
                                   * clockrel * clockval
38
 
39
  datatype t = Term of clockterm
40
             | And  of t * t
41
             | Or   of t * t
42
 
43 31 tbourke
  val trueExpr       : t
44
  val falseExpr      : t
45
 
46 49 tbourke
  val isConstant     : t -> bool option
47
 
48 4 tbourke
  val negate         : t -> t
49
  val getFree        : t -> symbolset
50
 
51
  val fromExpr       : symbolset * Environment.env * Expression.expr
52
                       -> t * (symbol * Expression.ty) list * symbolset
53
                       (* raises NonClockTerm *)
54
  (* usednames * environment * expression to convert
55
   *    -> result * forall bindings * usednames' -- now in prenex form *)
56
 
57
  val toExpr         : t * (symbol * Expression.ty) list -> Expression.expr
58
 
59
  val rename         : {old: symbol, new: symbol} * t -> t
60 19 tbourke
  val conflictExists : symbolset * symbolset * clockterm list list -> bool
61 4 tbourke
 
62 35 tbourke
  val ensureNoBindingConflict : (symbol * Expression.ty) list * t
63
                                -> (symbol * Expression.ty) list * t
64
                                -> (symbol * Expression.ty) list * t
65
  (* (l', e') = ensureNoBindingConflict (rl, re) (l, e)
66
   * Renames bound variables (l => l') in (e => e') to ensure that combination
67
   * with the reference expression will not capture names improperly.
68
   *
69
   * e.g. it would then be safe to and the reference and result expressions:
70
   *          (al, ae) = (rl @ l', andexpr (re, e'))
71
   * *)
72
 
73 72 tbourke
  val toDNF            : t -> clockterm list list
74
  val fromDNF          : clockterm list list -> t
75
  val clusterNonClocks : clockterm list list -> clockterm list list
76
  val andexpr          : t * t -> t
77 4 tbourke
 
78 72 tbourke
  val toString         : t -> string
79 4 tbourke
 
80
end
81