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
/*++
Copyright (c) 2022 Microsoft Corporation
Module Name:
propagate_values2_tactic.h
Author:
Nikolaj Bjorner (nbjorner) 2022-11-24
Tactic Documentation:
## Tactic propagate-values
### Short Description:
Tactic for propagating equalities `(= t v)` where `v` is a value
### Long Description
In a context where terms are equated to constants it is invariably beneficial to
replace terms, that can be compound, with the constants and then simplify the resulting formulas.
The propagate-values tactic accomplishes the task of replacing such terms.
### Example
```z3
(declare-const x Int)
(declare-const y Int)
(declare-fun f (Int) Int)
(assert (= 1 (f (+ x y))))
(assert (= 2 x))
(assert (> (f (+ 2 y)) y))
(apply propagate-values)
```
### Notes
* supports unsat cores
--*/
#pragma once
#include "util/params.h"
#include "tactic/tactic.h"
#include "tactic/dependent_expr_state_tactic.h"
#include "ast/simplifiers/propagate_values.h"
#include "ast/simplifiers/dependent_expr_state.h"
inline tactic * mk_propagate_values2_tactic(ast_manager & m, params_ref const & p = params_ref()) {
return alloc(dependent_expr_state_tactic, m, p,
[](auto& m, auto& p, auto &s) -> dependent_expr_simplifier* { return alloc(propagate_values, m, p, s); });
}
Z3_ADD_TACTIC(propagate_values2, "propagate-values2", "propagate constants.", mk_propagate_values2_tactic(m, p));
Z3_ADD_SIMPLIFIER(propagate_values, "propagate-values", "propagate constants.", alloc(propagate_values, m, p, s));