occam-verify-cli 1.0.437 → 1.0.444

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 (217) hide show
  1. package/lib/context/file.js +38 -35
  2. package/lib/context/local.js +10 -10
  3. package/lib/context/release.js +6 -6
  4. package/lib/context/temporary.js +14 -14
  5. package/lib/element/assertion/contained.js +45 -45
  6. package/lib/element/assertion/defined.js +13 -13
  7. package/lib/element/assertion/property.js +23 -22
  8. package/lib/element/assertion/satisfies.js +7 -6
  9. package/lib/element/assertion/subproof.js +20 -17
  10. package/lib/element/assertion/type.js +3 -2
  11. package/lib/element/assertion.js +1 -23
  12. package/lib/element/assumption.js +24 -22
  13. package/lib/element/axiom.js +9 -12
  14. package/lib/element/axiomLemmaTheoremConjecture.js +32 -32
  15. package/lib/element/{statement/combinator → combinator}/bracketed.js +16 -16
  16. package/lib/element/combinator.js +229 -0
  17. package/lib/element/conclusion.js +11 -9
  18. package/lib/element/{term/constructor → constructor}/bracketed.js +5 -5
  19. package/lib/element/constructor.js +232 -0
  20. package/lib/element/declaration/combinator.js +2 -16
  21. package/lib/element/declaration/complexType.js +12 -12
  22. package/lib/element/declaration/constructor.js +13 -11
  23. package/lib/element/declaration/simpleType.js +4 -4
  24. package/lib/element/declaration/typePrefix.js +2 -2
  25. package/lib/element/declaration/variable.js +3 -3
  26. package/lib/element/deduction.js +11 -9
  27. package/lib/element/derivation.js +5 -8
  28. package/lib/element/equivalence.js +10 -10
  29. package/lib/element/equivalences.js +5 -5
  30. package/lib/element/frame.js +32 -38
  31. package/lib/element/hypothesis.js +3 -3
  32. package/lib/element/judgement.js +6 -4
  33. package/lib/element/label.js +16 -18
  34. package/lib/element/metaLemmaMetatheorem.js +5 -5
  35. package/lib/element/metaType.js +17 -80
  36. package/lib/element/metavariable.js +34 -34
  37. package/lib/element/parameter.js +3 -3
  38. package/lib/element/premise.js +43 -52
  39. package/lib/element/property.js +9 -9
  40. package/lib/element/propertyRelation.js +13 -13
  41. package/lib/element/reference.js +14 -17
  42. package/lib/element/rule.js +26 -50
  43. package/lib/element/signature.js +11 -11
  44. package/lib/element/statement.js +54 -56
  45. package/lib/element/step.js +79 -51
  46. package/lib/element/subDerivation.js +7 -10
  47. package/lib/element/subproof.js +6 -14
  48. package/lib/element/substitution/frame.js +1 -7
  49. package/lib/element/substitution/reference.js +2 -3
  50. package/lib/element/substitution/statement.js +44 -15
  51. package/lib/element/substitution/term.js +10 -57
  52. package/lib/element/substitution.js +5 -11
  53. package/lib/element/substitutions.js +29 -29
  54. package/lib/element/supposition.js +63 -55
  55. package/lib/element/term.js +21 -34
  56. package/lib/element/type.js +47 -60
  57. package/lib/element/typePrefix.js +5 -5
  58. package/lib/element/variable.js +9 -9
  59. package/lib/element.js +27 -3
  60. package/lib/metaTypes.js +52 -0
  61. package/lib/node/axiomLemmaTheoremConjecture.js +9 -9
  62. package/lib/node/body/axiom.js +2 -25
  63. package/lib/node/body/conjecture.js +2 -25
  64. package/lib/node/body/lemma.js +2 -25
  65. package/lib/node/body/metaLemma.js +2 -25
  66. package/lib/node/body/metatheorem.js +2 -25
  67. package/lib/node/body/rule.js +15 -1
  68. package/lib/node/body/theorem.js +2 -25
  69. package/lib/node/body.js +25 -2
  70. package/lib/node/combinator.js +11 -2
  71. package/lib/node/constructor.js +11 -2
  72. package/lib/node/declaration/combinator.js +5 -5
  73. package/lib/node/declaration/constructor.js +8 -8
  74. package/lib/node/declaration/property.js +15 -15
  75. package/lib/node/declaration/simpleType.js +31 -31
  76. package/lib/node/declaration/variable.js +8 -8
  77. package/lib/node/equality.js +8 -8
  78. package/lib/node/frame.js +20 -20
  79. package/lib/node/header.js +22 -22
  80. package/lib/node/metaLemmaMetaTheorem.js +16 -16
  81. package/lib/node/metavariable.js +15 -15
  82. package/lib/node/property.js +8 -8
  83. package/lib/node/propertyRelation.js +8 -8
  84. package/lib/node/rule.js +16 -16
  85. package/lib/node/statement.js +12 -12
  86. package/lib/node/step.js +22 -22
  87. package/lib/node/subproof.js +8 -8
  88. package/lib/node/substitution/frame.js +19 -19
  89. package/lib/node/substitution/statement.js +19 -19
  90. package/lib/node/substitution/term.js +19 -19
  91. package/lib/node/term.js +35 -35
  92. package/lib/preamble.js +5 -5
  93. package/lib/process/instantiate.js +20 -2
  94. package/lib/process/unify.js +39 -42
  95. package/lib/process/validate.js +431 -0
  96. package/lib/process/verify.js +44 -135
  97. package/lib/types.js +27 -0
  98. package/lib/utilities/brackets.js +4 -4
  99. package/lib/utilities/element.js +100 -61
  100. package/lib/utilities/instance.js +18 -18
  101. package/lib/utilities/statement.js +11 -16
  102. package/lib/utilities/string.js +21 -10
  103. package/lib/utilities/unification.js +237 -0
  104. package/lib/utilities/validation.js +251 -0
  105. package/package.json +6 -6
  106. package/src/context/file.js +37 -31
  107. package/src/context/local.js +8 -8
  108. package/src/context/release.js +9 -6
  109. package/src/context/temporary.js +11 -11
  110. package/src/element/assertion/contained.js +19 -20
  111. package/src/element/assertion/defined.js +11 -12
  112. package/src/element/assertion/property.js +20 -20
  113. package/src/element/assertion/satisfies.js +6 -6
  114. package/src/element/assertion/subproof.js +17 -15
  115. package/src/element/assertion/type.js +2 -2
  116. package/src/element/assertion.js +0 -2
  117. package/src/element/assumption.js +22 -19
  118. package/src/element/axiom.js +7 -11
  119. package/src/element/axiomLemmaTheoremConjecture.js +36 -36
  120. package/src/element/{statement/combinator → combinator}/bracketed.js +7 -7
  121. package/src/element/combinator.js +90 -0
  122. package/src/element/conclusion.js +12 -10
  123. package/src/element/{term/constructor → constructor}/bracketed.js +5 -5
  124. package/src/element/{term/constructor.js → constructor.js} +17 -25
  125. package/src/element/declaration/combinator.js +1 -22
  126. package/src/element/declaration/complexType.js +11 -11
  127. package/src/element/declaration/constructor.js +13 -10
  128. package/src/element/declaration/simpleType.js +3 -3
  129. package/src/element/declaration/typePrefix.js +1 -1
  130. package/src/element/declaration/variable.js +2 -2
  131. package/src/element/deduction.js +12 -9
  132. package/src/element/derivation.js +4 -8
  133. package/src/element/equivalence.js +8 -8
  134. package/src/element/equivalences.js +4 -4
  135. package/src/element/frame.js +28 -30
  136. package/src/element/hypothesis.js +2 -2
  137. package/src/element/judgement.js +6 -3
  138. package/src/element/label.js +14 -21
  139. package/src/element/metaLemmaMetatheorem.js +4 -3
  140. package/src/element/metaType.js +9 -45
  141. package/src/element/metavariable.js +29 -31
  142. package/src/element/parameter.js +2 -2
  143. package/src/element/premise.js +56 -62
  144. package/src/element/property.js +6 -6
  145. package/src/element/propertyRelation.js +11 -11
  146. package/src/element/reference.js +12 -21
  147. package/src/element/rule.js +28 -72
  148. package/src/element/signature.js +10 -9
  149. package/src/element/statement.js +69 -56
  150. package/src/element/step.js +89 -51
  151. package/src/element/subDerivation.js +6 -10
  152. package/src/element/subproof.js +4 -12
  153. package/src/element/substitution/frame.js +0 -2
  154. package/src/element/substitution/reference.js +1 -5
  155. package/src/element/substitution/statement.js +44 -14
  156. package/src/element/substitution/term.js +10 -13
  157. package/src/element/substitution.js +3 -5
  158. package/src/element/substitutions.js +48 -30
  159. package/src/element/supposition.js +88 -70
  160. package/src/element/term.js +18 -28
  161. package/src/element/type.js +42 -36
  162. package/src/element/typePrefix.js +3 -3
  163. package/src/element/variable.js +7 -7
  164. package/src/element.js +15 -1
  165. package/src/metaTypes.js +42 -0
  166. package/src/node/axiomLemmaTheoremConjecture.js +6 -6
  167. package/src/node/body/axiom.js +0 -21
  168. package/src/node/body/conjecture.js +0 -23
  169. package/src/node/body/lemma.js +0 -23
  170. package/src/node/body/metaLemma.js +0 -23
  171. package/src/node/body/metatheorem.js +0 -23
  172. package/src/node/body/rule.js +12 -0
  173. package/src/node/body/theorem.js +0 -23
  174. package/src/node/body.js +23 -0
  175. package/src/node/combinator.js +9 -0
  176. package/src/node/constructor.js +9 -0
  177. package/src/node/declaration/combinator.js +5 -5
  178. package/src/node/declaration/constructor.js +8 -8
  179. package/src/node/declaration/property.js +14 -14
  180. package/src/node/declaration/simpleType.js +31 -31
  181. package/src/node/declaration/variable.js +7 -7
  182. package/src/node/equality.js +7 -7
  183. package/src/node/frame.js +21 -21
  184. package/src/node/header.js +22 -22
  185. package/src/node/metaLemmaMetaTheorem.js +14 -14
  186. package/src/node/metavariable.js +14 -14
  187. package/src/node/property.js +7 -7
  188. package/src/node/propertyRelation.js +7 -7
  189. package/src/node/rule.js +15 -15
  190. package/src/node/statement.js +12 -12
  191. package/src/node/step.js +21 -21
  192. package/src/node/subproof.js +7 -7
  193. package/src/node/substitution/frame.js +18 -18
  194. package/src/node/substitution/statement.js +18 -18
  195. package/src/node/substitution/term.js +18 -18
  196. package/src/node/term.js +34 -34
  197. package/src/preamble.js +4 -4
  198. package/src/process/instantiate.js +12 -0
  199. package/src/process/unify.js +53 -57
  200. package/src/process/validate.js +316 -0
  201. package/src/process/verify.js +50 -138
  202. package/src/types.js +18 -0
  203. package/src/utilities/brackets.js +10 -6
  204. package/src/utilities/element.js +138 -91
  205. package/src/utilities/instance.js +18 -18
  206. package/src/utilities/statement.js +27 -28
  207. package/src/utilities/string.js +34 -20
  208. package/src/{mixins/step/unify.js → utilities/unification.js} +82 -68
  209. package/src/utilities/validation.js +369 -0
  210. package/lib/element/statement/combinator.js +0 -105
  211. package/lib/element/term/constructor.js +0 -172
  212. package/lib/mixins/statement/verify.js +0 -198
  213. package/lib/mixins/step/unify.js +0 -228
  214. package/lib/mixins/term/verify.js +0 -65
  215. package/src/element/statement/combinator.js +0 -59
  216. package/src/mixins/statement/verify.js +0 -295
  217. package/src/mixins/term/verify.js +0 -81
