occam-verify-cli 1.0.388 → 1.0.404

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 (305) hide show
  1. package/lib/action/verify.js +3 -3
  2. package/lib/assignment/equality.js +2 -2
  3. package/lib/context/file.js +11 -11
  4. package/lib/context/local.js +38 -61
  5. package/lib/context/partial.js +10 -10
  6. package/lib/context/temporary.js +755 -0
  7. package/lib/mixins/statement/verify.js +38 -16
  8. package/lib/mixins/step/unify.js +7 -8
  9. package/lib/node/argument.js +4 -4
  10. package/lib/node/assertion/contained.js +6 -6
  11. package/lib/node/assertion/defined.js +6 -6
  12. package/lib/node/assertion/property.js +6 -6
  13. package/lib/node/assertion/satisfies.js +6 -6
  14. package/lib/node/assertion/subproof.js +6 -6
  15. package/lib/node/assertion/type.js +6 -6
  16. package/lib/node/assertion.js +107 -0
  17. package/lib/node/assumption.js +134 -0
  18. package/lib/node/axiom.js +6 -6
  19. package/lib/node/{topLevelAssertion.js → axiomLemmaTheoremConjecture.js} +12 -12
  20. package/lib/node/body.js +4 -5
  21. package/lib/node/combinator.js +4 -4
  22. package/lib/node/conclusion.js +4 -4
  23. package/lib/node/conjecture.js +6 -6
  24. package/lib/node/constructor.js +4 -4
  25. package/lib/node/declaration/combinator.js +6 -6
  26. package/lib/node/declaration/complexType.js +6 -6
  27. package/lib/node/declaration/constructor.js +6 -6
  28. package/lib/node/declaration/metavariable.js +6 -6
  29. package/lib/node/declaration/property.js +6 -6
  30. package/lib/node/declaration/simpleType.js +6 -6
  31. package/lib/node/declaration/typePrefix.js +6 -6
  32. package/lib/node/declaration/variable.js +6 -6
  33. package/lib/node/declaration.js +6 -22
  34. package/lib/node/deduction.js +4 -4
  35. package/lib/node/derivation.js +4 -4
  36. package/lib/node/document.js +107 -0
  37. package/lib/node/equality.js +4 -4
  38. package/lib/node/error.js +4 -4
  39. package/lib/node/frame.js +25 -14
  40. package/lib/node/header.js +4 -4
  41. package/lib/node/hypothesis.js +4 -4
  42. package/lib/node/judgement.js +8 -8
  43. package/lib/node/label.js +4 -4
  44. package/lib/node/labels.js +4 -4
  45. package/lib/node/lemma.js +6 -6
  46. package/lib/node/metaArgument.js +4 -4
  47. package/lib/node/metaLemma.js +6 -6
  48. package/lib/node/{topLevelMetaAssertion.js → metaLemmaMetaTheorem.js} +12 -12
  49. package/lib/node/metaType.js +4 -4
  50. package/lib/node/metatheorem.js +6 -6
  51. package/lib/node/metavariable.js +4 -4
  52. package/lib/node/nonsense.js +4 -4
  53. package/lib/node/parameter.js +4 -4
  54. package/lib/node/parenthesisedLabel.js +4 -4
  55. package/lib/node/parenthesisedLabels.js +4 -4
  56. package/lib/node/placeholder.js +107 -0
  57. package/lib/node/premise.js +4 -4
  58. package/lib/node/procedureCall.js +4 -4
  59. package/lib/node/procedureReference.js +4 -4
  60. package/lib/node/proof.js +4 -4
  61. package/lib/node/property.js +4 -4
  62. package/lib/node/propertyRelation.js +4 -4
  63. package/lib/node/qualification.js +4 -4
  64. package/lib/node/reference.js +4 -4
  65. package/lib/node/rule.js +4 -4
  66. package/lib/node/section.js +4 -4
  67. package/lib/node/signature.js +4 -4
  68. package/lib/node/statement.js +15 -4
  69. package/lib/node/step.js +4 -4
  70. package/lib/node/subDerivation.js +4 -4
  71. package/lib/node/subproof.js +4 -4
  72. package/lib/node/substitution/frame.js +28 -6
  73. package/lib/node/substitution/statement.js +6 -6
  74. package/lib/node/substitution/term.js +28 -6
  75. package/lib/node/substitution.js +107 -0
  76. package/lib/node/supposition.js +4 -4
  77. package/lib/node/term.js +27 -4
  78. package/lib/node/theorem.js +6 -6
  79. package/lib/node/type.js +4 -4
  80. package/lib/node/typePrefix.js +4 -4
  81. package/lib/node/types.js +4 -4
  82. package/lib/node/variable.js +4 -4
  83. package/lib/nominal/parser.js +3 -3
  84. package/lib/nonTerminalNode.js +222 -0
  85. package/lib/nonTerminalNodeMap.js +5 -3
  86. package/lib/ontology/assertion/contained.js +80 -39
  87. package/lib/ontology/assertion/defined.js +80 -39
  88. package/lib/ontology/assertion/property.js +71 -29
  89. package/lib/ontology/assertion/satisfies.js +73 -25
  90. package/lib/ontology/assertion/subproof.js +95 -41
  91. package/lib/ontology/assertion/type.js +74 -18
  92. package/lib/ontology/assertion.js +66 -0
  93. package/lib/ontology/assumption.js +379 -0
  94. package/lib/ontology/axiom.js +8 -11
  95. package/lib/ontology/combinator/bracketed.js +17 -3
  96. package/lib/ontology/combinator.js +17 -3
  97. package/lib/ontology/conclusion.js +38 -9
  98. package/lib/ontology/constructor/bracketed.js +17 -3
  99. package/lib/ontology/constructor.js +17 -3
  100. package/lib/ontology/declaration/combinator.js +75 -33
  101. package/lib/ontology/declaration/complexType.js +110 -63
  102. package/lib/ontology/declaration/constructor.js +81 -38
  103. package/lib/ontology/declaration/metavariable.js +87 -39
  104. package/lib/ontology/declaration/simpleType.js +95 -48
  105. package/lib/ontology/declaration/typePrefix.js +87 -40
  106. package/lib/ontology/declaration/variable.js +87 -39
  107. package/lib/ontology/declaration.js +13 -313
  108. package/lib/ontology/deduction.js +38 -9
  109. package/lib/ontology/equivalence.js +295 -0
  110. package/lib/ontology/equivalences.js +264 -0
  111. package/lib/ontology/frame.js +83 -51
  112. package/lib/ontology/hypothesis.js +11 -11
  113. package/lib/ontology/judgement.js +8 -8
  114. package/lib/ontology/label.js +5 -6
  115. package/lib/ontology/metavariable.js +14 -15
  116. package/lib/ontology/premise.js +60 -21
  117. package/lib/ontology/procedureCall.js +15 -15
  118. package/lib/ontology/procedureReference.js +1 -1
  119. package/lib/ontology/proof.js +2 -2
  120. package/lib/ontology/reference.js +6 -13
  121. package/lib/ontology/rule.js +69 -71
  122. package/lib/ontology/section.js +2 -2
  123. package/lib/ontology/signature.js +2 -2
  124. package/lib/ontology/statement.js +36 -24
  125. package/lib/ontology/step.js +38 -26
  126. package/lib/ontology/subproof.js +12 -13
  127. package/lib/ontology/substitution/frame.js +69 -21
  128. package/lib/ontology/substitution/reference.js +24 -9
  129. package/lib/ontology/substitution/statement.js +137 -76
  130. package/lib/ontology/substitution/term.js +75 -35
  131. package/lib/ontology/substitution.js +50 -44
  132. package/lib/ontology/substitutions.js +425 -0
  133. package/lib/ontology/supposition.js +69 -29
  134. package/lib/ontology/term.js +35 -37
  135. package/lib/ontology/topLevelAssertion.js +16 -17
  136. package/lib/ontology/topLevelMetaAssertion.js +3 -4
  137. package/lib/ontology/variable.js +9 -14
  138. package/lib/preamble.js +7 -4
  139. package/lib/ruleNames.js +20 -12
  140. package/lib/unifier/intrinsicLevel.js +4 -5
  141. package/lib/unifier/metaLevel.js +24 -24
  142. package/lib/utilities/brackets.js +4 -21
  143. package/lib/utilities/context.js +6 -6
  144. package/lib/utilities/frame.js +18 -0
  145. package/lib/utilities/json.js +24 -1
  146. package/lib/utilities/metavariable.js +18 -0
  147. package/lib/utilities/statement.js +18 -0
  148. package/lib/utilities/substitutions.js +43 -30
  149. package/lib/utilities/unification.js +10 -16
  150. package/lib/utilities/variable.js +18 -0
  151. package/package.json +10 -10
  152. package/src/action/verify.js +2 -2
  153. package/src/assignment/equality.js +1 -1
  154. package/src/context/file.js +13 -11
  155. package/src/context/local.js +40 -65
  156. package/src/context/partial.js +9 -14
  157. package/src/context/temporary.js +463 -0
  158. package/src/mixins/statement/verify.js +60 -23
  159. package/src/mixins/step/unify.js +6 -6
  160. package/src/node/argument.js +1 -1
  161. package/src/node/assertion/contained.js +3 -3
  162. package/src/node/assertion/defined.js +3 -3
  163. package/src/node/assertion/property.js +3 -3
  164. package/src/node/assertion/satisfies.js +3 -3
  165. package/src/node/assertion/subproof.js +3 -3
  166. package/src/node/assertion/type.js +3 -3
  167. package/src/node/assertion.js +7 -0
  168. package/src/node/assumption.js +35 -0
  169. package/src/node/axiom.js +3 -3
  170. package/src/node/{topLevelAssertion.js → axiomLemmaTheoremConjecture.js} +2 -2
  171. package/src/node/body.js +1 -3
  172. package/src/node/combinator.js +1 -1
  173. package/src/node/conclusion.js +1 -1
  174. package/src/node/conjecture.js +3 -3
  175. package/src/node/constructor.js +1 -1
  176. package/src/node/declaration/combinator.js +3 -3
  177. package/src/node/declaration/complexType.js +3 -3
  178. package/src/node/declaration/constructor.js +3 -3
  179. package/src/node/declaration/metavariable.js +3 -3
  180. package/src/node/declaration/property.js +3 -3
  181. package/src/node/declaration/simpleType.js +3 -3
  182. package/src/node/declaration/typePrefix.js +3 -3
  183. package/src/node/declaration/variable.js +3 -3
  184. package/src/node/declaration.js +2 -18
  185. package/src/node/deduction.js +1 -1
  186. package/src/node/derivation.js +1 -1
  187. package/src/node/document.js +7 -0
  188. package/src/node/equality.js +1 -1
  189. package/src/node/error.js +1 -1
  190. package/src/node/frame.js +23 -11
  191. package/src/node/header.js +1 -1
  192. package/src/node/hypothesis.js +1 -1
  193. package/src/node/judgement.js +6 -6
  194. package/src/node/label.js +1 -1
  195. package/src/node/labels.js +1 -1
  196. package/src/node/lemma.js +3 -3
  197. package/src/node/metaArgument.js +1 -1
  198. package/src/node/metaLemma.js +3 -3
  199. package/src/node/{topLevelMetaAssertion.js → metaLemmaMetaTheorem.js} +2 -2
  200. package/src/node/metaType.js +1 -1
  201. package/src/node/metatheorem.js +3 -3
  202. package/src/node/metavariable.js +1 -1
  203. package/src/node/nonsense.js +1 -1
  204. package/src/node/parameter.js +1 -1
  205. package/src/node/parenthesisedLabel.js +1 -1
  206. package/src/node/parenthesisedLabels.js +1 -1
  207. package/src/node/placeholder.js +7 -0
  208. package/src/node/premise.js +1 -1
  209. package/src/node/procedureCall.js +1 -1
  210. package/src/node/procedureReference.js +1 -1
  211. package/src/node/proof.js +1 -1
  212. package/src/node/property.js +1 -1
  213. package/src/node/propertyRelation.js +1 -1
  214. package/src/node/qualification.js +1 -1
  215. package/src/node/reference.js +1 -1
  216. package/src/node/rule.js +2 -2
  217. package/src/node/section.js +1 -1
  218. package/src/node/signature.js +1 -1
  219. package/src/node/statement.js +13 -1
  220. package/src/node/step.js +1 -1
  221. package/src/node/subDerivation.js +1 -1
  222. package/src/node/subproof.js +1 -1
  223. package/src/node/substitution/frame.js +29 -3
  224. package/src/node/substitution/statement.js +3 -3
  225. package/src/node/substitution/term.js +29 -3
  226. package/src/node/substitution.js +7 -0
  227. package/src/node/supposition.js +1 -1
  228. package/src/node/term.js +27 -1
  229. package/src/node/theorem.js +3 -3
  230. package/src/node/type.js +1 -1
  231. package/src/node/typePrefix.js +1 -1
  232. package/src/node/types.js +1 -1
  233. package/src/node/variable.js +1 -1
  234. package/src/nominal/parser.js +2 -2
  235. package/src/{node/nonTerminal.js → nonTerminalNode.js} +31 -25
  236. package/src/nonTerminalNodeMap.js +10 -5
  237. package/src/ontology/assertion/contained.js +21 -32
  238. package/src/ontology/assertion/defined.js +20 -31
  239. package/src/ontology/assertion/property.js +7 -20
  240. package/src/ontology/assertion/satisfies.js +8 -16
  241. package/src/ontology/assertion/subproof.js +36 -42
  242. package/src/ontology/assertion/type.js +10 -11
  243. package/src/ontology/assertion.js +23 -0
  244. package/src/ontology/assumption.js +385 -0
  245. package/src/ontology/axiom.js +7 -16
  246. package/src/ontology/combinator/bracketed.js +2 -0
  247. package/src/ontology/combinator.js +2 -0
  248. package/src/ontology/conclusion.js +51 -10
  249. package/src/ontology/constructor/bracketed.js +2 -0
  250. package/src/ontology/constructor.js +2 -0
  251. package/src/ontology/declaration/combinator.js +15 -24
  252. package/src/ontology/declaration/complexType.js +57 -53
  253. package/src/ontology/declaration/constructor.js +25 -31
  254. package/src/ontology/declaration/metavariable.js +25 -30
  255. package/src/ontology/declaration/simpleType.js +34 -38
  256. package/src/ontology/declaration/typePrefix.js +23 -31
  257. package/src/ontology/declaration/variable.js +26 -31
  258. package/src/ontology/declaration.js +8 -339
  259. package/src/ontology/deduction.js +51 -10
  260. package/src/{equivalence.js → ontology/equivalence.js} +4 -3
  261. package/src/{equivalences.js → ontology/equivalences.js} +14 -12
  262. package/src/ontology/frame.js +93 -66
  263. package/src/ontology/hypothesis.js +8 -8
  264. package/src/ontology/judgement.js +8 -8
  265. package/src/ontology/label.js +2 -7
  266. package/src/ontology/metavariable.js +14 -17
  267. package/src/ontology/premise.js +82 -25
  268. package/src/ontology/procedureCall.js +14 -14
  269. package/src/ontology/procedureReference.js +2 -2
  270. package/src/ontology/proof.js +1 -1
  271. package/src/ontology/reference.js +5 -9
  272. package/src/ontology/rule.js +79 -82
  273. package/src/ontology/section.js +1 -1
  274. package/src/ontology/signature.js +1 -1
  275. package/src/ontology/statement.js +37 -27
  276. package/src/ontology/step.js +45 -28
  277. package/src/ontology/subproof.js +10 -10
  278. package/src/ontology/substitution/frame.js +72 -26
  279. package/src/ontology/substitution/reference.js +8 -6
  280. package/src/ontology/substitution/statement.js +95 -76
  281. package/src/ontology/substitution/term.js +81 -41
  282. package/src/ontology/substitution.js +35 -34
  283. package/src/{substitutions.js → ontology/substitutions.js} +29 -28
  284. package/src/ontology/supposition.js +88 -28
  285. package/src/ontology/term.js +31 -43
  286. package/src/ontology/topLevelAssertion.js +16 -18
  287. package/src/ontology/topLevelMetaAssertion.js +3 -3
  288. package/src/ontology/variable.js +10 -17
  289. package/src/preamble.js +6 -3
  290. package/src/ruleNames.js +10 -8
  291. package/src/unifier/intrinsicLevel.js +5 -6
  292. package/src/unifier/metaLevel.js +32 -29
  293. package/src/utilities/brackets.js +3 -29
  294. package/src/utilities/context.js +5 -5
  295. package/src/utilities/frame.js +13 -0
  296. package/src/utilities/json.js +28 -0
  297. package/src/utilities/metavariable.js +13 -0
  298. package/src/utilities/statement.js +13 -0
  299. package/src/utilities/substitutions.js +59 -33
  300. package/src/utilities/unification.js +8 -24
  301. package/src/utilities/variable.js +13 -0
  302. package/lib/equivalence.js +0 -294
  303. package/lib/equivalences.js +0 -263
  304. package/lib/node/nonTerminal.js +0 -218
  305. package/lib/substitutions.js +0 -424
