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.
Files changed (272) 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 +316 -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/substitution/frame.js +15 -1
  79. package/lib/node/substitution/statement.js +37 -1
  80. package/lib/node/substitution/term.js +15 -1
  81. package/lib/preamble.js +63 -63
  82. package/lib/process/assign.js +58 -0
  83. package/lib/process/instantiate.js +68 -7
  84. package/lib/process/unify.js +26 -26
  85. package/lib/process/verify.js +21 -21
  86. package/lib/utilities/brackets.js +9 -18
  87. package/lib/utilities/customGrammar.js +1 -1
  88. package/lib/utilities/element.js +1128 -0
  89. package/lib/utilities/json.js +32 -32
  90. package/lib/utilities/node.js +49 -61
  91. package/lib/utilities/statement.js +83 -0
  92. package/lib/utilities/string.js +98 -56
  93. package/package.json +6 -6
  94. package/src/action/verify.js +8 -1
  95. package/src/context/file.js +9 -39
  96. package/src/context/local.js +5 -11
  97. package/src/context/nominal.js +30 -0
  98. package/src/context/release.js +1 -1
  99. package/src/context/temporary.js +6 -63
  100. package/src/{ontology → element}/assertion/contained.js +4 -25
  101. package/src/{ontology → element}/assertion/defined.js +7 -26
  102. package/src/{ontology → element}/assertion/property.js +7 -26
  103. package/src/{ontology → element}/assertion/satisfies.js +5 -53
  104. package/src/{ontology → element}/assertion/subproof.js +3 -32
  105. package/src/{ontology → element}/assertion/type.js +7 -26
  106. package/src/{ontology → element}/assertion.js +6 -6
  107. package/src/{ontology → element}/assumption.js +3 -27
  108. package/src/{ontology → element}/axiom.js +4 -11
  109. package/src/{ontology/topLevelAssertion.js → element/axiomLemmaTheoremConjecture.js} +9 -105
  110. package/src/{ontology → element}/conclusion.js +4 -19
  111. package/src/{ontology → element}/conjecture.js +4 -11
  112. package/src/{ontology → element}/declaration/combinator.js +3 -14
  113. package/src/{ontology → element}/declaration/complexType.js +3 -19
  114. package/src/{ontology → element}/declaration/constructor.js +3 -14
  115. package/src/{ontology → element}/declaration/metavariable.js +3 -39
  116. package/src/{ontology → element}/declaration/simpleType.js +3 -19
  117. package/src/{ontology → element}/declaration/typePrefix.js +3 -15
  118. package/src/{ontology → element}/declaration/variable.js +3 -14
  119. package/src/{ontology → element}/declaration.js +6 -6
  120. package/src/{ontology → element}/deduction.js +9 -22
  121. package/src/{ontology → element}/derivation.js +2 -32
  122. package/src/{ontology → element}/equality.js +18 -42
  123. package/src/{ontology → element}/equivalence.js +17 -2
  124. package/src/{ontology → element}/equivalences.js +1 -1
  125. package/src/{ontology → element}/error.js +8 -8
  126. package/src/{ontology → element}/frame.js +8 -56
  127. package/src/{ontology → element}/hypothesis.js +5 -5
  128. package/src/{ontology → element}/judgement.js +7 -7
  129. package/src/{ontology → element}/label.js +3 -3
  130. package/src/{ontology → element}/lemma.js +4 -4
  131. package/src/{ontology → element}/metaLemma.js +5 -5
  132. package/src/{ontology/topLevelMetaAssertion.js → element/metaLemmaMetatheorem.js} +11 -11
  133. package/src/{ontology → element}/metaType.js +11 -7
  134. package/src/{ontology → element}/metatheorem.js +5 -5
  135. package/src/{ontology → element}/metavariable.js +10 -60
  136. package/src/{ontology → element}/parameter.js +1 -1
  137. package/src/{ontology → element}/premise.js +14 -14
  138. package/src/{ontology → element}/procedureCall.js +4 -4
  139. package/src/{ontology → element}/procedureReference.js +1 -1
  140. package/src/{ontology → element}/proof.js +3 -3
  141. package/src/{ontology → element}/property.js +7 -15
  142. package/src/{ontology → element}/propertyRelation.js +5 -11
  143. package/src/{ontology → element}/reference.js +5 -19
  144. package/src/{ontology → element}/rule.js +13 -13
  145. package/src/{ontology → element}/section.js +10 -10
  146. package/src/{ontology → element}/signature.js +12 -15
  147. package/src/element/statement/combinator/bracketed.js +38 -0
  148. package/src/element/statement/combinator.js +59 -0
  149. package/src/{ontology → element}/statement.js +11 -27
  150. package/src/{ontology → element}/step.js +10 -44
  151. package/src/{ontology → element}/subDerivation.js +3 -24
  152. package/src/{ontology → element}/subproof.js +3 -43
  153. package/src/{ontology → element}/substitution/frame.js +4 -21
  154. package/src/{ontology → element}/substitution/reference.js +3 -3
  155. package/src/{ontology → element}/substitution/statement.js +6 -10
  156. package/src/{ontology → element}/substitution/term.js +7 -23
  157. package/src/{ontology → element}/substitutions.js +1 -1
  158. package/src/{ontology → element}/supposition.js +10 -10
  159. package/src/{ontology → element/term}/constructor/bracketed.js +12 -13
  160. package/src/element/term/constructor.js +82 -0
  161. package/src/{ontology → element}/term.js +6 -38
  162. package/src/{ontology → element}/theorem.js +5 -5
  163. package/src/{ontology → element}/type.js +17 -64
  164. package/src/{ontology → element}/typePrefix.js +8 -12
  165. package/src/{ontology → element}/variable.js +9 -20
  166. package/src/elements.js +13 -0
  167. package/src/mixins/statement/verify.js +4 -4
  168. package/src/mixins/step/unify.js +6 -6
  169. package/src/mixins/term/verify.js +3 -3
  170. package/src/node/substitution/frame.js +14 -0
  171. package/src/node/substitution/statement.js +40 -0
  172. package/src/node/substitution/term.js +15 -0
  173. package/src/preamble.js +62 -62
  174. package/src/process/assign.js +59 -0
  175. package/src/process/instantiate.js +67 -15
  176. package/src/process/unify.js +37 -39
  177. package/src/process/verify.js +20 -20
  178. package/src/utilities/brackets.js +12 -17
  179. package/src/utilities/customGrammar.js +3 -3
  180. package/src/utilities/element.js +1380 -0
  181. package/src/utilities/json.js +31 -31
  182. package/src/utilities/node.js +56 -64
  183. package/src/utilities/{context.js → statement.js} +10 -39
  184. package/src/utilities/string.js +120 -52
  185. package/lib/assignment/equality.js +0 -62
  186. package/lib/assignment/judgement.js +0 -62
  187. package/lib/assignment/variable.js +0 -64
  188. package/lib/context/bracketed/combinator.js +0 -121
  189. package/lib/context/bracketed/constructor.js +0 -121
  190. package/lib/context/bracketted.js +0 -86
  191. package/lib/context/partial/metavariable.js +0 -180
  192. package/lib/context/partial/statement.js +0 -180
  193. package/lib/context/partial/term.js +0 -192
  194. package/lib/context/partial/variable.js +0 -192
  195. package/lib/context/partial.js +0 -93
  196. package/lib/ontology/assertion/contained.js +0 -357
  197. package/lib/ontology/assertion/defined.js +0 -331
  198. package/lib/ontology/assertion/property.js +0 -313
  199. package/lib/ontology/assertion/satisfies.js +0 -302
  200. package/lib/ontology/assertion/subproof.js +0 -240
  201. package/lib/ontology/assertion/type.js +0 -308
  202. package/lib/ontology/assumption.js +0 -383
  203. package/lib/ontology/axiom.js +0 -339
  204. package/lib/ontology/combinator/bracketed.js +0 -202
  205. package/lib/ontology/combinator.js +0 -155
  206. package/lib/ontology/conclusion.js +0 -201
  207. package/lib/ontology/constructor.js +0 -185
  208. package/lib/ontology/declaration/combinator.js +0 -210
  209. package/lib/ontology/declaration/complexType.js +0 -393
  210. package/lib/ontology/declaration/constructor.js +0 -242
  211. package/lib/ontology/declaration/metavariable.js +0 -257
  212. package/lib/ontology/declaration/simpleType.js +0 -290
  213. package/lib/ontology/declaration/typePrefix.js +0 -228
  214. package/lib/ontology/declaration/variable.js +0 -245
  215. package/lib/ontology/deduction.js +0 -215
  216. package/lib/ontology/derivation.js +0 -155
  217. package/lib/ontology/equality.js +0 -288
  218. package/lib/ontology/equivalence.js +0 -295
  219. package/lib/ontology/equivalences.js +0 -264
  220. package/lib/ontology/frame.js +0 -419
  221. package/lib/ontology/hypothesis.js +0 -190
  222. package/lib/ontology/judgement.js +0 -248
  223. package/lib/ontology/label.js +0 -198
  224. package/lib/ontology/metavariable.js +0 -502
  225. package/lib/ontology/parameter.js +0 -108
  226. package/lib/ontology/premise.js +0 -310
  227. package/lib/ontology/procedureCall.js +0 -243
  228. package/lib/ontology/property.js +0 -166
  229. package/lib/ontology/propertyRelation.js +0 -202
  230. package/lib/ontology/reference.js +0 -315
  231. package/lib/ontology/rule.js +0 -373
  232. package/lib/ontology/section.js +0 -255
  233. package/lib/ontology/signature.js +0 -217
  234. package/lib/ontology/statement.js +0 -398
  235. package/lib/ontology/step.js +0 -295
  236. package/lib/ontology/subDerivation.js +0 -147
  237. package/lib/ontology/subproof.js +0 -265
  238. package/lib/ontology/substitution/frame.js +0 -261
  239. package/lib/ontology/substitution/term.js +0 -269
  240. package/lib/ontology/substitution.js +0 -206
  241. package/lib/ontology/substitutions.js +0 -425
  242. package/lib/ontology/supposition.js +0 -323
  243. package/lib/ontology/term.js +0 -351
  244. package/lib/ontology/topLevelAssertion.js +0 -431
  245. package/lib/ontology/topLevelMetaAssertion.js +0 -234
  246. package/lib/ontology/type.js +0 -556
  247. package/lib/ontology/typePrefix.js +0 -99
  248. package/lib/ontology/variable.js +0 -343
  249. package/lib/ontology.js +0 -27
  250. package/lib/utilities/assignments.js +0 -19
  251. package/lib/utilities/context.js +0 -101
  252. package/lib/utilities/subproof.js +0 -42
  253. package/lib/utilities/type.js +0 -40
  254. package/src/assignment/equality.js +0 -29
  255. package/src/assignment/judgement.js +0 -29
  256. package/src/assignment/variable.js +0 -34
  257. package/src/context/bracketed/combinator.js +0 -31
  258. package/src/context/bracketed/constructor.js +0 -31
  259. package/src/context/bracketted.js +0 -41
  260. package/src/context/partial/metavariable.js +0 -39
  261. package/src/context/partial/statement.js +0 -39
  262. package/src/context/partial/term.js +0 -49
  263. package/src/context/partial/variable.js +0 -49
  264. package/src/context/partial.js +0 -71
  265. package/src/ontology/combinator/bracketed.js +0 -38
  266. package/src/ontology/combinator.js +0 -72
  267. package/src/ontology/constructor.js +0 -105
  268. package/src/ontology.js +0 -13
  269. package/src/utilities/assignments.js +0 -11
  270. package/src/utilities/subproof.js +0 -56
  271. package/src/utilities/type.js +0 -35
  272. /package/src/{ontology → element}/substitution.js +0 -0
