Skip to content

Commit 88aafac

Browse files
committed
more in-depth proof iterator explanation + minor improvements
1 parent e2958f3 commit 88aafac

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

__dependency_graph.dot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ digraph {
99
CfgGrammar
1010
CfgGrammar
1111
}
12-
FctHelper -> Resources [color=blue]
1312
FctHelper -> iostream [color=blue]
1413
FctHelper -> math [color=blue]
1514
FctHelper -> algorithm [color=red]
@@ -67,6 +66,7 @@ digraph {
6766
main -> cstring [color=blue]
6867
main -> ctime [color=blue]
6968
main -> iostream [color=blue]
69+
main -> unistd [color=blue]
7070
subgraph "cluster_D:/Dropbox/eclipse/pmGenerator" {
7171
main
7272
}

helper/FctHelper.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#include "FctHelper.h"
22

3-
#include "Resources.h"
4-
53
#include <iostream>
64
#include <math.h>
75

main.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <cstring>
66
#include <ctime>
77
#include <iostream>
8+
#include <unistd.h>
89

910
using namespace std;
1011
using namespace xamid::helper;
@@ -14,11 +15,11 @@ using namespace xamid::nortmann;
1415
struct A {
1516
A() {
1617
time_t time = chrono::system_clock::to_time_t(chrono::system_clock::now());
17-
cout << strtok(ctime(&time), "\n") << ": Process started." << endl;
18+
cout << strtok(ctime(&time), "\n") << ": Process started. [pid: " << getpid() << ", tid:" << this_thread::get_id() << "]" << endl;
1819
}
1920
~A() {
2021
time_t time = chrono::system_clock::to_time_t(chrono::system_clock::now());
21-
cout << strtok(ctime(&time), "\n") << ": Process terminated." << endl;
22+
cout << strtok(ctime(&time), "\n") << ": Process terminated. [pid: " << getpid() << ", tid:" << this_thread::get_id() << "]" << endl;
2223
}
2324
} a;
2425

nortmann/DlProofEnumerator.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,17 @@ struct DlProofEnumerator {
9393
}
9494

9595
private:
96+
// The idea, for an odd number n := 'knownLimit', is to implement a pushdown automaton for a context-free grammar
97+
// with start symbol S, nonterminals {S, A} \cup {Nx | x > 0 odd, and x <= n}, and production rules
98+
// S -> N1 | ... | Nn | A (S produces a superset of all representative proofs.)
99+
// A -> <production generated by proofLengthCombinations(n)>, e.g. n = 5 => A -> D N1 N5 | D N5 N1 | D N3 N3 | D N3 N5 | D N5 N3 | D N1 A | D A N1 | D N5 N5 | D N3 A | D A N3 | D N5 A | D A N5 | D A A
100+
// N1 -> {p | p is representative proof of length 1}
101+
// ...
102+
// Nn -> {p | p is representative proof of length n}.
103+
// This grammar defines a superset of all condensed-detachment proofs on top of the already known proofs of lengths up to n, where A encodes those which have
104+
// at least length n + 2. By starting the pushdown automaton with stack [A], only the new candidates are iterated, of which invalid candidates can be skipped
105+
// after resulting in a parse error. When providing 'wordLengthLimit' := n + 2, this means to only iterate candidates of length n + 2 in an efficient way.
106+
// [NOTE: Sequential non-generic variants (with explicit grammars given as comments) are available at https://github.com/deontic-logic/proof-tool/blob/29dd7dfab9f373d1dd387fb99c16e82c577ec21f/nortmann/DlProofEnumerator.h?ts=4#L167-L174 and below.]
96107
static void _loadAndProcessQueuesConcurrently(unsigned concurrencyCount, std::vector<std::deque<std::string>>& queues, std::vector<std::mutex>& mtxs, const auto& loader, const auto& process);
97108
static void _processCondensedDetachmentPlProofs_generic_seq(std::string& prefix, std::vector<std::uint32_t>& stack, std::uint32_t wordLengthLimit, std::uint32_t knownLimit, const std::vector<std::vector<std::string>>& allRepresentatives, const auto& fString);
98109
static void _processCondensedDetachmentPlProofs_naive_seq(std::string& prefix, unsigned stackSize, std::uint32_t wordLengthLimit, const auto& fString);

0 commit comments

Comments
 (0)