occam-verify-cli 1.0.983 → 1.0.985

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 (423) hide show
  1. package/lib/action/verify.js +22 -27
  2. package/lib/constants.js +1 -41
  3. package/lib/index.js +1 -2
  4. package/lib/utilities/fileContext.js +3 -8
  5. package/lib/utilities/releaseContext.js +2 -2
  6. package/package.json +10 -11
  7. package/src/action/verify.js +8 -18
  8. package/src/constants.js +0 -10
  9. package/src/index.js +0 -2
  10. package/src/utilities/fileContext.js +1 -2
  11. package/src/utilities/releaseContext.js +1 -1
  12. package/lib/context/aphasic.js +0 -27
  13. package/lib/context/bounded.js +0 -244
  14. package/lib/context/branching.js +0 -61
  15. package/lib/context/file/nominal.js +0 -586
  16. package/lib/context/illative.js +0 -28
  17. package/lib/context/liminal.js +0 -200
  18. package/lib/context/literal.js +0 -44
  19. package/lib/context/mnemic.js +0 -454
  20. package/lib/context/nested.js +0 -31
  21. package/lib/context/nominal.js +0 -57
  22. package/lib/context/phaneric.js +0 -44
  23. package/lib/context/thetic.js +0 -28
  24. package/lib/context.js +0 -445
  25. package/lib/element/assertion/contained.js +0 -218
  26. package/lib/element/assertion/defined.js +0 -213
  27. package/lib/element/assertion/property.js +0 -176
  28. package/lib/element/assertion/signature.js +0 -170
  29. package/lib/element/assertion/subproof.js +0 -220
  30. package/lib/element/assertion/type.js +0 -227
  31. package/lib/element/assertion.js +0 -49
  32. package/lib/element/assumption/metaLevel.js +0 -244
  33. package/lib/element/assumption.js +0 -252
  34. package/lib/element/combinator/bracketed.js +0 -36
  35. package/lib/element/combinator.js +0 -104
  36. package/lib/element/conclusion.js +0 -131
  37. package/lib/element/constructor/bracketed.js +0 -57
  38. package/lib/element/constructor.js +0 -129
  39. package/lib/element/declaration/combinator.js +0 -58
  40. package/lib/element/declaration/complexType.js +0 -180
  41. package/lib/element/declaration/constructor.js +0 -93
  42. package/lib/element/declaration/metavariable.js +0 -77
  43. package/lib/element/declaration/property.js +0 -88
  44. package/lib/element/declaration/simpleType.js +0 -148
  45. package/lib/element/declaration/typePrefix.js +0 -53
  46. package/lib/element/declaration/variable.js +0 -99
  47. package/lib/element/declaration.js +0 -15
  48. package/lib/element/deduction.js +0 -131
  49. package/lib/element/derivation.js +0 -46
  50. package/lib/element/equality.js +0 -211
  51. package/lib/element/equivalence.js +0 -200
  52. package/lib/element/error.js +0 -27
  53. package/lib/element/frame.js +0 -238
  54. package/lib/element/hypothesis.js +0 -135
  55. package/lib/element/judgement.js +0 -212
  56. package/lib/element/label.js +0 -135
  57. package/lib/element/metaType.js +0 -57
  58. package/lib/element/metavariable.js +0 -452
  59. package/lib/element/parameter.js +0 -69
  60. package/lib/element/procedureCall.js +0 -116
  61. package/lib/element/procedureReference.js +0 -56
  62. package/lib/element/proof.js +0 -52
  63. package/lib/element/proofAssertion/premise.js +0 -238
  64. package/lib/element/proofAssertion/step.js +0 -235
  65. package/lib/element/proofAssertion/supposition.js +0 -249
  66. package/lib/element/proofAssertion.js +0 -56
  67. package/lib/element/property.js +0 -176
  68. package/lib/element/propertyRelation.js +0 -132
  69. package/lib/element/reference.js +0 -227
  70. package/lib/element/rule.js +0 -242
  71. package/lib/element/section.js +0 -64
  72. package/lib/element/signature.js +0 -195
  73. package/lib/element/statement.js +0 -228
  74. package/lib/element/subDerivation.js +0 -46
  75. package/lib/element/subproof.js +0 -91
  76. package/lib/element/substitution/frame.js +0 -256
  77. package/lib/element/substitution/reference.js +0 -192
  78. package/lib/element/substitution/statement.js +0 -294
  79. package/lib/element/substitution/term.js +0 -266
  80. package/lib/element/substitution.js +0 -183
  81. package/lib/element/term.js +0 -217
  82. package/lib/element/topLevelAssertion/axiom.js +0 -158
  83. package/lib/element/topLevelAssertion/conjecture.js +0 -42
  84. package/lib/element/topLevelAssertion/lemma.js +0 -39
  85. package/lib/element/topLevelAssertion/theorem.js +0 -42
  86. package/lib/element/topLevelAssertion.js +0 -286
  87. package/lib/element/topLevelMetaAssertion/metaLemma.js +0 -42
  88. package/lib/element/topLevelMetaAssertion/metatheorem.js +0 -42
  89. package/lib/element/topLevelMetaAssertion.js +0 -179
  90. package/lib/element/type.js +0 -240
  91. package/lib/element/typePrefix.js +0 -85
  92. package/lib/element/variable.js +0 -206
  93. package/lib/elements.js +0 -27
  94. package/lib/metaTypeNames.js +0 -26
  95. package/lib/metaTypes.js +0 -66
  96. package/lib/node/argument.js +0 -31
  97. package/lib/node/assertion/contained.js +0 -51
  98. package/lib/node/assertion/defined.js +0 -47
  99. package/lib/node/assertion/property.js +0 -36
  100. package/lib/node/assertion/signature.js +0 -32
  101. package/lib/node/assertion/subproof.js +0 -28
  102. package/lib/node/assertion/type.js +0 -32
  103. package/lib/node/assertion.js +0 -18
  104. package/lib/node/assumption/metaLevel.js +0 -27
  105. package/lib/node/assumption.js +0 -27
  106. package/lib/node/body/axiom.js +0 -23
  107. package/lib/node/body/conjecture.js +0 -23
  108. package/lib/node/body/lemma.js +0 -23
  109. package/lib/node/body/metaLemma.js +0 -23
  110. package/lib/node/body/metatheorem.js +0 -23
  111. package/lib/node/body/rule.js +0 -44
  112. package/lib/node/body/theorem.js +0 -23
  113. package/lib/node/body.js +0 -31
  114. package/lib/node/combinator.js +0 -23
  115. package/lib/node/conclusion.js +0 -27
  116. package/lib/node/constructor.js +0 -23
  117. package/lib/node/declaration/combinator.js +0 -28
  118. package/lib/node/declaration/complexType.js +0 -72
  119. package/lib/node/declaration/constructor.js +0 -47
  120. package/lib/node/declaration/metavariable.js +0 -36
  121. package/lib/node/declaration/property.js +0 -44
  122. package/lib/node/declaration/simpleType.js +0 -72
  123. package/lib/node/declaration/typePrefix.js +0 -32
  124. package/lib/node/declaration/variable.js +0 -51
  125. package/lib/node/declaration.js +0 -18
  126. package/lib/node/deduction.js +0 -27
  127. package/lib/node/derivation.js +0 -26
  128. package/lib/node/document.js +0 -18
  129. package/lib/node/equality.js +0 -33
  130. package/lib/node/equivalence.js +0 -23
  131. package/lib/node/equivalences.js +0 -18
  132. package/lib/node/error.js +0 -18
  133. package/lib/node/frame.js +0 -38
  134. package/lib/node/header/axiom.js +0 -28
  135. package/lib/node/header/conjecture.js +0 -23
  136. package/lib/node/header/lemma.js +0 -23
  137. package/lib/node/header/metaLemma.js +0 -23
  138. package/lib/node/header/metatheorem.js +0 -23
  139. package/lib/node/header/rule.js +0 -23
  140. package/lib/node/header/theorem.js +0 -23
  141. package/lib/node/header.js +0 -47
  142. package/lib/node/hypothesis.js +0 -27
  143. package/lib/node/judgement.js +0 -31
  144. package/lib/node/label.js +0 -23
  145. package/lib/node/labels.js +0 -23
  146. package/lib/node/metaArgument.js +0 -23
  147. package/lib/node/metaType.js +0 -30
  148. package/lib/node/metavariable.js +0 -39
  149. package/lib/node/parameter.js +0 -47
  150. package/lib/node/parenthesisedLabel.js +0 -23
  151. package/lib/node/parenthesisedLabels.js +0 -27
  152. package/lib/node/placeholder.js +0 -18
  153. package/lib/node/procedureCall.js +0 -31
  154. package/lib/node/procedureReference.js +0 -30
  155. package/lib/node/proof.js +0 -23
  156. package/lib/node/proofAssertion/premise.js +0 -28
  157. package/lib/node/proofAssertion/step.js +0 -52
  158. package/lib/node/proofAssertion/supposition.js +0 -28
  159. package/lib/node/proofAssertion.js +0 -27
  160. package/lib/node/property.js +0 -30
  161. package/lib/node/propertyRelation.js +0 -31
  162. package/lib/node/qualification.js +0 -27
  163. package/lib/node/reference.js +0 -23
  164. package/lib/node/rule.js +0 -43
  165. package/lib/node/section.js +0 -39
  166. package/lib/node/signature.js +0 -23
  167. package/lib/node/statement.js +0 -103
  168. package/lib/node/subDerivation.js +0 -26
  169. package/lib/node/subproof.js +0 -35
  170. package/lib/node/substitution/frame.js +0 -40
  171. package/lib/node/substitution/reference.js +0 -40
  172. package/lib/node/substitution/statement.js +0 -60
  173. package/lib/node/substitution/term.js +0 -40
  174. package/lib/node/substitution.js +0 -18
  175. package/lib/node/term.js +0 -60
  176. package/lib/node/topLevelAssertion/axiom.js +0 -26
  177. package/lib/node/topLevelAssertion/conjecture.js +0 -26
  178. package/lib/node/topLevelAssertion/lemma.js +0 -26
  179. package/lib/node/topLevelAssertion/theorem.js +0 -26
  180. package/lib/node/topLevelAssertion.js +0 -46
  181. package/lib/node/topLevelMetaAssertion/metaLemma.js +0 -26
  182. package/lib/node/topLevelMetaAssertion/metatheorem.js +0 -26
  183. package/lib/node/topLevelMetaAssertion.js +0 -42
  184. package/lib/node/type.js +0 -60
  185. package/lib/node/typePrefix.js +0 -30
  186. package/lib/node/types.js +0 -23
  187. package/lib/node/variable.js +0 -30
  188. package/lib/nominal/lexer.js +0 -15
  189. package/lib/nominal/parser.js +0 -24
  190. package/lib/nonTerminalNodeMap.js +0 -189
  191. package/lib/pass/zip.js +0 -23
  192. package/lib/preamble.js +0 -73
  193. package/lib/process/assign.js +0 -62
  194. package/lib/process/discharge.js +0 -38
  195. package/lib/process/equate.js +0 -73
  196. package/lib/process/instantiate.js +0 -261
  197. package/lib/process/unification.js +0 -228
  198. package/lib/process/unify.js +0 -336
  199. package/lib/process/validate.js +0 -135
  200. package/lib/process/validation.js +0 -291
  201. package/lib/process/verify.js +0 -205
  202. package/lib/ruleNames.js +0 -350
  203. package/lib/tokenTypes.js +0 -22
  204. package/lib/utilities/assignment.js +0 -47
  205. package/lib/utilities/bnf.js +0 -21
  206. package/lib/utilities/brackets.js +0 -77
  207. package/lib/utilities/breakPoint.js +0 -38
  208. package/lib/utilities/context.js +0 -220
  209. package/lib/utilities/element.js +0 -1851
  210. package/lib/utilities/equivalence.js +0 -27
  211. package/lib/utilities/equivalences.js +0 -134
  212. package/lib/utilities/instance.js +0 -44
  213. package/lib/utilities/json.js +0 -1109
  214. package/lib/utilities/string.js +0 -231
  215. package/lib/utilities/substitutions.js +0 -86
  216. package/lib/utilities/synoptic.js +0 -159
  217. package/lib/utilities/type.js +0 -27
  218. package/src/context/aphasic.js +0 -15
  219. package/src/context/bounded.js +0 -362
  220. package/src/context/branching.js +0 -69
  221. package/src/context/file/nominal.js +0 -955
  222. package/src/context/illative.js +0 -17
  223. package/src/context/liminal.js +0 -280
  224. package/src/context/literal.js +0 -42
  225. package/src/context/mnemic.js +0 -778
  226. package/src/context/nested.js +0 -21
  227. package/src/context/nominal.js +0 -62
  228. package/src/context/phaneric.js +0 -43
  229. package/src/context/thetic.js +0 -17
  230. package/src/context.js +0 -722
  231. package/src/element/assertion/contained.js +0 -313
  232. package/src/element/assertion/defined.js +0 -310
  233. package/src/element/assertion/property.js +0 -252
  234. package/src/element/assertion/signature.js +0 -239
  235. package/src/element/assertion/subproof.js +0 -335
  236. package/src/element/assertion/type.js +0 -328
  237. package/src/element/assertion.js +0 -65
  238. package/src/element/assumption/metaLevel.js +0 -373
  239. package/src/element/assumption.js +0 -374
  240. package/src/element/combinator/bracketed.js +0 -32
  241. package/src/element/combinator.js +0 -145
  242. package/src/element/conclusion.js +0 -185
  243. package/src/element/constructor/bracketed.js +0 -68
  244. package/src/element/constructor.js +0 -188
  245. package/src/element/declaration/combinator.js +0 -66
  246. package/src/element/declaration/complexType.js +0 -257
  247. package/src/element/declaration/constructor.js +0 -122
  248. package/src/element/declaration/metavariable.js +0 -93
  249. package/src/element/declaration/property.js +0 -108
  250. package/src/element/declaration/simpleType.js +0 -208
  251. package/src/element/declaration/typePrefix.js +0 -58
  252. package/src/element/declaration/variable.js +0 -130
  253. package/src/element/declaration.js +0 -7
  254. package/src/element/deduction.js +0 -185
  255. package/src/element/derivation.js +0 -57
  256. package/src/element/equality.js +0 -325
  257. package/src/element/equivalence.js +0 -276
  258. package/src/element/error.js +0 -26
  259. package/src/element/frame.js +0 -356
  260. package/src/element/hypothesis.js +0 -186
  261. package/src/element/judgement.js +0 -303
  262. package/src/element/label.js +0 -186
  263. package/src/element/metaType.js +0 -75
  264. package/src/element/metavariable.js +0 -662
  265. package/src/element/parameter.js +0 -90
  266. package/src/element/procedureCall.js +0 -159
  267. package/src/element/procedureReference.js +0 -71
  268. package/src/element/proof.js +0 -61
  269. package/src/element/proofAssertion/premise.js +0 -354
  270. package/src/element/proofAssertion/step.js +0 -271
  271. package/src/element/proofAssertion/supposition.js +0 -377
  272. package/src/element/proofAssertion.js +0 -74
  273. package/src/element/property.js +0 -258
  274. package/src/element/propertyRelation.js +0 -193
  275. package/src/element/reference.js +0 -345
  276. package/src/element/rule.js +0 -358
  277. package/src/element/section.js +0 -78
  278. package/src/element/signature.js +0 -292
  279. package/src/element/statement.js +0 -358
  280. package/src/element/subDerivation.js +0 -56
  281. package/src/element/subproof.js +0 -116
  282. package/src/element/substitution/frame.js +0 -392
  283. package/src/element/substitution/reference.js +0 -274
  284. package/src/element/substitution/statement.js +0 -452
  285. package/src/element/substitution/term.js +0 -407
  286. package/src/element/substitution.js +0 -261
  287. package/src/element/term.js +0 -339
  288. package/src/element/topLevelAssertion/axiom.js +0 -244
  289. package/src/element/topLevelAssertion/conjecture.js +0 -40
  290. package/src/element/topLevelAssertion/lemma.js +0 -42
  291. package/src/element/topLevelAssertion/theorem.js +0 -40
  292. package/src/element/topLevelAssertion.js +0 -436
  293. package/src/element/topLevelMetaAssertion/metaLemma.js +0 -40
  294. package/src/element/topLevelMetaAssertion/metatheorem.js +0 -40
  295. package/src/element/topLevelMetaAssertion.js +0 -276
  296. package/src/element/type.js +0 -374
  297. package/src/element/typePrefix.js +0 -113
  298. package/src/element/variable.js +0 -259
  299. package/src/elements.js +0 -13
  300. package/src/metaTypeNames.js +0 -5
  301. package/src/metaTypes.js +0 -71
  302. package/src/node/argument.js +0 -30
  303. package/src/node/assertion/contained.js +0 -53
  304. package/src/node/assertion/defined.js +0 -46
  305. package/src/node/assertion/property.js +0 -30
  306. package/src/node/assertion/signature.js +0 -23
  307. package/src/node/assertion/subproof.js +0 -16
  308. package/src/node/assertion/type.js +0 -23
  309. package/src/node/assertion.js +0 -7
  310. package/src/node/assumption/metaLevel.js +0 -23
  311. package/src/node/assumption.js +0 -23
  312. package/src/node/body/axiom.js +0 -7
  313. package/src/node/body/conjecture.js +0 -7
  314. package/src/node/body/lemma.js +0 -7
  315. package/src/node/body/metaLemma.js +0 -7
  316. package/src/node/body/metatheorem.js +0 -7
  317. package/src/node/body/rule.js +0 -42
  318. package/src/node/body/theorem.js +0 -7
  319. package/src/node/body.js +0 -30
  320. package/src/node/combinator.js +0 -16
  321. package/src/node/conclusion.js +0 -23
  322. package/src/node/constructor.js +0 -16
  323. package/src/node/declaration/combinator.js +0 -16
  324. package/src/node/declaration/complexType.js +0 -88
  325. package/src/node/declaration/constructor.js +0 -46
  326. package/src/node/declaration/metavariable.js +0 -30
  327. package/src/node/declaration/property.js +0 -42
  328. package/src/node/declaration/simpleType.js +0 -87
  329. package/src/node/declaration/typePrefix.js +0 -24
  330. package/src/node/declaration/variable.js +0 -53
  331. package/src/node/declaration.js +0 -7
  332. package/src/node/deduction.js +0 -23
  333. package/src/node/derivation.js +0 -19
  334. package/src/node/document.js +0 -7
  335. package/src/node/equality.js +0 -35
  336. package/src/node/equivalence.js +0 -16
  337. package/src/node/equivalences.js +0 -7
  338. package/src/node/error.js +0 -7
  339. package/src/node/frame.js +0 -40
  340. package/src/node/header/axiom.js +0 -16
  341. package/src/node/header/conjecture.js +0 -7
  342. package/src/node/header/lemma.js +0 -7
  343. package/src/node/header/metaLemma.js +0 -7
  344. package/src/node/header/metatheorem.js +0 -7
  345. package/src/node/header/rule.js +0 -7
  346. package/src/node/header/theorem.js +0 -7
  347. package/src/node/header.js +0 -54
  348. package/src/node/hypothesis.js +0 -23
  349. package/src/node/judgement.js +0 -30
  350. package/src/node/label.js +0 -16
  351. package/src/node/labels.js +0 -16
  352. package/src/node/metaArgument.js +0 -16
  353. package/src/node/metaType.js +0 -26
  354. package/src/node/metavariable.js +0 -42
  355. package/src/node/parameter.js +0 -51
  356. package/src/node/parenthesisedLabel.js +0 -16
  357. package/src/node/parenthesisedLabels.js +0 -23
  358. package/src/node/placeholder.js +0 -7
  359. package/src/node/procedureCall.js +0 -30
  360. package/src/node/procedureReference.js +0 -26
  361. package/src/node/proof.js +0 -16
  362. package/src/node/proofAssertion/premise.js +0 -16
  363. package/src/node/proofAssertion/step.js +0 -52
  364. package/src/node/proofAssertion/supposition.js +0 -16
  365. package/src/node/proofAssertion.js +0 -23
  366. package/src/node/property.js +0 -28
  367. package/src/node/propertyRelation.js +0 -30
  368. package/src/node/qualification.js +0 -23
  369. package/src/node/reference.js +0 -16
  370. package/src/node/rule.js +0 -51
  371. package/src/node/section.js +0 -44
  372. package/src/node/signature.js +0 -16
  373. package/src/node/statement.js +0 -167
  374. package/src/node/subDerivation.js +0 -19
  375. package/src/node/subproof.js +0 -35
  376. package/src/node/substitution/frame.js +0 -37
  377. package/src/node/substitution/reference.js +0 -38
  378. package/src/node/substitution/statement.js +0 -70
  379. package/src/node/substitution/term.js +0 -38
  380. package/src/node/substitution.js +0 -7
  381. package/src/node/term.js +0 -75
  382. package/src/node/topLevelAssertion/axiom.js +0 -13
  383. package/src/node/topLevelAssertion/conjecture.js +0 -13
  384. package/src/node/topLevelAssertion/lemma.js +0 -13
  385. package/src/node/topLevelAssertion/theorem.js +0 -13
  386. package/src/node/topLevelAssertion.js +0 -58
  387. package/src/node/topLevelMetaAssertion/metaLemma.js +0 -13
  388. package/src/node/topLevelMetaAssertion/metatheorem.js +0 -13
  389. package/src/node/topLevelMetaAssertion.js +0 -51
  390. package/src/node/type.js +0 -74
  391. package/src/node/typePrefix.js +0 -26
  392. package/src/node/types.js +0 -16
  393. package/src/node/variable.js +0 -26
  394. package/src/nominal/lexer.js +0 -5
  395. package/src/nominal/parser.js +0 -12
  396. package/src/nonTerminalNodeMap.js +0 -261
  397. package/src/pass/zip.js +0 -19
  398. package/src/preamble.js +0 -64
  399. package/src/process/assign.js +0 -53
  400. package/src/process/discharge.js +0 -33
  401. package/src/process/equate.js +0 -94
  402. package/src/process/instantiate.js +0 -198
  403. package/src/process/unification.js +0 -332
  404. package/src/process/unify.js +0 -504
  405. package/src/process/validate.js +0 -174
  406. package/src/process/validation.js +0 -410
  407. package/src/process/verify.js +0 -299
  408. package/src/ruleNames.js +0 -86
  409. package/src/tokenTypes.js +0 -4
  410. package/src/utilities/assignment.js +0 -57
  411. package/src/utilities/bnf.js +0 -20
  412. package/src/utilities/brackets.js +0 -87
  413. package/src/utilities/breakPoint.js +0 -29
  414. package/src/utilities/context.js +0 -223
  415. package/src/utilities/element.js +0 -2293
  416. package/src/utilities/equivalence.js +0 -25
  417. package/src/utilities/equivalences.js +0 -158
  418. package/src/utilities/instance.js +0 -40
  419. package/src/utilities/json.js +0 -1273
  420. package/src/utilities/string.js +0 -282
  421. package/src/utilities/substitutions.js +0 -93
  422. package/src/utilities/synoptic.js +0 -135
  423. package/src/utilities/type.js +0 -19
