occam-verify-cli 1.0.852 → 1.0.857
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 +18 -3
- package/lib/context/liminal.js +101 -102
- package/lib/context/mnemic.js +511 -0
- package/lib/context.js +23 -11
- package/lib/element/assertion/contained.js +8 -8
- package/lib/element/assertion/defined.js +6 -6
- package/lib/element/assertion/satisfies.js +4 -4
- package/lib/element/assertion/type.js +5 -4
- package/lib/element/assumption/metaLevel.js +7 -7
- package/lib/element/assumption.js +23 -15
- package/lib/element/combinator.js +4 -4
- package/lib/element/conclusion.js +4 -4
- package/lib/element/constructor.js +4 -4
- package/lib/element/declaration/combinator.js +4 -4
- package/lib/element/declaration/complexType.js +3 -3
- package/lib/element/declaration/constructor.js +6 -4
- package/lib/element/declaration/metavariable.js +7 -7
- package/lib/element/declaration/variable.js +6 -4
- package/lib/element/deduction.js +4 -4
- package/lib/element/frame.js +60 -48
- package/lib/element/judgement.js +16 -29
- package/lib/element/label.js +4 -4
- package/lib/element/metavariable.js +59 -58
- package/lib/element/proofAssertion/premise.js +4 -4
- package/lib/element/reference.js +20 -20
- package/lib/element/rule.js +4 -4
- package/lib/element/substitution/frame.js +9 -8
- package/lib/element/substitution/reference.js +7 -7
- package/lib/element/substitution/statement.js +12 -11
- package/lib/element/substitution/term.js +9 -8
- package/lib/element/topLevelAssertion.js +4 -4
- package/lib/element/topLevelMetaAssertion.js +2 -2
- package/lib/element/variable.js +8 -8
- package/lib/utilities/context.js +6 -6
- package/lib/utilities/element.js +3 -3
- package/lib/utilities/json.js +16 -16
- package/lib/utilities/string.js +7 -29
- package/lib/utilities/substitutions.js +6 -6
- package/package.json +1 -1
- package/src/context/file/nominal.js +24 -2
- package/src/context/liminal.js +116 -117
- package/src/context/{ephemeral.js → mnemic.js} +38 -40
- package/src/context.js +32 -12
- package/src/element/assertion/contained.js +7 -7
- package/src/element/assertion/defined.js +5 -5
- package/src/element/assertion/satisfies.js +3 -4
- package/src/element/assertion/type.js +5 -4
- package/src/element/assumption/metaLevel.js +6 -8
- package/src/element/assumption.js +28 -17
- package/src/element/combinator.js +3 -4
- package/src/element/conclusion.js +3 -4
- package/src/element/constructor.js +3 -4
- package/src/element/declaration/combinator.js +3 -4
- package/src/element/declaration/complexType.js +2 -2
- package/src/element/declaration/constructor.js +7 -4
- package/src/element/declaration/metavariable.js +6 -8
- package/src/element/declaration/variable.js +7 -4
- package/src/element/deduction.js +3 -4
- package/src/element/frame.js +81 -64
- package/src/element/judgement.js +21 -43
- package/src/element/label.js +3 -4
- package/src/element/metavariable.js +66 -73
- package/src/element/proofAssertion/premise.js +3 -4
- package/src/element/reference.js +21 -25
- package/src/element/rule.js +3 -3
- package/src/element/substitution/frame.js +7 -7
- package/src/element/substitution/reference.js +4 -6
- package/src/element/substitution/statement.js +9 -10
- package/src/element/substitution/term.js +7 -7
- package/src/element/topLevelAssertion.js +3 -3
- package/src/element/topLevelMetaAssertion.js +2 -2
- package/src/element/variable.js +7 -8
- package/src/utilities/context.js +9 -9
- package/src/utilities/element.js +3 -3
- package/src/utilities/json.js +9 -9
- package/src/utilities/string.js +11 -40
- package/src/utilities/substitutions.js +3 -3
- package/lib/context/ephemeral.js +0 -513
package/src/element/variable.js
CHANGED
|
@@ -113,22 +113,21 @@ export default define(class Variable extends Element {
|
|
|
113
113
|
context.trace(`Unifying the '${termString}' term with the '${variableString}' variable...`);
|
|
114
114
|
|
|
115
115
|
let variable,
|
|
116
|
-
|
|
116
|
+
derivedSubstitution;
|
|
117
117
|
|
|
118
118
|
variable = this; ///
|
|
119
119
|
|
|
120
120
|
const variableNode = variable.getNode();
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
derivedSubstitution = context.findDerivedSubstitutionByVariableNode(variableNode);
|
|
123
123
|
|
|
124
|
-
if (
|
|
125
|
-
const
|
|
124
|
+
if (derivedSubstitution !== null) {
|
|
125
|
+
const derivedSubstitutionComparesToTerm = derivedSubstitution.compareTerm(term, context);
|
|
126
126
|
|
|
127
|
-
if (
|
|
128
|
-
const
|
|
129
|
-
termSubstitutionString = termSubstitution.getString();
|
|
127
|
+
if (derivedSubstitutionComparesToTerm) {
|
|
128
|
+
const derivedSubstitutionString = derivedSubstitution.getString();
|
|
130
129
|
|
|
131
|
-
context.trace(`The '${
|
|
130
|
+
context.trace(`The '${derivedSubstitutionString}' derived substitution is already present.`);
|
|
132
131
|
|
|
133
132
|
termUnifies = true;
|
|
134
133
|
}
|
package/src/utilities/context.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import MenmicContext from "../context/mnemic";
|
|
3
4
|
import NestedContext from "../context/nested";
|
|
4
5
|
import TheticContext from "../context/thetic";
|
|
5
6
|
import BoundedContext from "../context/bounded";
|
|
@@ -8,11 +9,10 @@ import LiteralContext from "../context/literal";
|
|
|
8
9
|
import LiminalContext from "../context/liminal";
|
|
9
10
|
import SynopticContext from "../context/synoptic";
|
|
10
11
|
import IllativeContext from "../context/illative";
|
|
11
|
-
import EphemeralContext from "../context/ephemeral";
|
|
12
12
|
import BranchingContext from "../context/branching";
|
|
13
13
|
import NominalFileContext from "../context/file/nominal";
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { mnemicContextsFromJSON, mnemicContextToMnemicContextJSON } from "../utilities/json";
|
|
16
16
|
|
|
17
17
|
export function join(innerFunction, ...contexts) {
|
|
18
18
|
const synopticContext = SynopticContext.fromContexts(...contexts),
|
|
@@ -81,9 +81,9 @@ export function descend(innerFunction, context) {
|
|
|
81
81
|
|
|
82
82
|
export function attempt(innerFunction, ...contexts) {
|
|
83
83
|
contexts = contexts.map((context) => { ///
|
|
84
|
-
const
|
|
84
|
+
const mnemicContext = MenmicContext.fromNothing(context);
|
|
85
85
|
|
|
86
|
-
context =
|
|
86
|
+
context = mnemicContext; ///
|
|
87
87
|
|
|
88
88
|
return context;
|
|
89
89
|
})
|
|
@@ -121,9 +121,9 @@ export function reconcile(innerFunction, context) {
|
|
|
121
121
|
|
|
122
122
|
export function serialise(innerFunction, ...contexts) {
|
|
123
123
|
contexts = contexts.map((context) => { ///
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
contextJSON =
|
|
124
|
+
const mnemicContext = context, ///
|
|
125
|
+
mnemicContextJSON = mnemicContextToMnemicContextJSON(mnemicContext),
|
|
126
|
+
contextJSON = mnemicContextJSON; ///
|
|
127
127
|
|
|
128
128
|
context = contextJSON; ///
|
|
129
129
|
|
|
@@ -134,8 +134,8 @@ export function serialise(innerFunction, ...contexts) {
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
export function unserialise(innerFunction, json, context) {
|
|
137
|
-
const
|
|
138
|
-
contexts =
|
|
137
|
+
const mnemicContexts = mnemicContextsFromJSON(json, context),
|
|
138
|
+
contexts = mnemicContexts; ///
|
|
139
139
|
|
|
140
140
|
return innerFunction(json, ...contexts);
|
|
141
141
|
}
|
package/src/utilities/element.js
CHANGED
|
@@ -10,7 +10,7 @@ import { equivalenceStringFromTerms,
|
|
|
10
10
|
subproofStringFromSuppositionsAndSubDerivation,
|
|
11
11
|
procedureCallStringFromProcedureReferenceAndParameters,
|
|
12
12
|
topLevelAssertionStringFromLabelsSuppositionsAndDeduction,
|
|
13
|
-
|
|
13
|
+
topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction } from "../utilities/string";
|
|
14
14
|
|
|
15
15
|
export function typeFromTypeNode(typeNode, context) {
|
|
16
16
|
let type;
|
|
@@ -368,7 +368,7 @@ export function metaLemmaFromMetaLemmaNode(metaLemmaNode, context) {
|
|
|
368
368
|
deduction = deductionFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
369
369
|
suppositions = suppositionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
370
370
|
metaLevelAssumptions = metaLevelAssumptionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
371
|
-
topLevelMetaAssertionString =
|
|
371
|
+
topLevelMetaAssertionString = topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction(label, suppositions, deduction),
|
|
372
372
|
node = metaLemmaMetathoremNode, ///
|
|
373
373
|
string = topLevelMetaAssertionString, ///
|
|
374
374
|
lineIndex = null;
|
|
@@ -561,7 +561,7 @@ export function metatheoremFromMetatheoremNode(metatheoremNode, context) {
|
|
|
561
561
|
deduction = deductionFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
562
562
|
suppositions = suppositionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
563
563
|
metaLevelAssumptions = metaLevelAssumptionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
564
|
-
topLevelMetaAssertionString =
|
|
564
|
+
topLevelMetaAssertionString = topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction(label, suppositions, deduction),
|
|
565
565
|
node = metaLemmaMetathoremNode, ///
|
|
566
566
|
string = topLevelMetaAssertionString, ///
|
|
567
567
|
lineIndex = null;
|
package/src/utilities/json.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import elements from "../elements";
|
|
4
|
-
import
|
|
4
|
+
import MnemicContext from "../context/mnemic";
|
|
5
5
|
|
|
6
6
|
export function nameFromJSON(json, context) {
|
|
7
7
|
let { name } = json;
|
|
@@ -659,7 +659,7 @@ export function metavariablesFromJSON(json, context) {
|
|
|
659
659
|
return metavariables;
|
|
660
660
|
}
|
|
661
661
|
|
|
662
|
-
export function
|
|
662
|
+
export function mnemicContextsFromJSON(json, context) {
|
|
663
663
|
const releaseContext = context; ///
|
|
664
664
|
|
|
665
665
|
const { contexts = [] } = json;
|
|
@@ -671,15 +671,15 @@ export function ephemeralContextsFromJSON(json, context) {
|
|
|
671
671
|
}
|
|
672
672
|
|
|
673
673
|
const contextsJSON = contexts, ///
|
|
674
|
-
|
|
674
|
+
mnemicContexts = contextsJSON.map((contextJSON) => {
|
|
675
675
|
const json = contextJSON, ///
|
|
676
676
|
context = releaseContext, ///
|
|
677
|
-
|
|
677
|
+
mnemicContext = MnemicContext.fromJSON(json, context);
|
|
678
678
|
|
|
679
|
-
return
|
|
679
|
+
return mnemicContext; ///
|
|
680
680
|
});
|
|
681
681
|
|
|
682
|
-
return
|
|
682
|
+
return mnemicContexts;
|
|
683
683
|
}
|
|
684
684
|
|
|
685
685
|
export function declaredVariablesFromJSON(json, context) {
|
|
@@ -870,10 +870,10 @@ export function nominalTypeNameToNominalTypeNameJSON(nominalTypeName) {
|
|
|
870
870
|
return nominalTypeNameJSON;
|
|
871
871
|
}
|
|
872
872
|
|
|
873
|
-
export function
|
|
874
|
-
const
|
|
873
|
+
export function mnemicContextToMnemicContextJSON(mnemicContext) {
|
|
874
|
+
const mnemicContextJSON = mnemicContext.toJSON();
|
|
875
875
|
|
|
876
|
-
return
|
|
876
|
+
return mnemicContextJSON;
|
|
877
877
|
}
|
|
878
878
|
|
|
879
879
|
export function procedureReferenceToProcedureReferenceJSON(procedureReference) {
|
package/src/utilities/string.js
CHANGED
|
@@ -89,20 +89,6 @@ export function parametersStringFromParameters(parameters) {
|
|
|
89
89
|
return parametersString;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
export function assumptionsStringFromAssumptions(assumptions) {
|
|
93
|
-
const assumptionsString = assumptions.reduce((assumptionsString, assumption) => {
|
|
94
|
-
const assumptionString = assumption.getString();
|
|
95
|
-
|
|
96
|
-
assumptionsString = (assumptionsString === null) ?
|
|
97
|
-
assumptionString: ///
|
|
98
|
-
`${assumptionsString}, ${assumptionString}`;
|
|
99
|
-
|
|
100
|
-
return assumptionsString;
|
|
101
|
-
}, null);
|
|
102
|
-
|
|
103
|
-
return assumptionsString;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
92
|
export function suppositionsStringFromSuppositions(suppositions) {
|
|
107
93
|
const suppositionsString = suppositions.reduce((suppositionsString, supposition) => {
|
|
108
94
|
const suppositionString = supposition.getString();
|
|
@@ -117,20 +103,6 @@ export function suppositionsStringFromSuppositions(suppositions) {
|
|
|
117
103
|
return suppositionsString;
|
|
118
104
|
}
|
|
119
105
|
|
|
120
|
-
export function metalevelAssumptionsStringFromMetaLevelAssumptions(metaLevelAssumptions) {
|
|
121
|
-
const metaLevelAssumptionsString = metaLevelAssumptions.reduce((metaLevelAssumptionsString, metaLevelAssumption) => {
|
|
122
|
-
const metaLevelAssumptionString = metaLevelAssumption.getString();
|
|
123
|
-
|
|
124
|
-
metaLevelAssumptionsString = (metaLevelAssumptionsString === null) ?
|
|
125
|
-
metaLevelAssumptionString: ///
|
|
126
|
-
`${metaLevelAssumptionsString}, ${metaLevelAssumptionString}`;
|
|
127
|
-
|
|
128
|
-
return metaLevelAssumptionsString;
|
|
129
|
-
}, null);
|
|
130
|
-
|
|
131
|
-
return metaLevelAssumptionsString;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
106
|
export function signatureStringFromTerms(terms) {
|
|
135
107
|
const termsString = termsStringFromTerms(terms),
|
|
136
108
|
signatureString = `[${termsString}]`;
|
|
@@ -250,6 +222,17 @@ export function topLevelAssertionStringFromLabelsSuppositionsAndDeduction(labels
|
|
|
250
222
|
return topLevelAssertionString;
|
|
251
223
|
}
|
|
252
224
|
|
|
225
|
+
export function topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction(label, suppositions, deduction) {
|
|
226
|
+
const labelString = label.getString(),
|
|
227
|
+
deductionString = deduction.getString(),
|
|
228
|
+
suppositionsString = suppositionsStringFromSuppositions(suppositions),
|
|
229
|
+
topLevelMetaAssertionString = (suppositionsString !== null) ?
|
|
230
|
+
`${labelString} :: [${suppositionsString}]...${deductionString}` :
|
|
231
|
+
`${labelString} :: ${deductionString}`;
|
|
232
|
+
|
|
233
|
+
return topLevelMetaAssertionString;
|
|
234
|
+
}
|
|
235
|
+
|
|
253
236
|
export function statementSubstitutionStringFromStatementMetavariableAndSubstitution(statement, metavariable, substitution) {
|
|
254
237
|
const statementString = statement.getString(),
|
|
255
238
|
metavariableString = metavariable.getString(),
|
|
@@ -258,15 +241,3 @@ export function statementSubstitutionStringFromStatementMetavariableAndSubstitut
|
|
|
258
241
|
|
|
259
242
|
return statementSubstitutionString;
|
|
260
243
|
}
|
|
261
|
-
|
|
262
|
-
export function topLevelMetaAssertionStringFromLabelSuppositionsDeductionAndMetaLevelAssumptions(label, suppositions, deduction, metaLevelAssumptions) {
|
|
263
|
-
const labelString = label.getString(),
|
|
264
|
-
deductionString = deduction.getString(),
|
|
265
|
-
suppositionsString = suppositionsStringFromSuppositions(suppositions),
|
|
266
|
-
metalevelAssumptionsString = metalevelAssumptionsStringFromMetaLevelAssumptions(metaLevelAssumptions),
|
|
267
|
-
topLevelMetaAssertionString = (suppositionsString !== null) ?
|
|
268
|
-
`${labelString} :: [${suppositionsString}]...${deductionString} ${metalevelAssumptionsString}` :
|
|
269
|
-
`${labelString} :: ${deductionString} ${metalevelAssumptionsString}`;
|
|
270
|
-
|
|
271
|
-
return topLevelMetaAssertionString;
|
|
272
|
-
}
|
|
@@ -96,11 +96,11 @@ export function statementFromStatementAndSubstitutions(statement, generalContext
|
|
|
96
96
|
return statement;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
export function
|
|
99
|
+
export function metavariableNodesFromDerivedSubstitutions(derivedSubstitutions) {
|
|
100
100
|
const metavariableNodes = [];
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
const metavariableNode =
|
|
102
|
+
derivedSubstitutions.forEach((derivedSubstitution) => {
|
|
103
|
+
const metavariableNode = derivedSubstitution.getMetavariableNode();
|
|
104
104
|
|
|
105
105
|
if (metavariableNode !== null) {
|
|
106
106
|
metavariableNodes.push(metavariableNode);
|