@@ -0,0 +1,463 @@
1
+ "use strict";
2
+
3
+ import { arrayUtilities } from "necessary";
4
+
5
+ const { extract, compress } = arrayUtilities;
6
+
7
+ export default class TemporaryContext {
8
+ constructor(context, tokens, terms, frames, statements, assertions, substitutions, reference) {
9
+ this.context = context;
10
+ this.tokens = tokens;
11
+ this.terms = terms;
12
+ this.frames = frames;
13
+ this.statements = statements;
14
+ this.assertions = assertions;
15
+ this.substitutions = substitutions;
16
+ this.reference = reference;
17
+ }
18
+
19
+ getContext() {
20
+ return this.context;
21
+ }
22
+
23
+ getTokens() {
24
+ return tokens;
25
+ }
26
+
27
+ getTerms() {
28
+ return this.terms;
29
+ }
30
+
31
+ getFrames() {
32
+ return this.frames;
33
+ }
34
+
35
+ getStatements() {
36
+ return this.statements;
37
+ }
38
+
39
+ getAssertions() {
40
+ return this.assertions;
41
+ }
42
+
43
+ getSubstitutions() {
44
+ return this.substitutions;
45
+ }
46
+
47
+ getReference() {
48
+ return this.reference;
49
+ }
50
+
51
+ addTerm(term) {
52
+ const context = this, ///
53
+ termNode = term.getNode(),
54
+ termString = term.getString();
55
+
56
+ extract(this.terms, (term) => {
57
+ const termMatchesTermNode = term.matchTermNode(termNode);
58
+
59
+ if (termMatchesTermNode) {
60
+ return true;
61
+ }
62
+ });
63
+
64
+ context.trace(`ADded the '${termString}' term.`);
65
+
66
+ this.terms.push(term);
67
+ }
68
+
69
+ addFrame(frame) {
70
+ const context = this, ///
71
+ frameNode = frame.getNode(),
72
+ frameString = frame.getString();
73
+
74
+ extract(this.frames, (frame) => {
75
+ const frameMatchesFrameNode = frame.matchFrameNode(frameNode);
76
+
77
+ if (frameMatchesFrameNode) {
78
+ return true;
79
+ }
80
+ });
81
+
82
+ context.trace(`Added the '${frameString}' frame.`);
83
+
84
+ this.frames.push(frame);
85
+ }
86
+
87
+ addStatement(statement) {
88
+ const context = this, ///
89
+ statementNode = statement.getNode(),
90
+ statementString = statement.getString();
91
+
92
+ extract(this.statements, (statement) => {
93
+ const statementMatchesFrameNode = statement.matchStatementNode(statementNode);
94
+
95
+ if (statementMatchesFrameNode) {
96
+ return true;
97
+ }
98
+ });
99
+
100
+ context.trace(`Added the '${statementString}' statement.`);
101
+
102
+ this.statements.push(statement);
103
+ }
104
+
105
+ addAssertion(assertion) {
106
+ const context = this, ///
107
+ assertionNode = assertion.getNode(),
108
+ assertionString = assertion.getString();
109
+
110
+ extract(this.assertions, (assertion) => {
111
+ const assertionMatchesFrameNode = assertion.matchAssertionNode(assertionNode);
112
+
113
+ if (assertionMatchesFrameNode) {
114
+ return true;
115
+ }
116
+ });
117
+
118
+ context.trace(`Added the '${assertionString}' assertion.`);
119
+
120
+ this.assertions.push(assertion);
121
+ }
122
+
123
+ addSubstitution(substitution) {
124
+ const context = this, ///
125
+ substitutionNode = substitution.getNode(),
126
+ substitutionString = substitution.getString();
127
+
128
+ extract(this.substitutions, (substitution) => {
129
+ const substitutionMatchesFrameNode = substitution.matchSubstitutionNode(substitutionNode);
130
+
131
+ if (substitutionMatchesFrameNode) {
132
+ return true;
133
+ }
134
+ });
135
+
136
+ context.trace(`Added the '${substitutionString}' substitution.`);
137
+
138
+ this.substitutions.push(substitution);
139
+ }
140
+
141
+ addReference(reference) {
142
+ const context = this, ///
143
+ referenceString = reference.getString();
144
+
145
+ this.reference = reference;
146
+
147
+ context.trace(`Added the '${referenceString}' reference.`);
148
+ }
149
+
150
+ findTermByTermNode(termNode) {
151
+ const term = this.terms.find((term) => {
152
+ const termMatchesTermNode = term.matchTermNode(termNode);
153
+
154
+ if (termMatchesTermNode) {
155
+ return true;
156
+ }
157
+ }) || null;
158
+
159
+ return term;
160
+ }
161
+
162
+ findFrameByFrameNode(frameNode) {
163
+ const frame = this.frames.find((frame) => {
164
+ const frameMatchesFrameNode = frame.matchFrameNode(frameNode);
165
+
166
+ if (frameMatchesFrameNode) {
167
+ return true;
168
+ }
169
+ }) || null;
170
+
171
+ return frame;
172
+ }
173
+
174
+ findAssertionByAssertionNode(assertionNode) {
175
+ const assertion = this.assertions.find((assertion) => {
176
+ const assertionMatchesAssertionNode = assertion.matchAssertionNode(assertionNode);
177
+
178
+ if (assertionMatchesAssertionNode) {
179
+ return true;
180
+ }
181
+ }) || null;
182
+
183
+ return assertion;
184
+ }
185
+
186
+ findStatementByStatementNode(statementNode) {
187
+ const statement = this.statements.find((statement) => {
188
+ const statementMatchesStatementNode = statement.matchStatementNode(statementNode);
189
+
190
+ if (statementMatchesStatementNode) {
191
+ return true;
192
+ }
193
+ }) || null;
194
+
195
+ return statement;
196
+ }
197
+
198
+ findSubtitutionBySubtitutionNode(substitutionNode) {
199
+ const substitution = this.substitutions.find((substitution) => {
200
+ const substitutionMatchesSubtitutionNode = substitution.matchSubtitutionNode(substitutionNode);
201
+
202
+ if (substitutionMatchesSubtitutionNode) {
203
+ return true;
204
+ }
205
+ }) || null;
206
+
207
+ return substitution;
208
+ }
209
+
210
+ getVariables(nested = true) { return this.context.getVariables(nested); }
211
+
212
+ getJudgements() { return this.context.getJudgements(); }
213
+
214
+ getEquivalences() { return this.context.getEquivalences(); }
215
+
216
+ getSteps() { return this.context.getSteps(); }
217
+
218
+ getLastStep() { return this.context.getLastStep(); }
219
+
220
+ getStepsOrSubproofs() { return this.context.getStepsOrSubproofs(); }
221
+
222
+ getFilePath() { return this.context.getFilePath(); }
223
+
224
+ getLexer() { return this.context.getLexer(); }
225
+
226
+ getParser() { return this.context.getParser(); }
227
+
228
+ getAxioms() { return this.context.getAxioms(); }
229
+
230
+ getLemmas() { return this.context.getLemmas(); }
231
+
232
+ getTheorems() { return this.context.getTheorems(); }
233
+
234
+ getConjectures() { return this.context.getConjectures(); }
235
+
236
+ getCombinators() { return this.context.getCombinators(); }
237
+
238
+ getConstructors() { return this.context.getConstructors(); }
239
+
240
+ getTypePrefix() { return this.context.getTypePrefix(); }
241
+
242
+ addAxiom(axiom) { this.context.addAxiom(axiom); }
243
+
244
+ addLemma(lemma) { this.context.addLemma(lemma); }
245
+
246
+ addTheorem(theorem) { this.context.addTheorem(theorem); }
247
+
248
+ addEquality(equality) { return this.context.addEquality(equality); }
249
+
250
+ addVariable(variable, nested = true) { return this.context.addVariable(variable, nested); }
251
+
252
+ addJudgement(judgement) { return this.context.addJudgement(judgement); }
253
+
254
+ addStepOrSubproof(stepOrSubproof) { this.context.addStepOrSubproof(stepOrSubproof); }
255
+
256
+ findProcedureByName(name) { return this.context.findProcedureByName(name); }
257
+
258
+ findLabelByReference(reference, context) { return this.context.findLabelByReference(reference, context); }
259
+
260
+ findRuleByReference(reference) { return this.context.findRuleByReference(reference); }
261
+
262
+ findAxiomByReference(reference) { return this.context.findAxiomByReference(reference); }
263
+
264
+ findLemmaByReference(reference) { return this.context.findLemmaByReference(reference); }
265
+
266
+ findTheoremByReference(reference) { return this.context.findTheoremByReference(reference); }
267
+
268
+ findConjectureByReference(reference) { return this.context.findConjectureByReference(reference); }
269
+
270
+ findMetaLemmasByReference(reference) { return this.context.findMetaLemmasByReference(reference); }
271
+
272
+ findMetatheoremsByReference(reference) { return this.context.findMetatheoremsByReference(reference); }
273
+
274
+ findMetaLemmaMetatheoremByReference(reference) { return this.context.findMetaLemmaMetatheoremByReference(reference); }
275
+
276
+ findMetaLemmaMetatheoremsByReference(reference) { return this.context.findMetaLemmaMetatheoremsByReference(reference); }
277
+
278
+ findVariableByVariableIdentifier(variableIdentifier, nested = true) { return this.context.findVariableByVariableIdentifier(variableIdentifier, nested); }
279
+
280
+ findJudgementByMetavariable(metavariable) { return this.context.findJudgementByMetavariable(metavariable); }
281
+
282
+ findEquivalenceByTerm(term) { return this.context.findEquivalenceByTerm(term); }
283
+
284
+ findMetavariable(metavariable) { return this.context.findMetavariable(metavariable); }
285
+
286
+ findLabelByMetavariable(metavariable) { return this.context.findLabelByMetavariable(metavariable); }
287
+
288
+ findTypeByNominalTypeName(nominalTypeName) { return this.context.findTypeByNominalTypeName(nominalTypeName); }
289
+
290
+ findMetaTypeByMetaTypeName(metaTypeName) { return this.context.findMetaTypeByMetaTypeName(metaTypeName); }
291
+
292
+ findMetavariableByMetavariableName(metavariableName) { return this.context.findMetavariableByMetavariableName(metavariableName); }
293
+
294
+ isProcedurePresentByName(name) { return this.context.isProcedurePresentByName(name); }
295
+
296
+ isLabelPresentByReference(reference) { return this.context.isLabelPresentByReference(reference); }
297
+
298
+ isMetavariablePresentByReference(reference) { return this.context.isMetavariablePresentByReference(reference); }
299
+
300
+ isMetaLemmaMetatheoremPresentByReference(reference) { return this.context.isMetaLemmaMetatheoremPresentByReference(reference); }
301
+
302
+ findAxiomLemmaTheoremOrConjectureByReference(reference) { return this.context.findAxiomLemmaTheoremOrConjectureByReference(reference); }
303
+
304
+ isMetavariablePresent(metavariable) { return this.context.isMetavariablePresent(metavariable); }
305
+
306
+ isTypePresentByTypeName(typeName, includeRelease = true, includeDependencies = true) { return this.context.isTypePresentByTypeName(typeName, includeRelease, includeDependencies); }
307
+
308
+ isTypePresentByNominalTypeName(nominalTypeName) { return this.context.isTypePresentByNominalTypeName(nominalTypeName); }
309
+
310
+ isTypePresentByPrefixedTypeName(prefixedTypeName) { return this.context.isTypePresentByPrefixedTypeName(prefixedTypeName); }
311
+
312
+ isTypePrefixPresentByTypePrefixName(typePrefixName) { return this.context.isTypePrefixPresentByTypePrefixName(typePrefixName); }
313
+
314
+ isVariablePresentByVariableIdentifier(variableIdentifier, nested = true) { return this.context.findVariableByVariableIdentifier(variableIdentifier, nested); }
315
+
316
+ isLabelPresentByMetavariableName(metavariableName) { return this.context.isLabelPresentByMetavariableName(metavariableName); }
317
+
318
+ isLabelPresentByMetavariable(metavariable) { return this.context.isLabelPresentByMetavariable(metavariable); }
319
+
320
+ isMetavariablePresentByMetavariableName(metavariableNode) { return this.context.isMetavariablePresentByMetavariableName(metavariableNode); }
321
+
322
+ isJudgementPresentByMetavariable(metavariable) { return this.context.isJudgementPresentByMetavariable(metavariable); }
323
+
324
+ isTermGrounded(term) { return this.context.isTermGrounded(term); }
325
+
326
+ isVariableDefined(variable) { return this.context.isVariableDefined(variable); }
327
+
328
+ isMetavariableDefined(metavariable) { return this.context.isMetavariableDefined(metavariable); }
329
+
330
+ matchTermAndPropertyRelation(term, propertyRelation) { return this.context.matchTermAndPropertyRelation(term, propertyRelation); }
331
+
332
+ nodeAsString(node, tokens = null) {
333
+ if (tokens === null) {
334
+ tokens = this.tokens;
335
+ }
336
+
337
+ const string = this.context.nodeAsString(node, tokens);
338
+
339
+ return string;
340
+ }
341
+
342
+ nodesAsString(node, tokens = null) {
343
+ if (tokens === null) {
344
+ tokens = this.tokens;
345
+ }
346
+
347
+ const string = this.context.nodesAsString(node, tokens);
348
+
349
+ return string;
350
+ }
351
+
352
+ nodeAsTokens(node, tokens = null) {
353
+ if (tokens === null) {
354
+ tokens = this.tokens;
355
+ }
356
+
357
+ tokens = this.context.nodeAsTokens(node, tokens); ///
358
+
359
+ return tokens;
360
+ }
361
+
362
+ nodesAsTokens(node, tokens = null) {
363
+ if (tokens === null) {
364
+ tokens = this.tokens;
365
+ }
366
+
367
+ tokens = this.context.nodesAsTokens(node, tokens); ///
368
+
369
+ return tokens;
370
+ }
371
+
372
+ tokensAsString(tokens) { return this.context.tokensAsString(tokens); }
373
+
374
+ trace(message, node = null) { this.context.trace(message, node); }
375
+
376
+ debug(message, node = null) { this.context.debug(message, node); }
377
+
378
+ info(message, node = null) { this.context.info(message, node); }
379
+
380
+ warning(message, node = null) { this.context.warning(message, node); }
381
+
382
+ error(message, node = null) { this.context.error(message, node); }
383
+
384
+ marge(context) {
385
+ const terms = context.getTerms(),
386
+ frames = context.getFrames(),
387
+ statements = context.getStatements(),
388
+ assertions = context.getAssertions(),
389
+ substitutions = context.getSubstitutions();
390
+
391
+ this.terms = [
392
+ ...this.terms,
393
+ ...terms
394
+ ];
395
+
396
+ this.frames = [
397
+ ...this.frames,
398
+ ...frames
399
+ ];
400
+
401
+ this.statements = [
402
+ ...this.statements,
403
+ ...statements
404
+ ];
405
+
406
+ this.assertions = [
407
+ ...this.assertions,
408
+ ...assertions
409
+ ];
410
+
411
+ this.substitutions = [
412
+ ...this.substitutions,
413
+ ...substitutions
414
+ ];
415
+
416
+ compress(this.terms, (termA, termB) => {
417
+ const termANode = termA.getNode(),
418
+ termBNode = termB.getNode(),
419
+ termANodeMatchesTermBNode = termANode.match(termBNode);
420
+
421
+ if (termAMatchesTermB) {
422
+ return true;
423
+ }
424
+ });
425
+
426
+ }
427
+
428
+ static fromNothing(context) {
429
+ const terms = [],
430
+ frames = [],
431
+ tokens = null,
432
+ statements = [],
433
+ assertions = [],
434
+ substitutions = [],
435
+ reference = null,
436
+ temporaryContext = new TemporaryContext(context, tokens, terms, frames, statements, assertions, substitutions, reference);
437
+
438
+ return temporaryContext;
439
+ }
440
+
441
+ static fromTermsAndFrames(terms, frames, context) {
442
+ const tokens = null,
443
+ statements = [],
444
+ assertions = [],
445
+ substitutions = [],
446
+ reference = null,
447
+ temporaryContext = new TemporaryContext(context, tokens, terms, frames, statements, assertions, substitutions, reference);
448
+
449
+ return temporaryContext;
450
+ }
451
+
452
+ static fromContextAndTokens(context, tokens) {
453
+ const terms = [],
454
+ frames = [],
455
+ statements = [],
456
+ assertions = [],
457
+ substitutions = [],
458
+ reference = null,
459
+ temporaryContext = new TemporaryContext(context, tokens, terms, frames, statements, assertions, substitutions, reference);
460
+
461
+ return temporaryContext;
462
+ }
463
+ }
@@ -12,6 +12,41 @@ import { equalityFromStatement,
12
12
  containedAssertionFromStatement,
13
13
  satisfiesAssertionFromStatement } from "../../utilities/context";
