Skip to content

Commit 652a46f

Browse files
committed
--extract -z: force redundant schema removal for '-t'
+ fix output + update comments for 'auto parse' in DRuleParser::parseAbstractDProof() and 'auto explore' in DRuleParser::compressAbstractDProof()
1 parent 9c758df commit 652a46f

File tree

6 files changed

+39
-35
lines changed

6 files changed

+39
-35
lines changed

README.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,11 +494,12 @@ <h4 id="usage">Usage</h4>
494494
-p: search proofs (rather than conclusions) ; used only when '-n', '-s' and '-t' unspecified
495495
-f: search terms are given by input file path (where a comma-separated string is stored), ignoring all CR, LF, whitespace, and lines starting with '%'
496496
-d: print debug information
497-
--extract [-t &lt;limit or -1&gt;] [-o &lt;output file&gt;] [-s] [-# &lt;amount up to 35&gt;] [-h &lt;string&gt;] [-l &lt;limit or -1&gt;] [-k &lt;limit or -1&gt;] [-f] [-d]
497+
--extract [-t &lt;limit or -1&gt;] [-o &lt;output file&gt;] [-s] [-z] [-# &lt;amount up to 35&gt;] [-h &lt;string&gt;] [-l &lt;limit or -1&gt;] [-k &lt;limit or -1&gt;] [-f] [-d]
498498
Various options to extract information from proof files ; [Hint: Generate missing files with '--variate 1 -s'.]
499499
-t: compose file with up to the given amount of smallest conclusions that occur in proof files ; includes origins, symbolic lengths, proofs, and formulas in normal Polish notation
500500
-o: specify output file path for '-t' ; relative to effective data location ; default: "top&lt;amount&gt;SmallestConclusions_&lt;min proof length&gt;to&lt;max proof length&gt;Steps&lt;unfiltered info&gt;.txt"
501501
-s: redundant schema removal for '-t' ; very time-intensive for requesting huge collections from unfiltered proof files - better pre-filter via '-g' or '-m' instead ; default: false
502+
-z: force redundant schema removal for '-t' ; like '-s', but also filter proof files not declared as unfiltered (which might be useful for non-standard procedures)
502503
-#: initialize proof system at ./data/[&lt;hash&gt;/]/extraction-&lt;id&gt;/ with the given amount of smallest filtered conclusions that occur in proof files ; specify with '-c &lt;parent system&gt; -e &lt;id&gt;'
503504
-h: similar to '-#' ; hand-pick conclusions with a comma-separated string of proofs ; "." to not modify axioms
504505
-l: similar to '-#' (but creates identical system with prebuilt proof files) ; copy proofs with conclusions that have symbolic lengths of at most the given number

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,12 @@ Some more – and very special – proof systems are illustrated [further down b
119119
-p: search proofs (rather than conclusions) ; used only when '-n', '-s' and '-t' unspecified
120120
-f: search terms are given by input file path (where a comma-separated string is stored), ignoring all CR, LF, whitespace, and lines starting with '%'
121121
-d: print debug information
122-
--extract [-t <limit or -1>] [-o <output file>] [-s] [-# <amount up to 35>] [-h <string>] [-l <limit or -1>] [-k <limit or -1>] [-f] [-d]
122+
--extract [-t <limit or -1>] [-o <output file>] [-s] [-z] [-# <amount up to 35>] [-h <string>] [-l <limit or -1>] [-k <limit or -1>] [-f] [-d]
123123
Various options to extract information from proof files ; [Hint: Generate missing files with '--variate 1 -s'.]
124124
-t: compose file with up to the given amount of smallest conclusions that occur in proof files ; includes origins, symbolic lengths, proofs, and formulas in normal Polish notation
125125
-o: specify output file path for '-t' ; relative to effective data location ; default: "top<amount>SmallestConclusions_<min proof length>to<max proof length>Steps<unfiltered info>.txt"
126126
-s: redundant schema removal for '-t' ; very time-intensive for requesting huge collections from unfiltered proof files - better pre-filter via '-g' or '-m' instead ; default: false
127+
-z: force redundant schema removal for '-t' ; like '-s', but also filter proof files not declared as unfiltered (which might be useful for non-standard procedures)
127128
-#: initialize proof system at ./data/[<hash>/]/extraction-<id>/ with the given amount of smallest filtered conclusions that occur in proof files ; specify with '-c <parent system> -e <id>'
128129
-h: similar to '-#' ; hand-pick conclusions with a comma-separated string of proofs ; "." to not modify axioms
129130
-l: similar to '-#' (but creates identical system with prebuilt proof files) ; copy proofs with conclusions that have symbolic lengths of at most the given number

logic/DlProofEnumerator.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3151,7 +3151,7 @@ map<string, string> DlProofEnumerator::searchProofFiles(const vector<string>& se
31513151
return bestResults;
31523152
}
31533153

3154-
void DlProofEnumerator::extractConclusions(ExtractionMethod method, uint32_t extractAmount, const string* config, bool allowRedundantSchemaRemoval, size_t bound1, size_t bound2, bool debug, string* optOut_createdExDir) {
3154+
void DlProofEnumerator::extractConclusions(ExtractionMethod method, uint32_t extractAmount, const string* config, bool allowRedundantSchemaRemoval, bool forceRedundantSchemaRemoval, size_t bound1, size_t bound2, bool debug, string* optOut_createdExDir) {
31553155
chrono::time_point<chrono::steady_clock> startTime;
31563156
vector<string> dProofs;
31573157
if ((method == ExtractionMethod::ProofSystemFromTopList && !extractAmount) || (method == ExtractionMethod::ProofSystemFromString && (!config || config->empty()))) {
@@ -3249,7 +3249,7 @@ void DlProofEnumerator::extractConclusions(ExtractionMethod method, uint32_t ext
32493249
// removals are performed (unless requested by ridiculous limits for ExtractionMethod::TopListFile), which should be done via -g or -m anyway.
32503250
// For small sets, where this loop can occur for ExtractionMethod::ProofSystemFromTopList (and under reasonable parameters for
32513251
// ExtractionMethod::TopListFile), its performance overhead is insignificant.
3252-
redundantSchemaRemoval = useUnfilteredFiles && (method == ExtractionMethod::ProofSystemFromTopList || allowRedundantSchemaRemoval);
3252+
redundantSchemaRemoval = forceRedundantSchemaRemoval || (useUnfilteredFiles && (method == ExtractionMethod::ProofSystemFromTopList || allowRedundantSchemaRemoval));
32533253
if (redundantSchemaRemoval && limits.front() > 1)
32543254
cerr << "Warning: Schemas are filtered only partially, because proofs with less than " + to_string(limits.front()) + " steps are missing from the collection. Generate corresponding file(s) to avoid this." << endl;
32553255
bool repeat = false;
@@ -3353,7 +3353,7 @@ void DlProofEnumerator::extractConclusions(ExtractionMethod method, uint32_t ext
33533353
uint32_t proofLen = q.first;
33543354
size_t lineNo = r.first;
33553355
bool schemaFound = false;
3356-
if (proofLen >= unfiltered) { // detect conclusions that are merely instances of other formulas proven in lower or equal amounts of steps
3356+
if (forceRedundantSchemaRemoval || proofLen >= unfiltered) { // detect conclusions that are merely instances of other formulas proven in lower or equal amounts of steps
33573357
bool search = true;
33583358
for (const pair<const size_t, tbb::concurrent_map<uint32_t, tbb::concurrent_map<size_t, string>>>& p_ : topList)
33593359
if (search && p_.first <= symConLen) {
@@ -3524,7 +3524,7 @@ void DlProofEnumerator::extractConclusions(ExtractionMethod method, uint32_t ext
35243524
size_t maxSymConNumLen = FctHelper::digitsNum_uint64(maxSymConLen);
35253525

35263526
// 3. Print relevant results to file.
3527-
filesystem::path file = filesystem::u8path(config ? effectiveDataLocation + *config : effectiveDataLocation + "top" + (extractAmount == UINT32_MAX ? "" : to_string(counter)) + "SmallestConclusions_" + to_string(limits.empty() ? 0 : limits.front()) + "to" + to_string(limits.empty() ? 0 : limits.back()) + "Steps" + (!useUnfilteredFiles || (redundantSchemaRemoval && limits.front() == 1) ? "" : string("-") + (redundantSchemaRemoval ? "partially-" : "un") + "filtered" + to_string(unfiltered) + "+") + ".txt");
3527+
filesystem::path file = filesystem::u8path(config ? effectiveDataLocation + *config : effectiveDataLocation + "top" + (extractAmount == UINT32_MAX ? "" : to_string(counter)) + "SmallestConclusions_" + to_string(limits.empty() ? 0 : limits.front()) + "to" + to_string(limits.empty() ? 0 : limits.back()) + "Steps" + ((!useUnfilteredFiles && !forceRedundantSchemaRemoval) || (redundantSchemaRemoval && limits.front() == 1) ? (forceRedundantSchemaRemoval ? "-filtered" : "") : string("-") + (redundantSchemaRemoval ? "partially-" : "un") + "filtered" + (forceRedundantSchemaRemoval ? "" : to_string(unfiltered) + "+")) + ".txt");
35283528
string::size_type bytes = 0;
35293529
while (!filesystem::exists(file) && !FctHelper::ensureDirExists(file.string()))
35303530
cerr << "Failed to create file at \"" << file.string() << "\", trying again." << endl;

logic/DlProofEnumerator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ struct DlProofEnumerator {
105105

106106
// Data search ; input files with conclusions are required
107107
static std::map<std::string, std::string> searchProofFiles(const std::vector<std::string>& searchTerms, bool normalPolishNotation = false, bool searchProofs = false, unsigned schemaSearch = 0, const std::string* inputFile = nullptr, bool debug = false);
108-
static void extractConclusions(ExtractionMethod method, std::uint32_t extractAmount, const std::string* config = nullptr, bool allowRedundantSchemaRemoval = false, std::size_t bound1 = 0, std::size_t bound2 = 0, bool debug = false, std::string* optOut_createdExDir = nullptr);
108+
static void extractConclusions(ExtractionMethod method, std::uint32_t extractAmount, const std::string* config = nullptr, bool allowRedundantSchemaRemoval = false, bool forceRedundantSchemaRemoval = false, std::size_t bound1 = 0, std::size_t bound2 = 0, bool debug = false, std::string* optOut_createdExDir = nullptr);
109109

110110
// Data representation ; input files with conclusions are required
111111
static void printConclusionLengthPlotData(bool measureSymbolicLength = true, bool table = true, std::int64_t cutX = -1, std::int64_t cutY = -1, const std::string& dataLocation = "data", const std::string& inputFilePrefix = "dProofs-withConclusions/dProofs", bool includeUnfiltered = false, std::ostream* mout = nullptr, bool debug = false, const std::uint32_t* proofLenStepSize = nullptr);

0 commit comments

Comments
 (0)