@@ -171,78 +171,7 @@ module EdgeData = struct
171
171
EdgeExp.ValuePair. V (EdgeExp.T. Access lhs_access)
172
172
173
173
174
- let derive_guards edge why3_norms tenv (prover_data : Provers.prover_data ) =
175
- let selected_theory = prover_data.real_data in
176
- let or_terms =
177
- List. fold edge.conditions ~init: [] ~f: (fun or_terms and_terms ->
178
- let condition_set =
179
- EdgeExp.Set. fold
180
- (fun cond acc ->
181
- match cond with
182
- | EdgeExp.T. BinOp (_ , EdgeExp.T. Const _ , EdgeExp.T. Const _ ) ->
183
- acc
184
- | EdgeExp.T. UnOp _ | EdgeExp.T. BinOp _ -> (
185
- try
186
- debug_log " Transforming: %a@," EdgeExp. pp cond ;
187
- let cond_why3, type_conditions =
188
- EdgeExp. to_why3_expr cond tenv ~selected_theory prover_data
189
- in
190
- Why3.Term.Sterm. add cond_why3 (Why3.Term.Sterm. union type_conditions acc)
191
- with error ->
192
- debug_log
193
- " Failed to transform condition '%a' to Why3 expression, skipping: %a@,"
194
- EdgeExp. pp cond Exn. pp error ;
195
- acc )
196
- | _ ->
197
- L. (die InternalError )
198
- " [Guards] Condition of form '%a' is not supported" EdgeExp. pp cond )
199
- and_terms Why3.Term.Sterm. empty
200
- in
201
- if Why3.Term.Sterm. is_empty condition_set then or_terms
202
- else (Why3.Term.Sterm. elements condition_set |> Why3.Term. t_and_l) :: or_terms )
203
- in
204
- if List. is_empty or_terms then EdgeExp.Set. empty
205
- else
206
- let lhs = Why3.Term. t_or_l or_terms in
207
- let gt = selected_theory.get_op " >" in
208
- let zero_const = selected_theory.mk_const (Why3.BigInt. of_int 0 ) in
209
- let goal_symbol = Why3.Decl. create_prsymbol (Why3.Ident. id_fresh " is_guard" ) in
210
- let lhs_vars = Why3.Term.Mvs. keys (Why3.Term. t_vars lhs) in
211
- let is_norm_guard why3_norm =
212
- let rhs = Why3.Term. t_app_infer gt [why3_norm; zero_const] in
213
- let formula = Why3.Term. t_implies lhs rhs in
214
- let rhs_vars = Why3.Term.Mvs. keys (Why3.Term. t_vars rhs) in
215
- let free_vars = lhs_vars @ rhs_vars in
216
- let quantified_fmla = Why3.Term. t_forall_close free_vars [] formula in
217
- let task = Why3.Task. use_export None selected_theory.theory in
218
- let task = Why3.Task. add_prop_decl task Why3.Decl. Pgoal goal_symbol quantified_fmla in
219
- let prover_call =
220
- Why3.Driver. prove_task prover_data.driver task ~config: prover_data.main
221
- ~command: prover_data.prover_conf.command
222
- ~limit: {Why3.Call_provers. empty_limit with limit_time= 5. }
223
- in
224
- let result = Why3.Call_provers. wait_on_call prover_call in
225
- match result.pr_answer with
226
- | Why3.Call_provers. Valid ->
227
- (* Implication [conditions] => [norm > 0] always holds *)
228
- true
229
- | Why3.Call_provers. Invalid | Why3.Call_provers. Unknown _ ->
230
- false
231
- | _ ->
232
- debug_log " Failed task: %a\n " Why3.Pretty. print_task task ;
233
- debug_log " Fail: %s\n " result.pr_output ;
234
- assert false
235
- in
236
- let guards =
237
- List. fold why3_norms ~init: EdgeExp.Set. empty ~f: (fun guard_acc (norm , why3_norm ) ->
238
- if is_norm_guard why3_norm then EdgeExp.Set. add norm guard_acc else guard_acc )
239
- in
240
- guards
241
-
242
-
243
174
let derive_constraint edge_data (norm , used_assignments ) formals tenv proc_name =
244
- (* List.iter edge_data.assignments ~f:(fun (lhs, rhs) ->
245
- debug_log "Assignment: %a = %a@," HilExp.AccessExpression.pp lhs EdgeExp.ValuePair.pp rhs ) ; *)
246
175
let get_assignment lhs_access =
247
176
debug_log " get_assignment: %a@," HilExp.AccessExpression. pp lhs_access ;
248
177
let lhs_access_stripped =
@@ -333,25 +262,6 @@ module EdgeData = struct
333
262
else EdgeExp.AssignmentSet. empty
334
263
in
335
264
(accesses, Some rhs)
336
- (* if
337
- (not (EdgeExp.equal norm rhs_exp))
338
- && AccessExpressionSet.mem access used_assignments
339
- then (
340
- (* debug_log "############ FAIL ###########@,"; *)
341
- (* L.die InternalError "[%a] Edge '%a = %a' assignment previously used " Procname.pp
342
- proc_name HilExp.AccessExpression.pp access EdgeExp.pp rhs *)
343
- L.user_warning
344
- "[%a] Edge '%a = %a' assignment previously used, skipping substitution...@."
345
- Procname.pp proc_name HilExp.AccessExpression.pp access EdgeExp.pp rhs ;
346
- debug_log "Returning rhs: %a@," EdgeExp.pp norm ;
347
- (AccessExpressionSet.empty, Some norm) )
348
- else
349
- let accesses =
350
- if (not (EdgeExp.equal norm rhs)) && not (EdgeExp.is_zero rhs) then
351
- AccessExpressionSet.singleton access
352
- else AccessExpressionSet.empty
353
- in
354
- (accesses, Some rhs) *)
355
265
in
356
266
match rhs with
357
267
| EdgeExp.ValuePair. P (lower_bound , upper_bound ) -> (
0 commit comments