occam-verify-cli 0.0.546 → 0.0.548
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/axiomLemmaTheoremConjecture.js +2 -4
- package/lib/combinator.js +7 -7
- package/lib/conclusion.js +7 -7
- package/lib/consequence.js +7 -7
- package/lib/constructor.js +8 -8
- package/lib/context/proof.js +12 -1
- package/lib/context/release.js +8 -10
- package/lib/label.js +8 -8
- package/lib/supposition.js +7 -7
- package/lib/type.js +10 -8
- package/lib/verifier/termForVariable.js +5 -5
- package/lib/verify/metastatement/unqualified.js +3 -3
- package/lib/verify/metastatement.js +2 -2
- package/lib/verify/premise.js +2 -2
- package/lib/verify/rule.js +2 -2
- package/lib/verify/ruleProof.js +2 -2
- package/lib/verify/supposition.js +2 -2
- package/package.json +3 -3
- package/src/axiomLemmaTheoremConjecture.js +1 -5
- package/src/combinator.js +6 -6
- package/src/conclusion.js +6 -6
- package/src/consequence.js +9 -9
- package/src/constructor.js +6 -6
- package/src/context/proof.js +14 -0
- package/src/context/release.js +8 -12
- package/src/label.js +7 -7
- package/src/supposition.js +6 -6
- package/src/type.js +13 -11
- package/src/verifier/termForVariable.js +4 -4
- package/src/verify/metastatement/unqualified.js +2 -2
- package/src/verify/metastatement.js +1 -1
- package/src/verify/premise.js +1 -2
- package/src/verify/rule.js +1 -1
- package/src/verify/ruleProof.js +1 -1
- package/src/verify/supposition.js +1 -1
package/src/context/proof.js
CHANGED
|
@@ -186,6 +186,20 @@ class ProofContext {
|
|
|
186
186
|
|
|
187
187
|
return proofContext;
|
|
188
188
|
}
|
|
189
|
+
|
|
190
|
+
static fromProofContextAndAssignments(proofContext, assignments) {
|
|
191
|
+
const context = proofContext, ///
|
|
192
|
+
variables = assignments.map((assignment) => {
|
|
193
|
+
const variable = assignment.getVariable();
|
|
194
|
+
|
|
195
|
+
return variable;
|
|
196
|
+
}),
|
|
197
|
+
proofSteps = [];
|
|
198
|
+
|
|
199
|
+
proofContext = new ProofContext(context, variables, proofSteps);
|
|
200
|
+
|
|
201
|
+
return proofContext;
|
|
202
|
+
}
|
|
189
203
|
}
|
|
190
204
|
|
|
191
205
|
Object.assign(ProofContext.prototype, fileMixins);
|
package/src/context/release.js
CHANGED
|
@@ -349,27 +349,23 @@ export default class ReleaseContext {
|
|
|
349
349
|
|
|
350
350
|
this.parser = florenceParser; ///
|
|
351
351
|
|
|
352
|
-
|
|
353
|
-
this.verified = false;
|
|
352
|
+
this.dependencyReleaseContexts = dependencyReleaseContexts;
|
|
354
353
|
|
|
355
|
-
|
|
356
|
-
} else {
|
|
354
|
+
if (this.json !== null) {
|
|
357
355
|
const fileContextsJSON = this.json; ///
|
|
358
356
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
this.fileContexts = fileContextsJSON.map((fileContextJSON) => {
|
|
357
|
+
fileContextsJSON.forEach((fileContextJSON) => {
|
|
362
358
|
const json = fileContextJSON, ///
|
|
363
359
|
{ filePath } = json,
|
|
364
360
|
fileContext = FileContext.fromFilePathAndReleaseContext(filePath, releaseContext);
|
|
365
361
|
|
|
366
362
|
fileContext.initialise(json);
|
|
367
363
|
|
|
368
|
-
|
|
364
|
+
this.fileContexts.push(fileContext);
|
|
369
365
|
});
|
|
370
|
-
}
|
|
371
366
|
|
|
372
|
-
|
|
367
|
+
this.verified = true;
|
|
368
|
+
}
|
|
373
369
|
}
|
|
374
370
|
|
|
375
371
|
toJSON() {
|
|
@@ -386,9 +382,9 @@ export default class ReleaseContext {
|
|
|
386
382
|
static fromLogJSONNameAndEntries(log, json, name, entries) {
|
|
387
383
|
const lexer = null,
|
|
388
384
|
parser = null,
|
|
389
|
-
verified =
|
|
385
|
+
verified = false,
|
|
390
386
|
customGrammar = customGrammarFromNameAndEntries(name, entries),
|
|
391
|
-
fileContexts =
|
|
387
|
+
fileContexts = [],
|
|
392
388
|
dependencyReleaseContexts = null,
|
|
393
389
|
releaseContext = new ReleaseContext(log, json, name, entries, lexer, parser, verified, customGrammar, fileContexts, dependencyReleaseContexts);
|
|
394
390
|
|
package/src/label.js
CHANGED
|
@@ -34,6 +34,13 @@ export default class Label {
|
|
|
34
34
|
return json;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
static fromLabelNode(labelNode) {
|
|
38
|
+
const node = labelNode, ///
|
|
39
|
+
variable = new Label(node);
|
|
40
|
+
|
|
41
|
+
return variable;
|
|
42
|
+
}
|
|
43
|
+
|
|
37
44
|
static fromJSONAndFileContext(json, fileContext) {
|
|
38
45
|
const labelString = json, ///
|
|
39
46
|
lexer = fileContext.getLexer(),
|
|
@@ -44,11 +51,4 @@ export default class Label {
|
|
|
44
51
|
|
|
45
52
|
return label;
|
|
46
53
|
}
|
|
47
|
-
|
|
48
|
-
static fromLabelNode(labelNode) {
|
|
49
|
-
const node = labelNode, ///
|
|
50
|
-
variable = new Label(node);
|
|
51
|
-
|
|
52
|
-
return variable;
|
|
53
|
-
}
|
|
54
54
|
}
|
package/src/supposition.js
CHANGED
|
@@ -75,6 +75,12 @@ export default class Supposition {
|
|
|
75
75
|
return json;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
static fromStatementNode(statementNode) {
|
|
79
|
+
const supposition = new Supposition(statementNode);
|
|
80
|
+
|
|
81
|
+
return supposition;
|
|
82
|
+
}
|
|
83
|
+
|
|
78
84
|
static fromJSONAndFileContext(json, fileContext) {
|
|
79
85
|
const { statement } = json,
|
|
80
86
|
statementString = statement, ///
|
|
@@ -85,10 +91,4 @@ export default class Supposition {
|
|
|
85
91
|
|
|
86
92
|
return supposition;
|
|
87
93
|
}
|
|
88
|
-
|
|
89
|
-
static fromStatementNode(statementNode) {
|
|
90
|
-
const supposition = new Supposition(statementNode);
|
|
91
|
-
|
|
92
|
-
return supposition;
|
|
93
|
-
}
|
|
94
94
|
}
|
package/src/type.js
CHANGED
|
@@ -186,20 +186,22 @@ class ObjectType extends Type {
|
|
|
186
186
|
export const objectType = ObjectType.fromNothing();
|
|
187
187
|
|
|
188
188
|
function superTypeFromSuperTypeJSONAndFileContext(superTypeJSON, fileContext) {
|
|
189
|
-
let superType;
|
|
189
|
+
let superType = null;
|
|
190
190
|
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
if (superTypeJSON !== null) {
|
|
192
|
+
const json = superTypeJSON, ///
|
|
193
|
+
{ name } = json;
|
|
193
194
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
195
|
+
if (name === OBJECT_TYPE_NAME) {
|
|
196
|
+
superType = objectType; ///
|
|
197
|
+
} else {
|
|
198
|
+
const typeName = name, ///
|
|
199
|
+
type = fileContext.findTypeByTypeName(typeName);
|
|
199
200
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
superType = (type !== null) ?
|
|
202
|
+
type : ///
|
|
203
|
+
Type.fromJSONAndFileContext(json, fileContext); ///
|
|
204
|
+
}
|
|
203
205
|
}
|
|
204
206
|
|
|
205
207
|
return superType;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Verifier from "../verifier";
|
|
4
|
+
import verifyTerm from "../verify/term";
|
|
4
5
|
import TermForVariableSubstitution from "../substitution/termForVariable";
|
|
5
6
|
|
|
6
7
|
import { first } from "../utilities/array";
|
|
7
8
|
import { nodeQuery } from "../utilities/query";
|
|
8
9
|
import { TERM_RULE_NAME } from "../ruleNames";
|
|
9
10
|
import { variableNameFromVariableNode } from "../utilities/query";
|
|
10
|
-
import { verifyTermAgainstConstructors } from "../verify/term";
|
|
11
11
|
|
|
12
12
|
const variableNodeQuery = nodeQuery('/term/variable!');
|
|
13
13
|
|
|
@@ -54,10 +54,10 @@ export default class TermForVariableVerifier extends Verifier {
|
|
|
54
54
|
return termNodeVerified;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
verifyVariableNode(
|
|
57
|
+
verifyVariableNode(variableNodeA, termNodeB, substitutions, proofContextA, proofContextB) {
|
|
58
58
|
let variableVerified;
|
|
59
59
|
|
|
60
|
-
const variableNameA = variableNameFromVariableNode(
|
|
60
|
+
const variableNameA = variableNameFromVariableNode(variableNodeA),
|
|
61
61
|
substitution = substitutions.find((substitution) => {
|
|
62
62
|
const variableName = substitution.getVariableName();
|
|
63
63
|
|
|
@@ -83,7 +83,7 @@ export default class TermForVariableVerifier extends Verifier {
|
|
|
83
83
|
const types = [],
|
|
84
84
|
context = proofContextB, ///
|
|
85
85
|
termNode = termNodeB, ///
|
|
86
|
-
termVerified =
|
|
86
|
+
termVerified = verifyTerm(termNode, types, context);
|
|
87
87
|
|
|
88
88
|
if (termVerified) {
|
|
89
89
|
const firstType = first(types),
|
|
@@ -6,7 +6,7 @@ import { nodeQuery } from "../../utilities/query";
|
|
|
6
6
|
|
|
7
7
|
const metastatementNodeQuery = nodeQuery("/unqualifiedMetastatement/metastatement!");
|
|
8
8
|
|
|
9
|
-
export default function verifyUnqualifiedMetastatement(unqualifiedMetastatementNode,
|
|
9
|
+
export default function verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, derived, metaproofContext) {
|
|
10
10
|
let unqualifiedMetastatementVerified = false;
|
|
11
11
|
|
|
12
12
|
const metastatementNode = metastatementNodeQuery(unqualifiedMetastatementNode);
|
|
@@ -23,7 +23,7 @@ export default function verifyUnqualifiedMetastatement(unqualifiedMetastatementN
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
if (!unqualifiedMetastatementVerified) {
|
|
26
|
-
const metastatementVerified = verifyMetastatement(metastatementNode,
|
|
26
|
+
const metastatementVerified = verifyMetastatement(metastatementNode, derived, metaproofContext);
|
|
27
27
|
|
|
28
28
|
unqualifiedMetastatementVerified = metastatementVerified; ///
|
|
29
29
|
}
|
|
@@ -57,7 +57,7 @@ class MetastatementVerifier extends Verifier {
|
|
|
57
57
|
|
|
58
58
|
const metastatementVerifier = new MetastatementVerifier();
|
|
59
59
|
|
|
60
|
-
export default function verifyMetastatement(metastatementNode,
|
|
60
|
+
export default function verifyMetastatement(metastatementNode, derived, metaproofContext) {
|
|
61
61
|
let metastatementVerified = false;
|
|
62
62
|
|
|
63
63
|
if (!metastatementVerified) {
|
package/src/verify/premise.js
CHANGED
|
@@ -17,9 +17,8 @@ export default function verifyPremise(premiseNode, premises, metaproofContext) {
|
|
|
17
17
|
metaproofContext.debug(`Verifying the '${premiseString}' premise...`, premiseNode);
|
|
18
18
|
|
|
19
19
|
const derived = false,
|
|
20
|
-
assignments = [],
|
|
21
20
|
unqualifiedMetastatementNode = unqualifiedMetastatementNodeQuery(premiseNode),
|
|
22
|
-
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode,
|
|
21
|
+
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, derived, metaproofContext);
|
|
23
22
|
|
|
24
23
|
if (unqualifiedMetastatementVerified) {
|
|
25
24
|
const metastatementNode = metastatementNodeQuery(unqualifiedMetastatementNode),
|
package/src/verify/rule.js
CHANGED
|
@@ -51,7 +51,7 @@ export default function verifyRule(ruleNode, fileContext) {
|
|
|
51
51
|
let ruleProofVerified = true; ///
|
|
52
52
|
|
|
53
53
|
if (ruleProofNode !== null) {
|
|
54
|
-
ruleProofVerified = verifyRuleProof(ruleProofNode, conclusion, metaProofContext);
|
|
54
|
+
ruleProofVerified = verifyRuleProof(ruleProofNode, conclusion, assignments, metaProofContext);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
if (ruleProofVerified) {
|
package/src/verify/ruleProof.js
CHANGED
|
@@ -7,7 +7,7 @@ import { nodeQuery } from "../utilities/query";
|
|
|
7
7
|
|
|
8
8
|
const ruleDerivationNodeQuery = nodeQuery("/ruleProof/ruleDerivation!");
|
|
9
9
|
|
|
10
|
-
export default function verifyRuleProof(ruleProofNode, conclusion, metaproofContext) {
|
|
10
|
+
export default function verifyRuleProof(ruleProofNode, conclusion, assignments, metaproofContext) {
|
|
11
11
|
let ruleProofVerified = false;
|
|
12
12
|
|
|
13
13
|
const ruleDerivationNode = ruleDerivationNodeQuery(ruleProofNode),
|