-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Labels
Description
Typed.symbol returns a typed expression
Lines 41 to 43 in f50d5bf
| (** [symbol ty name] creates a symbolic constant of type [ty] with the given | |
| [name]. *) | |
| val symbol : 'a ty -> string -> 'a expr |
I guess because there aren't typed symbols.
This is convenient for constructing typed expressions because it can directly then be used.
But it makes it kind of impossible to look up that symbol in a model using
Lines 26 to 28 in f50d5bf
| (** [evaluate tbl sym] returns the value associated with symbol [sym] in [tbl], | |
| if any. *) | |
| val evaluate : t -> Symbol.t -> Value.t option |
because the underlying
Symbol.t isn't available.
I can see two ways to solve this:
- Add typed symbols (and their
unwrap). This changes the API to be more complex though. - Allow
Expr.tevaluation in models. It's kind of what I expected from the nameModel.evaluateand it's how e.g. Z3 model API works. CurrentlyModel.evaluateis just a hashtable lookup without any actual evaluation, which is strange. But changing it also affects the API.
Actually, in an ideal world, I'd even hope to have something like
Model.evaluate: Model.t -> 'a Typed.expr -> 'a option
or
Model.evaluate: Model.t -> 'a Typed.symbol -> 'a option
That way I wouldn't have to match on Value.t to get the results in the expected type. Not sure how achievable such API would be though.
Reactions are currently unavailable