occam-verify-cli 1.0.421 → 1.0.427
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/action/verify.js +7 -3
- package/lib/context/file.js +8 -44
- package/lib/context/local.js +8 -26
- package/lib/context/nominal.js +64 -0
- package/lib/context/release.js +2 -2
- package/lib/context/temporary.js +6 -58
- package/lib/element/assertion/contained.js +303 -0
- package/lib/element/assertion/defined.js +318 -0
- package/lib/element/assertion/property.js +299 -0
- package/lib/element/assertion/satisfies.js +264 -0
- package/lib/element/assertion/subproof.js +178 -0
- package/lib/element/assertion/type.js +294 -0
- package/lib/{ontology → element}/assertion.js +9 -9
- package/lib/element/assumption.js +365 -0
- package/lib/element/axiom.js +332 -0
- package/lib/element/axiomLemmaTheoremConjecture.js +346 -0
- package/lib/element/conclusion.js +151 -0
- package/lib/{ontology → element}/conjecture.js +7 -14
- package/lib/element/declaration/combinator.js +161 -0
- package/lib/element/declaration/complexType.js +343 -0
- package/lib/element/declaration/constructor.js +193 -0
- package/lib/element/declaration/metavariable.js +193 -0
- package/lib/element/declaration/simpleType.js +240 -0
- package/lib/element/declaration/typePrefix.js +179 -0
- package/lib/element/declaration/variable.js +196 -0
- package/lib/{ontology → element}/declaration.js +9 -9
- package/lib/element/deduction.js +207 -0
- package/lib/element/derivation.js +96 -0
- package/lib/element/equality.js +275 -0
- package/lib/element/equivalence.js +316 -0
- package/lib/element/equivalences.js +264 -0
- package/lib/{ontology → element}/error.js +12 -12
- package/lib/element/frame.js +387 -0
- package/lib/element/hypothesis.js +195 -0
- package/lib/element/judgement.js +243 -0
- package/lib/element/label.js +198 -0
- package/lib/{ontology → element}/lemma.js +7 -7
- package/lib/{ontology → element}/metaLemma.js +8 -8
- package/lib/element/metaLemmaMetatheorem.js +234 -0
- package/lib/{ontology → element}/metaType.js +18 -11
- package/lib/{ontology → element}/metatheorem.js +8 -8
- package/lib/element/metavariable.js +459 -0
- package/lib/element/parameter.js +108 -0
- package/lib/element/premise.js +310 -0
- package/lib/element/procedureCall.js +243 -0
- package/lib/{ontology → element}/procedureReference.js +3 -3
- package/lib/{ontology → element}/proof.js +4 -4
- package/lib/element/property.js +128 -0
- package/lib/element/propertyRelation.js +195 -0
- package/lib/element/reference.js +304 -0
- package/lib/element/rule.js +373 -0
- package/lib/element/section.js +255 -0
- package/lib/element/signature.js +217 -0
- package/lib/element/statement/combinator/bracketed.js +166 -0
- package/lib/element/statement/combinator.js +105 -0
- package/lib/element/statement.js +386 -0
- package/lib/element/step.js +274 -0
- package/lib/element/subDerivation.js +137 -0
- package/lib/element/subproof.js +240 -0
- package/lib/element/substitution/frame.js +216 -0
- package/lib/{ontology → element}/substitution/reference.js +5 -4
- package/lib/{ontology → element}/substitution/statement.js +7 -6
- package/lib/element/substitution/term.js +265 -0
- package/lib/element/substitution.js +206 -0
- package/lib/element/substitutions.js +425 -0
- package/lib/element/supposition.js +323 -0
- package/lib/{ontology → element/term}/constructor/bracketed.js +11 -7
- package/lib/element/term/constructor.js +172 -0
- package/lib/element/term.js +322 -0
- package/lib/{ontology → element}/theorem.js +8 -8
- package/lib/element/type.js +490 -0
- package/lib/element/typePrefix.js +99 -0
- package/lib/element/variable.js +345 -0
- package/lib/elements.js +27 -0
- package/lib/mixins/statement/verify.js +14 -14
- package/lib/mixins/step/unify.js +12 -12
- package/lib/mixins/term/verify.js +4 -4
- package/lib/node/substitution/frame.js +15 -1
- package/lib/node/substitution/statement.js +37 -1
- package/lib/node/substitution/term.js +15 -1
- package/lib/preamble.js +63 -63
- package/lib/process/assign.js +58 -0
- package/lib/process/instantiate.js +68 -7
- package/lib/process/unify.js +26 -26
- package/lib/process/verify.js +21 -21
- package/lib/utilities/brackets.js +9 -18
- package/lib/utilities/customGrammar.js +1 -1
- package/lib/utilities/element.js +1128 -0
- package/lib/utilities/json.js +32 -32
- package/lib/utilities/node.js +49 -61
- package/lib/utilities/statement.js +83 -0
- package/lib/utilities/string.js +98 -56
- package/package.json +6 -6
- package/src/action/verify.js +8 -1
- package/src/context/file.js +9 -39
- package/src/context/local.js +5 -11
- package/src/context/nominal.js +30 -0
- package/src/context/release.js +1 -1
- package/src/context/temporary.js +6 -63
- package/src/{ontology → element}/assertion/contained.js +4 -25
- package/src/{ontology → element}/assertion/defined.js +7 -26
- package/src/{ontology → element}/assertion/property.js +7 -26
- package/src/{ontology → element}/assertion/satisfies.js +5 -53
- package/src/{ontology → element}/assertion/subproof.js +3 -32
- package/src/{ontology → element}/assertion/type.js +7 -26
- package/src/{ontology → element}/assertion.js +6 -6
- package/src/{ontology → element}/assumption.js +3 -27
- package/src/{ontology → element}/axiom.js +4 -11
- package/src/{ontology/topLevelAssertion.js → element/axiomLemmaTheoremConjecture.js} +9 -105
- package/src/{ontology → element}/conclusion.js +4 -19
- package/src/{ontology → element}/conjecture.js +4 -11
- package/src/{ontology → element}/declaration/combinator.js +3 -14
- package/src/{ontology → element}/declaration/complexType.js +3 -19
- package/src/{ontology → element}/declaration/constructor.js +3 -14
- package/src/{ontology → element}/declaration/metavariable.js +3 -39
- package/src/{ontology → element}/declaration/simpleType.js +3 -19
- package/src/{ontology → element}/declaration/typePrefix.js +3 -15
- package/src/{ontology → element}/declaration/variable.js +3 -14
- package/src/{ontology → element}/declaration.js +6 -6
- package/src/{ontology → element}/deduction.js +9 -22
- package/src/{ontology → element}/derivation.js +2 -32
- package/src/{ontology → element}/equality.js +18 -42
- package/src/{ontology → element}/equivalence.js +17 -2
- package/src/{ontology → element}/equivalences.js +1 -1
- package/src/{ontology → element}/error.js +8 -8
- package/src/{ontology → element}/frame.js +8 -56
- package/src/{ontology → element}/hypothesis.js +5 -5
- package/src/{ontology → element}/judgement.js +7 -7
- package/src/{ontology → element}/label.js +3 -3
- package/src/{ontology → element}/lemma.js +4 -4
- package/src/{ontology → element}/metaLemma.js +5 -5
- package/src/{ontology/topLevelMetaAssertion.js → element/metaLemmaMetatheorem.js} +11 -11
- package/src/{ontology → element}/metaType.js +11 -7
- package/src/{ontology → element}/metatheorem.js +5 -5
- package/src/{ontology → element}/metavariable.js +10 -60
- package/src/{ontology → element}/parameter.js +1 -1
- package/src/{ontology → element}/premise.js +14 -14
- package/src/{ontology → element}/procedureCall.js +4 -4
- package/src/{ontology → element}/procedureReference.js +1 -1
- package/src/{ontology → element}/proof.js +3 -3
- package/src/{ontology → element}/property.js +7 -15
- package/src/{ontology → element}/propertyRelation.js +5 -11
- package/src/{ontology → element}/reference.js +5 -19
- package/src/{ontology → element}/rule.js +13 -13
- package/src/{ontology → element}/section.js +10 -10
- package/src/{ontology → element}/signature.js +12 -15
- package/src/element/statement/combinator/bracketed.js +38 -0
- package/src/element/statement/combinator.js +59 -0
- package/src/{ontology → element}/statement.js +11 -27
- package/src/{ontology → element}/step.js +10 -44
- package/src/{ontology → element}/subDerivation.js +3 -24
- package/src/{ontology → element}/subproof.js +3 -43
- package/src/{ontology → element}/substitution/frame.js +4 -21
- package/src/{ontology → element}/substitution/reference.js +3 -3
- package/src/{ontology → element}/substitution/statement.js +6 -10
- package/src/{ontology → element}/substitution/term.js +7 -23
- package/src/{ontology → element}/substitutions.js +1 -1
- package/src/{ontology → element}/supposition.js +10 -10
- package/src/{ontology → element/term}/constructor/bracketed.js +12 -13
- package/src/element/term/constructor.js +82 -0
- package/src/{ontology → element}/term.js +6 -38
- package/src/{ontology → element}/theorem.js +5 -5
- package/src/{ontology → element}/type.js +17 -64
- package/src/{ontology → element}/typePrefix.js +8 -12
- package/src/{ontology → element}/variable.js +9 -20
- package/src/elements.js +13 -0
- package/src/mixins/statement/verify.js +4 -4
- package/src/mixins/step/unify.js +6 -6
- package/src/mixins/term/verify.js +3 -3
- package/src/node/substitution/frame.js +14 -0
- package/src/node/substitution/statement.js +40 -0
- package/src/node/substitution/term.js +15 -0
- package/src/preamble.js +62 -62
- package/src/process/assign.js +59 -0
- package/src/process/instantiate.js +67 -15
- package/src/process/unify.js +37 -39
- package/src/process/verify.js +20 -20
- package/src/utilities/brackets.js +12 -17
- package/src/utilities/customGrammar.js +3 -3
- package/src/utilities/element.js +1380 -0
- package/src/utilities/json.js +31 -31
- package/src/utilities/node.js +56 -64
- package/src/utilities/{context.js → statement.js} +10 -39
- package/src/utilities/string.js +120 -52
- package/lib/assignment/equality.js +0 -62
- package/lib/assignment/judgement.js +0 -62
- package/lib/assignment/variable.js +0 -64
- package/lib/context/bracketed/combinator.js +0 -121
- package/lib/context/bracketed/constructor.js +0 -121
- package/lib/context/bracketted.js +0 -86
- package/lib/context/partial/metavariable.js +0 -180
- package/lib/context/partial/statement.js +0 -180
- package/lib/context/partial/term.js +0 -192
- package/lib/context/partial/variable.js +0 -192
- package/lib/context/partial.js +0 -93
- package/lib/ontology/assertion/contained.js +0 -357
- package/lib/ontology/assertion/defined.js +0 -331
- package/lib/ontology/assertion/property.js +0 -313
- package/lib/ontology/assertion/satisfies.js +0 -302
- package/lib/ontology/assertion/subproof.js +0 -240
- package/lib/ontology/assertion/type.js +0 -308
- package/lib/ontology/assumption.js +0 -383
- package/lib/ontology/axiom.js +0 -339
- package/lib/ontology/combinator/bracketed.js +0 -202
- package/lib/ontology/combinator.js +0 -155
- package/lib/ontology/conclusion.js +0 -201
- package/lib/ontology/constructor.js +0 -185
- package/lib/ontology/declaration/combinator.js +0 -210
- package/lib/ontology/declaration/complexType.js +0 -393
- package/lib/ontology/declaration/constructor.js +0 -242
- package/lib/ontology/declaration/metavariable.js +0 -257
- package/lib/ontology/declaration/simpleType.js +0 -290
- package/lib/ontology/declaration/typePrefix.js +0 -228
- package/lib/ontology/declaration/variable.js +0 -245
- package/lib/ontology/deduction.js +0 -215
- package/lib/ontology/derivation.js +0 -155
- package/lib/ontology/equality.js +0 -288
- package/lib/ontology/equivalence.js +0 -295
- package/lib/ontology/equivalences.js +0 -264
- package/lib/ontology/frame.js +0 -419
- package/lib/ontology/hypothesis.js +0 -190
- package/lib/ontology/judgement.js +0 -248
- package/lib/ontology/label.js +0 -198
- package/lib/ontology/metavariable.js +0 -502
- package/lib/ontology/parameter.js +0 -108
- package/lib/ontology/premise.js +0 -310
- package/lib/ontology/procedureCall.js +0 -243
- package/lib/ontology/property.js +0 -166
- package/lib/ontology/propertyRelation.js +0 -202
- package/lib/ontology/reference.js +0 -315
- package/lib/ontology/rule.js +0 -373
- package/lib/ontology/section.js +0 -255
- package/lib/ontology/signature.js +0 -217
- package/lib/ontology/statement.js +0 -398
- package/lib/ontology/step.js +0 -295
- package/lib/ontology/subDerivation.js +0 -147
- package/lib/ontology/subproof.js +0 -265
- package/lib/ontology/substitution/frame.js +0 -261
- package/lib/ontology/substitution/term.js +0 -269
- package/lib/ontology/substitution.js +0 -206
- package/lib/ontology/substitutions.js +0 -425
- package/lib/ontology/supposition.js +0 -323
- package/lib/ontology/term.js +0 -351
- package/lib/ontology/topLevelAssertion.js +0 -431
- package/lib/ontology/topLevelMetaAssertion.js +0 -234
- package/lib/ontology/type.js +0 -556
- package/lib/ontology/typePrefix.js +0 -99
- package/lib/ontology/variable.js +0 -343
- package/lib/ontology.js +0 -27
- package/lib/utilities/assignments.js +0 -19
- package/lib/utilities/context.js +0 -101
- package/lib/utilities/subproof.js +0 -42
- package/lib/utilities/type.js +0 -40
- package/src/assignment/equality.js +0 -29
- package/src/assignment/judgement.js +0 -29
- package/src/assignment/variable.js +0 -34
- package/src/context/bracketed/combinator.js +0 -31
- package/src/context/bracketed/constructor.js +0 -31
- package/src/context/bracketted.js +0 -41
- package/src/context/partial/metavariable.js +0 -39
- package/src/context/partial/statement.js +0 -39
- package/src/context/partial/term.js +0 -49
- package/src/context/partial/variable.js +0 -49
- package/src/context/partial.js +0 -71
- package/src/ontology/combinator/bracketed.js +0 -38
- package/src/ontology/combinator.js +0 -72
- package/src/ontology/constructor.js +0 -105
- package/src/ontology.js +0 -13
- package/src/utilities/assignments.js +0 -11
- package/src/utilities/subproof.js +0 -56
- package/src/utilities/type.js +0 -35
- /package/src/{ontology → element}/substitution.js +0 -0
package/src/utilities/json.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import elements from "../elements";
|
|
4
4
|
|
|
5
5
|
export function termFromJSON(json, context) {
|
|
6
6
|
let { term } = json;
|
|
@@ -9,7 +9,7 @@ export function termFromJSON(json, context) {
|
|
|
9
9
|
|
|
10
10
|
json = termJSON; ///
|
|
11
11
|
|
|
12
|
-
const { Term } =
|
|
12
|
+
const { Term } = elements;
|
|
13
13
|
|
|
14
14
|
term = Term.fromJSON(json, context);
|
|
15
15
|
|
|
@@ -52,7 +52,7 @@ export function statementFromJSON(json, context) {
|
|
|
52
52
|
let { statement = null } = json;
|
|
53
53
|
|
|
54
54
|
if (statement !== null) {
|
|
55
|
-
const { Statement } =
|
|
55
|
+
const { Statement } = elements,
|
|
56
56
|
statementJSON = statement; ///
|
|
57
57
|
|
|
58
58
|
json = statementJSON; ///
|
|
@@ -66,7 +66,7 @@ export function statementFromJSON(json, context) {
|
|
|
66
66
|
export function deductionFromJSON(json, context) {
|
|
67
67
|
let { deduction } = json;
|
|
68
68
|
|
|
69
|
-
const { Deduction } =
|
|
69
|
+
const { Deduction } = elements,
|
|
70
70
|
deductionJSON = deduction; ///
|
|
71
71
|
|
|
72
72
|
json = deductionJSON; ///
|
|
@@ -80,7 +80,7 @@ export function signatureFromJSON(json, context) {
|
|
|
80
80
|
let { signature = null } = json;
|
|
81
81
|
|
|
82
82
|
if (signature !== null) {
|
|
83
|
-
const { Signature } =
|
|
83
|
+
const { Signature } = elements,
|
|
84
84
|
signatureJSON = signature; ///
|
|
85
85
|
|
|
86
86
|
json = signatureJSON; ///
|
|
@@ -94,7 +94,7 @@ export function signatureFromJSON(json, context) {
|
|
|
94
94
|
export function referenceFromJSON(json, context) {
|
|
95
95
|
let { reference } = json;
|
|
96
96
|
|
|
97
|
-
const { Reference } =
|
|
97
|
+
const { Reference } = elements,
|
|
98
98
|
referenceJSON = reference; ///
|
|
99
99
|
|
|
100
100
|
json = referenceJSON; ///
|
|
@@ -107,7 +107,7 @@ export function referenceFromJSON(json, context) {
|
|
|
107
107
|
export function conclusionFromJSON(json, context) {
|
|
108
108
|
let { conclusion } = json;
|
|
109
109
|
|
|
110
|
-
const { Conclusion } =
|
|
110
|
+
const { Conclusion } = elements,
|
|
111
111
|
conclusionJSON = conclusion; ///
|
|
112
112
|
|
|
113
113
|
json = conclusionJSON; ///
|
|
@@ -120,7 +120,7 @@ export function conclusionFromJSON(json, context) {
|
|
|
120
120
|
export function metavariableFromJSON(json, context) {
|
|
121
121
|
let { metavariable } = json;
|
|
122
122
|
|
|
123
|
-
const { Metavariable } =
|
|
123
|
+
const { Metavariable } = elements,
|
|
124
124
|
metavariableJSON = metavariable; ///
|
|
125
125
|
|
|
126
126
|
json = metavariableJSON; ///
|
|
@@ -134,7 +134,7 @@ export function procedureCallFromJSON(json, context) {
|
|
|
134
134
|
let { procedureCall = null } = json;
|
|
135
135
|
|
|
136
136
|
if (procedureCall !== null) {
|
|
137
|
-
const { ProcedureCall } =
|
|
137
|
+
const { ProcedureCall } = elements,
|
|
138
138
|
procedureCallJSON = procedureCall; ///
|
|
139
139
|
|
|
140
140
|
json = procedureCallJSON; ///
|
|
@@ -148,7 +148,7 @@ export function procedureCallFromJSON(json, context) {
|
|
|
148
148
|
export function procedureReferenceFromJSON(json, context) {
|
|
149
149
|
let { procedureReference } = json;
|
|
150
150
|
|
|
151
|
-
const { ProcedureReference } =
|
|
151
|
+
const { ProcedureReference } = elements,
|
|
152
152
|
procedureReferenceJSON = procedureReference; ///
|
|
153
153
|
|
|
154
154
|
json = procedureReferenceJSON; ///
|
|
@@ -161,7 +161,7 @@ export function procedureReferenceFromJSON(json, context) {
|
|
|
161
161
|
export function typesFromJSON(json, types, context) {
|
|
162
162
|
const { types: typesJSON } = json;
|
|
163
163
|
|
|
164
|
-
const { Type } =
|
|
164
|
+
const { Type } = elements;
|
|
165
165
|
|
|
166
166
|
typesJSON.forEach((typeJSON) => {
|
|
167
167
|
const json = typeJSON, ///
|
|
@@ -174,7 +174,7 @@ export function typesFromJSON(json, types, context) {
|
|
|
174
174
|
export function termsFromJSON(json, context) {
|
|
175
175
|
let { terms } = json;
|
|
176
176
|
|
|
177
|
-
const { Term } =
|
|
177
|
+
const { Term } = elements,
|
|
178
178
|
termsJSON = terms; ///
|
|
179
179
|
|
|
180
180
|
terms = termsJSON.map((termJSON) => {
|
|
@@ -190,7 +190,7 @@ export function termsFromJSON(json, context) {
|
|
|
190
190
|
export function rulesFromJSON(json, context) {
|
|
191
191
|
let { rules } = json;
|
|
192
192
|
|
|
193
|
-
const { Rule } =
|
|
193
|
+
const { Rule } = elements,
|
|
194
194
|
rulesJSON = rules; ///
|
|
195
195
|
|
|
196
196
|
rules = rulesJSON.map((ruleJSON) => {
|
|
@@ -206,7 +206,7 @@ export function rulesFromJSON(json, context) {
|
|
|
206
206
|
export function labelFromJSON(json, context) {
|
|
207
207
|
let { label } = json;
|
|
208
208
|
|
|
209
|
-
const { Label } =
|
|
209
|
+
const { Label } = elements,
|
|
210
210
|
labelJSON = label; ///
|
|
211
211
|
|
|
212
212
|
json = labelJSON; ///
|
|
@@ -219,7 +219,7 @@ export function labelFromJSON(json, context) {
|
|
|
219
219
|
export function framesFromJSON(json, context) {
|
|
220
220
|
let { frames } = json;
|
|
221
221
|
|
|
222
|
-
const { Frame } =
|
|
222
|
+
const { Frame } = elements,
|
|
223
223
|
framesJSON = frames; ///
|
|
224
224
|
|
|
225
225
|
frames = framesJSON.map((frameJSON) => {
|
|
@@ -235,7 +235,7 @@ export function framesFromJSON(json, context) {
|
|
|
235
235
|
export function labelsFromJSON(json, context) {
|
|
236
236
|
let { labels } = json;
|
|
237
237
|
|
|
238
|
-
const { Label } =
|
|
238
|
+
const { Label } = elements,
|
|
239
239
|
labelsJSON = labels; ///
|
|
240
240
|
|
|
241
241
|
labels = labelsJSON.map((labelJSON) => {
|
|
@@ -251,7 +251,7 @@ export function labelsFromJSON(json, context) {
|
|
|
251
251
|
export function axiomsFromJSON(json, context) {
|
|
252
252
|
let { axioms } = json;
|
|
253
253
|
|
|
254
|
-
const { Axiom } =
|
|
254
|
+
const { Axiom } = elements,
|
|
255
255
|
axiomsJSON = axioms; ///
|
|
256
256
|
|
|
257
257
|
axioms = axiomsJSON.map((axiomJSON) => {
|
|
@@ -267,7 +267,7 @@ export function axiomsFromJSON(json, context) {
|
|
|
267
267
|
export function premisesFromJSON(json, context) {
|
|
268
268
|
let { premises } = json;
|
|
269
269
|
|
|
270
|
-
const { Premise } =
|
|
270
|
+
const { Premise } = elements,
|
|
271
271
|
premisesJSON = premises; ///
|
|
272
272
|
|
|
273
273
|
premises = premisesJSON.map((premiseJSON) => {
|
|
@@ -283,7 +283,7 @@ export function premisesFromJSON(json, context) {
|
|
|
283
283
|
export function theoremsFromJSON(json, context) {
|
|
284
284
|
let { theorems } = json;
|
|
285
285
|
|
|
286
|
-
const { Theorem } =
|
|
286
|
+
const { Theorem } = elements,
|
|
287
287
|
theoremsJSON = theorems; ///
|
|
288
288
|
|
|
289
289
|
theorems = theoremsJSON.map((theoremJSON) => {
|
|
@@ -299,7 +299,7 @@ export function theoremsFromJSON(json, context) {
|
|
|
299
299
|
export function variablesFromJSON(json, context) {
|
|
300
300
|
let { variables } = json;
|
|
301
301
|
|
|
302
|
-
const { Variable } =
|
|
302
|
+
const { Variable } = elements,
|
|
303
303
|
variablesJSON = variables; ///
|
|
304
304
|
|
|
305
305
|
variables = variablesJSON.map((variableJSON) => {
|
|
@@ -315,7 +315,7 @@ export function variablesFromJSON(json, context) {
|
|
|
315
315
|
export function propertiesFromJSON(json, context) {
|
|
316
316
|
let { properties } = json;
|
|
317
317
|
|
|
318
|
-
const { Property } =
|
|
318
|
+
const { Property } = elements,
|
|
319
319
|
propertiesJSON = properties; ///
|
|
320
320
|
|
|
321
321
|
properties = propertiesJSON.map((propertyJSON) => {
|
|
@@ -348,7 +348,7 @@ export function superTypesFromJSON(json, context) {
|
|
|
348
348
|
export function hypothesesFromJSON(json, context) {
|
|
349
349
|
let { hypotheses } = json;
|
|
350
350
|
|
|
351
|
-
const { Hypothesis } =
|
|
351
|
+
const { Hypothesis } = elements,
|
|
352
352
|
hypothesesJSON = hypotheses; ///
|
|
353
353
|
|
|
354
354
|
hypotheses = hypothesesJSON.map((hypothesisJSON) => {
|
|
@@ -364,7 +364,7 @@ export function hypothesesFromJSON(json, context) {
|
|
|
364
364
|
export function parametersFromJSON(json, context) {
|
|
365
365
|
let { parameters } = json;
|
|
366
366
|
|
|
367
|
-
const { Parameter } =
|
|
367
|
+
const { Parameter } = elements,
|
|
368
368
|
parametersJSON = parameters; ///
|
|
369
369
|
|
|
370
370
|
parameters = parametersJSON.map((parameterJSON) => {
|
|
@@ -380,7 +380,7 @@ export function parametersFromJSON(json, context) {
|
|
|
380
380
|
export function conjecturesFromJSON(json, context) {
|
|
381
381
|
let { conjectures } = json;
|
|
382
382
|
|
|
383
|
-
const { Conjecture } =
|
|
383
|
+
const { Conjecture } = elements,
|
|
384
384
|
conjecturesJSON = conjectures; ///
|
|
385
385
|
|
|
386
386
|
conjectures = conjecturesJSON.map((conjectureJSON) => {
|
|
@@ -396,7 +396,7 @@ export function conjecturesFromJSON(json, context) {
|
|
|
396
396
|
export function combinatorsFromJSON(json, context) {
|
|
397
397
|
let { combinators } = json;
|
|
398
398
|
|
|
399
|
-
const { Combinator } =
|
|
399
|
+
const { Combinator } = elements,
|
|
400
400
|
combinatorsJSON = combinators; ///
|
|
401
401
|
|
|
402
402
|
combinators = combinatorsJSON.map((combinatorJSON) => {
|
|
@@ -412,7 +412,7 @@ export function combinatorsFromJSON(json, context) {
|
|
|
412
412
|
export function typePrefixesFromJSON(json, context) {
|
|
413
413
|
let { typePrefixes } = json;
|
|
414
414
|
|
|
415
|
-
const { TypePrefix } =
|
|
415
|
+
const { TypePrefix } = elements,
|
|
416
416
|
typePrefixesJSON = typePrefixes; ///
|
|
417
417
|
|
|
418
418
|
typePrefixes = typePrefixesJSON.map((typePrefixJSON) => {
|
|
@@ -428,7 +428,7 @@ export function typePrefixesFromJSON(json, context) {
|
|
|
428
428
|
export function constructorsFromJSON(json, context) {
|
|
429
429
|
let { constructors } = json;
|
|
430
430
|
|
|
431
|
-
const { Constructor } =
|
|
431
|
+
const { Constructor } = elements,
|
|
432
432
|
constructorsJSON = constructors; ///
|
|
433
433
|
|
|
434
434
|
constructors = constructorsJSON.map((constructorJSON) => {
|
|
@@ -444,7 +444,7 @@ export function constructorsFromJSON(json, context) {
|
|
|
444
444
|
export function metatheoremsFromJSON(json, context) {
|
|
445
445
|
let { metatheorems } = json;
|
|
446
446
|
|
|
447
|
-
const { Metatheorem } =
|
|
447
|
+
const { Metatheorem } = elements,
|
|
448
448
|
metatheoremsJSON = metatheorems; ///
|
|
449
449
|
|
|
450
450
|
metatheorems = metatheoremsJSON.map((metatheoremJSON) => {
|
|
@@ -460,7 +460,7 @@ export function metatheoremsFromJSON(json, context) {
|
|
|
460
460
|
export function suppositionsFromJSON(json, context) {
|
|
461
461
|
let { suppositions } = json;
|
|
462
462
|
|
|
463
|
-
const { Supposition } =
|
|
463
|
+
const { Supposition } = elements,
|
|
464
464
|
suppositionsJSON = suppositions; ///
|
|
465
465
|
|
|
466
466
|
suppositions = suppositionsJSON.map((suppositionJSON) => {
|
|
@@ -476,7 +476,7 @@ export function suppositionsFromJSON(json, context) {
|
|
|
476
476
|
export function substitutionsFromJSON(json, context) {
|
|
477
477
|
let { substitutions = [] } = json; ///
|
|
478
478
|
|
|
479
|
-
const { StatementSubstitution } =
|
|
479
|
+
const { StatementSubstitution } = elements,
|
|
480
480
|
substitutionsJSON = substitutions, ///
|
|
481
481
|
Substitution = StatementSubstitution; ///
|
|
482
482
|
|
|
@@ -493,7 +493,7 @@ export function substitutionsFromJSON(json, context) {
|
|
|
493
493
|
export function metavariablesFromJSON(json, context) {
|
|
494
494
|
let { metavariables } = json;
|
|
495
495
|
|
|
496
|
-
const { Metavariable } =
|
|
496
|
+
const { Metavariable } = elements,
|
|
497
497
|
metavariablesJSON = metavariables; ///
|
|
498
498
|
|
|
499
499
|
metavariables = metavariablesJSON.map((metavariableJSON) => {
|
package/src/utilities/node.js
CHANGED
|
@@ -1,93 +1,85 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { EMPTY_STRING } from "../constants";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
export function nodeAsString(node, tokens) {
|
|
6
|
+
let string;
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
let type;
|
|
8
|
+
tokens = nodeAsTokens(node, tokens); ///
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const { Type } = ontology,
|
|
14
|
-
typeName = typeNode.getTypeName(),
|
|
15
|
-
typePrefixName = typeNode.getTypePrefixName(),
|
|
16
|
-
nominalTypeName = typeNode.getNominalTypeName(),
|
|
17
|
-
string = nominalTypeName, ///
|
|
18
|
-
name = typeName, ///
|
|
19
|
-
prefixName = typePrefixName, ///
|
|
20
|
-
superTypes = null,
|
|
21
|
-
properties = null,
|
|
22
|
-
provisional = null;
|
|
23
|
-
|
|
24
|
-
type = new Type(string, name, prefixName, superTypes, properties, provisional);
|
|
25
|
-
}
|
|
10
|
+
string = tokensAsString(tokens);
|
|
11
|
+
|
|
12
|
+
string = trimString(string); ///
|
|
26
13
|
|
|
27
|
-
return
|
|
14
|
+
return string;
|
|
28
15
|
}
|
|
29
16
|
|
|
30
|
-
export function
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
string = context.nodeAsString(node),
|
|
34
|
-
type = null,
|
|
35
|
-
term = new Term(string, node, type);
|
|
17
|
+
export function nodesAsString(nodes, tokens) {
|
|
18
|
+
const string = nodes.reduce((string, node) => {
|
|
19
|
+
const nodeString = nodeAsString(node, tokens);
|
|
36
20
|
|
|
37
|
-
|
|
38
|
-
|
|
21
|
+
string = (string === null) ?
|
|
22
|
+
nodeString :
|
|
23
|
+
`${string}, ${nodeString}`;
|
|
39
24
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
node = statementNode, ///
|
|
43
|
-
tokens = context.nodeAsTokens(node),
|
|
44
|
-
string = context.tokensAsString(tokens),
|
|
45
|
-
statement = new Statement(string, node, tokens);
|
|
25
|
+
return string;
|
|
26
|
+
}, null);
|
|
46
27
|
|
|
47
|
-
return
|
|
28
|
+
return string;
|
|
48
29
|
}
|
|
49
30
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const term = termFromTermNode(termNode, context);
|
|
53
|
-
|
|
54
|
-
return term;
|
|
55
|
-
});
|
|
31
|
+
function trimString(string) {
|
|
32
|
+
string = string.replace(/\s+$/, EMPTY_STRING); ///
|
|
56
33
|
|
|
57
|
-
return
|
|
34
|
+
return string;
|
|
58
35
|
}
|
|
59
36
|
|
|
60
|
-
|
|
61
|
-
|
|
37
|
+
function tokensAsString(tokens) {
|
|
38
|
+
const string = tokens.reduce((string, token) => {
|
|
39
|
+
const content = token.getContent();
|
|
62
40
|
|
|
63
|
-
|
|
64
|
-
singularVariableNode = termNode.getSingularVariableNode();
|
|
41
|
+
string = `${string}${content}`;
|
|
65
42
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
variableNode = singularVariableNode; ///
|
|
43
|
+
return string;
|
|
44
|
+
}, EMPTY_STRING);
|
|
69
45
|
|
|
70
|
-
|
|
46
|
+
return string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function nodeAsTokens(node, tokens) {
|
|
50
|
+
const nodeTerminalNode = node.isTerminalNode();
|
|
71
51
|
|
|
72
|
-
|
|
52
|
+
if (nodeTerminalNode) {
|
|
53
|
+
const terminalNode = node; ///
|
|
54
|
+
|
|
55
|
+
tokens = terminalNodeAsTokens(terminalNode, tokens);
|
|
56
|
+
} else {
|
|
57
|
+
const nonTerminalNode = node; ///
|
|
73
58
|
|
|
74
|
-
|
|
59
|
+
tokens = nonTerminalNodeAsTokens(nonTerminalNode, tokens);
|
|
75
60
|
}
|
|
76
61
|
|
|
77
|
-
return
|
|
62
|
+
return tokens;
|
|
78
63
|
}
|
|
79
64
|
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
|
|
65
|
+
function terminalNodeAsTokens(terminalNode, tokens) {
|
|
66
|
+
const significantToken = terminalNode.getSignificantToken(),
|
|
67
|
+
token = significantToken; ///
|
|
83
68
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
69
|
+
tokens = [ ///
|
|
70
|
+
token
|
|
71
|
+
];
|
|
87
72
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
string = `[${termsString}]`;
|
|
73
|
+
return tokens;
|
|
74
|
+
}
|
|
91
75
|
|
|
92
|
-
|
|
76
|
+
function nonTerminalNodeAsTokens(nonTerminalNode, tokens) {
|
|
77
|
+
const lastSignificantTokenIndex = nonTerminalNode.getLastSignificantTokenIndex(tokens),
|
|
78
|
+
firstSignificantTokenIndex = nonTerminalNode.getFirstSignificantTokenIndex(tokens),
|
|
79
|
+
start = firstSignificantTokenIndex, ///
|
|
80
|
+
end = lastSignificantTokenIndex + 1;
|
|
81
|
+
|
|
82
|
+
tokens = tokens.slice(start, end); ///
|
|
83
|
+
|
|
84
|
+
return tokens;
|
|
93
85
|
}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import TemporaryContext from "../context/temporary";
|
|
3
|
+
import elements from "../elements";
|
|
5
4
|
|
|
6
5
|
export function equalityFromStatement(statement, context) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const { Equality } = ontology,
|
|
6
|
+
const { Equality } = elements,
|
|
10
7
|
statementNode = statement.getNode(),
|
|
11
8
|
equality = Equality.fromStatementNode(statementNode, context);
|
|
12
9
|
|
|
@@ -14,9 +11,7 @@ export function equalityFromStatement(statement, context) {
|
|
|
14
11
|
}
|
|
15
12
|
|
|
16
13
|
export function judgementFromStatement(statement, context) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const { Judgement } = ontology,
|
|
14
|
+
const { Judgement } = elements,
|
|
20
15
|
statementNode = statement.getNode(),
|
|
21
16
|
judgement = Judgement.fromStatementNode(statementNode, context);
|
|
22
17
|
|
|
@@ -24,9 +19,7 @@ export function judgementFromStatement(statement, context) {
|
|
|
24
19
|
}
|
|
25
20
|
|
|
26
21
|
export function metavariableFromStatement(statement, context) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const { Metavariable } = ontology,
|
|
22
|
+
const { Metavariable } = elements,
|
|
30
23
|
statementNode = statement.getNode(),
|
|
31
24
|
metavariable = Metavariable.fromStatementNode(statementNode, context);
|
|
32
25
|
|
|
@@ -34,9 +27,7 @@ export function metavariableFromStatement(statement, context) {
|
|
|
34
27
|
}
|
|
35
28
|
|
|
36
29
|
export function typeAssertionFromStatement(statement, context) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const { TypeAssertion } = ontology,
|
|
30
|
+
const { TypeAssertion } = elements,
|
|
40
31
|
statementNode = statement.getNode(),
|
|
41
32
|
typeAssertion = TypeAssertion.fromStatementNode(statementNode, context);
|
|
42
33
|
|
|
@@ -44,9 +35,7 @@ export function typeAssertionFromStatement(statement, context) {
|
|
|
44
35
|
}
|
|
45
36
|
|
|
46
37
|
export function definedAssertionFromStatement(statement, context) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const { DefinedAssertion } = ontology,
|
|
38
|
+
const { DefinedAssertion } = elements,
|
|
50
39
|
statementNode = statement.getNode(),
|
|
51
40
|
definedAssertion = DefinedAssertion.fromStatementNode(statementNode, context);
|
|
52
41
|
|
|
@@ -54,9 +43,7 @@ export function definedAssertionFromStatement(statement, context) {
|
|
|
54
43
|
}
|
|
55
44
|
|
|
56
45
|
export function propertyAssertionFromStatement(statement, context) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const { PropertyAssertion } = ontology,
|
|
46
|
+
const { PropertyAssertion } = elements,
|
|
60
47
|
statementNode = statement.getNode(),
|
|
61
48
|
propertyAssertion = PropertyAssertion.fromStatementNode(statementNode, context);
|
|
62
49
|
|
|
@@ -64,9 +51,7 @@ export function propertyAssertionFromStatement(statement, context) {
|
|
|
64
51
|
}
|
|
65
52
|
|
|
66
53
|
export function subproofAssertionFromStatement(statement, context) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const { SubproofAssertion } = ontology,
|
|
54
|
+
const { SubproofAssertion } = elements,
|
|
70
55
|
statementNode = statement.getNode(),
|
|
71
56
|
subproofAssertion = SubproofAssertion.fromStatementNode(statementNode, context);
|
|
72
57
|
|
|
@@ -74,9 +59,7 @@ export function subproofAssertionFromStatement(statement, context) {
|
|
|
74
59
|
}
|
|
75
60
|
|
|
76
61
|
export function containedAssertionFromStatement(statement, context) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const { ContainedAssertion } = ontology,
|
|
62
|
+
const { ContainedAssertion } = elements,
|
|
80
63
|
statementNode = statement.getNode(),
|
|
81
64
|
containedAssertion = ContainedAssertion.fromStatementNode(statementNode, context);
|
|
82
65
|
|
|
@@ -84,21 +67,9 @@ export function containedAssertionFromStatement(statement, context) {
|
|
|
84
67
|
}
|
|
85
68
|
|
|
86
69
|
export function satisfiesAssertionFromStatement(statement, context) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const { SatisfiesAssertion } = ontology,
|
|
70
|
+
const { SatisfiesAssertion } = elements,
|
|
90
71
|
statementNode = statement.getNode(),
|
|
91
72
|
satisfiesAssertion = SatisfiesAssertion.fromStatementNode(statementNode, context);
|
|
92
73
|
|
|
93
74
|
return satisfiesAssertion;
|
|
94
75
|
}
|
|
95
|
-
|
|
96
|
-
export function contextFromStatement(statement, context) {
|
|
97
|
-
const statementTokens = statement.getTokens(),
|
|
98
|
-
tokens = statementTokens, ///
|
|
99
|
-
temporaryContext = TemporaryContext.fromContextAndTokens(context, tokens);
|
|
100
|
-
|
|
101
|
-
context = temporaryContext; ///
|
|
102
|
-
|
|
103
|
-
return context;
|
|
104
|
-
}
|