Skip to content

Commit 5ff3872

Browse files
committed
new feature '--ndconvert': convert natural deduction to D-proof summary
- natural deduction format based on https://github.com/mrieppel/FitchFX - includes Earley parser (to parse FitchFX-formatted formulas) - easy to use when more context-free grammars must be parsed, in case parsing is not performance-critical + --parse -s: fix axiom names to 1,…,9,a,b,…; not all numeric
1 parent 5c66a6a commit 5ff3872

22 files changed

+2696
-35
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ data/*
3232
!data/pmproofs.txt
3333
!data/pmproofs-old.txt
3434
!data/cardinalities.txt
35+
!data/*_ffx.txt
3536
!data/52436f9e87daeb2c361a73a9f389b061258328e641f750b1767addf7/
3637
data/52436f9e87daeb2c361a73a9f389b061258328e641f750b1767addf7/*
3738
!data/52436f9e87daeb2c361a73a9f389b061258328e641f750b1767addf7/\!.def

README.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,16 @@ <h4 id="usage">Usage</h4>
514514
-f: proof summary is given by input file path ; ignores lines that are empty or starting with '%'
515515
-o: redirect the result's output to the specified file
516516
-d: print debug information
517+
--ndconvert &lt;input file&gt; [-b &lt;base file&gt;] [-n] [-u] [-h] [-k] [-o &lt;output file&gt;] [-d]
518+
Convert proof from Fitch-style natural deduction to condensed detachment in a user-definable Hilbert system and print its proof summary (usable via '--transform' and '--unfold') ; ignores configured system
519+
Input file must contain propositional FitchFX proof without premises, as exportable from https://mrieppel.github.io/FitchFX/ ; supported rules: 'Assumption','IP','~I','~E','&gt;I','&gt;E','&I','&E','vI','vE','&lt;&gt;I','&lt;&gt;E','Reit'
520+
-b: provide target system with translation-assisting proofs via input file path of a proof summary ; proofs of (A1),(A2) are minimally required ; details: https://github.com/xamidi/pmGenerator/blob/master/nd/NdConverter.h
521+
-n: specify and print formulas in normal Polish notation (e.g. "CpCqp"), not with numeric variables (e.g. "C0C1.0")
522+
-u: print formulas in infix notation with operators as Unicode characters ; does not affect input format (for which '-n' can still be specified)
523+
-h: use heterogeneous language ; do not consider all formulas to use only connectives in {C,N} (aliased by Kpq:=NCpNq, Apq:=CNpq, Epq:=NCCpqNCqp, and O:=NCpp)
524+
-k: keep proofs for all theorems (not only those which are used to derive the target theorem)
525+
-o: redirect the result's output to the specified file
526+
-d: print debug information
517527
--search &lt;string&gt; [-n] [-s] [-w] [-t] [-p] [-f] [-d]
518528
Search in proof files at ./data/[&lt;hash&gt;/]/dProofs-withConclusions/ via comma-separated string of full formulas or full proofs ; [Hint: Generate missing files with '--variate 1 -s'.]
519529
-n: specify formulas in normal Polish notation (e.g. "CpCqp"), not with numeric variables (e.g. "C0C1.0")
@@ -579,6 +589,7 @@ <h4 id="usage">Usage</h4>
579589
pmGenerator --unfold CpCqp=1,CCpCqrCCpqCpr=2,CCNpNqCqp=3,[0]CCpCNqNrCpCrq:D2D13,[1]Cpp:DD211,[2]NCCppNCqq:DD3DD2DD2D[0]D[0]11D1[1][1] -n -t CNNpp,NCCppNCqq
580590
pmGenerator --transform data/m.txt -f -n -t CpCqp,CCpCqrCCpqCpr,CCNpNqCqp,Cpp,CCpqCCqrCpr,CCNppp,CpCNpq -j -1 -p -2 -d
581591
pmGenerator --transform "CCCpqrCCrpCsp=1,[0]=DDDD1D1D1D1DDDD1D1D11111111,[1]=D1DD[0]1[0],[2]=DDDD1DD[1][1]1111" -n -w -t _
592+
pmGenerator --ndconvert data/m_ffx.txt -n -b data/w1.txt -u
582593
pmGenerator -c -s CCCCC0.1CN2N3.2.4CC4.0C3.0 -g 35 --plot -s -t -x 50 -y 100 -o data/478804cd4793bc7f87041d99326aff4595662146d8a68175dda22bed/plot_data_x50_y100.txt
583594
pmGenerator -c -n -s CCCCCpqCNrNsrtCCtpCsp --search CpCqp,CCpCqrCCpqCpr,CCNpNqCqp -n
584595
pmGenerator --variate 1 -s --extract -t 1000 -s -d

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,16 @@ Some more – and very special – proof systems are illustrated [further down b
146146
-f: proof summary is given by input file path ; ignores lines that are empty or starting with '%'
147147
-o: redirect the result's output to the specified file
148148
-d: print debug information
149+
--ndconvert <input file> [-b <base file>] [-n] [-u] [-h] [-k] [-o <output file>] [-d]
150+
Convert proof from Fitch-style natural deduction to condensed detachment in a user-definable Hilbert system and print its proof summary (usable via '--transform' and '--unfold') ; ignores configured system
151+
Input file must contain propositional FitchFX proof without premises, as exportable from https://mrieppel.github.io/FitchFX/ ; supported rules: 'Assumption','IP','~I','~E','>I','>E','&I','&E','vI','vE','<>I','<>E','Reit'
152+
-b: provide target system with translation-assisting proofs via input file path of a proof summary ; proofs of (A1),(A2) are minimally required ; details: https://github.com/xamidi/pmGenerator/blob/master/nd/NdConverter.h
153+
-n: specify and print formulas in normal Polish notation (e.g. "CpCqp"), not with numeric variables (e.g. "C0C1.0")
154+
-u: print formulas in infix notation with operators as Unicode characters ; does not affect input format (for which '-n' can still be specified)
155+
-h: use heterogeneous language ; do not consider all formulas to use only connectives in {C,N} (aliased by Kpq:=NCpNq, Apq:=CNpq, Epq:=NCCpqNCqp, and O:=NCpp)
156+
-k: keep proofs for all theorems (not only those which are used to derive the target theorem)
157+
-o: redirect the result's output to the specified file
158+
-d: print debug information
149159
--search <string> [-n] [-s] [-w] [-t] [-p] [-f] [-d]
150160
Search in proof files at ./data/[<hash>/]/dProofs-withConclusions/ via comma-separated string of full formulas or full proofs ; [Hint: Generate missing files with '--variate 1 -s'.]
151161
-n: specify formulas in normal Polish notation (e.g. "CpCqp"), not with numeric variables (e.g. "C0C1.0")
@@ -212,6 +222,7 @@ Some more – and very special – proof systems are illustrated [further down b
212222
pmGenerator --unfold CpCqp=1,CCpCqrCCpqCpr=2,CCNpNqCqp=3,[0]CCpCNqNrCpCrq:D2D13,[1]Cpp:DD211,[2]NCCppNCqq:DD3DD2DD2D[0]D[0]11D1[1][1] -n -t CNNpp,NCCppNCqq
213223
pmGenerator --transform data/m.txt -f -n -t CpCqp,CCpCqrCCpqCpr,CCNpNqCqp,Cpp,CCpqCCqrCpr,CCNppp,CpCNpq -j -1 -p -2 -d
214224
pmGenerator --transform "CCCpqrCCrpCsp=1,[0]=DDDD1D1D1D1DDDD1D1D11111111,[1]=D1DD[0]1[0],[2]=DDDD1DD[1][1]1111" -n -w -t _
225+
pmGenerator --ndconvert data/m_ffx.txt -n -b data/w1.txt -u
215226
pmGenerator -c -s CCCCC0.1CN2N3.2.4CC4.0C3.0 -g 35 --plot -s -t -x 50 -y 100 -o data/478804cd4793bc7f87041d99326aff4595662146d8a68175dda22bed/plot_data_x50_y100.txt
216227
pmGenerator -c -n -s CCCCCpqCNrNsrtCCtpCsp --search CpCqp,CCpCqrCCpqCpr,CCNpNqCqp -n
217228
pmGenerator --variate 1 -s --extract -t 1000 -s -d

__dependency_graph.dot

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@ digraph {
1515
CfgGrammar -> "(cstdint)" [color=red]
1616
CfgGrammar -> "(unordered_map)" [color=red]
1717
CfgGrammar -> "(vector)" [color=red]
18+
CfgParser -> FctHelper [color=blue]
19+
CfgParser -> CfgGrammar [color=blue]
20+
CfgParser -> TreeNode [color=red]
1821
subgraph "cluster_D:/Dropbox/eclipse/pmGenerator\grammar" {
1922
CfgGrammar
2023
CfgGrammar
24+
CfgParser
25+
CfgParser
2126
}
2227
FctHelper -> "(cmath)" [color=blue]
2328
FctHelper -> "(iostream)" [color=blue]
@@ -147,6 +152,7 @@ digraph {
147152
main -> FctHelper [color=blue]
148153
main -> Version [color=blue]
149154
main -> DRuleReducer [color=blue]
155+
main -> NdConverter [color=blue]
150156
main -> DlProofEnumerator [color=blue]
151157
main -> "boost/algorithm/string" [color=blue]
152158
main -> "(cstring)" [color=blue]
@@ -191,6 +197,33 @@ digraph {
191197
DRuleReducer
192198
DRuleReducer
193199
}
200+
NdConverter -> FctHelper [color=blue]
201+
NdConverter -> TreeNode [color=blue]
202+
NdConverter -> DlCore [color=blue]
203+
NdConverter -> DlProofEnumerator [color=blue]
204+
NdConverter -> NdParser [color=blue]
205+
NdConverter -> "boost/algorithm/string" [color=blue]
206+
NdConverter -> "(numeric)" [color=blue]
207+
NdConverter -> "(string)" [color=red]
208+
NdParser -> FctHelper [color=blue]
209+
NdParser -> CfgGrammar [color=blue]
210+
NdParser -> CfgParser [color=blue]
211+
NdParser -> DlCore [color=blue]
212+
NdParser -> "boost/algorithm/string" [color=blue]
213+
NdParser -> "(iostream)" [color=blue]
214+
NdParser -> "(array)" [color=red]
215+
NdParser -> "(cstddef)" [color=red]
216+
NdParser -> "(cstdint)" [color=red]
217+
NdParser -> "(map)" [color=red]
218+
NdParser -> "(memory)" [color=red]
219+
NdParser -> "(string)" [color=red]
220+
NdParser -> "(vector)" [color=red]
221+
subgraph "cluster_D:/Dropbox/eclipse/pmGenerator\nd" {
222+
NdConverter
223+
NdConverter
224+
NdParser
225+
NdParser
226+
}
194227
TreeNode -> ICloneable [color=red]
195228
TreeNode -> IPrintable [color=red]
196229
TreeNode -> "(algorithm)" [color=red]

data/m_ffx.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
% Meredith's Axiom (CCCCCpqCNrNsrtCCtpCsp), i.e. ((((0→1)→(¬2→¬3))→2)→4)→((4→0)→(3→0))
2+
% Fitch-style natural deduction proof constructor: https://mrieppel.github.io/FitchFX/
3+
%
4+
% Related Hilbert system: https://xamidi.github.io/pmGenerator/data/m.txt
5+
% Conversion to Hilbert-style condensed detachment proof summary:
6+
% - [base:CpCqp,CCpCqrCCpqCpr,CCNpNqCqp]: pmGenerator --ndconvert data/m_ffx.txt -n
7+
% - [<proof summary of base system>.txt]: pmGenerator --ndconvert data/m_ffx.txt -n -b <proof summary of base system>.txt
8+
9+
Problem: |- (((((A > B) > (~C > ~D)) > C) > E) > ((E > A) > (D > A)))
10+
11+
1 | |_ ((((A > B) > (~C > ~D)) > C) > E) Assumption
12+
2 | | |_ (E > A) Assumption
13+
3 | | | |_ D Assumption
14+
4 | | | | |_ ~A Assumption
15+
5 | | | | | |_ ((A > B) > (~C > ~D)) Assumption
16+
6 | | | | | | |_ ~C Assumption
17+
7 | | | | | | | |_ A Assumption
18+
8 | | | | | | | | |_ ~B Assumption
19+
9 | | | | | | | | | # ~E 4,7
20+
10 | | | | | | | | B IP 8-9
21+
11 | | | | | | | (A > B) >I 7-10
22+
12 | | | | | | | (~C > ~D) >E 5,11
23+
13 | | | | | | | ~D >E 6,12
24+
14 | | | | | | | # ~E 3,13
25+
15 | | | | | | C IP 6-14
26+
16 | | | | | (((A > B) > (~C > ~D)) > C) >I 5-15
27+
17 | | | | | E >E 1,16
28+
18 | | | | | A >E 2,17
29+
19 | | | | | # ~E 4,18
30+
20 | | | | A IP 4-19
31+
21 | | | (D > A) >I 3-20
32+
22 | | ((E > A) > (D > A)) >I 2-21
33+
23 | (((((A > B) > (~C > ~D)) > C) > E) > ((E > A) > (D > A))) >I 1-22

data/w1_ffx.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
% Walsh's 1st Axiom (CCpCCNpqrCsCCNtCrtCpt), i.e. (0→((¬0→1)→2))→(3→((¬4→(2→4))→(0→4)))
2+
% Fitch-style natural deduction proof constructor: https://mrieppel.github.io/FitchFX/
3+
%
4+
% Related Hilbert system: https://xamidi.github.io/pmGenerator/data/w1.txt
5+
% Conversion to Hilbert-style condensed detachment proof summary:
6+
% - [base:CpCqp,CCpCqrCCpqCpr,CCNpNqCqp]: pmGenerator --ndconvert data/w1_ffx.txt -n
7+
% - [<proof summary of base system>.txt]: pmGenerator --ndconvert data/w1_ffx.txt -n -b <proof summary of base system>.txt
8+
9+
Problem: |- ((A > ((~A > B) > C)) > (D > ((~E > (C > E)) > (A > E))))
10+
11+
1 | |_ (A > ((~A > B) > C)) Assumption
12+
2 | | |_ D Assumption
13+
3 | | | |_ (~E > (C > E)) Assumption
14+
4 | | | | |_ A Assumption
15+
5 | | | | | |_ ~E Assumption
16+
6 | | | | | | |_ ~A Assumption
17+
7 | | | | | | | |_ ~B Assumption
18+
8 | | | | | | | | # ~E 4,6
19+
9 | | | | | | | B IP 7-8
20+
10 | | | | | | (~A > B) >I 6-9
21+
11 | | | | | | ((~A > B) > C) >E 1,4
22+
12 | | | | | | C >E 10,11
23+
13 | | | | | | (C > E) >E 3,5
24+
14 | | | | | | E >E 12,13
25+
15 | | | | | | # ~E 5,14
26+
16 | | | | | E IP 5-15
27+
17 | | | | (A > E) >I 4-16
28+
18 | | | ((~E > (C > E)) > (A > E)) >I 3-17
29+
19 | | (D > ((~E > (C > E)) > (A > E))) >I 2-18
30+
20 | ((A > ((~A > B) > C)) > (D > ((~E > (C > E)) > (A > E)))) >I 1-19

data/w2_ffx.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
% Walsh's 2nd Axiom (CpCCqCprCCNrCCNstqCsr), i.e. 0→((1→(0→2))→((¬2→((¬3→4)→1))→(3→2)))
2+
% Fitch-style natural deduction proof constructor: https://mrieppel.github.io/FitchFX/
3+
%
4+
% Related Hilbert system: https://xamidi.github.io/pmGenerator/data/w2.txt
5+
% Conversion to Hilbert-style condensed detachment proof summary:
6+
% - [base:CpCqp,CCpCqrCCpqCpr,CCNpNqCqp]: pmGenerator --ndconvert data/w2_ffx.txt -n
7+
% - [<proof summary of base system>.txt]: pmGenerator --ndconvert data/w2_ffx.txt -n -b <proof summary of base system>.txt
8+
9+
Problem: |- (A > ((B > (A > C)) > ((~C > ((~D > E) > B)) > (D > C))))
10+
11+
1 | |_ A Assumption
12+
2 | | |_ (B > (A > C)) Assumption
13+
3 | | | |_ (~C > ((~D > E) > B)) Assumption
14+
4 | | | | |_ D Assumption
15+
5 | | | | | |_ ~C Assumption
16+
6 | | | | | | |_ ~D Assumption
17+
7 | | | | | | | |_ ~E Assumption
18+
8 | | | | | | | | # ~E 4,6
19+
9 | | | | | | | E IP 7-8
20+
10 | | | | | | (~D > E) >I 6-9
21+
11 | | | | | | ((~D > E) > B) >E 3,5
22+
12 | | | | | | B >E 10,11
23+
13 | | | | | | (A > C) >E 2,12
24+
14 | | | | | | C >E 1,13
25+
15 | | | | | | # ~E 5,14
26+
16 | | | | | C IP 5-15
27+
17 | | | | (D > C) >I 4-16
28+
18 | | | ((~C > ((~D > E) > B)) > (D > C)) >I 3-17
29+
19 | | ((B > (A > C)) > ((~C > ((~D > E) > B)) > (D > C))) >I 2-18
30+
20 | (A > ((B > (A > C)) > ((~C > ((~D > E) > B)) > (D > C)))) >I 1-19

data/w3_ffx.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
% Walsh's 3rd Axiom (CpCCNqCCNrsCptCCtqCrq), i.e. 0→((¬1→((¬2→3)→(0→4)))→((4→1)→(2→1)))
2+
% Fitch-style natural deduction proof constructor: https://mrieppel.github.io/FitchFX/
3+
%
4+
% Related Hilbert system: https://xamidi.github.io/pmGenerator/data/w3.txt
5+
% Conversion to Hilbert-style condensed detachment proof summary:
6+
% - [base:CpCqp,CCpCqrCCpqCpr,CCNpNqCqp]: pmGenerator --ndconvert data/w3_ffx.txt -n
7+
% - [<proof summary of base system>.txt]: pmGenerator --ndconvert data/w3_ffx.txt -n -b <proof summary of base system>.txt
8+
9+
Problem: |- (A > ((~B > ((~C > D) > (A > E))) > ((E > B) > (C > B))))
10+
11+
1 | |_ A Assumption
12+
2 | | |_ (~B > ((~C > D) > (A > E))) Assumption
13+
3 | | | |_ (E > B) Assumption
14+
4 | | | | |_ C Assumption
15+
5 | | | | | |_ ~B Assumption
16+
6 | | | | | | |_ ~C Assumption
17+
7 | | | | | | | |_ ~D Assumption
18+
8 | | | | | | | | # ~E 4,6
19+
9 | | | | | | | D IP 7-8
20+
10 | | | | | | (~C > D) >I 6-9
21+
11 | | | | | | ((~C > D) > (A > E)) >E 2,5
22+
12 | | | | | | (A > E) >E 10,11
23+
13 | | | | | | E >E 1,12
24+
14 | | | | | | B >E 3,13
25+
15 | | | | | | # ~E 5,14
26+
16 | | | | | B IP 5-15
27+
17 | | | | (C > B) >I 4-16
28+
18 | | | ((E > B) > (C > B)) >I 3-17
29+
19 | | ((~B > ((~C > D) > (A > E))) > ((E > B) > (C > B))) >I 2-18
30+
20 | (A > ((~B > ((~C > D) > (A > E))) > ((E > B) > (C > B)))) >I 1-19

data/w4_ffx.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
% Walsh's 4th Axiom (CpCCNqCCNrsCtqCCrtCrq), i.e. 0→((¬1→((¬2→3)→(4→1)))→((2→4)→(2→1)))
2+
% Fitch-style natural deduction proof constructor: https://mrieppel.github.io/FitchFX/
3+
%
4+
% Related Hilbert system: https://xamidi.github.io/pmGenerator/data/w4.txt
5+
% Conversion to Hilbert-style condensed detachment proof summary:
6+
% - [base:CpCqp,CCpCqrCCpqCpr,CCNpNqCqp]: pmGenerator --ndconvert data/w4_ffx.txt -n
7+
% - [<proof summary of base system>.txt]: pmGenerator --ndconvert data/w4_ffx.txt -n -b <proof summary of base system>.txt
8+
9+
Problem: |- (A > ((~B > ((~C > D) > (E > B))) > ((C > E) > (C > B))))
10+
11+
1 | |_ A Assumption
12+
2 | | |_ (~B > ((~C > D) > (E > B))) Assumption
13+
3 | | | |_ (C > E) Assumption
14+
4 | | | | |_ C Assumption
15+
5 | | | | | |_ ~B Assumption
16+
6 | | | | | | |_ ~C Assumption
17+
7 | | | | | | | |_ ~D Assumption
18+
8 | | | | | | | | # ~E 4,6
19+
9 | | | | | | | D IP 7-8
20+
10 | | | | | | (~C > D) >I 6-9
21+
11 | | | | | | ((~C > D) > (E > B)) >E 2,5
22+
12 | | | | | | (E > B) >E 10,11
23+
13 | | | | | | E >E 3,4
24+
14 | | | | | | B >E 12,13
25+
15 | | | | | | # ~E 5,14
26+
16 | | | | | B IP 5-15
27+
17 | | | | (C > B) >I 4-16
28+
18 | | | ((C > E) > (C > B)) >I 3-17
29+
19 | | ((~B > ((~C > D) > (E > B))) > ((C > E) > (C > B))) >I 2-18
30+
20 | (A > ((~B > ((~C > D) > (E > B))) > ((C > E) > (C > B)))) >I 1-19

0 commit comments

Comments
 (0)