occam-verify-cli 1.0.421 → 1.0.428

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.
Files changed (278) hide show
  1. package/lib/action/verify.js +7 -3
  2. package/lib/context/file.js +8 -44
  3. package/lib/context/local.js +8 -26
  4. package/lib/context/nominal.js +64 -0
  5. package/lib/context/release.js +2 -2
  6. package/lib/context/temporary.js +6 -58
  7. package/lib/element/assertion/contained.js +303 -0
  8. package/lib/element/assertion/defined.js +318 -0
  9. package/lib/element/assertion/property.js +299 -0
  10. package/lib/element/assertion/satisfies.js +264 -0
  11. package/lib/element/assertion/subproof.js +178 -0
  12. package/lib/element/assertion/type.js +294 -0
  13. package/lib/{ontology → element}/assertion.js +9 -9
  14. package/lib/element/assumption.js +365 -0
  15. package/lib/element/axiom.js +332 -0
  16. package/lib/element/axiomLemmaTheoremConjecture.js +346 -0
  17. package/lib/element/conclusion.js +151 -0
  18. package/lib/{ontology → element}/conjecture.js +7 -14
  19. package/lib/element/declaration/combinator.js +161 -0
  20. package/lib/element/declaration/complexType.js +343 -0
  21. package/lib/element/declaration/constructor.js +193 -0
  22. package/lib/element/declaration/metavariable.js +193 -0
  23. package/lib/element/declaration/simpleType.js +240 -0
  24. package/lib/element/declaration/typePrefix.js +179 -0
  25. package/lib/element/declaration/variable.js +196 -0
  26. package/lib/{ontology → element}/declaration.js +9 -9
  27. package/lib/element/deduction.js +207 -0
  28. package/lib/element/derivation.js +96 -0
  29. package/lib/element/equality.js +275 -0
  30. package/lib/element/equivalence.js +312 -0
  31. package/lib/element/equivalences.js +264 -0
  32. package/lib/{ontology → element}/error.js +12 -12
  33. package/lib/element/frame.js +387 -0
  34. package/lib/element/hypothesis.js +195 -0
  35. package/lib/element/judgement.js +243 -0
  36. package/lib/element/label.js +198 -0
  37. package/lib/{ontology → element}/lemma.js +7 -7
  38. package/lib/{ontology → element}/metaLemma.js +8 -8
  39. package/lib/element/metaLemmaMetatheorem.js +234 -0
  40. package/lib/{ontology → element}/metaType.js +18 -11
  41. package/lib/{ontology → element}/metatheorem.js +8 -8
  42. package/lib/element/metavariable.js +459 -0
  43. package/lib/element/parameter.js +108 -0
  44. package/lib/element/premise.js +310 -0
  45. package/lib/element/procedureCall.js +243 -0
  46. package/lib/{ontology → element}/procedureReference.js +3 -3
  47. package/lib/{ontology → element}/proof.js +4 -4
  48. package/lib/element/property.js +128 -0
  49. package/lib/element/propertyRelation.js +195 -0
  50. package/lib/element/reference.js +304 -0
  51. package/lib/element/rule.js +373 -0
  52. package/lib/element/section.js +255 -0
  53. package/lib/element/signature.js +217 -0
  54. package/lib/element/statement/combinator/bracketed.js +166 -0
  55. package/lib/element/statement/combinator.js +105 -0
  56. package/lib/element/statement.js +386 -0
  57. package/lib/element/step.js +274 -0
  58. package/lib/element/subDerivation.js +137 -0
  59. package/lib/element/subproof.js +240 -0
  60. package/lib/element/substitution/frame.js +216 -0
  61. package/lib/{ontology → element}/substitution/reference.js +5 -4
  62. package/lib/{ontology → element}/substitution/statement.js +7 -6
  63. package/lib/element/substitution/term.js +265 -0
  64. package/lib/element/substitution.js +206 -0
  65. package/lib/element/substitutions.js +425 -0
  66. package/lib/element/supposition.js +323 -0
  67. package/lib/{ontology → element/term}/constructor/bracketed.js +11 -7
  68. package/lib/element/term/constructor.js +172 -0
  69. package/lib/element/term.js +322 -0
  70. package/lib/{ontology → element}/theorem.js +8 -8
  71. package/lib/element/type.js +490 -0
  72. package/lib/element/typePrefix.js +99 -0
  73. package/lib/element/variable.js +345 -0
  74. package/lib/elements.js +27 -0
  75. package/lib/mixins/statement/verify.js +14 -14
  76. package/lib/mixins/step/unify.js +12 -12
  77. package/lib/mixins/term/verify.js +4 -4
  78. package/lib/node/equivalence.js +116 -0
  79. package/lib/node/substitution/frame.js +15 -1
  80. package/lib/node/substitution/statement.js +37 -1
  81. package/lib/node/substitution/term.js +15 -1
  82. package/lib/nonTerminalNodeMap.js +4 -3
  83. package/lib/preamble.js +63 -63
  84. package/lib/process/assign.js +58 -0
  85. package/lib/process/instantiate.js +74 -7
  86. package/lib/process/unify.js +26 -26
  87. package/lib/process/verify.js +21 -21
  88. package/lib/ruleNames.js +5 -1
  89. package/lib/utilities/brackets.js +9 -18
  90. package/lib/utilities/customGrammar.js +1 -1
  91. package/lib/utilities/element.js +1141 -0
  92. package/lib/utilities/json.js +32 -32
  93. package/lib/utilities/node.js +49 -61
  94. package/lib/utilities/statement.js +83 -0
  95. package/lib/utilities/string.js +80 -57
  96. package/package.json +6 -6
  97. package/src/action/verify.js +8 -1
  98. package/src/context/file.js +9 -39
  99. package/src/context/local.js +5 -11
  100. package/src/context/nominal.js +30 -0
  101. package/src/context/release.js +1 -1
  102. package/src/context/temporary.js +6 -63
  103. package/src/{ontology → element}/assertion/contained.js +4 -25
  104. package/src/{ontology → element}/assertion/defined.js +7 -26
  105. package/src/{ontology → element}/assertion/property.js +7 -26
  106. package/src/{ontology → element}/assertion/satisfies.js +5 -53
  107. package/src/{ontology → element}/assertion/subproof.js +3 -32
  108. package/src/{ontology → element}/assertion/type.js +7 -26
  109. package/src/{ontology → element}/assertion.js +6 -6
  110. package/src/{ontology → element}/assumption.js +3 -27
  111. package/src/{ontology → element}/axiom.js +4 -11
  112. package/src/{ontology/topLevelAssertion.js → element/axiomLemmaTheoremConjecture.js} +9 -105
  113. package/src/{ontology → element}/conclusion.js +4 -19
  114. package/src/{ontology → element}/conjecture.js +4 -11
  115. package/src/{ontology → element}/declaration/combinator.js +3 -14
  116. package/src/{ontology → element}/declaration/complexType.js +3 -19
  117. package/src/{ontology → element}/declaration/constructor.js +3 -14
  118. package/src/{ontology → element}/declaration/metavariable.js +3 -39
  119. package/src/{ontology → element}/declaration/simpleType.js +3 -19
  120. package/src/{ontology → element}/declaration/typePrefix.js +3 -15
  121. package/src/{ontology → element}/declaration/variable.js +3 -14
  122. package/src/{ontology → element}/declaration.js +6 -6
  123. package/src/{ontology → element}/deduction.js +9 -22
  124. package/src/{ontology → element}/derivation.js +2 -32
  125. package/src/{ontology → element}/equality.js +18 -42
  126. package/src/{ontology → element}/equivalence.js +37 -22
  127. package/src/{ontology → element}/equivalences.js +1 -2
  128. package/src/{ontology → element}/error.js +8 -8
  129. package/src/{ontology → element}/frame.js +8 -56
  130. package/src/{ontology → element}/hypothesis.js +5 -5
  131. package/src/{ontology → element}/judgement.js +7 -7
  132. package/src/{ontology → element}/label.js +3 -3
  133. package/src/{ontology → element}/lemma.js +4 -4
  134. package/src/{ontology → element}/metaLemma.js +5 -5
  135. package/src/{ontology/topLevelMetaAssertion.js → element/metaLemmaMetatheorem.js} +11 -11
  136. package/src/{ontology → element}/metaType.js +11 -7
  137. package/src/{ontology → element}/metatheorem.js +5 -5
  138. package/src/{ontology → element}/metavariable.js +10 -60
  139. package/src/{ontology → element}/parameter.js +1 -1
  140. package/src/{ontology → element}/premise.js +14 -14
  141. package/src/{ontology → element}/procedureCall.js +4 -4
  142. package/src/{ontology → element}/procedureReference.js +1 -1
  143. package/src/{ontology → element}/proof.js +3 -3
  144. package/src/{ontology → element}/property.js +7 -15
  145. package/src/{ontology → element}/propertyRelation.js +5 -11
  146. package/src/{ontology → element}/reference.js +5 -19
  147. package/src/{ontology → element}/rule.js +13 -13
  148. package/src/{ontology → element}/section.js +10 -10
  149. package/src/{ontology → element}/signature.js +12 -15
  150. package/src/element/statement/combinator/bracketed.js +38 -0
  151. package/src/element/statement/combinator.js +59 -0
  152. package/src/{ontology → element}/statement.js +11 -27
  153. package/src/{ontology → element}/step.js +10 -44
  154. package/src/{ontology → element}/subDerivation.js +3 -24
  155. package/src/{ontology → element}/subproof.js +3 -43
  156. package/src/{ontology → element}/substitution/frame.js +4 -21
  157. package/src/{ontology → element}/substitution/reference.js +3 -3
  158. package/src/{ontology → element}/substitution/statement.js +6 -10
  159. package/src/{ontology → element}/substitution/term.js +7 -23
  160. package/src/{ontology → element}/substitutions.js +1 -1
  161. package/src/{ontology → element}/supposition.js +10 -10
  162. package/src/{ontology → element/term}/constructor/bracketed.js +12 -13
  163. package/src/element/term/constructor.js +82 -0
  164. package/src/{ontology → element}/term.js +6 -38
  165. package/src/{ontology → element}/theorem.js +5 -5
  166. package/src/{ontology → element}/type.js +17 -64
  167. package/src/{ontology → element}/typePrefix.js +8 -12
  168. package/src/{ontology → element}/variable.js +9 -20
  169. package/src/elements.js +13 -0
  170. package/src/mixins/statement/verify.js +4 -4
  171. package/src/mixins/step/unify.js +6 -6
  172. package/src/mixins/term/verify.js +3 -3
  173. package/src/node/equivalence.js +16 -0
  174. package/src/node/substitution/frame.js +14 -0
  175. package/src/node/substitution/statement.js +40 -0
  176. package/src/node/substitution/term.js +15 -0
  177. package/src/nonTerminalNodeMap.js +4 -1
  178. package/src/preamble.js +62 -62
  179. package/src/process/assign.js +59 -0
  180. package/src/process/instantiate.js +71 -15
  181. package/src/process/unify.js +37 -39
  182. package/src/process/verify.js +20 -20
  183. package/src/ruleNames.js +1 -0
  184. package/src/utilities/brackets.js +12 -17
  185. package/src/utilities/customGrammar.js +3 -3
  186. package/src/utilities/element.js +1399 -0
  187. package/src/utilities/json.js +31 -31
  188. package/src/utilities/node.js +56 -64
  189. package/src/utilities/{context.js → statement.js} +10 -39
  190. package/src/utilities/string.js +83 -53
  191. package/lib/assignment/equality.js +0 -62
  192. package/lib/assignment/judgement.js +0 -62
  193. package/lib/assignment/variable.js +0 -64
  194. package/lib/context/bracketed/combinator.js +0 -121
  195. package/lib/context/bracketed/constructor.js +0 -121
  196. package/lib/context/bracketted.js +0 -86
  197. package/lib/context/partial/metavariable.js +0 -180
  198. package/lib/context/partial/statement.js +0 -180
  199. package/lib/context/partial/term.js +0 -192
  200. package/lib/context/partial/variable.js +0 -192
  201. package/lib/context/partial.js +0 -93
  202. package/lib/ontology/assertion/contained.js +0 -357
  203. package/lib/ontology/assertion/defined.js +0 -331
  204. package/lib/ontology/assertion/property.js +0 -313
  205. package/lib/ontology/assertion/satisfies.js +0 -302
  206. package/lib/ontology/assertion/subproof.js +0 -240
  207. package/lib/ontology/assertion/type.js +0 -308
  208. package/lib/ontology/assumption.js +0 -383
  209. package/lib/ontology/axiom.js +0 -339
  210. package/lib/ontology/combinator/bracketed.js +0 -202
  211. package/lib/ontology/combinator.js +0 -155
  212. package/lib/ontology/conclusion.js +0 -201
  213. package/lib/ontology/constructor.js +0 -185
  214. package/lib/ontology/declaration/combinator.js +0 -210
  215. package/lib/ontology/declaration/complexType.js +0 -393
  216. package/lib/ontology/declaration/constructor.js +0 -242
  217. package/lib/ontology/declaration/metavariable.js +0 -257
  218. package/lib/ontology/declaration/simpleType.js +0 -290
  219. package/lib/ontology/declaration/typePrefix.js +0 -228
  220. package/lib/ontology/declaration/variable.js +0 -245
  221. package/lib/ontology/deduction.js +0 -215
  222. package/lib/ontology/derivation.js +0 -155
  223. package/lib/ontology/equality.js +0 -288
  224. package/lib/ontology/equivalence.js +0 -295
  225. package/lib/ontology/equivalences.js +0 -264
  226. package/lib/ontology/frame.js +0 -419
  227. package/lib/ontology/hypothesis.js +0 -190
  228. package/lib/ontology/judgement.js +0 -248
  229. package/lib/ontology/label.js +0 -198
  230. package/lib/ontology/metavariable.js +0 -502
  231. package/lib/ontology/parameter.js +0 -108
  232. package/lib/ontology/premise.js +0 -310
  233. package/lib/ontology/procedureCall.js +0 -243
  234. package/lib/ontology/property.js +0 -166
  235. package/lib/ontology/propertyRelation.js +0 -202
  236. package/lib/ontology/reference.js +0 -315
  237. package/lib/ontology/rule.js +0 -373
  238. package/lib/ontology/section.js +0 -255
  239. package/lib/ontology/signature.js +0 -217
  240. package/lib/ontology/statement.js +0 -398
  241. package/lib/ontology/step.js +0 -295
  242. package/lib/ontology/subDerivation.js +0 -147
  243. package/lib/ontology/subproof.js +0 -265
  244. package/lib/ontology/substitution/frame.js +0 -261
  245. package/lib/ontology/substitution/term.js +0 -269
  246. package/lib/ontology/substitution.js +0 -206
  247. package/lib/ontology/substitutions.js +0 -425
  248. package/lib/ontology/supposition.js +0 -323
  249. package/lib/ontology/term.js +0 -351
  250. package/lib/ontology/topLevelAssertion.js +0 -431
  251. package/lib/ontology/topLevelMetaAssertion.js +0 -234
  252. package/lib/ontology/type.js +0 -556
  253. package/lib/ontology/typePrefix.js +0 -99
  254. package/lib/ontology/variable.js +0 -343
  255. package/lib/ontology.js +0 -27
  256. package/lib/utilities/assignments.js +0 -19
  257. package/lib/utilities/context.js +0 -101
  258. package/lib/utilities/subproof.js +0 -42
  259. package/lib/utilities/type.js +0 -40
  260. package/src/assignment/equality.js +0 -29
  261. package/src/assignment/judgement.js +0 -29
  262. package/src/assignment/variable.js +0 -34
  263. package/src/context/bracketed/combinator.js +0 -31
  264. package/src/context/bracketed/constructor.js +0 -31
  265. package/src/context/bracketted.js +0 -41
  266. package/src/context/partial/metavariable.js +0 -39
  267. package/src/context/partial/statement.js +0 -39
  268. package/src/context/partial/term.js +0 -49
  269. package/src/context/partial/variable.js +0 -49
  270. package/src/context/partial.js +0 -71
  271. package/src/ontology/combinator/bracketed.js +0 -38
  272. package/src/ontology/combinator.js +0 -72
  273. package/src/ontology/constructor.js +0 -105
  274. package/src/ontology.js +0 -13
  275. package/src/utilities/assignments.js +0 -11
  276. package/src/utilities/subproof.js +0 -56
  277. package/src/utilities/type.js +0 -35
  278. /package/src/{ontology → element}/substitution.js +0 -0
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import ontology from "../ontology";
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 } = ontology;
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology;
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
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 } = ontology,
496
+ const { Metavariable } = elements,
497
497
  metavariablesJSON = metavariables; ///