@@ -1,295 +0,0 @@
1
- "use strict";
2
-
3
- import elements from "../../elements";
4
-
5
- import { equalityFromStatement,
6
- judgementFromStatement,
7
- metavariableFromStatement,
8
- typeAssertionFromStatement,
9
- definedAssertionFromStatement,
10
- propertyAssertionFromStatement,
11
- subproofAssertionFromStatement,
12
- containedAssertionFromStatement,
13
- satisfiesAssertionFromStatement } from "../../utilities/statement";
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 } = elements,
29
- frameSubstitution = FrameSubstitution.fromStatement(statement, context),
30
- termSubstitution = TermSubstitution.fromStatement(statement, context),
31
- substitution = (termSubstitution || frameSubstitution);
32
-
33
- if (substitution !== null) {
34
- const substitutionVerifies = substitution.verify(context);
35
-
36
- if (substitutionVerifies) {
37
- verifiesAsMetavariableAndSubstitution = true;
38
- }
39
- } else {
40
- verifiesAsMetavariableAndSubstitution = true;
41
- }
42
- }
43
-
44
- if (verifiesAsMetavariableAndSubstitution) {
45
- context.debug(`...verified the '${statementString}' statement as a metavariable and substitution.`);
46
- }
47
- }
48
-
49
- return verifiesAsMetavariableAndSubstitution;
50
- }
51
-
52
- function unifyWithBracketedCombinator(statement, assignments, stated, context) {
53
- stated = true; ///
54
-
55
- assignments = null; ///
56
-
57
- const { BracketedCombinator } = elements,
58
- bracketedCombinator = BracketedCombinator.fromNothing(),
59
- unifiesWithBracketedCombinator = bracketedCombinator.unifyStatement(statement, assignments, stated, context);
60
-
61
- return unifiesWithBracketedCombinator;
62
- }
63
-
64
- function unifyWithCombinators(statement, assignments, stated, context) {
65
- stated = true; ///
66
-
67
- assignments = null; ///
68
-
69
- const combinators = context.getCombinators(),
70
- unifiesWithCombinators = combinators.some((combinator) => {
71
- const unifiesWithCombinator = combinator.unifyStatement(statement, assignments, stated, context);
72
-
73
- if (unifiesWithCombinator) {
74
- return true;
75
- }
76
- });
77
-
78
- return unifiesWithCombinators;
79
- }
80
-
81
- function verifyAsEquality(statement, assignments, stated, context) {
82
- let verifiesAsEquality = false;
83
-
84
- const equality = equalityFromStatement(statement, context);
85
-
86
- if (equality !== null) {
87
- const statementString = statement.getString();
88
-
89
- context.trace(`Verifying the '${statementString}' statement as an equality...`);
90
-
91
- const equalityVerifies = equality.verify(assignments, stated, context);
92
-
93
- verifiesAsEquality = equalityVerifies; ///
94
-
95
- if (verifiesAsEquality) {
96
- context.debug(`...verified the '${statementString}' statement as an equality.`);
97
- }
98
- }
99
-
100
- return verifiesAsEquality;
101
- }
102
-
103
- function verifyAsJudgement(statement, assignments, stated, context) {
104
- let verifiesAsJudgement = false;
105
-
106
- const judgement = judgementFromStatement(statement, context);
107
-
108
- if (judgement !== null) {
109
- const statementString = statement.getString();
110
-
111
- context.trace(`Verifying the '${statementString}' statement as a judgement...`);
112
-
113
- const judgementVerifies = judgement.verify(assignments, stated, context);
114
-
115
- verifiesAsJudgement = judgementVerifies; ///
116
-
117
- if (verifiesAsJudgement) {
118
- context.debug(`...verified the '${statementString}' statement as a judgement.`);
119
- }
120
- }
121
-
122
- return verifiesAsJudgement;
123
- }
124
-
125
- function verifyAsTypeAssertion(statement, assignments, stated, context) {
126
- let verifiesAsTypeAssertion = false;
127
-
128
- const typeAssertion = typeAssertionFromStatement(statement, context);
129
-
130
- if (typeAssertion !== null) {
131
- const statementString = statement.getString();
132
-
133
- context.trace(`Verifying the '${statementString}' statement as a type assertion...`);
134
-
135
- const typeAssertionVerifies = typeAssertion.verify(assignments, stated, context);
136
-
137
- verifiesAsTypeAssertion = typeAssertionVerifies; ///
138
-
139
- if (verifiesAsTypeAssertion) {
140
- const assertion = typeAssertion; ///
141
-
142
- context.addAssertion(assertion);
143
-
144
- context.debug(`...verified the '${statementString}' statement as a type assertion.`);
145
- }
146
- }
147
-
148
- return verifiesAsTypeAssertion;
149
- }
150
-
151
- function verifyAsDefinedAssertion(statement, assignments, stated, context) {
152
- let verifiesAsDefinedAssertion = false;
153
-
154
- const definedAssertion = definedAssertionFromStatement(statement, context);
155
-
156
- if (definedAssertion !== null) {
157
- const statementString = statement.getString();
158
-
159
- context.trace(`Verifying the '${statementString}' statement as a defined assertion...`);
160
-
161
- const definedAssertionVerifies = definedAssertion.verify(assignments, stated, context);
162
-
163
- verifiesAsDefinedAssertion = definedAssertionVerifies; ///
164
-
165
- if (verifiesAsDefinedAssertion) {
166
- const assertion = definedAssertion; ///
167
-
168
- context.addAssertion(assertion);
169
-
170
- context.debug(`...verified the '${statementString}' statement as a defined assertion.`);
171
- }
172
- }
173
-
174
- return verifiesAsDefinedAssertion;
175
- }
176
-
177
- function verifyAsPropertyAssertion(statement, assignments, stated, context) {
178
- let verifiesAsPropertyAssertion = false;
179
-
180
- const propertyAssertion = propertyAssertionFromStatement(statement, context);
181
-
182
- if (propertyAssertion !== null) {
183
- const statementString = statement.getString();
184
-
185
- context.trace(`Verifying the '${statementString}' statement as a property assertion...`);
186
-
187
- const propertyAssertionVerifies = propertyAssertion.verify(assignments, stated, context);
188
-
189
- verifiesAsPropertyAssertion = propertyAssertionVerifies; ///
190
-
191
- if (verifiesAsPropertyAssertion) {
192
- const assertion = propertyAssertion; ///
193
-
194
- context.addAssertion(assertion);
195
-
196
- context.debug(`...verified the '${statementString}' statement as a property assertion.`);
197
- }
198
- }
199
-
200
- return verifiesAsPropertyAssertion;
201
- }
202
-
203
- function verifyAsSubproofAssertion(statement, assignments, stated, context) {
204
- let verifiesAsSubproofAssertion = false;
205
-
206
- const subproofAssertion = subproofAssertionFromStatement(statement, context);
207
-
208
- if (subproofAssertion !== null) {
209
- const statementString = statement.getString();
210
-
211
- context.trace(`Verifying the '${statementString}' statement as a subproof assertion...`);
212
-
213
- const subproofAssertionVerifies = subproofAssertion.verify(assignments, stated, context);
214
-
215
- verifiesAsSubproofAssertion = subproofAssertionVerifies; ///
216
-
217
- if (verifiesAsSubproofAssertion) {
218
- const assertion = subproofAssertion; ///
219
-
220
- context.addAssertion(assertion);
221
-
222
- context.debug(`...verified the '${statementString}' statement as a subproof assertion.`);
223
- }
224
- }
225
-
226
- return verifiesAsSubproofAssertion;
227
- }
228
-
229
- function verifyAsContainedAssertion(statement, assignments, stated, context) {
230
- let verifiesAsContainedAssertion = false;
231
-
232
- const containedAssertion = containedAssertionFromStatement(statement, context);
233
-
234
- if (containedAssertion !== null) {
235
- const statementString = statement.getString();
236
-
237
- context.trace(`Verifying the '${statementString}' statement as a contained assertion...`);
238
-
239
- const containedAssertionVerifies = containedAssertion.verify(assignments, stated, context);
240
-
241
- verifiesAsContainedAssertion = containedAssertionVerifies; ///
242
-
243
- if (verifiesAsContainedAssertion) {
244
- const assertion = containedAssertion; ///
245
-
246
- context.addAssertion(assertion);
247
-
248
- context.debug(`...verified the '${statementString}' statement as a contained assertion.`);
249
- }
250
- }
251
-
252
- return verifiesAsContainedAssertion;
253
- }
254
-
255
- function verifyAsSatisfiesAssertion(statement, assignments, stated, context) {
256
- let verifiesAsSatisfiesAssertion = false;
257
-
258
- const satisfiesAssertion = satisfiesAssertionFromStatement(statement, context);
259
-
260
- if (satisfiesAssertion !== null) {
261
- const statementString = statement.getString();
262
-
263
- context.trace(`Verifying the '${statementString}' statement as a satisfies assertion...`);
264
-
265
- const satisfiesAssertionVerifies = satisfiesAssertion.verify(assignments, stated, context);
266
-
267
- verifiesAsSatisfiesAssertion = satisfiesAssertionVerifies; ///
268
-
269
- if (verifiesAsSatisfiesAssertion) {
270
- const assertion = satisfiesAssertion; ///
271
-
272
- context.addAssertion(assertion);
273
-
274
- context.debug(`...verified the '${statementString}' statement as a satisfies assertion.`);
275
- }
276
- }
277
-
278
- return verifiesAsSatisfiesAssertion;
279
- }
280
-
281
- const verifyMixins = [
282
- verifyAsMetavariableAndSubstitution,
283
- unifyWithBracketedCombinator,
284
- unifyWithCombinators,
285
- verifyAsEquality,
286
- verifyAsJudgement,
287
- verifyAsTypeAssertion,
288
- verifyAsDefinedAssertion,
289
- verifyAsPropertyAssertion,
290
- verifyAsSubproofAssertion,
291
- verifyAsContainedAssertion,
292
- verifyAsSatisfiesAssertion
293
- ];
294
-
295
- export default verifyMixins;
@@ -1,81 +0,0 @@
1
- "use strict";
2
-
3
- import elements from "../../elements";
4
-
5
- function unifyWithBracketedConstructor(term, context, verifyAhead) {
6
- let unifiesWithBracketedConstructor;
7
-
8
- const { BracketedConstructor } = elements,
9
- bracketedConstructor = BracketedConstructor.fromNothing();
10
-
11
- unifiesWithBracketedConstructor = bracketedConstructor.unifyTerm(term, context, verifyAhead);
12
-
13
- return unifiesWithBracketedConstructor;
14
- }
15
-
16
- function unifyWithConstructors(term, context, verifyAhead) {
17
- let unifiesWithConstructors;
18
-
19
- const constructors = context.getConstructors();
20
-
21
- unifiesWithConstructors = constructors.some((constructor) => {
22
- const unifiesWithConstructor = constructor.unifyTerm(term, context, verifyAhead);
23
-
24
- if (unifiesWithConstructor) {
25
- return true;
26
- }
27
- });
28
-
29
- return unifiesWithConstructors;
30
- }
31
-
32
- function verifyTermAsVariable(term, context, verifyAhead) {
33
- let termVerifiesAsVariable = false;
34
-
35
- const { Variable } = elements,
36
- termNode = term.getNode(),
37
- singularVariableNode = termNode.getSingularVariableNode();
38
-
39
- if (singularVariableNode !== null) {
40
- let variable;
41
-
42
- const termString = term.getString(),
43
- variableNode = singularVariableNode; ///
44
-
45
- variable = Variable.fromVariableNode(variableNode, context);
46
-
47
- context.trace(`Verifying the '${termString}' term as a variable...`);
48
-
49
- const variableVerifies = variable.verify(context);
50
-
51
- if (variableVerifies) {
52
- let verifiesAhead;
53
-
54
- const variableIdentifier = variable.getIdentifier();
55
-
56
- variable = context.findVariableByVariableIdentifier(variableIdentifier);
57
-
58
- const type = variable.getType();
59
-
60
- term.setType(type);
61
-
62
- verifiesAhead = verifyAhead();
63
-
64
- termVerifiesAsVariable = verifiesAhead; ///
65
- }
66
-
67
- if (termVerifiesAsVariable) {
68
- context.debug(`...verified the '${termString}' term as a variable.`);
69
- }
70
- }
71
-
72
- return termVerifiesAsVariable;
73
- }
74
-
75
- const verifyMixins = [
76
- unifyWithBracketedConstructor,
77
- unifyWithConstructors,
78
- verifyTermAsVariable
79
- ];
80
-
81
- export default verifyMixins;