occam-verify-cli 0.0.525 → 0.0.527
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 +10 -40
- package/lib/axiom.js +7 -7
- package/lib/axiomLemmaTheoremConjecture.js +190 -0
- package/lib/combinator.js +5 -5
- package/lib/conclusion.js +3 -3
- package/lib/conjecture.js +141 -0
- package/lib/consequence.js +5 -5
- package/lib/constants.js +4 -16
- package/lib/constructor.js +6 -6
- package/lib/context/file.js +85 -32
- package/lib/context/metaproof.js +46 -4
- package/lib/context/proof.js +38 -93
- package/lib/context/release/directory.js +20 -1
- package/lib/context/release/file.js +27 -3
- package/lib/equality.js +78 -51
- package/lib/index.js +1 -13
- package/lib/kinds.js +5 -1
- package/lib/label.js +5 -5
- package/lib/lemma.js +7 -7
- package/lib/matcher/metastatementForMetavariable.js +16 -19
- package/lib/matcher/statementForMetavariable.js +22 -20
- package/lib/matcher/{statementForVariable → termForVariable}/consequence.js +13 -13
- package/lib/matcher/{statementForVariable → termForVariable}/supposition.js +13 -13
- package/lib/matcher/termForVariable.js +198 -0
- package/lib/matcher.js +23 -64
- package/lib/mixins/file.js +62 -2
- package/lib/premise.js +6 -6
- package/lib/rule.js +5 -5
- package/lib/ruleNames.js +1 -9
- package/lib/step/proof.js +22 -1
- package/lib/substitution/statementForMetavariable.js +12 -8
- package/lib/substitution/termForVariable.js +86 -0
- package/lib/supposition.js +6 -6
- package/lib/theorem.js +7 -7
- package/lib/type.js +13 -6
- package/lib/utilities/string.js +17 -16
- package/lib/utilities/substitution.js +4 -5
- package/lib/variable.js +5 -39
- package/lib/verify/assertion/type.js +60 -37
- package/lib/verify/axiom.js +2 -3
- package/lib/verify/conclusion.js +2 -3
- package/lib/verify/conjecture.js +56 -0
- package/lib/verify/consequence.js +3 -4
- package/lib/verify/declaration/topLevel.js +7 -3
- package/lib/verify/label.js +2 -3
- package/lib/verify/lemma.js +2 -3
- package/lib/verify/metastatement/qualified.js +3 -4
- package/lib/verify/metastatement/unqualified.js +3 -4
- package/lib/verify/premise.js +3 -4
- package/lib/verify/rule.js +2 -3
- package/lib/verify/statement/qualified.js +41 -12
- package/lib/verify/statement/unqualified.js +3 -4
- package/lib/verify/statement.js +47 -51
- package/lib/verify/statementAsCombinator.js +2 -3
- package/lib/verify/supposition.js +3 -4
- package/lib/verify/term.js +3 -4
- package/lib/verify/termAsConstructor.js +4 -5
- package/lib/verify/theorem.js +2 -3
- package/lib/verify/type.js +2 -3
- package/lib/verify/variable.js +2 -3
- package/package.json +1 -1
- package/src/assertion/type.js +7 -32
- package/src/axiom.js +4 -4
- package/src/{axiomLemmaTheorem.js → axiomLemmaTheoremConjecture.js} +9 -9
- package/src/combinator.js +4 -4
- package/src/conclusion.js +2 -2
- package/src/conjecture.js +13 -0
- package/src/consequence.js +4 -4
- package/src/constants.js +1 -4
- package/src/constructor.js +6 -6
- package/src/context/file.js +89 -32
- package/src/context/metaproof.js +44 -3
- package/src/context/proof.js +42 -37
- package/src/context/release/directory.js +24 -0
- package/src/context/release/file.js +34 -3
- package/src/equality.js +110 -61
- package/src/index.js +0 -3
- package/src/kinds.js +1 -0
- package/src/label.js +4 -4
- package/src/lemma.js +4 -4
- package/src/matcher/metastatementForMetavariable.js +22 -32
- package/src/matcher/statementForMetavariable.js +40 -34
- package/src/matcher/termForVariable/consequence.js +9 -0
- package/src/matcher/termForVariable/supposition.js +9 -0
- package/src/matcher/termForVariable.js +89 -0
- package/src/matcher.js +28 -22
- package/src/mixins/file.js +46 -1
- package/src/premise.js +6 -6
- package/src/rule.js +4 -4
- package/src/ruleNames.js +0 -2
- package/src/step/proof.js +27 -0
- package/src/substitution/statementForMetavariable.js +17 -10
- package/src/substitution/termForVariable.js +64 -0
- package/src/supposition.js +5 -5
- package/src/theorem.js +4 -4
- package/src/type.js +18 -8
- package/src/utilities/string.js +27 -21
- package/src/utilities/substitution.js +6 -4
- package/src/variable.js +5 -38
- package/src/verify/assertion/type.js +71 -65
- package/src/verify/axiom.js +1 -2
- package/src/verify/conclusion.js +1 -2
- package/src/verify/conjecture.js +73 -0
- package/src/verify/consequence.js +2 -3
- package/src/verify/declaration/topLevel.js +7 -0
- package/src/verify/label.js +1 -2
- package/src/verify/lemma.js +1 -2
- package/src/verify/metastatement/qualified.js +2 -3
- package/src/verify/metastatement/unqualified.js +2 -3
- package/src/verify/premise.js +2 -3
- package/src/verify/rule.js +1 -2
- package/src/verify/statement/qualified.js +55 -15
- package/src/verify/statement/unqualified.js +2 -3
- package/src/verify/statement.js +49 -70
- package/src/verify/statementAsCombinator.js +1 -2
- package/src/verify/supposition.js +2 -3
- package/src/verify/term.js +2 -3
- package/src/verify/termAsConstructor.js +3 -4
- package/src/verify/theorem.js +1 -2
- package/src/verify/type.js +1 -2
- package/src/verify/variable.js +1 -2
- package/lib/axiomLemmaTheorem.js +0 -190
- package/lib/jsonTypes.js +0 -30
- package/lib/matcher/statementForVariable.js +0 -201
- package/lib/substitution/statementForVariable.js +0 -86
- package/lib/utilities/json.js +0 -187
- package/lib/utilities/version.js +0 -32
- package/lib/versionChanges.js +0 -34
- package/src/jsonTypes.js +0 -6
- package/src/matcher/statementForVariable/consequence.js +0 -9
- package/src/matcher/statementForVariable/supposition.js +0 -9
- package/src/matcher/statementForVariable.js +0 -99
- package/src/substitution/statementForVariable.js +0 -64
- package/src/utilities/json.js +0 -264
- package/src/utilities/version.js +0 -30
- package/src/versionChanges.js +0 -11
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import Variable from "../../variable";
|
|
3
4
|
import TypeAssertion from "../../assertion/type";
|
|
4
5
|
|
|
5
6
|
import { first } from "../../utilities/array";
|
|
6
|
-
import {
|
|
7
|
+
import { verifyTermAsVariable } from "../../verify/term";
|
|
7
8
|
import { nodeQuery, typeNameFromTypeNode } from "../../utilities/query";
|
|
8
|
-
import { verifyTermAsVariable, verifyTermAgainstConstructors } from "../../verify/term";
|
|
9
9
|
|
|
10
10
|
const termNodeQuery = nodeQuery("/typeAssertion/term"),
|
|
11
11
|
typeNodeQuery = nodeQuery("/typeAssertion/type");
|
|
12
12
|
|
|
13
|
-
export default function verifyTypeAssertion(typeAssertionNode, assertions, proofContext) {
|
|
13
|
+
export default function verifyTypeAssertion(typeAssertionNode, assertions, derived, proofContext) {
|
|
14
14
|
let typeAssertionVerified = false;
|
|
15
15
|
|
|
16
16
|
proofContext.begin(typeAssertionNode);
|
|
17
17
|
|
|
18
|
-
const typeAssertionString = nodeAsString(typeAssertionNode);
|
|
18
|
+
const typeAssertionString = proofContext.nodeAsString(typeAssertionNode);
|
|
19
19
|
|
|
20
20
|
proofContext.debug(`Verifying the '${typeAssertionString}' type assertion...`);
|
|
21
21
|
|
|
@@ -27,16 +27,16 @@ export default function verifyTypeAssertion(typeAssertionNode, assertions, proof
|
|
|
27
27
|
proofContext.error(`The ${typeName} type is not present.`);
|
|
28
28
|
} else {
|
|
29
29
|
if (!typeAssertionVerified) {
|
|
30
|
-
const variableTypeAssertionVerified = verifyVariableTypeAssertion(typeAssertionNode, assertions, proofContext);
|
|
30
|
+
const variableTypeAssertionVerified = verifyVariableTypeAssertion(typeAssertionNode, assertions, derived, proofContext);
|
|
31
31
|
|
|
32
32
|
typeAssertionVerified = variableTypeAssertionVerified; ///
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
if (!typeAssertionVerified) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
35
|
+
// if (!typeAssertionVerified) {
|
|
36
|
+
// const termTypeAssertionVerified = verifyTermTypeAssertion(typeAssertionNode, assertions, proofContext);
|
|
37
|
+
//
|
|
38
|
+
// typeAssertionVerified = termTypeAssertionVerified; ///
|
|
39
|
+
// }
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
if (typeAssertionVerified) {
|
|
@@ -50,7 +50,7 @@ export default function verifyTypeAssertion(typeAssertionNode, assertions, proof
|
|
|
50
50
|
return typeAssertionVerified;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
function verifyVariableTypeAssertion(typeAssertionNode, assertions, proofContext) {
|
|
53
|
+
function verifyVariableTypeAssertion(typeAssertionNode, assertions, derived, proofContext) {
|
|
54
54
|
let variableTypeAssertionVerified = false;
|
|
55
55
|
|
|
56
56
|
const context = proofContext, ///
|
|
@@ -59,18 +59,28 @@ function verifyVariableTypeAssertion(typeAssertionNode, assertions, proofContext
|
|
|
59
59
|
termVerifiedAsVariable = verifyTermAsVariable(termNode, variables, context);
|
|
60
60
|
|
|
61
61
|
if (termVerifiedAsVariable) {
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
const typeNode = typeNodeQuery(typeAssertionNode),
|
|
63
|
+
typeName = typeNameFromTypeNode(typeNode),
|
|
64
|
+
assertedTypeName = typeName, ///
|
|
65
|
+
assertedType = proofContext.findTypeByTypeName(assertedTypeName),
|
|
66
|
+
firstVariable = first(variables),
|
|
67
|
+
variable = firstVariable, ///
|
|
68
|
+
variableName = variable.getName(),
|
|
69
|
+
variableType = variable.getType();
|
|
70
|
+
|
|
71
|
+
if (derived) {
|
|
72
|
+
const variableTypeEqualToOrSubTypeOfAssertedType = variableType.isEqualToOrSubTypeOf(assertedType);
|
|
73
|
+
|
|
74
|
+
if (!variableTypeEqualToOrSubTypeOfAssertedType) {
|
|
75
|
+
const assertedTypeName = assertedType.getName(),
|
|
76
|
+
variableTypeName = variableType.getName();
|
|
77
|
+
|
|
78
|
+
proofContext.error(`The '${variableName}' variable's '${variableTypeName}' type is not equal to or a sub-type of the '${assertedTypeName}' asserted type.`);
|
|
79
|
+
} else {
|
|
80
|
+
variableTypeAssertionVerified = true;
|
|
81
|
+
}
|
|
64
82
|
} else {
|
|
65
|
-
const
|
|
66
|
-
typeName = typeNameFromTypeNode(typeNode),
|
|
67
|
-
assertedTypeName = typeName, ///
|
|
68
|
-
assertedType = proofContext.findTypeByTypeName(assertedTypeName),
|
|
69
|
-
firstVariable = first(variables),
|
|
70
|
-
variable = firstVariable, ///
|
|
71
|
-
variableName = variable.getName(),
|
|
72
|
-
variableType = variable.getType(),
|
|
73
|
-
assertedTypeEqualToOrSubTypeOfVariableType = assertedType.isEqualToOrSubTypeOf(variableType);
|
|
83
|
+
const assertedTypeEqualToOrSubTypeOfVariableType = assertedType.isEqualToOrSubTypeOf(variableType);
|
|
74
84
|
|
|
75
85
|
if (!assertedTypeEqualToOrSubTypeOfVariableType) {
|
|
76
86
|
const assertedTypeName = assertedType.getName(),
|
|
@@ -79,7 +89,9 @@ function verifyVariableTypeAssertion(typeAssertionNode, assertions, proofContext
|
|
|
79
89
|
proofContext.error(`The '${assertedTypeName}' asserted type is not equal to or a sub-type of the '${variableName}' variable's '${variableTypeName}' type.`);
|
|
80
90
|
} else {
|
|
81
91
|
const type = assertedType, ///
|
|
82
|
-
|
|
92
|
+
name = variableName, ///
|
|
93
|
+
variable = Variable.fromTypeAndName(type, name),
|
|
94
|
+
typeAssertion = TypeAssertion.fromVariable(variable),
|
|
83
95
|
assertion = typeAssertion; ///
|
|
84
96
|
|
|
85
97
|
assertions.push(assertion);
|
|
@@ -92,46 +104,40 @@ function verifyVariableTypeAssertion(typeAssertionNode, assertions, proofContext
|
|
|
92
104
|
return variableTypeAssertionVerified;
|
|
93
105
|
}
|
|
94
106
|
|
|
95
|
-
function verifyTermTypeAssertion(typeAssertionNode, assertions, proofContext) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return termTypeAssertionVerified;
|
|
136
|
-
}
|
|
107
|
+
// function verifyTermTypeAssertion(typeAssertionNode, assertions, proofContext) {
|
|
108
|
+
// let termTypeAssertionVerified = false;
|
|
109
|
+
//
|
|
110
|
+
// const types = [],
|
|
111
|
+
// context = proofContext, ///
|
|
112
|
+
// termNode = termNodeQuery(typeAssertionNode),
|
|
113
|
+
// termVerifiedAgainstConstructors = verifyTermAgainstConstructors(termNode, types, context);
|
|
114
|
+
//
|
|
115
|
+
// if (termVerifiedAgainstConstructors) {
|
|
116
|
+
// const typeNode = typeNodeQuery(typeAssertionNode),
|
|
117
|
+
// typeName = typeNameFromTypeNode(typeNode),
|
|
118
|
+
// assertedTypeName = typeName, ///
|
|
119
|
+
// assertedType = proofContext.findTypeByTypeName(assertedTypeName),
|
|
120
|
+
// firstType = first(types),
|
|
121
|
+
// termType = firstType,
|
|
122
|
+
// termString = proofContext.nodeAsString(termNode),
|
|
123
|
+
// termTypeEqualToOrSubTypeOfAssertedType = termType.isEqualToOrSubTypeOf(assertedType);
|
|
124
|
+
//
|
|
125
|
+
// if (!termTypeEqualToOrSubTypeOfAssertedType) {
|
|
126
|
+
// const termTypeName = termType.getName(),
|
|
127
|
+
// assertedTypeName = assertedType.getName();
|
|
128
|
+
//
|
|
129
|
+
// proofContext.error(`The '${termString}' term's '${termTypeName}' type is not equal to or a sub-type of the '${assertedTypeName}' asserted type.`);
|
|
130
|
+
// } else {
|
|
131
|
+
// const type = assertedType, ///
|
|
132
|
+
// typeAssertion = TypeAssertion.fromTypeAndTermNode(type, termNode),
|
|
133
|
+
// assertion = typeAssertion; ///
|
|
134
|
+
//
|
|
135
|
+
// assertions.push(assertion);
|
|
136
|
+
//
|
|
137
|
+
// termTypeAssertionVerified = true;
|
|
138
|
+
// }
|
|
139
|
+
// }
|
|
140
|
+
//
|
|
141
|
+
// return termTypeAssertionVerified;
|
|
142
|
+
// }
|
|
137
143
|
|
package/src/verify/axiom.js
CHANGED
|
@@ -7,7 +7,6 @@ import verifySupposition from "../verify/supposition";
|
|
|
7
7
|
import verifyConsequence from "../verify/consequence";
|
|
8
8
|
|
|
9
9
|
import { first } from "../utilities/array";
|
|
10
|
-
import { nodesAsString } from "../utilities/string";
|
|
11
10
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
12
11
|
|
|
13
12
|
const labelNodesQuery = nodesQuery("/axiom/label"),
|
|
@@ -20,7 +19,7 @@ export default function verifyAxiom(axiomNode, fileContext) {
|
|
|
20
19
|
fileContext.begin(axiomNode);
|
|
21
20
|
|
|
22
21
|
const labelNodes = labelNodesQuery(axiomNode),
|
|
23
|
-
labelsString = nodesAsString(labelNodes),
|
|
22
|
+
labelsString = fileContext.nodesAsString(labelNodes),
|
|
24
23
|
proofContext = ProofContext.fromFileContext(fileContext);
|
|
25
24
|
|
|
26
25
|
fileContext.debug(`Verifying the '${labelsString}' axiom...`);
|
package/src/verify/conclusion.js
CHANGED
|
@@ -4,7 +4,6 @@ import Conclusion from "../conclusion";
|
|
|
4
4
|
import verifyUnqualifiedMetastatement from "./metastatement/unqualified";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
7
|
-
import { nodeAsString } from "../utilities/string";
|
|
8
7
|
|
|
9
8
|
const metastatementNodeQuery = nodeQuery("/unqualifiedMetastatement/metastatement!"),
|
|
10
9
|
unqualifiedMetastatementNodeQuery = nodeQuery("/conclusion/unqualifiedMetastatement!");
|
|
@@ -14,7 +13,7 @@ export default function verifyConclusion(conclusionNode, conclusions, metaproofC
|
|
|
14
13
|
|
|
15
14
|
metaproofContext.begin(conclusionNode);
|
|
16
15
|
|
|
17
|
-
const conclusionString = nodeAsString(conclusionNode);
|
|
16
|
+
const conclusionString = metaproofContext.nodeAsString(conclusionNode);
|
|
18
17
|
|
|
19
18
|
metaproofContext.debug(`Verifying the '${conclusionString}' conclusion...`);
|
|
20
19
|
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import Conjecture from "../conjecture";
|
|
4
|
+
import verifyProof from "../verify/proof";
|
|
5
|
+
import ProofContext from "../context/proof";
|
|
6
|
+
import verifyLabels from "../verify/labels";
|
|
7
|
+
import verifySupposition from "./supposition";
|
|
8
|
+
import verifyConsequence from "./consequence";
|
|
9
|
+
|
|
10
|
+
import { first } from "../utilities/array";
|
|
11
|
+
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
12
|
+
|
|
13
|
+
const proofNodeQuery = nodeQuery("/conjecture/proof!"),
|
|
14
|
+
labelNodesQuery = nodesQuery("/conjecture/label"),
|
|
15
|
+
consequenceNodeQuery = nodeQuery("/conjecture/consequence!"),
|
|
16
|
+
suppositionsNodeQuery = nodesQuery("/conjecture/supposition");
|
|
17
|
+
|
|
18
|
+
export default function verifyConjecture(conjectureNode, fileContext) {
|
|
19
|
+
let conjectureVerified = false;
|
|
20
|
+
|
|
21
|
+
fileContext.begin(conjectureNode);
|
|
22
|
+
|
|
23
|
+
const labelNodes = labelNodesQuery(conjectureNode),
|
|
24
|
+
labelsString = fileContext.nodesAsString(labelNodes),
|
|
25
|
+
proofContext = ProofContext.fromFileContext(fileContext);
|
|
26
|
+
|
|
27
|
+
fileContext.debug(`Verifying the '${labelsString}' conjecture...`);
|
|
28
|
+
|
|
29
|
+
const labels = [],
|
|
30
|
+
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
31
|
+
|
|
32
|
+
if (labelsVerified) {
|
|
33
|
+
const suppositions = [],
|
|
34
|
+
suppositionNodes = suppositionsNodeQuery(conjectureNode),
|
|
35
|
+
suppositionsVerified = suppositionNodes.every((suppositionNode) => {
|
|
36
|
+
const suppositionVerified = verifySupposition(suppositionNode, suppositions, proofContext);
|
|
37
|
+
|
|
38
|
+
if (suppositionVerified) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (suppositionsVerified) {
|
|
44
|
+
const consequences = [],
|
|
45
|
+
consequenceNode = consequenceNodeQuery(conjectureNode),
|
|
46
|
+
consequenceVerified = verifyConsequence(consequenceNode, consequences, proofContext);
|
|
47
|
+
|
|
48
|
+
if (consequenceVerified) {
|
|
49
|
+
const proofNode = proofNodeQuery(conjectureNode),
|
|
50
|
+
firstConsequence = first(consequences),
|
|
51
|
+
consequence = firstConsequence; ///
|
|
52
|
+
|
|
53
|
+
verifyProof(proofNode, consequence, proofContext);
|
|
54
|
+
|
|
55
|
+
const conjecture = Conjecture.fromLabelsSuppositionsAndConsequence(labels, suppositions, consequence);
|
|
56
|
+
|
|
57
|
+
fileContext.addConjecture(conjecture);
|
|
58
|
+
|
|
59
|
+
conjectureVerified = true;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (conjectureVerified) {
|
|
65
|
+
fileContext.info(`Verified the '${labelsString}' conjecture.`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
conjectureVerified ?
|
|
69
|
+
fileContext.complete(conjectureNode) :
|
|
70
|
+
fileContext.complete(conjectureNode);
|
|
71
|
+
|
|
72
|
+
return conjectureVerified;
|
|
73
|
+
}
|
|
@@ -4,7 +4,6 @@ import Consequence from "../consequence";
|
|
|
4
4
|
import verifyUnqualifiedStatement from "./statement/unqualified";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
7
|
-
import { nodeAsString } from "../utilities/string";
|
|
8
7
|
|
|
9
8
|
const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!"),
|
|
10
9
|
unqualifiedStatementNodeQuery = nodeQuery("/consequence/unqualifiedStatement!");
|
|
@@ -14,9 +13,9 @@ export default function verifyConsequence(consequenceNode, consequences, proofCo
|
|
|
14
13
|
|
|
15
14
|
proofContext.begin(consequenceNode);
|
|
16
15
|
|
|
17
|
-
const consequenceString = nodeAsString(consequenceNode);
|
|
16
|
+
const consequenceString = proofContext.nodeAsString(consequenceNode);
|
|
18
17
|
|
|
19
|
-
proofContext.debug(`Verifying the ${consequenceString} consequence...`);
|
|
18
|
+
proofContext.debug(`Verifying the '${consequenceString}' consequence...`);
|
|
20
19
|
|
|
21
20
|
const derived = false,
|
|
22
21
|
assertions = [],
|
|
@@ -4,6 +4,7 @@ import verifyRule from "../../verify/rule";
|
|
|
4
4
|
import verifyAxiom from "../../verify/axiom";
|
|
5
5
|
import verifyLemma from "../../verify/lemma";
|
|
6
6
|
import verifyTheorem from "../../verify/theorem";
|
|
7
|
+
import verifyConjecture from "../../verify/conjecture";
|
|
7
8
|
import verifyTypeDeclaration from "../../verify/declaration/type";
|
|
8
9
|
import verifyVariableDeclaration from "../../verify/declaration/variable";
|
|
9
10
|
import verifyCombinatorDeclaration from "../../verify/declaration/combinator";
|
|
@@ -15,6 +16,7 @@ const ruleNodeQuery = nodeQuery("/topLevelDeclaration/rule!"),
|
|
|
15
16
|
axiomNodeQuery = nodeQuery("/topLevelDeclaration/axiom!"),
|
|
16
17
|
lemmaNodeQuery = nodeQuery("/topLevelDeclaration/lemma!"),
|
|
17
18
|
theoremNodeQuery = nodeQuery("/topLevelDeclaration/theorem!"),
|
|
19
|
+
conjectureNodeQuery = nodeQuery("/topLevelDeclaration/conjecture!"),
|
|
18
20
|
typeDeclarationNodeQuery = nodeQuery("/topLevelDeclaration/typeDeclaration!"),
|
|
19
21
|
variableDeclarationNodeQuery = nodeQuery("/topLevelDeclaration/variableDeclaration!"),
|
|
20
22
|
combinatorDeclarationNodeQuery = nodeQuery("/topLevelDeclaration/combinatorDeclaration!"),
|
|
@@ -30,6 +32,7 @@ export default function verifyTopLevelDeclaration(topLevelDeclarationNode, fileC
|
|
|
30
32
|
axiomNode = axiomNodeQuery(node),
|
|
31
33
|
lemmaNode = lemmaNodeQuery(node),
|
|
32
34
|
theoremNode = theoremNodeQuery(node),
|
|
35
|
+
conjectureNode = conjectureNodeQuery(node),
|
|
33
36
|
typeDeclarationNode = typeDeclarationNodeQuery(node),
|
|
34
37
|
variableDeclarationNode = variableDeclarationNodeQuery(node),
|
|
35
38
|
combinatorDeclarationNode = combinatorDeclarationNodeQuery(node),
|
|
@@ -53,6 +56,10 @@ export default function verifyTopLevelDeclaration(topLevelDeclarationNode, fileC
|
|
|
53
56
|
const theoremVerified = verifyTheorem(theoremNode, fileContext);
|
|
54
57
|
|
|
55
58
|
topLevelDeclarationVerified = theoremVerified; ///
|
|
59
|
+
} else if (conjectureNode !== null) {
|
|
60
|
+
const conjectureVerified = verifyConjecture(conjectureNode, fileContext);
|
|
61
|
+
|
|
62
|
+
topLevelDeclarationVerified = conjectureVerified; ///
|
|
56
63
|
} else if (typeDeclarationNode !== null) {
|
|
57
64
|
const typeDeclarationVerified = verifyTypeDeclaration(typeDeclarationNode, fileContext);
|
|
58
65
|
|
package/src/verify/label.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import Label from "../label";
|
|
4
4
|
|
|
5
|
-
import { nodeAsString } from "../utilities/string";
|
|
6
5
|
import { labelNameFromLabelNode } from "../utilities/query";
|
|
7
6
|
|
|
8
7
|
export default function verifyLabel(labelNode, labels, fileContext) {
|
|
@@ -14,7 +13,7 @@ export default function verifyLabel(labelNode, labels, fileContext) {
|
|
|
14
13
|
labelPresent = fileContext.isLabelPresentByLabelName(labelName);
|
|
15
14
|
|
|
16
15
|
if (labelPresent) {
|
|
17
|
-
const labelString = nodeAsString(labelNode);
|
|
16
|
+
const labelString = fileContext.nodeAsString(labelNode);
|
|
18
17
|
|
|
19
18
|
fileContext.error(`The '${labelString}' label is already present.`, labelNode);
|
|
20
19
|
} else {
|
package/src/verify/lemma.js
CHANGED
|
@@ -9,7 +9,6 @@ import verifyConsequence from "./consequence";
|
|
|
9
9
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { EMPTY_STRING } from "../constants";
|
|
12
|
-
import { nodesAsString } from "../utilities/string";
|
|
13
12
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
14
13
|
|
|
15
14
|
const proofNodeQuery = nodeQuery("/lemma/proof!"),
|
|
@@ -23,7 +22,7 @@ export default function verifyLemma(lemmaNode, fileContext) {
|
|
|
23
22
|
fileContext.begin(lemmaNode);
|
|
24
23
|
|
|
25
24
|
const labelNodes = labelNodesQuery(lemmaNode),
|
|
26
|
-
labelsString = nodesAsString(labelNodes),
|
|
25
|
+
labelsString = fileContext.nodesAsString(labelNodes),
|
|
27
26
|
proofContext = ProofContext.fromFileContext(fileContext);
|
|
28
27
|
|
|
29
28
|
(labelsString === EMPTY_STRING) ?
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import verifyMetastatement from "../../verify/metastatement";
|
|
4
4
|
|
|
5
|
-
import { nodeAsString } from "../../utilities/string";
|
|
6
5
|
import { nodeQuery, referenceNameFromReferenceNode } from "../../utilities/query";
|
|
7
6
|
|
|
8
7
|
const referenceNodeQuery = nodeQuery("/qualifiedMetastatement/qualification!/reference!"),
|
|
@@ -16,9 +15,9 @@ export default function verifyQualifiedMetastatement(qualifiedMetastatementNode,
|
|
|
16
15
|
const metastatementNode = metastatementNodeQuery(qualifiedMetastatementNode);
|
|
17
16
|
|
|
18
17
|
if (metastatementNode !== null) {
|
|
19
|
-
const metastatementString = nodeAsString(metastatementNode);
|
|
18
|
+
const metastatementString = metaproofContext.nodeAsString(metastatementNode);
|
|
20
19
|
|
|
21
|
-
metaproofContext.debug(`Verifying the ${metastatementString} qualified metastatement...`);
|
|
20
|
+
metaproofContext.debug(`Verifying the '${metastatementString}' qualified metastatement...`);
|
|
22
21
|
|
|
23
22
|
let ruleMatchesMetastatement = true;
|
|
24
23
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import verifyMetastatement from "../metastatement";
|
|
4
4
|
|
|
5
5
|
import { nodeQuery } from "../../utilities/query";
|
|
6
|
-
import { nodeAsString } from "../../utilities/string";
|
|
7
6
|
|
|
8
7
|
const metastatementNodeQuery = nodeQuery("/unqualifiedMetastatement/metastatement!");
|
|
9
8
|
|
|
@@ -15,9 +14,9 @@ export default function verifyUnqualifiedMetastatement(unqualifiedMetastatementN
|
|
|
15
14
|
const metastatementNode = metastatementNodeQuery(unqualifiedMetastatementNode);
|
|
16
15
|
|
|
17
16
|
if (metastatementNode !== null) {
|
|
18
|
-
const metastatementString = nodeAsString(metastatementNode);
|
|
17
|
+
const metastatementString = metaproofContext.nodeAsString(metastatementNode);
|
|
19
18
|
|
|
20
|
-
metaproofContext.debug(`Verifying the ${metastatementString} unqualified metastatement...`);
|
|
19
|
+
metaproofContext.debug(`Verifying the '${metastatementString}' unqualified metastatement...`);
|
|
21
20
|
|
|
22
21
|
let metastatementMatches = true;
|
|
23
22
|
|
package/src/verify/premise.js
CHANGED
|
@@ -5,7 +5,6 @@ import MetaproofStep from "../step/metaproof";
|
|
|
5
5
|
import verifyUnqualifiedMetastatement from "../verify/metastatement/unqualified";
|
|
6
6
|
|
|
7
7
|
import { nodeQuery } from "../utilities/query";
|
|
8
|
-
import { nodeAsString } from "../utilities/string";
|
|
9
8
|
|
|
10
9
|
const metastatementNodeQuery = nodeQuery("/unqualifiedMetastatement/metastatement!"),
|
|
11
10
|
unqualifiedMetastatementNodeQuery = nodeQuery("/premise/unqualifiedMetastatement!");
|
|
@@ -15,9 +14,9 @@ export default function verifyPremise(premiseNode, premises, metaproofContext) {
|
|
|
15
14
|
|
|
16
15
|
metaproofContext.begin(premiseNode);
|
|
17
16
|
|
|
18
|
-
const premiseString = nodeAsString(premiseNode);
|
|
17
|
+
const premiseString = metaproofContext.nodeAsString(premiseNode);
|
|
19
18
|
|
|
20
|
-
metaproofContext.debug(`Verifying the ${premiseString} premise...`);
|
|
19
|
+
metaproofContext.debug(`Verifying the '${premiseString}' premise...`);
|
|
21
20
|
|
|
22
21
|
const derived = false,
|
|
23
22
|
assertions = [],
|
package/src/verify/rule.js
CHANGED
|
@@ -8,7 +8,6 @@ import MetaproofContext from "../context/metaproof";
|
|
|
8
8
|
import verifyConclusion from "../verify/conclusion";
|
|
9
9
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
|
-
import { nodesAsString } from "../utilities/string";
|
|
12
11
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
13
12
|
|
|
14
13
|
const labelNodesQuery = nodesQuery("/rule/label"),
|
|
@@ -22,7 +21,7 @@ export default function verifyRule(ruleNode, fileContext) {
|
|
|
22
21
|
fileContext.begin(ruleNode);
|
|
23
22
|
|
|
24
23
|
const labelNodes = labelNodesQuery(ruleNode),
|
|
25
|
-
labelsString = nodesAsString(labelNodes),
|
|
24
|
+
labelsString = fileContext.nodesAsString(labelNodes),
|
|
26
25
|
metaProofContext = MetaproofContext.fromFileContext(fileContext);
|
|
27
26
|
|
|
28
27
|
fileContext.debug(`Verifying the '${labelsString}' rule...`);
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import verifyStatement from "../../verify/statement";
|
|
4
4
|
|
|
5
|
-
import { nodeAsString } from "../../utilities/string";
|
|
6
5
|
import { nodeQuery, referenceNameFromReferenceNode } from "../../utilities/query";
|
|
7
6
|
|
|
8
7
|
const referenceNodeQuery = nodeQuery("/qualifiedStatement/qualification!/reference!"),
|
|
@@ -16,28 +15,69 @@ export default function verifyQualifiedStatement(qualifiedStatementNode, asserti
|
|
|
16
15
|
const statementNode = statementNodeQuery(qualifiedStatementNode);
|
|
17
16
|
|
|
18
17
|
if (statementNode !== null) {
|
|
19
|
-
const statementString = nodeAsString(statementNode);
|
|
18
|
+
const statementString = proofContext.nodeAsString(statementNode);
|
|
20
19
|
|
|
21
|
-
proofContext.debug(`Verifying the ${statementString} qualified statement...`);
|
|
22
|
-
|
|
23
|
-
let ruleMatchesStatement = true;
|
|
20
|
+
proofContext.debug(`Verifying the '${statementString}' qualified statement...`);
|
|
24
21
|
|
|
25
22
|
const referenceNode = referenceNodeQuery(qualifiedStatementNode);
|
|
26
23
|
|
|
27
|
-
if (referenceNode
|
|
28
|
-
const referenceName = referenceNameFromReferenceNode(referenceNode),
|
|
29
|
-
rule = proofContext.findRuleByReferenceName(referenceName);
|
|
30
|
-
|
|
31
|
-
if (rule !== null) {
|
|
32
|
-
ruleMatchesStatement = rule.matchStatement(statementNode, proofContext);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (ruleMatchesStatement) {
|
|
24
|
+
if (referenceNode === null) {
|
|
37
25
|
const context = proofContext,
|
|
38
26
|
statementVerified = verifyStatement(statementNode, assertions, derived, context);
|
|
39
27
|
|
|
40
28
|
qualifiedStatementVerified = statementVerified; ///
|
|
29
|
+
} else {
|
|
30
|
+
const referenceName = referenceNameFromReferenceNode(referenceNode);
|
|
31
|
+
|
|
32
|
+
if (!qualifiedStatementVerified) {
|
|
33
|
+
const rule = proofContext.findRuleByReferenceName(referenceName);
|
|
34
|
+
|
|
35
|
+
if (rule !== null) {
|
|
36
|
+
const ruleMatchesStatement = rule.matchStatement(statementNode, proofContext);
|
|
37
|
+
|
|
38
|
+
qualifiedStatementVerified = ruleMatchesStatement; ///
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (!qualifiedStatementVerified) {
|
|
43
|
+
const axiom = proofContext.findAxiomByReferenceName(referenceName);
|
|
44
|
+
|
|
45
|
+
if (axiom !== null) {
|
|
46
|
+
const axiomMatchesStatement = axiom.matchStatement(statementNode, proofContext);
|
|
47
|
+
|
|
48
|
+
qualifiedStatementVerified = axiomMatchesStatement; ///
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!qualifiedStatementVerified) {
|
|
53
|
+
const lemma = proofContext.findLemmaByReferenceName(referenceName);
|
|
54
|
+
|
|
55
|
+
if (lemma !== null) {
|
|
56
|
+
const lemmaMatchesStatement = lemma.matchStatement(statementNode, proofContext);
|
|
57
|
+
|
|
58
|
+
qualifiedStatementVerified = lemmaMatchesStatement; ///
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (!qualifiedStatementVerified) {
|
|
63
|
+
const theorem = proofContext.findTheoremByReferenceName(referenceName);
|
|
64
|
+
|
|
65
|
+
if (theorem !== null) {
|
|
66
|
+
const theoremMatchesStatement = theorem.matchStatement(statementNode, proofContext);
|
|
67
|
+
|
|
68
|
+
qualifiedStatementVerified = theoremMatchesStatement; ///
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!qualifiedStatementVerified) {
|
|
73
|
+
const conjecture = proofContext.findConjectureByReferenceName(referenceName);
|
|
74
|
+
|
|
75
|
+
if (conjecture !== null) {
|
|
76
|
+
const conjectureMatchesStatement = conjecture.matchStatement(statementNode, proofContext);
|
|
77
|
+
|
|
78
|
+
qualifiedStatementVerified = conjectureMatchesStatement; ///
|
|
79
|
+
}
|
|
80
|
+
}
|
|
41
81
|
}
|
|
42
82
|
}
|
|
43
83
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import verifyStatement from "../statement";
|
|
4
4
|
|
|
5
5
|
import { nodeQuery } from "../../utilities/query";
|
|
6
|
-
import { nodeAsString } from "../../utilities/string";
|
|
7
6
|
|
|
8
7
|
const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!");
|
|
9
8
|
|
|
@@ -15,9 +14,9 @@ export default function verifyUnqualifiedStatement(unqualifiedStatementNode, ass
|
|
|
15
14
|
const statementNode = statementNodeQuery(unqualifiedStatementNode);
|
|
16
15
|
|
|
17
16
|
if (statementNode !== null) {
|
|
18
|
-
const statementString = nodeAsString(statementNode);
|
|
17
|
+
const statementString = proofContext.nodeAsString(statementNode);
|
|
19
18
|
|
|
20
|
-
proofContext.debug(`Verifying the ${statementString} unqualified statement...`);
|
|
19
|
+
proofContext.debug(`Verifying the '${statementString}' unqualified statement...`);
|
|
21
20
|
|
|
22
21
|
let statementMatches = true;
|
|
23
22
|
|