occam-verify-cli 1.0.776 → 1.0.785
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/branching.js +1 -1
- package/lib/context/ephemeral.js +22 -11
- package/lib/context/file/nominal.js +4 -4
- package/lib/context/nested.js +5 -1
- package/lib/context/proof.js +74 -59
- package/lib/context.js +20 -20
- package/lib/element/assertion/contained.js +9 -3
- package/lib/element/assertion/defined.js +28 -22
- package/lib/element/assertion/property.js +5 -1
- package/lib/element/assertion/satisfies.js +5 -1
- package/lib/element/assertion/subproof.js +6 -1
- package/lib/element/assertion/type.js +6 -2
- package/lib/element/assumption.js +47 -20
- package/lib/element/equivalences.js +4 -2
- package/lib/element/frame.js +17 -41
- package/lib/element/judgement.js +42 -6
- package/lib/element/metavariable.js +15 -11
- package/lib/element/proofAssertion/step.js +44 -4
- package/lib/element/topLevelMetaAssertion.js +9 -9
- package/lib/nonTerminalNodeMap.js +1 -3
- package/lib/preamble.js +1 -2
- package/lib/process/instantiate.js +2 -8
- package/lib/process/unify.js +72 -5
- package/lib/ruleNames.js +1 -5
- package/lib/utilities/context.js +30 -10
- package/lib/utilities/element.js +18 -41
- package/lib/utilities/json.js +1 -23
- package/lib/utilities/string.js +8 -19
- package/lib/utilities/unification.js +13 -11
- package/lib/utilities/validation.js +17 -10
- package/package.json +4 -4
- package/src/context/branching.js +1 -1
- package/src/context/ephemeral.js +26 -10
- package/src/context/file/nominal.js +3 -3
- package/src/context/nested.js +6 -0
- package/src/context/proof.js +93 -73
- package/src/context.js +27 -26
- package/src/element/assertion/contained.js +16 -3
- package/src/element/assertion/defined.js +32 -23
- package/src/element/assertion/property.js +8 -1
- package/src/element/assertion/satisfies.js +8 -1
- package/src/element/assertion/subproof.js +8 -0
- package/src/element/assertion/type.js +8 -1
- package/src/element/assumption.js +72 -31
- package/src/element/equivalences.js +5 -2
- package/src/element/frame.js +29 -66
- package/src/element/judgement.js +56 -6
- package/src/element/metavariable.js +22 -18
- package/src/element/proofAssertion/step.js +4 -3
- package/src/element/topLevelMetaAssertion.js +13 -13
- package/src/nonTerminalNodeMap.js +0 -3
- package/src/preamble.js +0 -1
- package/src/process/instantiate.js +2 -6
- package/src/process/unify.js +117 -7
- package/src/ruleNames.js +0 -1
- package/src/utilities/context.js +43 -11
- package/src/utilities/element.js +26 -56
- package/src/utilities/json.js +0 -26
- package/src/utilities/string.js +8 -22
- package/src/utilities/unification.js +17 -16
- package/src/utilities/validation.js +24 -16
- package/lib/element/substitution/metaLevel.js +0 -148
- package/lib/node/substitution/metaLevel.js +0 -40
- package/lib/utilities/statement.js +0 -71
- package/src/element/substitution/metaLevel.js +0 -212
- package/src/node/substitution/metaLevel.js +0 -37
- package/src/utilities/statement.js +0 -66
package/src/process/unify.js
CHANGED
|
@@ -14,8 +14,9 @@ const typeNodeQuery = nodeQuery("/type"),
|
|
|
14
14
|
frameNodeQuery = nodeQuery("/frame"),
|
|
15
15
|
metaTypeNodeQuery = nodeQuery("/metaType"),
|
|
16
16
|
statementNodeQuery = nodeQuery("/statement"),
|
|
17
|
+
metavariableNodeQuery = nodeQuery("/metavariable"),
|
|
17
18
|
termVariableNodeQuery = nodeQuery("/term/variable!"),
|
|
18
|
-
|
|
19
|
+
frameMetavariableNodeQuery = nodeQuery("/frame/metavariable!"),
|
|
19
20
|
statementMetavariableNodeQuery = nodeQuery("/statement/metavariable!"),
|
|
20
21
|
assumptionMetavariableNodeQuery = nodeQuery("/assumption/metavariable!");
|
|
21
22
|
|
|
@@ -89,7 +90,7 @@ class MetaLevelPass extends ZipPassBase {
|
|
|
89
90
|
}
|
|
90
91
|
},
|
|
91
92
|
{
|
|
92
|
-
generalNodeQuery:
|
|
93
|
+
generalNodeQuery: frameMetavariableNodeQuery,
|
|
93
94
|
specificNodeQuery: frameNodeQuery,
|
|
94
95
|
run: (generalFrameMetavariableNode, specificFrameNode, generalContext, specificContext) => {
|
|
95
96
|
let success = false;
|
|
@@ -147,6 +148,98 @@ class MetaLevelPass extends ZipPassBase {
|
|
|
147
148
|
];
|
|
148
149
|
}
|
|
149
150
|
|
|
151
|
+
class AssumptionPass extends ZipPass {
|
|
152
|
+
static maps = [
|
|
153
|
+
{
|
|
154
|
+
generalNodeQuery: statementMetavariableNodeQuery,
|
|
155
|
+
specificNodeQuery: statementNodeQuery,
|
|
156
|
+
run: (generalStatementMetavariableNode, specificStatementNode, generalContext, specificContext) => {
|
|
157
|
+
let success = false;
|
|
158
|
+
|
|
159
|
+
const statementNode = specificStatementNode, ///
|
|
160
|
+
metavariableNode = generalStatementMetavariableNode, ///
|
|
161
|
+
metavariableName = metavariableNode.getMetavariableName();
|
|
162
|
+
|
|
163
|
+
let context;
|
|
164
|
+
|
|
165
|
+
context = generalContext; ///
|
|
166
|
+
|
|
167
|
+
const metavariable = context.findMetavariableByMetavariableName(metavariableName);
|
|
168
|
+
|
|
169
|
+
context = specificContext; ///
|
|
170
|
+
|
|
171
|
+
const statement = context.findStatementByStatementNode(statementNode),
|
|
172
|
+
substitution = null,
|
|
173
|
+
statementUnifies = metavariable.unifyStatement(statement, substitution, generalContext, specificContext);
|
|
174
|
+
|
|
175
|
+
if (statementUnifies) {
|
|
176
|
+
success = true;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return success;
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
generalNodeQuery: metavariableNodeQuery,
|
|
184
|
+
specificNodeQuery: metavariableNodeQuery,
|
|
185
|
+
run: (generalMetavariableNode, specificMetavariableNode, generalContext, specificContext) => {
|
|
186
|
+
let success = false;
|
|
187
|
+
|
|
188
|
+
let context,
|
|
189
|
+
metavariableNode;
|
|
190
|
+
|
|
191
|
+
context = generalContext; ///
|
|
192
|
+
|
|
193
|
+
metavariableNode = generalMetavariableNode; ///
|
|
194
|
+
|
|
195
|
+
const metavariableName = metavariableNode.getMetavariableName(),
|
|
196
|
+
metavariable = context.findMetavariableByMetavariableName(metavariableName);
|
|
197
|
+
|
|
198
|
+
context = specificContext; ///
|
|
199
|
+
|
|
200
|
+
metavariableNode = specificMetavariableNode; ///
|
|
201
|
+
|
|
202
|
+
const reference = context.findReferenceByMetavariableNode(metavariableNode),
|
|
203
|
+
referenceUnifies = metavariable.unifyReference(reference, generalContext, specificContext);
|
|
204
|
+
|
|
205
|
+
if (referenceUnifies) {
|
|
206
|
+
success = true;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return success;
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
generalNodeQuery: termVariableNodeQuery,
|
|
214
|
+
specificNodeQuery: termNodeQuery,
|
|
215
|
+
run: (generalTermVariableNode, specificTermNode, generalContext, specificContext) => {
|
|
216
|
+
let success = false;
|
|
217
|
+
|
|
218
|
+
const termNode = specificTermNode, ///
|
|
219
|
+
variableNode = generalTermVariableNode, ///
|
|
220
|
+
variableIdentifier = variableNode.getVariableIdentifier();
|
|
221
|
+
|
|
222
|
+
let context;
|
|
223
|
+
|
|
224
|
+
context = generalContext; ///
|
|
225
|
+
|
|
226
|
+
const variable = context.findVariableByVariableIdentifier(variableIdentifier);
|
|
227
|
+
|
|
228
|
+
context = specificContext; ///
|
|
229
|
+
|
|
230
|
+
const term = context.findTermByTermNode(termNode),
|
|
231
|
+
termUnifies = variable.unifyTerm(term, generalContext, specificContext);
|
|
232
|
+
|
|
233
|
+
if (termUnifies) {
|
|
234
|
+
success = true;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return success;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
];
|
|
241
|
+
}
|
|
242
|
+
|
|
150
243
|
class CombinatorPass extends ZipPass {
|
|
151
244
|
static maps = [
|
|
152
245
|
{
|
|
@@ -307,7 +400,7 @@ class MetavariablePass extends ZipPass {
|
|
|
307
400
|
class SubstitutionPass extends ZipPass {
|
|
308
401
|
static maps = [
|
|
309
402
|
{
|
|
310
|
-
generalNodeQuery:
|
|
403
|
+
generalNodeQuery: frameMetavariableNodeQuery,
|
|
311
404
|
specificNodeQuery: frameNodeQuery,
|
|
312
405
|
run: (generalFrameMetavariableNode, specificFrameNode, generalContext, specificContext) => {
|
|
313
406
|
let success = false;
|
|
@@ -399,6 +492,7 @@ class IntrinsicLevelPass extends ZipPass {
|
|
|
399
492
|
}
|
|
400
493
|
|
|
401
494
|
const metaLevelPass = new MetaLevelPass(),
|
|
495
|
+
assumptionPass = new AssumptionPass(),
|
|
402
496
|
combinatorPass = new CombinatorPass(),
|
|
403
497
|
constructorPass = new ConstructorPass(),
|
|
404
498
|
metavariablePass = new MetavariablePass(),
|
|
@@ -421,14 +515,30 @@ export function unifyStatement(generalStatement, specificStatement, generalConte
|
|
|
421
515
|
return statementUnifies;
|
|
422
516
|
}
|
|
423
517
|
|
|
518
|
+
export function unifyAssumption(generalAssumption, specificAssumption, generalContext, specificContext) {
|
|
519
|
+
let assumptionUnifies = false;
|
|
520
|
+
|
|
521
|
+
const generalAssumptionNode = generalAssumption.getNode(),
|
|
522
|
+
specificAssumptionNode = specificAssumption.getNode(),
|
|
523
|
+
generalNode = generalAssumptionNode, ///
|
|
524
|
+
specificNode = specificAssumptionNode, ///
|
|
525
|
+
success = assumptionPass.run(generalNode, specificNode, generalContext, specificContext);
|
|
526
|
+
|
|
527
|
+
if (success) {
|
|
528
|
+
assumptionUnifies = true;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
return assumptionUnifies;
|
|
532
|
+
}
|
|
533
|
+
|
|
424
534
|
export function unifySubstitution(generalSubstitution, specificSubstitution, generalContext, specificContext) {
|
|
425
535
|
let substitutionUnifies = false;
|
|
426
536
|
|
|
427
537
|
const generalSubstitutionNode = generalSubstitution.getNode(),
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
538
|
+
specificSubstitutionNode = specificSubstitution.getNode(),
|
|
539
|
+
generalNode = generalSubstitutionNode, ///
|
|
540
|
+
specificNode = specificSubstitutionNode, ///
|
|
541
|
+
success = substitutionPass.run(generalNode, specificNode, generalContext, specificContext);
|
|
432
542
|
|
|
433
543
|
if (success) {
|
|
434
544
|
substitutionUnifies = true;
|
package/src/ruleNames.js
CHANGED
|
@@ -78,7 +78,6 @@ export const VARIABLE_DECLARATION_RULE_NAME = "variableDeclaration";
|
|
|
78
78
|
export const COMBINATOR_DECLARATION_RULE_NAME = "combinatorDeclaration";
|
|
79
79
|
export const STATEMENT_SUBSTITUTION_RULE_NAME = "statementSubstitution";
|
|
80
80
|
export const REFERENCE_SUBSTITUTION_RULE_NAME = "referenceSubstitution";
|
|
81
|
-
export const META_LEVEL_SUBSTITUTION_RULE_NAME = "metaLevelSubstitution";
|
|
82
81
|
export const TYPE_PREFIX_DECLARATION_RULE_NAME = "typePrefixDeclaration";
|
|
83
82
|
export const SIMPLE_TYPE_DECLARATION_RULE_NAME = "simpleTypeDeclaration";
|
|
84
83
|
export const CONSTRUCTOR_DECLARATION_RULE_NAME = "constructorDeclaration";
|
package/src/utilities/context.js
CHANGED
|
@@ -91,13 +91,7 @@ export function nominally(innerFunction) {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
export function simplify(innerFunction, context) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
while (contextExtraneousContext) {
|
|
97
|
-
context = context.getContext();
|
|
98
|
-
|
|
99
|
-
contextExtraneousContext = isContextExtraneousContext(context);
|
|
100
|
-
}
|
|
94
|
+
context = removeExtraneousContexts(context);
|
|
101
95
|
|
|
102
96
|
const ephemeralContext = EphemeralContext.fromNothing(context);
|
|
103
97
|
|
|
@@ -124,14 +118,14 @@ export function unserialise(innerFunction, json, context) {
|
|
|
124
118
|
return innerFunction(json, context);
|
|
125
119
|
}
|
|
126
120
|
|
|
127
|
-
export async function asyncRestrict(innerFunction,
|
|
121
|
+
export async function asyncRestrict(innerFunction, assumptions, context) {
|
|
128
122
|
if (context === undefined) {
|
|
129
|
-
context =
|
|
123
|
+
context = assumptions; ///
|
|
130
124
|
|
|
131
|
-
|
|
125
|
+
assumptions = null;
|
|
132
126
|
}
|
|
133
127
|
|
|
134
|
-
const proofContext = ProofContext.
|
|
128
|
+
const proofContext = ProofContext.fromAssumptions(assumptions, context);
|
|
135
129
|
|
|
136
130
|
context = proofContext; ///
|
|
137
131
|
|
|
@@ -158,3 +152,41 @@ function isContextExtraneousContext(context) {
|
|
|
158
152
|
|
|
159
153
|
return contextExtraneousContext;
|
|
160
154
|
}
|
|
155
|
+
|
|
156
|
+
function removeExtraneousContexts(context) {
|
|
157
|
+
context = trimExtraneousContexts(context);
|
|
158
|
+
|
|
159
|
+
const firstContext = context; ///
|
|
160
|
+
|
|
161
|
+
let currentContext = context; ///
|
|
162
|
+
|
|
163
|
+
while (currentContext !== null) {
|
|
164
|
+
context = currentContext.getContext();
|
|
165
|
+
|
|
166
|
+
context = trimExtraneousContexts(context);
|
|
167
|
+
|
|
168
|
+
currentContext.setContext(context);
|
|
169
|
+
|
|
170
|
+
currentContext = context; ///
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
context = firstContext; ///
|
|
174
|
+
|
|
175
|
+
return context;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function trimExtraneousContexts(context) {
|
|
179
|
+
let contextExtraneousContext = isContextExtraneousContext(context);
|
|
180
|
+
|
|
181
|
+
while (contextExtraneousContext) {
|
|
182
|
+
context = context.getContext();
|
|
183
|
+
|
|
184
|
+
if (context === null) {
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
contextExtraneousContext = isContextExtraneousContext(context);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return context;
|
|
192
|
+
}
|
package/src/utilities/element.js
CHANGED
|
@@ -348,11 +348,11 @@ export function metaLemmaFromMetaLemmaNode(metaLemmaNode, context) {
|
|
|
348
348
|
label = labelFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
349
349
|
deduction = deductionFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
350
350
|
suppositions = suppositionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
351
|
-
|
|
351
|
+
assumptions = assumptionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
352
352
|
topLevelMetaAssertionString = topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction(label, suppositions, deduction),
|
|
353
353
|
node = metaLemmaMetathoremNode, ///
|
|
354
354
|
string = topLevelMetaAssertionString, ///
|
|
355
|
-
metaLemma = new MetaLemma(context, string, node, label, suppositions, deduction, proof,
|
|
355
|
+
metaLemma = new MetaLemma(context, string, node, label, suppositions, deduction, proof, assumptions);
|
|
356
356
|
|
|
357
357
|
return metaLemma;
|
|
358
358
|
}
|
|
@@ -437,20 +437,6 @@ export function conclusionFromConclusionNode(conclusionNode, context) {
|
|
|
437
437
|
return conclusion;
|
|
438
438
|
}
|
|
439
439
|
|
|
440
|
-
export function assumptionFromAssumptionNode(assumptionNode, context) {
|
|
441
|
-
const { Assumption } = elements,
|
|
442
|
-
node = assumptionNode, ///
|
|
443
|
-
string = context.nodeAsString(node),
|
|
444
|
-
reference = referenceFromAssumptionNode(assumptionNode, context),
|
|
445
|
-
statement = statementFromAssumptionNode(assumptionNode, context);
|
|
446
|
-
|
|
447
|
-
context = null;
|
|
448
|
-
|
|
449
|
-
const assumption = new Assumption(context, string, node, reference, statement);
|
|
450
|
-
|
|
451
|
-
return assumption;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
440
|
export function derivationFromDerivationNode(derivationNode, context) {
|
|
455
441
|
const { Derivation } = elements,
|
|
456
442
|
node = derivationNode, ///
|
|
@@ -478,6 +464,20 @@ export function typePrefixFromTypePrefixNode(typePrefixNode, context) {
|
|
|
478
464
|
return typePrefix;
|
|
479
465
|
}
|
|
480
466
|
|
|
467
|
+
export function assumptionFromAssumptionNode(assumptionNode, context) {
|
|
468
|
+
const { Assumption } = elements,
|
|
469
|
+
node = assumptionNode, ///
|
|
470
|
+
string = context.nodeAsString(node),
|
|
471
|
+
reference = referenceFromAssumptionNode(assumptionNode, context),
|
|
472
|
+
statement = statementFromAssumptionNode(assumptionNode, context);
|
|
473
|
+
|
|
474
|
+
context = null;
|
|
475
|
+
|
|
476
|
+
const assumption = new Assumption(context, string, node, reference, statement);
|
|
477
|
+
|
|
478
|
+
return assumption;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
481
|
export function constructorFromConstructorNode(constructorNode, context) {
|
|
482
482
|
const { Constructor } = elements,
|
|
483
483
|
node = constructorNode, ///
|
|
@@ -525,11 +525,11 @@ export function metatheoremFromMetatheoremNode(metatheoremNode, context) {
|
|
|
525
525
|
label = labelFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
526
526
|
deduction = deductionFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
527
527
|
suppositions = suppositionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
528
|
-
|
|
528
|
+
assumptions = assumptionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
529
529
|
topLevelMetaAssertionString = topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction(label, suppositions, deduction),
|
|
530
530
|
node = metaLemmaMetathoremNode, ///
|
|
531
531
|
string = topLevelMetaAssertionString, ///
|
|
532
|
-
metatheorem = new Metatheorem(context, string, node, label, suppositions, deduction, proof,
|
|
532
|
+
metatheorem = new Metatheorem(context, string, node, label, suppositions, deduction, proof, assumptions);
|
|
533
533
|
|
|
534
534
|
return metatheorem;
|
|
535
535
|
}
|
|
@@ -788,21 +788,6 @@ export function statementSubstitutionFromStatementSubstitutionNode(statementSubs
|
|
|
788
788
|
return statementSubstitution;
|
|
789
789
|
}
|
|
790
790
|
|
|
791
|
-
export function metaLevelSubstitutionFromMetaLevelSubstitutionNode(metaLevelSubstitutionNode, context) {
|
|
792
|
-
const { MetaLevelSubstitution } = elements,
|
|
793
|
-
node = metaLevelSubstitutionNode, ///
|
|
794
|
-
string = context.nodeAsString(node),
|
|
795
|
-
targetReference = targetReferenceFromMetaLevelSubstitutionNode(metaLevelSubstitutionNode, context),
|
|
796
|
-
replacementStatement = replacementStatementFromMetaLevelSubstitutionNode(metaLevelSubstitutionNode, context),
|
|
797
|
-
ephemeralContext = context.retrieveEphemeralContext();
|
|
798
|
-
|
|
799
|
-
context = ephemeralContext; ///
|
|
800
|
-
|
|
801
|
-
const metaLevelSubstitution = new MetaLevelSubstitution(context, string, node, targetReference, replacementStatement);
|
|
802
|
-
|
|
803
|
-
return metaLevelSubstitution;
|
|
804
|
-
}
|
|
805
|
-
|
|
806
791
|
export function constructorDeclarationFromConstructorDeclarationNode(constructorDeclarationNode, context) {
|
|
807
792
|
const { ConstructorDeclaration } = elements,
|
|
808
793
|
node = constructorDeclarationNode, ///
|
|
@@ -1813,6 +1798,12 @@ export function metaTypeFromMetavariableDeclarationNode(metavariableDeclarationN
|
|
|
1813
1798
|
return metaType;
|
|
1814
1799
|
}
|
|
1815
1800
|
|
|
1801
|
+
export function assumptionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context) {
|
|
1802
|
+
const assumptions = [];
|
|
1803
|
+
|
|
1804
|
+
return assumptions;
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1816
1807
|
export function provisionalFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context) {
|
|
1817
1808
|
const provisional = simpleTypeDeclarationNode.isProvisional();
|
|
1818
1809
|
|
|
@@ -1891,17 +1882,9 @@ export function metavariableFromMetavariableDeclarationNode(metavariableDeclarat
|
|
|
1891
1882
|
export function targetReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode, context) {
|
|
1892
1883
|
const targetReferenceNode = referenceSubstitutionNode.getTargetReferenceNode(),
|
|
1893
1884
|
targetReferenceString = context.nodeAsString(targetReferenceNode),
|
|
1894
|
-
|
|
1885
|
+
targetReference = referenceFromReferenceString(targetReferenceString, context);
|
|
1895
1886
|
|
|
1896
|
-
return
|
|
1897
|
-
}
|
|
1898
|
-
|
|
1899
|
-
export function targetReferenceFromMetaLevelSubstitutionNode(metaLevelSubstitutionNode, context) {
|
|
1900
|
-
const targetReferenceNode = metaLevelSubstitutionNode.getTargetReferenceNode(),
|
|
1901
|
-
targetReferenceString = context.nodeAsString(targetReferenceNode),
|
|
1902
|
-
targetRefernece = referenceFromReferenceString(targetReferenceString, context);
|
|
1903
|
-
|
|
1904
|
-
return targetRefernece;
|
|
1887
|
+
return targetReference;
|
|
1905
1888
|
}
|
|
1906
1889
|
|
|
1907
1890
|
export function targetStatementFromStatementSubstitutionNode(statementSubstitutionNode, context) {
|
|
@@ -1950,19 +1933,6 @@ export function replacementStatementFromStatementSubstitutionNode(statementSubst
|
|
|
1950
1933
|
return replacementStatement;
|
|
1951
1934
|
}
|
|
1952
1935
|
|
|
1953
|
-
export function replacementStatementFromMetaLevelSubstitutionNode(metaLevelSubstitutionNode, context) {
|
|
1954
|
-
const replacementStatementNode = metaLevelSubstitutionNode.getReplacementStatementNode(),
|
|
1955
|
-
replacementStatement = statementFromStatementNode(replacementStatementNode, context);
|
|
1956
|
-
|
|
1957
|
-
return replacementStatement;
|
|
1958
|
-
}
|
|
1959
|
-
|
|
1960
|
-
export function metaLevelSubstitutionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context) {
|
|
1961
|
-
const metaLevelSubstitutions = [];
|
|
1962
|
-
|
|
1963
|
-
return metaLevelSubstitutions;
|
|
1964
|
-
}
|
|
1965
|
-
|
|
1966
1936
|
export function termsFromTermNodes(termNodes, context) {
|
|
1967
1937
|
const terms = termNodes.map((termNode) => {
|
|
1968
1938
|
const term = termFromTermNode(termNode, context);
|
package/src/utilities/json.js
CHANGED
|
@@ -703,22 +703,6 @@ export function propertyRelationsFromJSON(json, context) {
|
|
|
703
703
|
return propertyRelations;
|
|
704
704
|
}
|
|
705
705
|
|
|
706
|
-
export function metaLevelSubstitutionsFromJSON(json, context) {
|
|
707
|
-
let { metaLevelSubstitutions } = json; ///
|
|
708
|
-
|
|
709
|
-
const { MetaLevelSubstitution } = elements,
|
|
710
|
-
metaLevelSubstitutionsJSON = metaLevelSubstitutions; ///
|
|
711
|
-
|
|
712
|
-
metaLevelSubstitutions = metaLevelSubstitutionsJSON.map((metaLevelSubstitutionJSON) => {
|
|
713
|
-
const json = metaLevelSubstitutionJSON, ///
|
|
714
|
-
metaLevelSubstitution = MetaLevelSubstitution.fromJSON(json, context);
|
|
715
|
-
|
|
716
|
-
return metaLevelSubstitution;
|
|
717
|
-
});
|
|
718
|
-
|
|
719
|
-
return metaLevelSubstitutions;
|
|
720
|
-
}
|
|
721
|
-
|
|
722
706
|
export function nameToNameJSON(name) {
|
|
723
707
|
const nameJSON = name; ///
|
|
724
708
|
|
|
@@ -1127,16 +1111,6 @@ export function propertyRelationsToPropertyRelationsJSON(propertyRelations) {
|
|
|
1127
1111
|
return propertyRelationsJSON;
|
|
1128
1112
|
}
|
|
1129
1113
|
|
|
1130
|
-
export function metaLevelSubstitutionsToMetaLevelSubstitutionsJSON(metaLevelSubstitutions) {
|
|
1131
|
-
const metaLevelSubstitutionsJSON = metaLevelSubstitutions.map((metaLevelSubstitution) => {
|
|
1132
|
-
const metaLevelSubstitutionJSON = metaLevelSubstitution.toJSON();
|
|
1133
|
-
|
|
1134
|
-
return metaLevelSubstitutionJSON;
|
|
1135
|
-
});
|
|
1136
|
-
|
|
1137
|
-
return metaLevelSubstitutionsJSON;
|
|
1138
|
-
}
|
|
1139
|
-
|
|
1140
1114
|
function findTypeByName(name, context) {
|
|
1141
1115
|
const typeName = name, ///
|
|
1142
1116
|
type = context.findTypeByTypeName(typeName);
|
package/src/utilities/string.js
CHANGED
|
@@ -117,20 +117,6 @@ export function suppositionsStringFromSuppositions(suppositions) {
|
|
|
117
117
|
return suppositionsString;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
export function metaLevelSubstitutionsStringFromMetaLevelSubstitutions(metaLevelSubstitutions) {
|
|
121
|
-
const metaLevelSubstitutionsString = metaLevelSubstitutions.reduce((metaLevelSubstitutionsString, metaLevelSubstitution) => {
|
|
122
|
-
const metaLevelSubstitutionString = metaLevelSubstitution.getString();
|
|
123
|
-
|
|
124
|
-
metaLevelSubstitutionsString = (metaLevelSubstitutionsString === null) ?
|
|
125
|
-
metaLevelSubstitutionString: ///
|
|
126
|
-
`${metaLevelSubstitutionsString}, ${metaLevelSubstitutionString}`;
|
|
127
|
-
|
|
128
|
-
return metaLevelSubstitutionsString;
|
|
129
|
-
}, null);
|
|
130
|
-
|
|
131
|
-
return metaLevelSubstitutionsString;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
120
|
export function signatureStringFromTerms(terms) {
|
|
135
121
|
const termsString = termsStringFromTerms(terms),
|
|
136
122
|
signatureString = `[${termsString}]`;
|
|
@@ -151,6 +137,14 @@ export function typeStringFromNominalTypeName(nominalTypeName) {
|
|
|
151
137
|
return typeString;
|
|
152
138
|
}
|
|
153
139
|
|
|
140
|
+
export function assumptionStringFromStatementAndReference(statement, reference) {
|
|
141
|
+
const statementString = statement.getString(),
|
|
142
|
+
referneceString = reference.getString(),
|
|
143
|
+
assumptionString = `${referneceString} :: ${statementString}`;
|
|
144
|
+
|
|
145
|
+
return assumptionString;
|
|
146
|
+
}
|
|
147
|
+
|
|
154
148
|
export function termSubstitutionStringFromTermAndVariable(term, variable) {
|
|
155
149
|
const termString = term.getString(),
|
|
156
150
|
variableString = variable.getString(),
|
|
@@ -198,14 +192,6 @@ export function frameSubstitutionStringFromFrameAndMetavariable(frame, metavaria
|
|
|
198
192
|
return string;
|
|
199
193
|
}
|
|
200
194
|
|
|
201
|
-
export function metaLevelSubstitutionStringFromStatementAndReference(statement, reference) {
|
|
202
|
-
const statementString = statement.getString(),
|
|
203
|
-
referenceString = reference.getString(),
|
|
204
|
-
metaLevelSubstitutionString = `[${statementString} for ${referenceString}]`;
|
|
205
|
-
|
|
206
|
-
return metaLevelSubstitutionString;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
195
|
export function procedureCallStringFromProcedureReferenceAndParameters(procedureReference, parameters) {
|
|
210
196
|
const procedureReferenceName = procedureReference.getName(),
|
|
211
197
|
parametersString = parametersStringFromParameters(parameters),
|
|
@@ -5,10 +5,6 @@ import { arrayUtilities } from "necessary";
|
|
|
5
5
|
import elements from "../elements";
|
|
6
6
|
|
|
7
7
|
import { descend } from "./context";
|
|
8
|
-
import { judgementFromStatement,
|
|
9
|
-
typeAssertionFromStatement,
|
|
10
|
-
propertyAssertionFromStatement,
|
|
11
|
-
satisfiesAssertionFromStatement } from "../utilities/statement";
|
|
12
8
|
|
|
13
9
|
const { backwardsSome } = arrayUtilities;
|
|
14
10
|
|
|
@@ -59,17 +55,17 @@ async function unifyStatementWithReference(statement, reference, satisfiesAssert
|
|
|
59
55
|
statementUnifiesWithReference = true;
|
|
60
56
|
}
|
|
61
57
|
} else {
|
|
62
|
-
const
|
|
58
|
+
const metaLevel = context.isMetaLevel();
|
|
63
59
|
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
specificContext = context; ///
|
|
60
|
+
if (metaLevel) {
|
|
61
|
+
descend((context) => {
|
|
62
|
+
const { Assumption } = elements,
|
|
63
|
+
assumption = Assumption.fromStatementAndReference(statement, reference, context);
|
|
69
64
|
|
|
70
|
-
|
|
65
|
+
assumption.validate(context, metaLevel);
|
|
71
66
|
|
|
72
|
-
|
|
67
|
+
statementUnifiesWithReference = true;
|
|
68
|
+
}, context);
|
|
73
69
|
}
|
|
74
70
|
}
|
|
75
71
|
|
|
@@ -84,7 +80,9 @@ async function unifyStatementWithReference(statement, reference, satisfiesAssert
|
|
|
84
80
|
async function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAssertion, context) {
|
|
85
81
|
let statementUnifiesAsSatisfiesAssertion = false;
|
|
86
82
|
|
|
87
|
-
|
|
83
|
+
const { SatisfiesAssertion } = elements;
|
|
84
|
+
|
|
85
|
+
satisfiesAssertion = SatisfiesAssertion.fromStatement(statement, context);
|
|
88
86
|
|
|
89
87
|
if (satisfiesAssertion !== null) {
|
|
90
88
|
const statementString = statement.getString();
|
|
@@ -202,7 +200,8 @@ async function unifyStatementAsJudgement(statement, reference, satisfiesAssertio
|
|
|
202
200
|
let statementUnifiesAsJudgement = false;
|
|
203
201
|
|
|
204
202
|
if (reference === null) {
|
|
205
|
-
const
|
|
203
|
+
const { Judgement } = elements,
|
|
204
|
+
judgement = Judgement.fromStatement(statement, context);
|
|
206
205
|
|
|
207
206
|
if (judgement !== null) {
|
|
208
207
|
const statementString = statement.getString();
|
|
@@ -224,7 +223,8 @@ async function unifyStatementAsTypeAssertion(statement, reference, satisfiesAsse
|
|
|
224
223
|
let statementUnifiesAsTypeAssertion = false;
|
|
225
224
|
|
|
226
225
|
if (reference === null) {
|
|
227
|
-
const
|
|
226
|
+
const { TypeAssertion } = elements,
|
|
227
|
+
typeAssertion = TypeAssertion.fromStatement(statement, context);
|
|
228
228
|
|
|
229
229
|
if (typeAssertion !== null) {
|
|
230
230
|
const statementString = statement.getString();
|
|
@@ -244,7 +244,8 @@ async function unifyStatementAsPropertyAssertion(statement, reference, satisfies
|
|
|
244
244
|
let statementUnifiesAsPropertyAssertion = false;
|
|
245
245
|
|
|
246
246
|
if (reference === null) {
|
|
247
|
-
const
|
|
247
|
+
const { PropertyAssertion } = elements,
|
|
248
|
+
propertyAssertion = PropertyAssertion.fromStatement(statement, context);
|
|
248
249
|
|
|
249
250
|
if (propertyAssertion !== null) {
|
|
250
251
|
const statementString = statement.getString();
|
|
@@ -4,14 +4,6 @@ import elements from "../elements";
|
|
|
4
4
|
|
|
5
5
|
import { choose, descend } from "./context";
|
|
6
6
|
import { bracketedConstructorFromNothing, bracketedCombinatorFromNothing } from "../utilities/instance";
|
|
7
|
-
import { judgementFromStatement,
|
|
8
|
-
metavariableFromStatement,
|
|
9
|
-
typeAssertionFromStatement,
|
|
10
|
-
definedAssertionFromStatement,
|
|
11
|
-
propertyAssertionFromStatement,
|
|
12
|
-
subproofAssertionFromStatement,
|
|
13
|
-
containedAssertionFromStatement,
|
|
14
|
-
satisfiesAssertionFromStatement } from "../utilities/statement";
|
|
15
7
|
|
|
16
8
|
function validateTermAsVariable(term, context, validateForwards) {
|
|
17
9
|
let termValidatesAsVariable = false;
|
|
@@ -91,9 +83,11 @@ function unifyTermWithBracketedConstructor(term, context, validateForwards) {
|
|
|
91
83
|
function validateStatementAsMetavariable(statement, context) {
|
|
92
84
|
let statementValidatesAsMetavariable = false;
|
|
93
85
|
|
|
86
|
+
const { Metavariable } = elements;
|
|
87
|
+
|
|
94
88
|
let metavariable;
|
|
95
89
|
|
|
96
|
-
metavariable =
|
|
90
|
+
metavariable = Metavariable.fromStatement(statement, context);
|
|
97
91
|
|
|
98
92
|
if (metavariable !== null) {
|
|
99
93
|
const statementString = statement.getString();
|
|
@@ -206,7 +200,9 @@ function validateStatementAsJudgement(statement, context) {
|
|
|
206
200
|
|
|
207
201
|
let judgement;
|
|
208
202
|
|
|
209
|
-
|
|
203
|
+
const { Judgement } = elements;
|
|
204
|
+
|
|
205
|
+
judgement = Judgement.fromStatement(statement, context);
|
|
210
206
|
|
|
211
207
|
if (judgement !== null) {
|
|
212
208
|
const statementString = statement.getString();
|
|
@@ -230,9 +226,11 @@ function validateStatementAsJudgement(statement, context) {
|
|
|
230
226
|
function validateStatementAsTypeAssertion(statement, context) {
|
|
231
227
|
let validatesStatementAsTypeAssertion = false;
|
|
232
228
|
|
|
229
|
+
const { TypeAssertion } = elements;
|
|
230
|
+
|
|
233
231
|
let typeAssertion;
|
|
234
232
|
|
|
235
|
-
typeAssertion =
|
|
233
|
+
typeAssertion = TypeAssertion.fromStatement(statement, context);
|
|
236
234
|
|
|
237
235
|
if (typeAssertion !== null) {
|
|
238
236
|
const statementString = statement.getString();
|
|
@@ -256,9 +254,11 @@ function validateStatementAsTypeAssertion(statement, context) {
|
|
|
256
254
|
function validateStatementAsDefinedAssertion(statement, context) {
|
|
257
255
|
let validatesStatementAsDefinedAssertion = false;
|
|
258
256
|
|
|
257
|
+
const { DefinedAssertion } = elements;
|
|
258
|
+
|
|
259
259
|
let definedAssertion;
|
|
260
260
|
|
|
261
|
-
definedAssertion =
|
|
261
|
+
definedAssertion = DefinedAssertion.fromStatement(statement, context);
|
|
262
262
|
|
|
263
263
|
if (definedAssertion !== null) {
|
|
264
264
|
const statementString = statement.getString();
|
|
@@ -282,9 +282,11 @@ function validateStatementAsDefinedAssertion(statement, context) {
|
|
|
282
282
|
function validateStatementAsPropertyAssertion(statement, context) {
|
|
283
283
|
let statementValidatesAsPropertyAssertion = false;
|
|
284
284
|
|
|
285
|
+
const { PropertyAssertion } = elements;
|
|
286
|
+
|
|
285
287
|
let propertyAssertion;
|
|
286
288
|
|
|
287
|
-
propertyAssertion =
|
|
289
|
+
propertyAssertion = PropertyAssertion.fromStatement(statement, context);
|
|
288
290
|
|
|
289
291
|
if (propertyAssertion !== null) {
|
|
290
292
|
const statementString = statement.getString();
|
|
@@ -308,9 +310,11 @@ function validateStatementAsPropertyAssertion(statement, context) {
|
|
|
308
310
|
function validateStatementAsSubproofAssertion(statement, context) {
|
|
309
311
|
let statementValidatesAsSubproofAssertion = false;
|
|
310
312
|
|
|
313
|
+
const { SubproofAssertion } = elements;
|
|
314
|
+
|
|
311
315
|
let subproofAssertion;
|
|
312
316
|
|
|
313
|
-
subproofAssertion =
|
|
317
|
+
subproofAssertion = SubproofAssertion.fromStatement(statement, context);
|
|
314
318
|
|
|
315
319
|
if (subproofAssertion !== null) {
|
|
316
320
|
const statementString = statement.getString();
|
|
@@ -334,9 +338,11 @@ function validateStatementAsSubproofAssertion(statement, context) {
|
|
|
334
338
|
function validateStatementAsContainedAssertion(statement, context) {
|
|
335
339
|
let validatesStatementAsContainedAssertion = false;
|
|
336
340
|
|
|
341
|
+
const { ContainedAssertion } = elements;
|
|
342
|
+
|
|
337
343
|
let containedAssertion;
|
|
338
344
|
|
|
339
|
-
containedAssertion =
|
|
345
|
+
containedAssertion = ContainedAssertion.fromStatement(statement, context);
|
|
340
346
|
|
|
341
347
|
if (containedAssertion !== null) {
|
|
342
348
|
const statementString = statement.getString();
|
|
@@ -360,9 +366,11 @@ function validateStatementAsContainedAssertion(statement, context) {
|
|
|
360
366
|
function validateStatementAsSatisfiesAssertion(statement, context) {
|
|
361
367
|
let validatesAStatementsSatisfiesAssertion = false;
|
|
362
368
|
|
|
369
|
+
const { SatisfiesAssertion } = elements;
|
|
370
|
+
|
|
363
371
|
let satisfiesAssertion;
|
|
364
372
|
|
|
365
|
-
satisfiesAssertion =
|
|
373
|
+
satisfiesAssertion = SatisfiesAssertion.fromStatement(statement, context);
|
|
366
374
|
|
|
367
375
|
if (satisfiesAssertion !== null) {
|
|
368
376
|
const statementString = statement.getString();
|