498
498
 
499
499
  metavariables = metavariablesJSON.map((metavariableJSON) => {
@@ -1,93 +1,85 @@
1
1
  "use strict";
2
2
 
3
- import ontology from "../ontology";
3
+ import { EMPTY_STRING } from "../constants";
4
4
 
5
- import { baseType } from "../ontology/type";
5
+ export function nodeAsString(node, tokens) {
6
+ let string;
6
7
 
7
- export function typeFromTypeNode(typeNode, context) {
8
- let type;
8
+ tokens = nodeAsTokens(node, tokens); ///
9
9
 
10
- if (typeNode === null) {
11
- type = baseType;
12
- } else {
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 type;
14
+ return string;
28
15
  }
29
16
 
30
- export function termFromTermNode(termNode, context) {
31
- const { Term } = ontology,
32
- node = termNode, ///
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
- return term;
38
- }
21
+ string = (string === null) ?
22
+ nodeString :
23
+ `${string}, ${nodeString}`;
39
24
 
40
- export function statementFromStatementNode(statementNode, context) {
41
- const { Statement } = ontology,
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 statement;
28
+ return string;
48
29
  }
49
30
 
50
- export function termsFromTermNodes(termNodes, context) {
51
- const terms = termNodes.map((termNode) => {
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 terms;
34
+ return string;
58
35
  }
59
36
 
60
- export function variableFromTerm(term, context) {
61
- let variable = null;
37
+ function tokensAsString(tokens) {
38
+ const string = tokens.reduce((string, token) => {
39
+ const content = token.getContent();
62
40
 
63
- const termNode = term.getNode(),
64
- singularVariableNode = termNode.getSingularVariableNode();
41
+ string = `${string}${content}`;
65
42
 
66
- if (singularVariableNode !== null) {
67
- const { Variable } = ontology,
68
- variableNode = singularVariableNode; ///
43
+ return string;
44
+ }, EMPTY_STRING);
69
45
 
70
- variable = Variable.fromVariableNode(variableNode, context);
46
+ return string;
47
+ }
48
+
49
+ function nodeAsTokens(node, tokens) {
50
+ const nodeTerminalNode = node.isTerminalNode();
71
51
 
72
- const type = term.getType();
52
+ if (nodeTerminalNode) {
53
+ const terminalNode = node; ///
54
+
55
+ tokens = terminalNodeAsTokens(terminalNode, tokens);
56
+ } else {
57
+ const nonTerminalNode = node; ///
73
58
 
74
- variable.setType(type);
59
+ tokens = nonTerminalNodeAsTokens(nonTerminalNode, tokens);
75
60
  }
76
61
 
77
- return variable;
62
+ return tokens;
78
63
  }
79
64
 
80
- export function stringFromTerms(terms) {
81
- const termsString = terms.reduce((termsString, term) => {
82
- const termString = term.getString();
65
+ function terminalNodeAsTokens(terminalNode, tokens) {
66
+ const significantToken = terminalNode.getSignificantToken(),
67
+ token = significantToken; ///
83
68
 
84
- termsString = (termsString !== null) ?
85
- `${termsString}, ${termString}` :
86
- termString;
69
+ tokens = [ ///
70
+ token
71
+ ];
87
72
 
88
- return termsString;
89
- }, null),
90
- string = `[${termsString}]`;
73
+ return tokens;
74
+ }
91
75
 
92
- return string;
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 ontology from "../ontology";
4
- import TemporaryContext from "../context/temporary";
3
+ import elements from "../elements";
5
4
 
6
5
  export function equalityFromStatement(statement, context) {
7
- context = contextFromStatement(statement, context); ///
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
- context = contextFromStatement(statement, context); ///
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
- context = contextFromStatement(statement, context); ///
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
- context = contextFromStatement(statement, context); ///
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
- context = contextFromStatement(statement, context); ///
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
- context = contextFromStatement(statement, context); ///
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
- context = contextFromStatement(statement, context); ///
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
- context = contextFromStatement(statement, context); ///
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
- context = contextFromStatement(statement, context); ///
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
- }