occam-verify-cli 0.0.1067 → 0.0.1069
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/bin/action/verify.js +3 -2
- package/lib/assertion/contained.js +2 -2
- package/lib/assertion/defined.js +2 -2
- package/lib/assertion/subproof.js +3 -3
- package/lib/assignment/judgement.js +3 -3
- package/lib/axiom.js +11 -6
- package/lib/combinator.js +9 -9
- package/lib/conclusion.js +13 -10
- package/lib/conjecture.js +11 -6
- package/lib/consequent.js +13 -10
- package/lib/constructor.js +9 -9
- package/lib/context/file.js +34 -126
- package/lib/context/local.js +16 -5
- package/lib/context/release.js +2 -3
- package/lib/declaration.js +96 -2
- package/lib/equivalence.js +2 -2
- package/lib/frame.js +179 -98
- package/lib/index.js +22 -6
- package/lib/judgement.js +84 -5
- package/lib/label.js +12 -8
- package/lib/lemma.js +12 -12
- package/lib/metaLemma.js +120 -8
- package/lib/metaType.js +24 -3
- package/lib/metatheorem.js +145 -9
- package/lib/metavariable.js +128 -43
- package/lib/mixins/statement/qualified/unify.js +6 -10
- package/lib/mixins/statement/unify.js +4 -19
- package/lib/mixins/statement/verify.js +13 -13
- package/lib/mixins/term/unify.js +2 -2
- package/lib/premise.js +21 -13
- package/lib/reference.js +17 -17
- package/lib/rule.js +28 -40
- package/lib/statement/unqualified.js +34 -9
- package/lib/statement.js +7 -5
- package/lib/substitution/frameForMetavariable.js +75 -70
- package/lib/substitution/statementForMetavariable.js +83 -42
- package/lib/substitution/termForVariable.js +65 -68
- package/lib/substitution.js +46 -43
- package/lib/substitutions.js +52 -40
- package/lib/supposition.js +15 -11
- package/lib/term.js +6 -11
- package/lib/theorem.js +11 -6
- package/lib/topLevelAssertion.js +24 -42
- package/lib/type.js +5 -12
- package/lib/unifier/intrinsicLevel.js +4 -4
- package/lib/unifier/metaLevel.js +11 -7
- package/lib/unifier/metavariable.js +6 -6
- package/lib/unifier/statementWithCombinator.js +16 -16
- package/lib/unifier/termWithConstructor.js +7 -7
- package/lib/utilities/brackets.js +10 -10
- package/lib/utilities/json.js +493 -0
- package/lib/utilities/node.js +26 -19
- package/lib/utilities/release.js +53 -0
- package/lib/utilities/releaseContext.js +4 -15
- package/lib/utilities/tokens.js +8 -1
- package/lib/variable.js +14 -15
- package/lib/verifier/topLevel.js +5 -5
- package/package.json +1 -1
- package/src/assertion/contained.js +1 -1
- package/src/assertion/defined.js +1 -1
- package/src/assertion/subproof.js +2 -3
- package/src/assignment/judgement.js +3 -4
- package/src/axiom.js +14 -6
- package/src/combinator.js +12 -13
- package/src/conclusion.js +16 -13
- package/src/conjecture.js +14 -6
- package/src/consequent.js +16 -13
- package/src/constructor.js +11 -13
- package/src/context/file.js +94 -202
- package/src/context/local.js +8 -6
- package/src/context/release.js +2 -3
- package/src/declaration.js +126 -45
- package/src/equivalence.js +2 -2
- package/src/frame.js +225 -141
- package/src/index.js +17 -1
- package/src/judgement.js +109 -3
- package/src/label.js +15 -10
- package/src/lemma.js +17 -10
- package/src/metaLemma.js +102 -1
- package/src/metaType.js +29 -3
- package/src/metatheorem.js +143 -2
- package/src/metavariable.js +189 -66
- package/src/mixins/statement/qualified/unify.js +7 -19
- package/src/mixins/statement/unify.js +3 -25
- package/src/mixins/statement/verify.js +15 -13
- package/src/mixins/term/unify.js +1 -1
- package/src/premise.js +31 -16
- package/src/reference.js +18 -18
- package/src/rule.js +40 -58
- package/src/statement/unqualified.js +41 -11
- package/src/statement.js +6 -3
- package/src/substitution/frameForMetavariable.js +85 -98
- package/src/substitution/statementForMetavariable.js +109 -45
- package/src/substitution/termForVariable.js +83 -94
- package/src/substitution.js +36 -34
- package/src/substitutions.js +53 -46
- package/src/supposition.js +22 -14
- package/src/term.js +5 -15
- package/src/theorem.js +14 -6
- package/src/topLevelAssertion.js +38 -64
- package/src/type.js +5 -20
- package/src/unifier/intrinsicLevel.js +4 -3
- package/src/unifier/metaLevel.js +19 -7
- package/src/unifier/metavariable.js +5 -5
- package/src/unifier/statementWithCombinator.js +19 -19
- package/src/unifier/termWithConstructor.js +7 -7
- package/src/utilities/brackets.js +5 -5
- package/src/utilities/json.js +551 -0
- package/src/utilities/node.js +28 -23
- package/src/{verify → utilities}/release.js +5 -1
- package/src/utilities/releaseContext.js +2 -2
- package/src/utilities/tokens.js +10 -0
- package/src/variable.js +18 -19
- package/src/verifier/topLevel.js +6 -4
- package/lib/argument.js +0 -106
- package/lib/metaTypes.js +0 -19
- package/lib/unify/metavariableWithFrame.js +0 -40
- package/lib/unify/simpleSubstitutionStatementWithComplexSubstitutionStatement.js +0 -31
- package/lib/unify/statementWithSttaemetnGivenEquivalences.js +0 -45
- package/lib/verify/declaration.js +0 -83
- package/lib/verify/frame.js +0 -120
- package/lib/verify/judgement.js +0 -88
- package/lib/verify/metaLemma.js +0 -49
- package/lib/verify/metatheorem.js +0 -48
- package/lib/verify/metavariableGivenMetaType.js +0 -44
- package/lib/verify/release.js +0 -50
- package/src/argument.js +0 -79
- package/src/metaTypes.js +0 -11
- package/src/unify/metavariableWithFrame.js +0 -40
- package/src/unify/simpleSubstitutionStatementWithComplexSubstitutionStatement.js +0 -27
- package/src/unify/statementWithSttaemetnGivenEquivalences.js +0 -51
- package/src/verify/declaration.js +0 -113
- package/src/verify/frame.js +0 -157
- package/src/verify/judgement.js +0 -127
- package/src/verify/metaLemma.js +0 -72
- package/src/verify/metatheorem.js +0 -67
- package/src/verify/metavariableGivenMetaType.js +0 -45
package/src/lemma.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import shim from "./shim";
|
|
3
4
|
import Label from "./label";
|
|
4
5
|
import Proof from "./proof";
|
|
5
6
|
import Consequent from "./consequent";
|
|
@@ -8,23 +9,24 @@ import LocalContext from "./context/local";
|
|
|
8
9
|
import Substitutions from "./substitutions";
|
|
9
10
|
import TopLevelAssertion from "./topLevelAssertion";
|
|
10
11
|
|
|
12
|
+
import { EMPTY_STRING } from "./constants";
|
|
13
|
+
import { stringFromLabels } from "./topLevelAssertion";
|
|
11
14
|
import { nodeQuery, nodesQuery } from "./utilities/query";
|
|
12
|
-
import { labelsStringFromLabels } from "./topLevelAssertion";
|
|
13
15
|
|
|
14
16
|
const proofNodeQuery = nodeQuery("/lemma/proof"),
|
|
15
17
|
labelNodesQuery = nodesQuery("/lemma/label"),
|
|
16
18
|
consequentNodeQuery = nodeQuery("/lemma/consequent"),
|
|
17
19
|
suppositionNodesQuery = nodesQuery("/lemma/supposition");
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
class Lemma extends TopLevelAssertion {
|
|
20
22
|
verify() {
|
|
21
23
|
let verified = false;
|
|
22
24
|
|
|
23
|
-
const
|
|
25
|
+
const lemmaString = this.string; ///
|
|
24
26
|
|
|
25
|
-
(
|
|
27
|
+
(lemmaString === EMPTY_STRING) ?
|
|
26
28
|
this.fileContext.trace(`Verifying a lemma...`) :
|
|
27
|
-
this.fileContext.trace(`Verifying the '${
|
|
29
|
+
this.fileContext.trace(`Verifying the '${lemmaString}' lemma...`);
|
|
28
30
|
|
|
29
31
|
const labelsVerifiedAtTopLevel = this.labels.every((label) => {
|
|
30
32
|
const labelVVerifiedAtTopLevel = label.verifyAtTopLevel(this.fileContext);
|
|
@@ -63,16 +65,14 @@ export default class Lemma extends TopLevelAssertion {
|
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
if (verified) {
|
|
66
|
-
(
|
|
68
|
+
(lemmaString === EMPTY_STRING) ?
|
|
67
69
|
this.fileContext.debug(`...verified a lemma.`) :
|
|
68
|
-
this.fileContext.debug(`...verified the '${
|
|
70
|
+
this.fileContext.debug(`...verified the '${lemmaString}' lemma.`);
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
return verified;
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
static fromJSON(json, fileContext) { return TopLevelAssertion.fromJSON(Lemma, json, fileContext); }
|
|
75
|
-
|
|
76
76
|
static fromLemmaNode(lemmaNode, fileContext) {
|
|
77
77
|
const proofNode = proofNodeQuery(lemmaNode),
|
|
78
78
|
labelNodes = labelNodesQuery(lemmaNode),
|
|
@@ -89,9 +89,16 @@ export default class Lemma extends TopLevelAssertion {
|
|
|
89
89
|
return supposition;
|
|
90
90
|
}),
|
|
91
91
|
consequent = Consequent.fromConsequentNode(consequentNode, fileContext),
|
|
92
|
+
string = stringFromLabels(labels),
|
|
92
93
|
proof = Proof.fromProofNode(proofNode, fileContext),
|
|
93
|
-
lemma = new Lemma(fileContext, labels, suppositions, consequent, proof);
|
|
94
|
+
lemma = new Lemma(fileContext, string, labels, suppositions, consequent, proof);
|
|
94
95
|
|
|
95
96
|
return lemma;
|
|
96
97
|
}
|
|
97
98
|
}
|
|
99
|
+
|
|
100
|
+
Object.assign(shim, {
|
|
101
|
+
Lemma
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
export default Lemma;
|
package/src/metaLemma.js
CHANGED
|
@@ -1,7 +1,108 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import Label from "./label";
|
|
4
|
+
import Proof from "./proof";
|
|
5
|
+
import Consequent from "./consequent";
|
|
6
|
+
import Supposition from "./supposition";
|
|
7
|
+
import LocalContext from "./context/local";
|
|
8
|
+
import Substitutions from "./substitutions";
|
|
3
9
|
import TopLevelAssertion from "./topLevelAssertion";
|
|
4
10
|
|
|
11
|
+
import { EMPTY_STRING } from "./constants";
|
|
12
|
+
import { stringFromLabels } from "./topLevelAssertion";
|
|
13
|
+
import { nodeQuery, nodesQuery } from "./utilities/query";
|
|
14
|
+
|
|
15
|
+
const proofNodeQuery = nodeQuery("/metaLemma/proof"),
|
|
16
|
+
labelNodesQuery = nodesQuery("/metaLemma/label"),
|
|
17
|
+
consequentNodeQuery = nodeQuery("/metaLemma/consequent"),
|
|
18
|
+
suppositionNodesQuery = nodesQuery("/metaLemma/supposition");
|
|
19
|
+
|
|
5
20
|
export default class MetaLemma extends TopLevelAssertion {
|
|
6
|
-
|
|
21
|
+
constructor(fileContext, string, labels, suppositions, consequent, proof, substitutions) {
|
|
22
|
+
super(fileContext, string, labels, suppositions, consequent, proof);
|
|
23
|
+
|
|
24
|
+
this.substitutions = substitutions;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
getSubstitutions() {
|
|
28
|
+
return this.substitutions;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
verify() {
|
|
32
|
+
let verified = false;
|
|
33
|
+
|
|
34
|
+
const metaLemmaString = this.string; ///
|
|
35
|
+
|
|
36
|
+
(metaLemmaString === EMPTY_STRING) ?
|
|
37
|
+
this.fileContext.trace(`Verifying a meta-lemma...`) :
|
|
38
|
+
this.fileContext.trace(`Verifying the '${metaLemmaString}' meta-lemma...`);
|
|
39
|
+
|
|
40
|
+
const labelsVerifiedAtTopLevel = this.labels.every((label) => {
|
|
41
|
+
const labelVVerifiedAtTopLevel = label.verifyAtTopLevel(this.fileContext);
|
|
42
|
+
|
|
43
|
+
if (labelVVerifiedAtTopLevel) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
if (labelsVerifiedAtTopLevel) {
|
|
49
|
+
const localContext = LocalContext.fromFileContext(this.fileContext),
|
|
50
|
+
suppositionsVerified = this.suppositions.every((supposition) => {
|
|
51
|
+
const suppositionVerified = supposition.verify(localContext);
|
|
52
|
+
|
|
53
|
+
if (suppositionVerified) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
if (suppositionsVerified) {
|
|
59
|
+
const consequentVerified = this.consequent.verify(localContext);
|
|
60
|
+
|
|
61
|
+
if (consequentVerified) {
|
|
62
|
+
const proofVerified = this.proof.verify(this.substitutions, this.consequent, localContext);
|
|
63
|
+
|
|
64
|
+
if (proofVerified) {
|
|
65
|
+
const metaLemma = this; ///
|
|
66
|
+
|
|
67
|
+
this.fileContext.addMetaLemma(metaLemma);
|
|
68
|
+
|
|
69
|
+
verified = true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (verified) {
|
|
76
|
+
(metaLemmaString === EMPTY_STRING) ?
|
|
77
|
+
this.fileContext.debug(`...verified a meta-lemma.`) :
|
|
78
|
+
this.fileContext.debug(`...verified the '${metaLemmaString}' meta-lemma.`);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return verified;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static fromMetaLemmaNode(metaLemmaNode, fileContext) {
|
|
85
|
+
const proofNode = proofNodeQuery(metaLemmaNode),
|
|
86
|
+
labelNodes = labelNodesQuery(metaLemmaNode),
|
|
87
|
+
consequentNode = consequentNodeQuery(metaLemmaNode),
|
|
88
|
+
suppositionNodes = suppositionNodesQuery(metaLemmaNode),
|
|
89
|
+
labels = labelNodes.map((labelNode) => {
|
|
90
|
+
const label = Label.fromLabelNode(labelNode, fileContext);
|
|
91
|
+
|
|
92
|
+
return label;
|
|
93
|
+
}),
|
|
94
|
+
suppositions = suppositionNodes.map((suppositionNode) => {
|
|
95
|
+
const supposition = Supposition.fromSuppositionNode(suppositionNode, fileContext);
|
|
96
|
+
|
|
97
|
+
return supposition;
|
|
98
|
+
}),
|
|
99
|
+
consequent = Consequent.fromConsequentNode(consequentNode, fileContext),
|
|
100
|
+
proof = Proof.fromProofNode(proofNode, fileContext),
|
|
101
|
+
string = stringFromLabels(labels),
|
|
102
|
+
substitutions = Substitutions.fromNothing(),
|
|
103
|
+
metaLemma = new MetaLemma(fileContext, string, labels, suppositions, consequent, proof, substitutions);
|
|
104
|
+
|
|
105
|
+
return metaLemma;
|
|
106
|
+
}
|
|
7
107
|
}
|
|
108
|
+
|
package/src/metaType.js
CHANGED
|
@@ -57,15 +57,15 @@ class MetaType {
|
|
|
57
57
|
|
|
58
58
|
static fromJSON(json, fileContext) {
|
|
59
59
|
const { name } = json,
|
|
60
|
-
|
|
60
|
+
metaTypeName = name, ///
|
|
61
|
+
metaType = metaTypeFromMetaTypeName(metaTypeName);
|
|
61
62
|
|
|
62
63
|
return metaType;
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
static fromMetaTypeNode(metaTypeNode, localContext) {
|
|
66
67
|
const metaTypeName = metaTypeNameFromMetaTypeNode(metaTypeNode),
|
|
67
|
-
|
|
68
|
-
metaType = new MetaType(name);
|
|
68
|
+
metaType = metaTypeFromMetaTypeName(metaTypeName);
|
|
69
69
|
|
|
70
70
|
return metaType;
|
|
71
71
|
}
|
|
@@ -107,3 +107,29 @@ class StatementMetaType extends MetaType {
|
|
|
107
107
|
export const frameMetaType = FrameMetaType.fromNothing();
|
|
108
108
|
export const referenceMetaType = ReferenceMetaType.fromNothing();
|
|
109
109
|
export const statementMetaType = StatementMetaType.fromNothing();
|
|
110
|
+
|
|
111
|
+
function metaTypeFromMetaTypeName(metaTypeName) {
|
|
112
|
+
let metaType;
|
|
113
|
+
|
|
114
|
+
switch (metaTypeName) {
|
|
115
|
+
case FRAME_META_TYPE_NAME: {
|
|
116
|
+
metaType = frameMetaType; ///
|
|
117
|
+
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
case REFERENCE_META_TYPE_NAME: {
|
|
122
|
+
metaType = referenceMetaType; ///
|
|
123
|
+
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
case STATEMENT_META_TYPE_NAME: {
|
|
128
|
+
metaType = statementMetaType; ///
|
|
129
|
+
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return metaType;
|
|
135
|
+
}
|
package/src/metatheorem.js
CHANGED
|
@@ -1,7 +1,148 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import shim from "./shim";
|
|
4
|
+
import Label from "./label";
|
|
5
|
+
import Proof from "./proof";
|
|
6
|
+
import Consequent from "./consequent";
|
|
7
|
+
import Supposition from "./supposition";
|
|
8
|
+
import LocalContext from "./context/local";
|
|
9
|
+
import Substitutions from "./substitutions";
|
|
3
10
|
import TopLevelAssertion from "./topLevelAssertion";
|
|
4
11
|
|
|
5
|
-
|
|
6
|
-
|
|
12
|
+
import { nodeQuery, nodesQuery } from "./utilities/query";
|
|
13
|
+
import { stringFromLabels } from "./topLevelAssertion";
|
|
14
|
+
import { labelsFromJSON,
|
|
15
|
+
labelsToLabelsJSON,
|
|
16
|
+
consequentFromJSON,
|
|
17
|
+
suppositionsFromJSON,
|
|
18
|
+
substitutionsFromJSON,
|
|
19
|
+
consequentToConsequentJSON,
|
|
20
|
+
suppositionsToSuppositionsJSON,
|
|
21
|
+
substitutionsToSubstitutionsJSON } from "./utilities/json";
|
|
22
|
+
|
|
23
|
+
const proofNodeQuery = nodeQuery("/metatheorem/proof"),
|
|
24
|
+
labelNodesQuery = nodesQuery("/metatheorem/label"),
|
|
25
|
+
consequentNodeQuery = nodeQuery("/metatheorem/consequent"),
|
|
26
|
+
suppositionNodesQuery = nodesQuery("/metatheorem/supposition");
|
|
27
|
+
|
|
28
|
+
class Metatheorem extends TopLevelAssertion {
|
|
29
|
+
constructor(fileContext, string, labels, suppositions, consequent, proof, substitutions) {
|
|
30
|
+
super(fileContext, string, labels, suppositions, consequent, proof);
|
|
31
|
+
|
|
32
|
+
this.substitutions = substitutions;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
getSubstitutions() {
|
|
36
|
+
return this.substitutions;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
verify() {
|
|
40
|
+
let verified = false;
|
|
41
|
+
|
|
42
|
+
const metatheoremString = this.string; ///
|
|
43
|
+
|
|
44
|
+
this.fileContext.trace(`Verifying the '${metatheoremString}' metatheorem...`);
|
|
45
|
+
|
|
46
|
+
const labelsVerifiedAtTopLevel = this.labels.every((label) => {
|
|
47
|
+
const labelVVerifiedAtTopLevel = label.verifyAtTopLevel(this.fileContext);
|
|
48
|
+
|
|
49
|
+
if (labelVVerifiedAtTopLevel) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
if (labelsVerifiedAtTopLevel) {
|
|
55
|
+
const localContext = LocalContext.fromFileContext(this.fileContext),
|
|
56
|
+
suppositionsVerified = this.suppositions.every((supposition) => {
|
|
57
|
+
const suppositionVerified = supposition.verify(localContext);
|
|
58
|
+
|
|
59
|
+
if (suppositionVerified) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
if (suppositionsVerified) {
|
|
65
|
+
const consequentVerified = this.consequent.verify(localContext);
|
|
66
|
+
|
|
67
|
+
if (consequentVerified) {
|
|
68
|
+
const proofVerified = this.proof.verify(this.substitutions, this.consequent, localContext);
|
|
69
|
+
|
|
70
|
+
if (proofVerified) {
|
|
71
|
+
const metatheorem = this; ///
|
|
72
|
+
|
|
73
|
+
this.fileContext.addMetatheorem(metatheorem);
|
|
74
|
+
|
|
75
|
+
verified = true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (verified) {
|
|
82
|
+
this.fileContext.debug(`...verified the '${metatheoremString}' metatheorem.`);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return verified;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
toJSON() {
|
|
89
|
+
const labelsJSON = labelsToLabelsJSON(this.labels),
|
|
90
|
+
consequentJSON = consequentToConsequentJSON(this.consequent),
|
|
91
|
+
suppositionsJSON = suppositionsToSuppositionsJSON(this.suppositions),
|
|
92
|
+
substitutionsJSON = substitutionsToSubstitutionsJSON(this.substitutions),
|
|
93
|
+
labels = labelsJSON, ///
|
|
94
|
+
consequent = consequentJSON, ///
|
|
95
|
+
suppositions = suppositionsJSON, ///
|
|
96
|
+
substitutions = substitutionsJSON, ///
|
|
97
|
+
json = {
|
|
98
|
+
labels,
|
|
99
|
+
consequent,
|
|
100
|
+
suppositions,
|
|
101
|
+
substitutions
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
return json;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
static fromJSON(json, fileContext) {
|
|
108
|
+
const labels = labelsFromJSON(json, fileContext),
|
|
109
|
+
consequent = consequentFromJSON(json, fileContext),
|
|
110
|
+
suppositions = suppositionsFromJSON(json, fileContext),
|
|
111
|
+
substitutions = substitutionsFromJSON(json, fileContext),
|
|
112
|
+
string = stringFromLabels(labels),
|
|
113
|
+
proof = null,
|
|
114
|
+
topLevelAssertion = new Metatheorem(fileContext, string, labels, suppositions, consequent, proof, substitutions);
|
|
115
|
+
|
|
116
|
+
return topLevelAssertion;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
static fromMetatheoremNode(metatheoremNode, fileContext) {
|
|
120
|
+
const proofNode = proofNodeQuery(metatheoremNode),
|
|
121
|
+
labelNodes = labelNodesQuery(metatheoremNode),
|
|
122
|
+
consequentNode = consequentNodeQuery(metatheoremNode),
|
|
123
|
+
suppositionNodes = suppositionNodesQuery(metatheoremNode),
|
|
124
|
+
labels = labelNodes.map((labelNode) => {
|
|
125
|
+
const label = Label.fromLabelNode(labelNode, fileContext);
|
|
126
|
+
|
|
127
|
+
return label;
|
|
128
|
+
}),
|
|
129
|
+
suppositions = suppositionNodes.map((suppositionNode) => {
|
|
130
|
+
const supposition = Supposition.fromSuppositionNode(suppositionNode, fileContext);
|
|
131
|
+
|
|
132
|
+
return supposition;
|
|
133
|
+
}),
|
|
134
|
+
consequent = Consequent.fromConsequentNode(consequentNode, fileContext),
|
|
135
|
+
proof = Proof.fromProofNode(proofNode, fileContext),
|
|
136
|
+
string = stringFromLabels(labels),
|
|
137
|
+
substitutions = Substitutions.fromNothing(),
|
|
138
|
+
metatheorem = new Metatheorem(fileContext, string, labels, suppositions, consequent, proof, substitutions);
|
|
139
|
+
|
|
140
|
+
return metatheorem;
|
|
141
|
+
}
|
|
7
142
|
}
|
|
143
|
+
|
|
144
|
+
Object.assign(shim, {
|
|
145
|
+
Metatheorem
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
export default Metatheorem;
|