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
135
136
137
138
139
140
/*
* 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 "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 testFloorElimination(Options::UnificationWithAbstraction uwa)
{
auto s = testAlascaState(uwa);
return alascaSimplRule(s,toSgi(FloorElimination(s)), Normalization(s));
}
REGISTER_GEN_TESTER(AlascaGenerationTester<ToSgi<FloorElimination>>(testFloorElimination(UWA_MODE)))
/////////////////////////////////////////////////////////
// Basic tests
//////////////////////////////////////
TEST_GENERATION(basic_success01,
Generation::SymmetricTest()
.inputs ({ clause({ floor(a) == frac(1,2) }) })
.premiseRedundant(true)
.expected(exactly(
clause({ })
))
)
TEST_GENERATION(basic_success02,
Generation::SymmetricTest()
.inputs ({ clause({ floor(a) == frac(-1,2) }) })
.premiseRedundant(true)
.expected(exactly(
clause({ })
))
)
TEST_GENERATION(basic_success03,
Generation::SymmetricTest()
.inputs ({ clause({ 5 * floor(x) == num(4) }) })
.premiseRedundant(true)
.expected(exactly(
clause({ })
))
)
TEST_GENERATION(basic_success04,
Generation::SymmetricTest()
.inputs ({ clause({ p(x), 5 * floor(x) == num(4) }) })
.premiseRedundant(true)
.expected(exactly(
clause({ p(x) })
))
)
TEST_GENERATION(basic_fail01,
Generation::SymmetricTest()
.inputs ({ clause({ floor(a) == frac(1,1) }) })
.premiseRedundant(false)
.expected(exactly(
/* nothing */
))
)
TEST_GENERATION(basic_fail02,
Generation::SymmetricTest()
.inputs ({ clause({ floor(a) == frac(1,1) + b }) })
.premiseRedundant(false)
.expected(exactly(
/* nothing */
))
)
TEST_GENERATION(basic_fail03,
Generation::SymmetricTest()
.inputs ({ clause({ 2 *floor(a) == num(4) }) })
.premiseRedundant(false)
.expected(exactly(
/* nothing */
))
)
TEST_GENERATION(basic_fail04,
Generation::SymmetricTest()
.inputs ({ clause({ floor(a) + floor(b) == frac(1,1) }) })
.premiseRedundant(false)
.expected(exactly(
/* nothing */
))
)