occam-verify-cli 1.0.792 → 1.0.796
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/ephemeral.js +2 -7
- package/lib/context/file/nominal.js +5 -1
- package/lib/context/liminal.js +39 -16
- package/lib/context/proof.js +35 -40
- package/lib/context.js +11 -3
- package/lib/element/assumption/metaLevel.js +181 -0
- package/lib/element/assumption.js +20 -38
- package/lib/element/judgement.js +11 -13
- package/lib/element/metavariable.js +28 -25
- package/lib/element/substitution/reference.js +20 -1
- package/lib/element/substitution/statement.js +22 -2
- package/lib/element/topLevelMetaAssertion.js +9 -9
- package/lib/node/assumption/metaLevel.js +27 -0
- package/lib/node/assumption.js +5 -5
- package/lib/nonTerminalNodeMap.js +3 -1
- package/lib/preamble.js +2 -1
- package/lib/process/instantiate.js +8 -2
- package/lib/process/unify.js +15 -28
- package/lib/ruleNames.js +5 -1
- package/lib/utilities/context.js +5 -5
- package/lib/utilities/element.js +33 -18
- package/lib/utilities/json.js +23 -1
- package/lib/utilities/string.js +25 -14
- package/lib/utilities/unification.js +3 -3
- package/lib/utilities/validation.js +9 -14
- package/package.json +4 -4
- package/src/context/ephemeral.js +1 -9
- package/src/context/file/nominal.js +6 -0
- package/src/context/liminal.js +54 -16
- package/src/context/proof.js +41 -47
- package/src/context.js +15 -2
- package/src/element/assumption/metaLevel.js +263 -0
- package/src/element/assumption.js +30 -56
- package/src/element/judgement.js +13 -21
- package/src/element/metavariable.js +29 -28
- package/src/element/substitution/reference.js +33 -0
- package/src/element/substitution/statement.js +33 -1
- package/src/element/topLevelMetaAssertion.js +15 -15
- package/src/node/assumption/metaLevel.js +23 -0
- package/src/node/assumption.js +8 -8
- package/src/nonTerminalNodeMap.js +3 -0
- package/src/preamble.js +1 -0
- package/src/process/instantiate.js +4 -0
- package/src/process/unify.js +18 -39
- package/src/ruleNames.js +1 -0
- package/src/utilities/context.js +4 -4
- package/src/utilities/element.js +44 -25
- package/src/utilities/json.js +27 -1
- package/src/utilities/string.js +34 -19
- package/src/utilities/unification.js +3 -3
- package/src/utilities/validation.js +10 -16
|
@@ -70,6 +70,23 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
70
70
|
return comparesToParameter;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
compareSubstitution(substitution) {
|
|
74
|
+
let substitutionCompares = false;
|
|
75
|
+
|
|
76
|
+
const substitutionReferenceSubstitution = (substitution instanceof ReferenceSubstitution);
|
|
77
|
+
|
|
78
|
+
if (substitutionReferenceSubstitution) {
|
|
79
|
+
const substitutionNode = substitution.getNode(),
|
|
80
|
+
substitutionNodeMatches = this.matchNode(substitutionNode);
|
|
81
|
+
|
|
82
|
+
if (substitutionNodeMatches) {
|
|
83
|
+
substitutionCompares = true;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return substitutionCompares;
|
|
88
|
+
}
|
|
89
|
+
|
|
73
90
|
validate(generalContext, specificContext) {
|
|
74
91
|
let referenceSubstitution = null;
|
|
75
92
|
|
|
@@ -199,6 +216,22 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
199
216
|
|
|
200
217
|
return referenceSubstitution;
|
|
201
218
|
}
|
|
219
|
+
|
|
220
|
+
static fromAssumptionAndMetaLevelAssumption(assumption, metaLevelAssumption, context) {
|
|
221
|
+
let referenceSubstitution;
|
|
222
|
+
|
|
223
|
+
instantiate((context) => {
|
|
224
|
+
const reference = metaLevelAssumption.getReference(),
|
|
225
|
+
metavariable = assumption.getMetavariable(),
|
|
226
|
+
referenceSubstitutionString = referenceSubstitutionStringFromReferenceAndMetavariable(reference, metavariable),
|
|
227
|
+
string = referenceSubstitutionString, ///
|
|
228
|
+
referenceSubstitutionNode = instantiateReferenceSubstitution(string, context);
|
|
229
|
+
|
|
230
|
+
referenceSubstitution = referenceSubstitutionFromReferenceSubstitutionNode(referenceSubstitutionNode, context);
|
|
231
|
+
}, context);
|
|
232
|
+
|
|
233
|
+
return referenceSubstitution;
|
|
234
|
+
}
|
|
202
235
|
});
|
|
203
236
|
|
|
204
237
|
function targetReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode, context) {
|
|
@@ -132,7 +132,11 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
132
132
|
const replacementStatementValidates = this.validateReplacementStatement(generalContext, specificContext);
|
|
133
133
|
|
|
134
134
|
if (replacementStatementValidates) {
|
|
135
|
-
|
|
135
|
+
const substitutionValidates = this.validateSubstitution(generalContext, specificContext);
|
|
136
|
+
|
|
137
|
+
if (substitutionValidates) {
|
|
138
|
+
validates = true;
|
|
139
|
+
}
|
|
136
140
|
}
|
|
137
141
|
}
|
|
138
142
|
|
|
@@ -155,6 +159,34 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
155
159
|
return statementSubstitution;
|
|
156
160
|
}
|
|
157
161
|
|
|
162
|
+
validateSubstitution(generalContext, specificContext) {
|
|
163
|
+
let substitutionValidates = true;
|
|
164
|
+
|
|
165
|
+
if (this.substitution !== null) {
|
|
166
|
+
const context = specificContext, ///
|
|
167
|
+
substitutionString = this.substitution.getString(),
|
|
168
|
+
statementSubstitutionString = this.getString();
|
|
169
|
+
|
|
170
|
+
context.trace(`Validating the '${statementSubstitutionString}' statement substitution's '${substitutionString}' substitution...`);
|
|
171
|
+
|
|
172
|
+
specificContext = generalContext; ///
|
|
173
|
+
|
|
174
|
+
const substitution = this.substitution.validate(generalContext, specificContext);
|
|
175
|
+
|
|
176
|
+
if (substitution !== null) {
|
|
177
|
+
this.substitution = substitution;
|
|
178
|
+
|
|
179
|
+
substitutionValidates = true;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (substitutionValidates) {
|
|
183
|
+
context.debug(`...validatewd the '${statementSubstitutionString}' statement substitution's '${substitutionString}' substitution.`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return substitutionValidates;
|
|
188
|
+
}
|
|
189
|
+
|
|
158
190
|
validateTargetStatement(generalContext, specificContext) {
|
|
159
191
|
let targetStatementValidates = false;
|
|
160
192
|
|
|
@@ -3,27 +3,27 @@
|
|
|
3
3
|
import { Element, asynchronousUtilities } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import { asyncRestrict } from "../utilities/context";
|
|
6
|
-
import {
|
|
6
|
+
import { topLevelMetaAssertionStringFromLabelSuppositionsDeductionAndMetaLevelAssumptions } from "../utilities/string";
|
|
7
7
|
import { labelFromJSON,
|
|
8
8
|
labelToLabelJSON,
|
|
9
9
|
deductionFromJSON,
|
|
10
|
-
assumptionsFromJSON,
|
|
11
10
|
suppositionsFromJSON,
|
|
12
11
|
deductionToDeductionJSON,
|
|
13
|
-
|
|
14
|
-
suppositionsToSuppositionsJSON
|
|
12
|
+
metaLevelAssumptionsFromJSON,
|
|
13
|
+
suppositionsToSuppositionsJSON,
|
|
14
|
+
metaLevelAssumptionsToMetaLevelAssumptionsJSON } from "../utilities/json";
|
|
15
15
|
|
|
16
16
|
const { asyncForwardsEvery } = asynchronousUtilities;
|
|
17
17
|
|
|
18
18
|
export default class TopLevelMetaAssertion extends Element {
|
|
19
|
-
constructor(context, string, node, label, suppositions, deduction, proof,
|
|
19
|
+
constructor(context, string, node, label, suppositions, deduction, proof, metaLevelAssumptions) {
|
|
20
20
|
super(context, string, node);
|
|
21
21
|
|
|
22
22
|
this.label = label;
|
|
23
23
|
this.suppositions = suppositions;
|
|
24
24
|
this.deduction = deduction;
|
|
25
25
|
this.proof = proof;
|
|
26
|
-
this.
|
|
26
|
+
this.metaLevelAssumptions = metaLevelAssumptions;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
getLabel() {
|
|
@@ -42,8 +42,8 @@ export default class TopLevelMetaAssertion extends Element {
|
|
|
42
42
|
return this.proof;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
return this.
|
|
45
|
+
getMetaLevelAssumptions() {
|
|
46
|
+
return this.metaLevelAssumptions;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
getStatement() {
|
|
@@ -121,7 +121,7 @@ export default class TopLevelMetaAssertion extends Element {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
}, this.
|
|
124
|
+
}, this.metaLevelAssumptions, context);
|
|
125
125
|
|
|
126
126
|
if (verifies) {
|
|
127
127
|
context.debug(`...verified the '${topLevelMetaAssertionString}' top level meta assertion.`);
|
|
@@ -234,16 +234,16 @@ export default class TopLevelMetaAssertion extends Element {
|
|
|
234
234
|
const labelJSON = labelToLabelJSON(this.label),
|
|
235
235
|
deductionJSON = deductionToDeductionJSON(this.deduction),
|
|
236
236
|
suppositionsJSON = suppositionsToSuppositionsJSON(this.suppositions),
|
|
237
|
-
|
|
237
|
+
metaLevelAssumptionsJSON = metaLevelAssumptionsToMetaLevelAssumptionsJSON(this.metaLevelAssumptions),
|
|
238
238
|
label = labelJSON, ///
|
|
239
239
|
deduction = deductionJSON, ///
|
|
240
240
|
suppositions = suppositionsJSON, ///
|
|
241
|
-
|
|
241
|
+
metaLevelAssumptions = metaLevelAssumptionsJSON, ///
|
|
242
242
|
json = {
|
|
243
243
|
label,
|
|
244
244
|
deduction,
|
|
245
245
|
suppositions,
|
|
246
|
-
|
|
246
|
+
metaLevelAssumptions
|
|
247
247
|
};
|
|
248
248
|
|
|
249
249
|
return json;
|
|
@@ -253,11 +253,11 @@ export default class TopLevelMetaAssertion extends Element {
|
|
|
253
253
|
const label = labelFromJSON(json, context),
|
|
254
254
|
deduction = deductionFromJSON(json, context),
|
|
255
255
|
suppositions = suppositionsFromJSON(json, context),
|
|
256
|
-
|
|
256
|
+
metaLevelAssumptions = metaLevelAssumptionsFromJSON(json, context),
|
|
257
257
|
node = null,
|
|
258
258
|
proof = null,
|
|
259
|
-
string =
|
|
260
|
-
topLevelMetaAssertion = new Class(context, string, node, label, suppositions, deduction, proof,
|
|
259
|
+
string = topLevelMetaAssertionStringFromLabelSuppositionsDeductionAndMetaLevelAssumptions(label, suppositions, deduction, metaLevelAssumptions),
|
|
260
|
+
topLevelMetaAssertion = new Class(context, string, node, label, suppositions, deduction, proof, metaLevelAssumptions);
|
|
261
261
|
|
|
262
262
|
return topLevelMetaAssertion;
|
|
263
263
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NonTerminalNode } from "occam-languages";
|
|
4
|
+
|
|
5
|
+
import { REFERENCE_RULE_NAME, STATEMENT_RULE_NAME } from "../../ruleNames";
|
|
6
|
+
|
|
7
|
+
export default class MetaLevelAssumptionpNode extends NonTerminalNode {
|
|
8
|
+
getReferenceNode() {
|
|
9
|
+
const ruleName = REFERENCE_RULE_NAME,
|
|
10
|
+
referenceNode = this.getNodeByRuleName(ruleName);
|
|
11
|
+
|
|
12
|
+
return referenceNode;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
getStatementNode() {
|
|
16
|
+
const ruleName = STATEMENT_RULE_NAME,
|
|
17
|
+
statementNode = this.getNodeByRuleName(ruleName);
|
|
18
|
+
|
|
19
|
+
return statementNode;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(MetaLevelAssumptionpNode, ruleName, childNodes, opacity, precedence); }
|
|
23
|
+
}
|
package/src/node/assumption.js
CHANGED
|
@@ -2,16 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import { NonTerminalNode } from "occam-languages";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { METAVARIABLE_RULE_NAME, STATEMENT_RULE_NAME } from "../ruleNames";
|
|
6
6
|
|
|
7
7
|
export default class AssumptionpNode extends NonTerminalNode {
|
|
8
|
-
getStatementNode() {
|
|
9
|
-
const ruleName = STATEMENT_RULE_NAME,
|
|
10
|
-
statementNode = this.getNodeByRuleName(ruleName);
|
|
11
|
-
|
|
12
|
-
return statementNode;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
8
|
getMetavariableNode() {
|
|
16
9
|
const ruleName = METAVARIABLE_RULE_NAME,
|
|
17
10
|
metavariableNode = this.getNodeByRuleName(ruleName);
|
|
@@ -19,5 +12,12 @@ export default class AssumptionpNode extends NonTerminalNode {
|
|
|
19
12
|
return metavariableNode;
|
|
20
13
|
}
|
|
21
14
|
|
|
15
|
+
getStatementNode() {
|
|
16
|
+
const ruleName = STATEMENT_RULE_NAME,
|
|
17
|
+
statementNode = this.getNodeByRuleName(ruleName);
|
|
18
|
+
|
|
19
|
+
return statementNode;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
22
|
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(AssumptionpNode, ruleName, childNodes, opacity, precedence); }
|
|
23
23
|
}
|
|
@@ -75,6 +75,7 @@ import SatisfiesAssertionNode from "./node/assertion/satisfies";
|
|
|
75
75
|
import ParenthesisedLabelsNode from "./node/parenthesisedLabels"
|
|
76
76
|
import PropertyDeclarationNode from "./node/declaration/property";
|
|
77
77
|
import VariableDeclarationNode from "./node/declaration/variable";
|
|
78
|
+
import MetaLevelAssumptionpNode from "./node/assumption/metaLevel";
|
|
78
79
|
import SimpleTypeDeclarationNode from "./node/declaration/simpleType";
|
|
79
80
|
import CombinatorDeclarationNode from "./node/declaration/combinator";
|
|
80
81
|
import ReferenceSubstitutionNode from "./node/substitution/reference";
|
|
@@ -160,6 +161,7 @@ import {
|
|
|
160
161
|
PARENTHESISED_LABELS_RULE_NAME,
|
|
161
162
|
PROPERTY_DECLARATION_RULE_NAME,
|
|
162
163
|
VARIABLE_DECLARATION_RULE_NAME,
|
|
164
|
+
META_LEVEL_ASSUMPTION_RULE_NAME,
|
|
163
165
|
COMBINATOR_DECLARATION_RULE_NAME,
|
|
164
166
|
REFERENCE_SUBSTITUTION_RULE_NAME,
|
|
165
167
|
STATEMENT_SUBSTITUTION_RULE_NAME,
|
|
@@ -245,6 +247,7 @@ const NonTerminalNodeMap = {
|
|
|
245
247
|
[PARENTHESISED_LABELS_RULE_NAME]: ParenthesisedLabelsNode,
|
|
246
248
|
[VARIABLE_DECLARATION_RULE_NAME]: VariableDeclarationNode,
|
|
247
249
|
[PROPERTY_DECLARATION_RULE_NAME]: PropertyDeclarationNode,
|
|
250
|
+
[META_LEVEL_ASSUMPTION_RULE_NAME]: MetaLevelAssumptionpNode,
|
|
248
251
|
[COMBINATOR_DECLARATION_RULE_NAME]: CombinatorDeclarationNode,
|
|
249
252
|
[STATEMENT_SUBSTITUTION_RULE_NAME]: StatementSubstitutionNode,
|
|
250
253
|
[REFERENCE_SUBSTITUTION_RULE_NAME]: ReferenceSubstitutionNode,
|
package/src/preamble.js
CHANGED
|
@@ -50,6 +50,7 @@ import PropertyAssertion from "./element/assertion/property";
|
|
|
50
50
|
import ProcedureReference from "./element/procedureReference";
|
|
51
51
|
import ContainedAssertion from "./element/assertion/contained";
|
|
52
52
|
import SatisfiesAssertion from "./element/assertion/satisfies";
|
|
53
|
+
import MetaLevelAssumption from "./element/assumption/metaLevel";
|
|
53
54
|
import VariableDeclaration from "./element/declaration/variable";
|
|
54
55
|
import BracketedCombinator from "./element/combinator/bracketed";
|
|
55
56
|
import BracketedConstructor from "./element/constructor/bracketed";
|
|
@@ -33,6 +33,7 @@ import { TERM_RULE_NAME,
|
|
|
33
33
|
PROCEDURE_REFERENCE_RULE_NAME,
|
|
34
34
|
CONTAINED_ASSERTION_RULE_NAME,
|
|
35
35
|
SATISFIES_ASSERTION_RULE_NAME,
|
|
36
|
+
META_LEVEL_ASSUMPTION_RULE_NAME,
|
|
36
37
|
STATEMENT_SUBSTITUTION_RULE_NAME,
|
|
37
38
|
REFERENCE_SUBSTITUTION_RULE_NAME } from "../ruleNames";
|
|
38
39
|
|
|
@@ -68,6 +69,7 @@ const termPlaceholderRule = ruleFromRuleName(TERM_RULE_NAME),
|
|
|
68
69
|
procedureReferencelaceholderRule = ruleFromRuleName(PROCEDURE_REFERENCE_RULE_NAME),
|
|
69
70
|
containedAssertionPlaceholderRule = ruleFromRuleName(CONTAINED_ASSERTION_RULE_NAME),
|
|
70
71
|
satisfiesAssertionPlaceholderRule = ruleFromRuleName(SATISFIES_ASSERTION_RULE_NAME),
|
|
72
|
+
metaLevelAssumptionPlaceholderRule = ruleFromRuleName(META_LEVEL_ASSUMPTION_RULE_NAME),
|
|
71
73
|
statementSubstitutionPlaceholderRule = ruleFromRuleName(STATEMENT_SUBSTITUTION_RULE_NAME),
|
|
72
74
|
referenceSubstitutionPlaceholderRule = ruleFromRuleName(REFERENCE_SUBSTITUTION_RULE_NAME);
|
|
73
75
|
|
|
@@ -155,6 +157,8 @@ export function instantiateContainedAssertion(string, context) { return instanti
|
|
|
155
157
|
|
|
156
158
|
export function instantiateSatisfiesAssertion(string, context) { return instantiate(satisfiesAssertionPlaceholderRule, string, context); }
|
|
157
159
|
|
|
160
|
+
export function instantiateMetaLevelAssumption(string, context) { return instantiate(metaLevelAssumptionPlaceholderRule, string, context); }
|
|
161
|
+
|
|
158
162
|
export function instantiateStatementSubstitution(string, context) { return instantiate(statementSubstitutionPlaceholderRule, string, context); }
|
|
159
163
|
|
|
160
164
|
export function instantiateReferenceSubstitution(string, context) { return instantiate(referenceSubstitutionPlaceholderRule, string, context); }
|
package/src/process/unify.js
CHANGED
|
@@ -17,6 +17,7 @@ const typeNodeQuery = nodeQuery("/type"),
|
|
|
17
17
|
metavariableNodeQuery = nodeQuery("/metavariable"),
|
|
18
18
|
termVariableNodeQuery = nodeQuery("/term/variable!"),
|
|
19
19
|
frameMetavariableNodeQuery = nodeQuery("/frame/metavariable!"),
|
|
20
|
+
referenceMetavariableNodeQuery = nodeQuery("/reference/metavariable!"),
|
|
20
21
|
statementMetavariableNodeQuery = nodeQuery("/statement/metavariable!"),
|
|
21
22
|
assumptionMetavariableNodeQuery = nodeQuery("/assumption/metavariable!");
|
|
22
23
|
|
|
@@ -29,21 +30,24 @@ class MetaLevelPass extends ZipPassBase {
|
|
|
29
30
|
let success = false;
|
|
30
31
|
|
|
31
32
|
let context,
|
|
33
|
+
reference,
|
|
32
34
|
metavariableNode;
|
|
33
35
|
|
|
34
36
|
context = generalContext; ///
|
|
35
37
|
|
|
36
38
|
metavariableNode = generalAssumptionMetavariableNode; ///
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
reference = context.findReferenceByMetavariableNode(metavariableNode);
|
|
41
|
+
|
|
42
|
+
const metavariable = reference.getMetavariable();
|
|
40
43
|
|
|
41
44
|
context = specificContext; ///
|
|
42
45
|
|
|
43
46
|
metavariableNode = specificAssumptionMetavariableNode; ///
|
|
44
47
|
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
reference = context.findReferenceByMetavariableNode(metavariableNode);
|
|
49
|
+
|
|
50
|
+
const referenceUnifies = metavariable.unifyReference(reference, generalContext, specificContext);
|
|
47
51
|
|
|
48
52
|
if (referenceUnifies) {
|
|
49
53
|
success = true;
|
|
@@ -181,56 +185,31 @@ class AssumptionPass extends ZipPass {
|
|
|
181
185
|
},
|
|
182
186
|
{
|
|
183
187
|
generalNodeQuery: metavariableNodeQuery,
|
|
184
|
-
specificNodeQuery:
|
|
185
|
-
run: (generalMetavariableNode,
|
|
188
|
+
specificNodeQuery: referenceMetavariableNodeQuery,
|
|
189
|
+
run: (generalMetavariableNode, specificReferenceMetavariableNode, generalContext, specificContext) => {
|
|
186
190
|
let success = false;
|
|
187
191
|
|
|
188
192
|
let context,
|
|
193
|
+
reference,
|
|
189
194
|
metavariableNode;
|
|
190
195
|
|
|
191
196
|
context = generalContext; ///
|
|
192
197
|
|
|
193
198
|
metavariableNode = generalMetavariableNode; ///
|
|
194
199
|
|
|
195
|
-
|
|
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();
|
|
200
|
+
reference = context.findReferenceByMetavariableNode(metavariableNode);
|
|
221
201
|
|
|
222
|
-
|
|
202
|
+
const metavariable = reference.getMetavariable();
|
|
223
203
|
|
|
224
|
-
context =
|
|
204
|
+
context = specificContext; ///
|
|
225
205
|
|
|
226
|
-
|
|
206
|
+
metavariableNode = specificReferenceMetavariableNode; ///
|
|
227
207
|
|
|
228
|
-
|
|
208
|
+
reference = context.findReferenceByMetavariableNode(metavariableNode);
|
|
229
209
|
|
|
230
|
-
const
|
|
231
|
-
termUnifies = variable.unifyTerm(term, generalContext, specificContext);
|
|
210
|
+
const referenceUnifies = metavariable.unifyReference(reference, generalContext, specificContext);
|
|
232
211
|
|
|
233
|
-
if (
|
|
212
|
+
if (referenceUnifies) {
|
|
234
213
|
success = true;
|
|
235
214
|
}
|
|
236
215
|
|
package/src/ruleNames.js
CHANGED
|
@@ -75,6 +75,7 @@ export const SATISFIES_ASSERTION_RULE_NAME = "satisfiesAssertion";
|
|
|
75
75
|
export const PARENTHESISED_LABELS_RULE_NAME = "parenthesisedLabels";
|
|
76
76
|
export const PROPERTY_DECLARATION_RULE_NAME = "propertyDeclaration";
|
|
77
77
|
export const VARIABLE_DECLARATION_RULE_NAME = "variableDeclaration";
|
|
78
|
+
export const META_LEVEL_ASSUMPTION_RULE_NAME = "metaLevelAssumption";
|
|
78
79
|
export const COMBINATOR_DECLARATION_RULE_NAME = "combinatorDeclaration";
|
|
79
80
|
export const STATEMENT_SUBSTITUTION_RULE_NAME = "statementSubstitution";
|
|
80
81
|
export const REFERENCE_SUBSTITUTION_RULE_NAME = "referenceSubstitution";
|
package/src/utilities/context.js
CHANGED
|
@@ -114,14 +114,14 @@ export function unserialise(innerFunction, json, context) {
|
|
|
114
114
|
return innerFunction(json, context);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
export async function asyncRestrict(innerFunction,
|
|
117
|
+
export async function asyncRestrict(innerFunction, metaLevelAssumptions, context) {
|
|
118
118
|
if (context === undefined) {
|
|
119
|
-
context =
|
|
119
|
+
context = metaLevelAssumptions; ///
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
metaLevelAssumptions = null;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
const proofContext = ProofContext.
|
|
124
|
+
const proofContext = ProofContext.fromMetaLevelAssumptions(metaLevelAssumptions, context);
|
|
125
125
|
|
|
126
126
|
context = proofContext; ///
|
|
127
127
|
|
package/src/utilities/element.js
CHANGED
|
@@ -10,7 +10,7 @@ import { equivalenceStringFromTerms,
|
|
|
10
10
|
subproofStringFromSuppositionsAndSubDerivation,
|
|
11
11
|
procedureCallStringFromProcedureReferenceAndParameters,
|
|
12
12
|
topLevelAssertionStringFromLabelsSuppositionsAndDeduction,
|
|
13
|
-
|
|
13
|
+
topLevelMetaAssertionStringFromLabelSuppositionsDeductionAndMetaLevelAssumptions } from "../utilities/string";
|
|
14
14
|
|
|
15
15
|
export function typeFromTypeNode(typeNode, context) {
|
|
16
16
|
let type;
|
|
@@ -346,11 +346,11 @@ export function metaLemmaFromMetaLemmaNode(metaLemmaNode, context) {
|
|
|
346
346
|
label = labelFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
347
347
|
deduction = deductionFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
348
348
|
suppositions = suppositionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
349
|
-
|
|
350
|
-
topLevelMetaAssertionString =
|
|
349
|
+
metaLevelAssumptions = metaLevelAssumptionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
350
|
+
topLevelMetaAssertionString = topLevelMetaAssertionStringFromLabelSuppositionsDeductionAndMetaLevelAssumptions(label, suppositions, deduction, metaLevelAssumptions),
|
|
351
351
|
node = metaLemmaMetathoremNode, ///
|
|
352
352
|
string = topLevelMetaAssertionString, ///
|
|
353
|
-
metaLemma = new MetaLemma(context, string, node, label, suppositions, deduction, proof,
|
|
353
|
+
metaLemma = new MetaLemma(context, string, node, label, suppositions, deduction, proof, metaLevelAssumptions);
|
|
354
354
|
|
|
355
355
|
return metaLemma;
|
|
356
356
|
}
|
|
@@ -467,11 +467,8 @@ export function assumptionFromAssumptionNode(assumptionNode, context) {
|
|
|
467
467
|
node = assumptionNode, ///
|
|
468
468
|
string = context.nodeAsString(node),
|
|
469
469
|
reference = referenceFromAssumptionNode(assumptionNode, context),
|
|
470
|
-
statement = statementFromAssumptionNode(assumptionNode, context)
|
|
471
|
-
|
|
472
|
-
context = null;
|
|
473
|
-
|
|
474
|
-
const assumption = new Assumption(context, string, node, reference, statement);
|
|
470
|
+
statement = statementFromAssumptionNode(assumptionNode, context),
|
|
471
|
+
assumption = new Assumption(context, string, node, reference, statement);
|
|
475
472
|
|
|
476
473
|
return assumption;
|
|
477
474
|
}
|
|
@@ -523,11 +520,11 @@ export function metatheoremFromMetatheoremNode(metatheoremNode, context) {
|
|
|
523
520
|
label = labelFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
524
521
|
deduction = deductionFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
525
522
|
suppositions = suppositionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
526
|
-
|
|
527
|
-
topLevelMetaAssertionString =
|
|
523
|
+
metaLevelAssumptions = metaLevelAssumptionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
524
|
+
topLevelMetaAssertionString = topLevelMetaAssertionStringFromLabelSuppositionsDeductionAndMetaLevelAssumptions(label, suppositions, deduction, metaLevelAssumptions),
|
|
528
525
|
node = metaLemmaMetathoremNode, ///
|
|
529
526
|
string = topLevelMetaAssertionString, ///
|
|
530
|
-
metatheorem = new Metatheorem(context, string, node, label, suppositions, deduction, proof,
|
|
527
|
+
metatheorem = new Metatheorem(context, string, node, label, suppositions, deduction, proof, metaLevelAssumptions);
|
|
531
528
|
|
|
532
529
|
return metatheorem;
|
|
533
530
|
}
|
|
@@ -730,6 +727,17 @@ export function variableDeclarationFromVariableDeclarationNode(variableDeclarati
|
|
|
730
727
|
return variableDeclaration;
|
|
731
728
|
}
|
|
732
729
|
|
|
730
|
+
export function metaLevelAssumptionFromMetaLevelAssumptionNode(metaLevelAssumptionNode, context) {
|
|
731
|
+
const { MetaLevelAssumption } = elements,
|
|
732
|
+
node = metaLevelAssumptionNode, ///
|
|
733
|
+
string = context.nodeAsString(node),
|
|
734
|
+
reference = referenceFromMetaLevelAssumptionNode(metaLevelAssumptionNode, context),
|
|
735
|
+
statement = statementFromMetaLevelAssumptionNode(metaLevelAssumptionNode, context),
|
|
736
|
+
metaLevelAssumption = new MetaLevelAssumption(context, string, node, reference, statement);
|
|
737
|
+
|
|
738
|
+
return metaLevelAssumption;
|
|
739
|
+
}
|
|
740
|
+
|
|
733
741
|
export function typePrefixDeclarationFromTypePrefixDeclarationNode(typePrefixDeclarationNode, context) {
|
|
734
742
|
const { TypePrefixDeclaration } = elements,
|
|
735
743
|
node = typePrefixDeclarationNode, ///
|
|
@@ -1245,13 +1253,8 @@ export function statementFromConclusionNode(conclusinoNode, context) {
|
|
|
1245
1253
|
}
|
|
1246
1254
|
|
|
1247
1255
|
export function statementFromAssumptionNode(assumptionNode, context) {
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
const statementNode = assumptionNode.getStatementNode();
|
|
1251
|
-
|
|
1252
|
-
if (statementNode !== null) {
|
|
1253
|
-
statement = statementFromStatementNode(statementNode, context);
|
|
1254
|
-
}
|
|
1256
|
+
const statementNode = assumptionNode.getStatementNode(),
|
|
1257
|
+
statement = statementFromStatementNode(statementNode, context);
|
|
1255
1258
|
|
|
1256
1259
|
return statement;
|
|
1257
1260
|
}
|
|
@@ -1725,6 +1728,22 @@ export function targetFrameFromFrameSubstitutionNode(frameSubstitutionNode, cont
|
|
|
1725
1728
|
return targetFrame;
|
|
1726
1729
|
}
|
|
1727
1730
|
|
|
1731
|
+
export function statementFromMetaLevelAssumptionNode(metaLevelAssumptionNode, context) {
|
|
1732
|
+
const statementNode = metaLevelAssumptionNode.getStatementNode(),
|
|
1733
|
+
statement = statementFromStatementNode(statementNode, context);
|
|
1734
|
+
|
|
1735
|
+
return statement;
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
export function referenceFromMetaLevelAssumptionNode(metaLevelAssumptionNode, context) {
|
|
1739
|
+
const { Reference } = elements,
|
|
1740
|
+
referenceNode = metaLevelAssumptionNode.getReferenceNode(),
|
|
1741
|
+
referenceString = context.nodeAsString(referenceNode),
|
|
1742
|
+
reference = Reference.fromReferenceString(referenceString, context);
|
|
1743
|
+
|
|
1744
|
+
return reference;
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1728
1747
|
export function suppositionsFromTopLevelAssertionNode(topLevelAsssertionNode, context) {
|
|
1729
1748
|
const suppositionNodes = topLevelAsssertionNode.getSuppositionNodes(),
|
|
1730
1749
|
suppositions = suppositionsFromSuppositionNodes(suppositionNodes, context);
|
|
@@ -1800,12 +1819,6 @@ export function metaTypeFromMetavariableDeclarationNode(metavariableDeclarationN
|
|
|
1800
1819
|
return metaType;
|
|
1801
1820
|
}
|
|
1802
1821
|
|
|
1803
|
-
export function assumptionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context) {
|
|
1804
|
-
const assumptions = [];
|
|
1805
|
-
|
|
1806
|
-
return assumptions;
|
|
1807
|
-
}
|
|
1808
|
-
|
|
1809
1822
|
export function provisionalFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context) {
|
|
1810
1823
|
const provisional = simpleTypeDeclarationNode.isProvisional();
|
|
1811
1824
|
|
|
@@ -1937,6 +1950,12 @@ export function replacementStatementFromStatementSubstitutionNode(statementSubst
|
|
|
1937
1950
|
return replacementStatement;
|
|
1938
1951
|
}
|
|
1939
1952
|
|
|
1953
|
+
export function metaLevelAssumptionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context) {
|
|
1954
|
+
const metaLevelAssumptions = [];
|
|
1955
|
+
|
|
1956
|
+
return metaLevelAssumptions;
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1940
1959
|
export function termsFromTermNodes(termNodes, context) {
|
|
1941
1960
|
const terms = termNodes.map((termNode) => {
|
|
1942
1961
|
const term = termFromTermNode(termNode, context);
|
package/src/utilities/json.js
CHANGED
|
@@ -565,7 +565,7 @@ export function assumptionsFromJSON(json, context) {
|
|
|
565
565
|
let { assumptions } = json;
|
|
566
566
|
|
|
567
567
|
const { Assumption } = elements,
|
|
568
|
-
|
|
568
|
+
assumptionsJSON = assumptions; ///
|
|
569
569
|
|
|
570
570
|
assumptions = assumptionsJSON.map((assumptionJSON) => {
|
|
571
571
|
const json = assumptionJSON, ///
|
|
@@ -702,6 +702,22 @@ export function propertyRelationsFromJSON(json, context) {
|
|
|
702
702
|
return propertyRelations;
|
|
703
703
|
}
|
|
704
704
|
|
|
705
|
+
export function metaLevelAssumptionsFromJSON(json, context) {
|
|
706
|
+
let { metaLevelAssumptions } = json;
|
|
707
|
+
|
|
708
|
+
const { MetaLevelAssumption } = elements,
|
|
709
|
+
metaLevelAssumptionsJSON = metaLevelAssumptions; ///
|
|
710
|
+
|
|
711
|
+
metaLevelAssumptions = metaLevelAssumptionsJSON.map((metaLevelAssumptionJSON) => {
|
|
712
|
+
const json = metaLevelAssumptionJSON, ///
|
|
713
|
+
metaLevelAssumption = MetaLevelAssumption.fromJSON(json, context);
|
|
714
|
+
|
|
715
|
+
return metaLevelAssumption;
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
return metaLevelAssumptions;
|
|
719
|
+
}
|
|
720
|
+
|
|
705
721
|
export function nameToNameJSON(name) {
|
|
706
722
|
const nameJSON = name; ///
|
|
707
723
|
|
|
@@ -1120,6 +1136,16 @@ export function propertyRelationsToPropertyRelationsJSON(propertyRelations) {
|
|
|
1120
1136
|
return propertyRelationsJSON;
|
|
1121
1137
|
}
|
|
1122
1138
|
|
|
1139
|
+
export function metaLevelAssumptionsToMetaLevelAssumptionsJSON(metaLevelAssumptions) {
|
|
1140
|
+
const metaLevelAssumptionsJSON = metaLevelAssumptions.map((metaLevelAssumption) => {
|
|
1141
|
+
const metaLevelAssumptionJSON = metaLevelAssumption.toJSON();
|
|
1142
|
+
|
|
1143
|
+
return metaLevelAssumptionJSON;
|
|
1144
|
+
});
|
|
1145
|
+
|
|
1146
|
+
return metaLevelAssumptionsJSON;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1123
1149
|
function findTypeByName(name, context) {
|
|
1124
1150
|
const typeName = name, ///
|
|
1125
1151
|
type = context.findTypeByTypeName(typeName);
|