occam-verify-cli 1.0.448 → 1.0.472
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/constants.js +13 -5
- package/lib/context/ephemeral.js +270 -0
- package/lib/context/file.js +136 -128
- package/lib/context/liminal.js +120 -0
- package/lib/context/literal.js +92 -0
- package/lib/context/nominal.js +15 -1
- package/lib/context/release.js +68 -9
- package/lib/context/scoped.js +322 -0
- package/lib/context/synthetic.js +133 -0
- package/lib/element/assertion/contained.js +66 -66
- package/lib/element/assertion/defined.js +32 -32
- package/lib/element/assertion/property.js +39 -39
- package/lib/element/assertion/satisfies.js +22 -22
- package/lib/element/assumption.js +71 -87
- package/lib/element/combinator/bracketed.js +1 -10
- package/lib/element/conclusion.js +19 -15
- package/lib/element/constructor/bracketed.js +1 -10
- package/lib/element/constructor.js +2 -2
- package/lib/element/declaration/combinator.js +1 -2
- package/lib/element/declaration/metavariable.js +3 -3
- package/lib/element/declaration/variable.js +3 -3
- package/lib/element/deduction.js +26 -20
- package/lib/element/derivation.js +3 -3
- package/lib/element/equality.js +5 -5
- package/lib/element/equivalence.js +112 -107
- package/lib/element/equivalences.js +24 -10
- package/lib/element/error.js +3 -3
- package/lib/element/frame.js +73 -62
- package/lib/element/hypothesis.js +2 -2
- package/lib/element/judgement.js +40 -60
- package/lib/element/metaType.js +4 -4
- package/lib/element/metavariable.js +49 -38
- package/lib/element/parameter.js +13 -5
- package/lib/element/procedureCall.js +16 -16
- package/lib/element/proof.js +14 -13
- package/lib/element/proofAssertion/premise.js +319 -0
- package/lib/element/proofAssertion/step.js +309 -0
- package/lib/element/proofAssertion/supposition.js +333 -0
- package/lib/element/proofAssertion.js +20 -10
- package/lib/element/propertyRelation.js +2 -2
- package/lib/element/reference.js +72 -30
- package/lib/element/rule.js +26 -28
- package/lib/element/section.js +5 -5
- package/lib/element/signature.js +9 -6
- package/lib/element/statement.js +44 -36
- package/lib/element/subproof.js +18 -17
- package/lib/element/substitution/frame.js +86 -49
- package/lib/element/substitution/reference.js +101 -19
- package/lib/element/substitution/statement.js +128 -105
- package/lib/element/substitution/term.js +93 -57
- package/lib/element/substitution.js +20 -69
- package/lib/element/substitutions.js +49 -34
- package/lib/element/term.js +41 -30
- package/lib/element/topLevelAssertion/axiom.js +331 -0
- package/lib/element/{conjecture.js → topLevelAssertion/conjecture.js} +10 -10
- package/lib/element/{lemma.js → topLevelAssertion/lemma.js} +9 -9
- package/lib/element/{theorem.js → topLevelAssertion/theorem.js} +8 -8
- package/lib/element/topLevelAssertion.js +434 -0
- package/lib/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +8 -8
- package/lib/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +8 -8
- package/lib/element/topLevelMetaAssertion.js +293 -0
- package/lib/element/type.js +4 -4
- package/lib/element/variable.js +48 -40
- package/lib/index.js +3 -3
- package/lib/main.js +3 -3
- package/lib/metaTypes.js +18 -15
- package/lib/node/frame.js +2 -2
- package/lib/node/metavariable.js +4 -4
- package/lib/node/parameter.js +28 -7
- package/lib/node/proofAssertion/premise.js +116 -0
- package/lib/node/proofAssertion/step.js +152 -0
- package/lib/node/proofAssertion/supposition.js +116 -0
- package/lib/node/{premise.js → proofAssertion.js} +11 -18
- package/lib/node/statement.js +2 -2
- package/lib/node/substitution/frame.js +9 -31
- package/lib/node/substitution/reference.js +137 -0
- package/lib/node/substitution/statement.js +9 -31
- package/lib/node/substitution/term.js +9 -23
- package/lib/node/{axiom.js → topLevelAssertion/axiom.js} +7 -7
- package/lib/node/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
- package/lib/node/{lemma.js → topLevelAssertion/lemma.js} +7 -7
- package/lib/node/{theorem.js → topLevelAssertion/theorem.js} +7 -7
- package/lib/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +9 -9
- package/lib/node/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
- package/lib/node/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
- package/lib/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +9 -9
- package/lib/nonTerminalNodeMap.js +15 -14
- package/lib/preamble.js +10 -10
- package/lib/process/instantiate.js +6 -21
- package/lib/process/unify.js +11 -10
- package/lib/tokenTypes.js +22 -0
- package/lib/types.js +3 -3
- package/lib/utilities/bnf.js +5 -5
- package/lib/utilities/context.js +63 -0
- package/lib/utilities/element.js +235 -408
- package/lib/utilities/instance.js +12 -34
- package/lib/utilities/json.js +3 -2
- package/lib/utilities/string.js +56 -21
- package/lib/utilities/unification.js +38 -32
- package/lib/utilities/validation.js +47 -50
- package/package.json +2 -2
- package/src/constants.js +12 -1
- package/src/context/ephemeral.js +257 -0
- package/src/context/file.js +108 -116
- package/src/context/liminal.js +67 -0
- package/src/context/literal.js +51 -0
- package/src/context/nominal.js +12 -0
- package/src/context/release.js +48 -8
- package/src/context/{local.js → scoped.js} +43 -125
- package/src/context/synthetic.js +60 -0
- package/src/element/assertion/contained.js +49 -47
- package/src/element/assertion/defined.js +29 -27
- package/src/element/assertion/property.js +35 -35
- package/src/element/assertion/satisfies.js +19 -18
- package/src/element/assumption.js +71 -93
- package/src/element/combinator/bracketed.js +0 -7
- package/src/element/conclusion.js +25 -24
- package/src/element/constructor/bracketed.js +0 -7
- package/src/element/constructor.js +1 -1
- package/src/element/declaration/combinator.js +0 -1
- package/src/element/declaration/metavariable.js +2 -2
- package/src/element/declaration/variable.js +5 -5
- package/src/element/deduction.js +33 -31
- package/src/element/derivation.js +2 -2
- package/src/element/equality.js +4 -4
- package/src/element/equivalence.js +115 -135
- package/src/element/equivalences.js +9 -7
- package/src/element/error.js +4 -2
- package/src/element/frame.js +80 -65
- package/src/element/hypothesis.js +1 -1
- package/src/element/judgement.js +42 -62
- package/src/element/metaType.js +3 -4
- package/src/element/metavariable.js +59 -56
- package/src/element/parameter.js +10 -5
- package/src/element/procedureCall.js +20 -18
- package/src/element/proof.js +14 -16
- package/src/element/{premise.js → proofAssertion/premise.js} +57 -53
- package/src/element/{step.js → proofAssertion/step.js} +59 -62
- package/src/element/{supposition.js → proofAssertion/supposition.js} +67 -56
- package/src/element/proofAssertion.js +24 -13
- package/src/element/propertyRelation.js +1 -1
- package/src/element/reference.js +87 -37
- package/src/element/rule.js +31 -37
- package/src/element/section.js +5 -5
- package/src/element/signature.js +8 -8
- package/src/element/statement.js +52 -48
- package/src/element/subproof.js +16 -18
- package/src/element/substitution/frame.js +104 -50
- package/src/element/substitution/reference.js +120 -20
- package/src/element/substitution/statement.js +169 -130
- package/src/element/substitution/term.js +104 -63
- package/src/element/substitution.js +16 -58
- package/src/element/substitutions.js +43 -41
- package/src/element/term.js +47 -41
- package/src/element/{axiom.js → topLevelAssertion/axiom.js} +22 -20
- package/src/element/{conjecture.js → topLevelAssertion/conjecture.js} +5 -6
- package/src/element/{lemma.js → topLevelAssertion/lemma.js} +5 -6
- package/src/element/{theorem.js → topLevelAssertion/theorem.js} +5 -5
- package/src/element/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +37 -33
- package/src/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +5 -6
- package/src/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +5 -6
- package/src/element/{metaLemmaMetatheorem.js → topLevelMetaAssertion.js} +19 -17
- package/src/element/type.js +2 -4
- package/src/element/variable.js +47 -48
- package/src/index.js +2 -1
- package/src/main.js +2 -1
- package/src/metaTypes.js +25 -9
- package/src/node/frame.js +1 -1
- package/src/node/metavariable.js +3 -3
- package/src/node/parameter.js +32 -5
- package/src/node/proofAssertion/premise.js +16 -0
- package/src/node/{step.js → proofAssertion/step.js} +4 -18
- package/src/node/proofAssertion/supposition.js +16 -0
- package/src/node/proofAssertion.js +23 -0
- package/src/node/statement.js +1 -1
- package/src/node/substitution/frame.js +6 -32
- package/src/node/substitution/reference.js +38 -0
- package/src/node/substitution/statement.js +6 -32
- package/src/node/substitution/term.js +6 -22
- package/src/node/topLevelAssertion/axiom.js +13 -0
- package/src/node/topLevelAssertion/conjecture.js +13 -0
- package/src/node/topLevelAssertion/lemma.js +13 -0
- package/src/node/topLevelAssertion/theorem.js +13 -0
- package/src/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +1 -1
- package/src/node/topLevelMetaAssertion/metaLemma.js +13 -0
- package/src/node/topLevelMetaAssertion/metatheorem.js +13 -0
- package/src/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +1 -1
- package/src/nonTerminalNodeMap.js +15 -12
- package/src/preamble.js +9 -9
- package/src/process/instantiate.js +27 -36
- package/src/process/unify.js +10 -9
- package/src/tokenTypes.js +4 -0
- package/src/types.js +4 -2
- package/src/utilities/bnf.js +3 -2
- package/src/utilities/context.js +46 -0
- package/src/utilities/element.js +302 -509
- package/src/utilities/instance.js +19 -42
- package/src/utilities/json.js +3 -1
- package/src/utilities/string.js +69 -28
- package/src/utilities/unification.js +41 -38
- package/src/utilities/validation.js +66 -75
- package/lib/context/local.js +0 -605
- package/lib/context/temporary.js +0 -752
- package/lib/element/axiom.js +0 -329
- package/lib/element/axiomLemmaTheoremConjecture.js +0 -427
- package/lib/element/metaLemmaMetatheorem.js +0 -289
- package/lib/element/premise.js +0 -307
- package/lib/element/step.js +0 -311
- package/lib/element/supposition.js +0 -320
- package/lib/log.js +0 -150
- package/lib/node/step.js +0 -166
- package/lib/node/supposition.js +0 -130
- package/src/context/temporary.js +0 -476
- package/src/log.js +0 -118
- package/src/node/axiom.js +0 -13
- package/src/node/conjecture.js +0 -13
- package/src/node/lemma.js +0 -13
- package/src/node/metaLemma.js +0 -13
- package/src/node/metatheorem.js +0 -13
- package/src/node/premise.js +0 -30
- package/src/node/supposition.js +0 -30
- package/src/node/theorem.js +0 -13
|
@@ -34,7 +34,7 @@ export default define(class Assumption extends Element {
|
|
|
34
34
|
compareSubstitution(substitution, context) {
|
|
35
35
|
let comparesToSubstituion = false;
|
|
36
36
|
|
|
37
|
-
const assumptionString = this.
|
|
37
|
+
const assumptionString = this.getString(), ///
|
|
38
38
|
substitutionString = substitution.getString();
|
|
39
39
|
|
|
40
40
|
context.trace(`Comparing the '${assumptionString}' assumption to the '${substitutionString}' substitution...`);
|
|
@@ -71,75 +71,59 @@ export default define(class Assumption extends Element {
|
|
|
71
71
|
return comparesToSubstituion;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
let
|
|
74
|
+
validate(assignments, stated, context) {
|
|
75
|
+
let validates = false;
|
|
76
76
|
|
|
77
|
-
const assumptionString = this.
|
|
77
|
+
const assumptionString = this.getString(); ///
|
|
78
78
|
|
|
79
|
-
context.trace(`
|
|
79
|
+
context.trace(`Validating the '${assumptionString}' assumption...`);
|
|
80
80
|
|
|
81
81
|
const simple = this.isSimple();
|
|
82
82
|
|
|
83
83
|
if (simple) {
|
|
84
|
-
const
|
|
84
|
+
const referenceValidatesAsMetavariable = this.validateReferenceAsMetavariable(assignments, stated, context);
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
if (referenceValidatesAsMetavariable) {
|
|
87
|
+
validates = true;
|
|
88
|
+
}
|
|
87
89
|
} else {
|
|
88
|
-
const
|
|
90
|
+
const referenceValidates = this.reference.validate(context);
|
|
89
91
|
|
|
90
|
-
if (
|
|
92
|
+
if (referenceValidates) {
|
|
91
93
|
const statementValidates = this.validateStatement(assignments, stated, context);
|
|
92
94
|
|
|
93
95
|
if (statementValidates) {
|
|
94
|
-
let
|
|
95
|
-
|
|
96
|
+
let validatesWhenStated = false,
|
|
97
|
+
validatesWhenDerived = false;
|
|
96
98
|
|
|
97
99
|
if (stated) {
|
|
98
|
-
|
|
100
|
+
validatesWhenStated = this.validateWhenStated(assignments, context);
|
|
99
101
|
} else {
|
|
100
|
-
|
|
102
|
+
validatesWhenDerived = this.validateWhenDerived(context);
|
|
101
103
|
}
|
|
102
104
|
|
|
103
|
-
if (
|
|
104
|
-
|
|
105
|
+
if (validatesWhenStated || validatesWhenDerived) {
|
|
106
|
+
validates = true;
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
if (
|
|
110
|
-
context.debug(`...
|
|
111
|
+
if (validates) {
|
|
112
|
+
context.debug(`...validated the '${assumptionString}' assumption.`);
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
|
|
114
|
-
return
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
verifyReference(assignments, stated, context) {
|
|
118
|
-
let referenceVerified;
|
|
119
|
-
|
|
120
|
-
const referenceString = this.reference.getString(),
|
|
121
|
-
assumptionString = this.string; ///
|
|
122
|
-
|
|
123
|
-
context.trace(`Verifying the '${assumptionString}' assumption's '${referenceString}' reference...`);
|
|
124
|
-
|
|
125
|
-
referenceVerified = this.reference.verify(context);
|
|
126
|
-
|
|
127
|
-
if (referenceVerified) {
|
|
128
|
-
context.debug(`...verified the '${assumptionString}' assumption's '${referenceString}' reference.`);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return referenceVerified;
|
|
116
|
+
return validates;
|
|
132
117
|
}
|
|
133
118
|
|
|
134
119
|
validateStatement(assignments, stated, context) {
|
|
135
|
-
let statementValidates;
|
|
120
|
+
let statementValidates = true; ///
|
|
136
121
|
|
|
137
|
-
if (this.statement
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const statementString = this.statement.getString();
|
|
122
|
+
if (this.statement !== null) {
|
|
123
|
+
const assumptionString = this.getString(),
|
|
124
|
+
statementString = this.statement.getString();
|
|
141
125
|
|
|
142
|
-
context.trace(`Validating the '${statementString}' statement...`);
|
|
126
|
+
context.trace(`Validating the '${assumptionString}' assumption's '${statementString}' statement...`);
|
|
143
127
|
|
|
144
128
|
stated = true; ///
|
|
145
129
|
|
|
@@ -148,83 +132,77 @@ export default define(class Assumption extends Element {
|
|
|
148
132
|
statementValidates = this.statement.validate(assignments, stated, context);
|
|
149
133
|
|
|
150
134
|
if (statementValidates) {
|
|
151
|
-
context.debug(`...validated the '${statementString}' statement.`);
|
|
135
|
+
context.debug(`...validated the '${assumptionString}' assumption's '${statementString}' statement.`);
|
|
152
136
|
}
|
|
153
137
|
}
|
|
154
138
|
|
|
155
139
|
return statementValidates;
|
|
156
140
|
}
|
|
157
141
|
|
|
158
|
-
|
|
159
|
-
let
|
|
142
|
+
validateReferenceAsMetavariable(assignments, stated, context) {
|
|
143
|
+
let referenceValidatesAsMetavariable;
|
|
160
144
|
|
|
161
145
|
const referenceString = this.reference.getString(),
|
|
162
|
-
assumptionString = this.
|
|
146
|
+
assumptionString = this.getString(); ///
|
|
163
147
|
|
|
164
|
-
context.trace(`
|
|
148
|
+
context.trace(`Validating the '${assumptionString}' assumption's '${referenceString}' reference as s metavariable...`);
|
|
165
149
|
|
|
166
|
-
|
|
167
|
-
metavariableName = metavariable.getName(),
|
|
168
|
-
metavariablePresent = context.isMetavariablePresentByMetavariableName(metavariableName);
|
|
169
|
-
|
|
170
|
-
if (metavariablePresent) {
|
|
171
|
-
referenceVerifiesAsMetavariable = true;
|
|
172
|
-
}
|
|
150
|
+
referenceValidatesAsMetavariable = this.reference.validateAsMetavariable(context);
|
|
173
151
|
|
|
174
|
-
if (
|
|
175
|
-
context.debug(`...
|
|
152
|
+
if (referenceValidatesAsMetavariable) {
|
|
153
|
+
context.debug(`...validated the '${assumptionString}' assumption's '${referenceString}' reference as a metavariable.`);
|
|
176
154
|
}
|
|
177
155
|
|
|
178
|
-
return
|
|
156
|
+
return referenceValidatesAsMetavariable;
|
|
179
157
|
}
|
|
180
158
|
|
|
181
|
-
|
|
182
|
-
let
|
|
159
|
+
validateWhenStated(assignments, context) {
|
|
160
|
+
let validatesWhenStated;
|
|
183
161
|
|
|
184
|
-
const assumptionString = this.
|
|
162
|
+
const assumptionString = this.getString(); ///
|
|
185
163
|
|
|
186
|
-
context.trace(`
|
|
164
|
+
context.trace(`Validating the '${assumptionString}' stated assumption...`);
|
|
187
165
|
|
|
188
166
|
const metavariablePresent = context.isMetavariablePresentByReference(this.reference);
|
|
189
167
|
|
|
190
168
|
if (metavariablePresent) {
|
|
191
|
-
|
|
169
|
+
validatesWhenStated = true;
|
|
192
170
|
} else {
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
const
|
|
171
|
+
const topLevelMetaAssertions = context.findTopLevelMetaAssertionsByReference(this.reference),
|
|
172
|
+
topLevelMetaAssertionsUnify = topLevelMetaAssertions.every((topLevelMetaAssertion) => {
|
|
173
|
+
const topLevelMetaAssertionUnifies = this.unifyTopLevelMetaAssertion(topLevelMetaAssertion, context);
|
|
196
174
|
|
|
197
|
-
if (
|
|
175
|
+
if (topLevelMetaAssertionUnifies) {
|
|
198
176
|
return true;
|
|
199
177
|
}
|
|
200
178
|
});
|
|
201
179
|
|
|
202
|
-
|
|
180
|
+
validatesWhenStated = topLevelMetaAssertionsUnify; ///
|
|
203
181
|
}
|
|
204
182
|
|
|
205
|
-
if (
|
|
206
|
-
context.debug(`...
|
|
183
|
+
if (validatesWhenStated) {
|
|
184
|
+
context.debug(`...validated the '${assumptionString}' stated assumption.`);
|
|
207
185
|
}
|
|
208
186
|
|
|
209
|
-
return
|
|
187
|
+
return validatesWhenStated;
|
|
210
188
|
}
|
|
211
189
|
|
|
212
|
-
|
|
213
|
-
let
|
|
190
|
+
validateWhenDerived(context) {
|
|
191
|
+
let validatesWhenDerived;
|
|
214
192
|
|
|
215
|
-
const assumptionString = this.
|
|
193
|
+
const assumptionString = this.getString(); ///
|
|
216
194
|
|
|
217
|
-
context.trace(`
|
|
195
|
+
context.trace(`Validating the '${assumptionString}' derived assumption...`);
|
|
218
196
|
|
|
219
|
-
const
|
|
197
|
+
const topLevelMetaAssertionPresent = context.isTopLevelMetaAssertionPresentByReference(this.reference);
|
|
220
198
|
|
|
221
|
-
|
|
199
|
+
validatesWhenDerived = topLevelMetaAssertionPresent; ///
|
|
222
200
|
|
|
223
|
-
if (
|
|
224
|
-
context.debug(`...
|
|
201
|
+
if (validatesWhenDerived) {
|
|
202
|
+
context.debug(`...validated the '${assumptionString}' derived assumption.`);
|
|
225
203
|
}
|
|
226
204
|
|
|
227
|
-
return
|
|
205
|
+
return validatesWhenDerived;
|
|
228
206
|
}
|
|
229
207
|
|
|
230
208
|
unifyStatement(statement, substitutions, generalContext, specificContext) {
|
|
@@ -260,7 +238,7 @@ export default define(class Assumption extends Element {
|
|
|
260
238
|
|
|
261
239
|
const context = generalContext, ///
|
|
262
240
|
labelString = label.getString(),
|
|
263
|
-
assumptionString = this.
|
|
241
|
+
assumptionString = this.getString(); //;/
|
|
264
242
|
|
|
265
243
|
context.trace(`Unifying the '${labelString}' label with the '${assumptionString}' assumption...`);
|
|
266
244
|
|
|
@@ -275,28 +253,28 @@ export default define(class Assumption extends Element {
|
|
|
275
253
|
return labelUnifiesWithReference;
|
|
276
254
|
}
|
|
277
255
|
|
|
278
|
-
|
|
279
|
-
let
|
|
256
|
+
unifyTopLevelMetaAssertion(topLevelMetaAssertion, context) {
|
|
257
|
+
let topLevelMetaAssertionUnifies = false;
|
|
280
258
|
|
|
281
|
-
const assumptionString = this.
|
|
282
|
-
|
|
259
|
+
const assumptionString = this.getString(), ///
|
|
260
|
+
topLevelMetaAssertionString = topLevelMetaAssertion.getString();
|
|
283
261
|
|
|
284
|
-
context.trace(`Unifying the '${
|
|
262
|
+
context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${assumptionString}' assumption...`);
|
|
285
263
|
|
|
286
264
|
const generalContext = context; ///
|
|
287
265
|
|
|
288
|
-
context =
|
|
266
|
+
context = topLevelMetaAssertion.getContext(); ///
|
|
289
267
|
|
|
290
268
|
const { Substitutions } = elements,
|
|
291
269
|
specificContext = context, ///
|
|
292
|
-
labelSubstitutions = Substitutions.fromNothing(),
|
|
293
|
-
label =
|
|
270
|
+
labelSubstitutions = Substitutions.fromNothing(context),
|
|
271
|
+
label = topLevelMetaAssertion.getLabel(),
|
|
294
272
|
substitutions = labelSubstitutions, ///
|
|
295
273
|
labelUnifies = this.unifyLabel(label, substitutions, generalContext, specificContext);
|
|
296
274
|
|
|
297
275
|
if (labelUnifies) {
|
|
298
|
-
const statementSubstitutions = Substitutions.fromNothing(),
|
|
299
|
-
statement =
|
|
276
|
+
const statementSubstitutions = Substitutions.fromNothing(context),
|
|
277
|
+
statement = topLevelMetaAssertion.getStatement(),
|
|
300
278
|
substitutions = statementSubstitutions, ///
|
|
301
279
|
statementUUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
302
280
|
|
|
@@ -304,18 +282,18 @@ export default define(class Assumption extends Element {
|
|
|
304
282
|
const labelSubstitutionsCorrelateStatementSubstitutions = labelSubstitutions.correlateSubstitutions(statementSubstitutions);
|
|
305
283
|
|
|
306
284
|
if (labelSubstitutionsCorrelateStatementSubstitutions) {
|
|
307
|
-
|
|
285
|
+
topLevelMetaAssertionUnifies = true; ///
|
|
308
286
|
}
|
|
309
287
|
}
|
|
310
288
|
}
|
|
311
289
|
|
|
312
|
-
if (
|
|
290
|
+
if (topLevelMetaAssertionUnifies) {
|
|
313
291
|
context = generalContext; ///
|
|
314
292
|
|
|
315
|
-
context.trace(`...unified the '${
|
|
293
|
+
context.trace(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${assumptionString}' assumption...`);
|
|
316
294
|
}
|
|
317
295
|
|
|
318
|
-
return
|
|
296
|
+
return topLevelMetaAssertionUnifies;
|
|
319
297
|
}
|
|
320
298
|
|
|
321
299
|
toJSON() {
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import Combinator from "../combinator";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import { bracketedCombinatorFromNothing } from "../../utilities/instance";
|
|
7
6
|
|
|
8
7
|
export default define(class BracketedCombinator extends Combinator {
|
|
9
8
|
unifyStatement(statement, assignments, stated, context) {
|
|
@@ -23,10 +22,4 @@ export default define(class BracketedCombinator extends Combinator {
|
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
static name = "BracketedCombinator";
|
|
26
|
-
|
|
27
|
-
static fromNothing() {
|
|
28
|
-
const bracketedCombinator = bracketedCombinatorFromNothing();
|
|
29
|
-
|
|
30
|
-
return bracketedCombinator;
|
|
31
|
-
}
|
|
32
25
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Element from "../element";
|
|
4
|
-
import TemporaryContext from "../context/temporary";
|
|
5
4
|
|
|
6
5
|
import { define } from "../elements";
|
|
6
|
+
import { attempt } from "../utilities/context";
|
|
7
7
|
import { termsFromJSON, framesFromJSON, statementFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON } from "../utilities/json";
|
|
8
8
|
|
|
9
9
|
export default define(class Conclusion extends Element {
|
|
@@ -20,30 +20,28 @@ export default define(class Conclusion extends Element {
|
|
|
20
20
|
verify(context) {
|
|
21
21
|
let verifies = false;
|
|
22
22
|
|
|
23
|
-
const temporaryContext = TemporaryContext.fromNothing(context);
|
|
24
|
-
|
|
25
|
-
context = temporaryContext; ///
|
|
26
|
-
|
|
27
23
|
const node = this.getNode(),
|
|
28
24
|
conclusionString = this.getString(); ///
|
|
29
25
|
|
|
30
26
|
context.trace(`Verifying the '${conclusionString}' conclusion...`, node);
|
|
31
27
|
|
|
32
|
-
if (this.statement
|
|
33
|
-
context
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
if (this.statement !== null) {
|
|
29
|
+
attempt((context) => {
|
|
30
|
+
const stated = true,
|
|
31
|
+
assignments = null,
|
|
32
|
+
statementValidates = this.statement.validate(assignments, stated, context);
|
|
33
|
+
|
|
34
|
+
if (statementValidates) {
|
|
35
|
+
this.setContext(context);
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
37
|
+
verifies = true;
|
|
38
|
+
}
|
|
39
|
+
}, context);
|
|
40
|
+
} else {
|
|
41
|
+
context.debug(`Unable to verify the '${conclusionString}' conclusion because it is nonsense.`, node);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
if (verifies) {
|
|
45
|
-
this.setContext(context);
|
|
46
|
-
|
|
47
45
|
context.debug(`...verified the '${conclusionString}' conclusion.`, node);
|
|
48
46
|
}
|
|
49
47
|
|
|
@@ -53,14 +51,18 @@ export default define(class Conclusion extends Element {
|
|
|
53
51
|
unifyStatement(statement, substitutions, context) {
|
|
54
52
|
let statementUnifies;
|
|
55
53
|
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
conclusionString = conclusion.getString();
|
|
54
|
+
const statementString = statement.getString(),
|
|
55
|
+
conclusionString = this.getString(); ///
|
|
59
56
|
|
|
60
57
|
context.trace(`Unifying the '${statementString}' statement with the '${conclusionString}' conclusion...`);
|
|
61
58
|
|
|
62
|
-
const
|
|
63
|
-
|
|
59
|
+
const specificContext = context; ///
|
|
60
|
+
|
|
61
|
+
context = this.getContext();
|
|
62
|
+
|
|
63
|
+
const generalContext = context; ///
|
|
64
|
+
|
|
65
|
+
context = specificContext; ///
|
|
64
66
|
|
|
65
67
|
statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
66
68
|
|
|
@@ -104,10 +106,9 @@ export default define(class Conclusion extends Element {
|
|
|
104
106
|
frames = framesFromJSON(json, context),
|
|
105
107
|
statement = statementFromJSON(json, context),
|
|
106
108
|
node = null,
|
|
107
|
-
string = statement.getString()
|
|
108
|
-
temporaryContext = TemporaryContext.fromTermsAndFrames(terms, frames, context);
|
|
109
|
+
string = statement.getString();
|
|
109
110
|
|
|
110
|
-
context =
|
|
111
|
+
context = ephemeralContext; ///
|
|
111
112
|
|
|
112
113
|
const conclusion = new Conclusion(context, string, node, statement);
|
|
113
114
|
|
|
@@ -4,7 +4,6 @@ import elements from "../../elements";
|
|
|
4
4
|
import Constructor from "../constructor";
|
|
5
5
|
|
|
6
6
|
import { define } from "../../elements";
|
|
7
|
-
import { bracketedConstructorFromNothing } from "../../utilities/instance";
|
|
8
7
|
|
|
9
8
|
export default define(class BracketedConstructor extends Constructor {
|
|
10
9
|
unifyTerm(term, context, verifyAhead) {
|
|
@@ -53,10 +52,4 @@ export default define(class BracketedConstructor extends Constructor {
|
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
static name = "BracketedConstructor";
|
|
56
|
-
|
|
57
|
-
static fromNothing() {
|
|
58
|
-
const bracketedConstructor = bracketedConstructorFromNothing();
|
|
59
|
-
|
|
60
|
-
return bracketedConstructor;
|
|
61
|
-
}
|
|
62
55
|
});
|
|
@@ -27,7 +27,7 @@ export default define(class Constructor extends Element {
|
|
|
27
27
|
let termUnifies = false;
|
|
28
28
|
|
|
29
29
|
const termString = term.getString(),
|
|
30
|
-
constructorString = this.getString();
|
|
30
|
+
constructorString = this.getString(); ///
|
|
31
31
|
|
|
32
32
|
context.trace(`Unifying the '${termString}' term with the '${constructorString}' constructor...`);
|
|
33
33
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import Declaration from "../declaration";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import { verifyStatement } from "../../process/verify";
|
|
7
6
|
|
|
8
7
|
export default define(class CombinatorDeclaration extends Declaration {
|
|
9
8
|
constructor(context, string, node, combinator) {
|
|
@@ -76,7 +76,7 @@ export default define(class MetavariableDeclaration extends Declaration {
|
|
|
76
76
|
context = this.getContext(),
|
|
77
77
|
metavariableString = metavariable.getString();
|
|
78
78
|
|
|
79
|
-
context.trace(`Verifying the '${metavariableString}' metavariable
|
|
79
|
+
context.trace(`Verifying the '${metavariableString}' metavariable...`, node);
|
|
80
80
|
|
|
81
81
|
const metavariableNode = metavariable.getNode(), ///
|
|
82
82
|
termNode = metavariableNode.getTermNode();
|
|
@@ -98,7 +98,7 @@ export default define(class MetavariableDeclaration extends Declaration {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
if (metavariableVerifies) {
|
|
101
|
-
context.debug(`...verified the '${metavariableString}' metavariable
|
|
101
|
+
context.debug(`...verified the '${metavariableString}' metavariable.`, node);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
return metavariableVerifies;
|
|
@@ -65,7 +65,7 @@ export default define(class VariableDeclaration extends Declaration {
|
|
|
65
65
|
context.debug(`...verified the '${variableString}' variable.`, node);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
return
|
|
68
|
+
return variableVerifies;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
verifyVariableType() {
|
|
@@ -82,7 +82,9 @@ export default define(class VariableDeclaration extends Declaration {
|
|
|
82
82
|
|
|
83
83
|
context.trace(`Verifying the '${typeString}' type...`, node);
|
|
84
84
|
|
|
85
|
-
const
|
|
85
|
+
const includeSupertypes = false,
|
|
86
|
+
provisional = type.isProvisional(includeSupertypes),
|
|
87
|
+
nominalTypeName = type.getNominalTypeName();
|
|
86
88
|
|
|
87
89
|
type = context.findTypeByNominalTypeName(nominalTypeName);
|
|
88
90
|
|
|
@@ -91,9 +93,7 @@ export default define(class VariableDeclaration extends Declaration {
|
|
|
91
93
|
if (!typePresent) {
|
|
92
94
|
context.debug(`The '${typeString}' type is not present.`, node);
|
|
93
95
|
} else {
|
|
94
|
-
const
|
|
95
|
-
provisional = type.isProvisional(includeSupertypes),
|
|
96
|
-
typeComparesToProvisional = type.compareProvisional(provisional);
|
|
96
|
+
const typeComparesToProvisional = type.compareProvisional(provisional);
|
|
97
97
|
|
|
98
98
|
if (!typeComparesToProvisional) {
|
|
99
99
|
provisional ?
|
package/src/element/deduction.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Element from "../element";
|
|
4
|
-
import
|
|
4
|
+
import EphemeralContext from "../context/ephemeral";
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
|
+
import { attempt } from "../utilities/context";
|
|
7
8
|
import { termsFromJSON, framesFromJSON, statementFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON } from "../utilities/json";
|
|
8
9
|
|
|
9
10
|
export default define(class Deduction extends Element {
|
|
@@ -20,30 +21,28 @@ export default define(class Deduction extends Element {
|
|
|
20
21
|
verify(context) {
|
|
21
22
|
let verifies = false;
|
|
22
23
|
|
|
23
|
-
const temporaryContext = TemporaryContext.fromNothing(context);
|
|
24
|
-
|
|
25
|
-
context = temporaryContext; ///
|
|
26
|
-
|
|
27
24
|
const node = this.getNode(),
|
|
28
25
|
deductionString = this.getString(); ///
|
|
29
26
|
|
|
30
27
|
context.trace(`Verifying the '${deductionString}' deduction...`, node);
|
|
31
28
|
|
|
32
|
-
if (this.statement
|
|
33
|
-
context
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
statementVealidates = this.statement.validate(assignments, stated, context);
|
|
29
|
+
if (this.statement !== null) {
|
|
30
|
+
attempt((context) => {
|
|
31
|
+
const stated = true,
|
|
32
|
+
assignments = null,
|
|
33
|
+
statementValidates = this.statement.validate(assignments, stated, context);
|
|
38
34
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
if (statementValidates) {
|
|
36
|
+
this.setContext(context);
|
|
37
|
+
|
|
38
|
+
verifies = true;
|
|
39
|
+
}
|
|
40
|
+
}, context);
|
|
41
|
+
} else {
|
|
42
|
+
context.debug(`Unable to verify the '${deductionString}' deduction because it is nonsense.`, node);
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
if (verifies) {
|
|
45
|
-
this.setContext(context);
|
|
46
|
-
|
|
47
46
|
context.debug(`...verified the '${deductionString}' deduction.`, node);
|
|
48
47
|
}
|
|
49
48
|
|
|
@@ -53,14 +52,18 @@ export default define(class Deduction extends Element {
|
|
|
53
52
|
unifyStatement(statement, substitutions, context) {
|
|
54
53
|
let statementUnifies;
|
|
55
54
|
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
deductionString = deduction.getString();
|
|
55
|
+
const statementString = statement.getString(),
|
|
56
|
+
deductionString = this.getString(); ///
|
|
59
57
|
|
|
60
58
|
context.trace(`Unifying the '${statementString}' statement with the '${deductionString}' deduction...`);
|
|
61
59
|
|
|
62
|
-
const
|
|
63
|
-
|
|
60
|
+
const specificContext = context; ///
|
|
61
|
+
|
|
62
|
+
context = this.getContext();
|
|
63
|
+
|
|
64
|
+
const generalContext = context; ///
|
|
65
|
+
|
|
66
|
+
context = specificContext; ///
|
|
64
67
|
|
|
65
68
|
statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
66
69
|
|
|
@@ -72,22 +75,25 @@ export default define(class Deduction extends Element {
|
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
unifyDeduction(deduction, substitutions, generalContext, specificContext) {
|
|
75
|
-
let deductionUnifies;
|
|
78
|
+
let deductionUnifies = false;
|
|
76
79
|
|
|
77
80
|
const context = specificContext, ///
|
|
81
|
+
generalDeduction = this, ///
|
|
78
82
|
specificDeduction = deduction, ///
|
|
79
|
-
generalDeductionString =
|
|
83
|
+
generalDeductionString = generalDeduction.getString(),
|
|
80
84
|
specificDeductionString = specificDeduction.getString();
|
|
81
85
|
|
|
82
|
-
context.trace(`Unifying the '${specificDeductionString}' deduction with the '${generalDeductionString}' deduction
|
|
86
|
+
context.trace(`Unifying the '${specificDeductionString}' deduction with the '${generalDeductionString}' deduction...`);
|
|
83
87
|
|
|
84
88
|
const statement = specificDeduction.getStatement(),
|
|
85
89
|
statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
86
90
|
|
|
87
|
-
|
|
91
|
+
if (statementUnifies) {
|
|
92
|
+
deductionUnifies = true;
|
|
93
|
+
}
|
|
88
94
|
|
|
89
95
|
if (deductionUnifies) {
|
|
90
|
-
context.debug(`...unified the '${specificDeductionString}' deduction with the '${generalDeductionString}' deduction
|
|
96
|
+
context.debug(`...unified the '${specificDeductionString}' deduction with the '${generalDeductionString}' deduction.`);
|
|
91
97
|
}
|
|
92
98
|
|
|
93
99
|
return deductionUnifies;
|
|
@@ -125,11 +131,7 @@ export default define(class Deduction extends Element {
|
|
|
125
131
|
const terms = termsFromJSON(json, context),
|
|
126
132
|
frames = framesFromJSON(json, context),
|
|
127
133
|
statement = statementFromJSON(json, context),
|
|
128
|
-
|
|
129
|
-
string = statement.getString(),
|
|
130
|
-
temporaryContext = TemporaryContext.fromTermsAndFrames(terms, frames, context);
|
|
131
|
-
|
|
132
|
-
context = temporaryContext; ///
|
|
134
|
+
string = statement.getString();
|
|
133
135
|
|
|
134
136
|
const deduction = new Deduction(context, string, statement);
|
|
135
137
|
|
|
@@ -27,12 +27,12 @@ export default define(class Derivation extends Element {
|
|
|
27
27
|
return lastProofAssertion;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
verify(
|
|
30
|
+
verify(context) {
|
|
31
31
|
let verifies;
|
|
32
32
|
|
|
33
33
|
verifies = this.subproofOrProofAssertions.every((subproofOrProofAssertion) => { ///
|
|
34
34
|
const assignments = [],
|
|
35
|
-
subproofOrProofAssertionVerifies = subproofOrProofAssertion.verify(
|
|
35
|
+
subproofOrProofAssertionVerifies = subproofOrProofAssertion.verify(assignments, context);
|
|
36
36
|
|
|
37
37
|
if (subproofOrProofAssertionVerifies) {
|
|
38
38
|
const assignmentsAssigned = assignAssignments(assignments, context);
|