Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subsumption and Subsumption Resolution via SAT solving #546

Open
wants to merge 546 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
546 commits
Select commit Hold shift + click to select a range
a2d7f13
Remove old impl, move v3 into separate file
JakobR Feb 17, 2022
c79666e
use unused variable
JakobR Feb 17, 2022
6b3a631
minor tweaks
JakobR Feb 17, 2022
a154f0b
Extract BindingsManager
JakobR Feb 17, 2022
063dc92
Remove minisat
JakobR Feb 17, 2022
bdcd2bd
token
JakobR Feb 17, 2022
07ba33c
cache bindings
JakobR Feb 17, 2022
40022ae
seems to work
JakobR Feb 19, 2022
7cb7df6
don't leak
JakobR Feb 19, 2022
2ebcfbf
bugfix and make it testable
JakobR Feb 20, 2022
58f6853
wtf
JakobR Feb 20, 2022
3c513b0
includes for gcc
JakobR Feb 20, 2022
3c54935
warnings
JakobR Feb 20, 2022
071b259
gcc compile error
JakobR Feb 20, 2022
adf461f
hmm
JakobR Feb 20, 2022
0def54e
warning
JakobR Feb 20, 2022
7f4e014
gcc compile error
JakobR Feb 20, 2022
d6de884
tweaks
JakobR Feb 20, 2022
e7449d1
do first run without setup
JakobR Feb 20, 2022
f741f86
minor tweak: we don't *always* need to clear the solver
JakobR Feb 20, 2022
ed817f1
there's a stupid bug in the slogs but I have no idea what it is :(
JakobR Feb 20, 2022
561a461
correct the resLitIdx before logging
JakobR Feb 20, 2022
37fb509
update slog parser
JakobR Feb 21, 2022
bae5726
slog fix
JakobR Feb 21, 2022
b4aa03a
measure orig_setup
JakobR Feb 21, 2022
cc317e2
more faithful MLMatcher usage
JakobR Feb 21, 2022
ea42c90
properly skip of already-handled instances
JakobR Feb 21, 2022
05d2845
don't check S/SR in release mode
JakobR Feb 22, 2022
22a823a
slight optimization
JakobR Feb 23, 2022
cf4a030
remove comment
JakobR Feb 23, 2022
4ba46bc
do less runs
JakobR Feb 23, 2022
3c51fa9
try shorter clause (or rather, an exactly-one constraint)
JakobR Feb 24, 2022
37d03ed
do another run with S enabled
JakobR Feb 26, 2022
6483620
fix
JakobR Feb 26, 2022
675bbd7
minor
JakobR May 1, 2022
9fc9fcb
wip
JakobR May 1, 2022
75eaaec
ok this probably isn't going to change much for us
JakobR May 1, 2022
6dee16c
add setting to allow disabling solver reuse
JakobR May 16, 2022
adcfea5
disable solver reuse for test
JakobR May 16, 2022
d28abc1
no need to re-run orig here
JakobR May 16, 2022
4e820bb
re-enable solver reuse so I don't forget later
JakobR May 16, 2022
c9c7e6f
try vmtf
JakobR May 18, 2022
da18f21
again, we don't need to re-run orig
JakobR May 18, 2022
22040dc
rename folder
JakobR May 21, 2022
4a57c4c
remove wrong license comment; old files
JakobR May 21, 2022
d118b31
undo temporary changes
JakobR May 21, 2022
89239db
remove more outdated code
JakobR Jul 29, 2022
1e759fc
comments
JakobR Jul 29, 2022
25a2f4d
benchmark SAT vs. UNSAT
JakobR Jul 30, 2022
5c1624f
try to decide unknowns
JakobR Jul 31, 2022
c5bc381
now the real benchmark
JakobR Aug 1, 2022
1a41dac
enable regular benchmark again
JakobR Aug 2, 2022
6db109a
noreuse
JakobR Aug 3, 2022
8b5363a
vmtf
JakobR Aug 3, 2022
f28a668
default cfg
JakobR Aug 3, 2022
e1fe48b
Apply clang-format
JakobR Oct 10, 2022
1db2c2e
Merge branch 'master' into sat-subsumption
JakobR Oct 13, 2022
d74793b
fix
JakobR Oct 13, 2022
e6696a5
make sure the default copy/move constructors are generated
JakobR Oct 13, 2022
e73b676
Rename files (SMT -> SAT)
JakobR Oct 14, 2022
1f6f8d5
Replace SMT -> SAT
JakobR Oct 14, 2022
5ba66a9
More replacements
JakobR Oct 14, 2022
211879f
First implementation of subsumption resolution
RobCoutel Oct 14, 2022
169adcc
update interface, impl second encoding, impr doc
RobCoutel Oct 16, 2022
8614280
Included Jakob's subsumption
RobCoutel Oct 17, 2022
d7a09a8
Fixes on Subsumption + efficiency of matching
RobCoutel Oct 18, 2022
a42434c
Fixed the bug seen by micheal
RobCoutel Oct 18, 2022
8ef5a1c
update ForwardInterface, improve sat speed
RobCoutel Oct 20, 2022
1c07f60
buggy version for Micheal
RobCoutel Oct 20, 2022
539618b
Forward subsumption with sat approach
RobCoutel Oct 20, 2022
c01f769
Slight performance increase
RobCoutel Oct 21, 2022
334db30
Pre-fill the match set when doing subsumption
RobCoutel Oct 21, 2022
ce2fb14
Reduce the number of clause tested
RobCoutel Oct 24, 2022
61f70a1
Make it faster with hashmaps
RobCoutel Oct 24, 2022
adf88cd
Cleaning some code + fix minor bug
RobCoutel Oct 24, 2022
ffd8cf1
Fix log namespace conflict
RobCoutel Oct 25, 2022
4a2b614
First try at chain resolution
RobCoutel Oct 25, 2022
30144ad
commit to merge master on this branch
RobCoutel Oct 28, 2022
53bd6ba
Merge remote-tracking branch 'origin/sat-subsumption' into robin_c-su…
RobCoutel Oct 28, 2022
6659044
Merge remote-tracking branch 'origin/master' into robin_c-subsumption…
RobCoutel Oct 28, 2022
a704570
Still fails an assertion
RobCoutel Oct 31, 2022
efe993d
fix wrong #if #else
RobCoutel Oct 31, 2022
1e591f2
fix an option problem
RobCoutel Oct 31, 2022
f3c551e
Added the separate loops + stats
RobCoutel Nov 6, 2022
f2f40e0
fixes on the backward method
RobCoutel Nov 6, 2022
1d8f6d0
clean + more tests
RobCoutel Nov 6, 2022
a104848
buggy code for Micheal
RobCoutel Nov 8, 2022
bb8ba88
fix the bug of allocation
RobCoutel Nov 8, 2022
09bb106
First benchmarking method
RobCoutel Nov 10, 2022
1c91f73
Implement benchmarking procedure
RobCoutel Nov 10, 2022
90d1c68
fixing the problem with option 2
RobCoutel Nov 10, 2022
f7de096
clean up
RobCoutel Nov 10, 2022
9132a4b
Benchmarking version (cleaned, ready for optimization)
RobCoutel Nov 15, 2022
f4ed676
keeping the variables and bindings between sub and sr
RobCoutel Nov 16, 2022
7fa43bb
Fix compilation on macOS
JakobR Nov 16, 2022
add9e53
Explicitly specify namespace in macro
JakobR Nov 16, 2022
e38fd64
Fix allocator use in subsat::decision_queue
JakobR Nov 16, 2022
a1764ac
cmake's "option" only supports boolean values; use "set" instead
JakobR Nov 16, 2022
d81b9c7
Fix subsat::clear_constraints with VDOM heuristic
JakobR Nov 16, 2022
5f35005
Added some pruning
RobCoutel Nov 18, 2022
cc91eee
clean up + update documentation
RobCoutel Nov 18, 2022
1a8110e
optimisations - hopefully no bugs
MichaelRawson Nov 23, 2022
fad3021
make unit tests compile
MichaelRawson Nov 23, 2022
13d1f16
find a way to express Robin's original implementation: should now be …
MichaelRawson Nov 24, 2022
9aeb3b8
the literal thing
MichaelRawson Nov 24, 2022
84f9bd2
add time correlation measures (disabled)
RobCoutel Dec 21, 2022
276e0de
modify the wrapping of correlation measurement
RobCoutel Dec 23, 2022
c1ebe2d
compile
JakobR Dec 23, 2022
40f9361
Print configuration with --version
JakobR Dec 23, 2022
e9b2b6d
Remove google benchmark submodule
JakobR Dec 23, 2022
ce7d410
fixed a bug in backward mode
RobCoutel Dec 29, 2022
fe6c056
resize _jStates as necessary
MichaelRawson Jan 3, 2023
8a4ef45
small fix for heat maps
RobCoutel Jan 13, 2023
587d201
Merge branch 'master' into robin_c-subsumption_resolution
RobCoutel Feb 25, 2023
7d8d8cc
fix the merge but adding the include
RobCoutel Feb 25, 2023
8d5b6db
deactivate chaining
RobCoutel Feb 25, 2023
66e8f0c
remove the chaining of subsumption resolution
RobCoutel Feb 25, 2023
16bc9e8
fix the nullary symbol problem
RobCoutel Feb 25, 2023
a6ade3d
clean up
RobCoutel Feb 25, 2023
16df2fa
small fixes and code clean up
RobCoutel Oct 23, 2023
ee31810
Merge remote-tracking branch 'origin/master' into robin_c-subsumption…
RobCoutel Oct 23, 2023
7d9f816
enable choosing between the encodings
RobCoutel Oct 27, 2023
0dbd005
Remove allocator template argument from subsat solver
JakobR Nov 22, 2023
d7bd8ef
Appease the compiler
JakobR Nov 22, 2023
f232570
Remove obsolete CLASS_NAME
JakobR Nov 22, 2023
e14d921
Get rid of SolverWrapper
JakobR Nov 22, 2023
36bfc91
Remove obsolete BYPASSING_ALLOCATOR
JakobR Nov 22, 2023
0366489
Merge remote-tracking branch 'origin/master' into jakob-sat-sr
JakobR Nov 22, 2023
b2dd172
Minor fixes
JakobR Nov 22, 2023
453d107
Reoganize the Benchmarking system.
RobCoutel Nov 28, 2023
79c15b4
Merge remote-tracking branch 'origin/robin_c-subsumption_resolution' …
JakobR Nov 28, 2023
0aafbac
optimize loop at runtime
RobCoutel Dec 12, 2023
611bc53
fixed the benchmarks not creating data for training
RobCoutel Dec 13, 2023
3cf26ee
Split unit propagation
JakobR Dec 13, 2023
6ce499d
Count ticks during propagation
JakobR Dec 13, 2023
eb95cbb
Count ticks during conflict analysis
JakobR Dec 13, 2023
e57a616
Initialize satSubs only once
JakobR Dec 15, 2023
ad56cb0
Fix warnings
JakobR Dec 15, 2023
fbba4e4
Log SAT solver ticks
JakobR Dec 15, 2023
5787db8
Move globals into object, do not use std::vector<bool>
JakobR Dec 15, 2023
dcec2fb
Minor refactor
JakobR Dec 15, 2023
f6bfa50
TPTPPrinter: add method to print a literal as if it were a unit clause
JakobR Dec 15, 2023
10e7ecd
Add 'sbench' mode
JakobR Dec 15, 2023
fc0121c
Add ForwardSubsumptionLogger
JakobR Dec 15, 2023
cb728e3
Log subsumption and subsumption resolution calls
JakobR Dec 15, 2023
5f4b36d
Parse subsumption logs
JakobR Dec 15, 2023
58c7094
Fix uninitialized clause idx
JakobR Dec 15, 2023
c2d7b06
two levels of SAT solver statistics
JakobR Dec 18, 2023
e2fc2d5
Print subsat config in --version
JakobR Dec 18, 2023
cdb64e8
Rename sbench -> sreplay
JakobR Dec 18, 2023
392a4c5
Log more SAT stats
JakobR Dec 18, 2023
0289083
Print all(?) SAT-SR-related compile options in --version
JakobR Dec 18, 2023
9a80762
Disable clause logging by default
JakobR Dec 18, 2023
a99a7f3
Merge branch 'master' into jakob-sat-sr
JakobR Dec 19, 2023
a84bb90
no need for explicit destructor definition
JakobR Dec 19, 2023
3fb1d08
limits
JakobR Dec 19, 2023
bfb954e
also print names of compile config vars
JakobR Dec 19, 2023
db9dc6b
fix
JakobR Dec 19, 2023
e73b094
fix warning?
JakobR Dec 19, 2023
64fb68a
Log subsumption stats, and include result
JakobR Dec 19, 2023
a9ed303
reduce output
JakobR Dec 19, 2023
d2d2cca
damn
JakobR Dec 19, 2023
abfce41
only log the big ones
JakobR Dec 19, 2023
3dfb800
clock info
JakobR Jan 2, 2024
21e8597
Use steady_clock for benchmarking
JakobR Jan 2, 2024
5ecbf1a
Merge branch 'master' into jakob-sat-sr
JakobR Jan 2, 2024
015516e
Flush after each line and defer timeouts while printing
JakobR Jan 2, 2024
f6579e2
We need the original, non-normalized literal
JakobR Jan 2, 2024
09d1b34
let's be explicit about the units we use for time
JakobR Jan 2, 2024
dff855c
fix for CORRELATE_LENGTH_TIME=0
JakobR Jan 2, 2024
8315373
Keep order of checks as they appear in the logfile
JakobR Jan 3, 2024
48e83c1
Extract configuration name
JakobR Jan 3, 2024
b4b1e9c
Implement subsumption replay mode
JakobR Jan 3, 2024
211f0d4
fw subsumption rounds
JakobR Jan 3, 2024
35149b2
add cmake options
JakobR Jan 3, 2024
652b483
typo
JakobR Jan 4, 2024
b33b40e
log sparsity again (now via number of matches)
JakobR Jan 10, 2024
1acdd38
remove filtering
JakobR Jan 10, 2024
15988f0
update the heuristic
Jan 11, 2024
7472fd4
update heuristic again
JakobR Jan 11, 2024
e147cbd
flush output
JakobR Jan 11, 2024
83b5b24
clarifying comments
JakobR Jan 11, 2024
201fc24
disable logging in the oracle
JakobR Jan 11, 2024
00b562e
fence off clock operations
JakobR Jan 11, 2024
90cec00
don't round duration
JakobR Jan 11, 2024
7c2dc60
pruneSubsumptionResolution: reset vector less often
JakobR Jan 12, 2024
02406cc
reduce resets in pruneSubsumption, use same vector for both prunings
JakobR Jan 12, 2024
d511789
skip max_timestamp computation
JakobR Jan 12, 2024
f2d236f
don't touch statistics in oracle
JakobR Jan 14, 2024
84c5f66
rounds also for no_sat
JakobR Jan 15, 2024
6cf2a79
update decision tree
JakobR Jan 17, 2024
102789e
bug in replay
JakobR Jan 17, 2024
9986ce8
add cutoff option
JakobR Jan 18, 2024
b604bff
Add optional max_ticks limit
JakobR Jan 18, 2024
bc1bdab
implement cutoff for s/sr
JakobR Jan 18, 2024
f88b0e8
report number of cutoffs
JakobR Jan 18, 2024
f1b9ee4
Add pruning stats
Jan 19, 2024
4a9c661
fix
JakobR Jan 19, 2024
ddfecd9
Merge branch 'jakob-sat-sr' into robin_c-subsumption_resolution
Feb 23, 2024
7975a6f
bug in the test
Mar 22, 2024
afd4652
improved the indirect encodign by removing c_j encoding one single b_ij-
Apr 17, 2024
da31ae2
Merge remote-tracking branch 'origin/HEAD' into robin_c-subsumption_r…
Apr 17, 2024
4dc9408
fixed the compilation errors
Apr 17, 2024
8f2607e
remove all benchmarking code
Apr 19, 2024
ee9379f
reverse some of the formating changes
Apr 19, 2024
3f2d46b
forgot to remove one option
Apr 19, 2024
40fe242
improved the documentation
Apr 19, 2024
fd6fa06
add the missing headers
Apr 19, 2024
e732f12
remove extra line cause checks to crash
Apr 22, 2024
3cefe51
implement revisions suggested by Michael
Apr 24, 2024
1da80d5
Update Makefile
JakobR May 17, 2024
9bb2b00
Rename iterator base class
JakobR May 17, 2024
e63c9fc
Add comments
JakobR May 17, 2024
c639133
Remove unused includes
JakobR May 17, 2024
3bc6029
BackwardSubsumptionAndResolution cleanup
JakobR May 17, 2024
92400b5
restore 'const'
JakobR May 17, 2024
771f051
update comment
JakobR May 17, 2024
215dbbc
change according to review
JakobR May 17, 2024
8f73972
Initialize MLMatcher::m_impl in the constructor
JakobR May 17, 2024
d533d52
Add comment on noexcept clause
JakobR May 17, 2024
506be0f
Remove .gitignore in subfolder
JakobR May 17, 2024
6812c9c
Remove USE_ALLOCATOR
JakobR May 17, 2024
ba5d0bc
Remove non-Vampire definitions
JakobR May 17, 2024
5400b5b
Move isAdditionOverflow into Lib/Int.hpp
JakobR May 17, 2024
fd4d37d
Extract Slice into separate file
JakobR May 17, 2024
6620c12
Remove #define from header
JakobR May 17, 2024
807a81d
Remove pre-C++17 versions
JakobR May 17, 2024
00c7fcc
Proper [[nodiscard]]
JakobR May 17, 2024
719a07c
Only include when logging enabled
JakobR May 17, 2024
6ea8be3
Move comment to the top
JakobR May 17, 2024
a116537
Remove clock info output
JakobR May 17, 2024
f5d72e5
Remove unimplemented functions
JakobR May 17, 2024
a0c4d62
Remove 'preprocess_very_lightly'
JakobR May 17, 2024
0e21bad
inline SUBSAT_LEARN=1
JakobR May 17, 2024
fae9285
Inline SUBSAT_SIMPLIFY_CLAUSES=1 SUBSAT_SIMPLIFY_AMOS=1
JakobR May 17, 2024
7abc658
Inline SUBSAT_MINIMIZE=0
JakobR May 17, 2024
5b44e19
Inline SUBSAT_PHASE_SAVING=0
JakobR May 17, 2024
5e1762b
Set SUBSAT_EXPENSIVE_ASSERTIONS=0
JakobR May 17, 2024
f5fd1de
Match::operator<<
JakobR May 17, 2024
531b854
Use Vampire-style assertions
JakobR May 17, 2024
f1f33e1
Restore Statistics.cpp from master branch
JakobR May 17, 2024
beca034
Merge branch 'master' into robin_c-sat-s-sr-for-master
quickbeam123 May 20, 2024
bcd55ee
prevent the following: SATSubsumption/subsat/././subsat_config.hpp:18…
quickbeam123 May 20, 2024
59b780f
Move standalone subsat into the main CMakeLists.txt
JakobR May 21, 2024
8b9bd4e
Get rid of the SUBSAT_STANDALONE flag
JakobR May 21, 2024
62aaa35
Disable SAT solver statistics by default
JakobR May 21, 2024
a4f7188
Simplify Constraint::header_bytes
JakobR May 21, 2024
4f56e29
Remove both extra_i and extra_j
JakobR May 21, 2024
172a2bd
Restore subsumption (resolution) statistics
JakobR May 21, 2024
1f42144
Remove the now-unused EncodingMethod type
JakobR May 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
@@ -1,3 +1,6 @@
[submodule "benchmark"]
path = benchmark
url = https://github.com/google/benchmark.git
MichaelRawson marked this conversation as resolved.
Show resolved Hide resolved
[submodule "z3"]
path = z3
url = https://github.com/Z3Prover/z3
33 changes: 27 additions & 6 deletions CMakeLists.txt
Expand Up @@ -385,7 +385,7 @@ source_group(indexing_source_files FILES ${VAMPIRE_INDEXING_SOURCES})
set(VAMPIRE_INFERENCE_SOURCES
JakobR marked this conversation as resolved.
Show resolved Hide resolved
Inferences/BackwardDemodulation.cpp
Inferences/BackwardSubsumptionDemodulation.cpp
Inferences/BackwardSubsumptionResolution.cpp
Inferences/BackwardSubsumptionAndResolution.cpp
Inferences/BinaryResolution.cpp
Inferences/Condensation.cpp
Inferences/DemodulationHelper.cpp
Expand Down Expand Up @@ -417,14 +417,13 @@ set(VAMPIRE_INFERENCE_SOURCES
Inferences/GaussianVariableElimination.cpp
Kernel/Rebalancing.cpp
Kernel/Rebalancing/Inverters.cpp
Inferences/SLQueryBackwardSubsumption.cpp
Inferences/Superposition.cpp
Inferences/TautologyDeletionISE.cpp
Inferences/TermAlgebraReasoning.cpp
Inferences/URResolution.cpp
Inferences/DefinitionIntroduction.cpp
Inferences/BackwardDemodulation.hpp
Inferences/BackwardSubsumptionResolution.hpp
Inferences/BackwardSubsumptionAndResolution.hpp
Inferences/BinaryResolution.hpp
Inferences/Condensation.hpp
Inferences/DemodulationHelper.hpp
Expand Down Expand Up @@ -454,7 +453,6 @@ set(VAMPIRE_INFERENCE_SOURCES
Inferences/GaussianVariableElimination.hpp
Kernel/Rebalancing.hpp
Kernel/Rebalancing/Inverters.hpp
Inferences/SLQueryBackwardSubsumption.hpp
Inferences/SubsumptionDemodulationHelper.cpp
Inferences/Superposition.hpp
Inferences/TautologyDeletionISE.hpp
Expand Down Expand Up @@ -687,6 +685,27 @@ set(VAMPIRE_CASC_SOURCES
)
source_group(casc_source_files FILES ${VAMPIRE_CASC_SOURCES})

set(VAMPIRE_SAT_SUBSUMPTION_SOURCES
SATSubsumption/SATSubsumptionAndResolution.cpp
SATSubsumption/SATSubsumptionAndResolution.hpp

SATSubsumption/subsat/constraint.cpp
SATSubsumption/subsat/constraint.hpp
SATSubsumption/subsat/decision_queue.hpp
SATSubsumption/subsat/default_init_allocator.hpp
SATSubsumption/subsat/log.cpp
SATSubsumption/subsat/log.hpp
SATSubsumption/subsat/subsat.cpp
SATSubsumption/subsat/subsat.hpp
SATSubsumption/subsat/subsat_config.hpp
SATSubsumption/subsat/SubstitutionTheory.hpp
SATSubsumption/subsat/types.cpp
SATSubsumption/subsat/types.hpp
SATSubsumption/subsat/variable_domain_size.hpp
SATSubsumption/subsat/vector_map.hpp
)
source_group(smt_subsumption_source_files FILES ${VAMPIRE_SAT_SUBSUMPTION_SOURCES})

set(VAMPIRE_TESTING_SOURCES
Test/UnitTesting.cpp
Test/UnitTesting.hpp
Expand Down Expand Up @@ -731,6 +750,7 @@ set(UNIT_TESTS
UnitTests/tOption.cpp
UnitTests/tStack.cpp
UnitTests/tSet.cpp
UnitTests/tSATSubsumptionResolution.cpp
UnitTests/tDeque.cpp
UnitTests/tTermAlgebra.cpp
UnitTests/tFunctionDefinitionHandler.cpp
Expand All @@ -745,7 +765,6 @@ set(UNIT_TESTS_Z3
source_group(unit_tests_z3 FILES ${UNIT_TESTS_Z3})



# also include forwards.hpp?
set(VAMPIRE_SOURCES
${VAMPIRE_DEBUG_SOURCES}
Expand All @@ -763,6 +782,7 @@ set(VAMPIRE_SOURCES
${VAMPIRE_SMTCOMP_SOURCES}
${VAMPIRE_MINISAT_SOURCES}
${VAMPIRE_CASC_SOURCES}
${VAMPIRE_SAT_SUBSUMPTION_SOURCES}
Forwards.hpp
"${CMAKE_CURRENT_BINARY_DIR}/version.cpp"
)
Expand Down Expand Up @@ -804,7 +824,7 @@ endif()
################################################################

# find Z3 automatically!
# normally this is just in /z3/build/, but this can be overridden
# normally this is just in /z3/build/, but this can be overridden using -DZ3_DIR
find_package(
Z3
CONFIG
Expand Down Expand Up @@ -852,6 +872,7 @@ else ()
set(UNIT_TESTS ${UNIT_TESTS} ${UNIT_TESTS_Z3})
endif()


################################################################
# build objects
################################################################
Expand Down
12 changes: 12 additions & 0 deletions Indexing/LiteralMiniIndex.cpp
Expand Up @@ -32,6 +32,18 @@ bool LiteralMiniIndex::literalHeaderComparator(const Entry& e1, const Entry& e2)
return e1._header<e2._header || ( e1._header==e2._header && e1._weight<e2._weight );
}

LiteralMiniIndex::LiteralMiniIndex()
: _cnt(0), _entries()
{
}

void LiteralMiniIndex::init(Clause* cl)
{
_cnt = cl->length();
_entries.ensure(cl->length()+1);
init(cl->literals());
}

LiteralMiniIndex::LiteralMiniIndex(Clause* cl)
: _cnt(cl->length()), _entries(cl->length()+1)
{
Expand Down
31 changes: 26 additions & 5 deletions Indexing/LiteralMiniIndex.hpp
Expand Up @@ -31,7 +31,10 @@ class LiteralMiniIndex
{
public:
USE_ALLOCATOR(LiteralMiniIndex);


LiteralMiniIndex();
MichaelRawson marked this conversation as resolved.
Show resolved Hide resolved
void init(Clause* cl);

LiteralMiniIndex(Clause* cl);
LiteralMiniIndex(Literal* const * lits, unsigned length);

Expand All @@ -53,6 +56,7 @@ class LiteralMiniIndex
unsigned _cnt;
DArray<Entry> _entries;

// TODO: name is misleading, because "base" means something different when next to "instance" (IteratorBase would already be better)
JakobR marked this conversation as resolved.
Show resolved Hide resolved
struct BaseIterator
{
BaseIterator(LiteralMiniIndex const& index, Literal* query, bool complementary)
Expand Down Expand Up @@ -102,11 +106,11 @@ class LiteralMiniIndex


struct InstanceIterator
: BaseIterator
{
: BaseIterator {
InstanceIterator(LiteralMiniIndex const& index, Literal* base, bool complementary)
: BaseIterator(index, base, complementary)
{}
: BaseIterator(index, base, complementary)
{
}

bool hasNext()
{
Expand All @@ -120,6 +124,23 @@ class LiteralMiniIndex
}
return false;
}

template <class Binder>
JakobR marked this conversation as resolved.
Show resolved Hide resolved
bool hasNext(Binder& binder)
{
if (_ready) {
return true;
}
while (_curr->_header == _hdr) {
if (MatchingUtils::match(_query, _curr->_lit, _compl, binder)) {
_ready = true;
return true;
}
_curr++;
}
return false;
}

Literal* next()
{
return BaseIterator::next();
Expand Down
204 changes: 204 additions & 0 deletions Inferences/BackwardSubsumptionAndResolution.cpp
@@ -0,0 +1,204 @@
/*
* 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
*/
/**
* @file BackwardSubsumptionAndResolution.cpp
* Implements class BackwardSubsumptionAndResolution.
*/

/**
* The subsumption and subsumption resolution are described in the papers:
* - 2022: "First-Order Subsumption via SAT Solving." by Jakob Rath, Armin Biere and Laura Kovács
* - 2023: "SAT-Based Subsumption Resolution" by Robin Coutelier, Jakob Rath, Michael Rawson and
* Laura Kovács
* - 2024: "SAT Solving for Variants of First-Order Subsumption" by Robin Coutelier, Jakob Rath,
* Michael Rawson, Armin Biere and Laura Kovács
*
* In particular, this file implements the loop optimization described in 2023 and 2024.
*/

#include "Debug/RuntimeStatistics.hpp"

#include "Lib/DArray.hpp"
#include "Lib/DHSet.hpp"
#include "Lib/Environment.hpp"
#include "Lib/List.hpp"
#include "Lib/Metaiterators.hpp"
#include "Lib/VirtualIterator.hpp"

#include "Kernel/Clause.hpp"
#include "Kernel/Matcher.hpp"
#include "Kernel/MLMatcher.hpp"
#include "Kernel/Signature.hpp"
#include "Kernel/Term.hpp"

#include "Indexing/Index.hpp"
#include "Indexing/LiteralIndex.hpp"
#include "Indexing/IndexManager.hpp"

#include "Saturation/SaturationAlgorithm.hpp"

#include "Shell/Statistics.hpp"

#include "ForwardSubsumptionAndResolution.hpp"
#include "BackwardSubsumptionAndResolution.hpp"

#include <chrono>
JakobR marked this conversation as resolved.
Show resolved Hide resolved

namespace Inferences {

using namespace Lib;
using namespace Kernel;
using namespace Indexing;
using namespace Saturation;
using namespace std::chrono;

/***************************************************************/
/* CORE METHODS */
/***************************************************************/
void BackwardSubsumptionAndResolution::attach(SaturationAlgorithm *salg)
{
BackwardSimplificationEngine::attach(salg);
_bwIndex = static_cast<BackwardSubsumptionIndex *>(
_salg->getIndexManager()->request(BACKWARD_SUBSUMPTION_SUBST_TREE)
);
}

void BackwardSubsumptionAndResolution::detach()
{
_bwIndex = 0;
_salg->getIndexManager()->release(BACKWARD_SUBSUMPTION_SUBST_TREE);
BackwardSimplificationEngine::detach();
}


void BackwardSubsumptionAndResolution::perform(Clause *cl,
BwSimplificationRecordIterator &simplifications)
{
ASSERT_VALID(*cl)
ASS(_bwIndex)
simplifications = BwSimplificationRecordIterator::getEmpty();

if (!_subsumption && !_subsumptionResolution) {
return;
}

_checked.reset();

// The set of clauses that are subsumed by cl
static DHSet<Clause *> subsumedSet;
subsumedSet.reset();
// contains the list of simplifications found so far
List<BwSimplificationRecord> *simplificationBuffer = List<BwSimplificationRecord>::empty();

/********************************************************/
/* cl is UNIT */
/********************************************************/
// cl is a unit clause and will subsume all clauses that contain its literal
// and will be resolved with all clauses that contain its negation
if (cl->length() == 1) {
Literal *lit = (*cl)[0];
// Check for the subsumptions
if (_subsumption) {
/***************************************************/
/* SUBSUMPTION UNIT CLAUSE */
/***************************************************/
auto it = _bwIndex->getInstances(lit, false, false);
while (it.hasNext()) {
Clause *icl = it.next().data->clause;
if (!_checked.insert(icl))
continue;
subsumedSet.insert(icl);
List<BwSimplificationRecord>::push(BwSimplificationRecord(icl), simplificationBuffer);
}
}
if (_subsumptionResolution) {
/***************************************************/
/* SUBSUMPTION RESOLUTION UNIT CLAUSE */
/***************************************************/
auto it = _bwIndex->getInstances(lit, true, false);
while (it.hasNext()) {
auto res = it.next();
Clause *icl = res.data->clause;
if (subsumedSet.contains(icl) || !_checked.insert(icl))
continue;
Clause *conclusion = SATSubsumption::SATSubsumptionAndResolution::getSubsumptionResolutionConclusion(icl, res.data->literal, cl);
ASS(conclusion)
List<BwSimplificationRecord>::push(BwSimplificationRecord(icl, conclusion), simplificationBuffer);
}
}
goto finish;
}

if (_subsumptionByUnitsOnly && _srByUnitsOnly) {
ASS(!simplificationBuffer)
goto finish;
}

/*******************************************************/
/* SUBSUMPTION & RESOLUTION MULTI-LITERAL */
/*******************************************************/
if (!_subsumptionByUnitsOnly) {
for (unsigned i = 0; i < cl->length(); i++) {
Literal *lit = (*cl)[i];
// find the positively matched literals
auto it = _bwIndex->getInstances(lit, false, false);
while (it.hasNext()) {
Clause *icl = it.next().data->clause;
if (!_checked.insert(icl))
continue;
// check subsumption and setup subsumption resolution at the same time
bool checkS = _subsumption && !_subsumptionByUnitsOnly;
bool checkSR = _subsumptionResolution && !_srByUnitsOnly;
if (checkS) {
if (satSubs.checkSubsumption(cl, icl, checkSR)) {
List<BwSimplificationRecord>::push(BwSimplificationRecord(icl), simplificationBuffer);
subsumedSet.insert(icl);
continue;
}
}
if (checkSR) {
// check subsumption resolution
Clause *conclusion = satSubs.checkSubsumptionResolution(cl, icl, checkS); // use the previous setup only if subsumption was checked
if (conclusion)
List<BwSimplificationRecord>::push(BwSimplificationRecord(icl, conclusion), simplificationBuffer);
}
}
}
}

/*******************************************************/
/* SUBSUMPTION RESOLUTION MULTI-LITERAL */
/*******************************************************/
if (_subsumptionResolution && !_srByUnitsOnly) {
for (unsigned i = 0; i < cl->length(); i++) {
Literal *lit = (*cl)[i];
// find the negatively matched literals
auto it = _bwIndex->getInstances(lit, true, false);
while (it.hasNext()) {
Clause *icl = it.next().data->clause;
if (!_checked.insert(icl))
continue;
// check subsumption resolution
Clause *conclusion = satSubs.checkSubsumptionResolution(cl, icl, false);
if (conclusion)
List<BwSimplificationRecord>::push(BwSimplificationRecord(icl, conclusion), simplificationBuffer);
}
}
}

finish:
if (simplificationBuffer) {
simplifications = pvi(List<BwSimplificationRecord>::Iterator(simplificationBuffer));
}

return;
}

} // namespace Inferences