occam-verify-cli 0.0.909 → 0.0.911
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/axiomLemmaTheoremConjecture.js +6 -6
- package/lib/conclusion.js +7 -7
- package/lib/consequent.js +3 -3
- package/lib/context/file.js +7 -35
- package/lib/context/local.js +14 -19
- package/lib/context/localMeta.js +16 -21
- package/lib/declaration.js +10 -10
- package/lib/equivalence.js +15 -15
- package/lib/frame.js +5 -5
- package/lib/frameAssertion.js +3 -3
- package/lib/metaConsequent.js +4 -4
- package/lib/metaLemmaMetatheorem.js +10 -10
- package/lib/metaSupposition.js +10 -10
- package/lib/metaType.js +7 -7
- package/lib/metavariable.js +7 -7
- package/lib/mixins/nodesVerifier/intrinsiclevel.js +3 -3
- package/lib/mixins/nodesVerifier/metaLevel.js +3 -3
- package/lib/premise.js +19 -19
- package/lib/rule.js +21 -21
- package/lib/step/metaproof.js +14 -53
- package/lib/step/proof.js +10 -22
- package/lib/substitution/metastatementForMetavariable.js +11 -11
- package/lib/substitution/statementForMetavariable.js +9 -8
- package/lib/substitution/termForVariable.js +9 -9
- package/lib/substitution.js +11 -11
- package/lib/supposition.js +3 -3
- package/lib/type.js +7 -7
- package/lib/utilities/match.js +96 -0
- package/lib/variable.js +8 -8
- package/lib/verify/containedAssertion.js +54 -20
- package/lib/verify/definedAssertion.js +67 -33
- package/lib/verify/frame.js +2 -2
- package/lib/verify/frameAssertion.js +3 -3
- package/lib/verify/metaDerivation.js +7 -7
- package/lib/verify/metaSubDerivation.js +6 -6
- package/lib/verify/metaproofStep.js +98 -0
- package/lib/verify/metastatement/unqualified.js +4 -7
- package/lib/verify/metastatement.js +35 -6
- package/lib/verify/ruleProofStep.js +25 -14
- package/lib/verify/statement/unqualified.js +3 -3
- package/lib/verify/statement.js +4 -7
- package/package.json +2 -2
- package/src/axiomLemmaTheoremConjecture.js +6 -6
- package/src/conclusion.js +6 -6
- package/src/consequent.js +2 -2
- package/src/context/file.js +6 -30
- package/src/context/local.js +13 -19
- package/src/context/localMeta.js +15 -21
- package/src/declaration.js +12 -12
- package/src/equivalence.js +14 -14
- package/src/frame.js +4 -4
- package/src/frameAssertion.js +2 -2
- package/src/metaConsequent.js +3 -3
- package/src/metaLemmaMetatheorem.js +10 -10
- package/src/metaSupposition.js +9 -9
- package/src/metaType.js +7 -7
- package/src/metavariable.js +6 -6
- package/src/mixins/nodesVerifier/intrinsiclevel.js +2 -2
- package/src/mixins/nodesVerifier/metaLevel.js +2 -2
- package/src/premise.js +18 -18
- package/src/rule.js +22 -22
- package/src/step/metaproof.js +12 -73
- package/src/step/proof.js +8 -26
- package/src/substitution/metastatementForMetavariable.js +10 -10
- package/src/substitution/statementForMetavariable.js +6 -4
- package/src/substitution/termForVariable.js +8 -8
- package/src/substitution.js +10 -10
- package/src/supposition.js +2 -2
- package/src/type.js +7 -7
- package/src/utilities/match.js +100 -0
- package/src/variable.js +11 -11
- package/src/verify/containedAssertion.js +76 -27
- package/src/verify/definedAssertion.js +90 -41
- package/src/verify/frame.js +1 -1
- package/src/verify/frameAssertion.js +2 -2
- package/src/verify/metaDerivation.js +6 -6
- package/src/verify/metaSubDerivation.js +6 -6
- package/src/verify/{metaProofStep.js → metaproofStep.js} +60 -19
- package/src/verify/metastatement/unqualified.js +3 -7
- package/src/verify/metastatement.js +46 -5
- package/src/verify/ruleProofStep.js +22 -1
- package/src/verify/statement/unqualified.js +2 -2
- package/src/verify/statement.js +2 -6
- package/lib/utilities/metaproof.js +0 -59
- package/lib/utilities/proof.js +0 -59
- package/lib/verify/metaProofStep.js +0 -76
- package/src/utilities/metaproof.js +0 -53
- package/src/utilities/proof.js +0 -53
package/src/metavariable.js
CHANGED
|
@@ -37,13 +37,13 @@ export default class Metavariable {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
matchName(name) {
|
|
40
|
-
const
|
|
40
|
+
const matchesName = (this.name === name);
|
|
41
41
|
|
|
42
|
-
return
|
|
42
|
+
return matchesName;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
matchNode(node, localMetaContext) {
|
|
46
|
-
let
|
|
46
|
+
let matchesNode = false;
|
|
47
47
|
|
|
48
48
|
const metavariableNode = node, ///
|
|
49
49
|
typeNode = typeNodeQuery(metavariableNode);
|
|
@@ -57,16 +57,16 @@ export default class Metavariable {
|
|
|
57
57
|
if (false) {
|
|
58
58
|
///
|
|
59
59
|
} else if ((termNode === null) && (this.termType === null)) {
|
|
60
|
-
|
|
60
|
+
matchesNode = true;
|
|
61
61
|
} else if ((termNode !== null) && (this.termType !== null)) {
|
|
62
62
|
const termVerifiedAgainstTermType = verifyTermAgainstTermType(termNode, this.termType, localMetaContext);
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
matchesNode = termVerifiedAgainstTermType; ///
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
return
|
|
69
|
+
return matchesNode;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
toJSON(tokens) {
|
|
@@ -18,9 +18,9 @@ function verifyVariableNode(variableNodeA, termNodeB, substitutions, localContex
|
|
|
18
18
|
|
|
19
19
|
if (substitution !== null) {
|
|
20
20
|
const termNode = termNodeB, ///
|
|
21
|
-
|
|
21
|
+
substitutionMatchesTermNode = substitution.matchTermNode(termNode);
|
|
22
22
|
|
|
23
|
-
if (
|
|
23
|
+
if (substitutionMatchesTermNode) {
|
|
24
24
|
const verifiedAhead = verifyAhead();
|
|
25
25
|
|
|
26
26
|
variableNodeVerified = verifiedAhead; ///
|
|
@@ -15,9 +15,9 @@ function verifyMetavariableNode(metavariableNodeA, metastatementNodeB, substitut
|
|
|
15
15
|
|
|
16
16
|
if (substitution !== null) {
|
|
17
17
|
const metastatementNode = metastatementNodeB, ///
|
|
18
|
-
|
|
18
|
+
substitutionMetastatementNode = substitution.matchMetastatementNode(metastatementNode);
|
|
19
19
|
|
|
20
|
-
metavariableNodeVerified =
|
|
20
|
+
metavariableNodeVerified = substitutionMetastatementNode; ///
|
|
21
21
|
} else {
|
|
22
22
|
const metavariableNode = metavariableNodeA, ///
|
|
23
23
|
metastatementNode = metastatementNodeB, ///
|
package/src/premise.js
CHANGED
|
@@ -17,7 +17,7 @@ const subproofAssertionNodeQuery = nodeQuery("/metastatement/subproofAssertion!"
|
|
|
17
17
|
ruleSubproofPremiseMetastatementNodesQuery = nodesQuery("/ruleSubproof/premise/unqualifiedMetastatement!/metastatement!"),
|
|
18
18
|
metaSubproofMetaSuppositionMetastatementNodesQuery = nodesQuery("/metaSubproof/metaSupposition/unqualifiedMetastatement!/metastatement!"),
|
|
19
19
|
ruleSubproofLastRuleProofStepMetastatementNodeQuery = nodeQuery("/ruleSubproof/ruleSubDerivation/lastRuleProofStep/unqualifiedMetastatement|qualifiedMetastatement/metastatement!"),
|
|
20
|
-
|
|
20
|
+
metaSubproofLastMetaproofStepMetastatementNodeQuery = nodeQuery("/metaSubproof/metaSubDerivation/lastMetaproofStep/unqualifiedMetastatement|qualifiedMetastatement/metastatement!");
|
|
21
21
|
|
|
22
22
|
export default class Premise {
|
|
23
23
|
constructor(metastatementNode, statementNode) {
|
|
@@ -34,7 +34,7 @@ export default class Premise {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
matchStatementNode(statementNode, substitutions, fileContext, localContext) {
|
|
37
|
-
let
|
|
37
|
+
let matchesStatementNode = false;
|
|
38
38
|
|
|
39
39
|
if (this.metastatementNode !== null) {
|
|
40
40
|
const nonTerminalNodeA = this.metastatementNode, ///
|
|
@@ -48,14 +48,14 @@ export default class Premise {
|
|
|
48
48
|
return verifiedAhead;
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
matchesStatementNode = nonTerminalNodeVerified; ///
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
return
|
|
54
|
+
return matchesStatementNode;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
matchSubproofNode(subproofNode, substitutions, fileContext, localContext) {
|
|
58
|
-
let
|
|
58
|
+
let matchesSubproofNode = false;
|
|
59
59
|
|
|
60
60
|
if (this.metastatementNode !== null) {
|
|
61
61
|
const subproofAssertionNode = subproofAssertionNodeQuery(this.metastatementNode);
|
|
@@ -69,7 +69,7 @@ export default class Premise {
|
|
|
69
69
|
],
|
|
70
70
|
subproofAssertionMetastatementNodes = subproofAssertionMetastatementNodesQuery(subproofAssertionNode);
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
matchesSubproofNode = match(subproofAssertionMetastatementNodes, subproofStatementNodes, (subproofAssertionMetastatementNode, subproofStatementNode) => {
|
|
73
73
|
const nonTerminalNodeA = subproofAssertionMetastatementNode, ///
|
|
74
74
|
nonTerminalNodeB = subproofStatementNode, ///
|
|
75
75
|
fileContextA = fileContext, ///
|
|
@@ -88,11 +88,11 @@ export default class Premise {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return matchesSubproofNode;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
matchRuleSubproofNode(ruleSubproofNode, substitutions, fileContext, localMetaContext) {
|
|
95
|
-
let
|
|
95
|
+
let matchesRuleSubproofNode = false;
|
|
96
96
|
|
|
97
97
|
if (this.metastatementNode !== null) {
|
|
98
98
|
const subproofAssertionNode = subproofAssertionNodeQuery(this.metastatementNode);
|
|
@@ -106,7 +106,7 @@ export default class Premise {
|
|
|
106
106
|
],
|
|
107
107
|
subproofAssertionMetastatementNodes = subproofAssertionMetastatementNodesQuery(subproofAssertionNode);
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
matchesRuleSubproofNode = match(subproofAssertionMetastatementNodes, ruleSubproofMetastatementNodes, (subproofAssertionMetastatementNode, ruleSubproofMetastatementNode) => {
|
|
110
110
|
const nonTerminalNodeA = subproofAssertionMetastatementNode, ///
|
|
111
111
|
nonTerminalNodeB = ruleSubproofMetastatementNode, ///
|
|
112
112
|
fileContextA = fileContext, ///
|
|
@@ -125,25 +125,25 @@ export default class Premise {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
return
|
|
128
|
+
return matchesRuleSubproofNode;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
matchMetaSubproofNode(metaSubproofNode, substitutions, fileContext, localMetaContext) {
|
|
132
|
-
let
|
|
132
|
+
let matchesMetaSubproofNode = false;
|
|
133
133
|
|
|
134
134
|
if (this.metastatementNode !== null) {
|
|
135
135
|
const subproofAssertionNode = subproofAssertionNodeQuery(this.metastatementNode);
|
|
136
136
|
|
|
137
137
|
if (subproofAssertionNode !== null) {
|
|
138
138
|
const metaSubproofMetaSuppositionMetastatementNodes = metaSubproofMetaSuppositionMetastatementNodesQuery(metaSubproofNode),
|
|
139
|
-
|
|
139
|
+
metaSubproofLastMetaproofStepMetastatementNode = metaSubproofLastMetaproofStepMetastatementNodeQuery(metaSubproofNode),
|
|
140
140
|
metaSubproofMetastatementNodes = [
|
|
141
141
|
...metaSubproofMetaSuppositionMetastatementNodes,
|
|
142
|
-
|
|
142
|
+
metaSubproofLastMetaproofStepMetastatementNode
|
|
143
143
|
],
|
|
144
144
|
subproofAssertionMetastatementNodes = subproofAssertionMetastatementNodesQuery(subproofAssertionNode);
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
matchesMetaSubproofNode = match(subproofAssertionMetastatementNodes, metaSubproofMetastatementNodes, (subproofAssertionMetastatementNode, ruleSubproofMetastatementNode) => {
|
|
147
147
|
const nonTerminalNodeA = subproofAssertionMetastatementNode, ///
|
|
148
148
|
nonTerminalNodeB = ruleSubproofMetastatementNode, ///
|
|
149
149
|
fileContextA = fileContext, ///
|
|
@@ -162,11 +162,11 @@ export default class Premise {
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
return
|
|
165
|
+
return matchesMetaSubproofNode;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
matchMetastatementNode(metastatementNode, substitutions, fileContext, localMetaContext) {
|
|
169
|
-
let
|
|
169
|
+
let matchesMetastatementNode = false;
|
|
170
170
|
|
|
171
171
|
if (this.metastatementNode !== null) {
|
|
172
172
|
const nonTerminalNodeA = this.metastatementNode, ///
|
|
@@ -180,10 +180,10 @@ export default class Premise {
|
|
|
180
180
|
return verifiedAhead;
|
|
181
181
|
});
|
|
182
182
|
|
|
183
|
-
|
|
183
|
+
matchesMetastatementNode = nonTerminalNodeVerified; ///
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
return
|
|
186
|
+
return matchesMetastatementNode;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
toJSON(tokens) {
|
package/src/rule.js
CHANGED
|
@@ -31,7 +31,7 @@ export default class Rule {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
matchStatement(statementNode, localContext) {
|
|
34
|
-
let
|
|
34
|
+
let matchesStatement = false;
|
|
35
35
|
|
|
36
36
|
const proofSteps = localContext.getProofSteps(),
|
|
37
37
|
substitutions = [],
|
|
@@ -40,14 +40,14 @@ export default class Rule {
|
|
|
40
40
|
if (premisesMatch) {
|
|
41
41
|
const conclusionMatches = matchConclusion(this.conclusion, statementNode, substitutions, this.fileContext, localContext);
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
matchesStatement = conclusionMatches; ///
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
return
|
|
46
|
+
return matchesStatement;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
matchMetastatement(metastatementNode, localMetaContext) {
|
|
50
|
-
let
|
|
50
|
+
let matchesMetastatement = false;
|
|
51
51
|
|
|
52
52
|
const metaproofSteps = localMetaContext.getMetaproofSteps(),
|
|
53
53
|
substitutions = [],
|
|
@@ -56,14 +56,14 @@ export default class Rule {
|
|
|
56
56
|
if (premisesMatch) {
|
|
57
57
|
const conclusionMatches = metaMatchConclusion(this.conclusion, metastatementNode, substitutions, this.fileContext, localMetaContext);
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
matchesMetastatement = conclusionMatches; ///
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
return
|
|
62
|
+
return matchesMetastatement;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
matchMetavariableNode(metavariableNode) {
|
|
66
|
-
const
|
|
66
|
+
const matchesMetavariableNode = this.labels.some((label) => {
|
|
67
67
|
const labelMatchesMetavariableNode = label.matchMetavariableNode(metavariableNode);
|
|
68
68
|
|
|
69
69
|
if (labelMatchesMetavariableNode) {
|
|
@@ -71,7 +71,7 @@ export default class Rule {
|
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
return
|
|
74
|
+
return matchesMetavariableNode;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
toJSON(tokens) {
|
|
@@ -150,15 +150,15 @@ function matchPremise(premise, proofStep, substitutions, fileContext, localConte
|
|
|
150
150
|
statementNode = proofStep.getStatementNode();
|
|
151
151
|
|
|
152
152
|
if (subproofNode !== null) {
|
|
153
|
-
const
|
|
153
|
+
const premiseMatchesSubproofNode = premise.matchSubproofNode(subproofNode, substitutions, fileContext, localContext);
|
|
154
154
|
|
|
155
|
-
premiseMatches =
|
|
155
|
+
premiseMatches = premiseMatchesSubproofNode; ///
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
if (statementNode !== null) {
|
|
159
|
-
const
|
|
159
|
+
const premiseMatchesStatementNode = premise.matchStatementNode(statementNode, substitutions, fileContext, localContext);
|
|
160
160
|
|
|
161
|
-
premiseMatches =
|
|
161
|
+
premiseMatches = premiseMatchesStatementNode; ///
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
return premiseMatches;
|
|
@@ -181,8 +181,8 @@ function matchPremises(premises, proofSteps, substitutions, fileContext, localCo
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
function matchConclusion(conclusion, statementNode, substitutions, fileContext, localContext) {
|
|
184
|
-
const
|
|
185
|
-
conclusionMatches =
|
|
184
|
+
const conclusionMatchesStatementNode = conclusion.matchStatementNode(statementNode, substitutions, fileContext, localContext),
|
|
185
|
+
conclusionMatches = conclusionMatchesStatementNode; ///
|
|
186
186
|
|
|
187
187
|
return conclusionMatches;
|
|
188
188
|
}
|
|
@@ -195,21 +195,21 @@ function metaMatchPremise(premise, metaproofStep, substitutions, fileContext, lo
|
|
|
195
195
|
metastatementNode = metaproofStep.getMetastatementNode()
|
|
196
196
|
|
|
197
197
|
if (ruleSubproofNode !== null) {
|
|
198
|
-
const
|
|
198
|
+
const premiseMatchesRuleSubproofNode = premise.matchRuleSubproofNode(ruleSubproofNode, substitutions, fileContext, localMetaContext);
|
|
199
199
|
|
|
200
|
-
premiseMatches =
|
|
200
|
+
premiseMatches = premiseMatchesRuleSubproofNode; ///
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
if (metaSubproofNode !== null) {
|
|
204
|
-
const
|
|
204
|
+
const premiseMatchesMetaSubproofNode = premise.matchMetaSubproofNode(metaSubproofNode, substitutions, fileContext, localMetaContext);
|
|
205
205
|
|
|
206
|
-
premiseMatches =
|
|
206
|
+
premiseMatches = premiseMatchesMetaSubproofNode; ///
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
if (metastatementNode !== null) {
|
|
210
|
-
const
|
|
210
|
+
const premiseMatchesMetastatementNode = premise.matchMetastatementNode(metastatementNode, substitutions, fileContext, localMetaContext);
|
|
211
211
|
|
|
212
|
-
premiseMatches =
|
|
212
|
+
premiseMatches = premiseMatchesMetastatementNode; ///
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
return premiseMatches;
|
|
@@ -232,8 +232,8 @@ function metaMatchPremises(premises, metaproofSteps, substitutions, fileContext,
|
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
function metaMatchConclusion(conclusion, metastatementNode, substitutions, fileContext, localMetaContext) {
|
|
235
|
-
const
|
|
236
|
-
conclusionMatches =
|
|
235
|
+
const conclusionMatchesMetastatementNode = conclusion.matchMetastatementNode(metastatementNode, substitutions, fileContext, localMetaContext),
|
|
236
|
+
conclusionMatches = conclusionMatchesMetastatementNode; ///
|
|
237
237
|
|
|
238
238
|
return conclusionMatches;
|
|
239
239
|
}
|
package/src/step/metaproof.js
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { first, second } from "../utilities/array";
|
|
4
|
-
import { matchMetastatement } from "../utilities/metaproof";
|
|
5
|
-
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
6
|
-
|
|
7
|
-
const metastatementNodesQuery = nodesQuery("/subproofAssertion/metastatement"),
|
|
8
|
-
ruleSubproofAssertionNodeQuery = nodeQuery("/metastatement/subproofAssertion"),
|
|
9
|
-
qualifiedOrUnqualifiedMetastatementMetastatementNodesQuery = nodesQuery("/ruleSubproof/qualifiedMetastatement|unqualifiedMetastatement/metastatement!");
|
|
10
|
-
|
|
11
3
|
export default class MetaproofStep {
|
|
12
4
|
constructor(statementNode, ruleSubproofNode, metaSubproofNode, metastatementNode) {
|
|
13
5
|
this.statementNode = statementNode;
|
|
@@ -32,94 +24,41 @@ export default class MetaproofStep {
|
|
|
32
24
|
return this.metastatementNode;
|
|
33
25
|
}
|
|
34
26
|
|
|
35
|
-
|
|
36
|
-
let
|
|
37
|
-
|
|
38
|
-
if (!matches) {
|
|
39
|
-
const ruleSubproofAssertionNode = ruleSubproofAssertionNodeQuery(metastatementNode);
|
|
40
|
-
|
|
41
|
-
if (ruleSubproofAssertionNode !== null) {
|
|
42
|
-
const ruleSubproofAssertionMatches = this.matchRuleSubproofAssertion(ruleSubproofAssertionNode);
|
|
43
|
-
|
|
44
|
-
matches = ruleSubproofAssertionMatches; ///
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (!matches) {
|
|
49
|
-
const metastatementMatches = this.matchMetastatement(metastatementNode);
|
|
50
|
-
|
|
51
|
-
matches = metastatementMatches; ///
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return matches;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
matchMetastatement(metastatementNode) {
|
|
58
|
-
let metastatementMatches = false;
|
|
27
|
+
matchMetastatementNode(metastatementNode) {
|
|
28
|
+
let matchesMetastatementNode = false;
|
|
59
29
|
|
|
60
30
|
if (this.metastatementNode !== null) {
|
|
61
|
-
|
|
62
|
-
metastatementNodeB = this.metastatementNode; ///
|
|
63
|
-
|
|
64
|
-
metastatementMatches = matchMetastatement(metastatementNodeA, metastatementNodeB);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return metastatementMatches;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
matchRuleSubproofAssertion(ruleSubproofAssertionNode) {
|
|
71
|
-
let ruleSubproofAssertionMatches = false;
|
|
72
|
-
|
|
73
|
-
if (this.ruleSubproofNode !== null) {
|
|
74
|
-
const ruleSubproofAssertionMetastatementNodes = metastatementNodesQuery(ruleSubproofAssertionNode),
|
|
75
|
-
firstRuleSubproofAssertionMetastatementNode = first(ruleSubproofAssertionMetastatementNodes),
|
|
76
|
-
qualifiedOrUnqualifiedMetastatementMetastatementNodes = qualifiedOrUnqualifiedMetastatementMetastatementNodesQuery(this.ruleSubproofNode),
|
|
77
|
-
firstQualifiedOrUnqualifiedMetastatementMetastatementNode = first(qualifiedOrUnqualifiedMetastatementMetastatementNodes);
|
|
78
|
-
|
|
79
|
-
const metastatementNodeA = firstRuleSubproofAssertionMetastatementNode, ///
|
|
80
|
-
metastatementNodeB = firstQualifiedOrUnqualifiedMetastatementMetastatementNode, ///
|
|
81
|
-
metastatementMatches = matchMetastatement(metastatementNodeA, metastatementNodeB);
|
|
82
|
-
|
|
83
|
-
if (metastatementMatches) {
|
|
84
|
-
const secondRuleSubproofAssertionMetastatementNode = second(ruleSubproofAssertionMetastatementNodes),
|
|
85
|
-
secondQualifiedOrUnqualifiedMetastatementMetastatementNode = second(qualifiedOrUnqualifiedMetastatementMetastatementNodes);
|
|
86
|
-
|
|
87
|
-
const metastatementNodeA = secondRuleSubproofAssertionMetastatementNode, ///
|
|
88
|
-
metastatementNodeB = secondQualifiedOrUnqualifiedMetastatementMetastatementNode, ///
|
|
89
|
-
metastatementMatches = matchMetastatement(metastatementNodeA, metastatementNodeB);
|
|
90
|
-
|
|
91
|
-
ruleSubproofAssertionMatches = metastatementMatches; ///
|
|
92
|
-
}
|
|
31
|
+
matchesMetastatementNode = this.metastatementNode.match(metastatementNode);
|
|
93
32
|
}
|
|
94
33
|
|
|
95
|
-
return
|
|
34
|
+
return matchesMetastatementNode;
|
|
96
35
|
}
|
|
97
36
|
|
|
98
37
|
static fromStatementNode(statementNode) {
|
|
99
38
|
const ruleSubproofNode = null,
|
|
100
39
|
metaSubproofNode = null,
|
|
101
40
|
metastatementNode = null,
|
|
102
|
-
|
|
41
|
+
metaproofStep = new MetaproofStep(statementNode, ruleSubproofNode, metaSubproofNode, metastatementNode);
|
|
103
42
|
|
|
104
|
-
return
|
|
43
|
+
return metaproofStep;
|
|
105
44
|
}
|
|
106
45
|
|
|
107
46
|
static fromRuleSubproofNode(ruleSubproofNode) {
|
|
108
47
|
const statementNode = null,
|
|
109
48
|
metaSubproofNode = null,
|
|
110
49
|
metastatementNode = null,
|
|
111
|
-
|
|
50
|
+
metaproofStep = new MetaproofStep(statementNode, ruleSubproofNode, metaSubproofNode, metastatementNode);
|
|
112
51
|
|
|
113
|
-
return
|
|
52
|
+
return metaproofStep;
|
|
114
53
|
}
|
|
115
54
|
|
|
116
55
|
static fromMetaSubproofNode(metaSubproofNode) {
|
|
117
56
|
const statementNode = null,
|
|
118
57
|
ruleSubproofNode = null,
|
|
119
58
|
metastatementNode = null,
|
|
120
|
-
|
|
59
|
+
metaproofStep = new MetaproofStep(statementNode, ruleSubproofNode, metaSubproofNode, metastatementNode);
|
|
121
60
|
|
|
122
|
-
return
|
|
61
|
+
return metaproofStep;
|
|
123
62
|
|
|
124
63
|
}
|
|
125
64
|
|
|
@@ -127,8 +66,8 @@ export default class MetaproofStep {
|
|
|
127
66
|
const statementNode = null,
|
|
128
67
|
ruleSubproofNode = null,
|
|
129
68
|
metaSubproofNode = null,
|
|
130
|
-
|
|
69
|
+
metaproofStep = new MetaproofStep(statementNode, ruleSubproofNode, metaSubproofNode, metastatementNode);
|
|
131
70
|
|
|
132
|
-
return
|
|
71
|
+
return metaproofStep;
|
|
133
72
|
}
|
|
134
73
|
}
|
package/src/step/proof.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { META_ARGUMENT_RULE_NAME } from "../ruleNames";
|
|
4
|
-
import { matchStatementModuloBrackets } from "../utilities/proof";
|
|
5
|
-
|
|
6
3
|
export default class ProofStep {
|
|
7
4
|
constructor(subproofNode, statementNode) {
|
|
8
5
|
this.subproofNode = subproofNode;
|
|
@@ -17,42 +14,27 @@ export default class ProofStep {
|
|
|
17
14
|
return this.statementNode;
|
|
18
15
|
}
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
let
|
|
22
|
-
|
|
23
|
-
const statementMatches = this.matchStatement(statementNode);
|
|
24
|
-
|
|
25
|
-
matches = statementMatches; //
|
|
26
|
-
|
|
27
|
-
return matches;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
matchStatement(statementNode) {
|
|
31
|
-
let statementMatches = false;
|
|
17
|
+
matchStatementNode(statementNode) {
|
|
18
|
+
let matchesStatementNode = false;
|
|
32
19
|
|
|
33
20
|
if (this.statementNode !== null) {
|
|
34
|
-
|
|
35
|
-
statementNodeA = statementNode, ///
|
|
36
|
-
statementNodeB = this.statementNode, ///
|
|
37
|
-
statementMatchesModuloBrackets = matchStatementModuloBrackets(statementNodeA, statementNodeB, ruleName);
|
|
38
|
-
|
|
39
|
-
statementMatches = statementMatchesModuloBrackets; ///
|
|
21
|
+
matchesStatementNode = this.statementNode.match(statementNode);
|
|
40
22
|
}
|
|
41
23
|
|
|
42
|
-
return
|
|
24
|
+
return matchesStatementNode;
|
|
43
25
|
}
|
|
44
26
|
|
|
45
27
|
static fromSubproofNode(subproofNode) {
|
|
46
28
|
const statementNode = null,
|
|
47
|
-
|
|
29
|
+
proofStep = new ProofStep(subproofNode, statementNode);
|
|
48
30
|
|
|
49
|
-
return
|
|
31
|
+
return proofStep;
|
|
50
32
|
}
|
|
51
33
|
|
|
52
34
|
static fromStatementNode(statementNode) {
|
|
53
35
|
const subproofNode = null,
|
|
54
|
-
|
|
36
|
+
proofStep = new ProofStep(subproofNode, statementNode);
|
|
55
37
|
|
|
56
|
-
return
|
|
38
|
+
return proofStep;
|
|
57
39
|
}
|
|
58
40
|
}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import Substitution from "../substitution";
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { nodeAsString } from "../utilities/string";
|
|
6
|
+
import { bracketedMetastatementChildNodeFromMetastatementNode } from "../utilities/match";
|
|
7
|
+
import { metavariableNodeFromMetavariableString, metastatementNodeFromMetastatementString } from "../utilities/node";
|
|
8
8
|
|
|
9
9
|
export default class MetastatementForMetavariableSubstitution extends Substitution {
|
|
10
10
|
constructor(metavariableNode, metastatementNode) {
|
|
@@ -23,27 +23,27 @@ export default class MetastatementForMetavariableSubstitution extends Substituti
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
matchMetavariableNode(metavariableNode) {
|
|
26
|
-
const
|
|
26
|
+
const matchesMetavariableNode = this.metavariableNode.match(metavariableNode);
|
|
27
27
|
|
|
28
|
-
return
|
|
28
|
+
return matchesMetavariableNode;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
matchMetastatementNode(metastatementNode) {
|
|
32
|
-
let
|
|
32
|
+
let matchesMetastatementNode;
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
matchesMetastatementNode = this.metastatementNode.match(metastatementNode)
|
|
35
35
|
|
|
36
|
-
if (!
|
|
36
|
+
if (!matchesMetastatementNode) {
|
|
37
37
|
const bracketedMetastatementChildNode = bracketedMetastatementChildNodeFromMetastatementNode(metastatementNode);
|
|
38
38
|
|
|
39
39
|
if (bracketedMetastatementChildNode !== null) {
|
|
40
40
|
const metastatementNode = bracketedMetastatementChildNode; ///
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
matchesMetastatementNode = this.metastatementNode.match(metastatementNode);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
return
|
|
46
|
+
return matchesMetastatementNode;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
toJSON(tokens) {
|
|
@@ -4,7 +4,7 @@ import Substitution from "../substitution";
|
|
|
4
4
|
import TermForVariableSubstitution from "./termForVariable";
|
|
5
5
|
import verifyStatementAgainstStatement from "../verify/statementAtainstStatement";
|
|
6
6
|
|
|
7
|
-
import { bracketedStatementChildNodeFromStatementNode } from "../utilities/
|
|
7
|
+
import { bracketedStatementChildNodeFromStatementNode } from "../utilities/match";
|
|
8
8
|
|
|
9
9
|
export default class StatementForMetavariableSubstitution extends Substitution {
|
|
10
10
|
constructor(metavariableNode, statementNode, substitution) {
|
|
@@ -50,9 +50,9 @@ export default class StatementForMetavariableSubstitution extends Substitution {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
matchMetavariableNode(metavariableNode) {
|
|
53
|
-
const
|
|
53
|
+
const matchesMetavariableNode = this.metavariableNode.match(metavariableNode);
|
|
54
54
|
|
|
55
|
-
return
|
|
55
|
+
return matchesMetavariableNode;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
static fromMetavariableNodeAndStatementNode(metavariableNode, statementNode) {
|
|
@@ -102,7 +102,9 @@ function matchStatementNode(statementNodeA, statementNodeB, substitution, substi
|
|
|
102
102
|
let statementNodeMatches;
|
|
103
103
|
|
|
104
104
|
if (substitution === null) {
|
|
105
|
-
|
|
105
|
+
const statementNodeAMatchesStatementNodeB = statementNodeB.match(statementNodeA);
|
|
106
|
+
|
|
107
|
+
statementNodeMatches = statementNodeAMatchesStatementNodeB; ///
|
|
106
108
|
} else {
|
|
107
109
|
const statementVerifiedAgainstStatement = verifyStatementAgainstStatement(statementNodeA, statementNodeB, substitution, substitutions, localContextA, localContextB);
|
|
108
110
|
|
|
@@ -34,15 +34,15 @@ export default class TermForVariableSubstitution extends Substitution {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
matchTermNode(termNode) {
|
|
37
|
-
const
|
|
37
|
+
const matchesTermNode = this.termNode.match(termNode);
|
|
38
38
|
|
|
39
|
-
return
|
|
39
|
+
return matchesTermNode;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
matchVariableNode(variableNode) {
|
|
43
|
-
const
|
|
43
|
+
const matchesVariableNode = this.variableNode.match(variableNode);
|
|
44
44
|
|
|
45
|
-
return
|
|
45
|
+
return matchesVariableNode;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
static fromSubstitutionNode(substitutionNode) {
|
|
@@ -91,9 +91,9 @@ function substituteTermNode(termNode, substitutions) {
|
|
|
91
91
|
|
|
92
92
|
if (termVariableNode !== null) {
|
|
93
93
|
substitutions.some((substitution) => {
|
|
94
|
-
const
|
|
94
|
+
const substitutionMatchesVariableNode = substitution.matchVariableNode(termVariableNode);
|
|
95
95
|
|
|
96
|
-
if (
|
|
96
|
+
if (substitutionMatchesVariableNode) {
|
|
97
97
|
termNode = substitution.getTermNode(); ///
|
|
98
98
|
|
|
99
99
|
return true;
|
|
@@ -106,9 +106,9 @@ function substituteTermNode(termNode, substitutions) {
|
|
|
106
106
|
|
|
107
107
|
function substituteVariableNode(variableNode, substitutions) {
|
|
108
108
|
substitutions.some((substitution) => {
|
|
109
|
-
const
|
|
109
|
+
const substitutionMatchesVariableNode = substitution.matchVariableNode(variableNode);
|
|
110
110
|
|
|
111
|
-
if (
|
|
111
|
+
if (substitutionMatchesVariableNode) {
|
|
112
112
|
const termNode = substitution.getTermNode(),
|
|
113
113
|
termVariableNode = variableNodeQuery(termNode);
|
|
114
114
|
|
package/src/substitution.js
CHANGED
|
@@ -2,32 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
export default class Substitution {
|
|
4
4
|
matchTermNode(termNode) {
|
|
5
|
-
const
|
|
5
|
+
const matchesTermNode = false;
|
|
6
6
|
|
|
7
|
-
return
|
|
7
|
+
return matchesTermNode;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
matchVariableNode(variableNode) {
|
|
11
|
-
const
|
|
11
|
+
const matchesMetavariableNode = false;
|
|
12
12
|
|
|
13
|
-
return
|
|
13
|
+
return matchesMetavariableNode;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
matchStatementNode(statementNode) {
|
|
17
|
-
const
|
|
17
|
+
const matchesStatementNode = false;
|
|
18
18
|
|
|
19
|
-
return
|
|
19
|
+
return matchesStatementNode;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
matchMetavariableNode(metavariableNode) {
|
|
23
|
-
const
|
|
23
|
+
const matchesMetavariableNode = false;
|
|
24
24
|
|
|
25
|
-
return
|
|
25
|
+
return matchesMetavariableNode;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
matchMetastatementNode(metastatementNode) {
|
|
29
|
-
const
|
|
29
|
+
const matchesMetastatementNode = false;
|
|
30
30
|
|
|
31
|
-
return
|
|
31
|
+
return matchesMetastatementNode;
|
|
32
32
|
}
|
|
33
33
|
}
|