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
/*++
Copyright (c) 2013 Microsoft Corporation
Module Name:
lia2card_tactic.h
Author:
Nikolaj Bjorner (nbjorner) 2013-11-5
Tactic Documentation:
## Tactic lia2card
### Short Description
Extract 0-1 integer variables used in
cardinality and pseudo-Boolean constraints and replace them by Booleans.
### Example
```z3
(declare-const x Int)
(declare-const y Int)
(declare-const z Int)
(assert (<= 0 x))
(assert (<= 0 y))
(assert (<= 0 z))
(assert (>= 1 x))
(assert (>= 1 y))
(assert (>= 1 z))
(assert (>= (+ (* 5 x) (* -2 z) (* 3 y) 1) 4))
(apply lia2card)
```
### Notes
* The tactic does not (properly) support proofs or cores.
--*/
#pragma once
#include "util/params.h"
#include "tactic/tactic.h"
class ast_manager;
class tactic;
tactic * mk_lia2card_tactic(ast_manager & m, params_ref const & p = params_ref());
Z3_ADD_TACTIC(lia2card, "lia2card", "introduce cardinality constraints from 0-1 integer.", mk_lia2card_tactic(m, p));
bool get_pb_sum(expr* term, expr_ref_vector& args, vector<rational>& coeffs, rational& coeff);