occam-verify-cli 0.0.696 → 0.0.698
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 +6 -4
- package/lib/assignment/metavariable.js +62 -0
- package/lib/assignment/variable.js +6 -4
- package/lib/context/file.js +34 -26
- package/lib/context/local.js +24 -16
- package/lib/context/localMeta.js +17 -13
- package/lib/equality.js +13 -5
- package/lib/metavariable.js +25 -22
- package/lib/substitution/metastatementForMetavariable.js +17 -10
- package/lib/substitution/statementForMetavariable.js +17 -10
- package/lib/substitution/termForVariable.js +17 -11
- package/lib/utilities/query.js +2 -16
- package/lib/variable.js +33 -27
- package/lib/verifier/node/metastatement.js +2 -3
- 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/derivation.js +2 -2
- package/lib/verify/equality.js +3 -3
- package/lib/verify/file.js +2 -2
- package/lib/verify/metavariable.js +8 -6
- package/lib/verify/standaloneType.js +32 -0
- package/lib/verify/statement/unqualified.js +2 -2
- package/lib/verify/supposition.js +7 -4
- package/lib/verify/term.js +3 -3
- package/lib/verify/termAndStandaloneType.js +39 -0
- package/lib/verify/termAsVariableAndStandaloneType.js +39 -0
- package/lib/verify/theorem.js +3 -3
- package/lib/verify/type.js +2 -2
- package/lib/verify/typeAssertion.js +57 -91
- package/lib/verify/variable.js +12 -10
- package/package.json +5 -5
- package/src/assignment/equality.js +12 -3
- package/src/assignment/metavariable.js +30 -0
- package/src/assignment/variable.js +12 -3
- package/src/context/file.js +41 -29
- package/src/context/local.js +34 -19
- package/src/context/localMeta.js +21 -15
- package/src/equality.js +10 -3
- package/src/metavariable.js +25 -18
- package/src/substitution/metastatementForMetavariable.js +13 -7
- package/src/substitution/statementForMetavariable.js +13 -7
- package/src/substitution/termForVariable.js +13 -9
- package/src/utilities/query.js +1 -19
- package/src/variable.js +41 -26
- package/src/verifier/node/metastatement.js +1 -3
- 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/derivation.js +1 -1
- package/src/verify/equality.js +2 -2
- package/src/verify/file.js +1 -1
- package/src/verify/metavariable.js +10 -9
- package/src/verify/standaloneType.js +34 -0
- package/src/verify/statement/unqualified.js +1 -1
- package/src/verify/supposition.js +7 -3
- package/src/verify/term.js +3 -4
- package/src/verify/termAndStandaloneType.js +37 -0
- package/src/verify/termAsVariableAndStandaloneType.js +38 -0
- package/src/verify/theorem.js +2 -2
- package/src/verify/type.js +1 -1
- package/src/verify/typeAssertion.js +76 -112
- package/src/verify/variable.js +13 -13
package/src/variable.js
CHANGED
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
import Type from "./type";
|
|
4
4
|
|
|
5
|
+
import { nodeAsString } from "./utilities/string";
|
|
6
|
+
import { variableNodeFromVariableString } from "./utilities/node";
|
|
7
|
+
|
|
5
8
|
export default class Variable {
|
|
6
|
-
constructor(
|
|
7
|
-
this.
|
|
9
|
+
constructor(node, type) {
|
|
10
|
+
this.node = node;
|
|
8
11
|
this.type = type;
|
|
9
12
|
}
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
return this.
|
|
14
|
+
getNode() {
|
|
15
|
+
return this.node;
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
getType() {
|
|
@@ -17,19 +20,19 @@ export default class Variable {
|
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
match(variable) {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
nameMatches = this.matchName(name),
|
|
23
|
+
const type = variable.getType(),
|
|
24
|
+
node = variable.getNode(),
|
|
23
25
|
typeMatches = this.matchType(type),
|
|
24
|
-
|
|
26
|
+
nodeMatches = this.matchNode(node),
|
|
27
|
+
matches = nodeMatches && typeMatches;
|
|
25
28
|
|
|
26
29
|
return matches;
|
|
27
30
|
}
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
const
|
|
32
|
+
matchNode(node) {
|
|
33
|
+
const nodeMatches = this.node.match(node);
|
|
31
34
|
|
|
32
|
-
return
|
|
35
|
+
return nodeMatches;
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
matchType(type) {
|
|
@@ -38,41 +41,46 @@ export default class Variable {
|
|
|
38
41
|
return typeMatches;
|
|
39
42
|
}
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
const
|
|
44
|
+
matchNodeAndType(node, type) {
|
|
45
|
+
const nodeMatches = this.matchNode(node),
|
|
43
46
|
typeMatches = this.matchType(type),
|
|
44
|
-
|
|
47
|
+
nodeAndTypeMatch = nodeMatches && typeMatches;
|
|
45
48
|
|
|
46
|
-
return
|
|
49
|
+
return nodeAndTypeMatch;
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
asString(tokens) {
|
|
50
|
-
const typeName = this.type.getName()
|
|
51
|
-
|
|
53
|
+
const typeName = this.type.getName();
|
|
54
|
+
|
|
55
|
+
let string = nodeAsString(this.node, tokens);
|
|
56
|
+
|
|
57
|
+
string = `${string}:${typeName}`; ///
|
|
52
58
|
|
|
53
59
|
return string;
|
|
54
60
|
}
|
|
55
61
|
|
|
56
62
|
toJSON(tokens) {
|
|
57
63
|
const typeJSON = this.type.toJSON(tokens),
|
|
58
|
-
|
|
64
|
+
string = nodeAsString(this.node, tokens),
|
|
65
|
+
node = string, //
|
|
59
66
|
type = typeJSON, ///
|
|
60
67
|
json = {
|
|
61
|
-
|
|
68
|
+
node,
|
|
62
69
|
type
|
|
63
70
|
};
|
|
64
71
|
|
|
65
72
|
return json;
|
|
66
73
|
}
|
|
67
74
|
|
|
68
|
-
static
|
|
69
|
-
|
|
75
|
+
static fromJSONAndFileContext(json, fileContext) {
|
|
76
|
+
let { node } = json;
|
|
70
77
|
|
|
71
|
-
|
|
72
|
-
|
|
78
|
+
const lexer = fileContext.getLexer(),
|
|
79
|
+
parser = fileContext.getParser(),
|
|
80
|
+
variableString = node, ///
|
|
81
|
+
variableNode = variableNodeFromVariableString(variableString, lexer, parser);
|
|
73
82
|
|
|
74
|
-
|
|
75
|
-
const { name } = json;
|
|
83
|
+
node = variableNode; ///
|
|
76
84
|
|
|
77
85
|
let { type } = json;
|
|
78
86
|
|
|
@@ -84,7 +92,14 @@ export default class Variable {
|
|
|
84
92
|
|
|
85
93
|
type = fileContext.findTypeByTypeName(typeName); ///
|
|
86
94
|
|
|
87
|
-
const variable = new Variable(
|
|
95
|
+
const variable = new Variable(node, type);
|
|
96
|
+
|
|
97
|
+
return variable;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
static fromVariableNodeAndType(variableNode, type) {
|
|
101
|
+
const node = variableNode, ///
|
|
102
|
+
variable = new Variable(node, type);
|
|
88
103
|
|
|
89
104
|
return variable;
|
|
90
105
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import NodeVerifier from "../../verifier/node";
|
|
4
4
|
|
|
5
5
|
import { METAVARIABLE_RULE_NAME } from "../../ruleNames";
|
|
6
|
-
import { metavariableNameFromMetavariableNode } from "../../utilities/query";
|
|
7
6
|
|
|
8
7
|
class MetastatementNodeVerifier extends NodeVerifier {
|
|
9
8
|
verifyNonTerminalNode(nonTerminalNode, localMetaContext, verifyAhead) {
|
|
@@ -44,8 +43,7 @@ function verifyMetavariable(metavariableNode, localMetaContext, verifyAhead) {
|
|
|
44
43
|
|
|
45
44
|
localMetaContext.trace(`Verifying the '${metavariableString}' metavariable...`, metavariableNode);
|
|
46
45
|
|
|
47
|
-
const
|
|
48
|
-
metavariablePresent = localMetaContext.isMetavariablePresentByMetavariableName(metavariableName);
|
|
46
|
+
const metavariablePresent = localMetaContext.isMetavariablePresentByMetavariableNode(metavariableNode);
|
|
49
47
|
|
|
50
48
|
if (metavariablePresent) {
|
|
51
49
|
const verifiedAhead = verifyAhead();
|
|
@@ -5,7 +5,6 @@ import MetastatementForMetavariableSubstitution from "../../substitution/metasta
|
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../../utilities/query";
|
|
7
7
|
import { METASTATEMENT_RULE_NAME } from "../../ruleNames";
|
|
8
|
-
import { metavariableNameFromMetavariableNode } from "../../utilities/query";
|
|
9
8
|
|
|
10
9
|
const metavariableNodeQuery = nodeQuery('/metastatement/metavariable!');
|
|
11
10
|
|
|
@@ -55,11 +54,10 @@ export default class MetastatementForMetavariableNodesVerifier extends NodesVeri
|
|
|
55
54
|
verifyMetavariableNode(metavariableNodeA, metastatementNodeB, substitutions, fileContextA, localMetaContextB, verifyAhead) {
|
|
56
55
|
let metavariableNodeVerified;
|
|
57
56
|
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
const metavariableName = substitution.getMetavariableName();
|
|
57
|
+
const substitution = substitutions.find((substitution) => {
|
|
58
|
+
const substitutionMatchesMetavariableNodeA = substitution.matchMetavariableNode(metavariableNodeA);
|
|
61
59
|
|
|
62
|
-
if (
|
|
60
|
+
if (substitutionMatchesMetavariableNodeA) {
|
|
63
61
|
return true;
|
|
64
62
|
}
|
|
65
63
|
}) || null;
|
|
@@ -73,9 +71,9 @@ export default class MetastatementForMetavariableNodesVerifier extends NodesVeri
|
|
|
73
71
|
const { createSubstitutions } = this.constructor;
|
|
74
72
|
|
|
75
73
|
if (createSubstitutions) {
|
|
76
|
-
const
|
|
74
|
+
const metavariableNode = metavariableNodeA, ///
|
|
77
75
|
metastatementNode = metastatementNodeB, ///
|
|
78
|
-
metastatementForMetavariableSubstitution = MetastatementForMetavariableSubstitution.
|
|
76
|
+
metastatementForMetavariableSubstitution = MetastatementForMetavariableSubstitution.fromMetavariableNodeAndMetastatementNode(metavariableNode, metastatementNode),
|
|
79
77
|
substitution = metastatementForMetavariableSubstitution; ///
|
|
80
78
|
|
|
81
79
|
substitutions.push(substitution);
|
|
@@ -4,7 +4,6 @@ import NodesVerifier from "../../verifier/nodes";
|
|
|
4
4
|
import StatementForMetavariableSubstitution from "../../substitution/statementForMetavariable";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../../utilities/query";
|
|
7
|
-
import { metavariableNameFromMetavariableNode } from "../../utilities/query";
|
|
8
7
|
import { STATEMENT_RULE_NAME, METASTATEMENT_RULE_NAME, META_ARGUMENT_RULE_NAME } from "../../ruleNames";
|
|
9
8
|
|
|
10
9
|
const metavariableNodeQuery = nodeQuery('/metastatement/metavariable!'),
|
|
@@ -71,11 +70,10 @@ export default class StatementForMetavariableNodesVerifier extends NodesVerifier
|
|
|
71
70
|
verifyMetavariableNode(metavariableNodeA, statementNodeB, substitutions, fileContextA, localContext) {
|
|
72
71
|
let metavariableNodeVerified;
|
|
73
72
|
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
const metavariableName = substitution.getMetavariableName();
|
|
73
|
+
const substitution = substitutions.find((substitution) => {
|
|
74
|
+
const substitutionMatchesMetavariableNodeA = substitution.matchMetavariableNode(metavariableNodeA);
|
|
77
75
|
|
|
78
|
-
if (
|
|
76
|
+
if (substitutionMatchesMetavariableNodeA) {
|
|
79
77
|
return true;
|
|
80
78
|
}
|
|
81
79
|
}) || null;
|
|
@@ -89,9 +87,9 @@ export default class StatementForMetavariableNodesVerifier extends NodesVerifier
|
|
|
89
87
|
const { createSubstitutions } = this.constructor;
|
|
90
88
|
|
|
91
89
|
if (createSubstitutions) {
|
|
92
|
-
const
|
|
90
|
+
const metavariableNode = metavariableNodeA, ///
|
|
93
91
|
statementNode = statementNodeB, ///
|
|
94
|
-
statementForMetavariableSubstitution = StatementForMetavariableSubstitution.
|
|
92
|
+
statementForMetavariableSubstitution = StatementForMetavariableSubstitution.fromMetavariableNodeAndStatementNode(metavariableNode, statementNode),
|
|
95
93
|
substitution = statementForMetavariableSubstitution; ///
|
|
96
94
|
|
|
97
95
|
substitutions.push(substitution);
|
|
@@ -7,7 +7,6 @@ import TermForVariableSubstitution from "../../substitution/termForVariable";
|
|
|
7
7
|
import { first } from "../../utilities/array";
|
|
8
8
|
import { nodeQuery } from "../../utilities/query";
|
|
9
9
|
import { TERM_RULE_NAME } from "../../ruleNames";
|
|
10
|
-
import { variableNameFromVariableNode } from "../../utilities/query";
|
|
11
10
|
|
|
12
11
|
const variableNodeQuery = nodeQuery('/term/variable!');
|
|
13
12
|
|
|
@@ -57,11 +56,10 @@ export default class TermForVariableNodesVerifier extends NodesVerifier {
|
|
|
57
56
|
verifyVariableNode(variableNodeA, termNodeB, substitutions, localContextA, localContextB, verifyAhead) {
|
|
58
57
|
let variableVerified = false;
|
|
59
58
|
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
const variableName = substitution.getVariableName();
|
|
59
|
+
const substitution = substitutions.find((substitution) => {
|
|
60
|
+
const substitutionMatchesVariableNodeA = substitution.matchVariableNode(variableNodeA);
|
|
63
61
|
|
|
64
|
-
if (
|
|
62
|
+
if (substitutionMatchesVariableNodeA) {
|
|
65
63
|
return true;
|
|
66
64
|
}
|
|
67
65
|
}) || null;
|
|
@@ -79,9 +77,9 @@ export default class TermForVariableNodesVerifier extends NodesVerifier {
|
|
|
79
77
|
const { createSubstitutions } = this.constructor;
|
|
80
78
|
|
|
81
79
|
if (createSubstitutions) {
|
|
82
|
-
const
|
|
80
|
+
const variableNode = variableNodeA, ///
|
|
83
81
|
localContext = localContextA, ///
|
|
84
|
-
variable = localContext.
|
|
82
|
+
variable = localContext.findVariableByVariableNode(variableNode);
|
|
85
83
|
|
|
86
84
|
if (variable !== null) {
|
|
87
85
|
const terms = [],
|
|
@@ -97,7 +95,7 @@ export default class TermForVariableNodesVerifier extends NodesVerifier {
|
|
|
97
95
|
variableTypeEqualToOrSuperTypeOfTermType = variableType.isEqualToOrSuperTypeOf(termType);
|
|
98
96
|
|
|
99
97
|
if (variableTypeEqualToOrSuperTypeOfTermType) {
|
|
100
|
-
const termForVariableSubstitution = TermForVariableSubstitution.
|
|
98
|
+
const termForVariableSubstitution = TermForVariableSubstitution.fromVariableNodeAndTermNode(variableNode, termNode),
|
|
101
99
|
substitution = termForVariableSubstitution; ///
|
|
102
100
|
|
|
103
101
|
substitutions.push(substitution);
|
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 verifySupposition from "
|
|
5
|
+
import verifySupposition from "../verify/supposition";
|
|
6
6
|
import verifyQualifiedStatement from "../verify/statement/qualified";
|
|
7
7
|
import verifyUnqualifiedStatement from "../verify/statement/unqualified";
|
|
8
8
|
|
package/src/verify/equality.js
CHANGED
|
@@ -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);
|
|
@@ -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),
|
package/src/verify/file.js
CHANGED
|
@@ -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,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,7 +2,7 @@
|
|
|
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
|
|
|
@@ -30,8 +30,12 @@ export default function verifySupposition(suppositionNode, suppositions, localCo
|
|
|
30
30
|
|
|
31
31
|
localContext.addProofStep(proofStep);
|
|
32
32
|
|
|
33
|
-
assignments.
|
|
34
|
-
assignment.assign(localContext);
|
|
33
|
+
assignments.every((assignment) => {
|
|
34
|
+
const assigned = assignment.assign(localContext);
|
|
35
|
+
|
|
36
|
+
if (assigned) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
35
39
|
});
|
|
36
40
|
|
|
37
41
|
suppositionVerified = true;
|
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,13 +67,12 @@ 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 variablePresent = context.isVariablePresentByVariableNode(variableNode);
|
|
72
71
|
|
|
73
72
|
if (variablePresent) {
|
|
74
73
|
let verifiedAhead;
|
|
75
74
|
|
|
76
|
-
const variable = context.
|
|
75
|
+
const variable = context.findVariableByVariableNode(variableNode);
|
|
77
76
|
|
|
78
77
|
variables.push(variable);
|
|
79
78
|
|
|
@@ -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 verifySupposition from "
|
|
7
|
+
import verifyConsequent from "../verify/consequent";
|
|
8
|
+
import verifySupposition from "../verify/supposition";
|
|
9
9
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
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);
|