1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
module V = Map.Make(Dolmen.Std.Expr.Term.Var)
module C = Map.Make(Dolmen.Std.Expr.Term.Const)
type t = {
vars : Value.t V.t;
csts : Value.t C.t;
}
let empty =
{ vars = V.empty; csts = C.empty; }
module type S = sig
type key
val find_opt : key -> t -> Value.t option
val add : key -> Value.t -> t -> t
end
module Var
: S with type key := Dolmen.Std.Expr.Term.Var.t
= struct
let[@inline] find_opt v t =
match V.find v t.vars with
| res -> Some res
| exception Not_found -> None
let add v value t =
{ t with vars = V.add v value t.vars; }
end
module Cst
: S with type key := Dolmen.Std.Expr.Term.Const.t
= struct
let[@inline] find_opt c t =
match C.find c t.csts with
| res -> Some res
| exception Not_found -> None
let add c value t =
{ t with csts = C.add c value t.csts; }
end