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
82
83
/*++
Copyright (c) 2022 Microsoft Corporation
Module Name:
solve_eqs_tactic.h
Abstract:
Tactic for solving variables
Author:
Nikolaj Bjorner (nbjorner) 2022-10-30
Tactic Documentation:
## Tactic solve-eqs
### Short Description
Solve for variables
### Long Description
The tactic eliminates variables that can be brought into solved form.
For example, the assertion `x = f(y + z)` can be solved for `x`, replacing `x`
everywhere by `f(x + y)`. It depends on a set of theory specific equality solvers
* Basic equations
* equations between uninterpreted constants and terms.
* equations written as `(if p (= x t) (= x s))` are solved as `(= x (if p t s))`.
* asserting `p` or `(not p)` where `p` is uninterpreted, causes `p` to be replaced by `true` (or `false`).
* Arithmetic equations
* It solves `x mod k = s` to `x = k * m' + s`, where m'` is a fresh constant.
* It finds variables with unit coefficients in integer linear equations.
* It solves for `x * Y = Z` under the side-condition `Y != 0` as `x = Z/Y`.
It also allows solving for uninterpreted constants that only appear in a single disjuction. For example,
`(or (= x (+ 5 y)) (= y (+ u z)))` allows solving for `x`.
### Example
```
(declare-const x Int)
(declare-const y Int)
(declare-const z Int)
(declare-const u Int)
(assert (or (and (= x (+ 5 y)) (> u z)) (= y (+ u z))))
(apply solve-eqs)
```
It produces the goal
```
(goal
(or (not (<= u z)) (= y (+ u z)))
:precision precise :depth 1)
```
where `x` was solved as `(+ 5 y)`.
### Notes
* supports unsat cores
* supports fine-grained proofs for direct variable equalities and Boolean units
* theory-specific, conditional, and nested-equation extraction are skipped when producing proofs
--*/
inline tactic *
;
;