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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*++
Copyright (c) 2011 Microsoft Corporation
Module Name:
tseitin_cnf_tactic.h
Abstract:
Author:
Leonardo (leonardo) 2011-12-29
Tactic Documentation:
## Tactic tseitin-cnf
### Short Description
Convert goal into CNF using tseitin-like encoding (note: quantifiers are ignored).
### Long Description
Puts an assertion set in CNF.
Auxiliary variables are used to avoid blowup.
Features:
- Efficient encoding is used for commonly used patterns such as:
`(iff a (iff b c))`
`(or (not (or a b)) (not (or a c)) (not (or b c)))`
- Efficient encoding is used for chains of if-then-elses
- Distributivity is applied to non-shared nodes if the blowup is acceptable.
- The features above can be disabled/enabled using parameters.
- The assertion-set is only modified if the resultant set of clauses is "acceptable".
Notes:
- Term-if-then-else expressions are not handled by this strategy.
This kind of expression should be processed by other strategies.
- Quantifiers are treated as "theory" atoms. They are viewed
as propositional variables by this strategy.
- The assertion set may contain free variables.
- This strategy assumes the assertion_set_rewriter was used before invoking it.
In particular, it is more effective when "and" operators
were eliminated.
### Example
```z3
(declare-const a Bool)
(declare-const b Bool)
(declare-const c Bool)
(assert (= a (= b c)))
(apply tseitin-cnf)
```
--*/
#pragma once
#include "util/params.h"
#include "tactic/tactic.h"
class ast_manager;
class tactic;
tactic * mk_tseitin_cnf_core_tactic(ast_manager & m, params_ref const & p = params_ref());
tactic * mk_tseitin_cnf_tactic(ast_manager & m, params_ref const & p = params_ref());
Z3_ADD_TACTIC(tseitin_cnf, "tseitin-cnf", "convert goal into CNF using tseitin-like encoding (note: quantifiers are ignored).", mk_tseitin_cnf_tactic(m, p));
Z3_ADD_TACTIC(tseitin_cnf_core, "tseitin-cnf-core", "convert goal into CNF using tseitin-like encoding (note: quantifiers are ignored). This tactic does not apply required simplifications to the input goal like the tseitin-cnf tactic.", mk_tseitin_cnf_core_tactic(m, p));