occam-verify-cli 1.0.768 → 1.0.776
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/context/file/nominal.js +11 -11
- package/lib/context/illative.js +28 -0
- package/lib/context/nested.js +27 -0
- package/lib/context/proof.js +232 -0
- package/lib/context/thetic.js +28 -0
- package/lib/context.js +15 -21
- package/lib/element/assertion/contained.js +24 -22
- package/lib/element/assertion/defined.js +20 -19
- package/lib/element/assertion/property.js +14 -13
- package/lib/element/assertion/satisfies.js +8 -9
- package/lib/element/assertion/subproof.js +23 -26
- package/lib/element/assertion/type.js +9 -11
- package/lib/element/assumption.js +32 -39
- package/lib/element/combinator/bracketed.js +3 -3
- package/lib/element/combinator.js +20 -20
- package/lib/element/conclusion.js +33 -29
- package/lib/element/constructor.js +19 -18
- package/lib/element/deduction.js +33 -29
- package/lib/element/equality.js +13 -15
- package/lib/element/equivalence.js +59 -52
- package/lib/element/frame.js +41 -34
- package/lib/element/hypothesis.js +7 -5
- package/lib/element/judgement.js +32 -73
- package/lib/element/label.js +22 -22
- package/lib/element/metavariable.js +23 -7
- package/lib/element/proofAssertion/premise.js +48 -35
- package/lib/element/proofAssertion/step.js +35 -20
- package/lib/element/proofAssertion/supposition.js +48 -34
- package/lib/element/proofAssertion.js +1 -14
- package/lib/element/reference.js +80 -53
- package/lib/element/signature.js +44 -3
- package/lib/element/statement.js +28 -29
- package/lib/element/subproof.js +2 -2
- package/lib/element/substitution/frame.js +24 -19
- package/lib/element/substitution/metaLevel.js +31 -27
- package/lib/element/substitution/reference.js +11 -10
- package/lib/element/substitution/statement.js +30 -23
- package/lib/element/substitution/term.js +11 -10
- package/lib/element/term.js +24 -20
- package/lib/element/topLevelMetaAssertion.js +2 -2
- package/lib/element/variable.js +6 -2
- package/lib/process/assign.js +10 -4
- package/lib/process/unify.js +8 -8
- package/lib/process/validate.js +10 -8
- package/lib/utilities/context.js +68 -23
- package/lib/utilities/element.js +55 -27
- package/lib/utilities/json.js +8 -8
- package/lib/utilities/statement.js +1 -8
- package/lib/utilities/string.js +12 -1
- package/lib/utilities/unification.js +9 -7
- package/lib/utilities/validation.js +39 -31
- package/package.json +1 -1
- package/src/context/file/nominal.js +14 -16
- package/src/context/illative.js +17 -0
- package/src/context/nested.js +15 -0
- package/src/context/{scoped.js → proof.js} +73 -73
- package/src/context/thetic.js +17 -0
- package/src/context.js +23 -36
- package/src/element/assertion/contained.js +28 -28
- package/src/element/assertion/defined.js +23 -23
- package/src/element/assertion/property.js +15 -14
- package/src/element/assertion/satisfies.js +7 -9
- package/src/element/assertion/subproof.js +26 -31
- package/src/element/assertion/type.js +10 -12
- package/src/element/assumption.js +33 -54
- package/src/element/combinator/bracketed.js +2 -2
- package/src/element/combinator.js +23 -29
- package/src/element/conclusion.js +37 -40
- package/src/element/constructor.js +29 -34
- package/src/element/deduction.js +36 -39
- package/src/element/equality.js +16 -18
- package/src/element/equivalence.js +76 -67
- package/src/element/frame.js +42 -34
- package/src/element/hypothesis.js +7 -6
- package/src/element/judgement.js +34 -44
- package/src/element/label.js +25 -31
- package/src/element/metavariable.js +32 -12
- package/src/element/proofAssertion/premise.js +63 -49
- package/src/element/proofAssertion/step.js +43 -23
- package/src/element/proofAssertion/supposition.js +64 -50
- package/src/element/proofAssertion.js +0 -22
- package/src/element/reference.js +119 -80
- package/src/element/signature.js +5 -2
- package/src/element/statement.js +30 -35
- package/src/element/subproof.js +1 -1
- package/src/element/substitution/frame.js +27 -26
- package/src/element/substitution/metaLevel.js +38 -42
- package/src/element/substitution/reference.js +13 -14
- package/src/element/substitution/statement.js +35 -33
- package/src/element/substitution/term.js +13 -14
- package/src/element/term.js +42 -34
- package/src/element/topLevelMetaAssertion.js +1 -1
- package/src/element/variable.js +8 -1
- package/src/process/assign.js +9 -3
- package/src/process/unify.js +7 -7
- package/src/process/validate.js +9 -8
- package/src/utilities/context.js +82 -31
- package/src/utilities/element.js +68 -31
- package/src/utilities/json.js +13 -13
- package/src/utilities/statement.js +1 -9
- package/src/utilities/string.js +16 -2
- package/src/utilities/unification.js +10 -9
- package/src/utilities/validation.js +50 -38
- package/lib/context/scoped.js +0 -232
- package/lib/utilities/term.js +0 -17
- package/src/utilities/term.js +0 -10
package/src/utilities/context.js
CHANGED
|
@@ -1,38 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import ProofContext from "../context/proof";
|
|
4
|
+
import NestedContext from "../context/nested";
|
|
5
|
+
import TheticContext from "../context/thetic";
|
|
4
6
|
import NominalContext from "../context/nominal";
|
|
5
7
|
import LiteralContext from "../context/literal";
|
|
6
8
|
import LiminalContext from "../context/liminal";
|
|
9
|
+
import IllativeContext from "../context/illative";
|
|
7
10
|
import EphemeralContext from "../context/ephemeral";
|
|
8
11
|
import BranchingContext from "../context/branching";
|
|
9
12
|
import SyntheticContext from "../context/synthetic";
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
let context;
|
|
14
|
+
import { ephemeralContextFromJSON, ephemeralContextToEphemeralContextJSON } from "../utilities/json";
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
export function join(innerFunction, ...contexts) {
|
|
17
|
+
const syntheticContext = SyntheticContext.fromContexts(...contexts),
|
|
18
|
+
context = syntheticContext; ///
|
|
15
19
|
|
|
16
|
-
context
|
|
20
|
+
return innerFunction(context);
|
|
21
|
+
}
|
|
17
22
|
|
|
18
|
-
|
|
23
|
+
export function choose(innerFunction, context) {
|
|
24
|
+
const branchingContext = BranchingContext.fromNothing(context);
|
|
19
25
|
|
|
20
|
-
context =
|
|
26
|
+
context = branchingContext; ///
|
|
21
27
|
|
|
22
28
|
return innerFunction(context);
|
|
23
29
|
}
|
|
24
30
|
|
|
25
|
-
export function
|
|
26
|
-
const
|
|
27
|
-
|
|
31
|
+
export function derive(innerFunction, context) {
|
|
32
|
+
const illativeContext = IllativeContext.fromNothing(context);
|
|
33
|
+
|
|
34
|
+
context = illativeContext; ///
|
|
28
35
|
|
|
29
36
|
return innerFunction(context);
|
|
30
37
|
}
|
|
31
38
|
|
|
32
|
-
export function
|
|
33
|
-
const
|
|
39
|
+
export function declare(innerFunction, context) {
|
|
40
|
+
const theticContext = TheticContext.fromNothing(context);
|
|
34
41
|
|
|
35
|
-
context =
|
|
42
|
+
context = theticContext; ///
|
|
43
|
+
|
|
44
|
+
return innerFunction(context);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function descend(innerFunction, context) {
|
|
48
|
+
const nestedContext = NestedContext.fromNothing(context);
|
|
49
|
+
|
|
50
|
+
context = nestedContext; ///
|
|
36
51
|
|
|
37
52
|
return innerFunction(context);
|
|
38
53
|
}
|
|
@@ -61,6 +76,54 @@ export function instantiate(innerFunction, context) {
|
|
|
61
76
|
return innerFunction(context);
|
|
62
77
|
}
|
|
63
78
|
|
|
79
|
+
export function nominally(innerFunction) {
|
|
80
|
+
let context;
|
|
81
|
+
|
|
82
|
+
const nominalContext = NominalContext.fromNothing();
|
|
83
|
+
|
|
84
|
+
context = nominalContext; ///
|
|
85
|
+
|
|
86
|
+
const literalContext = LiteralContext.fromNothing(context);
|
|
87
|
+
|
|
88
|
+
context = literalContext; ///
|
|
89
|
+
|
|
90
|
+
return innerFunction(context);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function simplify(innerFunction, context) {
|
|
94
|
+
let contextExtraneousContext = isContextExtraneousContext(context);
|
|
95
|
+
|
|
96
|
+
while (contextExtraneousContext) {
|
|
97
|
+
context = context.getContext();
|
|
98
|
+
|
|
99
|
+
contextExtraneousContext = isContextExtraneousContext(context);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const ephemeralContext = EphemeralContext.fromNothing(context);
|
|
103
|
+
|
|
104
|
+
context = ephemeralContext; ///
|
|
105
|
+
|
|
106
|
+
return innerFunction(context);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function serialise(innerFunction, context) {
|
|
110
|
+
const ephemeralContext = context, ///
|
|
111
|
+
ephemeralContextJSON = ephemeralContextToEphemeralContextJSON(ephemeralContext),
|
|
112
|
+
contextJSON = ephemeralContextJSON; ///
|
|
113
|
+
|
|
114
|
+
context = contextJSON; ///
|
|
115
|
+
|
|
116
|
+
return innerFunction(context);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function unserialise(innerFunction, json, context) {
|
|
120
|
+
const ephemeralContext = ephemeralContextFromJSON(json, context);
|
|
121
|
+
|
|
122
|
+
context = ephemeralContext; ///
|
|
123
|
+
|
|
124
|
+
return innerFunction(json, context);
|
|
125
|
+
}
|
|
126
|
+
|
|
64
127
|
export async function asyncRestrict(innerFunction, metaLevelSubstitutions, context) {
|
|
65
128
|
if (context === undefined) {
|
|
66
129
|
context = metaLevelSubstitutions; ///
|
|
@@ -68,9 +131,9 @@ export async function asyncRestrict(innerFunction, metaLevelSubstitutions, conte
|
|
|
68
131
|
metaLevelSubstitutions = null;
|
|
69
132
|
}
|
|
70
133
|
|
|
71
|
-
const
|
|
134
|
+
const proofContext = ProofContext.fromMetaLevelSubstitutions(metaLevelSubstitutions, context);
|
|
72
135
|
|
|
73
|
-
context =
|
|
136
|
+
context = proofContext; ///
|
|
74
137
|
|
|
75
138
|
return await innerFunction(context);
|
|
76
139
|
}
|
|
@@ -83,27 +146,15 @@ export async function asyncReconcile(innerFunction, context) {
|
|
|
83
146
|
return await innerFunction(context);
|
|
84
147
|
}
|
|
85
148
|
|
|
86
|
-
export function sanitisedContextFromContext(context) {
|
|
87
|
-
let contextExtraneousContext = isContextExtraneousContext(context);
|
|
88
|
-
|
|
89
|
-
while (contextExtraneousContext) {
|
|
90
|
-
context = context.getContext();
|
|
91
|
-
|
|
92
|
-
contextExtraneousContext = isContextExtraneousContext(context);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const ephemeralContext = EphemeralContext.fromNothing(context),
|
|
96
|
-
sanitisedContext = ephemeralContext; ///
|
|
97
|
-
|
|
98
|
-
return sanitisedContext;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
149
|
function isContextExtraneousContext(context) {
|
|
102
150
|
const contextLiminalContext = (context instanceof LiminalContext),
|
|
103
151
|
contextEphemeralContext = (context instanceof EphemeralContext),
|
|
104
152
|
contextBranchingContext = (context instanceof BranchingContext),
|
|
105
153
|
contextSyntheticContext = (context instanceof SyntheticContext),
|
|
106
|
-
contextExtraneousContext = (contextLiminalContext
|
|
154
|
+
contextExtraneousContext = ( contextLiminalContext
|
|
155
|
+
|| contextEphemeralContext
|
|
156
|
+
|| contextBranchingContext
|
|
157
|
+
|| contextSyntheticContext );
|
|
107
158
|
|
|
108
159
|
return contextExtraneousContext;
|
|
109
160
|
}
|
package/src/utilities/element.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import elements from "../elements";
|
|
4
4
|
|
|
5
|
-
import { instantiate } from "../utilities/context";
|
|
6
5
|
import { baseTypeFromNothing } from "../utilities/type";
|
|
7
|
-
import {
|
|
6
|
+
import { simplify, instantiate,} from "../utilities/context";
|
|
7
|
+
import { instantiateLabel, instantiateReference } from "../process/instantiate";
|
|
8
8
|
import { equivalenceStringFromTerms,
|
|
9
9
|
typeStringFromNominalTypeName,
|
|
10
10
|
rulsStringFromLabelsPremisesAndConclusion,
|
|
@@ -13,7 +13,6 @@ import { equivalenceStringFromTerms,
|
|
|
13
13
|
procedureCallStringFromProcedureReferenceAndParameters,
|
|
14
14
|
topLevelAssertionStringFromLabelsSuppositionsAndDeduction,
|
|
15
15
|
topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction } from "../utilities/string";
|
|
16
|
-
import EphemeralContext from "../context/ephemeral";
|
|
17
16
|
|
|
18
17
|
export function typeFromTypeNode(typeNode, context) {
|
|
19
18
|
let type;
|
|
@@ -321,11 +320,9 @@ export function referenceFromReferenceNode(referenceNode, context) {
|
|
|
321
320
|
const { Reference } = elements,
|
|
322
321
|
node = referenceNode, ///
|
|
323
322
|
string = context.nodeAsString(node),
|
|
324
|
-
metavariable = metavariableFromReferenceNode(referenceNode, context)
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
const reference = new Reference(context, string, node, metavariable);
|
|
323
|
+
metavariable = metavariableFromReferenceNode(referenceNode, context),
|
|
324
|
+
topLevelMetaAssertion = topLevelMetaAssertionFromReferenceNode(referenceNode, context),
|
|
325
|
+
reference = new Reference(context, string, node, metavariable, topLevelMetaAssertion);
|
|
329
326
|
|
|
330
327
|
return reference;
|
|
331
328
|
}
|
|
@@ -509,13 +506,14 @@ export function suppositionFromSuppositionNode(suppositionNode, context) {
|
|
|
509
506
|
export function equivalenceFromEquivalenceNode(equivalenceNode, context) {
|
|
510
507
|
const { Equivalence } = elements,
|
|
511
508
|
node = equivalenceNode, ///
|
|
509
|
+
type = typeFromEquivalenceNode(equivalenceNode, context),
|
|
512
510
|
terms = termsFromEquivalenceNode(equivalenceNode, context),
|
|
513
511
|
equivalenceString = equivalenceStringFromTerms(terms),
|
|
514
512
|
string = equivalenceString; ///
|
|
515
513
|
|
|
516
514
|
context = null;
|
|
517
515
|
|
|
518
|
-
const equivalence = new Equivalence(context, string, node, terms);
|
|
516
|
+
const equivalence = new Equivalence(context, string, node, type, terms);
|
|
519
517
|
|
|
520
518
|
return equivalence;
|
|
521
519
|
}
|
|
@@ -677,12 +675,6 @@ export function subproofAssertionFromSubproofAssertionNode(subproofAssertionNode
|
|
|
677
675
|
return subproofAssertion;
|
|
678
676
|
}
|
|
679
677
|
|
|
680
|
-
export function substitutionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context) {
|
|
681
|
-
const substitutions = [];
|
|
682
|
-
|
|
683
|
-
return substitutions;
|
|
684
|
-
}
|
|
685
|
-
|
|
686
678
|
export function containedAssertionFromContainedAssertionNode(containedAssertionNode, context) {
|
|
687
679
|
const { ContainedAssertion } = elements,
|
|
688
680
|
node = containedAssertionNode, ///
|
|
@@ -945,7 +937,9 @@ export function referenceFromStepNode(stepNode, context) {
|
|
|
945
937
|
const referenceNode = stepNode.getReferenceNode();
|
|
946
938
|
|
|
947
939
|
if (referenceNode !== null) {
|
|
948
|
-
|
|
940
|
+
const referenceString = context.nodeAsString(referenceNode);
|
|
941
|
+
|
|
942
|
+
reference = referenceFromReferenceString(referenceString, context);
|
|
949
943
|
}
|
|
950
944
|
|
|
951
945
|
return reference;
|
|
@@ -1042,6 +1036,12 @@ export function typeFromConstructorNode(ocnstructorNode, context) {
|
|
|
1042
1036
|
return type;
|
|
1043
1037
|
}
|
|
1044
1038
|
|
|
1039
|
+
export function typeFromEquivalenceNode(equivalenceNode, context) {
|
|
1040
|
+
const type = null;
|
|
1041
|
+
|
|
1042
|
+
return type;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
1045
|
export function assumptionsFromFrameNode(frameNode, context) {
|
|
1046
1046
|
const assumptionNodes = frameNode.getAssumptionNodes(),
|
|
1047
1047
|
assumptions = assumptionsFromAssumptionNodes(assumptionNodes, context);
|
|
@@ -1361,16 +1361,11 @@ export function metavariableFromReferenceNode(referenceNode, context) {
|
|
|
1361
1361
|
}
|
|
1362
1362
|
|
|
1363
1363
|
export function referenceFromMetavariableNode(metavariableNode, context) {
|
|
1364
|
-
const metavariableString = context.nodeAsString(metavariableNode)
|
|
1364
|
+
const metavariableString = context.nodeAsString(metavariableNode),
|
|
1365
|
+
referenceString = metavariableString, ///
|
|
1366
|
+
reference = referenceFromReferenceString(referenceString, context);
|
|
1365
1367
|
|
|
1366
|
-
return
|
|
1367
|
-
const referenceString = metavariableString, ///
|
|
1368
|
-
string = referenceString, ///
|
|
1369
|
-
referenceNode = instantiateReference(string, context),
|
|
1370
|
-
reference = referenceFromReferenceNode(referenceNode, context);
|
|
1371
|
-
|
|
1372
|
-
return reference;
|
|
1373
|
-
}, context);
|
|
1368
|
+
return reference;
|
|
1374
1369
|
}
|
|
1375
1370
|
|
|
1376
1371
|
export function termFromJDefinedAssertionNode(definedAssertionNode, context) {
|
|
@@ -1607,7 +1602,8 @@ export function proofFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, cont
|
|
|
1607
1602
|
|
|
1608
1603
|
export function labelFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context) {
|
|
1609
1604
|
const labelNode = metaLemmaMetathoremNode.getLabelNode(),
|
|
1610
|
-
|
|
1605
|
+
labelString = context.nodeAsString(labelNode),
|
|
1606
|
+
label = labelFromLabelString(labelString, context);
|
|
1611
1607
|
|
|
1612
1608
|
return label;
|
|
1613
1609
|
}
|
|
@@ -1729,7 +1725,8 @@ export function signatureFromJSatisfiesAssertionNode(sasisfiesAssertionNode, con
|
|
|
1729
1725
|
|
|
1730
1726
|
export function referenceFromJSatisfiesAssertionNode(sasisfiesAssertionNode, context) {
|
|
1731
1727
|
const referenceNode = sasisfiesAssertionNode.getReferenceNode(),
|
|
1732
|
-
|
|
1728
|
+
referenceString = context.nodeAsString(referenceNode),
|
|
1729
|
+
reference = referenceFromReferenceString(referenceString, context);
|
|
1733
1730
|
|
|
1734
1731
|
return reference;
|
|
1735
1732
|
}
|
|
@@ -1754,6 +1751,12 @@ export function resolvedFromStatementSubstitutionNode(statementSubstitutionNode,
|
|
|
1754
1751
|
return resolved;
|
|
1755
1752
|
}
|
|
1756
1753
|
|
|
1754
|
+
export function topLevelMetaAssertionFromReferenceNode(referenceNode, context) {
|
|
1755
|
+
const topLevelMetaAssertion = null;
|
|
1756
|
+
|
|
1757
|
+
return topLevelMetaAssertion;
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1757
1760
|
export function deductionFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context) {
|
|
1758
1761
|
const deductionNode = metaLemmaMetathoremNode.getDeductionNode(),
|
|
1759
1762
|
deduction = deductionFromDeductionNode(deductionNode, context);
|
|
@@ -1887,14 +1890,16 @@ export function metavariableFromMetavariableDeclarationNode(metavariableDeclarat
|
|
|
1887
1890
|
|
|
1888
1891
|
export function targetReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode, context) {
|
|
1889
1892
|
const targetReferenceNode = referenceSubstitutionNode.getTargetReferenceNode(),
|
|
1890
|
-
|
|
1893
|
+
targetReferenceString = context.nodeAsString(targetReferenceNode),
|
|
1894
|
+
targetRefernece = referenceFromReferenceString(targetReferenceString, context);
|
|
1891
1895
|
|
|
1892
1896
|
return targetRefernece;
|
|
1893
1897
|
}
|
|
1894
1898
|
|
|
1895
1899
|
export function targetReferenceFromMetaLevelSubstitutionNode(metaLevelSubstitutionNode, context) {
|
|
1896
1900
|
const targetReferenceNode = metaLevelSubstitutionNode.getTargetReferenceNode(),
|
|
1897
|
-
|
|
1901
|
+
targetReferenceString = context.nodeAsString(targetReferenceNode),
|
|
1902
|
+
targetRefernece = referenceFromReferenceString(targetReferenceString, context);
|
|
1898
1903
|
|
|
1899
1904
|
return targetRefernece;
|
|
1900
1905
|
}
|
|
@@ -1932,7 +1937,8 @@ export function frameSubstitutionFromStatementSubstitutionNode(statementSubstitu
|
|
|
1932
1937
|
|
|
1933
1938
|
export function replacementReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode, context) {
|
|
1934
1939
|
const replacementReferenceNode = referenceSubstitutionNode.getReplacementReferenceNode(),
|
|
1935
|
-
|
|
1940
|
+
replacementReferenceString = context.nodeAsString(replacementReferenceNode),
|
|
1941
|
+
replacementReference = referenceFromReferenceString(replacementReferenceString, context);
|
|
1936
1942
|
|
|
1937
1943
|
return replacementReference;
|
|
1938
1944
|
}
|
|
@@ -1980,7 +1986,8 @@ export function typesFromTypesNode(typesNode, context) {
|
|
|
1980
1986
|
|
|
1981
1987
|
export function labelsFromLabelNodes(labelNodes, context) {
|
|
1982
1988
|
const labels = labelNodes.map((labelNode) => {
|
|
1983
|
-
const
|
|
1989
|
+
const labelString = context.nodeAsString(labelNode),
|
|
1990
|
+
label = labelFromLabelString(labelString, context);
|
|
1984
1991
|
|
|
1985
1992
|
return label;
|
|
1986
1993
|
});
|
|
@@ -2069,3 +2076,33 @@ export function stepsOrSubproofsFromSubDerivationNode(subDerivationNode, context
|
|
|
2069
2076
|
|
|
2070
2077
|
return stepsOrSubproofs;
|
|
2071
2078
|
}
|
|
2079
|
+
|
|
2080
|
+
export function labelFromLabelString(labelString, context) {
|
|
2081
|
+
let label;
|
|
2082
|
+
|
|
2083
|
+
simplify((context) => {
|
|
2084
|
+
instantiate((context) => {
|
|
2085
|
+
const string = labelString, ///
|
|
2086
|
+
labelNode = instantiateLabel(string, context);
|
|
2087
|
+
|
|
2088
|
+
label = labelFromLabelNode(labelNode, context);
|
|
2089
|
+
}, context);
|
|
2090
|
+
}, context);
|
|
2091
|
+
|
|
2092
|
+
return label;
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
export function referenceFromReferenceString(referenceString, context) {
|
|
2096
|
+
let reference;
|
|
2097
|
+
|
|
2098
|
+
simplify((context) => {
|
|
2099
|
+
instantiate((context) => {
|
|
2100
|
+
const string = referenceString, ///
|
|
2101
|
+
referenceNode = instantiateReference(string, context);
|
|
2102
|
+
|
|
2103
|
+
reference = referenceFromReferenceNode(referenceNode, context);
|
|
2104
|
+
}, context);
|
|
2105
|
+
}, context);
|
|
2106
|
+
|
|
2107
|
+
return reference;
|
|
2108
|
+
}
|
package/src/utilities/json.js
CHANGED
|
@@ -56,6 +56,19 @@ export function typeFromJSON(json, context) {
|
|
|
56
56
|
return type;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
export function labelFromJSON(json, context) {
|
|
60
|
+
let { label } = json;
|
|
61
|
+
|
|
62
|
+
const { Label } = elements,
|
|
63
|
+
labelJSON = label; ///
|
|
64
|
+
|
|
65
|
+
json = labelJSON; ///
|
|
66
|
+
|
|
67
|
+
label = Label.fromJSON(json, context);
|
|
68
|
+
|
|
69
|
+
return label;
|
|
70
|
+
}
|
|
71
|
+
|
|
59
72
|
export function frameFromJSON(json, context) {
|
|
60
73
|
let { frame } = json;
|
|
61
74
|
|
|
@@ -270,19 +283,6 @@ export function rulesFromJSON(json, context) {
|
|
|
270
283
|
return rules;
|
|
271
284
|
}
|
|
272
285
|
|
|
273
|
-
export function labelFromJSON(json, context) {
|
|
274
|
-
let { label } = json;
|
|
275
|
-
|
|
276
|
-
const { Label } = elements,
|
|
277
|
-
labelJSON = label; ///
|
|
278
|
-
|
|
279
|
-
json = labelJSON; ///
|
|
280
|
-
|
|
281
|
-
label = Label.fromJSON(json, context);
|
|
282
|
-
|
|
283
|
-
return label;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
286
|
export function framesFromJSON(json, context) {
|
|
287
287
|
let { frames } = json;
|
|
288
288
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
judgementFromStatementNode,
|
|
3
|
+
import { judgementFromStatementNode,
|
|
5
4
|
metavariableFromStatementNode,
|
|
6
5
|
typeAssertionFromStatementNode,
|
|
7
6
|
definedAssertionFromStatementNode,
|
|
@@ -10,13 +9,6 @@ import { equalityFromStatementNode,
|
|
|
10
9
|
containedAssertionFromStatementNode,
|
|
11
10
|
satisfiesAssertionFromStatementNode } from "../utilities/element";
|
|
12
11
|
|
|
13
|
-
export function equalityFromStatement(statement, context) {
|
|
14
|
-
const statementNode = statement.getNode(),
|
|
15
|
-
equality = equalityFromStatementNode(statementNode, context);
|
|
16
|
-
|
|
17
|
-
return equality;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
12
|
export function judgementFromStatement(statement, context) {
|
|
21
13
|
const statementNode = statement.getNode(),
|
|
22
14
|
judgement = judgementFromStatementNode(statementNode, context);
|
package/src/utilities/string.js
CHANGED
|
@@ -108,8 +108,8 @@ export function suppositionsStringFromSuppositions(suppositions) {
|
|
|
108
108
|
const suppositionString = supposition.getString();
|
|
109
109
|
|
|
110
110
|
suppositionsString = (suppositionsString === null) ?
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
suppositionString: ///
|
|
112
|
+
`${suppositionsString}, ${suppositionString}`;
|
|
113
113
|
|
|
114
114
|
return suppositionsString;
|
|
115
115
|
}, null);
|
|
@@ -117,6 +117,20 @@ 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
|
+
|
|
120
134
|
export function signatureStringFromTerms(terms) {
|
|
121
135
|
const termsString = termsStringFromTerms(terms),
|
|
122
136
|
signatureString = `[${termsString}]`;
|
|
@@ -4,8 +4,8 @@ import { arrayUtilities } from "necessary";
|
|
|
4
4
|
|
|
5
5
|
import elements from "../elements";
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import { descend } from "./context";
|
|
8
|
+
import { judgementFromStatement,
|
|
9
9
|
typeAssertionFromStatement,
|
|
10
10
|
propertyAssertionFromStatement,
|
|
11
11
|
satisfiesAssertionFromStatement } from "../utilities/statement";
|
|
@@ -49,7 +49,7 @@ async function unifyStatementWithReference(statement, reference, satisfiesAssert
|
|
|
49
49
|
|
|
50
50
|
context.trace(`Unifying the '${statementString}' statement with the '${referenceString}' reference...`);
|
|
51
51
|
|
|
52
|
-
const topLevelAssertion = context.findTopLevelAssertionByReference(reference
|
|
52
|
+
const topLevelAssertion = context.findTopLevelAssertionByReference(reference);
|
|
53
53
|
|
|
54
54
|
if (topLevelAssertion !== null) {
|
|
55
55
|
const subproofOrProofAssertions = context.getSubproofOrProofAssertions(),
|
|
@@ -91,9 +91,9 @@ async function unifyStatementAsSatisfiesAssertion(statement, reference, satisfie
|
|
|
91
91
|
|
|
92
92
|
context.trace(`Unifying the '${statementString}' statement as a satisfies assertion...`);
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
descend((context) => {
|
|
95
|
+
satisfiesAssertion.verifySignature(context);
|
|
96
|
+
}, context);
|
|
97
97
|
|
|
98
98
|
if (reference === null) {
|
|
99
99
|
const subproofOrProofAssertions = context.getSubproofOrProofAssertions();
|
|
@@ -106,7 +106,7 @@ async function unifyStatementAsSatisfiesAssertion(statement, reference, satisfie
|
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
108
|
} else {
|
|
109
|
-
const topLevelAssertion = context.findTopLevelAssertionByReference(reference
|
|
109
|
+
const topLevelAssertion = context.findTopLevelAssertionByReference(reference);
|
|
110
110
|
|
|
111
111
|
if (topLevelAssertion !== null) {
|
|
112
112
|
reference = satisfiesAssertion.getReference();
|
|
@@ -147,7 +147,7 @@ async function unifyStatementWithTopLevelAssertion(statement, reference, satisfi
|
|
|
147
147
|
let statementUnifiesWithTopLevelAssertion = false;
|
|
148
148
|
|
|
149
149
|
if (reference !== null) {
|
|
150
|
-
const topLevelAssertion = context.findTopLevelAssertionByReference(reference
|
|
150
|
+
const topLevelAssertion = context.findTopLevelAssertionByReference(reference);
|
|
151
151
|
|
|
152
152
|
if (topLevelAssertion !== null) {
|
|
153
153
|
const statementString = statement.getString(),
|
|
@@ -175,7 +175,8 @@ async function unifyStatementAsEquality(statement, reference, satisfiesAssertion
|
|
|
175
175
|
let statementUnifiesAEquality = false;
|
|
176
176
|
|
|
177
177
|
if (reference === null) {
|
|
178
|
-
const
|
|
178
|
+
const { Equality } = elements,
|
|
179
|
+
equality = Equality.fromStatement(statement, context);
|
|
179
180
|
|
|
180
181
|
if (equality !== null) {
|
|
181
182
|
const statementString = statement.getString();
|