@@ -0,0 +1,1380 @@
1
+ "use strict";
2
+
3
+ import elements from "../elements";
4
+
5
+ import { baseType } from "../element/type";
6
+ import { subproofStringFromSubproofNode, stringFromLabelsSuppositionsAndDeduction } from "../utilities/string";
7
+ import node from "occam-parsers/lib/mixins/node";
8
+
9
+ export function typeFromTypeNode(typeNode, context) {
10
+ let type;
11
+
12
+ if (typeNode === null) {
13
+ type = baseType;
14
+ } else {
15
+ const { Type } = elements,
16
+ typeName = typeNode.getTypeName(),
17
+ typePrefixName = typeNode.getTypePrefixName(),
18
+ nominalTypeName = typeNode.getNominalTypeName(),
19
+ string = nominalTypeName, ///
20
+ node = typeNode, ///
21
+ name = typeName, ///
22
+ prefixName = typePrefixName, ///
23
+ superTypes = null,
24
+ properties = null,
25
+ provisional = null;
26
+
27
+ type = new Type(string, node, name, prefixName, superTypes, properties, provisional);
28
+ }
29
+
30
+ return type;
31
+ }
32
+
33
+ export function termFromTermNode(termNode, context) {
34
+ const { Term } = elements,
35
+ node = termNode, ///
36
+ string = context.nodeAsString(node),
37
+ type = null,
38
+ term = new Term(string, node, type);
39
+
40
+ return term;
41
+ }
42
+
43
+ export function stepFromStepNode(stepNode, context) {
44
+ const { Step } = elements,
45
+ node = stepNode, ///
46
+ string = context.nodeAsString(node),
47
+ statement = statementFromStepNode(stepNode, context),
48
+ reference = referenceFromStepNode(stepNode, context),
49
+ satisfiesAssertion = satisfiesAssertionFromStepNode(stepNode, context),
50
+ step = new Step(context, string, node, statement, reference, satisfiesAssertion);
51
+
52
+ return step;
53
+ }
54
+
55
+ export function lemmaromAxiomNode(lemmaNode, context) {
56
+ const { Lemma } = elements,
57
+ axiomLemmaTheoremConjectureNode = lemmaNode, ///
58
+ proof = proofFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
59
+ labels = labelsFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
60
+ deduction = deductionFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
61
+ suppositions = suppositionsFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
62
+ signature = signatureFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
63
+ hypotheses = [],
64
+ node = lemmaNode, ///
65
+ string = stringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
66
+ lemma = new Lemma(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses);
67
+
68
+ return lemma;
69
+ }
70
+
71
+ export function frameFromFrameNode(frameNode, context) {
72
+ const { Frame } = elements,
73
+ node = frameNode, ///
74
+ string = context.nodeAsString(node),
75
+ assumptions = assumptionsFromFrameNode(frameNode, context),
76
+ frame = new Frame(string, node, assumptions);
77
+
78
+ return frame;
79
+ }
80
+
81
+ export function proofFromProofNode(proofNode, context) {
82
+ const { Proof } = elements,
83
+ node = proofNode, ///
84
+ string = null,
85
+ derivation = derivationFromProofNode(proofNode, context),
86
+ proof = new Proof(string, node, derivation);
87
+
88
+ return proof;
89
+ }
90
+
91
+ export function axiomFromAxiomNode(axiomNode, context) {
92
+ const { Axiom } = elements,
93
+ axiomLemmaTheoremConjectureNode = axiomNode, ///
94
+ proof = null,
95
+ labels = labelsFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
96
+ deduction = deductionFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
97
+ suppositions = suppositionsFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
98
+ signature = signatureFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
99
+ hypotheses = [],
100
+ node = axiomNode, ///
101
+ string = stringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
102
+ axiom = new Axiom(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses);
103
+
104
+ return axiom;
105
+ }
106
+
107
+ export function theoremromAxiomNode(theoremNode, context) {
108
+ const { Theorem } = elements,
109
+ axiomLemmaTheoremConjectureNode = theoremNode, ///
110
+ proof = proofFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
111
+ labels = labelsFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
112
+ deduction = deductionFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
113
+ suppositions = suppositionsFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
114
+ signature = signatureFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
115
+ hypotheses = [],
116
+ node = theoremNode, ///
117
+ string = stringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
118
+ theorem = new Theorem(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses);
119
+
120
+ return theorem;
121
+ }
122
+
123
+ export function conjectureromAxiomNode(conjectureNode, context) {
124
+ const { Conjecture } = elements,
125
+ axiomLemmaTheoremConjectureNode = conjectureNode, ///
126
+ proof = proofFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
127
+ labels = labelsFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
128
+ deduction = deductionFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
129
+ suppositions = suppositionsFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
130
+ signature = signatureFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
131
+ hypotheses = [],
132
+ node = conjectureNode, ///
133
+ string = stringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
134
+ conjecture = new Conjecture(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses);
135
+
136
+ return conjecture;
137
+ }
138
+
139
+ export function equalityFromEqualityNode(equalityNode, context) {
140
+ const { Equality } = elements,
141
+ node = equalityNode, ///
142
+ string = context.nodeAsString(node),
143
+ leftTermNode = equalityNode.getLeftTermNode(),
144
+ rightTermNode = equalityNode.getRightTermNode(),
145
+ leftTerm = termFromTermNode(leftTermNode, context),
146
+ rightTerm = termFromTermNode(rightTermNode, context),
147
+ equality = new Equality(string, leftTerm, rightTerm);
148
+
149
+ return equality;
150
+ }
151
+
152
+ export function metaTypeFromMetaTypeNode(metaTypeNode, context) {
153
+ const { MetaType } = elements,
154
+ node = metaTypeNode, ///
155
+ string = context.nodeAsString(node),
156
+ metaTypeName = metaTypeNode.getMetaTypeName(),
157
+ name = metaTypeName, ///
158
+ metaType = new MetaType(string, node, name);
159
+
160
+ return metaType;
161
+ }
162
+
163
+ export function propertyFromPropertyNode(propertyNode, context) {
164
+ const { Property } = elements,
165
+ node = propertyNode, ///
166
+ string = context.nodeAsString(node),
167
+ propertyName = propertyNode.getPropertyName(),
168
+ nominalTypeName = null,
169
+ name = propertyName, ///
170
+ property = new Property(string, node, name, nominalTypeName);
171
+
172
+ return property;
173
+ }
174
+
175
+ export function variableFromVariableNode(variableNode, context) {
176
+ const { Variable } = elements,
177
+ node = variableNode, ///
178
+ string = context.nodeAsString(node),
179
+ type = null,
180
+ identifier = identifierFromVarialbeNode(variableNode, context),
181
+ propertyRelations = [],
182
+ variable = new Variable(string, node, type, identifier, propertyRelations);
183
+
184
+ return variable;
185
+ }
186
+
187
+ export function subproofFromSubproofNode(subproofNode, context) {
188
+ const { SubProof } = elements,
189
+ node = subproofNode, ///
190
+ suppositions = suppositionsFromSubproofNode(subproofNode, context),
191
+ subDerivation = subDerivationFromSubproofNode(subproofNode, context),
192
+ subproofString = subproofStringFromSubproofNode(subproofNode, context),
193
+ string = subproofString, ///
194
+ subproof = new SubProof(string, node, suppositions, subDerivation);
195
+
196
+ return subproof;
197
+ }
198
+
199
+ export function equalityFromStatementNode(statementNode, context) {
200
+ let equality = null;
201
+
202
+ const equalityNode = statementNode.getEqualityNode();
203
+
204
+ if (equalityNode !== null) {
205
+ const node = equalityNode, ///
206
+ string = context.nodeAsString(node),
207
+ leftTerm = leftTermFromEqualityNode(equalityNode, context),
208
+ rightTerm = rightTermFromEqualityNode(equalityNode, context);
209
+
210
+ equality = new Equality(context, string, node, leftTerm, rightTerm);
211
+ }
212
+
213
+ return equality;
214
+ }
215
+
216
+ export function deductionFromDeductionNode(deductionNode, context) {
217
+ const { Deduction } = elements,
218
+ node = deductionNode, ///
219
+ string = context.nodeAsString(node),
220
+ statement = statementFromDeductionNode(deductionNode, context),
221
+ deduction = new Deduction(context, string, node, statement);
222
+
223
+ return deduction;
224
+ }
225
+
226
+ export function statementFromStatementNode(statementNode, context) {
227
+ const { Statement } = elements,
228
+ node = statementNode, ///
229
+ string = context.nodeAsString(node),
230
+ statement = new Statement(string, node);
231
+
232
+ return statement;
233
+ }
234
+
235
+ export function signatureFromSignatureNode(signatureNode, context) {
236
+ const { Signature } = elements,
237
+ node = signatureNode, ///
238
+ string = context.nodeAsString(node),
239
+ terms = termsFromSignatureNode(signatureNode, context),
240
+ signature = new Signature(string, node, terms);
241
+
242
+ return signature;
243
+ }
244
+
245
+ export function referenceFromReferenceNode(referenceNode, context) {
246
+ const { Reference } = elements,
247
+ node = referenceNode, ///
248
+ string = context.nodeAsString(node),
249
+ metavariable = metavariableFromReferenceNode(referenceNode, context),
250
+ reference = new Reference(string, node, metavariable);
251
+
252
+ return reference;
253
+ }
254
+
255
+ export function conclusinoFromConclusionNode(conclusinoNode, context) {
256
+ const { Conclusion } = elements,
257
+ node = conclusinoNode, ///
258
+ string = context.nodeAsString(node),
259
+ statement = statementFromConclusionNode(conclusinoNode, context),
260
+ conclusino = new Conclusion(context, string, node, statement);
261
+
262
+ return conclusino;
263
+ }
264
+
265
+ export function assumptionFromAssumptionNode(assumptionNode, context) {
266
+ const { Assumption } = elements,
267
+ node = assumptionNode, ///
268
+ string = context.nodeAsString(node),
269
+ statement = statementFromAssumptionNode(assumptionNode, context),
270
+ reference = referenceFromAssumptionNode(assumptionNode, context),
271
+ assumption = new Assumption(string, node, statement, reference);
272
+
273
+ return assumption;
274
+ }
275
+
276
+ export function derivationFromDerivationNode(derivationNode, context) {
277
+ const { Derivation } = elements,
278
+ node = derivationNode, ///
279
+ string = null,
280
+ stepsOrSubproofs = stepsOrSubproofsFromDerivationNode(derivationNode, context),
281
+ derivation = new Derivation(string, node, stepsOrSubproofs);
282
+
283
+ return derivation;
284
+ }
285
+
286
+ export function typePrefixFromTypePrefixNode(typePrefixNode, context) {
287
+ const { TypePrefix } = elements,
288
+ node = typePrefixNode, ///
289
+ string = context.nodeAsString(node),
290
+ term = termFromTypePrefixNode(typePrefixNode, context),
291
+ type = typeFromTypePrefixNode(typePrefixNode, context),
292
+ typePrefix = new TypePrefix(string, node, term, type);
293
+
294
+ return typePrefix;
295
+ }
296
+
297
+ export function metavariableFromMetavariableNode(metavariableNode, context) {
298
+ const { Metavariable } = elements,
299
+ node = metavariableNode, ///
300
+ string = context.nodeAsString(node),
301
+ metavariableName = metavariableNode.getMetavariableName(),
302
+ name = metavariableName, ///
303
+ type = null,
304
+ metaType = null,
305
+ metavariable = new Metavariable(string, node, name, type, metaType);
306
+
307
+ return metavariable;
308
+ }
309
+
310
+ export function subDerivationFromSubDerivationNode(subDerivationNode, context) {
311
+ const { SubDerivation } = elements,
312
+ node = subDerivationNode, ///
313
+ string = null,
314
+ stepsOrSubproofs = stepsOrSubproofsFromSubDerivationNode(subDerivationNode, context),
315
+ subDerivation = new SubDerivation(string, node, stepsOrSubproofs);
316
+
317
+ return subDerivation;
318
+
319
+ }
320
+
321
+ export function typeAssertionFromTypeAssertionNode(typeAssertionNode, context) {
322
+ const { TypeAssertion } = elements,
323
+ node = typeAssertionNode, ///
324
+ string = context.nodeAsString(node),
325
+ term = termFromTypeAssertionNode(typeAssertionNode, context),
326
+ type = typeFromTypeAssertionNode(typeAssertionNode, context),
327
+ typeAssertion = new TypeAssertion(string, node, term, type);
328
+
329
+ return typeAssertion;
330
+ }
331
+
332
+ export function stepsOrSubproofFromStepOrSubproofNode(stepOrSubproofNode, context) {
333
+ const step = stepFromStepOrSubproofNode(stepOrSubproofNode, context),
334
+ subproof = subproofFromStepOrSubproofNode(stepOrSubproofNode, context),
335
+ stepOrSubproof = (step || subproof);
336
+
337
+ return stepOrSubproof;
338
+ }
339
+
340
+ export function prefixedFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context) {
341
+ const prefixed = simpleTypeDeclarationNode.isPrefixed();
342
+
343
+ return prefixed;
344
+ }
345
+
346
+ export function prefixedFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
347
+ const prefixed = complexTypeDeclarationNode.isPrefixed();
348
+
349
+ return prefixed;
350
+ }
351
+
352
+ export function definedAssertionFromDefinedAssertionNode(definedAssertionNode, context) {
353
+ const { DefinedAssertion } = elements,
354
+ node = definedAssertionNode, ///
355
+ string = context.nodeAsString(node),
356
+ negated = definedAssertionNode.isNegated(),
357
+ term = termFromDefinedAssertionNode(definedAssertionNode, context),
358
+ frame = frameFromDefinedAssertionNode(definedAssertionNode, context),
359
+ definedAssertion = new DefinedAssertion(string, node, term, frame, negated);
360
+
361
+ return definedAssertion;
362
+ }
363
+
364
+ export function propertyRelationFromPropertyRelationNode(propertyRelationNode, context) {
365
+ const { PropertyRelation } = elements,
366
+ node = propertyRelationNode, ///
367
+ string = context.nodeAsString(node),
368
+ property = propertyFromPropertyRelationNode(propertyRelationNode, context),
369
+ term = termFromPropertyRelationNode(propertyRelationNode, context),
370
+ propertyRelation = new PropertyRelation(string, node, property, term);
371
+
372
+ return propertyRelation;
373
+ }
374
+
375
+ export function termSubstitutionFromTermSubstitutionNode(termSubstitutionNode, context) {
376
+ const { TermSubstitution } = elements,
377
+ node = termSubstitutionNode, ///
378
+ string = context.nodeAsString(node),
379
+ term = termFromTermSubstitutionNode(termSubstitutionNode, context),
380
+ variable = variableFromTermSubstitutionNode(termSubstitutionNode, context),
381
+ termSubstitution = new TermSubstitution(context, string, node, term, variable);
382
+
383
+ return termSubstitution;
384
+ }
385
+
386
+ export function frameSubstitutionFromFrameSubstitutionNode(frameSubstitutionNode, context) {
387
+ const { FrameSubstitution } = elements,
388
+ node = frameSubstitutionNode, ///
389
+ string = context.nodeAsString(node),
390
+ frame = frameFromFrameSubstitutionNode(frameSubstitutionNode, context),
391
+ metavariable = metavariableFromFrameSubstitutionNode(frameSubstitutionNode, context),
392
+ frameSubstitution = new FrameSubstitution(context, string, node, frame, metavariable);
393
+
394
+ return frameSubstitution;
395
+ }
396
+
397
+ export function propertyAssertionFromPropertyAssertionNode(propertyAssertionNode, context) {
398
+ const { PropertyAssertion } = elements,
399
+ node = propertyAssertionNode, ///
400
+ string = context.nodeAsString(node),
401
+ term = termFromPropertyAssertionNode(propertyAssertionNode, context),
402
+ propertyRelation = propertyRelationFromPropertyAssertionNode(propertyAssertionNode, context),
403
+ propertyAssertion = new PropertyAssertion(string, node, term, propertyRelation);
404
+
405
+ return propertyAssertion;
406
+ }
407
+
408
+ export function subproofAssertionFromSubproofAssertionNode(subproofAssertionNode, context) {
409
+ const { SubproofAssertion } = elements,
410
+ node = subproofAssertionNode, ///
411
+ string = context.nodeAsString(node),
412
+ statements = statementsFromSubproofAssertionNode(subproofAssertionNode, context),
413
+ subproofAssertion = new SubproofAssertion(string, node, statements);
414
+
415
+ return subproofAssertion;
416
+ }
417
+
418
+ export function containedAssertionFromContainedAssertionNode(containedAssertionNode, context) {
419
+ const { ContainedAssertion } = elements,
420
+ node = containedAssertionNode, ///
421
+ string = context.nodeAsString(node),
422
+ negated = containedAssertionNode.isNegated(),
423
+ term = termFromContainedAssertionNode(containedAssertionNode, context),
424
+ frame = frameFromContainedAssertionNode(containedAssertionNode, context),
425
+ statement = statementFromContainedAssertionNode(containedAssertionNode, context),
426
+ containedAssertion = new ContainedAssertion(string, node, term, frame, negated, statement);
427
+
428
+ return containedAssertion;
429
+ }
430
+
431
+ export function satisfiesAssertionFromSatisfiesAssertionNode(satisfiesAssertionNode, context) {
432
+ const { SatisfiesAssertion } = elements,
433
+ node = satisfiesAssertionNode, ///
434
+ string = context.nodeAsString(node),
435
+ signature = signatureFromSatisfiesAssertionNode(satisfiesAssertionNode, context),
436
+ reference = referenceFromSatisfiesAssertionNode(satisfiesAssertionNode, context),
437
+ satisfiesAssertion = new SatisfiesAssertion(string, node, signature, reference);
438
+
439
+ return satisfiesAssertion;
440
+ }
441
+
442
+ export function variableDeclarationFromVariableDeclarationNode(variableDeclarationNode, context) {
443
+ const { VariableDeclaration } = elements,
444
+ node = variableDeclarationNode, ///
445
+ string = context.nodeAsString(node),
446
+ varialbe = variableFromVariableNode(variableDeclarationNode, context),
447
+ variableDeclaration = new VariableDeclaration(context, string, node, varialbe);
448
+
449
+ return variableDeclaration;
450
+ }
451
+
452
+ export function typePrefixDeclarationFromTypePrefixDeclarationNode(typePrefixDeclarationNode, context) {
453
+ const { TypePrefixDeclaration } = elements,
454
+ node = typePrefixDeclarationNode, ///
455
+ string = context.nodeAsString(node), ///
456
+ typePrefix = typePrefixFromTypePrefixDeclarationNode(typePrefixDeclarationNode, context),
457
+ typePrefixDeclaration = new TypePrefixDeclaration(context, string, node, typePrefix);
458
+
459
+ return typePrefixDeclaration;
460
+ }
461
+
462
+ export function combinatorDeclarationFromCombinatorDeclarationNode(combinatorDeclarationNode, context) {
463
+ const { CombinatorDeclaration } = elements,
464
+ node = combinatorDeclarationNode, ///
465
+ string = context.nodeAsString(node),
466
+ combinator = combinatorFromCombinatorDeclarationNode(combinatorDeclarationNode, context),
467
+ combinatorDeclaration = new CombinatorDeclaration(context, string, node, combinator);
468
+
469
+ return combinatorDeclaration;
470
+ }
471
+
472
+ export function simpleTypeDeclarationFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context) {
473
+ const { SimpleTypeDeclaration } = elements,
474
+ node = simpleTypeDeclarationNode, ///
475
+ string = context.nodeAsString(node),
476
+ type = typeFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context),
477
+ prefixed = prefixedFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context),
478
+ simpleTypeDeclaration = new SimpleTypeDeclaration(context, string, node, type, prefixed);
479
+
480
+ return simpleTypeDeclaration;
481
+ }
482
+
483
+ export function statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, substitution, context) {
484
+ if (context === undefined) {
485
+ context = substitution; ///
486
+
487
+ substitution = null;
488
+ }
489
+
490
+ const { StatementSubstitution } = elements,
491
+ node = statementSubstitutionNode, ///
492
+ string = context.nodeAsString(node),
493
+ resolved = true,
494
+ statement = statementFromStatementSubstitutionNode(statementSubstitutionNode, context),
495
+ metavariable = metavariableFromStatementSubstitutionNode(statementSubstitutionNode, context),
496
+ statementSubstitution = new StatementSubstitution(context, string, node, resolved, statement, metavariable, substitution);
497
+
498
+ return statementSubstitution;
499
+ }
500
+
501
+ export function referenceSubstitutionFromReferenceSubstitutionNode(referenceSubstitutionNode, context) {
502
+ const { ReferenceSubstitution } = elements,
503
+ node = referenceSubstitutionNode, ///
504
+ string = context.nodeAsString(node),
505
+ reference = referenceFromReferenceSubstitutionNode(referenceSubstitutionNode, context),
506
+ metavariable = metavariableFromReferenceSubstitutionNode(referenceSubstitutionNode, context),
507
+ referenceSubstitution = new ReferenceSubstitution(context, string, node, reference, metavariable);
508
+
509
+ return referenceSubstitution;
510
+ }
511
+
512
+ export function constructorDeclarationFromConstructorDeclarationNode(constructorDeclarationNode, context) {
513
+ const { ConstructorDeclaration } = elements,
514
+ node = constructorDeclarationNode, ///
515
+ string = context.nodeAsString(node),
516
+ constructor = constructorFromConstructorDeclarationNode(constructorDeclarationNode, context),
517
+ constructorDeclaration = new ConstructorDeclaration(context, string, node, constructor);
518
+
519
+ return constructorDeclaration;
520
+ }
521
+
522
+ export function complexTypeDeclarationFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
523
+ const { ComplexTypeDeclaration } = elements,
524
+ node = complexTypeDeclarationNode, ///
525
+ string = context.nodeAsString(node),
526
+ type = typeFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
527
+ prefixed = prefixedFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
528
+ complexTypeDeclaration = new ComplexTypeDeclaration(context, string, node, type, prefixed);
529
+
530
+ return complexTypeDeclaration;
531
+ }
532
+
533
+ export function metavariableDeclarationFromMetavariableDeclarationNode(metavariableDeclarationNode, context) {
534
+ const { MetavariableDeclaration } = elements,
535
+ node = metavariableDeclarationNode, ///
536
+ string = context.nodeAsString(node),
537
+ metavarialbe = metavariableFromMetavariableNode(metavariableDeclarationNode, context),
538
+ metavariableDeclaration = new MetavariableDeclaration(context, string, node, metavarialbe);
539
+
540
+ return metavariableDeclaration;
541
+ }
542
+
543
+ export function statementFromStepNode(stepNode, context) {
544
+ let statement = null;
545
+
546
+ const statementNode = stepNode.getStatementNode();
547
+
548
+ if (statementNode !== null) {
549
+ statement = statementFromStatementNode(statementNode, context);
550
+ }
551
+
552
+ return statement;
553
+ }
554
+
555
+ export function referenceFromStepNode(stepNode, context) {
556
+ let reference = null;
557
+
558
+ const referenceNode = stepNode.getReferenceNode();
559
+
560
+ if (referenceNode !== null) {
561
+ reference = referenceFromReferenceNode(referenceNode, context);
562
+ }
563
+
564
+ return reference;
565
+ }
566
+
567
+ export function derivationFromProofNode(proofNode, context) {
568
+ let derivation = null;
569
+
570
+ const derivationNode = proofNode.getDerivationNode();
571
+
572
+ if (derivationNode !== null) {
573
+ derivation = derivationFromDerivationNode(derivationNode, context);
574
+ }
575
+
576
+ return derivation;
577
+ }
578
+
579
+ export function termFromTypeAssertionNode(typeAssertionNode, context) {
580
+ let term = null;
581
+
582
+ const termNode = typeAssertionNode.getTermNode();
583
+
584
+ if (termNode !== null) {
585
+ term = termFromTermNode(termNode, context);
586
+ }
587
+
588
+ return term;
589
+ }
590
+
591
+ export function typeFromTypeAssertionNode(typeAssertionNode, context) {
592
+ let type = null;
593
+
594
+ const typeNode = typeAssertionNode.getTypeNode();
595
+
596
+ if (typeNode !== null) {
597
+ type = typeFromTypeNode(typeNode, context);
598
+ }
599
+
600
+ return type;
601
+ }
602
+
603
+ export function stepFromStepOrSubproofNode(stepOrSubproofNode, context) {
604
+ let step = null;
605
+
606
+ const stepOrSubproofNodeStepNode = stepOrSubproofNode.isStepNode();
607
+
608
+ if (stepOrSubproofNodeStepNode) {
609
+ const stepNode = stepOrSubproofNode; ///
610
+
611
+ step = stepFromStepNode(stepNode, context);
612
+ }
613
+
614
+ return step;
615
+ }
616
+
617
+ export function identifierFromVarialbeNode(variableNode, context) {
618
+ const variableIdentifier = variableNode.getVariableIdentifier(),
619
+ identifier = variableIdentifier; ///
620
+
621
+ return identifier;
622
+ }
623
+
624
+ export function statementFromDeductionNode(deductionNode, context) {
625
+ let statement = null;
626
+
627
+ const statementNode = deductionNode.getStatementNode();
628
+
629
+ if (statementNode !== null) {
630
+ statement = statementFromStatementNode(statementNode, context);
631
+ }
632
+
633
+ return statement;
634
+ }
635
+
636
+ export function statementFromConclusionNode(conclusinoNode, context) {
637
+ let statement = null;
638
+
639
+ const statementNode = conclusinoNode.getStatementNode();
640
+
641
+ if (statementNode !== null) {
642
+ statement = statementFromStatementNode(statementNode, context);
643
+ }
644
+
645
+ return statement;
646
+ }
647
+
648
+ export function statementFromAssumptionNode(assumptionNode, context) {
649
+ let statement = null;
650
+
651
+ const statementNode = assumptionNode.getStatementNode();
652
+
653
+ if (statementNode !== null) {
654
+ statement = statementFromStatementNode(statementNode, context);
655
+ }
656
+
657
+ return statement;
658
+ }
659
+
660
+ export function referenceFromAssumptionNode(assumptionNode, context) {
661
+ let reference = null;
662
+
663
+ const referenceNode = assumptionNode.getReferenceNode();
664
+
665
+ if (referenceNode !== null) {
666
+ reference = referenceFromReferenceNode(referenceNode, context);
667
+ }
668
+
669
+ return reference;
670
+ }
671
+
672
+ export function assumptionFromJudgementNode(judgementNode, context) {
673
+ let assumption = null;
674
+
675
+ const assumptionNode = judgementNode.getAssumptionNode();
676
+
677
+ if (assumptionNode !== null) {
678
+ assumption = assumptionFromAssumptionNode(assumptionNode, context);
679
+ }
680
+
681
+ return assumption;
682
+ }
683
+
684
+ export function termFromDefinedAssertionNode(definedAssertionNode, context) {
685
+ let term = null;
686
+
687
+ const termNode = definedAssertionNode.getTermNode();
688
+
689
+ if (termNode !== null) {
690
+ term = termFromTermNode(termNode, context);
691
+ }
692
+
693
+ return term;
694
+ }
695
+
696
+ export function termFromPropertyRelationNode(propertyRelationNode, context) {
697
+ let term = null;
698
+
699
+ const termNode = propertyRelationNode.getTermNode();
700
+
701
+ if (termNode !== null) {
702
+ term = termFromTermNode(termNode, context);
703
+ }
704
+
705
+ return term;
706
+ }
707
+
708
+ export function termFromTermSubstitutionNode(termSubstitutionNode, context) {
709
+ let term = null;
710
+
711
+ const termNode = termSubstitutionNode.getTermNode();
712
+
713
+ if (termNode !== null) {
714
+ term = termFromTermNode(termNode, context);
715
+ }
716
+
717
+ return term;
718
+ }
719
+
720
+ export function subDerivationFromSubproofNode(subproofNode, context) {
721
+ let subDerviation = null;
722
+
723
+ const subDerivationNode = subproofNode.getSubDerivationNode();
724
+
725
+ if (subDerivationNode !== null) {
726
+ subDerviation = subDerivationFromSubDerivationNode(subDerivationNode, context);
727
+ }
728
+
729
+ return subDerviation;
730
+ }
731
+
732
+ export function typeAssertinFromStatementNode(statementNode, context) {
733
+ let typeAssertion = null;
734
+
735
+ const typeAssertionNode = statementNode.getTypeAssertionNode();
736
+
737
+ if (typeAssertionNode !== null) {
738
+ typeAssertion = typeAssertionFromTypeAssertionNode(typeAssertionNode, context);
739
+ }
740
+
741
+ return typeAssertion;
742
+ }
743
+
744
+ export function metavariableFromReferenceNode(referenceNode, context) {
745
+ let metavariable = null;
746
+
747
+ const metavariableNode = referenceNode.getTermNode();
748
+
749
+ if (metavariableNode !== null) {
750
+ metavariable = metavariableFromMetavaraibleNode(metavariableNode, context);
751
+ }
752
+
753
+ return metavariable;
754
+ }
755
+
756
+ export function frameFromDefinedAssertionNode(definedAssertionNode, context) {
757
+ let frame = null;
758
+
759
+ const frameNode = definedAssertionNode.getTermNode();
760
+
761
+ if (frameNode !== null) {
762
+ frame = frameFromFrameNode(frameNode, context);
763
+ }
764
+
765
+ return frame;
766
+ }
767
+
768
+ export function termFromPropertyAssertionNode(propertyAssertionNode, context) {
769
+ let term = null;
770
+
771
+ const termNode = propertyAssertionNode.getTermNode();
772
+
773
+ if (termNode !== null) {
774
+ term = termFromTermNode(termNode, context);
775
+ }
776
+
777
+ return term;
778
+ }
779
+
780
+ export function frameFromFrameSubstitutionNode(frameSubstitutionNode, context) {
781
+ let frame = null;
782
+
783
+ const frameNode = frameSubstitutionNode.getFrameNode();
784
+
785
+ if (frameNode !== null) {
786
+ frame = frameFromFrameNode(frameNode, context);
787
+ }
788
+
789
+ return frame;
790
+ }
791
+
792
+ export function satisfiesAssertionFromStepNode(stepNode, context) {
793
+ let satisfiesAssertion = null;
794
+
795
+ const satisfiesAssertionNode = stepNode.getSatisfiedAssertionNode();
796
+
797
+ if (satisfiesAssertionNode !== null) {
798
+ satisfiesAssertion = satisfiesAssertionFromSatisfiesAssertionNode(satisfiesAssertionNode, context);
799
+ }
800
+
801
+ return satisfiesAssertion;
802
+ }
803
+
804
+ export function subproofFromStepOrSubproofNode(subproofOrSubproofNode, context) {
805
+ let subproof = null;
806
+
807
+ const subproofOrSubproofNodeSubproofNode = subproofOrSubproofNode.isSubproofNode();
808
+
809
+ if (subproofOrSubproofNodeSubproofNode) {
810
+ const subproofNode = subproofOrSubproofNode; ///
811
+
812
+ subproof = subproofFromSubproofNode(subproofNode, context);
813
+ }
814
+
815
+ return subproof;
816
+ }
817
+
818
+ export function termFromContainedAssertionNode(containedAssertionNode, context) {
819
+ let term = null;
820
+
821
+ const termNode = containedAssertionNode.getTermNode();
822
+
823
+ if (termNode !== null) {
824
+ term = termFromTermNode(termNode, context);
825
+ }
826
+
827
+ return term;
828
+ }
829
+
830
+ export function frameFromContainedAssertionNode(containedAssertionNode, context) {
831
+ let frame = null;
832
+
833
+ const frameNode = containedAssertionNode.getFrameNode();
834
+
835
+ if (frameNode !== null) {
836
+ frame = frameFromFrameNode(frameNode, context)
837
+ }
838
+
839
+ return frame;
840
+ }
841
+
842
+ export function propertyFromPropertyRelationNode(propertyRelationNode, context) {
843
+ let property = null;
844
+
845
+ const propertyNode = propertyRelationNode.getTermNode();
846
+
847
+ if (propertyNode !== null) {
848
+ property = propertyFromPropertyNode(propertyNode, context);
849
+ }
850
+
851
+ return property;
852
+ }
853
+
854
+ export function variableFromTermSubstitutionNode(termSubstitutionNode, context) {
855
+ let variable = null;
856
+
857
+ const variableNode = termSubstitutionNode.getMetavariableNode();
858
+
859
+ if (variableNode !== null) {
860
+ variable = variableFromVariableNode(variableNode, context);
861
+ }
862
+
863
+ return variable;
864
+ }
865
+
866
+ export function definedAssertionFromStatementNode(statementNode, context) {
867
+ let definedAssertion = null;
868
+
869
+ const definedAssertionNode = statementNode.getDefinedAssertionNode();
870
+
871
+ if (definedAssertionNode !== null) {
872
+ definedAssertion = definedAssertionFromDefinedAssertionNode(definedAssertionNode, context);
873
+ }
874
+
875
+ return definedAssertion;
876
+ }
877
+
878
+ export function typeFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context) {
879
+ let type = null;
880
+
881
+ const typeNode = simpleTypeDeclarationNode.getTypeNode();
882
+
883
+ if (typeNode !== null) {
884
+ type = typeFromTypeNode(typeNode, context);
885
+ }
886
+
887
+ return type;
888
+ }
889
+
890
+ export function termSubstitutionFromStatementNode(statementNode, context) {
891
+ let termSubstitution = null;
892
+
893
+ const termSubstitutionNode = statementNode.getTermSubstitutionNode();
894
+
895
+ if (termSubstitutionNode !== null) {
896
+ termSubstitution = termSubstitutionFromTermSubstitutionNode(termSubstitutionNode, context);
897
+ }
898
+
899
+ return termSubstitution;
900
+ }
901
+
902
+ export function frameSubstitutionFromStatementNode(statementNode, context) {
903
+ let frameSubstitution = null;
904
+
905
+ const frameSubstitutionNode = statementNode.getFrameSubstitutionNode();
906
+
907
+ if (frameSubstitutionNode !== null) {
908
+ frameSubstitution = frameSubstitutionFromFrameSubstitutionNode(frameSubstitutionNode, context);
909
+ }
910
+
911
+ return frameSubstitution;
912
+ }
913
+
914
+ export function stepsOrSubproofsFromDerivationNode(derivationNode, context) {
915
+ const stepOrSubproofNodes = derivationNode.getStepOrSubproofNodes(),
916
+ stepsOrSubproofs = stepOrSubproofNodes.map((stepOrSubproofNode) => {
917
+ const stepOrSubproof = stepsOrSubproofFromStepOrSubproofNode(stepOrSubproofNode, context);
918
+
919
+ return stepOrSubproof;
920
+ });
921
+
922
+ return stepsOrSubproofs;
923
+ }
924
+
925
+ export function propertyAssertionFromStatementNode(statementNode, context) {
926
+ let propertyAssertion = null;
927
+
928
+ const propertyAssertionNode = statementNode.getPropertyAssertionNode();
929
+
930
+ if (propertyAssertionNode !== null) {
931
+ propertyAssertion = propertyAssertionFromPropertyAssertionNode(propertyAssertionNode, context);
932
+ }
933
+
934
+ return propertyAssertion;
935
+ }
936
+
937
+ export function subproofAssertionFromStatementNode(statementNode, context) {
938
+ let subproofAssertion = null;
939
+
940
+ const subproofAssertionNode = statementNode.getSubproofAssertionNode();
941
+
942
+ if (subproofAssertionNode !== null) {
943
+ subproofAssertion = subproofAssertionFromSubproofAssertionNode(subproofAssertionNode, context);
944
+ }
945
+
946
+ return subproofAssertion;
947
+ }
948
+
949
+ export function typeFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
950
+ let type = null;
951
+
952
+ const typeNode = complexTypeDeclarationNode.getTypeNode();
953
+
954
+ if (typeNode !== null) {
955
+ type = typeFromTypeNode(typeNode, context);
956
+ }
957
+
958
+ return type;
959
+ }
960
+
961
+ export function containedAssertionFromStatementNode(statementNode, context) {0
962
+ let containedAssertion = null;
963
+
964
+ const containedAssertionNode = statementNode.getContainedAssertionNode();
965
+
966
+ if (containedAssertionNode !== null) {
967
+ containedAssertion = containedAssertionFromContainedAssertionNode(containedAssertionNode, context);
968
+ }
969
+
970
+ return containedAssertion;
971
+ }
972
+
973
+ export function statementFromContainedAssertionNode(containedAssertionNode, context) {
974
+ let statement = null;
975
+
976
+ const statementNode = containedAssertionNode.getStatementNode();
977
+
978
+ if (statementNode !== null) {
979
+ statement = statementFromStatementNode(statementNode, context);
980
+ }
981
+
982
+ return statement;
983
+ }
984
+
985
+ export function satisfiesAssertionFromStatementNode(statementNode, context) {
986
+ let satisfiesAssertion = null;
987
+
988
+ const satisfiesAssertionNode = statementNode.getSatisfiedAssertionNode();
989
+
990
+ if (satisfiesAssertionNode !== null) {
991
+ satisfiesAssertion = satisfiesAssertionFromSatisfiesAssertionNode(satisfiesAssertionNode, context);
992
+ }
993
+
994
+ return satisfiesAssertion;
995
+ }
996
+
997
+ export function propertyFromPropertyDeclarationNode(propertyDeclarationNode, context) {
998
+ let property = null;
999
+
1000
+ const propertyNode = propertyDeclarationNode.getPropertyNode();
1001
+
1002
+ if (propertyNode !== null) {
1003
+ property = propertyFromPropertyNode(propertyNode, context);
1004
+ }
1005
+
1006
+ return property;
1007
+ }
1008
+
1009
+ export function signatureFromSatisfiesAssertionNode(satisfiesAssertionNode, context) {
1010
+ let signature = null;
1011
+
1012
+ const signatureNode = satisfiesAssertionNode.getSignatureNode();
1013
+
1014
+ if (signatureNode !== null) {
1015
+ signature = signatureFromSignatureNode(signatureNode, context);
1016
+ }
1017
+
1018
+ return signature;
1019
+ }
1020
+
1021
+ export function referenceFromSatisfiesAssertionNode(satisfiesAssertionNode, context) {
1022
+ let reference = null;
1023
+
1024
+ const referenceNode = satisfiesAssertionNode.getReferenceNode();
1025
+
1026
+ if (referenceNode !== null) {
1027
+ reference = referenceFromReferenceNode(referenceNode, context);
1028
+ }
1029
+
1030
+ return reference;
1031
+ }
1032
+
1033
+ export function variableFromVariableDeclarationNode(variableDeclarationNode, context) {
1034
+ let variable = null;
1035
+
1036
+ const variableNode = variableDeclarationNode.getVariableNode();
1037
+
1038
+ if (variableNode !== null) {
1039
+ variable = variableFromVariableNode(variableNode, context);
1040
+ }
1041
+
1042
+ return variable;
1043
+ }
1044
+
1045
+ export function stepsOrSubproofsFromSubDerivationNode(subDerivationNode, context) {
1046
+ const stepOrSubproofNodes = subDerivationNode.getStepOrSubproofNodes(),
1047
+ stepsOrSubproofs = stepOrSubproofNodes.map((stepOrSubproofNode) => {
1048
+ const stepOrSubproof = stepsOrSubproofFromStepOrSubproofNode(stepOrSubproofNode, context);
1049
+
1050
+ return stepOrSubproof;
1051
+ });
1052
+
1053
+ return stepsOrSubproofs;
1054
+ }
1055
+
1056
+ export function metavariableFromFrameSubstitutionNode(frameSubstitutionNode, context) {
1057
+ let metavariable = null;
1058
+
1059
+ const metavariableNode = frameSubstitutionNode.getMetavariableNode();
1060
+
1061
+ if (metavariableNode !== null) {
1062
+ metavariable = metavariableFromMetavariableNode(metavariableNode, context);
1063
+ }
1064
+
1065
+ return metavariable;
1066
+ }
1067
+
1068
+ export function statementFromStatementSubstitutionNode(statementSubstitutionNode, context) {
1069
+ let statement = null;
1070
+
1071
+ const statementNode = statementSubstitutionNode.getStatementNode();
1072
+
1073
+ if (statementNode !== null) {
1074
+ statement = statementFromStatementNode(statementNode, context);
1075
+ }
1076
+
1077
+ return statement;
1078
+ }
1079
+
1080
+ export function referenceFromReferenceSubstitutionNode(referenceSubstitutionNode, context) {
1081
+ let reference = null;
1082
+
1083
+ const referenceNode = referenceSubstitutionNode.getReferenceNode();
1084
+
1085
+ if (referenceNode !== null) {
1086
+ reference = referenceFromReferenceNode(referenceNode, context);
1087
+ }
1088
+
1089
+ return reference;
1090
+ }
1091
+
1092
+ export function typePrefixFromTypePrefixDeclarationNode(typePrefixDeclarationNode, context) {
1093
+ let typePrefix = null;
1094
+
1095
+ const typePrefixNode = typePrefixDeclarationNode.getTypePrefixNode();
1096
+
1097
+ if (typePrefixNode !== null) {
1098
+ typePrefix = typePrefixFromTypePrefixNode(typePrefixNode, context);
1099
+ }
1100
+
1101
+ return typePrefix;
1102
+ }
1103
+
1104
+ export function combinatorFromCombinatorDeclarationNode(combinatorDeclarationNode, context) {
1105
+ let combinator = null;
1106
+
1107
+ const statementNode = combinatorDeclarationNode.getStatementNode();
1108
+
1109
+ if (statementNode !== null) {
1110
+ const { Combinator } = elements,
1111
+ statement = statementFromStatementNode(statementNode, context);
1112
+
1113
+ combinator = new Combinator(statement);
1114
+ }
1115
+
1116
+ return combinator;
1117
+ }
1118
+
1119
+ export function metaTypeFromMetavariableDeclarationNode(metavariableDeclarationNode, context) {
1120
+ let metaType = null;
1121
+
1122
+ const metaTypeNode = metavariableDeclarationNode.getMetaTypeNode();
1123
+
1124
+ if (metaTypeNode !== null) {
1125
+ metaType = metaTypeFromMetaTypeNode(metaTypeNode, context);
1126
+ }
1127
+
1128
+ return metaType;
1129
+ }
1130
+
1131
+ export function propertyRelationFromPropertyAssertionNode(propertyAssertionNode, context) {
1132
+ let propertyRelation = null;
1133
+
1134
+ const propertyRelationNode = propertyAssertionNode.getPropertyRelationNode();
1135
+
1136
+ if (propertyRelationNode !== null) {
1137
+ propertyRelation = propertyRelationFromPropertyRelationNode(propertyRelationNode, context);
1138
+ }
1139
+
1140
+ return propertyRelation;
1141
+ }
1142
+
1143
+ export function constructorFromConstructorDeclarationNode(constructorDeclarationNode, context) {
1144
+ let constructor = null;
1145
+
1146
+ const termNode = constructorDeclarationNode.getStatementNode();
1147
+
1148
+ if (termNode !== null) {
1149
+ const { Constructor } = elements,
1150
+ term = termFromTermNode(termNode, context);
1151
+
1152
+ constructor = new Constructor(term);
1153
+ }
1154
+
1155
+ return constructor;
1156
+ }
1157
+
1158
+ export function metavariableFromStatementSubstitutionNode(statementSubstitutionNode, context) {
1159
+ let metavariable = null;
1160
+
1161
+ const metavariableNode = statementSubstitutionNode.getMetavariableNode();
1162
+
1163
+ if (metavariableNode !== null) {
1164
+ metavariable = metavariableFromMetavariableNode(metavariableNode, context);
1165
+ }
1166
+
1167
+ return metavariable;
1168
+ }
1169
+
1170
+ export function metavariableFromReferenceSubstitutionNode(referenceSubstitutionNode, context) {
1171
+ let metavariable = null;
1172
+
1173
+ const metavariableNode = referenceSubstitutionNode.getMetavariableNode();
1174
+
1175
+ if (metavariableNode !== null) {
1176
+ metavariable = metavariableFromMetavariableNode(metavariableNode, context);
1177
+ }
1178
+
1179
+ return metavariable;
1180
+ }
1181
+
1182
+ export function proofFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context) {
1183
+ let proof = null;
1184
+
1185
+ const proofNode = axiomLemmaTheoremConjectureNode.getProofNode();
1186
+
1187
+ if (proofNode !== null) {
1188
+ proof = proofFromProofNode(proofNode, context);
1189
+ }
1190
+
1191
+ return proof;
1192
+ }
1193
+
1194
+ export function metavariableFromMetavariableDeclarationNode(metavariableDeclarationNode, context) {
1195
+ let metavariable = null;
1196
+
1197
+ const metavariableNode = metavariableDeclarationNode.getMetavariableNode();
1198
+
1199
+ if (metavariableNode !== null) {
1200
+ metavariable = metavariableFromMetavariableNode(metavariableNode, context);
1201
+ }
1202
+
1203
+ return metavariable;
1204
+ }
1205
+
1206
+ export function deductionFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context) {
1207
+ let deduction = null;
1208
+
1209
+ const deductionNode = axiomLemmaTheoremConjectureNode.getDeductionNode();
1210
+
1211
+ if (deductionNode !== null) {
1212
+ deduction = deductionFromDeductionNode(deductionNode, context);
1213
+ }
1214
+
1215
+ return deduction;
1216
+ }
1217
+
1218
+ export function signatureFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context) {
1219
+ let signature = null;
1220
+
1221
+ const signatureNode = axiomLemmaTheoremConjectureNode.getSignatureNode();
1222
+
1223
+ if (signatureNode !== null) {
1224
+ signature = signatureFromSignatureNode(signatureNode, context);
1225
+ }
1226
+
1227
+ return signature;
1228
+ }
1229
+
1230
+ export function suppositionsFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context) {
1231
+ const suppositionNodes = axiomLemmaTheoremConjectureNode.getSuppositionNodes(),
1232
+ suppositions = suppositionsFromSuppositionNodes(suppositionNodes, context);
1233
+
1234
+ return suppositions;
1235
+ }
1236
+
1237
+ export function termsFromTermNodes(termNodes, context) {
1238
+ const terms = termNodes.map((termNode) => {
1239
+ const term = termFromTermNode(termNode, context);
1240
+
1241
+ return term;
1242
+ });
1243
+
1244
+ return terms;
1245
+ }
1246
+
1247
+ export function labelsFromLabelNodes(labelNodes, context) {
1248
+ const labels = labelNodes.map((labelNode) => {
1249
+ const label = labelFromLabelNode(labelNode, context);
1250
+
1251
+ return label;
1252
+ });
1253
+
1254
+ return labels;
1255
+ }
1256
+
1257
+ export function statementsFromStatementNodes(statementNodes, context) {
1258
+ const statements = statementNodes.map((statementNode) => {
1259
+ const statement = statementFromStatementNode(statementNode, context);
1260
+
1261
+ return statement;
1262
+ });
1263
+
1264
+ return statements;
1265
+ }
1266
+
1267
+ export function superTypesFromSuperTypeNodes(superTypeNodes, context) {
1268
+ const superTypes = superTypeNodes.map((superTypeNode) => {
1269
+ const typeNode = superTypeNode, ///
1270
+ type = typeFromTypeNode(typeNode, context),
1271
+ superType = type; ///
1272
+
1273
+ return superType;
1274
+ }),
1275
+ superTypesLength = superTypes.length;
1276
+
1277
+ if (superTypesLength === 0) {
1278
+ const superType = baseType; ///
1279
+
1280
+ superTypes.push(superType);
1281
+ }
1282
+
1283
+ return superTypes;
1284
+ }
1285
+
1286
+ export function assumptionsFromAssumptionNodes(assumptionNodes, context) {
1287
+ const assumptions = assumptionNodes.map((assumptionNode) => {
1288
+ const assumption = assumptionFromAssumptionNode(assumptionNode, context);
1289
+
1290
+ return assumption;
1291
+ });
1292
+
1293
+ return assumptions;
1294
+ }
1295
+
1296
+ export function suppositionsFromSuppositionNodes(suppositionNodes, context) {
1297
+ const suppositions = suppositionNodes.map((suppositionNode) => {
1298
+ const supposition = suppositionFromSuppositionNode(suppositionNode, context);
1299
+
1300
+ return supposition;
1301
+ });
1302
+
1303
+ return suppositions;
1304
+ }
1305
+
1306
+ export function propertiesFromPropertyDeclarationNodes(propertyDeclarationNodes, context) {
1307
+ const properties = propertyDeclarationNodes.map((propertyDeclarationNode) => {
1308
+ const property = propertyFromPropertyDeclarationNode(propertyDeclarationNode, context);
1309
+
1310
+ return property;
1311
+ });
1312
+
1313
+ return properties;
1314
+ }
1315
+
1316
+ export function termsFromSignatureNode(signatureNode, context) {
1317
+ const termNodes = signatureNode.getAssumptionNodes(),
1318
+ terms = termsFromTermNodes(termNodes, context);
1319
+
1320
+ return terms;
1321
+ }
1322
+
1323
+ export function assumptionsFromFrameNode(frameNode, context) {
1324
+ const assumptionNodes = frameNode.getAssumptionNodes(),
1325
+ assumptions = assumptionsFromAssumptionNodes(assumptionNodes, context);
1326
+
1327
+ return assumptions;
1328
+ }
1329
+
1330
+ export function suppositionsFromSubproofNode(subproofNode, context) {
1331
+ const suppositionNodes = subproofNode.getSuppositionNodes(),
1332
+ suppositions = suppositionsFromSuppositionNodes(suppositionNodes, context);
1333
+
1334
+ return suppositions;
1335
+ }
1336
+
1337
+ export function statementsFromSubproofAssertionNode(subproofAssertionNode, context) {
1338
+ const statementNodes = subproofAssertionNode.getStatementNodes(),
1339
+ statements = statementsFromStatementNodes(statementNodes, context);
1340
+
1341
+ return statements;
1342
+ }
1343
+
1344
+ export function propertiesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
1345
+ const propertyDeclarationNodes = complexTypeDeclarationNode.getPropertyDeclarationNodes(),
1346
+ properties = propertiesFromPropertyDeclarationNodes(propertyDeclarationNodes, context);
1347
+
1348
+ return properties;
1349
+ }
1350
+
1351
+ export function superTypesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
1352
+ const superTypeNodes = complexTypeDeclarationNode.getSuperTypeNodes(),
1353
+ superTypes = superTypesFromSuperTypeNodes(superTypeNodes, context);
1354
+
1355
+ return superTypes;
1356
+ }
1357
+
1358
+ export function labelsFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context) {
1359
+ const labelNodes = axiomLemmaTheoremConjectureNode.getLabelNodes(),
1360
+ labels = labelsFromLabelNodes(labelNodes, context);
1361
+
1362
+ return labels;
1363
+ }
1364
+
1365
+
1366
+
1367
+
1368
+ export function _typeFromMetavariableDeclarationNode(metavariableDeclarationNode, context) {
1369
+ let type = null;
1370
+
1371
+ const typeNode = metavariableDeclarationNode.getTypeNode();
1372
+
1373
+ if (typeNode !== null) {
1374
+ const nominalTypeName = typeNode.getNominalTypeName();
1375
+
1376
+ type = context.findTypeByNominalTypeName(nominalTypeName);
1377
+ }
1378
+
1379
+ return type;
1380
+ }