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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
* This file is part of the source code of the software program
* Vampire. It is protected by applicable
* copyright laws.
*
* This source code is distributed under the licence found here
* https://vprover.github.io/license.html
* and in the source directory
*/
#include "Inferences/ALASCA/Normalization.hpp"
#include "Inferences/ALASCA/Abstractions.hpp"
#include "Test/SyntaxSugar.hpp"
#include "Test/SyntaxSugar.hpp"
#include "Test/GenerationTester.hpp"
#include "Test/AlascaTestUtils.hpp"
using namespace std;
using namespace Kernel;
using namespace Inferences;
using namespace Test;
using namespace Indexing;
using namespace Inferences::ALASCA;
#define INT_TESTS 0
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
////// TEST CASES
/////////////////////////////////////
#define SUGAR(Num) \
NUMBER_SUGAR(Num) \
\
DECL_DEFAULT_VARS \
\
DECL_FUNC(f, {Num}, Num) \
DECL_FUNC(f2, {Num,Num}, Num) \
DECL_FUNC(g, {Num}, Num) \
DECL_FUNC(h, {Num}, Num) \
\
DECL_CONST(a, Num) \
DECL_CONST(b, Num) \
DECL_CONST(c, Num) \
\
DECL_PRED(p, {Num}) \
DECL_PRED(r, {Num,Num}) \
\
auto isInteger = [&](auto t) { return t == floor(t); }; \
#define MY_SYNTAX_SUGAR SUGAR(Real)
#define UWA_MODE Options::UnificationWithAbstraction::ALASCA_MAIN
inline auto testAbstraction(Options::UnificationWithAbstraction uwa)
{
auto s = testAlascaState(uwa);
return alascaSimplRule(s,toSgi(Abstraction<RealTraits>(s)), Normalization(s));
}
REGISTER_GEN_TESTER(AlascaGenerationTester<ToSgi<Abstraction<RealTraits>>>(testAbstraction(UWA_MODE)))
/////////////////////////////////////////////////////////
// Basic tests
//////////////////////////////////////
#define UNSTABILITY_ABSTRACTION 0
#if UNSTABILITY_ABSTRACTION
TEST_GENERATION(stabilizing_1,
Generation::SymmetricTest()
.inputs ({ clause({ 0 != x + f(f2(x,y) - f2(x, a)) }) })
.premiseRedundant(true)
.expected(exactly(
clause({ 0 != -z + f2(x,y) - f2(x, a), 0 != x + f(z) })
))
)
TEST_GENERATION(stabilizing_2,
Generation::SymmetricTest()
.inputs ({ clause({ x + a > 0, 0 != f(f2(x,y) - f2(x, a)) }) })
.premiseRedundant(true)
.expected(exactly(
clause({ 0 != -z + f2(x,y) - f2(x, a), x + a > 0, 0 != f(z) })
))
)
TEST_GENERATION(stabilizing_3,
Generation::SymmetricTest()
.inputs ({ clause({ 0 != x + f(f(f2(x,y) - f2(x, a)) - f(x)) }) })
.premiseRedundant(true)
.expected(exactly(
clause({ 0 != -z + f(f2(x,y) - f2(x, a)) - f(x), 0 != x + f(z) })
))
)
#endif // UNSTABILITY_ABSTRACTION
TEST_GENERATION(coherence_1,
Generation::SymmetricTest()
.inputs ({ clause({ p(floor(y)) }) })
.premiseRedundant(true)
.expected(exactly(
clause({ 0 != -z + floor(y), p(z) })
))
)
TEST_GENERATION(coherence_2,
Generation::SymmetricTest()
.inputs ({ clause({ p(floor(frac(1,2) * floor(y))) }) })
.premiseRedundant(true)
.expected(exactly(
clause({ 0 != -z + floor(frac(1,2) * floor(y)), p(z) })
))
)
TEST_GENERATION(coherence_3,
Generation::SymmetricTest()
.inputs ({ clause({ p(floor(2 * y + a) + b) }) })
.premiseRedundant(true)
.expected(exactly(
clause({ 0 != -z + floor(2 * y + a), p(z + b) })
))
)
TEST_GENERATION(coherence_4,
Generation::SymmetricTest()
.inputs ({ clause({ p(2 * x + a + b) }) })
.premiseRedundant(false)
.expected(exactly(
/* nothing */
))
)