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
/*++
Copyright (c) 2011 Microsoft Corporation
Module Name:
nnf_tactic.h
Abstract:
NNF tactic
Author:
Leonardo de Moura (leonardo) 2011-12-28.
Note:
tactic documentation below co-created using gptchat (with some corrections) :-)
Tactic Documentation:
## Tactic nnf
### Short Description:
The tactic converts formulas to negation normal form (NNF)
### Long Description
In NNF, negations only appear in front of atomic formulas.
Standard rules for conversion into negation normal form are:
- `(not (and p q))` is converted to `(or (not p) (not q))`
- `(not (or p q))` is converted to `(and (not p) (not q))`
- `(not (not p))` is converted to `p`
- `(not (exists x. p))` is converted to `(forall x. (not p))`
- `(not (forall x. p))` is converted to `(exists x. (not p))`
Once all negations are pushed inside, the resulting formula is in NNF.
### Example
```z3
(declare-const x Int)
(assert (not (or (> x 0) (< x 0))))
(apply nnf)
```
### Notes
* supports unsat cores, proof terms
--*/
#pragma once
#include "util/params.h"
#include "tactic/tactic.h"
class ast_manager;
class tactic;
tactic * mk_snf_tactic(ast_manager & m, params_ref const & p = params_ref());
tactic * mk_nnf_tactic(ast_manager & m, params_ref const & p = params_ref());
Z3_ADD_TACTIC(snf, "snf", "put goal in skolem normal form.", mk_snf_tactic(m, p));
Z3_ADD_TACTIC(nnf, "nnf", "put goal in negation normal form.", mk_nnf_tactic(m, p));