@@ -1,778 +0,0 @@
1
- "use strict";
2
-
3
- import { arrayUtilities } from "necessary";
4
-
5
- import Context from "../context";
6
-
7
- import { compressTerms,
8
- compressFrames,
9
- compressProperties,
10
- compressEqualities,
11
- compressJudgements,
12
- compressAssertions,
13
- compressStatements,
14
- compressSignatures,
15
- compressReferences,
16
- compressAssumptions,
17
- compressMetavariables,
18
- compressSubstitutions,
19
- compressPropertyRelations,} from "../utilities/synoptic";
20
- import { termsFromJSON,
21
- framesFromJSON,
22
- termsToTermsJSON,
23
- framesToFramesJSON,
24
- propertiesFromJSON,
25
- equalitiesFromJSON,
26
- judgementsFromJSON,
27
- statementsFromJSON,
28
- assertionsFromJSON,
29
- referencesFromJSON,
30
- signaturesFromJSON,
31
- assumptionsFromJSON,
32
- metavariablesFromJSON,
33
- substitutionsFromJSON,
34
- propertyRelationsFromJSON,
35
- propertiesToPropertiesJSON,
36
- judgementsToJudgementsJSON,
37
- equalitiesToEqualitiesJSON,
38
- statementsToStatementsJSON,
39
- signaturesToSignaturesJSON,
40
- assertionsToAssertionsJSON,
41
- referencesToReferencesJSON,
42
- assumptionsToAssumptionsJSON,
43
- metavariablesToMetavariablesJSON,
44
- substitutionsToSubstitutionsJSON,
45
- propertyRelationsToPropertyRelationsJSON } from "../utilities/json";
46
-
47
- const { push } = arrayUtilities;
48
-
49
- export default class MnemicContext extends Context {
50
- constructor(context, terms, frames, properties, equalities, judgements, assertions, statements, signatures, references, assumptions, metavariables, substitutions, propertyRelations) {
51
- super(context);
52
-
53
- this.terms = terms;
54
- this.frames = frames;
55
- this.properties = properties;
56
- this.equalities = equalities;
57
- this.judgements = judgements;
58
- this.assertions = assertions;
59
- this.statements = statements;
60
- this.signatures = signatures;
61
- this.references = references;
62
- this.assumptions = assumptions;
63
- this.metavariables = metavariables;
64
- this.substitutions = substitutions;
65
- this.propertyRelations = propertyRelations;
66
- }
67
-
68
- getTerms(terms = []) {
69
- const context = this.getContext();
70
-
71
- push(terms, this.terms);
72
-
73
- context.getTerms(terms);
74
-
75
- compressTerms(context);
76
-
77
- return terms;
78
- }
79
-
80
- getFrames(frames = []) {
81
- const context = this.getContext();
82
-
83
- push(frames, this.frames);
84
-
85
- context.getFrames(frames);
86
-
87
- compressFrames(context);
88
-
89
- return frames;
90
- }
91
-
92
- getProperties(properties = []) {
93
- const context = this.getContext();
94
-
95
- push(properties, this.properties);
96
-
97
- context.getProperties(properties);
98
-
99
- compressProperties(context);
100
-
101
- return properties;
102
- }
103
-
104
- getEqualities(equalities = []) {
105
- const context = this.getContext();
106
-
107
- push(equalities, this.equalities);
108
-
109
- context.getEqualities(equalities);
110
-
111
- compressEqualities(context);
112
-
113
- return equalities;
114
- }
115
-
116
- getJudgements(judgements = []) {
117
- const context = this.getContext();
118
-
119
- push(judgements, this.judgements);
120
-
121
- context.getJudgements(judgements);
122
-
123
- compressJudgements(context);
124
-
125
- return judgements;
126
- }
127
-
128
- getStatements(statements = []) {
129
- const context = this.getContext();
130
-
131
- push(statements, this.statements);
132
-
133
- context.getStatements(statements);
134
-
135
- compressStatements(context);
136
-
137
- return statements;
138
- }
139
-
140
- getSignatures(signatures = []) {
141
- const context = this.getContext();
142
-
143
- push(signatures, this.signatures);
144
-
145
- context.getSignatures(signatures);
146
-
147
- compressSignatures(context);
148
-
149
- return signatures;
150
- }
151
-
152
- getAssertions(assertions = []) {
153
- const context = this.getContext();
154
-
155
- push(assertions, this.assertions);
156
-
157
- context.getAssertions(assertions);
158
-
159
- compressAssertions(context);
160
-
161
- return assertions;
162
- }
163
-
164
- getReferences(references = []) {
165
- const context = this.getContext();
166
-
167
- push(references, this.references);
168
-
169
- context.getReferences(references);
170
-
171
- compressReferences(context);
172
-
173
- return references;
174
- }
175
-
176
- getAssumptions(assumptions = []) {
177
- const context = this.getContext();
178
-
179
- push(assumptions, this.assumptions);
180
-
181
- context.getAssumptions(assumptions);
182
-
183
- compressAssumptions(context);
184
-
185
- return assumptions;
186
- }
187
-
188
- getMetavariables(metavariables = []) {
189
- const context = this.getContext();
190
-
191
- push(metavariables, this.metavariables);
192
-
193
- context.getMetavariables(metavariables);
194
-
195
- compressMetavariables(context);
196
-
197
- return metavariables;
198
- }
199
-
200
- getSubstitutions(substitutions = []) {
201
- const context = this.getContext();
202
-
203
- push(substitutions, this.substitutions);
204
-
205
- context.getSubstitutions(substitutions);
206
-
207
- compressSubstitutions(context);
208
-
209
- return substitutions;
210
- }
211
-
212
- getPropertyRelations(propertyRelations = []) {
213
- const context = this.getContext();
214
-
215
- push(propertyRelations, this.propertyRelations);
216
-
217
- context.getPropertyRelations(propertyRelations);
218
-
219
- compressPropertyRelations(context);
220
-
221
- return propertyRelations;
222
- }
223
-
224
- addTerm(term) {
225
- const context = this, ///
226
- termString = term.getString();
227
-
228
- context.trace(`Adding the '${termString}' term to the mnemic context...`);
229
-
230
- this.terms.push(term);
231
-
232
- context.debug(`...added the '${termString}' term to the mnemic context.`);
233
- }
234
-
235
- addFrame(frame) {
236
- const context = this, ///
237
- frameString = frame.getString();
238
-
239
- context.trace(`Adding the '${frameString}' frame to the mnemic context...`);
240
-
241
- this.frames.push(frame);
242
-
243
- context.debug(`...added the '${frameString}' frame to the mnemic context.`);
244
- }
245
-
246
- addEquality(equality) {
247
- const context = this, ///
248
- equalityString = equality.getString();
249
-
250
- context.trace(`Adding the '${equalityString}' equality to the mnemic context...`);
251
-
252
- this.equalities.push(equality);
253
-
254
- context.debug(`...added the '${equalityString}' equality to the mnemic context.`);
255
- }
256
-
257
- addProperty(property) {
258
- const context = this, ///
259
- propertyString = property.getString();
260
-
261
- context.trace(`Adding the '${propertyString}' property to the mnemic context...`);
262
-
263
- this.properties.push(property);
264
-
265
- context.debug(`...added the '${propertyString}' property to the mnemic context.`);
266
- }
267
-
268
- addJudgement(judgement) {
269
- const context = this, ///
270
- judgementString = judgement.getString();
271
-
272
- context.trace(`Adding the '${judgementString}' judgement to the mnemic context...`);
273
-
274
- this.judgements.push(judgement);
275
-
276
- context.debug(`...added the '${judgementString}' judgement to the mnemic context.`);
277
- }
278
-
279
- addAssertion(assertion) {
280
- const context = this, ///
281
- assertionString = assertion.getString();
282
-
283
- context.trace(`Adding the '${assertionString}' assertion to the mnemic context...`);
284
-
285
- this.assertions.push(assertion);
286
-
287
- context.debug(`...added the '${assertionString}' assertion to the mnemic context.`);
288
- }
289
-
290
- addStatement(statement) {
291
- const context = this, ///
292
- statementString = statement.getString();
293
-
294
- context.trace(`Adding the '${statementString}' statement to the mnemic context...`);
295
-
296
- this.statements.push(statement);
297
-
298
- context.debug(`...added the '${statementString}' statement to the mnemic context.`);
299
- }
300
-
301
- addSignature(signature) {
302
- const context = this, ///
303
- signatureString = signature.getString();
304
-
305
- context.trace(`Adding the '${signatureString}' signature to the mnemic context...`);
306
-
307
- this.signatures.push(signature);
308
-
309
- context.debug(`...added the '${signatureString}' signature to the mnemic context.`);
310
- }
311
-
312
- addReference(reference) {
313
- const context = this, ///
314
- referenceString = reference.getString();
315
-
316
- context.trace(`Adding the '${referenceString}' reference to the mnemic context...`);
317
-
318
- this.references.push(reference);
319
-
320
- context.debug(`...added the '${referenceString}' reference to the mnemic context.`);
321
- }
322
-
323
- addAssumption(assumption) {
324
- const context = this, ///
325
- assumptionString = assumption.getString();
326
-
327
- context.trace(`Adding the '${assumptionString}' assumption to the mnemic context...`);
328
-
329
- this.assumptions.push(assumption);
330
-
331
- context.debug(`...added the '${assumptionString}' assumption to the mnemic context.`);
332
- }
333
-
334
- addMetavariable(metavariable) {
335
- const context = this, ///
336
- metavariableString = metavariable.getString();
337
-
338
- context.trace(`Adding the '${metavariableString}' metavariable to the mnemic context...`);
339
-
340
- this.metavariables.push(metavariable);
341
-
342
- context.debug(`...added the '${metavariableString}' metavariable to the mnemic context.`);
343
- }
344
-
345
- addSubstitution(substitution) {
346
- const context = this, ///
347
- substitutionString = substitution.getString();
348
-
349
- context.trace(`Adding the '${substitutionString}' substitution to the mnemic context...`);
350
-
351
- this.substitutions.push(substitution);
352
-
353
- context.debug(`...added the '${substitutionString}' substitution to the mnemic context.`);
354
- }
355
-
356
- addPropertyRelation(propertyRelation) {
357
- const context = this, ///
358
- propertyRelationString = propertyRelation.getString();
359
-
360
- context.trace(`Adding the '${propertyRelationString}' property relation to the mnemic context...`);
361
-
362
- this.propertyRelations.push(propertyRelation);
363
-
364
- context.debug(`...added the '${propertyRelationString}' property relation to the mnemic context.`);
365
- }
366
-
367
- addTerms(terms) {
368
- terms.forEach((term) => {
369
- this.addTerm(term);
370
- });
371
- }
372
-
373
- findTermByTermNode(termNode) {
374
- const terms = this.getTerms(),
375
- term = terms.find((term) => {
376
- const termNodeMatches = term.matchTermNode(termNode);
377
-
378
- if (termNodeMatches) {
379
- return true;
380
- }
381
- }) || null;
382
-
383
- return term;
384
- }
385
-
386
- findFrameByFrameNode(frameNode) {
387
- const frames = this.getFrames(),
388
- frame = frames.find((frame) => {
389
- const frameNodeMatches = frame.matchFrameNode(frameNode);
390
-
391
- if (frameNodeMatches) {
392
- return true;
393
- }
394
- }) || null;
395
-
396
- return frame;
397
- }
398
-
399
- findEqualityByEqualityNode(equalityNode) {
400
- const equalities = this.getEqualities(),
401
- equality = equalities.find((equality) => {
402
- const equalityNodeMatches = equality.matchEqualityNode(equalityNode);
403
-
404
- if (equalityNodeMatches) {
405
- return true;
406
- }
407
- }) || null;
408
-
409
- return equality;
410
- }
411
-
412
- findPropertyByPropertyNode(propertyNode) {
413
- const properties = this.getProperties(),
414
- property = properties.find((property) => {
415
- const propertyNodeMatches = property.matchEqualityNode(propertyNode);
416
-
417
- if (propertyNodeMatches) {
418
- return true;
419
- }
420
- }) || null;
421
-
422
- return property;
423
- }
424
-
425
- findJudgementByJudgementNode(judgementNode) {
426
- const judgements = this.getJudgements(),
427
- judgement = judgements.find((judgement) => {
428
- const judgementNodeMatches = judgement.matchJudgementNode(judgementNode);
429
-
430
- if (judgementNodeMatches) {
431
- return true;
432
- }
433
- }) || null;
434
-
435
- return judgement;
436
- }
437
-
438
- findAssertionByAssertionNode(assertionNode) {
439
- const assertions = this.getAssertions(),
440
- assertion = assertions.find((assertion) => {
441
- const assertionNodeMatches = assertion.matchAssertionNode(assertionNode);
442
-
443
- if (assertionNodeMatches) {
444
- return true;
445
- }
446
- }) || null;
447
-
448
- return assertion;
449
- }
450
-
451
- findStatementByStatementNode(statementNode) {
452
- const statements = this.getStatements(),
453
- statement = statements.find((statement) => {
454
- const statementNodeMatches = statement.matchStatementNode(statementNode);
455
-
456
- if (statementNodeMatches) {
457
- return true;
458
- }
459
- }) || null;
460
-
461
- return statement;
462
- }
463
-
464
- findSignatureBySignatureNode(signatureNode) {
465
- const signatures = this.getSignatures(),
466
- signature = signatures.find((signature) => {
467
- const signatureNodeMatches = signature.matchSignatureNode(signatureNode);
468
-
469
- if (signatureNodeMatches) {
470
- return true;
471
- }
472
- }) || null;
473
-
474
- return signature;
475
- }
476
-
477
- findReferenceByReferenceNode(referenceNode) {
478
- const references = this.getReferences(),
479
- reference = references.find((reference) => {
480
- const referenceMatcheReferenceNode = reference.matchReferenceNode(referenceNode);
481
-
482
- if (referenceMatcheReferenceNode) {
483
- return true;
484
- }
485
- }) || null;
486
-
487
- return reference;
488
- }
489
-
490
- findAssumptionByAssumptionNode(assumptionNode) {
491
- const assumptions = this.getAssumptions(),
492
- assumption = assumptions.find((assumption) => {
493
- const assumptionNodeMatches = assumption.matchAssumptionNode(assumptionNode);
494
-
495
- if (assumptionNodeMatches) {
496
- return true;
497
- }
498
- }) || null;
499
-
500
- return assumption;
501
- }
502
-
503
- findReferenceByMetavariableNode(metavariableNode) {
504
- const references = this.getReferences(),
505
- reference = references.find((reference) => {
506
- const referenceMatcheMetavariableNode = reference.matchMetavariableNode(metavariableNode);
507
-
508
- if (referenceMatcheMetavariableNode) {
509
- return true;
510
- }
511
- }) || null;
512
-
513
- return reference;
514
- }
515
-
516
- findMetavariableByMetavariableNode(metavariableNode) {
517
- const metavariables = this.getMetavariables(),
518
- metavariable = metavariables.find((metavariable) => {
519
- const metavariableNodeMatches = metavariable.matchMetavariableNode(metavariableNode);
520
-
521
- if (metavariableNodeMatches) {
522
- return true;
523
- }
524
- }) || null;
525
-
526
- return metavariable;
527
- }
528
-
529
- findSubstitutionBySubstitutionNode(substitutionNode) {
530
- const substitutions = this.getSubstitutions(),
531
- substitution = substitutions.find((substitution) => {
532
- const substitutionNodeMatches = substitution.matchSubstitutionNode(substitutionNode);
533
-
534
- if (substitutionNodeMatches) {
535
- return true;
536
- }
537
- }) || null;
538
-
539
- return substitution;
540
- }
541
-
542
- findPropertyRelationByPropertyRelationNode(propertyRelationNode) {
543
- const propertyRelations = this.getPropertyRelations(),
544
- propertyRelation = propertyRelations.find((propertyRelation) => {
545
- const propertyRelationNodeMatches = propertyRelation.matchEqualityNode(propertyRelationNode);
546
-
547
- if (propertyRelationNodeMatches) {
548
- return true;
549
- }
550
- }) || null;
551
-
552
- return propertyRelation;
553
- }
554
-
555
- findVariableByVariableNode(variableNode) {
556
- const variableIdentifier = variableNode.getVariableIdentifier(),
557
- declaredVariable = this.findDeclaredVariableByVariableIdentifier(variableIdentifier),
558
- variable = declaredVariable; ///
559
-
560
- return variable;
561
- }
562
-
563
- isTermPresentByTermNode(termNode) {
564
- const term = this.findTermByTermNode(termNode),
565
- termPresent = (term !== null);
566
-
567
- return termPresent;
568
- }
569
-
570
- isFramePresentByFrameNode(frameNode) {
571
- const frame = this.findFrameByFrameNode(frameNode),
572
- framePresent = (frame !== null);
573
-
574
- return framePresent;
575
- }
576
-
577
- isEqualityPresentByEqualityNode(equalityNode) {
578
- const equality = this.findEqualityByEqualityNode(equalityNode),
579
- equalityPresent = (equality !== null);
580
-
581
- return equalityPresent;
582
- }
583
-
584
- isPropertyPresentByPropertyNode(propertyNode) {
585
- const property = this.findPropertyByPropertyNode(propertyNode),
586
- propertyPresent = (property !== null);
587
-
588
- return propertyPresent;
589
- }
590
-
591
- isJudgementPresentByJudgementNode(judgementNode) {
592
- const judgement = this.findJudgementByJudgementNode(judgementNode),
593
- judgementPresent = (judgement !== null);
594
-
595
- return judgementPresent;
596
- }
597
-
598
- isAssertionPresentByAssertionNode(assertionNode) {
599
- const assertion = this.findAssertionByAssertionNode(assertionNode),
600
- assertionPresent = (assertion !== null);
601
-
602
- return assertionPresent;
603
- }
604
-
605
- isStatementPresentByStatementNode(statementNode) {
606
- const statement = this.findStatementByStatementNode(statementNode),
607
- statementPresent = (statement !== null);
608
-
609
- return statementPresent;
610
- }
611
-
612
- isSignaturePresentBySignatureNode(signatureNode) {
613
- const signature = this.findSignatureBySignatureNode(signatureNode),
614
- signaturePresent = (signature !== null);
615
-
616
- return signaturePresent;
617
- }
618
-
619
- isAssumptionPresentByAssumptionNode(assumptionNode) {
620
- const assumption = this.findAssumptionByAssumptionNode(assumptionNode),
621
- assumptionPresent = (assumption !== null);
622
-
623
- return assumptionPresent;
624
- }
625
-
626
- isReferencePresentByMetavariableNode(metavariableNode) {
627
- const reference = this.findReferenceByMetavariableNode(metavariableNode),
628
- referencePresent = (reference !== null);
629
-
630
- return referencePresent;
631
- }
632
-
633
- isMetavariablePresentByMetavariableNode(metavariablenNode) {
634
- const metavariablen = this.findMetavariableByMetavariableNode(metavariablenNode),
635
- metavariablenPresent = (metavariablen !== null);
636
-
637
- return metavariablenPresent;
638
- }
639
-
640
- isPropertyRelationresentByPropertyRelationNode(propertyRelationNode) {
641
- const propertyRelation = this.findPropertyRelationByPropertyRelationNode(propertyRelationNode),
642
- propertyRelationresent = (propertyRelation !== null);
643
-
644
- return propertyRelationresent;
645
- }
646
-
647
- commit(element) {
648
- const context = this; ///
649
-
650
- element.setContext(context);
651
- }
652
-
653
- initialise(json) {
654
- const context = this; ///
655
-
656
- this.terms = termsFromJSON(json, context);
657
-
658
- this.metavariables = metavariablesFromJSON(json, context);
659
-
660
- this.statements = statementsFromJSON(json, context);
661
- this.references = referencesFromJSON(json, context);
662
-
663
- this.equalities = equalitiesFromJSON(json, context);
664
- this.assumptions = assumptionsFromJSON(json, context);
665
-
666
- this.frames = framesFromJSON(json, context);
667
-
668
- this.properties = propertiesFromJSON(json, context);
669
-
670
- this.judgements = judgementsFromJSON(json, context);
671
- this.assertions = assertionsFromJSON(json, context);
672
- this.signatures = signaturesFromJSON(json, context);
673
- this.substitutions = substitutionsFromJSON(json, context);
674
- this.propertyRelations = propertyRelationsFromJSON(json, context);
675
- }
676
-
677
- toJSON() {
678
- let terms = this.getTerms(),
679
- frames = this.getFrames(),
680
- properties = this.getProperties(),
681
- equalities = this.getEqualities(),
682
- judgements = this.getJudgements(),
683
- assertions = this.getAssertions(),
684
- statements = this.getStatements(),
685
- signatures = this.getSignatures(),
686
- references = this.getReferences(),
687
- assumptions = this.getAssumptions(),
688
- metavariables = this.getMetavariables(),
689
- substitutions = this.getSubstitutions(),
690
- propertyRelations = this.getPropertyRelations();
691
-
692
- const termsJSON = termsToTermsJSON(terms),
693
- framesJSON = framesToFramesJSON(frames),
694
- propertiesJSON = propertiesToPropertiesJSON(properties),
695
- equalitiesJSON = equalitiesToEqualitiesJSON(equalities),
696
- judgementsJSON = judgementsToJudgementsJSON(judgements),
697
- assertionsJSON = assertionsToAssertionsJSON(assertions),
698
- statementsJSON = statementsToStatementsJSON(statements),
699
- signaturesJSON = signaturesToSignaturesJSON(signatures),
700
- referencesJSON = referencesToReferencesJSON(references),
701
- assumptionsJSON = assumptionsToAssumptionsJSON(assumptions),
702
- metavariablesJSON = metavariablesToMetavariablesJSON(metavariables),
703
- substitutionsJSON = substitutionsToSubstitutionsJSON(substitutions),
704
- propertyRelationsJSON = propertyRelationsToPropertyRelationsJSON(propertyRelations);
705
-
706
- terms = termsJSON; ///
707
- frames = framesJSON; ///
708
- properties = propertiesJSON; ///
709
- equalities = equalitiesJSON; ///
710
- judgements = judgementsJSON; ///
711
- assertions = assertionsJSON; ///
712
- statements = statementsJSON; ///
713
- signatures = signaturesJSON; ///
714
- references = referencesJSON; ///
715
- assumptions = assumptionsJSON; ///
716
- metavariables = metavariablesJSON; //
717
- substitutions = substitutionsJSON; ///
718
- propertyRelations = propertyRelationsJSON; ///
719
-
720
- const json = {
721
- terms,
722
- frames,
723
- properties,
724
- equalities,
725
- judgements,
726
- assertions,
727
- statements,
728
- signatures,
729
- references,
730
- assumptions,
731
- metavariables,
732
- substitutions,
733
- propertyRelations
734
- };
735
-
736
- return json;
737
- }
738
-
739
- static fromJSON(json, context) {
740
- const terms = null,
741
- frames = null,
742
- properties = null,
743
- equalities = null,
744
- judgements = null,
745
- statements = null,
746
- assertions = null,
747
- signatures = null,
748
- references = null,
749
- assumptions = null,
750
- metavariables = null,
751
- substitutions = null,
752
- propertyRelations = null,
753
- mnemicContext = new MnemicContext(context, terms, frames, properties, equalities, judgements, assertions, statements, signatures, references, assumptions, metavariables, substitutions, propertyRelations);
754
-
755
- mnemicContext.initialise(json);
756
-
757
- return mnemicContext;
758
- }
759
-
760
- static fromNothing(context) {
761
- const terms = [],
762
- frames = [],
763
- properties = [],
764
- equalities = [],
765
- judgements = [],
766
- statements = [],
767
- assertions = [],
768
- signatures = [],
769
- references = [],
770
- assumptions = [],
771
- metavariables = [],
772
- substitutions = [],
773
- propertyRelations = [],
774
- mnemicContext = new MnemicContext(context, terms, frames, properties, equalities, judgements, assertions, statements, signatures, references, assumptions, metavariables, substitutions, propertyRelations);
775
-
776
- return mnemicContext;
777
- }
778
- }