Skip to content

Commit 7211045

Browse files
Z3: Change accidentally changed things back to ctx
1 parent 196bf69 commit 7211045

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

src/witness/z3/violationZ3.z3.ml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct
1616
(* ("smt.core.minimize", "true"); *)
1717
(* ("sat.core.minimize", "true"); *)
1818
]
19-
let man = mk_context cfg
19+
let ctx = mk_context cfg
2020

2121
type var = varinfo
2222

@@ -40,43 +40,43 @@ struct
4040
let get_const m x =
4141
match VarMap.find_opt x m with
4242
| Some x -> x
43-
| None -> Arithmetic.Integer.mk_const_s man (get_name x)
44-
let sort = Arithmetic.Integer.mk_sort man
43+
| None -> Arithmetic.Integer.mk_const_s ctx (get_name x)
44+
let sort = Arithmetic.Integer.mk_sort ctx
4545
let freshen env x =
46-
VarMap.add x (Expr.mk_fresh_const man (get_name x) sort) env
46+
VarMap.add x (Expr.mk_fresh_const ctx (get_name x) sort) env
4747
end
4848

4949
let bool_to_int expr =
50-
Boolean.mk_ite man expr (Arithmetic.Integer.mk_numeral_i man 1) (Arithmetic.Integer.mk_numeral_i man 0)
50+
Boolean.mk_ite ctx expr (Arithmetic.Integer.mk_numeral_i ctx 1) (Arithmetic.Integer.mk_numeral_i ctx 0)
5151

5252
let int_to_bool expr =
53-
Boolean.mk_distinct man [expr; Arithmetic.Integer.mk_numeral_i man 0]
53+
Boolean.mk_distinct ctx [expr; Arithmetic.Integer.mk_numeral_i ctx 0]
5454

5555
let rec exp_to_expr env = function
5656
| Const (CInt (i, _, _)) ->
57-
Arithmetic.Integer.mk_numeral_s man (Z.to_string i)
57+
Arithmetic.Integer.mk_numeral_s ctx (Z.to_string i)
5858
| Lval (Var v, NoOffset) ->
5959
Env.get_const env v
6060
| BinOp (PlusA, e1, e2, TInt _) ->
61-
Arithmetic.mk_add man [exp_to_expr env e1; exp_to_expr env e2]
61+
Arithmetic.mk_add ctx [exp_to_expr env e1; exp_to_expr env e2]
6262
| BinOp (MinusA, e1, e2, TInt _) ->
63-
Arithmetic.mk_sub man [exp_to_expr env e1; exp_to_expr env e2]
63+
Arithmetic.mk_sub ctx [exp_to_expr env e1; exp_to_expr env e2]
6464
| BinOp (Mult, e1, e2, TInt _) ->
65-
Arithmetic.mk_mul man [exp_to_expr env e1; exp_to_expr env e2]
65+
Arithmetic.mk_mul ctx [exp_to_expr env e1; exp_to_expr env e2]
6666
| BinOp (Eq, e1, e2, TInt _) ->
67-
bool_to_int (Boolean.mk_eq man (exp_to_expr env e1) (exp_to_expr env e2))
67+
bool_to_int (Boolean.mk_eq ctx (exp_to_expr env e1) (exp_to_expr env e2))
6868
| BinOp (Ne, e1, e2, TInt _) ->
69-
bool_to_int (Boolean.mk_distinct man [exp_to_expr env e1; exp_to_expr env e2])
69+
bool_to_int (Boolean.mk_distinct ctx [exp_to_expr env e1; exp_to_expr env e2])
7070
| BinOp (Gt, e1, e2, TInt _) ->
71-
bool_to_int (Arithmetic.mk_gt man (exp_to_expr env e1) (exp_to_expr env e2))
71+
bool_to_int (Arithmetic.mk_gt ctx (exp_to_expr env e1) (exp_to_expr env e2))
7272
| BinOp (Lt, e1, e2, TInt _) ->
73-
bool_to_int (Arithmetic.mk_lt man (exp_to_expr env e1) (exp_to_expr env e2))
73+
bool_to_int (Arithmetic.mk_lt ctx (exp_to_expr env e1) (exp_to_expr env e2))
7474
| BinOp (Ge, e1, e2, TInt _) ->
75-
bool_to_int (Arithmetic.mk_ge man (exp_to_expr env e1) (exp_to_expr env e2))
75+
bool_to_int (Arithmetic.mk_ge ctx (exp_to_expr env e1) (exp_to_expr env e2))
7676
| BinOp (Le, e1, e2, TInt _) ->
77-
bool_to_int (Arithmetic.mk_le man (exp_to_expr env e1) (exp_to_expr env e2))
77+
bool_to_int (Arithmetic.mk_le ctx (exp_to_expr env e1) (exp_to_expr env e2))
7878
| UnOp (LNot, e, TInt _) ->
79-
bool_to_int (Boolean.mk_not man (int_to_bool (exp_to_expr env e)))
79+
bool_to_int (Boolean.mk_not ctx (int_to_bool (exp_to_expr env e)))
8080
| e ->
8181
failwith @@ GobPretty.sprintf "exp_to_expr: %a" Cil.d_exp e
8282

