occam-verify-cli 1.0.800 → 1.0.809
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/bounded.js +242 -0
- package/lib/context/branching.js +2 -2
- package/lib/context/ephemeral.js +186 -69
- package/lib/context/file/nominal.js +87 -52
- package/lib/context/liminal.js +2 -2
- package/lib/context/synoptic.js +212 -0
- package/lib/context.js +57 -17
- package/lib/element/assertion/defined.js +3 -3
- package/lib/element/assumption/metaLevel.js +6 -4
- package/lib/element/combinator.js +4 -2
- package/lib/element/conclusion.js +4 -2
- package/lib/element/constructor.js +4 -2
- package/lib/element/declaration/metavariable.js +10 -9
- package/lib/element/declaration/variable.js +7 -7
- package/lib/element/deduction.js +4 -2
- package/lib/element/derivation.js +1 -7
- package/lib/element/label.js +9 -5
- package/lib/element/metavariable.js +34 -34
- package/lib/element/procedureCall.js +2 -2
- package/lib/element/proof.js +2 -2
- package/lib/element/proofAssertion/premise.js +4 -3
- package/lib/element/proofAssertion/step.js +5 -3
- package/lib/element/reference.js +6 -4
- package/lib/element/rule.js +2 -2
- package/lib/element/statement.js +9 -1
- package/lib/element/subproof.js +2 -2
- package/lib/element/substitution/frame.js +43 -29
- package/lib/element/substitution/reference.js +38 -28
- package/lib/element/substitution/statement.js +52 -42
- package/lib/element/substitution/term.js +49 -35
- package/lib/element/topLevelAssertion.js +2 -2
- package/lib/element/topLevelMetaAssertion.js +2 -2
- package/lib/element/variable.js +6 -7
- package/lib/preamble.js +1 -2
- package/lib/process/assign.js +11 -10
- package/lib/process/equate.js +3 -2
- package/lib/process/unify.js +7 -7
- package/lib/utilities/context.js +51 -44
- package/lib/utilities/element.js +1 -1
- package/lib/utilities/equivalences.js +131 -0
- package/lib/utilities/instance.js +3 -3
- package/lib/utilities/json.js +59 -1
- package/lib/utilities/validation.js +4 -3
- package/package.json +4 -4
- package/src/context/{proof.js → bounded.js} +84 -85
- package/src/context/branching.js +2 -2
- package/src/context/ephemeral.js +421 -237
- package/src/context/file/nominal.js +127 -77
- package/src/context/liminal.js +2 -2
- package/src/context/synoptic.js +290 -0
- package/src/context.js +81 -20
- package/src/element/assertion/defined.js +4 -4
- package/src/element/assumption/metaLevel.js +8 -6
- package/src/element/combinator.js +4 -2
- package/src/element/conclusion.js +4 -2
- package/src/element/constructor.js +4 -2
- package/src/element/declaration/metavariable.js +10 -8
- package/src/element/declaration/variable.js +8 -7
- package/src/element/deduction.js +4 -2
- package/src/element/derivation.js +0 -2
- package/src/element/label.js +11 -7
- package/src/element/metavariable.js +11 -11
- package/src/element/procedureCall.js +2 -2
- package/src/element/proof.js +2 -2
- package/src/element/proofAssertion/premise.js +4 -4
- package/src/element/proofAssertion/step.js +6 -4
- package/src/element/reference.js +7 -5
- package/src/element/rule.js +2 -2
- package/src/element/statement.js +14 -0
- package/src/element/subproof.js +2 -2
- package/src/element/substitution/frame.js +47 -32
- package/src/element/substitution/reference.js +44 -34
- package/src/element/substitution/statement.js +69 -58
- package/src/element/substitution/term.js +53 -38
- package/src/element/topLevelAssertion.js +2 -2
- package/src/element/topLevelMetaAssertion.js +2 -2
- package/src/element/variable.js +6 -7
- package/src/preamble.js +0 -1
- package/src/process/assign.js +17 -14
- package/src/process/equate.js +3 -1
- package/src/process/unify.js +10 -13
- package/src/utilities/context.js +54 -49
- package/src/utilities/element.js +1 -0
- package/src/utilities/equivalences.js +158 -0
- package/src/utilities/instance.js +3 -3
- package/src/utilities/json.js +66 -0
- package/src/utilities/validation.js +6 -5
- package/lib/context/proof.js +0 -242
- package/lib/context/synthetic.js +0 -135
- package/lib/element/equivalences.js +0 -173
- package/src/context/synthetic.js +0 -180
- package/src/element/equivalences.js +0 -237
|
@@ -3,52 +3,23 @@
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
5
|
import Context from "../context";
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
import { mergeEquivalences, findEquivalenceByTerm, equivalencesFromEquality, separateGroundedTermsAndDefinedVariables } from "../utilities/equivalences";
|
|
7
8
|
|
|
8
9
|
const { last, filter } = arrayUtilities;
|
|
9
10
|
|
|
10
|
-
class
|
|
11
|
-
constructor(context,
|
|
11
|
+
class BoundedContext extends Context {
|
|
12
|
+
constructor(context, assignments, equivalences, declaredVariables, declaredJudgements, metaLevelAssumptions, subproofOrProofAssertions) {
|
|
12
13
|
super(context);
|
|
13
14
|
|
|
14
|
-
this.variables = variables;
|
|
15
|
-
this.judgements = judgements;
|
|
16
15
|
this.assignments = assignments;
|
|
17
16
|
this.equivalences = equivalences;
|
|
17
|
+
this.declaredVariables = declaredVariables;
|
|
18
|
+
this.declaredJudgements = declaredJudgements;
|
|
18
19
|
this.metaLevelAssumptions = metaLevelAssumptions;
|
|
19
20
|
this.subproofOrProofAssertions = subproofOrProofAssertions;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
getVariables() {
|
|
23
|
-
let variables;
|
|
24
|
-
|
|
25
|
-
const context = this.getContext();
|
|
26
|
-
|
|
27
|
-
variables = context.getVariables();
|
|
28
|
-
|
|
29
|
-
variables = [
|
|
30
|
-
...this.variables,
|
|
31
|
-
...variables
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
return variables;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
getJudgements() {
|
|
38
|
-
let judgements;
|
|
39
|
-
|
|
40
|
-
const context = this.getContext();
|
|
41
|
-
|
|
42
|
-
judgements = context.getJudgements();
|
|
43
|
-
|
|
44
|
-
judgements = [ ///
|
|
45
|
-
...this.judgements,
|
|
46
|
-
...judgements
|
|
47
|
-
]
|
|
48
|
-
|
|
49
|
-
return judgements;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
23
|
getAssignments() {
|
|
53
24
|
return this.assignments;
|
|
54
25
|
}
|
|
@@ -64,11 +35,41 @@ class ProofContext extends Context {
|
|
|
64
35
|
|
|
65
36
|
context = this; ///
|
|
66
37
|
|
|
67
|
-
equivalences = this.equivalences
|
|
38
|
+
equivalences = mergeEquivalences(this.equivalences, equivalences, context); ///
|
|
68
39
|
|
|
69
40
|
return equivalences;
|
|
70
41
|
}
|
|
71
42
|
|
|
43
|
+
getDeclaredVariables() {
|
|
44
|
+
let declaredVariables;
|
|
45
|
+
|
|
46
|
+
const context = this.getContext();
|
|
47
|
+
|
|
48
|
+
declaredVariables = context.getDeclaredVariables();
|
|
49
|
+
|
|
50
|
+
declaredVariables = [
|
|
51
|
+
...this.declaredVariables,
|
|
52
|
+
...declaredVariables
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
return declaredVariables;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
getDeclaredJudgements() {
|
|
59
|
+
let declaredJudgements;
|
|
60
|
+
|
|
61
|
+
const context = this.getContext();
|
|
62
|
+
|
|
63
|
+
declaredJudgements = context.getDeclaredJudgements();
|
|
64
|
+
|
|
65
|
+
declaredJudgements = [ ///
|
|
66
|
+
...this.declaredJudgements,
|
|
67
|
+
...declaredJudgements
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
return declaredJudgements;
|
|
71
|
+
}
|
|
72
|
+
|
|
72
73
|
getMetaLevelAssumptions() {
|
|
73
74
|
return this.metaLevelAssumptions;
|
|
74
75
|
}
|
|
@@ -139,10 +140,9 @@ class ProofContext extends Context {
|
|
|
139
140
|
const equalityRelfexive = equality.isReflexive();
|
|
140
141
|
|
|
141
142
|
if (!equalityRelfexive) {
|
|
142
|
-
const
|
|
143
|
-
equivalence = Equivalence.fromEquality(equality, context);
|
|
143
|
+
const equivalence = equivalencesFromEquality(equality, context);
|
|
144
144
|
|
|
145
|
-
this.equivalences = this.equivalences
|
|
145
|
+
this.equivalences = mergeEquivalences(this.equivalences, equivalence, context);
|
|
146
146
|
|
|
147
147
|
context.debug(`...added the '${equalityString}' equality to the proof context.`);
|
|
148
148
|
} else {
|
|
@@ -150,38 +150,38 @@ class ProofContext extends Context {
|
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
context.trace(`Adding the '${variableString}' variable to the proof context...`);
|
|
153
|
+
addAssignment(assignment) {
|
|
154
|
+
this.assignments.push(assignment);
|
|
155
|
+
}
|
|
158
156
|
|
|
159
|
-
|
|
157
|
+
assignAssignments() {
|
|
158
|
+
const context = this; ///
|
|
160
159
|
|
|
161
|
-
|
|
160
|
+
this.assignments.forEach((assignment) => {
|
|
161
|
+
assignment(context);
|
|
162
|
+
});
|
|
162
163
|
}
|
|
163
164
|
|
|
164
|
-
|
|
165
|
+
addDEclaredVariable(declaredVariable) {
|
|
165
166
|
const context = this, ///
|
|
166
|
-
|
|
167
|
+
declaredVariableString = declaredVariable.getString();
|
|
167
168
|
|
|
168
|
-
context.trace(`Adding the '${
|
|
169
|
+
context.trace(`Adding the '${declaredVariableString}' declared variable to the proof context...`);
|
|
169
170
|
|
|
170
|
-
this.
|
|
171
|
+
this.declaredVariables.push(declaredVariable);
|
|
171
172
|
|
|
172
|
-
context.debug(`...added the '${
|
|
173
|
+
context.debug(`...added the '${declaredVariableString}' declared variable to the proof context.`);
|
|
173
174
|
}
|
|
174
175
|
|
|
175
|
-
|
|
176
|
-
this
|
|
177
|
-
|
|
176
|
+
addDeclaredJudgement(declaredJudgement) {
|
|
177
|
+
const context = this, ///
|
|
178
|
+
declaredJudgementString = declaredJudgement.getString();
|
|
178
179
|
|
|
179
|
-
|
|
180
|
-
const context = this; ///
|
|
180
|
+
context.trace(`Adding the '${declaredJudgementString}' declared judgement to the proof context...`);
|
|
181
181
|
|
|
182
|
-
this.
|
|
183
|
-
|
|
184
|
-
});
|
|
182
|
+
this.declaredJudgements.push(declaredJudgement);
|
|
183
|
+
|
|
184
|
+
context.debug(`...added the '${declaredJudgementString}' declared judgement to the proof context.`);
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
addMetaLevelAssumption(metaLevelAssumption) {
|
|
@@ -210,9 +210,9 @@ class ProofContext extends Context {
|
|
|
210
210
|
context.debug(`The '${metaLevelAssumptionString}' metaLevelAssumption has already been added to the proof context.`);
|
|
211
211
|
} else {
|
|
212
212
|
this.metaLevelAssumptions.push(metaLevelAssumption);
|
|
213
|
-
|
|
214
|
-
context.debug(`...added the '${metaLevelAssumptionString}' meta-level assumption to the proof context.`);
|
|
215
213
|
}
|
|
214
|
+
|
|
215
|
+
context.debug(`...added the '${metaLevelAssumptionString}' meta-level assumption to the proof context.`);
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
addSubproofOrProofAssertion(subproofOrProofAssertion) {
|
|
@@ -240,11 +240,11 @@ class ProofContext extends Context {
|
|
|
240
240
|
return comparesToTermAndPropertyRelation;
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
findEquivalenceByTerm(term) { return this.equivalences
|
|
243
|
+
findEquivalenceByTerm(term) { return findEquivalenceByTerm(this.equivalences, term); }
|
|
244
244
|
|
|
245
245
|
findJudgementByMetavariableName(metavariableName) {
|
|
246
|
-
const
|
|
247
|
-
judgement =
|
|
246
|
+
const declaredJudgements = this.getJudgements(),
|
|
247
|
+
judgement = declaredJudgements.find((judgement) => {
|
|
248
248
|
const judgementMetavariableComparesToMetavariable = judgement.compareMetavariableName(metavariableName);
|
|
249
249
|
|
|
250
250
|
if (judgementMetavariableComparesToMetavariable) {
|
|
@@ -255,23 +255,23 @@ class ProofContext extends Context {
|
|
|
255
255
|
return judgement;
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
-
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
const variableComparesToVariableIdentifier =
|
|
258
|
+
findDeclaredVariableByVariableIdentifier(variableIdentifier) {
|
|
259
|
+
const declaredVariables = this.getDeclaredVariables(),
|
|
260
|
+
declaredVariable = declaredVariables.find((declaredVariable) => {
|
|
261
|
+
const variableComparesToVariableIdentifier = declaredVariable.compareVariableIdentifier(variableIdentifier);
|
|
262
262
|
|
|
263
263
|
if (variableComparesToVariableIdentifier) {
|
|
264
264
|
return true;
|
|
265
265
|
}
|
|
266
266
|
}) || null;
|
|
267
267
|
|
|
268
|
-
return
|
|
268
|
+
return declaredVariable;
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
findJudgementsByMetavariableNode(metavariableNode) {
|
|
272
|
-
const
|
|
272
|
+
const declaredJudgements = this.getJudgements();
|
|
273
273
|
|
|
274
|
-
filter(
|
|
274
|
+
filter(declaredJudgements, (judgement) => {
|
|
275
275
|
const metavariableNodeMatches = judgement.matchMetavariableNode(metavariableNode);
|
|
276
276
|
|
|
277
277
|
if (metavariableNodeMatches) {
|
|
@@ -279,7 +279,7 @@ class ProofContext extends Context {
|
|
|
279
279
|
}
|
|
280
280
|
});
|
|
281
281
|
|
|
282
|
-
return
|
|
282
|
+
return declaredJudgements;
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
findMetaLevelAssumptionByMetaLevelAssumptionNode(metaLevelAssumptionNode) {
|
|
@@ -307,11 +307,11 @@ class ProofContext extends Context {
|
|
|
307
307
|
return judgementPresent;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
-
|
|
311
|
-
const
|
|
312
|
-
|
|
310
|
+
isDeclaredVariablePresentByVariableIdentifier(variableIdentifier) {
|
|
311
|
+
const declaredVariable = this.findDeclaredVariableByVariableIdentifier(variableIdentifier),
|
|
312
|
+
declaredVariablePresent = (declaredVariable !== null);
|
|
313
313
|
|
|
314
|
-
return
|
|
314
|
+
return declaredVariablePresent;
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
isTermGrounded(term) {
|
|
@@ -320,7 +320,7 @@ class ProofContext extends Context {
|
|
|
320
320
|
groundedTerms = [],
|
|
321
321
|
definedVariables = [];
|
|
322
322
|
|
|
323
|
-
|
|
323
|
+
separateGroundedTermsAndDefinedVariables(equivalences, groundedTerms, definedVariables, context);
|
|
324
324
|
|
|
325
325
|
const termMatchesGroundedTerm = groundedTerms.some((groundedTerm) => {
|
|
326
326
|
const groundedTermNode = groundedTerm.getNode(),
|
|
@@ -336,16 +336,15 @@ class ProofContext extends Context {
|
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
static fromMetaLevelAssumptions(metaLevelAssumptions, context) {
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
equivalences = Equivalences.fromNothing(context),
|
|
339
|
+
const assignments = [],
|
|
340
|
+
equivalences = [],
|
|
341
|
+
declaredVariables = [],
|
|
342
|
+
declaredJudgements = [],
|
|
344
343
|
subproofOrProofAssertions = [],
|
|
345
|
-
|
|
344
|
+
boundedContext = new BoundedContext(context, assignments, equivalences, declaredVariables, declaredJudgements, metaLevelAssumptions, subproofOrProofAssertions);
|
|
346
345
|
|
|
347
|
-
return
|
|
346
|
+
return boundedContext;
|
|
348
347
|
}
|
|
349
348
|
}
|
|
350
349
|
|
|
351
|
-
export default
|
|
350
|
+
export default BoundedContext;
|
package/src/context/branching.js
CHANGED
|
@@ -33,9 +33,9 @@ export default class BranchingContext extends Context {
|
|
|
33
33
|
context.trace(`The '${termString}' term has already been added to the branching context.`);
|
|
34
34
|
} else {
|
|
35
35
|
this.terms.push(term);
|
|
36
|
-
|
|
37
|
-
context.debug(`...added the '${termString}' term to the branching context.`);
|
|
38
36
|
}
|
|
37
|
+
|
|
38
|
+
context.debug(`...added the '${termString}' term to the branching context.`);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
addTerms(terms) {
|