14
14
 
15
+ function verifyAsMetavariableAndSubstitution(statement, assignments, stated, context) {
16
+ let verifiesAsMetavariableAndSubstitution = false;
17
+
18
+ const metavariable = metavariableFromStatement(statement, context);
19
+
20
+ if (metavariable !== null) {
21
+ const statementString = statement.getString();
22
+
23
+ context.trace(`Verifying the '${statementString}' statement as a metavariable and substitution...`);
24
+
25
+ const metavariableVerifies = metavariable.verify(context);
26
+
27
+ if (metavariableVerifies) {
28
+ const { TermSubstitution, FrameSubstitution } = ontology,
29
+ substitution = TermSubstitution.fromStatement(statement, context) || FrameSubstitution.fromStatement(statement, context);
30
+
31
+ if (substitution !== null) {
32
+ const substitutionVerifies = substitution.verify(context);
33
+
34
+ if (substitutionVerifies) {
35
+ verifiesAsMetavariableAndSubstitution = true;
36
+ }
37
+ } else {
38
+ verifiesAsMetavariableAndSubstitution = true;
39
+ }
40
+ }
41
+
42
+ if (verifiesAsMetavariableAndSubstitution) {
43
+ context.debug(`...verified the '${statementString}' statement as a metavariable and substitution.`);
44
+ }
45
+ }
46
+
47
+ return verifiesAsMetavariableAndSubstitution;
48
+ }
49
+
15
50
  function unifyWithBracketedCombinator(statement, assignments, stated, context) {
16
51
  stated = true; ///
17
52
 
@@ -41,28 +76,6 @@ function unifyWithCombinators(statement, assignments, stated, context) {
41
76
  return unifiesWithCombinators;
42
77
  }
43
78
 
44
- function verifyAsMetavariable(statement, assignments, stated, context) {
45
- let verifiesAsMetavariable = false;
46
-
47
- const metavariable = metavariableFromStatement(statement, context);
48
-
49
- if (metavariable !== null) {
50
- const statementString = statement.getString();
51
-
52
- context.trace(`Verifying the '${statementString}' statement as a metavariable...`);
53
-
54
- const metavariableVerifies = metavariable.verify(context);
55
-
56
- verifiesAsMetavariable = metavariableVerifies; ///
57
-
58
- if (verifiesAsMetavariable) {
59
- context.debug(`...verified the '${statementString}' statement as a metavariable.`);
60
- }
61
- }
62
-
63
- return verifiesAsMetavariable;
64
- }
65
-
66
79
  function verifyAsEquality(statement, assignments, stated, context) {
67
80
  let verifiesAsEquality = false;
68
81
 
@@ -122,6 +135,10 @@ function verifyAsTypeAssertion(statement, assignments, stated, context) {
122
135
  verifiesAsTypeAssertion = typeAssertionVerifies; ///
123
136
 
124
137
  if (verifiesAsTypeAssertion) {
138
+ const assertion = typeAssertion; ///
139
+
140
+ context.addAssertion(assertion);
141
+
125
142
  context.debug(`...verified the '${statementString}' statement as a type assertion.`);
126
143
  }
127
144
  }
@@ -144,6 +161,10 @@ function verifyAsDefinedAssertion(statement, assignments, stated, context) {
144
161
  verifiesAsDefinedAssertion = definedAssertionVerifies; ///
145
162
 
146
163
  if (verifiesAsDefinedAssertion) {
164
+ const assertion = definedAssertion; ///
165
+
166
+ context.addAssertion(assertion);
167
+
147
168
  context.debug(`...verified the '${statementString}' statement as a defined assertion.`);
148
169
  }
149
170
  }
@@ -166,6 +187,10 @@ function verifyAsPropertyAssertion(statement, assignments, stated, context) {
166
187
  verifiesAsPropertyAssertion = propertyAssertionVerifies; ///
167
188
 
168
189
  if (verifiesAsPropertyAssertion) {
190
+ const assertion = propertyAssertion; ///
191
+
192
+ context.addAssertion(assertion);
193
+
169
194
  context.debug(`...verified the '${statementString}' statement as a property assertion.`);
170
195
  }
171
196
  }
@@ -188,6 +213,10 @@ function verifyAsSubproofAssertion(statement, assignments, stated, context) {
188
213
  verifiesAsSubproofAssertion = subproofAssertionVerifies; ///
189
214
 
190
215
  if (verifiesAsSubproofAssertion) {
216
+ const assertion = subproofAssertion; ///
217
+
218
+ context.addAssertion(assertion);
219
+
191
220
  context.debug(`...verified the '${statementString}' statement as a subproof assertion.`);
192
221
  }
193
222
  }
@@ -210,6 +239,10 @@ function verifyAsContainedAssertion(statement, assignments, stated, context) {
210
239
  verifiesAsContainedAssertion = containedAssertionVerifies; ///
211
240
 
212
241
  if (verifiesAsContainedAssertion) {
242
+ const assertion = containedAssertion; ///
243
+
244
+ context.addAssertion(assertion);
245
+
213
246
  context.debug(`...verified the '${statementString}' statement as a contained assertion.`);
214
247
  }
215
248
  }
@@ -232,6 +265,10 @@ function verifyAsSatisfiesAssertion(statement, assignments, stated, context) {
232
265
  verifiesAsSatisfiesAssertion = satisfiesAssertionVerifies; ///
233
266
 
234
267
  if (verifiesAsSatisfiesAssertion) {
268
+ const assertion = satisfiesAssertion; ///
269
+
270
+ context.addAssertion(assertion);
271
+
235
272
  context.debug(`...verified the '${statementString}' statement as a satisfies assertion.`);
236
273
  }
237
274
  }
@@ -240,9 +277,9 @@ function verifyAsSatisfiesAssertion(statement, assignments, stated, context) {
240
277
  }
241
278
 
242
279
  const verifyMixins = [
280
+ verifyAsMetavariableAndSubstitution,
243
281
  unifyWithBracketedCombinator,
244
282
  unifyWithCombinators,
245
- verifyAsMetavariable,
246
283
  verifyAsEquality,
247
284
  verifyAsJudgement,
248
285
  verifyAsTypeAssertion,
@@ -3,7 +3,6 @@
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
5
  import ontology from "../../ontology";
6
- import Substitutions from "../../substitutions";
7
6
 
8
7
  import { equalityFromStatement,
9
8
  judgementFromStatement,
@@ -59,7 +58,7 @@ function unifyWithReference(statement, reference, satisfiesAssertion, substituti
59
58
  statementSubstitution = StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context),
60
59
  substitution = statementSubstitution; ///
61
60
 
62
- substitutions.addSubstitution(substitution, specificContext);
61
+ substitutions.addSubstitution(substitution, context);
63
62
 
64
63
  unifiesWithReference = true;
65
64
 
@@ -109,7 +108,8 @@ function unifyAsSatisfiesAssertion(statement, reference, satisfiesAssertion, sub
109
108
  const satisfiable = axiom.isSatisfiable();
110
109
 
111
110
  if (satisfiable) {
112
- const substitutions = Substitutions.fromNothing(),
111
+ const { Substitutions } = ontology,
112
+ substitutions = Substitutions.fromNothing(),
113
113
  axiomLemmaTheoremOrConjectureUnifies = axiom.unifyAxiomLemmaTheoremOrConjecture(axiomLemmaTheoremOrConjecture, substitutions, context);
114
114
 
115
115
  if (axiomLemmaTheoremOrConjectureUnifies) {
@@ -140,7 +140,8 @@ function unifyWithAxiomLemmaTheoremOrConjecture(statement, reference, satisfiesA
140
140
  let unifiesWithAxiomLemmaTheoremOrConjecture = false;
141
141
 
142
142
  if (reference !== null) {
143
- const axiomLemmaTheoremOrConjecture = context.findAxiomLemmaTheoremOrConjectureByReference(reference),
143
+ const { Substitutions } = ontology,
144
+ axiomLemmaTheoremOrConjecture = context.findAxiomLemmaTheoremOrConjectureByReference(reference),
144
145
  generalSubstitutions = substitutions; ///
145
146
 
146
147
  if (axiomLemmaTheoremOrConjecture !== null) {
@@ -158,13 +159,12 @@ function unifyWithAxiomLemmaTheoremOrConjecture(statement, reference, satisfiesA
158
159
  if (statementAndStepsUnify) {
159
160
  const { StatementSubstitution } = ontology,
160
161
  metavariable = reference.getMetavariable(),
161
- specificContext = context, ///
162
162
  statementSubstitution = StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context),
163
163
  substitution = statementSubstitution; ///
164
164
 
165
165
  substitutions = generalSubstitutions; ///
166
166
 
167
- substitutions.addSubstitution(substitution, specificContext);
167
+ substitutions.addSubstitution(substitution, context);
168
168
 
169
169
  unifiesWithAxiomLemmaTheoremOrConjecture = true;
170
170
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import NonTerminalNode from "../node/nonTerminal";
3
+ import NonTerminalNode from "../nonTerminalNode";
4
4
 
5
5
  import { TERM_RULE_NAME, TYPE_RULE_NAME } from "../ruleNames";
6
6
 
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
 
3
- import NonTerminalNode from "../../node/nonTerminal";
3
+ import AssertionNode from "../../node/assertion";
4
4
 
5
5
  import { MISSING } from "../../constants";
6
6
  import { TERM_RULE_NAME, FRAME_RULE_NAME, STATEMENT_RULE_NAME } from "../../ruleNames";
7
7
 
8
- export default class ContainedAssertionNode extends NonTerminalNode {
8
+ export default class ContainedAssertionNode extends AssertionNode {
9
9
  isNegated() {
10
10
  let negated = false;
11
11
 
@@ -49,5 +49,5 @@ export default class ContainedAssertionNode extends NonTerminalNode {
49
49
  return statementNode;
50
50
  }
51
51
 
52
- static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(ContainedAssertionNode, ruleName, childNodes, opacity, precedence); }
52
+ static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return AssertionNode.fromRuleNameChildNodesOpacityAndPrecedence(ContainedAssertionNode, ruleName, childNodes, opacity, precedence); }
53
53
  }