occam-verify-cli 1.0.587 → 1.0.602
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 +74 -2
- package/lib/context/file/nominal.js +11 -9
- package/lib/context/liminal.js +161 -24
- package/lib/context/literal.js +8 -2
- package/lib/context/scoped.js +4 -28
- package/lib/context/synthetic.js +146 -0
- package/lib/context.js +170 -1
- package/lib/element/assertion/contained.js +21 -15
- package/lib/element/assertion/defined.js +45 -65
- package/lib/element/assertion/property.js +25 -19
- package/lib/element/assertion/satisfies.js +14 -8
- package/lib/element/assertion/subproof.js +12 -6
- package/lib/element/assertion.js +47 -1
- package/lib/element/assumption.js +12 -12
- package/lib/element/conclusion.js +2 -2
- package/lib/element/deduction.js +2 -2
- package/lib/element/frame.js +61 -29
- package/lib/element/judgement.js +7 -1
- package/lib/element/label.js +8 -8
- package/lib/element/metavariable.js +71 -59
- package/lib/element/procedureCall.js +24 -8
- package/lib/element/proof.js +43 -35
- package/lib/element/proofAssertion/premise.js +122 -97
- package/lib/element/proofAssertion/step.js +161 -115
- package/lib/element/proofAssertion/supposition.js +157 -118
- package/lib/element/proofAssertion.js +3 -3
- package/lib/element/reference.js +40 -7
- package/lib/element/rule.js +227 -95
- package/lib/element/signature.js +2 -1
- package/lib/element/statement.js +67 -34
- package/lib/element/substitution/frame.js +36 -16
- package/lib/element/substitution/reference.js +36 -16
- package/lib/element/substitution/statement.js +94 -55
- package/lib/element/substitution/term.js +36 -16
- package/lib/element/substitution.js +54 -17
- package/lib/element/substitutions.js +4 -276
- package/lib/element/term.js +60 -31
- package/lib/element/topLevelAssertion/axiom.js +13 -4
- package/lib/element/topLevelAssertion/conjecture.js +7 -2
- package/lib/element/topLevelAssertion/theorem.js +7 -2
- package/lib/element/topLevelAssertion.js +201 -134
- package/lib/element/topLevelMetaAssertion.js +310 -51
- package/lib/element/variable.js +15 -6
- package/lib/node/substitution/statement.js +33 -1
- package/lib/process/unify.js +6 -6
- package/lib/utilities/context.js +10 -25
- package/lib/utilities/element.js +34 -9
- package/lib/utilities/statement.js +1 -8
- package/lib/utilities/string.js +12 -1
- package/lib/utilities/substitutions.js +42 -16
- package/lib/utilities/unification.js +3 -1
- package/lib/utilities/validation.js +2 -2
- package/package.json +4 -4
- package/src/context/ephemeral.js +73 -1
- package/src/context/file/nominal.js +14 -11
- package/src/context/liminal.js +180 -25
- package/src/context/literal.js +3 -1
- package/src/context/scoped.js +3 -35
- package/src/context/synthetic.js +49 -0
- package/src/context.js +163 -1
- package/src/element/assertion/contained.js +28 -20
- package/src/element/assertion/defined.js +62 -34
- package/src/element/assertion/property.js +27 -19
- package/src/element/assertion/satisfies.js +15 -7
- package/src/element/assertion/subproof.js +13 -5
- package/src/element/assertion.js +35 -0
- package/src/element/assumption.js +5 -5
- package/src/element/conclusion.js +2 -4
- package/src/element/deduction.js +2 -4
- package/src/element/frame.js +71 -39
- package/src/element/judgement.js +2 -0
- package/src/element/label.js +4 -4
- package/src/element/metavariable.js +94 -75
- package/src/element/procedureCall.js +6 -6
- package/src/element/proof.js +6 -6
- package/src/element/proofAssertion/premise.js +101 -69
- package/src/element/proofAssertion/step.js +78 -39
- package/src/element/proofAssertion/supposition.js +141 -115
- package/src/element/proofAssertion.js +3 -2
- package/src/element/reference.js +52 -10
- package/src/element/rule.js +138 -76
- package/src/element/signature.js +2 -0
- package/src/element/statement.js +76 -45
- package/src/element/substitution/frame.js +44 -15
- package/src/element/substitution/reference.js +44 -15
- package/src/element/substitution/statement.js +124 -72
- package/src/element/substitution/term.js +43 -15
- package/src/element/substitution.js +55 -18
- package/src/element/substitutions.js +1 -258
- package/src/element/term.js +65 -34
- package/src/element/topLevelAssertion/axiom.js +1 -1
- package/src/element/topLevelAssertion/conjecture.js +1 -1
- package/src/element/topLevelAssertion/theorem.js +1 -1
- package/src/element/topLevelAssertion.js +128 -48
- package/src/element/topLevelMetaAssertion.js +86 -32
- package/src/element/variable.js +15 -5
- package/src/node/substitution/statement.js +33 -0
- package/src/process/unify.js +6 -8
- package/src/utilities/context.js +9 -8
- package/src/utilities/element.js +37 -10
- package/src/utilities/statement.js +0 -7
- package/src/utilities/string.js +14 -0
- package/src/utilities/substitutions.js +59 -17
- package/src/utilities/unification.js +4 -0
- package/src/utilities/validation.js +3 -1
package/src/utilities/element.js
CHANGED
|
@@ -668,17 +668,12 @@ export function referenceSubstitutionFromReferenceSubstitutionNode(referenceSubs
|
|
|
668
668
|
return referenceSubstitution;
|
|
669
669
|
}
|
|
670
670
|
|
|
671
|
-
export function statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode,
|
|
672
|
-
if (context === undefined) {
|
|
673
|
-
context = substitution; ///
|
|
674
|
-
|
|
675
|
-
substitution = null;
|
|
676
|
-
}
|
|
677
|
-
|
|
671
|
+
export function statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context) {
|
|
678
672
|
const { StatementSubstitution } = elements,
|
|
679
673
|
node = statementSubstitutionNode, ///
|
|
680
674
|
string = context.nodeAsString(node),
|
|
681
|
-
resolved = resolvedFromStatementSubstitutionNode(statementSubstitutionNode,
|
|
675
|
+
resolved = resolvedFromStatementSubstitutionNode(statementSubstitutionNode, context),
|
|
676
|
+
substitution = substitutionFromStatementSubstitutionNode(statementSubstitutionNode, context),
|
|
682
677
|
targetStatement = targetStatementFromStatementSubstitutionNode(statementSubstitutionNode, context),
|
|
683
678
|
replacementStatement = replacementStatementFromStatementSubstitutionNode(statementSubstitutionNode, context),
|
|
684
679
|
statementSubstitution = new StatementSubstitution(context, string, node, resolved, substitution, targetStatement, replacementStatement);
|
|
@@ -1431,8 +1426,8 @@ export function prefixedFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode,
|
|
|
1431
1426
|
return prefixed;
|
|
1432
1427
|
}
|
|
1433
1428
|
|
|
1434
|
-
export function resolvedFromStatementSubstitutionNode(statementSubstitutionNode,
|
|
1435
|
-
const resolved = (
|
|
1429
|
+
export function resolvedFromStatementSubstitutionNode(statementSubstitutionNode, context) {
|
|
1430
|
+
const resolved = statementSubstitutionNode.isResolved();
|
|
1436
1431
|
|
|
1437
1432
|
return resolved;
|
|
1438
1433
|
}
|
|
@@ -1506,6 +1501,14 @@ export function suppositionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNod
|
|
|
1506
1501
|
return suppositions;
|
|
1507
1502
|
}
|
|
1508
1503
|
|
|
1504
|
+
export function substitutionFromStatementSubstitutionNode(statementSubstitutionNode, context) {
|
|
1505
|
+
const frameSubstitution = frameSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context),
|
|
1506
|
+
termSubstitution = termSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context),
|
|
1507
|
+
substitution = (frameSubstitution || termSubstitution);
|
|
1508
|
+
|
|
1509
|
+
return substitution;
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1509
1512
|
export function constructorFromConstructorDeclarationNode(constructorDeclarationNode, context) {
|
|
1510
1513
|
const constructorNode = constructorDeclarationNode.getConstructorNode(),
|
|
1511
1514
|
constructor = constructorFromConstructorNode(constructorNode, context);
|
|
@@ -1534,6 +1537,30 @@ export function targetStatementFromStatementSubstitutionNode(statementSubstituti
|
|
|
1534
1537
|
return targetStatement;
|
|
1535
1538
|
}
|
|
1536
1539
|
|
|
1540
|
+
export function termSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context) {
|
|
1541
|
+
let termSubstitution = null;
|
|
1542
|
+
|
|
1543
|
+
const termSubstitutionNode = statementSubstitutionNode.getTermSubstitutionNode();
|
|
1544
|
+
|
|
1545
|
+
if (termSubstitutionNode !== null) {
|
|
1546
|
+
termSubstitution = termSubstitutionFromTermubstitutionNode(termSubstitutionNode, context);
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
return termSubstitution;
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
export function frameSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context) {
|
|
1553
|
+
let frameSubstitution = null;
|
|
1554
|
+
|
|
1555
|
+
const frameSubstitutionNode = statementSubstitutionNode.getFrameSubstitutionNode();
|
|
1556
|
+
|
|
1557
|
+
if (frameSubstitutionNode !== null) {
|
|
1558
|
+
frameSubstitution = frameSubstitutionFromFrameSubstitutionNode(frameSubstitutionNode, context);
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
return frameSubstitution;
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1537
1564
|
export function replacementReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode, context) {
|
|
1538
1565
|
const replacementReferenceNode = referenceSubstitutionNode.getReplacementReferenceNode(),
|
|
1539
1566
|
replacementReference = referenceFromReferenceNode(replacementReferenceNode, context);
|
|
@@ -24,13 +24,6 @@ export function judgementFromStatement(statement, context) {
|
|
|
24
24
|
return judgement;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export function metavariableFromStatement(statement, context) {
|
|
28
|
-
const statementNode = statement.getNode(),
|
|
29
|
-
metavariable = metavariableFromStatementNode(statementNode, context);
|
|
30
|
-
|
|
31
|
-
return metavariable;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
27
|
export function typeAssertionFromStatement(statement, context) {
|
|
35
28
|
const statementNode = statement.getNode(),
|
|
36
29
|
typeAssertion = typeAssertionFromStatementNode(statementNode, context);
|
package/src/utilities/string.js
CHANGED
|
@@ -16,6 +16,20 @@ export function termsStringFromTerms(terms) {
|
|
|
16
16
|
return termsString;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
export function framesStringFromFrames(frames) {
|
|
20
|
+
const framesString = frames.reduce((framesString, frame) => {
|
|
21
|
+
const frameString = frame.getString();
|
|
22
|
+
|
|
23
|
+
framesString = (framesString !== null) ?
|
|
24
|
+
`${framesString}, ${frameString}` :
|
|
25
|
+
frameString;
|
|
26
|
+
|
|
27
|
+
return framesString;
|
|
28
|
+
}, null);
|
|
29
|
+
|
|
30
|
+
return framesString;
|
|
31
|
+
}
|
|
32
|
+
|
|
19
33
|
export function labelsStringFromLabels(labels) {
|
|
20
34
|
const labelsString = labels.reduce((labelsString, label) => {
|
|
21
35
|
const labelString = label.getString();
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { arrayUtilities } from "necessary";
|
|
4
|
+
|
|
5
|
+
const { compress } = arrayUtilities;
|
|
6
|
+
|
|
7
|
+
export function termFromTermAndSubstitutions(term, generalContext, specificContext) {
|
|
4
8
|
if (term !== null) {
|
|
5
9
|
const termNode = term.getNode(),
|
|
6
10
|
termSingular = term.isSingular();
|
|
@@ -12,12 +16,13 @@ export function termFromTermAndSubstitutions(term, substitutions, generalContext
|
|
|
12
16
|
variable = generalContext.findVariableByVariableIdentifier(variableIdentifier);
|
|
13
17
|
|
|
14
18
|
if (variable !== null) {
|
|
15
|
-
const substitution =
|
|
19
|
+
const substitution = specificContext.findSubstitutionByVariable(variable, generalContext, specificContext);
|
|
16
20
|
|
|
17
21
|
if (substitution !== null) {
|
|
18
|
-
const termSubstitution = substitution
|
|
22
|
+
const termSubstitution = substitution, ///
|
|
23
|
+
replacementTerm = termSubstitution.getReplacementTerm();
|
|
19
24
|
|
|
20
|
-
term =
|
|
25
|
+
term = replacementTerm; ///
|
|
21
26
|
}
|
|
22
27
|
}
|
|
23
28
|
}
|
|
@@ -26,7 +31,7 @@ export function termFromTermAndSubstitutions(term, substitutions, generalContext
|
|
|
26
31
|
return term;
|
|
27
32
|
}
|
|
28
33
|
|
|
29
|
-
export function frameFromFrameAndSubstitutions(frame,
|
|
34
|
+
export function frameFromFrameAndSubstitutions(frame, generalContext, specificContext) {
|
|
30
35
|
if (frame !== null) {
|
|
31
36
|
const frameNode = frame.getNode(),
|
|
32
37
|
frameSingular = frame.isSingular();
|
|
@@ -38,14 +43,13 @@ export function frameFromFrameAndSubstitutions(frame, substitutions, generalCont
|
|
|
38
43
|
metavariable = generalContext.findMetavariableByMetavariableName(metavariableName);
|
|
39
44
|
|
|
40
45
|
if (metavariable !== null) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
substitution = substitutions.findSubstitutionByMetavariableAndSubstitution(metavariable, substitution);
|
|
46
|
+
const substitution = specificContext.findSubstitutionByMetavariable(metavariable, generalContext, specificContext);
|
|
44
47
|
|
|
45
48
|
if (substitution !== null) {
|
|
46
|
-
const frameSubstitution = substitution
|
|
49
|
+
const frameSubstitution = substitution, ///
|
|
50
|
+
replacementFrame = frameSubstitution.getReplacementFrame();
|
|
47
51
|
|
|
48
|
-
frame =
|
|
52
|
+
frame = replacementFrame; ///
|
|
49
53
|
}
|
|
50
54
|
}
|
|
51
55
|
}
|
|
@@ -54,32 +58,47 @@ export function frameFromFrameAndSubstitutions(frame, substitutions, generalCont
|
|
|
54
58
|
return frame;
|
|
55
59
|
}
|
|
56
60
|
|
|
57
|
-
export function statementFromStatementAndSubstitutions(statement,
|
|
61
|
+
export function statementFromStatementAndSubstitutions(statement, generalContext, specificContext) {
|
|
58
62
|
if (statement !== null) {
|
|
59
63
|
const statementNode = statement.getNode(),
|
|
60
64
|
statementSingular = statement.isSingular();
|
|
61
65
|
|
|
62
|
-
|
|
63
|
-
statement = null;
|
|
66
|
+
statement = null;
|
|
64
67
|
|
|
68
|
+
if (statementSingular) {
|
|
65
69
|
let substitution = null;
|
|
66
70
|
|
|
67
71
|
const substitutionNode = statementNode.getSubstitutionNode();
|
|
68
72
|
|
|
69
73
|
if (substitutionNode !== null) {
|
|
70
|
-
|
|
74
|
+
let context = generalContext; ///
|
|
75
|
+
|
|
76
|
+
generalContext = specificContext; ///
|
|
77
|
+
|
|
78
|
+
specificContext = context; ///
|
|
79
|
+
|
|
80
|
+
substitution = specificContext.findSubstitutionBySubstitutionNode(substitutionNode, generalContext, specificContext);
|
|
81
|
+
|
|
82
|
+
context = generalContext; ///
|
|
83
|
+
|
|
84
|
+
generalContext = specificContext; ///
|
|
85
|
+
|
|
86
|
+
specificContext = context; ///
|
|
71
87
|
}
|
|
72
88
|
|
|
73
89
|
const metavariableName = statementNode.getMetavariableName(),
|
|
74
90
|
metavariable = generalContext.findMetavariableByMetavariableName(metavariableName);
|
|
75
91
|
|
|
76
92
|
if (metavariable !== null) {
|
|
77
|
-
substitution =
|
|
93
|
+
substitution = (substitution !== null) ?
|
|
94
|
+
specificContext.findSubstitutionByMetavariableAndSubstitution(metavariable, substitution, generalContext, specificContext) :
|
|
95
|
+
specificContext.findSubstitutionByMetavariable(metavariable, generalContext, specificContext);
|
|
78
96
|
|
|
79
97
|
if (substitution !== null) {
|
|
80
|
-
const statementSubstitution = substitution
|
|
98
|
+
const statementSubstitution = substitution, ///
|
|
99
|
+
replacementStatement = statementSubstitution.getReplacementStatement();
|
|
81
100
|
|
|
82
|
-
statement =
|
|
101
|
+
statement = replacementStatement; ///
|
|
83
102
|
}
|
|
84
103
|
}
|
|
85
104
|
}
|
|
@@ -87,3 +106,26 @@ export function statementFromStatementAndSubstitutions(statement, substitutions,
|
|
|
87
106
|
|
|
88
107
|
return statement;
|
|
89
108
|
}
|
|
109
|
+
|
|
110
|
+
export function metavariablesFromSubstitutions(substitutions, generalContext, specificContext) {
|
|
111
|
+
const metavariables = [];
|
|
112
|
+
|
|
113
|
+
substitutions.forEach((substitution) => {
|
|
114
|
+
const context = generalContext, ///
|
|
115
|
+
metavariable = substitution.getMetavariable(generalContext, specificContext);
|
|
116
|
+
|
|
117
|
+
if (metavariable !== null) {
|
|
118
|
+
metavariables.push(metavariable);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
compress(metavariables, (metavariableA, metavariableB) => {
|
|
123
|
+
const metavariableComparesToMetavariableB = metavariableB.compare(metavariableA);
|
|
124
|
+
|
|
125
|
+
if (!metavariableComparesToMetavariableB) {
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
return metavariables;
|
|
131
|
+
}
|
|
@@ -60,6 +60,8 @@ async function unifyStatementWithReference(statement, reference, satisfiesAssert
|
|
|
60
60
|
// const { StatementSubstitution } = elements;
|
|
61
61
|
//
|
|
62
62
|
// StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context);
|
|
63
|
+
|
|
64
|
+
// validate
|
|
63
65
|
//
|
|
64
66
|
// }, generalContext, specificContext);
|
|
65
67
|
|
|
@@ -164,6 +166,8 @@ async function unifyStatementWithTopLevelAssertion(statement, reference, satisfi
|
|
|
164
166
|
// const { StatementSubstitution } = elements;
|
|
165
167
|
//
|
|
166
168
|
// StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context);
|
|
169
|
+
|
|
170
|
+
// vaiddate
|
|
167
171
|
//
|
|
168
172
|
// }, generalContext, specificContext);
|
|
169
173
|
|
|
@@ -95,7 +95,9 @@ function validateStatementAsMetavariable(statement, assignments, stated, context
|
|
|
95
95
|
substitution = (termSubstitution || frameSubstitution);
|
|
96
96
|
|
|
97
97
|
if (substitution !== null) {
|
|
98
|
-
const
|
|
98
|
+
const generalContext = context, ///
|
|
99
|
+
specificContext = context, ///
|
|
100
|
+
substitutionValidates = substitution.validate(generalContext, specificContext);
|
|
99
101
|
|
|
100
102
|
if (!substitutionValidates) {
|
|
101
103
|
statementValidatesAsMetavariableAndSubstitution = false;
|