|
1 | | -function get_normalized_form(formula::String) |
2 | | - get_conjunctive_normal_form( |
3 | | - get_removed_quantifier_form( |
4 | | - get_skolem_normal_form( |
5 | | - get_prenex_normal_form( |
6 | | - get_quantified_variables_form( |
7 | | - get_renamed_quantifiers_form( |
8 | | - Formula(formula))))))) |
9 | | -end |
10 | | - |
11 | 1 | function testsatisfiability(formula, issatisfiable; maxsearchdepth=5) |
12 | 2 | if issatisfiable == false |
13 | 3 | @customtest is_satisfiable(formula, maxsearchdepth=maxsearchdepth) == false |
|
18 | 8 |
|
19 | 9 | @testset "is_satisfiable" begin |
20 | 10 | # Basic tests, easy to verify by hand. |
21 | | - testsatisfiability(get_normalized_form("P(x) & ~P(x)"), false) |
22 | | - testsatisfiability(get_normalized_form("P(x) & ~P(y)"), true) |
23 | | - testsatisfiability(get_normalized_form("(P(x) & ~P(y)) & (~P(x) & P(y))"), false) |
24 | | - testsatisfiability(get_normalized_form("(P(x) & ~P(y)) | (C(y) & ~C(y))"), true) |
25 | | - testsatisfiability(get_normalized_form("A() & (B() | ~C()) & ~B() & C()"), false) |
26 | | - testsatisfiability(get_normalized_form("*{x}(P(x) & ~P(f(x)))"), false) |
27 | | - testsatisfiability(get_normalized_form("(S(x,p) | G(p)) & (~L(x) | G(p)) & (~S(x,p)) & (~G(p))"), false) |
28 | | - testsatisfiability(get_normalized_form("(S(x,p) | G(p)) & (~L(x) | G(p))"), true) |
| 11 | + testsatisfiability("P(x) & ~P(x)", false) |
| 12 | + testsatisfiability("P(x) & ~P(y)", true) |
| 13 | + testsatisfiability("(P(x) & ~P(y)) & (~P(x) & P(y))", false) |
| 14 | + testsatisfiability("(P(x) & ~P(y)) | (C(y) & ~C(y))", true) |
| 15 | + testsatisfiability("A() & (B() | ~C()) & ~B() & C()", false) |
| 16 | + testsatisfiability("*{x}(P(x) & ~P(f(x)))", false) |
| 17 | + testsatisfiability("(S(x,p) | G(p)) & (~L(x) | G(p)) & (~S(x,p)) & (~G(p))", false) |
| 18 | + testsatisfiability("(S(x,p) | G(p)) & (~L(x) | G(p))", true) |
29 | 19 |
|
30 | 20 | # Test based on "Logik für Informatiker", exercise 76. |
31 | 21 | testsatisfiability(CNF([ |
|
36 | 26 | ]), false) |
37 | 27 |
|
38 | 28 | # Test based on "Logik für Informatiker", exercise 76. |
39 | | - testsatisfiability(get_normalized_form("((~*{x}(~S(x, p) | L(x))) | G(p)) & ((~?{x}S(x,p)) & (~G(p)))"), false) |
| 29 | + testsatisfiability("((~*{x}(~S(x, p) | L(x))) | G(p)) & ((~?{x}S(x,p)) & (~G(p)))", false) |
40 | 30 |
|
41 | 31 | # Test based on "Logik für Informatiker", exercise 76. |
42 | | - testsatisfiability(get_normalized_form("((~*{x}(~S(x, p) | L(x))) | G(p)) & ((~?{x}S(x,p)) & (G(p)))"), true) |
| 32 | + testsatisfiability("((~*{x}(~S(x, p) | L(x))) | G(p)) & ((~?{x}S(x,p)) & (G(p)))", true) |
43 | 33 |
|
44 | 34 | # Test based on "Logik für Informatiker", exercise 80. |
45 | 35 | testsatisfiability(CNF([ |
|
0 commit comments