@@ -86,19 +86,19 @@ struct
8686
let wp_assert env (from_node, (edge: MyARG.inline_edge), _) = match edge with
8787
| MyARG.CFGEdge (MyCFG.Assign ((Var v, NoOffset), e)) ->
8888
let env' = Env.freshen env v in
89-
(env', [Boolean.mk_eq man (Env.get_const env v) (exp_to_expr env' e)])
89+
(env', [Boolean.mk_eq ctx (Env.get_const env v) (exp_to_expr env' e)])
9090
| MyARG.CFGEdge (MyCFG.Test (e, true)) ->
91-
(env, [Boolean.mk_distinct man [exp_to_expr env e; Arithmetic.Integer.mk_numeral_i man 0]])
91+
(env, [Boolean.mk_distinct ctx [exp_to_expr env e; Arithmetic.Integer.mk_numeral_i ctx 0]])
9292
| MyARG.CFGEdge (MyCFG.Test (e, false)) ->
93-
(env, [Boolean.mk_eq man (exp_to_expr env e) (Arithmetic.Integer.mk_numeral_i man 0)])
93+
(env, [Boolean.mk_eq ctx (exp_to_expr env e) (Arithmetic.Integer.mk_numeral_i ctx 0)])
9494
| MyARG.CFGEdge (MyCFG.Entry fd) ->
9595
let env' = List.fold_left (fun acc formal ->
9696
Env.freshen acc formal
9797
) env fd.sformals
9898
in
9999
let eqs = List.mapi (fun i formal ->
100100
let arg_vname = get_arg_vname i in
101-
Boolean.mk_eq man (Env.get_const env formal) (Env.get_const env' arg_vname)
101+
Boolean.mk_eq ctx (Env.get_const env formal) (Env.get_const env' arg_vname)
102102
) fd.sformals
103103
in
104104
(env', eqs)
@@ -110,22 +110,22 @@ struct
110110
in
111111
let eqs = List.mapi (fun i arg ->
112112
let arg_vname = get_arg_vname i in
113-
Boolean.mk_eq man (Env.get_const env arg_vname) (exp_to_expr env' arg)
113+
Boolean.mk_eq ctx (Env.get_const env arg_vname) (exp_to_expr env' arg)
114114
) args
115115
in
116116
(env', eqs)
117117
| MyARG.CFGEdge (MyCFG.Ret (None, fd)) ->
118118
(env, [])
119119
| MyARG.CFGEdge (MyCFG.Ret (Some e, fd)) ->
120120
let env' = Env.freshen env return_vname in
121-
(env', [Boolean.mk_eq man (Env.get_const env return_vname) (exp_to_expr env' e)])
121+
(env', [Boolean.mk_eq ctx (Env.get_const env return_vname) (exp_to_expr env' e)])
122122
| MyARG.InlineReturn (None, _, _) ->
123123
(env, [])
124124
| MyARG.InlineReturn (Some (Var v, NoOffset), _, _) ->
125125
let env' = Env.freshen env v in
126-
(env', [Boolean.mk_eq man (Env.get_const env v) (Env.get_const env' return_vname)])
126+
(env', [Boolean.mk_eq ctx (Env.get_const env v) (Env.get_const env' return_vname)])
127127
| _ ->
128-
(* (env, Boolean.mk_true man) *)
128+
(* (env, Boolean.mk_true ctx) *)
129129
failwith @@ GobPretty.sprintf "wp_assert: %a" MyARG.pretty_inline_edge edge
130130

131131
let const_get_symbol (expr: Expr.expr): Symbol.symbol =
@@ -140,7 +140,7 @@ struct
140140
| Unknown
141141

142142
let wp_path path =
143-
let solver = Solver.mk_simple_solver man in
143+
let solver = Solver.mk_simple_solver ctx in
144144
let rec iter_wp revpath i env = match revpath with
145145
| [] -> Feasible
146146
| step :: revpath' ->
@@ -149,14 +149,14 @@ struct
149149
| [] -> iter_wp revpath' (i - 1) env'
150150
| [expr] -> do_assert revpath' i env' expr
151151
| exprs ->
152-
let expr = Boolean.mk_and man exprs in
152+
let expr = Boolean.mk_and ctx exprs in
153153
do_assert revpath' i env' expr
154154
end
155155

156156
and do_assert revpath' i env' expr =
157157
Logs.debug "%d: %s" i (Expr.to_string expr);
158158

159-
let track_const = Boolean.mk_const man (Symbol.mk_int man i) in
159+
let track_const = Boolean.mk_const ctx (Symbol.mk_int ctx i) in
160160
Solver.assert_and_track solver expr track_const;
161161

162162
let status = Solver.check solver [] in

0 commit comments

Comments
 (0)