occam-verify-cli 0.0.697 → 0.0.700
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/assignment/equality.js +7 -5
- package/lib/assignment/metavariable.js +62 -0
- package/lib/assignment/variable.js +7 -5
- package/lib/constructor.js +3 -10
- package/lib/context/file.js +37 -97
- package/lib/context/local.js +28 -22
- package/lib/context/localMeta.js +21 -21
- package/lib/context/release.js +2 -4
- package/lib/equality.js +15 -7
- package/lib/metaType.js +10 -10
- package/lib/metavariable.js +27 -31
- package/lib/mixins/context.js +107 -0
- package/lib/ruleNames.js +9 -1
- package/lib/substitution/metastatementForMetavariable.js +17 -10
- package/lib/substitution/statementForMetavariable.js +17 -10
- package/lib/substitution/termForVariable.js +17 -11
- package/lib/type.js +23 -27
- package/lib/utilities/node.js +3 -73
- package/lib/utilities/query.js +2 -16
- package/lib/utilities/tokens.js +1 -8
- package/lib/variable.js +43 -36
- package/lib/verifier/node/metastatement.js +2 -3
- package/lib/verifier/node/statementAsCombinator.js +1 -1
- package/lib/verifier/node.js +2 -2
- package/lib/verifier/nodes/metastatementForMetavariable.js +5 -5
- package/lib/verifier/nodes/statementForMetavariable.js +5 -5
- package/lib/verifier/nodes/termForVariable.js +6 -6
- package/lib/verifier/nodes.js +2 -2
- package/lib/verify/axiom.js +3 -8
- package/lib/verify/conclusion.js +2 -2
- package/lib/verify/conjecture.js +4 -9
- package/lib/verify/derivation.js +3 -8
- package/lib/verify/equality.js +11 -11
- package/lib/verify/file.js +2 -2
- package/lib/verify/lemma.js +4 -9
- package/lib/verify/metavariable.js +8 -6
- package/lib/verify/premises.js +28 -0
- package/lib/verify/rule.js +3 -8
- package/lib/verify/ruleDerivation.js +6 -8
- package/lib/verify/standaloneType.js +32 -0
- package/lib/verify/statement/unqualified.js +2 -2
- package/lib/verify/supposition.js +4 -7
- package/lib/verify/suppositions.js +37 -0
- package/lib/verify/term.js +3 -4
- package/lib/verify/termAndStandaloneType.js +39 -0
- package/lib/verify/termAsVariableAndStandaloneType.js +39 -0
- package/lib/verify/theorem.js +4 -9
- package/lib/verify/type.js +2 -2
- package/lib/verify/typeAssertion.js +59 -89
- package/lib/verify/variable.js +12 -10
- package/package.json +1 -1
- package/src/assignment/equality.js +13 -4
- package/src/assignment/metavariable.js +30 -0
- package/src/assignment/variable.js +15 -4
- package/src/constructor.js +2 -7
- package/src/context/file.js +50 -41
- package/src/context/local.js +40 -27
- package/src/context/localMeta.js +26 -22
- package/src/context/release.js +6 -9
- package/src/equality.js +12 -5
- package/src/metaType.js +10 -10
- package/src/metavariable.js +24 -22
- package/src/mixins/{file.js → context.js} +20 -2
- package/src/ruleNames.js +2 -0
- package/src/substitution/metastatementForMetavariable.js +13 -7
- package/src/substitution/statementForMetavariable.js +13 -7
- package/src/substitution/termForVariable.js +13 -9
- package/src/type.js +27 -39
- package/src/utilities/node.js +3 -81
- package/src/utilities/query.js +1 -19
- package/src/utilities/tokens.js +0 -8
- package/src/variable.js +48 -30
- package/src/verifier/node/metastatement.js +1 -3
- package/src/verifier/node/statementAsCombinator.js +1 -1
- package/src/verifier/nodes/metastatementForMetavariable.js +5 -7
- package/src/verifier/nodes/statementForMetavariable.js +5 -7
- package/src/verifier/nodes/termForVariable.js +6 -8
- package/src/verify/axiom.js +2 -8
- package/src/verify/conclusion.js +1 -1
- package/src/verify/conjecture.js +3 -9
- package/src/verify/derivation.js +2 -8
- package/src/verify/equality.js +10 -10
- package/src/verify/file.js +1 -1
- package/src/verify/lemma.js +3 -9
- package/src/verify/metavariable.js +10 -9
- package/src/verify/premises.js +17 -0
- package/src/verify/rule.js +2 -8
- package/src/verify/ruleDerivation.js +5 -7
- package/src/verify/standaloneType.js +34 -0
- package/src/verify/statement/unqualified.js +1 -1
- package/src/verify/supposition.js +2 -7
- package/src/verify/suppositions.js +29 -0
- package/src/verify/term.js +3 -6
- package/src/verify/termAndStandaloneType.js +37 -0
- package/src/verify/termAsVariableAndStandaloneType.js +38 -0
- package/src/verify/theorem.js +3 -9
- package/src/verify/type.js +1 -1
- package/src/verify/typeAssertion.js +79 -110
- package/src/verify/variable.js +13 -13
- package/lib/mixins/file.js +0 -83
- package/lib/mixins/logging.js +0 -39
- package/src/mixins/logging.js +0 -24
package/src/verify/derivation.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import ProofStep from "../step/proof";
|
|
4
4
|
import LocalContext from "../context/local";
|
|
5
|
-
import
|
|
5
|
+
import verifySuppositions from "../verify/suppositions";
|
|
6
6
|
import verifyQualifiedStatement from "../verify/statement/qualified";
|
|
7
7
|
import verifyUnqualifiedStatement from "../verify/statement/unqualified";
|
|
8
8
|
|
|
@@ -53,13 +53,7 @@ function verifySubproof(subproofNode, localContext) {
|
|
|
53
53
|
|
|
54
54
|
const suppositions = [],
|
|
55
55
|
suppositionNodes = suppositionNodesQuery(subproofNode),
|
|
56
|
-
suppositionsVerified = suppositionNodes
|
|
57
|
-
const suppositionVerified = verifySupposition(suppositionNode, suppositions, localContext);
|
|
58
|
-
|
|
59
|
-
if (suppositionVerified) {
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
62
|
-
});
|
|
56
|
+
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
63
57
|
|
|
64
58
|
if (suppositionsVerified) {
|
|
65
59
|
const subDerivationNode = subDerivationNodeQuery(subproofNode),
|
package/src/verify/equality.js
CHANGED
|
@@ -19,7 +19,7 @@ export default function verifyEquality(equalityNode, assignments, derived, conte
|
|
|
19
19
|
|
|
20
20
|
const verifyEqualityFunctions = [
|
|
21
21
|
verifyDerivedEquality,
|
|
22
|
-
|
|
22
|
+
verifyGivenEquality
|
|
23
23
|
];
|
|
24
24
|
|
|
25
25
|
equalityVerified = verifyEqualityFunctions.some((verifyEqualityFunction) => {
|
|
@@ -59,7 +59,7 @@ function verifyDerivedEquality(equalityNode, assignments, derived, context, veri
|
|
|
59
59
|
secondTerm = second(terms),
|
|
60
60
|
leftTerm = firstTerm, ///
|
|
61
61
|
rightTerm = secondTerm, ///
|
|
62
|
-
equality = Equality.
|
|
62
|
+
equality = Equality.fromEqualityNodeLeftTermAndRightTerm(equalityNode, leftTerm, rightTerm);
|
|
63
63
|
|
|
64
64
|
if (equality !== null) {
|
|
65
65
|
const equalityEqual = context.isEqualityEqual(equality);
|
|
@@ -82,13 +82,13 @@ function verifyDerivedEquality(equalityNode, assignments, derived, context, veri
|
|
|
82
82
|
return derivedEqualityVerified;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
function
|
|
86
|
-
let
|
|
85
|
+
function verifyGivenEquality(equalityNode, assignments, derived, context, verifyAhead) {
|
|
86
|
+
let givenEqualityVerified = false;
|
|
87
87
|
|
|
88
88
|
if (!derived) {
|
|
89
89
|
const equalityString = context.nodeAsString(equalityNode);
|
|
90
90
|
|
|
91
|
-
context.trace(`Verifying the '${equalityString}'
|
|
91
|
+
context.trace(`Verifying the '${equalityString}' given equality...`, equalityNode);
|
|
92
92
|
|
|
93
93
|
const terms = [],
|
|
94
94
|
leftTermNode = leftTermNodeQuery(equalityNode),
|
|
@@ -104,7 +104,7 @@ function verifyStandaloneEquality(equalityNode, assignments, derived, context, v
|
|
|
104
104
|
secondTerm = second(terms),
|
|
105
105
|
leftTerm = firstTerm, ///
|
|
106
106
|
rightTerm = secondTerm, ///
|
|
107
|
-
equality = Equality.
|
|
107
|
+
equality = Equality.fromEqualityNodeLeftTermAndRightTerm(equalityNode, leftTerm, rightTerm);
|
|
108
108
|
|
|
109
109
|
if (equality !== null) {
|
|
110
110
|
const equalityAssignment = EqualityAssignment.fromEquality(equality),
|
|
@@ -122,12 +122,12 @@ function verifyStandaloneEquality(equalityNode, assignments, derived, context, v
|
|
|
122
122
|
return verifiedAhead;
|
|
123
123
|
});
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
givenEqualityVerified = termsVerified; ///
|
|
126
126
|
|
|
127
|
-
if (
|
|
128
|
-
context.trace(`...verified the '${equalityString}'
|
|
127
|
+
if (givenEqualityVerified) {
|
|
128
|
+
context.trace(`...verified the '${equalityString}' given equality.`, equalityNode);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
return
|
|
132
|
+
return givenEqualityVerified;
|
|
133
133
|
}
|
package/src/verify/file.js
CHANGED
package/src/verify/lemma.js
CHANGED
|
@@ -4,8 +4,8 @@ import Lemma from "../lemma";
|
|
|
4
4
|
import verifyProof from "../verify/proof";
|
|
5
5
|
import LocalContext from "../context/local";
|
|
6
6
|
import verifyLabels from "../verify/labels";
|
|
7
|
-
import verifyConsequent from "
|
|
8
|
-
import
|
|
7
|
+
import verifyConsequent from "../verify/consequent";
|
|
8
|
+
import verifySuppositions from "../verify/suppositions";
|
|
9
9
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { EMPTY_STRING } from "../constants";
|
|
@@ -33,13 +33,7 @@ export default function verifyLemma(lemmaNode, fileContext) {
|
|
|
33
33
|
if (labelsVerified) {
|
|
34
34
|
const suppositions = [],
|
|
35
35
|
suppositionNodes = suppositionsNodeQuery(lemmaNode),
|
|
36
|
-
suppositionsVerified = suppositionNodes
|
|
37
|
-
const suppositionVerified = verifySupposition(suppositionNode, suppositions, localContext);
|
|
38
|
-
|
|
39
|
-
if (suppositionVerified) {
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
36
|
+
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
43
37
|
|
|
44
38
|
if (suppositionsVerified) {
|
|
45
39
|
const consequents = [],
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Metavariable from "../metavariable";
|
|
4
|
+
import MetavariableAssignment from "../assignment/metavariable";
|
|
4
5
|
|
|
5
|
-
import { metaTypeNameFromMetaTypeNode
|
|
6
|
+
import { metaTypeNameFromMetaTypeNode } from "../utilities/query";
|
|
6
7
|
|
|
7
8
|
export default function verifyMetavariable(metavariableNode, metaTypeNode, fileContext) {
|
|
8
9
|
let metavariableVerified = false;
|
|
@@ -11,20 +12,20 @@ export default function verifyMetavariable(metavariableNode, metaTypeNode, fileC
|
|
|
11
12
|
|
|
12
13
|
fileContext.trace(`Verifying the '${metavariableString}' metavariable...`, metavariableNode);
|
|
13
14
|
|
|
14
|
-
const
|
|
15
|
-
metavariablePresent = fileContext.isMetavariablePresentByMetavariableName(metavariableName);
|
|
15
|
+
const metavariablePresent = fileContext.isMetavariablePresentByMetavariableNode(metavariableNode);
|
|
16
16
|
|
|
17
17
|
if (metavariablePresent) {
|
|
18
|
-
fileContext.debug(`The metavariable '${
|
|
18
|
+
fileContext.debug(`The metavariable '${metavariableString}' is already present.`, metavariableNode);
|
|
19
19
|
} else {
|
|
20
20
|
const metaTypeName = metaTypeNameFromMetaTypeNode(metaTypeNode),
|
|
21
21
|
metaType = fileContext.findMetaTypeByMetaTypeName(metaTypeName),
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
metavariable = Metavariable.fromMetavariableNodeAndMetaType(metavariableNode, metaType),
|
|
23
|
+
metavariableAssignment = MetavariableAssignment.fromMetavariable(metavariable),
|
|
24
|
+
metavariableAssigned = metavariableAssignment.assign(fileContext);
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
if (metavariableAssigned) {
|
|
27
|
+
metavariableVerified = true;
|
|
28
|
+
}
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
if (metavariableVerified) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import verifyPremise from "../verify/premise";
|
|
4
|
+
|
|
5
|
+
export default function verifyPremises(premiseNodes, premises, localMetaContext) {
|
|
6
|
+
let premisesVerified;
|
|
7
|
+
|
|
8
|
+
premisesVerified = premiseNodes.every((premiseNode) => {
|
|
9
|
+
const premiseVerified = verifyPremise(premiseNode, premises, localMetaContext);
|
|
10
|
+
|
|
11
|
+
if (premiseVerified) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
return premisesVerified;
|
|
17
|
+
}
|
package/src/verify/rule.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import Rule from "../rule";
|
|
4
4
|
import verifyLabels from "../verify/labels";
|
|
5
|
-
import
|
|
5
|
+
import verifyPremises from "../verify/premises";
|
|
6
6
|
import verifyRuleProof from "../verify/ruleProof";
|
|
7
7
|
import LocalMetaContext from "../context/localMeta";
|
|
8
8
|
import verifyConclusion from "../verify/conclusion";
|
|
@@ -30,13 +30,7 @@ export default function verifyRule(ruleNode, fileContext) {
|
|
|
30
30
|
if (labelsVerified) {
|
|
31
31
|
const premises = [],
|
|
32
32
|
premiseNodes = premisesNodeQuery(ruleNode),
|
|
33
|
-
premisesVerified = premiseNodes
|
|
34
|
-
const premiseVerified = verifyPremise(premiseNode, premises, localMetaContext);
|
|
35
|
-
|
|
36
|
-
if (premiseVerified) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
33
|
+
premisesVerified = verifyPremises(premiseNodes, premises, localMetaContext);
|
|
40
34
|
|
|
41
35
|
if (premisesVerified) {
|
|
42
36
|
const conclusions = [],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import MetaproofStep from "../step/metaproof";
|
|
4
|
-
import
|
|
4
|
+
import verifyPremises from "../verify/premises";
|
|
5
5
|
import LocalMetaContext from "../context/localMeta";
|
|
6
6
|
import verifyQualifiedMetastatement from "../verify/metastatement/qualified";
|
|
7
7
|
import verifyUnqualifiedMetastatement from "../verify/metastatement/unqualified";
|
|
@@ -53,13 +53,11 @@ function verifyRuleSubproof(ruleSubproofNode, localMetaContext) {
|
|
|
53
53
|
|
|
54
54
|
const premises = [],
|
|
55
55
|
premiseNodes = premiseNodesQuery(ruleSubproofNode),
|
|
56
|
-
premisesVerified = premiseNodes
|
|
57
|
-
const premiseVerified = verifyPremise(premiseNode, premises, localMetaContext);
|
|
56
|
+
premisesVerified = verifyPremises(premiseNodes, premises, localMetaContext);
|
|
58
57
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
});
|
|
58
|
+
if (premiseVerified) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
63
61
|
|
|
64
62
|
if (premisesVerified) {
|
|
65
63
|
const ruleSubDerivationNode = ruleSubDerivationNodeQuery(ruleSubproofNode),
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { typeNameFromTypeNode } from "../utilities/query";
|
|
4
|
+
|
|
5
|
+
export default function verifyStandaloneType(typeNode, types, context, verifyAhead) {
|
|
6
|
+
let standaloneTypeVerified = false;
|
|
7
|
+
|
|
8
|
+
const typeString = context.nodeAsString(typeNode);
|
|
9
|
+
|
|
10
|
+
context.trace(`Verifying the standalone '${typeString}' type...`, typeNode);
|
|
11
|
+
|
|
12
|
+
const typeName = typeNameFromTypeNode(typeNode),
|
|
13
|
+
type = context.findTypeByTypeName(typeName);
|
|
14
|
+
|
|
15
|
+
if (type !== null) {
|
|
16
|
+
let verifiedAhead;
|
|
17
|
+
|
|
18
|
+
types.push(type)
|
|
19
|
+
|
|
20
|
+
verifiedAhead = verifyAhead();
|
|
21
|
+
|
|
22
|
+
if (!verifiedAhead) {
|
|
23
|
+
types.pop();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
standaloneTypeVerified = verifiedAhead; ///
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (standaloneTypeVerified) {
|
|
30
|
+
context.debug(`...verified the standalone '${typeString}' type.`, typeNode);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return standaloneTypeVerified;
|
|
34
|
+
}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import ProofStep from "../step/proof";
|
|
4
4
|
import Supposition from "../supposition";
|
|
5
|
-
import verifyUnqualifiedStatement from "
|
|
5
|
+
import verifyUnqualifiedStatement from "../verify/statement/unqualified";
|
|
6
6
|
|
|
7
7
|
import { nodeQuery } from "../utilities/query";
|
|
8
8
|
|
|
9
9
|
const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!"),
|
|
10
10
|
unqualifiedStatementNodeQuery = nodeQuery("/supposition/unqualifiedStatement!");
|
|
11
11
|
|
|
12
|
-
export default function verifySupposition(suppositionNode, suppositions, localContext) {
|
|
12
|
+
export default function verifySupposition(suppositionNode, suppositions, assignments, localContext) {
|
|
13
13
|
let suppositionVerified;
|
|
14
14
|
|
|
15
15
|
const suppositionString = localContext.nodeAsString(suppositionNode);
|
|
@@ -17,7 +17,6 @@ export default function verifySupposition(suppositionNode, suppositions, localCo
|
|
|
17
17
|
localContext.trace(`Verifying the '${suppositionString}' supposition...`, suppositionNode);
|
|
18
18
|
|
|
19
19
|
const derived = false,
|
|
20
|
-
assignments = [],
|
|
21
20
|
unqualifiedStatementNode = unqualifiedStatementNodeQuery(suppositionNode),
|
|
22
21
|
unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, assignments, derived, localContext);
|
|
23
22
|
|
|
@@ -30,10 +29,6 @@ export default function verifySupposition(suppositionNode, suppositions, localCo
|
|
|
30
29
|
|
|
31
30
|
localContext.addProofStep(proofStep);
|
|
32
31
|
|
|
33
|
-
assignments.forEach((assignment) => {
|
|
34
|
-
assignment.assign(localContext);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
32
|
suppositionVerified = true;
|
|
38
33
|
}
|
|
39
34
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import verifySupposition from "../verify/supposition";
|
|
4
|
+
|
|
5
|
+
export default function verifySuppositions(suppositionNodes, suppositions, localContext) {
|
|
6
|
+
let suppositionsVerified;
|
|
7
|
+
|
|
8
|
+
const assignments = [];
|
|
9
|
+
|
|
10
|
+
suppositionsVerified = suppositionNodes.every((suppositionNode) => {
|
|
11
|
+
const suppositionVerified = verifySupposition(suppositionNode, suppositions, assignments, localContext);
|
|
12
|
+
|
|
13
|
+
if (suppositionVerified) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
if (suppositionsVerified) {
|
|
19
|
+
suppositionsVerified = assignments.every((assignment) => { ///
|
|
20
|
+
const assigned = assignment.assign(localContext);
|
|
21
|
+
|
|
22
|
+
if (assigned) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return suppositionsVerified;
|
|
29
|
+
}
|
package/src/verify/term.js
CHANGED
|
@@ -4,7 +4,7 @@ import Term from "../term";
|
|
|
4
4
|
import termNodesVerifier from "../verifier/nodes/term";
|
|
5
5
|
|
|
6
6
|
import { first } from "../utilities/array";
|
|
7
|
-
import { nodeQuery
|
|
7
|
+
import { nodeQuery } from "../utilities/query";
|
|
8
8
|
|
|
9
9
|
const variableNodeQuery = nodeQuery("/term/variable!");
|
|
10
10
|
|
|
@@ -67,14 +67,11 @@ export function verifyTermAsVariable(termNode, variables, context, verifyAhead)
|
|
|
67
67
|
|
|
68
68
|
context.trace(`Verifying the '${termString}' term as a variable...`, termNode);
|
|
69
69
|
|
|
70
|
-
const
|
|
71
|
-
variablePresent = context.isVariablePresentByVariableName(variableName);
|
|
70
|
+
const variable = context.findVariableByVariableNode(variableNode);
|
|
72
71
|
|
|
73
|
-
if (
|
|
72
|
+
if (variable !== null) {
|
|
74
73
|
let verifiedAhead;
|
|
75
74
|
|
|
76
|
-
const variable = context.findVariableByVariableName(variableName);
|
|
77
|
-
|
|
78
75
|
variables.push(variable);
|
|
79
76
|
|
|
80
77
|
verifiedAhead = verifyAhead();
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import verifyTerm from "../verify/term";
|
|
4
|
+
import verifyStandaloneType from "../verify/standaloneType";
|
|
5
|
+
|
|
6
|
+
export default function verifyTermAndStandaloneType(termNode, typeNode, terms, types, context, verifyAhead) {
|
|
7
|
+
let termAndStandaloneTypeVerified;
|
|
8
|
+
|
|
9
|
+
const termString = context.nodeAsString(termNode),
|
|
10
|
+
typeString = context.nodeAsString(typeNode);
|
|
11
|
+
|
|
12
|
+
context.trace(`Verifying the '${termString}' term and the standalone '${typeString}' type...`, termNode);
|
|
13
|
+
|
|
14
|
+
const termVerified = verifyTerm(termNode, terms, context, () => {
|
|
15
|
+
let verifiedAhead;
|
|
16
|
+
|
|
17
|
+
const standaloneTypeVerified = verifyStandaloneType(typeNode, types, context, () => {
|
|
18
|
+
let verifiedAhead;
|
|
19
|
+
|
|
20
|
+
verifiedAhead = verifyAhead();
|
|
21
|
+
|
|
22
|
+
return verifiedAhead;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
verifiedAhead = standaloneTypeVerified; ///
|
|
26
|
+
|
|
27
|
+
return verifiedAhead;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
termAndStandaloneTypeVerified = termVerified; ///
|
|
31
|
+
|
|
32
|
+
if (termAndStandaloneTypeVerified) {
|
|
33
|
+
context.debug(`...verified the '${termString}' term and the standalone '${typeString}' type.`, termNode);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return termAndStandaloneTypeVerified
|
|
37
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import verifyStandaloneType from "../verify/standaloneType";
|
|
4
|
+
|
|
5
|
+
import { verifyTermAsVariable } from "../verify/term";
|
|
6
|
+
|
|
7
|
+
export default function verifyTermAsVariableAndStandaloneType(termNode, typeNode, variables, types, context, verifyAhead) {
|
|
8
|
+
let termAsVariableAndStandaloneTypeVerified;
|
|
9
|
+
|
|
10
|
+
const termString = context.nodeAsString(termNode),
|
|
11
|
+
typeString = context.nodeAsString(typeNode);
|
|
12
|
+
|
|
13
|
+
context.trace(`Verifying the '${termString}' term as a variable and the standalone '${typeString}' type...`, termNode);
|
|
14
|
+
|
|
15
|
+
const termVerifiedAsVariable = verifyTermAsVariable(termNode, variables, context, () => {
|
|
16
|
+
let verifiedAhead;
|
|
17
|
+
|
|
18
|
+
const standaloneTypeVerified = verifyStandaloneType(typeNode, types, context, () => {
|
|
19
|
+
let verifiedAhead;
|
|
20
|
+
|
|
21
|
+
verifiedAhead = verifyAhead();
|
|
22
|
+
|
|
23
|
+
return verifiedAhead;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
verifiedAhead = standaloneTypeVerified; ///
|
|
27
|
+
|
|
28
|
+
return verifiedAhead;
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
termAsVariableAndStandaloneTypeVerified = termVerifiedAsVariable; ///
|
|
32
|
+
|
|
33
|
+
if (termAsVariableAndStandaloneTypeVerified) {
|
|
34
|
+
context.debug(`...verified the '${termString}' term as a variable and the standalone '${typeString}' type.`, termNode);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return termAsVariableAndStandaloneTypeVerified
|
|
38
|
+
}
|
package/src/verify/theorem.js
CHANGED
|
@@ -4,8 +4,8 @@ import Theorem from "../theorem";
|
|
|
4
4
|
import verifyProof from "../verify/proof";
|
|
5
5
|
import LocalContext from "../context/local";
|
|
6
6
|
import verifyLabels from "../verify/labels";
|
|
7
|
-
import verifyConsequent from "
|
|
8
|
-
import
|
|
7
|
+
import verifyConsequent from "../verify/consequent";
|
|
8
|
+
import verifySuppositions from "../verify/suppositions";
|
|
9
9
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
@@ -30,13 +30,7 @@ export default function verifyTheorem(theoremNode, fileContext) {
|
|
|
30
30
|
if (labelsVerified) {
|
|
31
31
|
const suppositions = [],
|
|
32
32
|
suppositionNodes = suppositionsNodeQuery(theoremNode),
|
|
33
|
-
suppositionsVerified = suppositionNodes
|
|
34
|
-
const suppositionVerified = verifySupposition(suppositionNode, suppositions, localContext);
|
|
35
|
-
|
|
36
|
-
if (suppositionVerified) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
33
|
+
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
40
34
|
|
|
41
35
|
if (suppositionsVerified) {
|
|
42
36
|
const consequents = [],
|
package/src/verify/type.js
CHANGED
|
@@ -9,7 +9,7 @@ export default function verifyType(typeNode, superTypeNode, fileContext) {
|
|
|
9
9
|
|
|
10
10
|
const typeString = fileContext.nodeAsString(typeNode);
|
|
11
11
|
|
|
12
|
-
fileContext.trace(`Verifying the '${typeString}' type
|
|
12
|
+
fileContext.trace(`Verifying the '${typeString}' type...`, typeNode);
|
|
13
13
|
|
|
14
14
|
const typeName = typeNameFromTypeNode(typeNode),
|
|
15
15
|
typePresent = fileContext.isTypePresentByTypeName(typeName);
|