occam-verify-cli 1.0.220 → 1.0.224
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/context/file.js +19 -19
- package/lib/context/local.js +5 -43
- package/lib/context/release.js +11 -11
- package/lib/dom/assertion/contained.js +44 -44
- package/lib/dom/assertion/defined.js +40 -40
- package/lib/dom/assertion/property.js +37 -35
- package/lib/dom/assertion/satisfies.js +26 -25
- package/lib/dom/assertion/subproof.js +16 -16
- package/lib/dom/assertion/type.js +34 -32
- package/lib/dom/axiom.js +52 -52
- package/lib/dom/combinator/bracketed.js +5 -5
- package/lib/dom/combinator.js +6 -6
- package/lib/dom/conclusion.js +10 -10
- package/lib/dom/conjecture.js +5 -5
- package/lib/dom/constructor/bracketed.js +12 -12
- package/lib/dom/constructor.js +9 -9
- package/lib/dom/declaration/combinator.js +11 -11
- package/lib/dom/declaration/complexType.js +133 -63
- package/lib/dom/declaration/constructor.js +17 -17
- package/lib/dom/declaration/metavariable.js +17 -17
- package/lib/dom/declaration/simpleType.js +229 -0
- package/lib/dom/declaration/variable.js +17 -17
- package/lib/dom/declaration.js +54 -52
- package/lib/dom/deduction.js +15 -15
- package/lib/dom/derivation.js +8 -8
- package/lib/dom/equality.js +49 -34
- package/lib/dom/error.js +3 -3
- package/lib/dom/frame.js +38 -38
- package/lib/dom/judgement.js +31 -29
- package/lib/dom/label.js +5 -5
- package/lib/dom/lemma.js +5 -5
- package/lib/dom/metaLemma.js +5 -5
- package/lib/dom/metatheorem.js +5 -5
- package/lib/dom/metavariable.js +55 -55
- package/lib/dom/premise.js +36 -34
- package/lib/dom/procedureCall.js +9 -9
- package/lib/dom/proof.js +6 -6
- package/lib/dom/propertyRelation.js +18 -18
- package/lib/dom/reference.js +28 -28
- package/lib/dom/rule.js +63 -48
- package/lib/dom/signature.js +17 -17
- package/lib/dom/statement.js +36 -36
- package/lib/dom/step.js +32 -35
- package/lib/dom/subDerivation.js +8 -8
- package/lib/dom/subproof.js +27 -30
- package/lib/dom/substitution/statement.js +7 -7
- package/lib/dom/substitution/term.js +2 -16
- package/lib/dom/substitution.js +1 -15
- package/lib/dom/supposition.js +39 -39
- package/lib/dom/term.js +15 -15
- package/lib/dom/theorem.js +5 -5
- package/lib/dom/topLevelAssertion.js +60 -71
- package/lib/dom/topLevelMetaAssertion.js +28 -20
- package/lib/dom/type.js +18 -24
- package/lib/dom/variable.js +16 -16
- package/lib/equivalence.js +54 -33
- package/lib/equivalences.js +57 -101
- package/lib/index.js +2 -2
- package/lib/mixins/statement/verify.js +52 -52
- package/lib/mixins/step/unify.js +79 -61
- package/lib/mixins/term/verify.js +17 -17
- package/lib/substitutions.js +7 -7
- package/lib/unifier/equantional.js +170 -0
- package/lib/unifier/intrinsicLevel.js +8 -8
- package/lib/unifier/metaLevel.js +21 -21
- package/lib/unifier/metavariable.js +9 -9
- package/lib/unifier/statementWithCombinator.js +18 -18
- package/lib/unifier/termWithConstructor.js +10 -10
- package/lib/unifier.js +41 -41
- package/lib/utilities/brackets.js +2 -2
- package/lib/utilities/release.js +18 -17
- package/lib/utilities/subproof.js +2 -2
- package/lib/utilities/type.js +2 -2
- package/lib/utilities/unification.js +28 -34
- package/lib/verifier/combinator.js +14 -14
- package/lib/verifier/constructor.js +18 -18
- package/lib/verifier/topLevel.js +38 -38
- package/lib/verifier.js +30 -30
- package/package.json +1 -1
- package/src/context/file.js +18 -18
- package/src/context/local.js +5 -48
- package/src/context/release.js +11 -11
- package/src/dom/assertion/contained.js +46 -46
- package/src/dom/assertion/defined.js +41 -41
- package/src/dom/assertion/property.js +37 -35
- package/src/dom/assertion/satisfies.js +26 -25
- package/src/dom/assertion/subproof.js +15 -15
- package/src/dom/assertion/type.js +34 -32
- package/src/dom/axiom.js +56 -54
- package/src/dom/combinator/bracketed.js +4 -4
- package/src/dom/combinator.js +5 -5
- package/src/dom/conclusion.js +9 -9
- package/src/dom/conjecture.js +4 -4
- package/src/dom/constructor/bracketed.js +11 -11
- package/src/dom/constructor.js +8 -8
- package/src/dom/declaration/combinator.js +10 -10
- package/src/dom/declaration/complexType.js +129 -64
- package/src/dom/declaration/constructor.js +16 -16
- package/src/dom/declaration/metavariable.js +16 -16
- package/src/dom/declaration/simpleType.js +179 -0
- package/src/dom/declaration/variable.js +16 -16
- package/src/dom/declaration.js +54 -52
- package/src/dom/deduction.js +14 -14
- package/src/dom/derivation.js +7 -7
- package/src/dom/equality.js +55 -38
- package/src/dom/error.js +2 -2
- package/src/dom/frame.js +38 -38
- package/src/dom/judgement.js +31 -29
- package/src/dom/label.js +4 -4
- package/src/dom/lemma.js +4 -4
- package/src/dom/metaLemma.js +4 -4
- package/src/dom/metatheorem.js +4 -4
- package/src/dom/metavariable.js +54 -54
- package/src/dom/premise.js +35 -33
- package/src/dom/procedureCall.js +8 -8
- package/src/dom/proof.js +5 -5
- package/src/dom/propertyRelation.js +17 -17
- package/src/dom/reference.js +27 -27
- package/src/dom/rule.js +72 -49
- package/src/dom/signature.js +15 -15
- package/src/dom/statement.js +34 -34
- package/src/dom/step.js +42 -48
- package/src/dom/subDerivation.js +7 -7
- package/src/dom/subproof.js +30 -40
- package/src/dom/substitution/statement.js +6 -6
- package/src/dom/substitution/term.js +1 -19
- package/src/dom/substitution.js +0 -13
- package/src/dom/supposition.js +38 -38
- package/src/dom/term.js +14 -14
- package/src/dom/theorem.js +4 -4
- package/src/dom/topLevelAssertion.js +62 -81
- package/src/dom/topLevelMetaAssertion.js +35 -20
- package/src/dom/type.js +23 -33
- package/src/dom/variable.js +16 -15
- package/src/equivalence.js +69 -46
- package/src/equivalences.js +53 -115
- package/src/index.js +1 -1
- package/src/mixins/statement/verify.js +51 -51
- package/src/mixins/step/unify.js +88 -67
- package/src/mixins/term/verify.js +16 -16
- package/src/substitutions.js +5 -6
- package/src/unifier/equantional.js +90 -0
- package/src/unifier/intrinsicLevel.js +7 -7
- package/src/unifier/metaLevel.js +20 -21
- package/src/unifier/metavariable.js +8 -8
- package/src/unifier/statementWithCombinator.js +17 -17
- package/src/unifier/termWithConstructor.js +9 -9
- package/src/unifier.js +40 -40
- package/src/utilities/brackets.js +1 -1
- package/src/utilities/release.js +18 -18
- package/src/utilities/subproof.js +1 -1
- package/src/utilities/type.js +1 -1
- package/src/utilities/unification.js +27 -37
- package/src/verifier/combinator.js +13 -13
- package/src/verifier/constructor.js +17 -17
- package/src/verifier/topLevel.js +41 -41
- package/src/verifier.js +29 -29
- package/lib/dom/declaration/type.js +0 -209
- package/lib/unifier/equality.js +0 -155
- package/src/dom/declaration/type.js +0 -150
- package/src/unifier/equality.js +0 -70
|
@@ -24,32 +24,32 @@ export default domAssigned(class MetavariableDeclaration {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
verify() {
|
|
27
|
-
let
|
|
27
|
+
let verifies;
|
|
28
28
|
|
|
29
29
|
const metavariableDeclarationString = this.string; ///
|
|
30
30
|
|
|
31
31
|
this.fileContext.trace(`Verifying the '${metavariableDeclarationString}' metavariable declaration...`);
|
|
32
32
|
|
|
33
|
-
const
|
|
33
|
+
const metavariableVerifies = this.verifyMetavariable(this.metavariable);
|
|
34
34
|
|
|
35
|
-
if (
|
|
35
|
+
if (metavariableVerifies) {
|
|
36
36
|
this.fileContext.addMetavariable(this.metavariable);
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
verifies = true;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
if (
|
|
41
|
+
if (verifies) {
|
|
42
42
|
this.fileContext.debug(`...verified the '${metavariableDeclarationString}' metavariable declaration.`);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
return
|
|
45
|
+
return verifies;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
verifyType(type) {
|
|
49
|
-
let
|
|
49
|
+
let typeVerifies;
|
|
50
50
|
|
|
51
51
|
if (type === null) {
|
|
52
|
-
|
|
52
|
+
typeVerifies = true;
|
|
53
53
|
} else {
|
|
54
54
|
const typeName = type.getName(),
|
|
55
55
|
typeString = type.getString();
|
|
@@ -61,19 +61,19 @@ export default domAssigned(class MetavariableDeclaration {
|
|
|
61
61
|
if (!typePresent) {
|
|
62
62
|
this.fileContext.debug(`The '${typeString}' type is not present.`);
|
|
63
63
|
} else {
|
|
64
|
-
|
|
64
|
+
typeVerifies = true;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
if (
|
|
67
|
+
if (typeVerifies) {
|
|
68
68
|
this.fileContext.debug(`...verified the '${typeString}' type.`);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
return
|
|
72
|
+
return typeVerifies;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
verifyMetavariable(metavariable) {
|
|
76
|
-
let
|
|
76
|
+
let metavariableVerifies = false;
|
|
77
77
|
|
|
78
78
|
const metavariableString = metavariable.getString();
|
|
79
79
|
|
|
@@ -92,17 +92,17 @@ export default domAssigned(class MetavariableDeclaration {
|
|
|
92
92
|
this.fileContext.debug(`The '${metavariableName}' metavariable is already present.`);
|
|
93
93
|
} else {
|
|
94
94
|
const type = metavariable.getType(),
|
|
95
|
-
|
|
95
|
+
typeVerifies = this.verifyType(type);
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
metavariableVerifies = typeVerifies; ///
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
if (
|
|
101
|
+
if (metavariableVerifies) {
|
|
102
102
|
this.fileContext.debug(`...verified the '${metavariableString}' metavariable when declared.`);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
return
|
|
105
|
+
return metavariableVerifies;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
static name = "MetavariableDeclaration";
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import dom from "../../dom";
|
|
4
|
+
|
|
5
|
+
import { objectType } from "../type";
|
|
6
|
+
import { domAssigned } from "../../dom";
|
|
7
|
+
import { stringFromTypeNameNameAndSuperTypes } from "../../utilities/type";
|
|
8
|
+
|
|
9
|
+
export default domAssigned(class SimpleTypeDeclaration {
|
|
10
|
+
constructor(fileContext, string, type) {
|
|
11
|
+
this.fileContext = fileContext;
|
|
12
|
+
this.string = string;
|
|
13
|
+
this.type = type;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
getFileContext() {
|
|
17
|
+
return this.fileContext;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getString() {
|
|
21
|
+
return this.string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
getType() {
|
|
25
|
+
return this.type;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
verify() {
|
|
29
|
+
let verifies = false;
|
|
30
|
+
|
|
31
|
+
const typeDeclarationString = this.getString(); ///
|
|
32
|
+
|
|
33
|
+
this.fileContext.trace(`Verifying the '${typeDeclarationString}' type declaration...`);
|
|
34
|
+
|
|
35
|
+
const typeVerifies = this.verifyType();
|
|
36
|
+
|
|
37
|
+
if (typeVerifies) {
|
|
38
|
+
const superTypesVerify = this.verifySuperTypes();
|
|
39
|
+
|
|
40
|
+
if (superTypesVerify) {
|
|
41
|
+
this.fileContext.addType(this.type);
|
|
42
|
+
|
|
43
|
+
verifies = true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (verifies) {
|
|
48
|
+
this.fileContext.debug(`...verified the '${typeDeclarationString}' type declaration.`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return verifies;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
verifyType() {
|
|
55
|
+
let typeVerifies = false;
|
|
56
|
+
|
|
57
|
+
const typeString = this.type.getString();
|
|
58
|
+
|
|
59
|
+
this.fileContext.trace(`Verifying the '${typeString}' type...`);
|
|
60
|
+
|
|
61
|
+
const typeName = this.type.getName(),
|
|
62
|
+
typePresent = this.fileContext.isTypePresentByTypeName(typeName);
|
|
63
|
+
|
|
64
|
+
if (typePresent) {
|
|
65
|
+
this.fileContext.debug(`The type '${typeString}' is already present.`);
|
|
66
|
+
} else {
|
|
67
|
+
typeVerifies = true;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (typeVerifies) {
|
|
71
|
+
this.fileContext.debug(`...verified the '${typeString}' type.`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return typeVerifies;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
verifySuperType(superType) {
|
|
78
|
+
let superTypeVerifies = false;
|
|
79
|
+
|
|
80
|
+
const superTypeString = superType.getString();
|
|
81
|
+
|
|
82
|
+
this.fileContext.trace(`Verifying the '${superTypeString}' super-type...`);
|
|
83
|
+
|
|
84
|
+
const superTypeName = superType.getName(),
|
|
85
|
+
superTypePresent = this.fileContext.isTypePresentByTypeName(superTypeName);
|
|
86
|
+
|
|
87
|
+
if (superTypePresent) {
|
|
88
|
+
superTypeVerifies = true;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (superTypeVerifies) {
|
|
92
|
+
this.fileContext.debug(`...verified the '${superTypeString}' super-type.`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return superTypeVerifies;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
verifySuperTypes() {
|
|
99
|
+
let superTypesVerify = false;
|
|
100
|
+
|
|
101
|
+
this.fileContext.trace(`Verifying the super-types...`);
|
|
102
|
+
|
|
103
|
+
let superTypes;
|
|
104
|
+
|
|
105
|
+
superTypes = this.type.getSuperTypes();
|
|
106
|
+
|
|
107
|
+
const superTypesLength = superTypes.length;
|
|
108
|
+
|
|
109
|
+
if (superTypesLength === 0) {
|
|
110
|
+
const superType = objectType; ///
|
|
111
|
+
|
|
112
|
+
superTypes.push(superType);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const typeName = this.type.getName(),
|
|
116
|
+
typeBasic = this.type.isBasic(),
|
|
117
|
+
typeString = this.type.getString();
|
|
118
|
+
|
|
119
|
+
if (typeBasic) {
|
|
120
|
+
superTypesVerify = true;
|
|
121
|
+
|
|
122
|
+
this.fileContext.trace(`The '${typeString}' type is basic.`)
|
|
123
|
+
} else {
|
|
124
|
+
const superTypeNames = superTypes.map((superType) => {
|
|
125
|
+
const superTypeName = superType.getName();
|
|
126
|
+
|
|
127
|
+
return superTypeName;
|
|
128
|
+
}),
|
|
129
|
+
superTypeNamesIncludesTypeName = superTypeNames.includes(typeName);
|
|
130
|
+
|
|
131
|
+
if (superTypeNamesIncludesTypeName) {
|
|
132
|
+
this.fileContext.trace(`The '${typeName}' type cannot be a super-type `);
|
|
133
|
+
} else {
|
|
134
|
+
superTypesVerify = superTypes.every((superType) => {
|
|
135
|
+
const superTypeVerifies = this.verifySuperType(superType);
|
|
136
|
+
|
|
137
|
+
if (superTypeVerifies) {
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
if (superTypesVerify) {
|
|
143
|
+
superTypes = superTypes.map((superType) => {
|
|
144
|
+
const superTypeName = superType.getName();
|
|
145
|
+
|
|
146
|
+
superType = this.fileContext.findTypeByTypeName(superTypeName);
|
|
147
|
+
|
|
148
|
+
return superType;
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
const string = stringFromTypeNameNameAndSuperTypes(typeName, superTypes);
|
|
152
|
+
|
|
153
|
+
this.type.setString(string);
|
|
154
|
+
|
|
155
|
+
this.type.setSuperTypes(superTypes);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (superTypesVerify) {
|
|
161
|
+
this.fileContext.debug(`...verified the super-types.`);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return superTypesVerify;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
static name = "SimpleTypeDeclaration";
|
|
168
|
+
|
|
169
|
+
static fromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, fileContext) {
|
|
170
|
+
const { Type } = dom,
|
|
171
|
+
type = Type.fromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, fileContext),
|
|
172
|
+
typeName = type.getName(),
|
|
173
|
+
superTypes = type.getSuperTypes(),
|
|
174
|
+
string = stringFromTypeNameNameAndSuperTypes(typeName, superTypes),
|
|
175
|
+
simpleTypeDeclaration = new SimpleTypeDeclaration(fileContext, string, type);
|
|
176
|
+
|
|
177
|
+
return simpleTypeDeclaration;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
@@ -24,33 +24,33 @@ export default domAssigned(class VariableDeclaration {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
verify() {
|
|
27
|
-
let
|
|
27
|
+
let verifies = false;
|
|
28
28
|
|
|
29
29
|
const variableDeclarationString = this.getString();
|
|
30
30
|
|
|
31
31
|
this.fileContext.trace(`Verifying the '${variableDeclarationString}' variable declaration...`);
|
|
32
32
|
|
|
33
|
-
const
|
|
33
|
+
const variableTypeVerifies = this.verifyVariableType();
|
|
34
34
|
|
|
35
|
-
if (
|
|
36
|
-
const
|
|
35
|
+
if (variableTypeVerifies) {
|
|
36
|
+
const variableVerifies = this.verifyVariable();
|
|
37
37
|
|
|
38
|
-
if (
|
|
38
|
+
if (variableVerifies) {
|
|
39
39
|
this.fileContext.addVariable(this.variable);
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
verifies = true;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
if (
|
|
45
|
+
if (verifies) {
|
|
46
46
|
this.fileContext.debug(`...verified the '${variableDeclarationString}' variable declaration.`);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
return
|
|
49
|
+
return verifies;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
verifyVariable() {
|
|
53
|
-
let
|
|
53
|
+
let variableVerifies = false;
|
|
54
54
|
|
|
55
55
|
const variableString = this.variable.getString();
|
|
56
56
|
|
|
@@ -62,18 +62,18 @@ export default domAssigned(class VariableDeclaration {
|
|
|
62
62
|
if (variablePresent) {
|
|
63
63
|
this.fileContext.debug(`The '${variableName}' variable is already present.`);
|
|
64
64
|
} else {
|
|
65
|
-
|
|
65
|
+
variableVerifies = true;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
if (
|
|
68
|
+
if ( variableVerifies) {
|
|
69
69
|
this.fileContext.debug(`...verified the '${variableString}' variable.`);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
return
|
|
72
|
+
return variableVerifies;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
verifyVariableType() {
|
|
76
|
-
let
|
|
76
|
+
let variableTypeVerifies = false;
|
|
77
77
|
|
|
78
78
|
let type;
|
|
79
79
|
|
|
@@ -103,15 +103,15 @@ export default domAssigned(class VariableDeclaration {
|
|
|
103
103
|
} else {
|
|
104
104
|
this.variable.setType(type);
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
variableTypeVerifies = true;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
if (
|
|
110
|
+
if (variableTypeVerifies) {
|
|
111
111
|
this.fileContext.debug(`...verified the '${typeString}' type.`);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
return
|
|
114
|
+
return variableTypeVerifies;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
static name = "VariableDeclaration";
|
package/src/dom/declaration.js
CHANGED
|
@@ -48,58 +48,58 @@ export default domAssigned(class Declaration {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
verify(assignments, stated, context) {
|
|
51
|
-
let
|
|
51
|
+
let verifies = false;
|
|
52
52
|
|
|
53
53
|
const declarationString = this.string; ///
|
|
54
54
|
|
|
55
55
|
context.trace(`Verifying the '${declarationString}' declaration...`);
|
|
56
56
|
|
|
57
|
-
const
|
|
57
|
+
const referenceVerifies = this.verifyReference(assignments, stated, context);
|
|
58
58
|
|
|
59
|
-
if (
|
|
60
|
-
const
|
|
59
|
+
if (referenceVerifies) {
|
|
60
|
+
const statementVerifies = this.verifyStatement(assignments, stated, context);
|
|
61
61
|
|
|
62
|
-
if (
|
|
63
|
-
let
|
|
64
|
-
|
|
62
|
+
if (statementVerifies) {
|
|
63
|
+
let verifiesWhenStated = false,
|
|
64
|
+
verifiesWhenDerived = false;
|
|
65
65
|
|
|
66
66
|
if (stated) {
|
|
67
|
-
|
|
67
|
+
verifiesWhenStated = this.verifyWhenStated(assignments, context);
|
|
68
68
|
} else {
|
|
69
|
-
|
|
69
|
+
verifiesWhenDerived = this.verifyWhenDerived(context);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
if (
|
|
73
|
-
|
|
72
|
+
if (verifiesWhenStated || verifiesWhenDerived) {
|
|
73
|
+
verifies = true;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
if (
|
|
78
|
+
if (verifies) {
|
|
79
79
|
context.debug(`...verified the '${declarationString}' declaration.`);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
return
|
|
82
|
+
return verifies;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
verifyReference(assignments, stated, context) {
|
|
86
|
-
let
|
|
86
|
+
let referenceVerifies;
|
|
87
87
|
|
|
88
88
|
const referenceString = this.reference.getString();
|
|
89
89
|
|
|
90
90
|
context.trace(`Verifying the '${referenceString}' reference...`);
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
referenceVerifies = this.reference.verify(context);
|
|
93
93
|
|
|
94
|
-
if (
|
|
94
|
+
if (referenceVerifies) {
|
|
95
95
|
context.debug(`...verified the '${referenceString}' reference.`);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
return
|
|
98
|
+
return referenceVerifies;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
verifyStatement(assignments, stated, context) {
|
|
102
|
-
let
|
|
102
|
+
let statementVerifies;
|
|
103
103
|
|
|
104
104
|
const statementString = this.statement.getString();
|
|
105
105
|
|
|
@@ -109,17 +109,17 @@ export default domAssigned(class Declaration {
|
|
|
109
109
|
|
|
110
110
|
assignments = null; ///
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
statementVerifies = this.statement.verify(assignments, stated, context);
|
|
113
113
|
|
|
114
|
-
if (
|
|
114
|
+
if (statementVerifies) {
|
|
115
115
|
context.debug(`...verified the '${statementString}' statement.`);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
return
|
|
118
|
+
return statementVerifies;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
verifyWhenStated(assignments, context) {
|
|
122
|
-
let
|
|
122
|
+
let verifiesWhenStated;
|
|
123
123
|
|
|
124
124
|
const declarationString = this.string; ///
|
|
125
125
|
|
|
@@ -128,29 +128,29 @@ export default domAssigned(class Declaration {
|
|
|
128
128
|
const metavariablePresent = context.isMetavariablePresentByReference(this.reference);
|
|
129
129
|
|
|
130
130
|
if (metavariablePresent) {
|
|
131
|
-
|
|
131
|
+
verifiesWhenStated = true;
|
|
132
132
|
} else {
|
|
133
133
|
const metaLemmaMetatheorems = context.findMetaLemmaMetatheoremsByReference(this.reference),
|
|
134
|
-
|
|
135
|
-
const
|
|
134
|
+
metaLemmaMetatheoremsUnify = metaLemmaMetatheorems.every((metaLemmaMetatheorem) => {
|
|
135
|
+
const metaLemmaMetatheoremUnifies = this.unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context);
|
|
136
136
|
|
|
137
|
-
if (
|
|
137
|
+
if (metaLemmaMetatheoremUnifies) {
|
|
138
138
|
return true;
|
|
139
139
|
}
|
|
140
140
|
});
|
|
141
141
|
|
|
142
|
-
|
|
142
|
+
verifiesWhenStated = metaLemmaMetatheoremsUnify; ///
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
if (
|
|
145
|
+
if (verifiesWhenStated) {
|
|
146
146
|
context.debug(`...verified the '${declarationString}' stated declaration.`);
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
return
|
|
149
|
+
return verifiesWhenStated;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
verifyWhenDerived(context) {
|
|
153
|
-
let
|
|
153
|
+
let verifiesWhenDerived;
|
|
154
154
|
|
|
155
155
|
const declarationString = this.string; ///
|
|
156
156
|
|
|
@@ -158,17 +158,17 @@ export default domAssigned(class Declaration {
|
|
|
158
158
|
|
|
159
159
|
const metaLemmaMetatheoremPresent = context.isMetaLemmaMetatheoremPresentByReference(this.reference);
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
verifiesWhenDerived = metaLemmaMetatheoremPresent; ///
|
|
162
162
|
|
|
163
|
-
if (
|
|
163
|
+
if (verifiesWhenDerived) {
|
|
164
164
|
context.debug(`...verified the '${declarationString}' derived declaration.`);
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
return
|
|
167
|
+
return verifiesWhenDerived;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
unifyStatement(statement, substitutions, generalContext, specificContext) {
|
|
171
|
-
let
|
|
171
|
+
let statementUnifies;
|
|
172
172
|
|
|
173
173
|
const context = generalContext, ///
|
|
174
174
|
statementString = statement.getString(),
|
|
@@ -178,19 +178,19 @@ export default domAssigned(class Declaration {
|
|
|
178
178
|
|
|
179
179
|
const generalStatement = this.statement,
|
|
180
180
|
specificStatement = statement, ///
|
|
181
|
-
|
|
181
|
+
statementUUnifiesIntrinsically = unifyStatementIntrinsically(generalStatement, specificStatement, substitutions, generalContext, specificContext);
|
|
182
182
|
|
|
183
|
-
|
|
183
|
+
statementUnifies = statementUUnifiesIntrinsically; ///
|
|
184
184
|
|
|
185
|
-
if (
|
|
185
|
+
if (statementUnifies) {
|
|
186
186
|
context.debug(`...unified the '${statementString}' statement with the '${declarationStatementString}' statement.`);
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
return
|
|
189
|
+
return statementUnifies;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
unifyLabelWithReference(label, substitutions, generalContext, specificContext) {
|
|
193
|
-
let
|
|
193
|
+
let labelUnifiesWithReference;
|
|
194
194
|
|
|
195
195
|
const context = generalContext, ///
|
|
196
196
|
labelString = label.getString(),
|
|
@@ -198,19 +198,19 @@ export default domAssigned(class Declaration {
|
|
|
198
198
|
|
|
199
199
|
context.trace(`Unifying the '${labelString}' label with the '${referenceString}' reference...`);
|
|
200
200
|
|
|
201
|
-
const
|
|
201
|
+
const labelUnifies = this.reference.unifyLabel(label, substitutions, context);
|
|
202
202
|
|
|
203
|
-
|
|
203
|
+
labelUnifiesWithReference = labelUnifies; ///
|
|
204
204
|
|
|
205
|
-
if (
|
|
205
|
+
if (labelUnifiesWithReference) {
|
|
206
206
|
context.debug(`...unified the '${labelString}' label with the '${referenceString}' reference.`);
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
return
|
|
209
|
+
return labelUnifiesWithReference;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context) {
|
|
213
|
-
let
|
|
213
|
+
let metaLemmaMetatheoremUnifies = false;
|
|
214
214
|
|
|
215
215
|
const declarationString = this.string, ///
|
|
216
216
|
metaLemmaMetatheoremString = metaLemmaMetatheorem.getString();
|
|
@@ -223,26 +223,28 @@ export default domAssigned(class Declaration {
|
|
|
223
223
|
labelSubstitutions = Substitutions.fromNothing(),
|
|
224
224
|
label = metaLemmaMetatheorem.getLabel(),
|
|
225
225
|
substitutions = labelSubstitutions, ///
|
|
226
|
-
|
|
226
|
+
labelUnifiesWithReference = this.unifyLabelWithReference(label, substitutions, generalContext, specificContext);
|
|
227
227
|
|
|
228
|
-
if (
|
|
228
|
+
if (labelUnifiesWithReference) {
|
|
229
229
|
const statementSubstitutions = Substitutions.fromNothing(),
|
|
230
230
|
statement = metaLemmaMetatheorem.getStatement(),
|
|
231
231
|
substitutions = statementSubstitutions, ///
|
|
232
|
-
|
|
232
|
+
statementUUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
233
233
|
|
|
234
|
-
if (
|
|
235
|
-
const
|
|
234
|
+
if (statementUUnifies) {
|
|
235
|
+
const labelSubstitutionsCorrelateStatementSubstitutions = labelSubstitutions.correlateSubstitutions(statementSubstitutions);
|
|
236
236
|
|
|
237
|
-
|
|
237
|
+
if (labelSubstitutionsCorrelateStatementSubstitutions) {
|
|
238
|
+
metaLemmaMetatheoremUnifies = true; ///
|
|
239
|
+
}
|
|
238
240
|
}
|
|
239
241
|
}
|
|
240
242
|
|
|
241
|
-
if (
|
|
243
|
+
if (metaLemmaMetatheoremUnifies) {
|
|
242
244
|
context.trace(`...unified the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${declarationString}' declaration...`);
|
|
243
245
|
}
|
|
244
246
|
|
|
245
|
-
return
|
|
247
|
+
return metaLemmaMetatheoremUnifies;
|
|
246
248
|
}
|
|
247
249
|
|
|
248
250
|
static name = "Declaration";
|
package/src/dom/deduction.js
CHANGED
|
@@ -20,7 +20,7 @@ export default domAssigned(class Deduction {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
verify(context) {
|
|
23
|
-
let
|
|
23
|
+
let verifies = false;
|
|
24
24
|
|
|
25
25
|
const deductionString = this.string; ///
|
|
26
26
|
|
|
@@ -29,22 +29,22 @@ export default domAssigned(class Deduction {
|
|
|
29
29
|
if (this.statement !== null) {
|
|
30
30
|
const stated = true,
|
|
31
31
|
assignments = null,
|
|
32
|
-
|
|
32
|
+
statementVerifies = this.statement.verify(assignments, stated, context);
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
verifies = statementVerifies; ///
|
|
35
35
|
} else {
|
|
36
36
|
context.debug(`Unable to verify the '${deductionString}' deduction because it is nonsense.`);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
if (
|
|
39
|
+
if (verifies) {
|
|
40
40
|
context.debug(`...verified the '${deductionString}' deduction.`);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
return
|
|
43
|
+
return verifies;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
unifyStatement(statement, substitutions, generalContext, specificContext) {
|
|
47
|
-
let
|
|
47
|
+
let statementUnifies;
|
|
48
48
|
|
|
49
49
|
const deduction = this, ///
|
|
50
50
|
statementString = statement.getString(),
|
|
@@ -52,17 +52,17 @@ export default domAssigned(class Deduction {
|
|
|
52
52
|
|
|
53
53
|
specificContext.trace(`Unifying the '${statementString}' statement with the '${deductionString}' deduction...`);
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
56
56
|
|
|
57
|
-
if (
|
|
57
|
+
if (statementUnifies) {
|
|
58
58
|
specificContext.debug(`...unified the '${statementString}' statement with the '${deductionString}' deduction.`);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
return
|
|
61
|
+
return statementUnifies;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
unifyDeduction(deduction, substitutions, generalContext, specificContext) {
|
|
65
|
-
let
|
|
65
|
+
let deductionUnifies;
|
|
66
66
|
|
|
67
67
|
const context = specificContext, ///
|
|
68
68
|
specificDeduction = deduction, ///
|
|
@@ -72,15 +72,15 @@ export default domAssigned(class Deduction {
|
|
|
72
72
|
context.trace(`Unifying the '${specificDeductionString}' deduction with the '${generalDeductionString}' deduction...`);
|
|
73
73
|
|
|
74
74
|
const statement = specificDeduction.getStatement(),
|
|
75
|
-
|
|
75
|
+
statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
deductionUnifies = statementUnifies; ///
|
|
78
78
|
|
|
79
|
-
if (
|
|
79
|
+
if (deductionUnifies) {
|
|
80
80
|
context.debug(`...unified the '${specificDeductionString}' deduction with the '${generalDeductionString}' deduction.`);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
return
|
|
83
|
+
return deductionUnifies;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
toJSON() {
|