occam-verify-cli 0.0.507 → 0.0.509
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/assertion/type.js +90 -0
- package/lib/axiomLemmaTheorem.js +2 -2
- package/lib/combinator.js +7 -1
- package/lib/conclusion.js +6 -6
- package/lib/consequence.js +4 -4
- package/lib/matcher/metastatementForMetavariable/conclusion.js +113 -0
- package/lib/matcher/metastatementForMetavariable/premise.js +113 -0
- package/lib/matcher/metastatementForMetavariable.js +201 -0
- package/lib/matcher/statementForMetavariable/conclusion.js +113 -0
- package/lib/matcher/statementForMetavariable/premise.js +113 -0
- package/lib/matcher/statementForMetavariable.js +201 -0
- package/lib/matcher/statementForVariable/consequence.js +113 -0
- package/lib/matcher/statementForVariable/supposition.js +113 -0
- package/lib/matcher/statementForVariable.js +201 -0
- package/lib/matcher.js +124 -10
- package/lib/premise.js +19 -19
- package/lib/rule.js +11 -11
- package/lib/substitution/metastatementForMetavariable.js +86 -0
- package/lib/substitution/statementForMetavariable.js +86 -0
- package/lib/substitution/statementForVariable.js +86 -0
- package/lib/supposition.js +9 -9
- package/lib/verify/assertion/type.js +19 -23
- package/lib/verify/conclusion.js +6 -5
- package/lib/verify/consequence.js +6 -5
- package/lib/verify/derivation.js +2 -2
- package/lib/verify/metastatement/qualified.js +19 -5
- package/lib/verify/metastatement/unqualified.js +16 -4
- package/lib/verify/metastatement.js +3 -3
- package/lib/verify/premise.js +6 -5
- package/lib/verify/ruleDerivation.js +2 -2
- package/lib/verify/statement/qualified.js +9 -8
- package/lib/verify/statement/unqualified.js +16 -4
- package/lib/verify/statement.js +106 -9
- package/lib/verify/supposition.js +11 -11
- package/package.json +3 -3
- package/src/assertion/type.js +46 -0
- package/src/axiomLemmaTheorem.js +1 -1
- package/src/combinator.js +4 -0
- package/src/conclusion.js +9 -9
- package/src/consequence.js +5 -5
- package/src/matcher/metastatementForMetavariable/conclusion.js +9 -0
- package/src/matcher/metastatementForMetavariable/premise.js +9 -0
- package/src/matcher/metastatementForMetavariable.js +99 -0
- package/src/matcher/statementForMetavariable/conclusion.js +9 -0
- package/src/matcher/statementForMetavariable/premise.js +9 -0
- package/src/matcher/statementForMetavariable.js +99 -0
- package/src/matcher/statementForVariable/consequence.js +9 -0
- package/src/matcher/statementForVariable/supposition.js +9 -0
- package/src/matcher/statementForVariable.js +99 -0
- package/src/matcher.js +70 -3
- package/src/premise.js +42 -42
- package/src/rule.js +12 -12
- package/src/{metaSubstitution.js → substitution/metastatementForMetavariable.js} +7 -7
- package/src/{substitution.js → substitution/statementForMetavariable.js} +7 -7
- package/src/substitution/statementForVariable.js +64 -0
- package/src/supposition.js +20 -20
- package/src/verify/assertion/type.js +24 -25
- package/src/verify/conclusion.js +11 -5
- package/src/verify/consequence.js +10 -4
- package/src/verify/derivation.js +4 -2
- package/src/verify/metastatement/qualified.js +20 -6
- package/src/verify/metastatement/unqualified.js +13 -3
- package/src/verify/metastatement.js +2 -2
- package/src/verify/premise.js +10 -4
- package/src/verify/ruleDerivation.js +4 -2
- package/src/verify/statement/qualified.js +13 -11
- package/src/verify/statement/unqualified.js +13 -3
- package/src/verify/statement.js +175 -9
- package/src/verify/supposition.js +16 -12
- package/lib/matcher/conclusion.js +0 -194
- package/lib/matcher/consequence.js +0 -194
- package/lib/matcher/premise.js +0 -199
- package/lib/matcher/supposition.js +0 -199
- package/lib/metaMatcher/conclusion.js +0 -194
- package/lib/metaMatcher/premise.js +0 -199
- package/lib/metaMatcher.js +0 -36
- package/lib/metaSubstitution.js +0 -86
- package/lib/mixins/matcher.js +0 -109
- package/lib/substitution.js +0 -86
- package/lib/verify/metaDerivation.js +0 -63
- package/lib/verify/metaproof.js +0 -32
- package/src/matcher/conclusion.js +0 -86
- package/src/matcher/consequence.js +0 -89
- package/src/matcher/premise.js +0 -94
- package/src/matcher/supposition.js +0 -97
- package/src/metaMatcher/conclusion.js +0 -86
- package/src/metaMatcher/premise.js +0 -94
- package/src/metaMatcher.js +0 -9
- package/src/mixins/matcher.js +0 -81
- package/src/verify/metaDerivation.js +0 -75
- package/src/verify/metaproof.js +0 -35
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { matcher } from "
|
|
4
|
-
import { METASTATEMENT_RULE_NAME } from "
|
|
5
|
-
import { bracketedNonTerminalChildNodeFromChildNodes } from "
|
|
3
|
+
import { matcher } from "../matcher";
|
|
4
|
+
import { METASTATEMENT_RULE_NAME } from "../ruleNames";
|
|
5
|
+
import { bracketedNonTerminalChildNodeFromChildNodes } from "../utilities/substitution";
|
|
6
6
|
|
|
7
|
-
export default class
|
|
7
|
+
export default class MetastatementForMetavariableSubstitution {
|
|
8
8
|
constructor(metavariableName, metastatementNode) {
|
|
9
9
|
this.metavariableName = metavariableName;
|
|
10
10
|
this.metastatementNode = metastatementNode;
|
|
@@ -47,7 +47,7 @@ export default class MetaSubstitution {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
static fromMetavariableNameAndMetastatementNode(metavariableName, metastatementNode) {
|
|
50
|
-
let
|
|
50
|
+
let metastatementForMetavariableSubstitution = new MetastatementForMetavariableSubstitution(metavariableName, metastatementNode);
|
|
51
51
|
|
|
52
52
|
const nonTerminalNode = metastatementNode, ///
|
|
53
53
|
childNodes = nonTerminalNode.getChildNodes(),
|
|
@@ -56,9 +56,9 @@ export default class MetaSubstitution {
|
|
|
56
56
|
metastatementNode = bracketedNonTerminalChildNodeFromChildNodes(childNodes, ruleName); ///
|
|
57
57
|
|
|
58
58
|
if (metastatementNode !== null) {
|
|
59
|
-
|
|
59
|
+
metastatementForMetavariableSubstitution = new MetastatementForMetavariableSubstitution(metavariableName, metastatementNode);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
return
|
|
62
|
+
return metastatementForMetavariableSubstitution;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { matcher } from "
|
|
4
|
-
import { STATEMENT_RULE_NAME } from "
|
|
5
|
-
import { bracketedNonTerminalChildNodeFromChildNodes } from "
|
|
3
|
+
import { matcher } from "../matcher";
|
|
4
|
+
import { STATEMENT_RULE_NAME } from "../ruleNames";
|
|
5
|
+
import { bracketedNonTerminalChildNodeFromChildNodes } from "../utilities/substitution";
|
|
6
6
|
|
|
7
|
-
export default class
|
|
7
|
+
export default class StatementForMetavariableSubstitution {
|
|
8
8
|
constructor(metavariableName, statementNode) {
|
|
9
9
|
this.metavariableName = metavariableName;
|
|
10
10
|
this.statementNode = statementNode;
|
|
@@ -47,7 +47,7 @@ export default class Substitution {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
static fromMetavariableNameAndStatementNode(metavariableName, statementNode) {
|
|
50
|
-
let
|
|
50
|
+
let statementForMetavariableSubstitution = new StatementForMetavariableSubstitution(metavariableName, statementNode);
|
|
51
51
|
|
|
52
52
|
const nonTerminalNode = statementNode, ///
|
|
53
53
|
childNodes = nonTerminalNode.getChildNodes(),
|
|
@@ -56,9 +56,9 @@ export default class Substitution {
|
|
|
56
56
|
statementNode = bracketedNonTerminalChildNodeFromChildNodes(childNodes, ruleName); ///
|
|
57
57
|
|
|
58
58
|
if (statementNode !== null) {
|
|
59
|
-
|
|
59
|
+
statementForMetavariableSubstitution = new StatementForMetavariableSubstitution(metavariableName, statementNode);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
return
|
|
62
|
+
return statementForMetavariableSubstitution;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { matcher } from "../matcher";
|
|
4
|
+
import { STATEMENT_RULE_NAME } from "../ruleNames";
|
|
5
|
+
import { bracketedNonTerminalChildNodeFromChildNodes } from "../utilities/substitution";
|
|
6
|
+
|
|
7
|
+
export default class StatementForVariableSubstitution {
|
|
8
|
+
constructor(variableName, statementNode) {
|
|
9
|
+
this.variableName = variableName;
|
|
10
|
+
this.statementNode = statementNode;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
getVariableName() {
|
|
14
|
+
return this.variableName;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getStatementNode() {
|
|
18
|
+
return this.statementNode;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
matchStatementNode(statementNode) {
|
|
22
|
+
let matchesStatementNode;
|
|
23
|
+
|
|
24
|
+
const nodeA = this.statementNode, ///
|
|
25
|
+
nodeB = statementNode,
|
|
26
|
+
nodeMatches = matcher.matchNode(nodeA, nodeB);
|
|
27
|
+
|
|
28
|
+
matchesStatementNode = nodeMatches; ///
|
|
29
|
+
|
|
30
|
+
if (!matchesStatementNode) {
|
|
31
|
+
const nonTerminalNode = statementNode, ///
|
|
32
|
+
childNodes = nonTerminalNode.getChildNodes(), ///
|
|
33
|
+
ruleName = STATEMENT_RULE_NAME;
|
|
34
|
+
|
|
35
|
+
statementNode = bracketedNonTerminalChildNodeFromChildNodes(childNodes, ruleName); ///
|
|
36
|
+
|
|
37
|
+
if (statementNode !== null) {
|
|
38
|
+
const nodeA = this.statementNode, ///
|
|
39
|
+
nodeB = statementNode,
|
|
40
|
+
nodeMatches = matchNode(nodeA, nodeB);
|
|
41
|
+
|
|
42
|
+
matchesStatementNode = nodeMatches; ///
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return matchesStatementNode;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static fromVariableNameAndStatementNode(variableName, statementNode) {
|
|
50
|
+
let statementForVariableSubstitution = new StatementForVariableSubstitution(variableName, statementNode);
|
|
51
|
+
|
|
52
|
+
const nonTerminalNode = statementNode, ///
|
|
53
|
+
childNodes = nonTerminalNode.getChildNodes(),
|
|
54
|
+
ruleName = STATEMENT_RULE_NAME;
|
|
55
|
+
|
|
56
|
+
statementNode = bracketedNonTerminalChildNodeFromChildNodes(childNodes, ruleName); ///
|
|
57
|
+
|
|
58
|
+
if (statementNode !== null) {
|
|
59
|
+
statementForVariableSubstitution = new StatementForVariableSubstitution(variableName, statementNode);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return statementForVariableSubstitution;
|
|
63
|
+
}
|
|
64
|
+
}
|
package/src/supposition.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { nodeAsString } from "./utilities/string";
|
|
4
|
-
import { suppositionMatcher } from "./matcher/supposition";
|
|
5
4
|
import { nodeQuery, nodesQuery } from "./utilities/query";
|
|
6
5
|
import { statementNodeFromStatementString } from "./utilities/string";
|
|
6
|
+
import { suppositionStatementForVariableMatcher } from "./matcher/statementForVariable/supposition";
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const subproofAssertionNodeQuery = nodeQuery("/statement/subproofAssertion!"),
|
|
9
|
+
subproofAssertionStatementNodesQuery = nodesQuery("/subproofAssertion/statement"),
|
|
10
|
+
subproofSuppositionStatementNodesQuery = nodesQuery("/subproof/supposition/unqualifiedStatement/statement!"),
|
|
11
|
+
subproofSubDerivationLastStatementNodeQuery = nodeQuery("/subproof/subDerivation/qualifiedStatement|unqualifiedStatement[-1]/statement!");
|
|
12
12
|
|
|
13
13
|
export default class Supposition {
|
|
14
14
|
constructor(statementNode) {
|
|
@@ -25,22 +25,22 @@ export default class Supposition {
|
|
|
25
25
|
const subproofAssertionNode = subproofAssertionNodeQuery(this.statementNode);
|
|
26
26
|
|
|
27
27
|
if (subproofAssertionNode !== null) {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
qualifiedOrUnqualifiedStatementStatementNode
|
|
28
|
+
const subproofSuppositionStatementNodes = subproofSuppositionStatementNodesQuery(subproofNode),
|
|
29
|
+
subproofSubDerivationLastStatementNode = subproofSubDerivationLastStatementNodeQuery(subproofNode),
|
|
30
|
+
subproofStatementNodes = [
|
|
31
|
+
...subproofSuppositionStatementNodes,
|
|
32
|
+
subproofSubDerivationLastStatementNode
|
|
34
33
|
],
|
|
35
|
-
|
|
34
|
+
subproofAssertionStatementNodes = subproofAssertionStatementNodesQuery(subproofAssertionNode),
|
|
35
|
+
subproofStatementNodesLength = subproofStatementNodes.length,
|
|
36
36
|
subproofAssertionStatementNodesLength = subproofAssertionStatementNodes.length;
|
|
37
37
|
|
|
38
|
-
if (
|
|
38
|
+
if (subproofStatementNodesLength === subproofAssertionStatementNodesLength) {
|
|
39
39
|
subproofNodeMatches = subproofAssertionStatementNodes.every((subproofAssertionStatementNode, index) => {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
nonTerminalNodeMatches =
|
|
40
|
+
const subproofStatementNode = subproofStatementNodes[index],
|
|
41
|
+
nonTerminalNodeA = subproofAssertionStatementNode, ///
|
|
42
|
+
nonTerminalNodeB = subproofStatementNode, ///
|
|
43
|
+
nonTerminalNodeMatches = suppositionStatementForVariableMatcher.matchNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions);
|
|
44
44
|
|
|
45
45
|
if (nonTerminalNodeMatches) {
|
|
46
46
|
return true;
|
|
@@ -53,9 +53,9 @@ export default class Supposition {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
matchStatementNode(statementNode, substitutions) {
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
nonTerminalNodeMatches =
|
|
56
|
+
const nonTerminalNodeA = this.statementNode, ///
|
|
57
|
+
nonTerminalNodeB = statementNode, ///
|
|
58
|
+
nonTerminalNodeMatches = suppositionStatementForVariableMatcher.matchNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions),
|
|
59
59
|
statementNodeMatches = nonTerminalNodeMatches; ///
|
|
60
60
|
|
|
61
61
|
return statementNodeMatches;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import TypeAssertion from "../../assertion/type";
|
|
4
4
|
|
|
5
5
|
import { first } from "../../utilities/array";
|
|
6
6
|
import { nodeAsString } from "../../utilities/string";
|
|
@@ -10,14 +10,14 @@ import { verifyTermAsVariable, verifyTermAgainstConstructors } from "../../verif
|
|
|
10
10
|
const termNodeQuery = nodeQuery("/typeAssertion/term"),
|
|
11
11
|
typeNodeQuery = nodeQuery("/typeAssertion/type");
|
|
12
12
|
|
|
13
|
-
export default function
|
|
13
|
+
export default function verifyTypeAssertion(typeAssertionNode, assertions, proofContext) {
|
|
14
14
|
let typeAssertionVerified = false;
|
|
15
15
|
|
|
16
16
|
proofContext.begin(typeAssertionNode);
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const typsAssertionString = nodeAsString(typeAssertionNode);
|
|
19
19
|
|
|
20
|
-
proofContext.debug(`Verifying the '${
|
|
20
|
+
proofContext.debug(`Verifying the '${typsAssertionString}' type assertion...`);
|
|
21
21
|
|
|
22
22
|
const typeNode = typeNodeQuery(typeAssertionNode),
|
|
23
23
|
typeName = typeNameFromTypeNode(typeNode),
|
|
@@ -27,20 +27,20 @@ export default function verifyStatementTypeAssertion(typeAssertionNode, qualifie
|
|
|
27
27
|
proofContext.error(`The ${typeName} type is not present.`);
|
|
28
28
|
} else {
|
|
29
29
|
if (!typeAssertionVerified) {
|
|
30
|
-
const variableTypeAssertionVerified = verifyVariableTypeAssertion(typeAssertionNode,
|
|
30
|
+
const variableTypeAssertionVerified = verifyVariableTypeAssertion(typeAssertionNode, assertions, proofContext);
|
|
31
31
|
|
|
32
32
|
typeAssertionVerified = variableTypeAssertionVerified; ///
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
if (!typeAssertionVerified) {
|
|
36
|
-
const termTypeAssertionVerified = verifyTermTypeAssertion(typeAssertionNode,
|
|
36
|
+
const termTypeAssertionVerified = verifyTermTypeAssertion(typeAssertionNode, assertions, proofContext);
|
|
37
37
|
|
|
38
38
|
typeAssertionVerified = termTypeAssertionVerified; ///
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
if (typeAssertionVerified) {
|
|
43
|
-
proofContext.info(`Verified the '${
|
|
43
|
+
proofContext.info(`Verified the '${typsAssertionString}' statement type assertion.`);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
typeAssertionVerified ?
|
|
@@ -50,7 +50,7 @@ export default function verifyStatementTypeAssertion(typeAssertionNode, qualifie
|
|
|
50
50
|
return typeAssertionVerified;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
function verifyVariableTypeAssertion(typeAssertionNode,
|
|
53
|
+
function verifyVariableTypeAssertion(typeAssertionNode, assertions, proofContext) {
|
|
54
54
|
let variableTypeAssertionVerified = false;
|
|
55
55
|
|
|
56
56
|
const context = proofContext, ///
|
|
@@ -66,22 +66,19 @@ function verifyVariableTypeAssertion(typeAssertionNode, qualified, proofContext)
|
|
|
66
66
|
firstVariable = first(variables),
|
|
67
67
|
variable = firstVariable, ///
|
|
68
68
|
variableName = variable.getName(),
|
|
69
|
-
variableType = variable.getType()
|
|
70
|
-
|
|
71
|
-
const assertedTypeEqualToOrSubTypeOfVariableType = (variableType === null) ?
|
|
69
|
+
variableType = variable.getType(),
|
|
70
|
+
assertedTypeEqualToOrSubTypeOfVariableType = (variableType === null) ?
|
|
72
71
|
true : ///
|
|
73
72
|
assertedType.isEqualToOrSubTypeOf(variableType);
|
|
74
73
|
|
|
75
74
|
if (!assertedTypeEqualToOrSubTypeOfVariableType) {
|
|
76
75
|
proofContext.error(`The asserted type is not equal to or a sub-type of the '${variableName}' variable type.`);
|
|
77
76
|
} else {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
variable = Variable.fromTypeAndName(type, name);
|
|
77
|
+
const type = assertedType, ///
|
|
78
|
+
typeAssertion = TypeAssertion.fromTypeAndVariableName(type, variableName),
|
|
79
|
+
assertion = typeAssertion; ///
|
|
82
80
|
|
|
83
|
-
|
|
84
|
-
}
|
|
81
|
+
assertions.push(assertion);
|
|
85
82
|
|
|
86
83
|
variableTypeAssertionVerified = true;
|
|
87
84
|
}
|
|
@@ -90,7 +87,7 @@ function verifyVariableTypeAssertion(typeAssertionNode, qualified, proofContext)
|
|
|
90
87
|
return variableTypeAssertionVerified;
|
|
91
88
|
}
|
|
92
89
|
|
|
93
|
-
function verifyTermTypeAssertion(typeAssertionNode,
|
|
90
|
+
function verifyTermTypeAssertion(typeAssertionNode, assertions, proofContext) {
|
|
94
91
|
let termTypeAssertionVerified = false;
|
|
95
92
|
|
|
96
93
|
const types = [],
|
|
@@ -106,16 +103,18 @@ function verifyTermTypeAssertion(typeAssertionNode, qualified, proofContext) {
|
|
|
106
103
|
firstType = first(types),
|
|
107
104
|
termType = firstType,
|
|
108
105
|
termString = nodeAsString(termNode),
|
|
109
|
-
|
|
106
|
+
assertedTypeEqualToTermType = (termType === null) ?
|
|
110
107
|
true : ///
|
|
111
|
-
assertedType.
|
|
108
|
+
assertedType.isEqualTo(termType);
|
|
112
109
|
|
|
113
|
-
if (!
|
|
114
|
-
proofContext.error(`The asserted type is not equal to
|
|
110
|
+
if (!assertedTypeEqualToTermType) {
|
|
111
|
+
proofContext.error(`The asserted type is not equal to the '${termString}' term type.`);
|
|
115
112
|
} else {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
const type = assertedType, ///
|
|
114
|
+
typeAssertion = TypeAssertion.fromTypeAndTermNode(type, termNode),
|
|
115
|
+
assertion = typeAssertion; ///
|
|
116
|
+
|
|
117
|
+
assertions.push(assertion);
|
|
119
118
|
|
|
120
119
|
termTypeAssertionVerified = true;
|
|
121
120
|
}
|
package/src/verify/conclusion.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Conclusion from "../conclusion";
|
|
4
|
+
import verifyUnqualifiedMetastatement from "./metastatement/unqualified";
|
|
4
5
|
|
|
5
6
|
import { nodeQuery } from "../utilities/query";
|
|
6
|
-
import {nodeAsString} from "../utilities/string";
|
|
7
|
+
import { nodeAsString } from "../utilities/string";
|
|
7
8
|
|
|
8
|
-
const metastatementNodeQuery = nodeQuery("/
|
|
9
|
+
const metastatementNodeQuery = nodeQuery("/unqualifiedMetastatement/metastatement!"),
|
|
10
|
+
unqualifiedMetastatementNodeQuery = nodeQuery("/conclusion/unqualifiedMetastatement!");
|
|
9
11
|
|
|
10
12
|
export default function verifyConclusion(conclusionNode, conclusions, metaproofContext) {
|
|
11
13
|
let conclusionVerified = false;
|
|
@@ -16,10 +18,14 @@ export default function verifyConclusion(conclusionNode, conclusions, metaproofC
|
|
|
16
18
|
|
|
17
19
|
metaproofContext.debug(`Verifying the '${conclusionString}' conclusion...`);
|
|
18
20
|
|
|
19
|
-
const
|
|
21
|
+
const derived = false,
|
|
22
|
+
assertions = [],
|
|
23
|
+
unqualifiedMetastatementNode = unqualifiedMetastatementNodeQuery(conclusionNode),
|
|
24
|
+
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, assertions, derived, metaproofContext);
|
|
20
25
|
|
|
21
|
-
if (
|
|
22
|
-
const
|
|
26
|
+
if (unqualifiedMetastatementVerified) {
|
|
27
|
+
const metastatementNode = metastatementNodeQuery(unqualifiedMetastatementNode),
|
|
28
|
+
conclusion = Conclusion.fromMetastatementNode(metastatementNode);
|
|
23
29
|
|
|
24
30
|
conclusions.push(conclusion);
|
|
25
31
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Consequence from "../consequence";
|
|
4
|
+
import verifyUnqualifiedStatement from "./statement/unqualified";
|
|
4
5
|
|
|
5
6
|
import { nodeQuery } from "../utilities/query";
|
|
6
7
|
import { nodeAsString } from "../utilities/string";
|
|
7
8
|
|
|
8
|
-
const statementNodeQuery = nodeQuery("/
|
|
9
|
+
const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!"),
|
|
10
|
+
unqualifiedStatementNodeQuery = nodeQuery("/consequence/unqualifiedStatement!");
|
|
9
11
|
|
|
10
12
|
export default function verifyConsequence(consequenceNode, consequences, proofContext) {
|
|
11
13
|
let consequenceVerified = false;
|
|
@@ -16,10 +18,14 @@ export default function verifyConsequence(consequenceNode, consequences, proofCo
|
|
|
16
18
|
|
|
17
19
|
proofContext.debug(`Verifying the ${consequenceString} consequence...`);
|
|
18
20
|
|
|
19
|
-
const
|
|
21
|
+
const derived = false,
|
|
22
|
+
assertions = [],
|
|
23
|
+
unqualifiedStatementNode = unqualifiedStatementNodeQuery(consequenceNode),
|
|
24
|
+
unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, assertions, derived, proofContext);
|
|
20
25
|
|
|
21
|
-
if (
|
|
22
|
-
const
|
|
26
|
+
if (unqualifiedStatementVerified) {
|
|
27
|
+
const statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
28
|
+
consequence = Consequence.fromStatementNode(statementNode);
|
|
23
29
|
|
|
24
30
|
consequences.push(consequence);
|
|
25
31
|
|
package/src/verify/derivation.js
CHANGED
|
@@ -123,8 +123,10 @@ function verifyChild(childNode, proofContext) {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
case UNQUALIFIED_STATEMENT_RULE_NAME: {
|
|
126
|
-
const
|
|
127
|
-
|
|
126
|
+
const derived = true,
|
|
127
|
+
assertions = [],
|
|
128
|
+
unqualifiedStatementNode = childNode, ///
|
|
129
|
+
unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, assertions, derived, proofContext);
|
|
128
130
|
|
|
129
131
|
if (unqualifiedStatementVerified) {
|
|
130
132
|
const statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import verifyMetastatement from "../../verify/metastatement";
|
|
4
|
+
|
|
3
5
|
import { nodeAsString } from "../../utilities/string";
|
|
4
6
|
import { nodeQuery, referenceNameFromReferenceNode } from "../../utilities/query";
|
|
5
7
|
|
|
@@ -18,14 +20,26 @@ export default function verifyQualifiedMetastatement(qualifiedMetastatementNode,
|
|
|
18
20
|
|
|
19
21
|
metaproofContext.debug(`Verifying the ${metastatementString} qualified metastatement...`);
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
let ruleMatchesStatement = true;
|
|
24
|
+
|
|
25
|
+
const referenceNode = referenceNodeQuery(qualifiedMetastatementNode);
|
|
26
|
+
|
|
27
|
+
if (referenceNode !== null) {
|
|
28
|
+
const referenceName = referenceNameFromReferenceNode(referenceNode),
|
|
29
|
+
rule = metaproofContext.findRuleByReferenceName(referenceName);
|
|
30
|
+
|
|
31
|
+
if (rule !== null) {
|
|
32
|
+
const ruleMatchesStatement = rule.matchMetastatement(metastatementNode, metaproofContext);
|
|
33
|
+
|
|
34
|
+
qualifiedMetastatementVerified = ruleMatchesStatement; ///
|
|
35
|
+
}
|
|
36
|
+
}
|
|
24
37
|
|
|
25
|
-
if (
|
|
26
|
-
const
|
|
38
|
+
if (ruleMatchesStatement) {
|
|
39
|
+
const assertions = [],
|
|
40
|
+
metastatementVerified = verifyMetastatement(metastatementNode, assertions, metaproofContext);
|
|
27
41
|
|
|
28
|
-
qualifiedMetastatementVerified =
|
|
42
|
+
qualifiedMetastatementVerified = metastatementVerified; ///
|
|
29
43
|
}
|
|
30
44
|
}
|
|
31
45
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import verifyMetastatement from "../metastatement";
|
|
4
|
+
|
|
3
5
|
import { nodeQuery } from "../../utilities/query";
|
|
4
6
|
import { nodeAsString } from "../../utilities/string";
|
|
5
7
|
|
|
6
8
|
const metastatementNodeQuery = nodeQuery("/unqualifiedMetastatement/metastatement!");
|
|
7
9
|
|
|
8
|
-
export default function verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, metaproofContext) {
|
|
10
|
+
export default function verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, assertions, derived, metaproofContext) {
|
|
9
11
|
let unqualifiedMetastatementVerified = false;
|
|
10
12
|
|
|
11
13
|
metaproofContext.begin(unqualifiedMetastatementNode);
|
|
@@ -17,9 +19,17 @@ export default function verifyUnqualifiedMetastatement(unqualifiedMetastatementN
|
|
|
17
19
|
|
|
18
20
|
metaproofContext.debug(`Verifying the ${metastatementString} unqualified metastatement...`);
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
let metastatementMatches = true;
|
|
23
|
+
|
|
24
|
+
if (derived) {
|
|
25
|
+
metastatementMatches = metaproofContext.matchMetastatement(metastatementNode);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (metastatementMatches) {
|
|
29
|
+
const metastatementVerified = verifyMetastatement(metastatementNode, assertions, metaproofContext);
|
|
21
30
|
|
|
22
|
-
|
|
31
|
+
unqualifiedMetastatementVerified = metastatementVerified; ///
|
|
32
|
+
}
|
|
23
33
|
}
|
|
24
34
|
|
|
25
35
|
unqualifiedMetastatementVerified ?
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
export default function verifyMetastatement(metastatementNode,
|
|
4
|
-
let metastatementVerified = true;
|
|
3
|
+
export default function verifyMetastatement(metastatementNode, assertions, metaproofContext) {
|
|
4
|
+
let metastatementVerified = true; ///
|
|
5
5
|
|
|
6
6
|
metaproofContext.begin(metastatementNode);
|
|
7
7
|
|
package/src/verify/premise.js
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import Premise from "../premise";
|
|
4
4
|
import MetaproofStep from "../step/metaproof";
|
|
5
|
+
import verifyUnqualifiedMetastatement from "../verify/metastatement/unqualified";
|
|
5
6
|
|
|
6
7
|
import { nodeQuery } from "../utilities/query";
|
|
7
8
|
import { nodeAsString } from "../utilities/string";
|
|
8
9
|
|
|
9
|
-
const metastatementNodeQuery = nodeQuery("/
|
|
10
|
+
const metastatementNodeQuery = nodeQuery("/unqualifiedMetastatement/metastatement!"),
|
|
11
|
+
unqualifiedMetastatementNodeQuery = nodeQuery("/premise/unqualifiedMetastatement!");
|
|
10
12
|
|
|
11
13
|
export default function verifyPremise(premiseNode, premises, metaproofContext) {
|
|
12
14
|
let premiseVerified;
|
|
@@ -17,10 +19,14 @@ export default function verifyPremise(premiseNode, premises, metaproofContext) {
|
|
|
17
19
|
|
|
18
20
|
metaproofContext.debug(`Verifying the ${premiseString} premise...`);
|
|
19
21
|
|
|
20
|
-
const
|
|
22
|
+
const derived = false,
|
|
23
|
+
assertions = [],
|
|
24
|
+
unqualifiedMetastatementNode = unqualifiedMetastatementNodeQuery(premiseNode),
|
|
25
|
+
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, assertions, derived, metaproofContext);
|
|
21
26
|
|
|
22
|
-
if (
|
|
23
|
-
const
|
|
27
|
+
if (unqualifiedMetastatementVerified) {
|
|
28
|
+
const metastatementNode = metastatementNodeQuery(unqualifiedMetastatementNode),
|
|
29
|
+
metaproofStep = MetaproofStep.fromMetastatementNode(metastatementNode),
|
|
24
30
|
premise = Premise.fromMetastatementNode(metastatementNode);
|
|
25
31
|
|
|
26
32
|
premises.push(premise);
|
|
@@ -123,8 +123,10 @@ function verifyChild(childNode, metaproofContext) {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
case UNQUALIFIED_METASTATEMENT_RULE_NAME: {
|
|
126
|
-
const
|
|
127
|
-
|
|
126
|
+
const derived = true,
|
|
127
|
+
assertions = [],
|
|
128
|
+
unqualifiedMetastatementNode = childNode, ///
|
|
129
|
+
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, assertions, derived, metaproofContext);
|
|
128
130
|
|
|
129
131
|
if (unqualifiedMetastatementVerified) {
|
|
130
132
|
const metastatementNode = metastatementNodeQuery(unqualifiedMetastatementNode),
|
|
@@ -5,8 +5,8 @@ import verifyStatement from "../../verify/statement";
|
|
|
5
5
|
import { nodeAsString } from "../../utilities/string";
|
|
6
6
|
import { nodeQuery, referenceNameFromReferenceNode } from "../../utilities/query";
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
|
|
8
|
+
const referenceNodeQuery = nodeQuery("/qualifiedStatement/qualification!/reference!"),
|
|
9
|
+
statementNodeQuery = nodeQuery("/qualifiedStatement/statement!");
|
|
10
10
|
|
|
11
11
|
export default function verifyQualifiedStatement(qualifiedStatementNode, proofContext) {
|
|
12
12
|
let qualifiedStatementVerified = false;
|
|
@@ -20,23 +20,25 @@ export default function verifyQualifiedStatement(qualifiedStatementNode, proofCo
|
|
|
20
20
|
|
|
21
21
|
proofContext.debug(`Verifying the ${statementString} qualified statement...`);
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
let ruleMatchesStatement = true;
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
const qualified = true,
|
|
27
|
-
statementVerified = verifyStatement(statementNode, qualified, proofContext);
|
|
25
|
+
const referenceNode = referenceNodeQuery(qualifiedStatementNode);
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
} else {
|
|
27
|
+
if (referenceNode !== null) {
|
|
31
28
|
const referenceName = referenceNameFromReferenceNode(referenceNode),
|
|
32
29
|
rule = proofContext.findRuleByReferenceName(referenceName);
|
|
33
30
|
|
|
34
31
|
if (rule !== null) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
qualifiedStatementVerified = ruleMatchesStatement; ///
|
|
32
|
+
ruleMatchesStatement = rule.matchStatement(statementNode, proofContext);
|
|
38
33
|
}
|
|
39
34
|
}
|
|
35
|
+
|
|
36
|
+
if (ruleMatchesStatement) {
|
|
37
|
+
const assertions = [],
|
|
38
|
+
statementVerified = verifyStatement(statementNode, assertions, proofContext);
|
|
39
|
+
|
|
40
|
+
qualifiedStatementVerified = statementVerified; ///
|
|
41
|
+
}
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
qualifiedStatementVerified ?
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import verifyStatement from "../statement";
|
|
4
|
+
|
|
3
5
|
import { nodeQuery } from "../../utilities/query";
|
|
4
6
|
import { nodeAsString } from "../../utilities/string";
|
|
5
7
|
|
|
6
8
|
const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!");
|
|
7
9
|
|
|
8
|
-
export default function verifyUnqualifiedStatement(unqualifiedStatementNode, proofContext) {
|
|
10
|
+
export default function verifyUnqualifiedStatement(unqualifiedStatementNode, assertions, derived, proofContext) {
|
|
9
11
|
let unqualifiedStatementVerified = false;
|
|
10
12
|
|
|
11
13
|
proofContext.begin(unqualifiedStatementNode);
|
|
@@ -17,9 +19,17 @@ export default function verifyUnqualifiedStatement(unqualifiedStatementNode, pro
|
|
|
17
19
|
|
|
18
20
|
proofContext.debug(`Verifying the ${statementString} unqualified statement...`);
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
let statementMatches = true;
|
|
23
|
+
|
|
24
|
+
if (derived) {
|
|
25
|
+
statementMatches = proofContext.matchStatement(statementNode);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (statementMatches) {
|
|
29
|
+
const statementVerified = verifyStatement(statementNode, assertions, proofContext);
|
|
21
30
|
|
|
22
|
-
|
|
31
|
+
unqualifiedStatementVerified = statementVerified; ///
|
|
32
|
+
}
|
|
23
33
|
}
|
|
24
34
|
|
|
25
35
|
unqualifiedStatementVerified ?
|