occam-verify-cli 0.0.1111 → 0.0.1112
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/combinator/bracketed.js +15 -65
- package/lib/combinator.js +4 -8
- package/lib/constructor/bracketed.js +24 -101
- package/lib/constructor.js +4 -8
- package/lib/context/file.js +41 -12
- package/lib/context/local.js +45 -25
- package/lib/context/release.js +2 -2
- package/lib/dom/assertion/contained.js +246 -0
- package/lib/dom/assertion/defined.js +266 -0
- package/lib/dom/assertion/subproof.js +210 -0
- package/lib/dom/assertion/type.js +240 -0
- package/lib/{axiom.js → dom/axiom.js} +18 -8
- package/lib/dom/conclusion.js +171 -0
- package/lib/{conjecture.js → dom/conjecture.js} +18 -8
- package/lib/dom/consequent.js +171 -0
- package/lib/dom/declaration/combinator.js +105 -0
- package/lib/dom/declaration/constructor.js +140 -0
- package/lib/dom/declaration/metavariable.js +154 -0
- package/lib/dom/declaration/type.js +140 -0
- package/lib/dom/declaration/variable.js +155 -0
- package/lib/{declaration.js → dom/declaration.js} +62 -18
- package/lib/dom/derivation.js +137 -0
- package/lib/dom/equality.js +260 -0
- package/lib/dom/error.js +85 -0
- package/lib/dom/frame.js +372 -0
- package/lib/dom/judgement.js +198 -0
- package/lib/dom/label.js +190 -0
- package/lib/{lemma.js → dom/lemma.js} +19 -9
- package/lib/{metaLemma.js → dom/metaLemma.js} +19 -9
- package/lib/dom/metaType.js +261 -0
- package/lib/dom/metatheorem.js +273 -0
- package/lib/dom/metavariable.js +463 -0
- package/lib/dom/premise.js +221 -0
- package/lib/dom/proof.js +154 -0
- package/lib/dom/proofStep.js +239 -0
- package/lib/dom/reference.js +218 -0
- package/lib/dom/rule.js +311 -0
- package/lib/dom/statement.js +379 -0
- package/lib/dom/subDerivation.js +137 -0
- package/lib/dom/subproof.js +211 -0
- package/lib/dom/supposition.js +221 -0
- package/lib/dom/term.js +354 -0
- package/lib/{theorem.js → dom/theorem.js} +18 -8
- package/lib/dom/topLevelAssertion.js +306 -0
- package/lib/dom/type.js +327 -0
- package/lib/dom/variable.js +328 -0
- package/lib/dom.js +27 -0
- package/lib/equivalences.js +307 -0
- package/lib/index.js +40 -35
- package/lib/mixins/proofStep/unify.js +86 -0
- package/lib/mixins/statement/verify.js +27 -2
- package/lib/mixins/term/verify.js +24 -4
- package/lib/substitution/frame.js +3 -3
- package/lib/substitution/statement.js +17 -16
- package/lib/substitution/term.js +10 -7
- package/lib/substitution.js +4 -31
- package/lib/substitutions.js +24 -56
- package/lib/unifier/equality.js +2 -3
- package/lib/unifier/label.js +3 -3
- package/lib/unifier/metaLevel.js +9 -8
- package/lib/unifier/metavariable.js +3 -3
- package/lib/unifier/statementWithCombinator.js +5 -5
- package/lib/unifier/termWithConstructor.js +3 -3
- package/lib/utilities/json.js +26 -40
- package/lib/utilities/string.js +6 -8
- package/lib/utilities/subproof.js +2 -2
- package/lib/utilities/substitutions.js +7 -6
- package/lib/utilities/verification.js +22 -14
- package/lib/verifier/combinator.js +4 -4
- package/lib/verifier/constructor.js +3 -3
- package/lib/verifier/topLevel.js +15 -21
- package/package.json +1 -1
- package/src/combinator/bracketed.js +11 -4
- package/src/combinator.js +3 -10
- package/src/constructor/bracketed.js +17 -5
- package/src/constructor.js +3 -9
- package/src/context/file.js +42 -11
- package/src/context/local.js +26 -34
- package/src/context/release.js +1 -1
- package/src/{assertion → dom/assertion}/contained.js +10 -8
- package/src/{assertion → dom/assertion}/defined.js +14 -11
- package/src/{assertion → dom/assertion}/subproof.js +11 -62
- package/src/{assertion → dom/assertion}/type.js +11 -8
- package/src/{axiom.js → dom/axiom.js} +6 -9
- package/src/dom/conclusion.js +95 -0
- package/src/{conjecture.js → dom/conjecture.js} +5 -8
- package/src/dom/consequent.js +95 -0
- package/src/{declaration → dom/declaration}/combinator.js +8 -5
- package/src/{declaration → dom/declaration}/constructor.js +8 -4
- package/src/{declaration → dom/declaration}/metavariable.js +8 -5
- package/src/{declaration → dom/declaration}/type.js +8 -4
- package/src/{declaration → dom/declaration}/variable.js +9 -6
- package/src/{declaration.js → dom/declaration.js} +11 -16
- package/src/{derivation.js → dom/derivation.js} +9 -12
- package/src/{equality.js → dom/equality.js} +11 -14
- package/src/{error.js → dom/error.js} +6 -3
- package/src/{frame.js → dom/frame.js} +14 -23
- package/src/{judgement.js → dom/judgement.js} +8 -11
- package/src/{label.js → dom/label.js} +9 -16
- package/src/{lemma.js → dom/lemma.js} +5 -9
- package/src/{metaLemma.js → dom/metaLemma.js} +6 -9
- package/src/{metaType.js → dom/metaType.js} +7 -10
- package/src/{metatheorem.js → dom/metatheorem.js} +6 -10
- package/src/{metavariable.js → dom/metavariable.js} +79 -77
- package/src/dom/premise.js +173 -0
- package/src/{proof.js → dom/proof.js} +8 -11
- package/src/dom/proofStep.js +173 -0
- package/src/{reference.js → dom/reference.js} +48 -20
- package/src/{rule.js → dom/rule.js} +13 -17
- package/src/{statement.js → dom/statement.js} +142 -71
- package/src/{subDerivation.js → dom/subDerivation.js} +9 -12
- package/src/{subproof.js → dom/subproof.js} +14 -47
- package/src/dom/supposition.js +173 -0
- package/src/{term.js → dom/term.js} +24 -45
- package/src/{theorem.js → dom/theorem.js} +5 -8
- package/src/{topLevelAssertion.js → dom/topLevelAssertion.js} +12 -14
- package/src/{type.js → dom/type.js} +9 -12
- package/src/{variable.js → dom/variable.js} +20 -28
- package/src/dom.js +13 -0
- package/src/equivalences.js +278 -0
- package/src/index.js +39 -34
- package/src/mixins/proofStep/unify.js +115 -0
- package/src/mixins/statement/verify.js +33 -1
- package/src/mixins/term/verify.js +33 -3
- package/src/substitution/frame.js +2 -2
- package/src/substitution/statement.js +20 -18
- package/src/substitution/term.js +12 -5
- package/src/substitution.js +4 -29
- package/src/substitutions.js +35 -73
- package/src/unifier/equality.js +1 -2
- package/src/unifier/label.js +2 -2
- package/src/unifier/metaLevel.js +9 -7
- package/src/unifier/metavariable.js +2 -2
- package/src/unifier/statementWithCombinator.js +4 -4
- package/src/unifier/termWithConstructor.js +2 -2
- package/src/utilities/json.js +23 -42
- package/src/utilities/string.js +8 -6
- package/src/utilities/subproof.js +2 -2
- package/src/utilities/substitutions.js +7 -5
- package/src/utilities/verification.js +29 -13
- package/src/verifier/combinator.js +3 -3
- package/src/verifier/constructor.js +3 -3
- package/src/verifier/topLevel.js +20 -21
- package/lib/assertion/contained.js +0 -232
- package/lib/assertion/defined.js +0 -211
- package/lib/assertion/subproof.js +0 -203
- package/lib/assertion/type.js +0 -185
- package/lib/conclusion.js +0 -130
- package/lib/consequent.js +0 -130
- package/lib/declaration/combinator.js +0 -90
- package/lib/declaration/constructor.js +0 -90
- package/lib/declaration/metavariable.js +0 -104
- package/lib/declaration/type.js +0 -90
- package/lib/declaration/variable.js +0 -105
- package/lib/derivation.js +0 -91
- package/lib/equality.js +0 -209
- package/lib/error.js +0 -70
- package/lib/frame.js +0 -331
- package/lib/judgement.js +0 -147
- package/lib/label.js +0 -141
- package/lib/metaType.js +0 -255
- package/lib/metatheorem.js +0 -263
- package/lib/metavariable.js +0 -399
- package/lib/mixins/statement/qualified/unify.js +0 -69
- package/lib/mixins/statement/unify.js +0 -42
- package/lib/mixins/statement/unifyIndependenntly.js +0 -46
- package/lib/mixins/term/unify.js +0 -40
- package/lib/premise.js +0 -184
- package/lib/proof.js +0 -103
- package/lib/proofStep.js +0 -179
- package/lib/reference.js +0 -145
- package/lib/rule.js +0 -259
- package/lib/shim.js +0 -14
- package/lib/statement/qualified.js +0 -152
- package/lib/statement/unqualified.js +0 -175
- package/lib/statement.js +0 -270
- package/lib/subDerivation.js +0 -91
- package/lib/subproof.js +0 -181
- package/lib/supposition.js +0 -184
- package/lib/term.js +0 -318
- package/lib/topLevelAssertion.js +0 -305
- package/lib/type.js +0 -321
- package/lib/utilities/equivalences.js +0 -178
- package/lib/variable.js +0 -281
- package/src/conclusion.js +0 -96
- package/src/consequent.js +0 -96
- package/src/mixins/statement/qualified/unify.js +0 -103
- package/src/mixins/statement/unify.js +0 -41
- package/src/mixins/statement/unifyIndependenntly.js +0 -58
- package/src/mixins/term/unify.js +0 -36
- package/src/premise.js +0 -183
- package/src/proofStep.js +0 -181
- package/src/shim.js +0 -5
- package/src/statement/qualified.js +0 -133
- package/src/statement/unqualified.js +0 -166
- package/src/supposition.js +0 -183
- package/src/utilities/equivalences.js +0 -183
package/src/unifier/equality.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import Unifier from "../unifier";
|
|
4
4
|
|
|
5
5
|
import { nodeQuery } from "../utilities/query";
|
|
6
|
-
import { findEquivalenceByTermNodes } from "../utilities/equivalences";
|
|
7
6
|
|
|
8
7
|
const termNodeQuery = nodeQuery("/term");
|
|
9
8
|
|
|
@@ -37,7 +36,7 @@ class EqualityUnifier extends Unifier {
|
|
|
37
36
|
leftTermNode,
|
|
38
37
|
rightTermNode
|
|
39
38
|
],
|
|
40
|
-
equivalence = findEquivalenceByTermNodes(
|
|
39
|
+
equivalence = equivalences.findEquivalenceByTermNodes(termNodes);
|
|
41
40
|
|
|
42
41
|
termUnifiedWithTerm = (equivalence !== null);
|
|
43
42
|
}
|
package/src/unifier/label.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import dom from "../dom";
|
|
4
4
|
import Unifier from "../unifier";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
@@ -28,7 +28,7 @@ class LabelUnifier extends Unifier {
|
|
|
28
28
|
unify: (generalTermNode, specificTermVariableNode, substitutions, generalContext, specificContext) => {
|
|
29
29
|
let termUnified;
|
|
30
30
|
|
|
31
|
-
const { Term, Variable } =
|
|
31
|
+
const { Term, Variable } = dom,
|
|
32
32
|
termNode = generalTermNode, ///
|
|
33
33
|
variableNode = specificTermVariableNode; ///
|
|
34
34
|
|
package/src/unifier/metaLevel.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import dom from "../dom";
|
|
4
4
|
import Unifier from "../unifier";
|
|
5
5
|
import TermSubstitution from "../substitution/term";
|
|
6
6
|
import FrameSubstitution from "../substitution/frame";
|
|
@@ -38,7 +38,7 @@ class MetaLevelUnifier extends Unifier {
|
|
|
38
38
|
statementMetavariableNode = statementMetavariableNodeQuery(statementNode);
|
|
39
39
|
|
|
40
40
|
if (statementMetavariableNode !== null) {
|
|
41
|
-
const { Metavariable, Statement } =
|
|
41
|
+
const { Metavariable, Statement } = dom; ///
|
|
42
42
|
|
|
43
43
|
let context,
|
|
44
44
|
statementNode;
|
|
@@ -60,7 +60,9 @@ class MetaLevelUnifier extends Unifier {
|
|
|
60
60
|
|
|
61
61
|
statementUnified = metavariable.unifyStatement(statement, substitution, substitutions, generalContext, specificContext);
|
|
62
62
|
} else {
|
|
63
|
-
|
|
63
|
+
const childNodesUnified = unifyChildNodes(generalStatementNode, specificStatementNode, substitutions, generalContext, specificContext);
|
|
64
|
+
|
|
65
|
+
statementUnified = childNodesUnified; ///
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
return statementUnified;
|
|
@@ -72,7 +74,7 @@ class MetaLevelUnifier extends Unifier {
|
|
|
72
74
|
unify: (generalFrameMetavariableNode, specificFrameNode, substitutions, generalContext, specificContext) => {
|
|
73
75
|
let frameUnified;
|
|
74
76
|
|
|
75
|
-
const { Frame, Metavariable } =
|
|
77
|
+
const { Frame, Metavariable } = dom,
|
|
76
78
|
frameNode = specificFrameNode, ///
|
|
77
79
|
metavariableNode = generalFrameMetavariableNode; ///
|
|
78
80
|
|
|
@@ -97,7 +99,7 @@ class MetaLevelUnifier extends Unifier {
|
|
|
97
99
|
unify: (generalTermVariableNode, specificTermNode, substitutions, generalContext, specificContext) => {
|
|
98
100
|
let termUnified;
|
|
99
101
|
|
|
100
|
-
const { Term, Variable } =
|
|
102
|
+
const { Term, Variable } = dom,
|
|
101
103
|
termNode = specificTermNode, ///
|
|
102
104
|
variableNode = generalTermVariableNode; ///
|
|
103
105
|
|
|
@@ -131,7 +133,7 @@ function unifyChildNodes(generalStatementNode, specificStatementNode, substituti
|
|
|
131
133
|
generalChildNodes = generalNonTerminalNodeChildNodes, ///
|
|
132
134
|
specificChildNodes = specificNonTerminalNodeChildNodes, ///
|
|
133
135
|
childNodesVerified = metaLevelUnifier.unifyChildNodes(generalChildNodes, specificChildNodes, substitutions, generalContext, specificContext),
|
|
134
|
-
|
|
136
|
+
childNodesUnified = childNodesVerified; ///
|
|
135
137
|
|
|
136
|
-
return
|
|
138
|
+
return childNodesUnified;
|
|
137
139
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import dom from "../dom";
|
|
4
4
|
import Unifier from "../unifier";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
@@ -29,7 +29,7 @@ class MetavariableUnifier extends Unifier {
|
|
|
29
29
|
unify: (generalTypeNode, specificTermNode, generalContext, specificContext) => {
|
|
30
30
|
let termUnified;
|
|
31
31
|
|
|
32
|
-
const { Term } =
|
|
32
|
+
const { Term } = dom,
|
|
33
33
|
typeNode = generalTypeNode, ///
|
|
34
34
|
termNode = specificTermNode, ///
|
|
35
35
|
typeName = typeNameFromTypeNode(typeNode),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import dom from "../dom";
|
|
4
4
|
import Unifier from "../unifier";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
@@ -32,7 +32,7 @@ class StatementWithCombinatorUnifier extends Unifier {
|
|
|
32
32
|
unify: (generalMetaTypeNode, specificStatementNode, assignments, stated, generalContext, specificContext) => {
|
|
33
33
|
let unified;
|
|
34
34
|
|
|
35
|
-
const { Statement, MetaType } =
|
|
35
|
+
const { Statement, MetaType } = dom,
|
|
36
36
|
metaTypeNode = generalMetaTypeNode, ///
|
|
37
37
|
statementNode = specificStatementNode; ///
|
|
38
38
|
|
|
@@ -58,7 +58,7 @@ class StatementWithCombinatorUnifier extends Unifier {
|
|
|
58
58
|
unify: (generalMetaTypeNode, specificFrameNode, assignments, stated, generalContext, specificContext) => {
|
|
59
59
|
let unified;
|
|
60
60
|
|
|
61
|
-
const { Frame, MetaType } =
|
|
61
|
+
const { Frame, MetaType } = dom,
|
|
62
62
|
metaTypeNode = generalMetaTypeNode, ///
|
|
63
63
|
frameNode = specificFrameNode; ///
|
|
64
64
|
|
|
@@ -84,7 +84,7 @@ class StatementWithCombinatorUnifier extends Unifier {
|
|
|
84
84
|
unify: (generalTypeNode, specificTermNode, assignments, stated, generalContext, specificContext) => {
|
|
85
85
|
let unified = false;
|
|
86
86
|
|
|
87
|
-
const { Term } =
|
|
87
|
+
const { Term } = dom,
|
|
88
88
|
typeNode = generalTypeNode, ///
|
|
89
89
|
termNode = specificTermNode, ///
|
|
90
90
|
typeName = typeNameFromTypeNode(typeNode);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import dom from "../dom";
|
|
4
4
|
import Unifier from "../unifier";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
@@ -29,7 +29,7 @@ class TermWithConstructorUnifier extends Unifier {
|
|
|
29
29
|
unify: (generalTypeNode, specificTermNode, context) => {
|
|
30
30
|
let unified = false;
|
|
31
31
|
|
|
32
|
-
const { Term } =
|
|
32
|
+
const { Term } = dom,
|
|
33
33
|
typeNode = generalTypeNode, ///
|
|
34
34
|
typeName = typeNameFromTypeNode(typeNode),
|
|
35
35
|
type = context.findTypeByTypeName(typeName);
|
package/src/utilities/json.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import dom from "../dom";
|
|
4
|
+
import Combinator from "../combinator";
|
|
5
|
+
import Constructor from "../constructor";
|
|
6
|
+
import StatementSubstitution from "../substitution/statement";
|
|
4
7
|
|
|
5
8
|
export function termFromJSON(json, fileContext) {
|
|
6
9
|
let { term } = json;
|
|
@@ -9,7 +12,7 @@ export function termFromJSON(json, fileContext) {
|
|
|
9
12
|
|
|
10
13
|
json = termJSON; ///
|
|
11
14
|
|
|
12
|
-
const { Term } =
|
|
15
|
+
const { Term } = dom;
|
|
13
16
|
|
|
14
17
|
term = Term.fromJSON(json, fileContext);
|
|
15
18
|
|
|
@@ -61,7 +64,7 @@ export function superTypeFromJSON(json, fileContext) {
|
|
|
61
64
|
export function statementFromJSON(json, fileContext) {
|
|
62
65
|
let { statement } = json;
|
|
63
66
|
|
|
64
|
-
const { Statement } =
|
|
67
|
+
const { Statement } = dom,
|
|
65
68
|
statementJSON = statement; ///
|
|
66
69
|
|
|
67
70
|
json = statementJSON; ///
|
|
@@ -74,7 +77,7 @@ export function statementFromJSON(json, fileContext) {
|
|
|
74
77
|
export function conclusionFromJSON(json, fileContext) {
|
|
75
78
|
let { conclusion } = json;
|
|
76
79
|
|
|
77
|
-
const { Conclusion } =
|
|
80
|
+
const { Conclusion } = dom,
|
|
78
81
|
conclusionJSON = conclusion; ///
|
|
79
82
|
|
|
80
83
|
json = conclusionJSON; ///
|
|
@@ -87,7 +90,7 @@ export function conclusionFromJSON(json, fileContext) {
|
|
|
87
90
|
export function consequentFromJSON(json, fileContext) {
|
|
88
91
|
let { consequent } = json;
|
|
89
92
|
|
|
90
|
-
const { Consequent } =
|
|
93
|
+
const { Consequent } = dom,
|
|
91
94
|
consequentJSON = consequent; ///
|
|
92
95
|
|
|
93
96
|
json = consequentJSON; ///
|
|
@@ -100,7 +103,7 @@ export function consequentFromJSON(json, fileContext) {
|
|
|
100
103
|
export function metavariableFromJSON(json, fileContext) {
|
|
101
104
|
let { metavariable } = json;
|
|
102
105
|
|
|
103
|
-
const { Metavariable } =
|
|
106
|
+
const { Metavariable } = dom,
|
|
104
107
|
metavariableJSON = metavariable; ///
|
|
105
108
|
|
|
106
109
|
json = metavariableJSON; ///
|
|
@@ -110,23 +113,10 @@ export function metavariableFromJSON(json, fileContext) {
|
|
|
110
113
|
return metavariable;
|
|
111
114
|
}
|
|
112
115
|
|
|
113
|
-
export function unqualifiedStatementFromJSON(json, fileContext) {
|
|
114
|
-
let { unqualifiedStatement } = json;
|
|
115
|
-
|
|
116
|
-
const { UnqualifiedStatement } = shim,
|
|
117
|
-
unqualifiedStatementJSON = unqualifiedStatement; ///
|
|
118
|
-
|
|
119
|
-
json = unqualifiedStatementJSON; ///
|
|
120
|
-
|
|
121
|
-
unqualifiedStatement = UnqualifiedStatement.fromJSON(json, fileContext);
|
|
122
|
-
|
|
123
|
-
return unqualifiedStatement;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
116
|
export function typesFromJSON(json, types, fileContext) {
|
|
127
117
|
const { types: typesJSON } = json;
|
|
128
118
|
|
|
129
|
-
const { Type } =
|
|
119
|
+
const { Type } = dom;
|
|
130
120
|
|
|
131
121
|
typesJSON.forEach((typeJSON) => {
|
|
132
122
|
const json = typeJSON, ///
|
|
@@ -139,7 +129,7 @@ export function typesFromJSON(json, types, fileContext) {
|
|
|
139
129
|
export function rulesFromJSON(json, fileContext) {
|
|
140
130
|
let { rules } = json;
|
|
141
131
|
|
|
142
|
-
const { Rule } =
|
|
132
|
+
const { Rule } = dom,
|
|
143
133
|
rulesJSON = rules; ///
|
|
144
134
|
|
|
145
135
|
rules = rulesJSON.map((ruleJSON) => {
|
|
@@ -155,7 +145,7 @@ export function rulesFromJSON(json, fileContext) {
|
|
|
155
145
|
export function labelsFromJSON(json, fileContext) {
|
|
156
146
|
let { labels } = json;
|
|
157
147
|
|
|
158
|
-
const { Label } =
|
|
148
|
+
const { Label } = dom,
|
|
159
149
|
labelsJSON = labels; ///
|
|
160
150
|
|
|
161
151
|
labels = labelsJSON.map((labelJSON) => {
|
|
@@ -171,7 +161,7 @@ export function labelsFromJSON(json, fileContext) {
|
|
|
171
161
|
export function axiomsFromJSON(json, fileContext) {
|
|
172
162
|
let { axioms } = json;
|
|
173
163
|
|
|
174
|
-
const { Axiom } =
|
|
164
|
+
const { Axiom } = dom,
|
|
175
165
|
axiomsJSON = axioms; ///
|
|
176
166
|
|
|
177
167
|
axioms = axiomsJSON.map((axiomJSON) => {
|
|
@@ -187,7 +177,7 @@ export function axiomsFromJSON(json, fileContext) {
|
|
|
187
177
|
export function premisesFromJSON(json, fileContext) {
|
|
188
178
|
let { premises } = json;
|
|
189
179
|
|
|
190
|
-
const { Premise } =
|
|
180
|
+
const { Premise } = dom,
|
|
191
181
|
premisesJSON = premises; ///
|
|
192
182
|
|
|
193
183
|
premises = premisesJSON.map((premiseJSON) => {
|
|
@@ -203,7 +193,7 @@ export function premisesFromJSON(json, fileContext) {
|
|
|
203
193
|
export function theoremsFromJSON(json, fileContext) {
|
|
204
194
|
let { theorems } = json;
|
|
205
195
|
|
|
206
|
-
const { Theorem } =
|
|
196
|
+
const { Theorem } = dom,
|
|
207
197
|
theoremsJSON = theorems; ///
|
|
208
198
|
|
|
209
199
|
theorems = theoremsJSON.map((theoremJSON) => {
|
|
@@ -219,7 +209,7 @@ export function theoremsFromJSON(json, fileContext) {
|
|
|
219
209
|
export function variablesFromJSON(json, fileContext) {
|
|
220
210
|
let { variables } = json;
|
|
221
211
|
|
|
222
|
-
const { Variable } =
|
|
212
|
+
const { Variable } = dom,
|
|
223
213
|
variablesJSON = variables; ///
|
|
224
214
|
|
|
225
215
|
variables = variablesJSON.map((variableJSON) => {
|
|
@@ -235,7 +225,7 @@ export function variablesFromJSON(json, fileContext) {
|
|
|
235
225
|
export function conjecturesFromJSON(json, fileContext) {
|
|
236
226
|
let { conjectures } = json;
|
|
237
227
|
|
|
238
|
-
const { Conjecture } =
|
|
228
|
+
const { Conjecture } = dom,
|
|
239
229
|
conjecturesJSON = conjectures; ///
|
|
240
230
|
|
|
241
231
|
conjectures = conjecturesJSON.map((conjectureJSON) => {
|
|
@@ -251,8 +241,7 @@ export function conjecturesFromJSON(json, fileContext) {
|
|
|
251
241
|
export function combinatorsFromJSON(json, fileContext) {
|
|
252
242
|
let { combinators } = json;
|
|
253
243
|
|
|
254
|
-
const
|
|
255
|
-
combinatorsJSON = combinators; ///
|
|
244
|
+
const combinatorsJSON = combinators; ///
|
|
256
245
|
|
|
257
246
|
combinators = combinatorsJSON.map((combinatorJSON) => {
|
|
258
247
|
const json = combinatorJSON, ///
|
|
@@ -267,8 +256,7 @@ export function combinatorsFromJSON(json, fileContext) {
|
|
|
267
256
|
export function constructorsFromJSON(json, fileContext) {
|
|
268
257
|
let { constructors } = json;
|
|
269
258
|
|
|
270
|
-
const
|
|
271
|
-
constructorsJSON = constructors; ///
|
|
259
|
+
const constructorsJSON = constructors; ///
|
|
272
260
|
|
|
273
261
|
constructors = constructorsJSON.map((constructorJSON) => {
|
|
274
262
|
const json = constructorJSON, ///
|
|
@@ -283,7 +271,7 @@ export function constructorsFromJSON(json, fileContext) {
|
|
|
283
271
|
export function metatheoremsFromJSON(json, fileContext) {
|
|
284
272
|
let { metatheorems } = json;
|
|
285
273
|
|
|
286
|
-
const { Metatheorem } =
|
|
274
|
+
const { Metatheorem } = dom,
|
|
287
275
|
metatheoremsJSON = metatheorems; ///
|
|
288
276
|
|
|
289
277
|
metatheorems = metatheoremsJSON.map((metatheoremJSON) => {
|
|
@@ -299,7 +287,7 @@ export function metatheoremsFromJSON(json, fileContext) {
|
|
|
299
287
|
export function suppositionsFromJSON(json, fileContext) {
|
|
300
288
|
let { suppositions } = json;
|
|
301
289
|
|
|
302
|
-
const { Supposition } =
|
|
290
|
+
const { Supposition } = dom,
|
|
303
291
|
suppositionsJSON = suppositions; ///
|
|
304
292
|
|
|
305
293
|
suppositions = suppositionsJSON.map((suppositionJSON) => {
|
|
@@ -315,8 +303,7 @@ export function suppositionsFromJSON(json, fileContext) {
|
|
|
315
303
|
export function substitutionsFromJSON(json, fileContext) {
|
|
316
304
|
let { substitutions = [] } = json; ///
|
|
317
305
|
|
|
318
|
-
const
|
|
319
|
-
substitutionsJSON = substitutions, ///
|
|
306
|
+
const substitutionsJSON = substitutions, ///
|
|
320
307
|
Substitution = StatementSubstitution; ///
|
|
321
308
|
|
|
322
309
|
substitutions = substitutionsJSON.map((substitutionJSON) => {
|
|
@@ -332,7 +319,7 @@ export function substitutionsFromJSON(json, fileContext) {
|
|
|
332
319
|
export function metavariablesFromJSON(json, fileContext) {
|
|
333
320
|
let { metavariables } = json;
|
|
334
321
|
|
|
335
|
-
const { Metavariable } =
|
|
322
|
+
const { Metavariable } = dom,
|
|
336
323
|
metavariablesJSON = metavariables; ///
|
|
337
324
|
|
|
338
325
|
metavariables = metavariablesJSON.map((metavariableJSON) => {
|
|
@@ -408,12 +395,6 @@ export function metavariableToMetavariableJSON(metavariable) {
|
|
|
408
395
|
return metavariableJSON;
|
|
409
396
|
}
|
|
410
397
|
|
|
411
|
-
export function unqualifiedStatementToUnqualifiedStatementJSON(unqualifiedStatement) {
|
|
412
|
-
const unqualifiedStatementJSON = unqualifiedStatement.toJSON();
|
|
413
|
-
|
|
414
|
-
return unqualifiedStatementJSON;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
398
|
export function typesToTypesJSON(types) {
|
|
418
399
|
const typesJSON = types.map((type) => {
|
|
419
400
|
const typeJSON = type.toJSON();
|
package/src/utilities/string.js
CHANGED
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { COMMA, EMPTY_STRING } from "../constants";
|
|
4
4
|
|
|
5
|
-
export function trim(string) {
|
|
6
|
-
string = string.replace(/\s+$/, EMPTY_STRING); ///
|
|
7
|
-
|
|
8
|
-
return string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
5
|
export function nodeAsString(node, tokens) {
|
|
12
6
|
let string;
|
|
13
7
|
|
|
@@ -15,6 +9,8 @@ export function nodeAsString(node, tokens) {
|
|
|
15
9
|
|
|
16
10
|
string = tokensAsString(tokens);
|
|
17
11
|
|
|
12
|
+
string = trimString(string); ///
|
|
13
|
+
|
|
18
14
|
return string;
|
|
19
15
|
}
|
|
20
16
|
|
|
@@ -60,6 +56,12 @@ export function nodeAsTokens(node, tokens) {
|
|
|
60
56
|
return tokens;
|
|
61
57
|
}
|
|
62
58
|
|
|
59
|
+
function trimString(string) {
|
|
60
|
+
string = string.replace(/\s+$/, EMPTY_STRING); ///
|
|
61
|
+
|
|
62
|
+
return string;
|
|
63
|
+
}
|
|
64
|
+
|
|
63
65
|
function terminalNodeAsTokens(terminalNode, tokens) {
|
|
64
66
|
const significantToken = terminalNode.getSignificantToken(),
|
|
65
67
|
token = significantToken; ///
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { nodeQuery, nodesQuery } from "./query";
|
|
4
4
|
import { nodeAsString, nodesAsString } from "./string";
|
|
5
5
|
|
|
6
|
-
const suppositionStatementNodesQuery = nodesQuery("/subproof/supposition/
|
|
7
|
-
lastProofStepStatementNodeQuery = nodeQuery("/subproof/subDerivation/lastProofStep/
|
|
6
|
+
const suppositionStatementNodesQuery = nodesQuery("/subproof/supposition/statement"),
|
|
7
|
+
lastProofStepStatementNodeQuery = nodeQuery("/subproof/subDerivation/lastProofStep/statement");
|
|
8
8
|
|
|
9
9
|
export function subproofStringFromSubproofNode(subproofNode, fileContext) {
|
|
10
10
|
let subproofString = null;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import dom from "../dom";
|
|
4
4
|
import TermSubstitution from "../substitution/term";
|
|
5
5
|
import FrameSubstitution from "../substitution/frame";
|
|
6
6
|
|
|
7
7
|
export function termFromTermAndSubstitutions(term, substitutions, context) {
|
|
8
8
|
if (term !== null) {
|
|
9
|
-
const { Variable } =
|
|
9
|
+
const { Variable } = dom,
|
|
10
10
|
termNode = term.getNode(),
|
|
11
11
|
variable = Variable.fromTermNode(termNode, context);
|
|
12
12
|
|
|
@@ -24,12 +24,14 @@ export function termFromTermAndSubstitutions(term, substitutions, context) {
|
|
|
24
24
|
|
|
25
25
|
export function frameFromFrameAndSubstitutions(frame, substitutions, context) {
|
|
26
26
|
if (frame !== null) {
|
|
27
|
-
const { Metavariable } =
|
|
27
|
+
const { Metavariable } = dom,
|
|
28
28
|
frameNode = frame.getNode(),
|
|
29
29
|
metavariable = Metavariable.fromFrameNode(frameNode, context);
|
|
30
30
|
|
|
31
31
|
if (metavariable !== null) {
|
|
32
|
-
|
|
32
|
+
let substitution = null;
|
|
33
|
+
|
|
34
|
+
substitution = substitutions.findSubstitutionByMetavariableAndSubstitution(metavariable, substitution);
|
|
33
35
|
|
|
34
36
|
if (substitution !== null) {
|
|
35
37
|
frame = substitution.getFrame();
|
|
@@ -42,7 +44,7 @@ export function frameFromFrameAndSubstitutions(frame, substitutions, context) {
|
|
|
42
44
|
|
|
43
45
|
export function statementFromStatementAndSubstitutions(statement, substitutions, context) {
|
|
44
46
|
if (statement !== null) {
|
|
45
|
-
const { Metavariable } =
|
|
47
|
+
const { Metavariable } = dom,
|
|
46
48
|
statementNode = statement.getNode(),
|
|
47
49
|
metavariable = Metavariable.fromStatementNode(statementNode, context);
|
|
48
50
|
|
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import dom from "../dom";
|
|
4
4
|
import LocalContext from "../context/local";
|
|
5
|
-
import TypeAssertion from "../assertion/type";
|
|
6
|
-
import DefinedAssertion from "../assertion/defined";
|
|
7
|
-
import SubproofAssertion from "../assertion/subproof";
|
|
8
|
-
import ContainedAssertion from "../assertion/contained";
|
|
9
5
|
|
|
10
6
|
import { bracketedStatementChildNodeFromStatementNode } from "../utilities/brackets";
|
|
11
7
|
|
|
8
|
+
export function stripBracketsFromTerm(term, context) {
|
|
9
|
+
const termNode = term.getNode(),
|
|
10
|
+
bracketedTermChildNode = bracketedTermChildNodeFromTermNode(termNode);
|
|
11
|
+
|
|
12
|
+
if (bracketedTermChildNode !== null) {
|
|
13
|
+
context = contextFromTerm(term, context); ///
|
|
14
|
+
|
|
15
|
+
const { Term } = dom,
|
|
16
|
+
termNode = bracketedTermChildNode; ///
|
|
17
|
+
|
|
18
|
+
term = Term.fromStatementNode(termNode, context);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return term;
|
|
22
|
+
}
|
|
23
|
+
|
|
12
24
|
export function stripBracketsFromStatement(statement, context) {
|
|
13
25
|
const statementNode = statement.getNode(),
|
|
14
26
|
bracketedStatementChildNode = bracketedStatementChildNodeFromStatementNode(statementNode);
|
|
@@ -16,7 +28,7 @@ export function stripBracketsFromStatement(statement, context) {
|
|
|
16
28
|
if (bracketedStatementChildNode !== null) {
|
|
17
29
|
context = contextFromStatement(statement, context); ///
|
|
18
30
|
|
|
19
|
-
const { Statement } =
|
|
31
|
+
const { Statement } = dom,
|
|
20
32
|
statementNode = bracketedStatementChildNode; ///
|
|
21
33
|
|
|
22
34
|
statement = Statement.fromStatementNode(statementNode, context);
|
|
@@ -28,7 +40,7 @@ export function stripBracketsFromStatement(statement, context) {
|
|
|
28
40
|
export function equalityFromStatement(statement, context) {
|
|
29
41
|
context = contextFromStatement(statement, context); ///
|
|
30
42
|
|
|
31
|
-
const { Equality } =
|
|
43
|
+
const { Equality } = dom,
|
|
32
44
|
statementNode = statement.getNode(),
|
|
33
45
|
equality = Equality.fromStatementNode(statementNode, context);
|
|
34
46
|
|
|
@@ -38,7 +50,7 @@ export function equalityFromStatement(statement, context) {
|
|
|
38
50
|
export function judgementFromStatement(statement, context) {
|
|
39
51
|
context = contextFromStatement(statement, context); ///
|
|
40
52
|
|
|
41
|
-
const { Judgement } =
|
|
53
|
+
const { Judgement } = dom,
|
|
42
54
|
statementNode = statement.getNode(),
|
|
43
55
|
judgement = Judgement.fromStatementNode(statementNode, context);
|
|
44
56
|
|
|
@@ -48,7 +60,7 @@ export function judgementFromStatement(statement, context) {
|
|
|
48
60
|
export function metavariableFromStatement(statement, context) {
|
|
49
61
|
context = contextFromStatement(statement, context); ///
|
|
50
62
|
|
|
51
|
-
const { Metavariable } =
|
|
63
|
+
const { Metavariable } = dom,
|
|
52
64
|
statementNode = statement.getNode(),
|
|
53
65
|
metavariable = Metavariable.fromStatementNode(statementNode, context);
|
|
54
66
|
|
|
@@ -58,7 +70,8 @@ export function metavariableFromStatement(statement, context) {
|
|
|
58
70
|
export function typeAssertionFromStatement(statement, context) {
|
|
59
71
|
context = contextFromStatement(statement, context); ///
|
|
60
72
|
|
|
61
|
-
const
|
|
73
|
+
const { TypeAssertion } = dom,
|
|
74
|
+
statementNode = statement.getNode(),
|
|
62
75
|
typeAssertion = TypeAssertion.fromStatementNode(statementNode, context);
|
|
63
76
|
|
|
64
77
|
return typeAssertion;
|
|
@@ -67,7 +80,8 @@ export function typeAssertionFromStatement(statement, context) {
|
|
|
67
80
|
export function definedAssertionFromStatement(statement, context) {
|
|
68
81
|
context = contextFromStatement(statement, context); ///
|
|
69
82
|
|
|
70
|
-
const
|
|
83
|
+
const { DefinedAssertion } = dom,
|
|
84
|
+
statementNode = statement.getNode(),
|
|
71
85
|
definedAssertion = DefinedAssertion.fromStatementNode(statementNode, context);
|
|
72
86
|
|
|
73
87
|
return definedAssertion;
|
|
@@ -76,7 +90,8 @@ export function definedAssertionFromStatement(statement, context) {
|
|
|
76
90
|
export function subproofAssertionFromStatement(statement, context) {
|
|
77
91
|
context = contextFromStatement(statement, context); ///
|
|
78
92
|
|
|
79
|
-
const
|
|
93
|
+
const { SubproofAssertion } = dom,
|
|
94
|
+
statementNode = statement.getNode(),
|
|
80
95
|
subproofAssertion = SubproofAssertion.fromStatementNode(statementNode, context);
|
|
81
96
|
|
|
82
97
|
return subproofAssertion;
|
|
@@ -85,7 +100,8 @@ export function subproofAssertionFromStatement(statement, context) {
|
|
|
85
100
|
export function containedAssertionFromStatement(statement, context) {
|
|
86
101
|
context = contextFromStatement(statement, context); ///
|
|
87
102
|
|
|
88
|
-
const
|
|
103
|
+
const { ContainedAssertion } = dom,
|
|
104
|
+
statementNode = statement.getNode(),
|
|
89
105
|
containedAssertion = ContainedAssertion.fromStatementNode(statementNode, context);
|
|
90
106
|
|
|
91
107
|
return containedAssertion;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import dom from "../dom";
|
|
4
4
|
import Verifier from "../verifier";
|
|
5
5
|
import LocalContext from "../context/local";
|
|
6
6
|
|
|
@@ -28,7 +28,7 @@ class CombinatorVerifier extends Verifier {
|
|
|
28
28
|
{
|
|
29
29
|
nodeQuery: statementNodeQuery,
|
|
30
30
|
verify: (statementNode, fileContext) => {
|
|
31
|
-
const { Statement } =
|
|
31
|
+
const { Statement } = dom,
|
|
32
32
|
localContext = LocalContext.fromFileContext(fileContext),
|
|
33
33
|
context = localContext, ///
|
|
34
34
|
statement = Statement.fromStatementNode(statementNode, context),
|
|
@@ -42,7 +42,7 @@ class CombinatorVerifier extends Verifier {
|
|
|
42
42
|
{
|
|
43
43
|
nodeQuery: termNodeQuery,
|
|
44
44
|
verify: (termNode, fileContext) => {
|
|
45
|
-
const { Term } =
|
|
45
|
+
const { Term } = dom,
|
|
46
46
|
localContext = LocalContext.fromFileContext(fileContext),
|
|
47
47
|
context = localContext, ///
|
|
48
48
|
term = Term.fromTermNode(termNode, context),
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import dom from "../dom";
|
|
4
4
|
import Verifier from "../verifier";
|
|
5
5
|
import LocalContext from "../context/local";
|
|
6
6
|
|
|
7
7
|
import { nodeQuery } from "../utilities/query";
|
|
8
|
-
import {typeNameFromTypeNode} from "../utilities/name";
|
|
8
|
+
import { typeNameFromTypeNode } from "../utilities/name";
|
|
9
9
|
|
|
10
10
|
const termNodeQuery = nodeQuery("/term"),
|
|
11
11
|
typeNodeQuery = nodeQuery("/type");
|
|
@@ -31,7 +31,7 @@ class ConstructorVerifier extends Verifier {
|
|
|
31
31
|
{
|
|
32
32
|
nodeQuery: termNodeQuery,
|
|
33
33
|
verify: (termNode, fileContext, verifyAhead) => {
|
|
34
|
-
const { Term } =
|
|
34
|
+
const { Term } = dom,
|
|
35
35
|
localContext = LocalContext.fromFileContext(fileContext),
|
|
36
36
|
context = localContext, ///
|
|
37
37
|
term = Term.fromTermNode(termNode, context),
|