occam-verify-cli 0.0.1068 → 0.0.1069
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/bin/action/verify.js +3 -2
- package/lib/assertion/subproof.js +3 -3
- package/lib/axiom.js +11 -6
- package/lib/combinator.js +9 -9
- package/lib/conclusion.js +10 -7
- package/lib/conjecture.js +11 -6
- package/lib/consequent.js +10 -7
- package/lib/constructor.js +9 -9
- package/lib/context/file.js +34 -126
- package/lib/context/local.js +16 -5
- package/lib/context/release.js +2 -3
- package/lib/declaration.js +50 -43
- package/lib/equivalence.js +2 -2
- package/lib/frame.js +100 -80
- package/lib/index.js +22 -6
- package/lib/judgement.js +3 -3
- package/lib/label.js +12 -8
- package/lib/lemma.js +12 -12
- package/lib/metaLemma.js +120 -8
- package/lib/metatheorem.js +145 -9
- package/lib/metavariable.js +39 -22
- package/lib/mixins/statement/qualified/unify.js +6 -10
- package/lib/mixins/statement/unify.js +3 -3
- package/lib/mixins/term/unify.js +2 -2
- package/lib/premise.js +12 -8
- package/lib/reference.js +7 -9
- package/lib/rule.js +24 -39
- package/lib/ruleNames.js +1 -5
- package/lib/statement/unqualified.js +9 -8
- package/lib/statement.js +4 -4
- package/lib/substitution/frameForMetavariable.js +30 -26
- package/lib/substitution/statementForMetavariable.js +44 -26
- package/lib/substitution/termForVariable.js +33 -37
- package/lib/substitution.js +24 -21
- package/lib/substitutions.js +7 -1
- package/lib/supposition.js +12 -8
- package/lib/term.js +6 -11
- package/lib/theorem.js +11 -6
- package/lib/topLevelAssertion.js +24 -42
- package/lib/type.js +5 -12
- package/lib/unifier/metaLevel.js +3 -3
- package/lib/unifier/metavariable.js +6 -6
- package/lib/unifier/statementWithCombinator.js +16 -16
- package/lib/unifier/termWithConstructor.js +7 -7
- package/lib/utilities/brackets.js +10 -10
- package/lib/utilities/json.js +493 -0
- package/lib/utilities/node.js +15 -22
- package/lib/utilities/release.js +53 -0
- package/lib/utilities/releaseContext.js +4 -15
- package/lib/utilities/tokens.js +7 -7
- package/lib/variable.js +6 -11
- package/lib/verifier/topLevel.js +5 -5
- package/package.json +1 -1
- package/src/assertion/subproof.js +2 -3
- package/src/axiom.js +14 -6
- package/src/combinator.js +12 -13
- package/src/conclusion.js +12 -9
- package/src/conjecture.js +14 -6
- package/src/consequent.js +12 -9
- package/src/constructor.js +11 -13
- package/src/context/file.js +94 -202
- package/src/context/local.js +8 -6
- package/src/context/release.js +2 -3
- package/src/declaration.js +72 -44
- package/src/equivalence.js +2 -2
- package/src/frame.js +111 -86
- package/src/index.js +17 -1
- package/src/judgement.js +2 -2
- package/src/label.js +15 -10
- package/src/lemma.js +17 -10
- package/src/metaLemma.js +102 -1
- package/src/metatheorem.js +143 -2
- package/src/metavariable.js +50 -30
- package/src/mixins/statement/qualified/unify.js +7 -19
- package/src/mixins/statement/unify.js +2 -2
- package/src/mixins/term/unify.js +1 -1
- package/src/premise.js +18 -10
- package/src/reference.js +7 -11
- package/src/rule.js +33 -57
- package/src/ruleNames.js +0 -1
- package/src/statement/unqualified.js +10 -10
- package/src/statement.js +3 -2
- package/src/substitution/frameForMetavariable.js +39 -33
- package/src/substitution/statementForMetavariable.js +64 -31
- package/src/substitution/termForVariable.js +47 -37
- package/src/substitution.js +18 -16
- package/src/substitutions.js +2 -0
- package/src/supposition.js +18 -10
- package/src/term.js +5 -15
- package/src/theorem.js +14 -6
- package/src/topLevelAssertion.js +38 -64
- package/src/type.js +5 -20
- package/src/unifier/metaLevel.js +2 -2
- package/src/unifier/metavariable.js +5 -5
- package/src/unifier/statementWithCombinator.js +18 -18
- package/src/unifier/termWithConstructor.js +7 -7
- package/src/utilities/brackets.js +5 -5
- package/src/utilities/json.js +551 -0
- package/src/utilities/node.js +15 -26
- package/src/{verify → utilities}/release.js +5 -1
- package/src/utilities/releaseContext.js +2 -2
- package/src/utilities/tokens.js +10 -7
- package/src/variable.js +4 -14
- package/src/verifier/topLevel.js +6 -4
- package/lib/argument.js +0 -106
- package/lib/metaTypes.js +0 -19
- package/lib/unify/statementWithSttaemetnGivenEquivalences.js +0 -45
- package/lib/verify/metaLemma.js +0 -49
- package/lib/verify/metatheorem.js +0 -48
- package/lib/verify/release.js +0 -50
- package/src/argument.js +0 -79
- package/src/metaTypes.js +0 -11
- package/src/unify/statementWithSttaemetnGivenEquivalences.js +0 -51
- package/src/verify/metaLemma.js +0 -72
- package/src/verify/metatheorem.js +0 -67
package/src/theorem.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import shim from "./shim";
|
|
3
4
|
import Label from "./label";
|
|
4
5
|
import Proof from "./proof";
|
|
5
6
|
import Consequent from "./consequent";
|
|
@@ -8,21 +9,21 @@ import LocalContext from "./context/local";
|
|
|
8
9
|
import Substitutions from "./substitutions";
|
|
9
10
|
import TopLevelAssertion from "./topLevelAssertion";
|
|
10
11
|
|
|
12
|
+
import { stringFromLabels } from "./topLevelAssertion";
|
|
11
13
|
import { nodeQuery, nodesQuery } from "./utilities/query";
|
|
12
|
-
import { labelsStringFromLabels } from "./topLevelAssertion";
|
|
13
14
|
|
|
14
15
|
const proofNodeQuery = nodeQuery("/theorem/proof"),
|
|
15
16
|
labelNodesQuery = nodesQuery("/theorem/label"),
|
|
16
17
|
consequentNodeQuery = nodeQuery("/theorem/consequent"),
|
|
17
18
|
suppositionNodesQuery = nodesQuery("/theorem/supposition");
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
class Theorem extends TopLevelAssertion {
|
|
20
21
|
verify() {
|
|
21
22
|
let verified = false;
|
|
22
23
|
|
|
23
|
-
const
|
|
24
|
+
const theoremString = this.string; ///
|
|
24
25
|
|
|
25
|
-
this.fileContext.trace(`Verifying the '${
|
|
26
|
+
this.fileContext.trace(`Verifying the '${theoremString}' theorem...`);
|
|
26
27
|
|
|
27
28
|
const labelsVerifiedAtTopLevel = this.labels.every((label) => {
|
|
28
29
|
const labelVVerifiedAtTopLevel = label.verifyAtTopLevel(this.fileContext);
|
|
@@ -61,7 +62,7 @@ export default class Theorem extends TopLevelAssertion {
|
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
if (verified) {
|
|
64
|
-
this.fileContext.debug(`...verified the '${
|
|
65
|
+
this.fileContext.debug(`...verified the '${theoremString}' theorem.`);
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
return verified;
|
|
@@ -85,9 +86,16 @@ export default class Theorem extends TopLevelAssertion {
|
|
|
85
86
|
return supposition;
|
|
86
87
|
}),
|
|
87
88
|
consequent = Consequent.fromConsequentNode(consequentNode, fileContext),
|
|
89
|
+
string = stringFromLabels(labels),
|
|
88
90
|
proof = Proof.fromProofNode(proofNode, fileContext),
|
|
89
|
-
theorem = new Theorem(fileContext, labels, suppositions, consequent, proof);
|
|
91
|
+
theorem = new Theorem(fileContext, string, labels, suppositions, consequent, proof);
|
|
90
92
|
|
|
91
93
|
return theorem;
|
|
92
94
|
}
|
|
93
95
|
}
|
|
96
|
+
|
|
97
|
+
Object.assign(shim, {
|
|
98
|
+
Theorem
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
export default Theorem;
|
package/src/topLevelAssertion.js
CHANGED
|
@@ -2,16 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
import Label from "./label";
|
|
6
|
-
import Consequent from "./consequent";
|
|
7
|
-
import Supposition from "./supposition";
|
|
8
5
|
import Substitutions from "./substitutions";
|
|
9
6
|
|
|
7
|
+
import { EMPTY_STRING } from "./constants";
|
|
8
|
+
import { labelsFromJSON,
|
|
9
|
+
labelsToLabelsJSON,
|
|
10
|
+
consequentFromJSON,
|
|
11
|
+
suppositionsFromJSON,
|
|
12
|
+
consequentToConsequentJSON,
|
|
13
|
+
suppositionsToSuppositionsJSON } from "./utilities/json";
|
|
14
|
+
|
|
10
15
|
const { reverse, correlate } = arrayUtilities;
|
|
11
16
|
|
|
12
17
|
export default class TopLevelAssertion {
|
|
13
|
-
constructor(fileContext, labels, suppositions, consequent, proof) {
|
|
18
|
+
constructor(fileContext, string, labels, suppositions, consequent, proof) {
|
|
14
19
|
this.fileContext = fileContext;
|
|
20
|
+
this.string = string;
|
|
15
21
|
this.labels = labels;
|
|
16
22
|
this.suppositions = suppositions;
|
|
17
23
|
this.consequent = consequent;
|
|
@@ -22,6 +28,10 @@ export default class TopLevelAssertion {
|
|
|
22
28
|
return this.fileContext;
|
|
23
29
|
}
|
|
24
30
|
|
|
31
|
+
getString() {
|
|
32
|
+
return this.string;
|
|
33
|
+
}
|
|
34
|
+
|
|
25
35
|
getLabels() {
|
|
26
36
|
return this.labels;
|
|
27
37
|
}
|
|
@@ -85,80 +95,44 @@ export default class TopLevelAssertion {
|
|
|
85
95
|
}
|
|
86
96
|
|
|
87
97
|
toJSON() {
|
|
88
|
-
const labelsJSON = this.labels
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return labelJSON;
|
|
92
|
-
}),
|
|
93
|
-
suppositionsJSON = this.suppositions.map((supposition) => {
|
|
94
|
-
const suppositionJSON = supposition.toJSON();
|
|
95
|
-
|
|
96
|
-
return suppositionJSON;
|
|
97
|
-
}),
|
|
98
|
-
consequentJSON = this.consequent.toJSON(),
|
|
98
|
+
const labelsJSON = labelsToLabelsJSON(this.labels),
|
|
99
|
+
consequentJSON = consequentToConsequentJSON(this.consequent),
|
|
100
|
+
suppositionsJSON = suppositionsToSuppositionsJSON(this.suppositions),
|
|
99
101
|
labels = labelsJSON, ///
|
|
100
|
-
suppositions = suppositionsJSON, ///
|
|
101
102
|
consequent = consequentJSON, ///
|
|
103
|
+
suppositions = suppositionsJSON, ///
|
|
102
104
|
json = {
|
|
103
105
|
labels,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
consequent,
|
|
107
|
+
suppositions
|
|
106
108
|
};
|
|
107
109
|
|
|
108
110
|
return json;
|
|
109
111
|
}
|
|
110
112
|
|
|
111
113
|
static fromJSON(Class, json, fileContext) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
label = Label.fromJSON(json, fileContext);
|
|
121
|
-
|
|
122
|
-
return label;
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
let { suppositions } = json;
|
|
126
|
-
|
|
127
|
-
const suppositionsJSON = suppositions; ///
|
|
128
|
-
|
|
129
|
-
suppositions = suppositionsJSON.map((suppositionJSON) => {
|
|
130
|
-
const json = suppositionJSON, ///
|
|
131
|
-
supposition = Supposition.fromJSON(json, fileContext);
|
|
132
|
-
|
|
133
|
-
return supposition;
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
let { consequent } = json;
|
|
137
|
-
|
|
138
|
-
const consequentJSON = consequent; ///
|
|
139
|
-
|
|
140
|
-
json = consequentJSON; ///
|
|
141
|
-
|
|
142
|
-
consequent = Consequent.fromJSON(json, fileContext);
|
|
143
|
-
|
|
144
|
-
const proof = null;
|
|
145
|
-
|
|
146
|
-
rule = new Class(fileContext, labels, suppositions, consequent, proof);
|
|
147
|
-
|
|
148
|
-
return rule;
|
|
114
|
+
const labels = labelsFromJSON(json, fileContext),
|
|
115
|
+
consequent = consequentFromJSON(json, fileContext),
|
|
116
|
+
suppositions = suppositionsFromJSON(json, fileContext),
|
|
117
|
+
string = stringFromLabels(labels),
|
|
118
|
+
proof = null,
|
|
119
|
+
topLevelAssertion = new Class(fileContext, string, labels, suppositions, consequent, proof);
|
|
120
|
+
|
|
121
|
+
return topLevelAssertion;
|
|
149
122
|
}
|
|
150
123
|
}
|
|
151
124
|
|
|
152
|
-
export function
|
|
153
|
-
const
|
|
125
|
+
export function stringFromLabels(labels) {
|
|
126
|
+
const string = labels.reduce((string, label) => {
|
|
154
127
|
const labelString = label.getString();
|
|
155
128
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
129
|
+
string = (string === EMPTY_STRING) ?
|
|
130
|
+
labelString: ///
|
|
131
|
+
`${labelString}, ${labelString}`;
|
|
132
|
+
|
|
133
|
+
return string;
|
|
134
|
+
}, EMPTY_STRING);
|
|
159
135
|
|
|
160
|
-
|
|
161
|
-
|
|
136
|
+
return string;
|
|
137
|
+
}
|
|
162
138
|
|
|
163
|
-
return labelsString;
|
|
164
|
-
}
|
package/src/type.js
CHANGED
|
@@ -5,6 +5,7 @@ import shim from "./shim";
|
|
|
5
5
|
import { nodeQuery } from "./utilities/query";
|
|
6
6
|
import { OBJECT_TYPE_NAME } from "./typeNames";
|
|
7
7
|
import { typeNameFromTypeNode } from "./utilities/name";
|
|
8
|
+
import { superTypeFromJSON, superTypeToSuperTypeJSON } from "./utilities/json";
|
|
8
9
|
|
|
9
10
|
const typeNodeQuery = nodeQuery("/typeDeclaration/type[0]"),
|
|
10
11
|
superTypeNodeQuery = nodeQuery("/typeDeclaration/type[1]");
|
|
@@ -155,9 +156,9 @@ class Type {
|
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
toJSON() {
|
|
158
|
-
const superTypeJSON = this.superType
|
|
159
|
-
name = this.name,
|
|
159
|
+
const superTypeJSON = superTypeToSuperTypeJSON(this.superType),
|
|
160
160
|
superType = superTypeJSON, ///
|
|
161
|
+
name = this.name,
|
|
161
162
|
json = {
|
|
162
163
|
name,
|
|
163
164
|
superType
|
|
@@ -229,8 +230,8 @@ export default Type;
|
|
|
229
230
|
|
|
230
231
|
class ObjectType extends Type {
|
|
231
232
|
toJSON() {
|
|
232
|
-
const
|
|
233
|
-
|
|
233
|
+
const superType = null,
|
|
234
|
+
name = this.name,
|
|
234
235
|
json = {
|
|
235
236
|
name,
|
|
236
237
|
superType
|
|
@@ -250,19 +251,3 @@ class ObjectType extends Type {
|
|
|
250
251
|
}
|
|
251
252
|
|
|
252
253
|
export const objectType = ObjectType.fromNothing();
|
|
253
|
-
|
|
254
|
-
function superTypeFromJSON(json, fileContext) {
|
|
255
|
-
let { superType } = json;
|
|
256
|
-
|
|
257
|
-
const superTypeJSON = superType; ///
|
|
258
|
-
|
|
259
|
-
json = superTypeJSON; ///
|
|
260
|
-
|
|
261
|
-
const { name } = json,
|
|
262
|
-
typeName = name, ///
|
|
263
|
-
type = fileContext.findTypeByTypeName(typeName);
|
|
264
|
-
|
|
265
|
-
superType = type; ///
|
|
266
|
-
|
|
267
|
-
return superType;
|
|
268
|
-
}
|
package/src/unifier/metaLevel.js
CHANGED
|
@@ -82,7 +82,7 @@ class MetaLevelUnifier extends Unifier {
|
|
|
82
82
|
|
|
83
83
|
const metavariableNode = frameMetavariableNodeA, ///
|
|
84
84
|
metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
|
|
85
|
-
metavariablePresent = localContextA.
|
|
85
|
+
metavariablePresent = localContextA.isMetavariablePresentByMetavariableName(metavariableName);
|
|
86
86
|
|
|
87
87
|
if (metavariablePresent) {
|
|
88
88
|
const { Frame, Metavariable } = shim,
|
|
@@ -107,7 +107,7 @@ class MetaLevelUnifier extends Unifier {
|
|
|
107
107
|
variableName = variableNameFromVariableNode(variableNode),
|
|
108
108
|
variablePresent = localContextA.isVariablePresentByVariableName(variableName);
|
|
109
109
|
|
|
110
|
-
if (variablePresent
|
|
110
|
+
if (variablePresent) {
|
|
111
111
|
const { Term, Variable } = shim,
|
|
112
112
|
localContext = localContextB, ///
|
|
113
113
|
termNode = termNodeB, ///
|
|
@@ -24,18 +24,18 @@ class MetavariableUnifier extends Unifier {
|
|
|
24
24
|
|
|
25
25
|
static maps = [
|
|
26
26
|
{
|
|
27
|
-
nodeQueryA:
|
|
28
|
-
nodeQueryB:
|
|
29
|
-
unify: (
|
|
27
|
+
nodeQueryA: typeNodeQuery,
|
|
28
|
+
nodeQueryB: termNodeQuery,
|
|
29
|
+
unify: (typeNodeA, termNodeB, localContext) => {
|
|
30
30
|
let unified = false;
|
|
31
31
|
|
|
32
32
|
const { Term } = shim,
|
|
33
|
-
typeNode =
|
|
33
|
+
typeNode = typeNodeA, ///
|
|
34
34
|
typeName = typeNameFromTypeNode(typeNode),
|
|
35
35
|
type = localContext.findTypeByTypeName(typeName);
|
|
36
36
|
|
|
37
37
|
if (type !== null) {
|
|
38
|
-
const termNode =
|
|
38
|
+
const termNode = termNodeB, ///
|
|
39
39
|
term = Term.fromTermNode(termNode, localContext),
|
|
40
40
|
termVerifiedGivenType = term.verifyGivenType(type, localContext);
|
|
41
41
|
|
|
@@ -13,11 +13,11 @@ const termNodeQuery = nodeQuery("/term!"),
|
|
|
13
13
|
statementNodeQuery = nodeQuery("/statement!");
|
|
14
14
|
|
|
15
15
|
class StatementWithCombinatorUnifier extends Unifier {
|
|
16
|
-
unify(
|
|
16
|
+
unify(combinatorStatementNode, statementNode, assignments, stated, localContext) {
|
|
17
17
|
let statementUnifiedWithCombinator;
|
|
18
18
|
|
|
19
|
-
const nonTerminalNodeA =
|
|
20
|
-
nonTerminalNodeB =
|
|
19
|
+
const nonTerminalNodeA = combinatorStatementNode, ///
|
|
20
|
+
nonTerminalNodeB = statementNode, ///
|
|
21
21
|
nonTerminalNodeUnified = this.unifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, assignments, stated, localContext);
|
|
22
22
|
|
|
23
23
|
statementUnifiedWithCombinator = nonTerminalNodeUnified; ///
|
|
@@ -27,14 +27,14 @@ class StatementWithCombinatorUnifier extends Unifier {
|
|
|
27
27
|
|
|
28
28
|
static maps = [
|
|
29
29
|
{
|
|
30
|
-
nodeQueryA:
|
|
31
|
-
nodeQueryB:
|
|
32
|
-
unify: (
|
|
30
|
+
nodeQueryA: metaTypeNodeQuery,
|
|
31
|
+
nodeQueryB: statementNodeQuery,
|
|
32
|
+
unify: (metaTypeNodeA, statementNodeB, assignments, stated, localContext) => {
|
|
33
33
|
let unified;
|
|
34
34
|
|
|
35
35
|
const { Statement, MetaType } = shim,
|
|
36
|
-
metaTypeNode =
|
|
37
|
-
statementNode =
|
|
36
|
+
metaTypeNode = metaTypeNodeA, ///
|
|
37
|
+
statementNode = statementNodeB, ///
|
|
38
38
|
metaType = MetaType.fromMetaTypeNode(metaTypeNode, localContext),
|
|
39
39
|
statement = Statement.fromStatementNode(statementNode, localContext),
|
|
40
40
|
statementVerifiedGivenType = statement.verifyGivenMetaType(metaType, assignments, stated, localContext);
|
|
@@ -45,14 +45,14 @@ class StatementWithCombinatorUnifier extends Unifier {
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
|
-
nodeQueryA:
|
|
49
|
-
nodeQueryB:
|
|
50
|
-
unify: (
|
|
48
|
+
nodeQueryA: metaTypeNodeQuery,
|
|
49
|
+
nodeQueryB: frameNodeQuery,
|
|
50
|
+
unify: (metaTypeNodeA, frameNodeB, assignments, stated, localContext) => {
|
|
51
51
|
let unified;
|
|
52
52
|
|
|
53
53
|
const { Frame, MetaType } = shim,
|
|
54
|
-
metaTypeNode =
|
|
55
|
-
frameNode =
|
|
54
|
+
metaTypeNode = metaTypeNodeA, ///
|
|
55
|
+
frameNode = frameNodeB, ///
|
|
56
56
|
metaType = MetaType.fromMetaTypeNode(metaTypeNode, localContext),
|
|
57
57
|
frame = Frame.fromFrameNode(frameNode, localContext),
|
|
58
58
|
frameVerifiedGivenType = frame.verifyGivenMetaType(metaType, assignments, stated, localContext);
|
|
@@ -63,18 +63,18 @@ class StatementWithCombinatorUnifier extends Unifier {
|
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
|
-
nodeQueryA:
|
|
67
|
-
nodeQueryB:
|
|
68
|
-
unify: (
|
|
66
|
+
nodeQueryA: typeNodeQuery,
|
|
67
|
+
nodeQueryB: termNodeQuery,
|
|
68
|
+
unify: (typeNodeA, termNodeB, assignments, stated, localContext) => {
|
|
69
69
|
let unified = false;
|
|
70
70
|
|
|
71
71
|
const { Term } = shim,
|
|
72
|
-
typeNode =
|
|
72
|
+
typeNode = typeNodeA, ///
|
|
73
73
|
typeName = typeNameFromTypeNode(typeNode),
|
|
74
74
|
type = localContext.findTypeByTypeName(typeName);
|
|
75
75
|
|
|
76
76
|
if (type !== null) {
|
|
77
|
-
const termNode =
|
|
77
|
+
const termNode = termNodeB, ///
|
|
78
78
|
term = Term.fromTermNode(termNode, localContext),
|
|
79
79
|
termVerifiedGivenType = term.verifyGivenType(type, localContext);
|
|
80
80
|
|
|
@@ -10,11 +10,11 @@ const termNodeQuery = nodeQuery("/term"),
|
|
|
10
10
|
typeNodeQuery = nodeQuery("/type");
|
|
11
11
|
|
|
12
12
|
class TermWithConstructorUnifier extends Unifier {
|
|
13
|
-
unify(
|
|
13
|
+
unify(constructorTermNode, termNode, localContext) {
|
|
14
14
|
let termUnifiedWithConstructor;
|
|
15
15
|
|
|
16
|
-
const nonTerminalNodeA =
|
|
17
|
-
nonTerminalNodeB =
|
|
16
|
+
const nonTerminalNodeA = constructorTermNode, ///
|
|
17
|
+
nonTerminalNodeB = termNode, ///
|
|
18
18
|
nonTerminalNodeUnified = this.unifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, localContext);
|
|
19
19
|
|
|
20
20
|
termUnifiedWithConstructor = nonTerminalNodeUnified; ///
|
|
@@ -24,9 +24,9 @@ class TermWithConstructorUnifier extends Unifier {
|
|
|
24
24
|
|
|
25
25
|
static maps = [
|
|
26
26
|
{
|
|
27
|
-
nodeQueryA:
|
|
28
|
-
nodeQueryB:
|
|
29
|
-
unify: (
|
|
27
|
+
nodeQueryA: typeNodeQuery,
|
|
28
|
+
nodeQueryB: termNodeQuery,
|
|
29
|
+
unify: (typeNodeB, termNodeB, localContext) => {
|
|
30
30
|
let unified = false;
|
|
31
31
|
|
|
32
32
|
const { Term } = shim,
|
|
@@ -35,7 +35,7 @@ class TermWithConstructorUnifier extends Unifier {
|
|
|
35
35
|
type = localContext.findTypeByTypeName(typeName);
|
|
36
36
|
|
|
37
37
|
if (type !== null) {
|
|
38
|
-
const termNode =
|
|
38
|
+
const termNode = termNodeB, ///
|
|
39
39
|
term = Term.fromTermNode(termNode, localContext),
|
|
40
40
|
termVerifiedGivenType = term.verifyGivenType(type, localContext);
|
|
41
41
|
|
|
@@ -8,17 +8,17 @@ import { BRACKETED_TERM_DEPTH, BRACKETED_STATEMENT_DEPTH } from "../constants";
|
|
|
8
8
|
const bracketedTermChildNodeQuery = nodeQuery("/term/argument/term!"),
|
|
9
9
|
bracketedStatementChildNodeQuery = nodeQuery("/statement/metaArgument/statement!");
|
|
10
10
|
|
|
11
|
-
export function
|
|
12
|
-
const bracketedTermChildNode = bracketedTermChildNodeFromTermNode(
|
|
11
|
+
export function stripBracketsFromTermNode(termNode) {
|
|
12
|
+
const bracketedTermChildNode = bracketedTermChildNodeFromTermNode(termNode);
|
|
13
13
|
|
|
14
14
|
if (bracketedTermChildNode !== null) {
|
|
15
|
-
|
|
15
|
+
termNode = bracketedTermChildNode; ///
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
return
|
|
18
|
+
return termNode;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export function
|
|
21
|
+
export function stripBracketsFromStatementNode(statementNode) {
|
|
22
22
|
const bracketedStatementChildNode = bracketedStatementChildNodeFromStatementNode(statementNode);
|
|
23
23
|
|
|
24
24
|
if (bracketedStatementChildNode !== null) {
|