occam-verify-cli 1.0.420 → 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 +10 -10
  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
package/src/preamble.js CHANGED
@@ -1,64 +1,64 @@
1
1
  "use strict";
2
2
 
3
- import Type from "./ontology/type";
4
- import Term from "./ontology/term";
5
- import Rule from "./ontology/rule";
6
- import Step from "./ontology/step";
7
- import Label from "./ontology/label";
8
- import Axiom from "./ontology/axiom";
9
- import Lemma from "./ontology/lemma";
10
- import Frame from "./ontology/frame";
11
- import Proof from "./ontology/proof";
12
- import Error from "./ontology/error";
13
- import Premise from "./ontology/premise";
14
- import Theorem from "./ontology/theorem";
15
- import Section from "./ontology/section";
16
- import Equality from "./ontology/equality";
17
- import MetaType from "./ontology/metaType";
18
- import Subproof from "./ontology/subproof";
19
- import Variable from "./ontology/variable";
20
- import Property from "./ontology/property";
21
- import Parameter from "./ontology/parameter";
22
- import Reference from "./ontology/reference";
23
- import Statement from "./ontology/statement";
24
- import Judgement from "./ontology/judgement";
25
- import MetaLemma from "./ontology/metaLemma";
26
- import Deduction from "./ontology/deduction";
27
- import Signature from "./ontology/signature";
28
- import TypePrefix from "./ontology/typePrefix";
29
- import Conjecture from "./ontology/conjecture";
30
- import Conclusion from "./ontology/conclusion";
31
- import Derivation from "./ontology/derivation";
32
- import Combinator from "./ontology/combinator";
33
- import Hypothesis from "./ontology/hypothesis";
34
- import Assumption from "./ontology/assumption";
35
- import Constructor from "./ontology/constructor";
36
- import Supposition from "./ontology/supposition";
37
- import Metatheorem from "./ontology/metatheorem";
38
- import Equivalence from "./ontology/equivalence";
39
- import Equivalences from "./ontology/equivalences";
40
- import Metavariable from "./ontology/metavariable";
41
- import Substitutions from "./ontology/substitutions";
42
- import ProcedureCall from "./ontology/procedureCall";
43
- import SubDerivation from "./ontology/subDerivation";
44
- import TypeAssertion from "./ontology/assertion/type";
45
- import PropertyRelation from "./ontology/propertyRelation";
46
- import DefinedAssertion from "./ontology/assertion/defined";
47
- import TermSubstitution from "./ontology/substitution/term";
48
- import FrameSubstitution from "./ontology/substitution/frame";
49
- import SubproofAssertion from "./ontology/assertion/subproof";
50
- import PropertyAssertion from "./ontology/assertion/property";
51
- import ProcedureReference from "./ontology/procedureReference";
52
- import ContainedAssertion from "./ontology/assertion/contained";
53
- import SatisfiesAssertion from "./ontology/assertion/satisfies";
54
- import VariableDeclaration from "./ontology/declaration/variable";
55
- import BracketedCombinator from "./ontology/combinator/bracketed";
56
- import BracketedConstructor from "./ontology/constructor/bracketed";
57
- import SimpleTypeDeclaration from "./ontology/declaration/simpleType";
58
- import StatementSubstitution from "./ontology/substitution/statement";
59
- import ReferenceSubstitution from "./ontology/substitution/reference";
60
- import CombinatorDeclaration from "./ontology/declaration/combinator";
61
- import TypePrefixDeclaration from "./ontology/declaration/typePrefix";
62
- import ConstructorDeclaration from "./ontology/declaration/constructor";
63
- import ComplexTypeDeclaration from "./ontology/declaration/complexType";
64
- import MetavariableDeclaration from "./ontology/declaration/metavariable";
3
+ import Type from "./element/type";
4
+ import Term from "./element/term";
5
+ import Rule from "./element/rule";
6
+ import Step from "./element/step";
7
+ import Label from "./element/label";
8
+ import Axiom from "./element/axiom";
9
+ import Lemma from "./element/lemma";
10
+ import Frame from "./element/frame";
11
+ import Proof from "./element/proof";
12
+ import Error from "./element/error";
13
+ import Premise from "./element/premise";
14
+ import Theorem from "./element/theorem";
15
+ import Section from "./element/section";
16
+ import Equality from "./element/equality";
17
+ import MetaType from "./element/metaType";
18
+ import Subproof from "./element/subproof";
19
+ import Variable from "./element/variable";
20
+ import Property from "./element/property";
21
+ import Parameter from "./element/parameter";
22
+ import Reference from "./element/reference";
23
+ import Statement from "./element/statement";
24
+ import Judgement from "./element/judgement";
25
+ import MetaLemma from "./element/metaLemma";
26
+ import Deduction from "./element/deduction";
27
+ import Signature from "./element/signature";
28
+ import TypePrefix from "./element/typePrefix";
29
+ import Conjecture from "./element/conjecture";
30
+ import Conclusion from "./element/conclusion";
31
+ import Derivation from "./element/derivation";
32
+ import Hypothesis from "./element/hypothesis";
33
+ import Assumption from "./element/assumption";
34
+ import Supposition from "./element/supposition";
35
+ import Metatheorem from "./element/metatheorem";
36
+ import Equivalence from "./element/equivalence";
37
+ import Equivalences from "./element/equivalences";
38
+ import Metavariable from "./element/metavariable";
39
+ import Substitutions from "./element/substitutions";
40
+ import ProcedureCall from "./element/procedureCall";
41
+ import SubDerivation from "./element/subDerivation";
42
+ import TypeAssertion from "./element/assertion/type";
43
+ import ConstructorTerm from "./element/term/constructor";
44
+ import PropertyRelation from "./element/propertyRelation";
45
+ import DefinedAssertion from "./element/assertion/defined";
46
+ import TermSubstitution from "./element/substitution/term";
47
+ import FrameSubstitution from "./element/substitution/frame";
48
+ import SubproofAssertion from "./element/assertion/subproof";
49
+ import PropertyAssertion from "./element/assertion/property";
50
+ import ProcedureReference from "./element/procedureReference";
51
+ import ContainedAssertion from "./element/assertion/contained";
52
+ import SatisfiesAssertion from "./element/assertion/satisfies";
53
+ import VariableDeclaration from "./element/declaration/variable";
54
+ import CombinatorStatement from "./element/statement/combinator";
55
+ import SimpleTypeDeclaration from "./element/declaration/simpleType";
56
+ import StatementSubstitution from "./element/substitution/statement";
57
+ import ReferenceSubstitution from "./element/substitution/reference";
58
+ import CombinatorDeclaration from "./element/declaration/combinator";
59
+ import TypePrefixDeclaration from "./element/declaration/typePrefix";
60
+ import ConstructorDeclaration from "./element/declaration/constructor";
61
+ import ComplexTypeDeclaration from "./element/declaration/complexType";
62
+ import MetavariableDeclaration from "./element/declaration/metavariable";
63
+ import BracketedConstructorTerm from "./element/term/constructor/bracketed";
64
+ import BracketedCombinatorStatement from "./element/statement/combinator/bracketed";
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ export function judgementAssignmentFromJudgement(judgement) {
4
+ return function (context) {
5
+ const judgementString = judgement.getString(),
6
+ judgementAdded = context.addJudgement(judgement),
7
+ assigned = judgementAdded; ///
8
+
9
+ assigned ?
10
+ context.trace(`Assigned the '${judgementString}' judgement.`) :
11
+ context.debug(`Unable to assign the '${judgementString}' judgement.`);
12
+
13
+ return assigned;
14
+ };
15
+ }
16
+
17
+ export function equalityAssignmentFromEquality(equality) {
18
+ return function (context) {
19
+ const equalityString = equality.getString(),
20
+ equalityAdded = context.addEquality(equality),
21
+ assigned = equalityAdded; ///
22
+
23
+ assigned ?
24
+ context.trace(`Assigned the '${equalityString}' equality.`) :
25
+ context.debug(`Unable to assign the '${equalityString}' equality.`);
26
+
27
+ return assigned;
28
+ };
29
+ }
30
+
31
+ export function variableAssignmentFromVariable(variable) {
32
+ return function (context) {
33
+ const nested = false;
34
+
35
+ context.addVariable(variable, nested);
36
+
37
+ const variableTypeString = variable.getTypeString(),
38
+ variableString = variable.getString(),
39
+ assigned = true;
40
+
41
+ assigned ?
42
+ context.trace(`Assigned the '${variableString}' variable with type '${variableTypeString}'.`) :
43
+ context.debug(`Unable to assign the '${variableString}' variable with type '${variableTypeString}'.`);
44
+
45
+ return assigned;
46
+ };
47
+ }
48
+
49
+ export default function assignAssignments(assignments, context) {
50
+ const assignmentsAssigned = assignments.every((assigment) => {
51
+ const assigned = assigment(context);
52
+
53
+ if (assigned) {
54
+ return true;
55
+ }
56
+ });
57
+
58
+ return assignmentsAssigned;
59
+ }
@@ -1,23 +1,75 @@
1
1
  "use strict";
2
2
 
3
+ import nominalContext from "../context/nominal";
4
+
3
5
  import { ruleFromBNF } from "../utilities/bnf";
6
+ import { BASE_TYPE_SYMBOL } from "../constants";
7
+ import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
8
+
9
+ const termPlaceholderBNF = ` _ ::= term... <END_OF_LINE> ; `,
10
+ variablePlaceholderBNF = ` _ ::= variable... <END_OF_LINE> ; `,
11
+ statementPlaceholderBNF = ` _ ::= statement... <END_OF_LINE> ; `,
12
+ metavariablePlaceholderBNF = ` _ ::= metavariable... <END_OF_LINE> ; `,
13
+ termSubstitutionPlaceholderBNF = ` _ ::= termSubstitution... <END_OF_LINE> ; `,
14
+ frameSubstitutionPlaceholderBNF = ` _ ::= frameSubstitution... <END_OF_LINE> ; `,
15
+ statementSubstitutionPlaceholderBNF = ` _ ::= statementSubstitution... <END_OF_LINE> ; `,
16
+ referenceSubstitutionPlaceholderBNF = ` _ ::= referenceSubstitution... <END_OF_LINE> ; `,
17
+ termPlaceholderRule = ruleFromBNF(termPlaceholderBNF),
18
+ variablePlaceholderRule = ruleFromBNF(variablePlaceholderBNF),
19
+ statementPlaceholderRule = ruleFromBNF(statementPlaceholderBNF),
20
+ metavariablePlaceholderRule = ruleFromBNF(metavariablePlaceholderBNF),
21
+ termSubstitutionPlaceholderRule = ruleFromBNF(termSubstitutionPlaceholderBNF),
22
+ frameSubstitutionPlaceholderRule = ruleFromBNF(frameSubstitutionPlaceholderBNF),
23
+ statementSubstitutionPlaceholderRule = ruleFromBNF(statementSubstitutionPlaceholderBNF),
24
+ referenceSubstitutionPlaceholderRule = ruleFromBNF(referenceSubstitutionPlaceholderBNF);
25
+
26
+ let bracketedConstructorTermNode = null,
27
+ bracketedCombinatorStatementNode = null;
28
+
29
+ export const bracketedConstructorTermString = `(${BASE_TYPE_SYMBOL})`;
30
+ export const bracketedCombinatorStatementString = `(${STATEMENT_META_TYPE_NAME})`;
31
+
32
+ export function instantiateTerm(string, context) { return instantiate(termPlaceholderRule, string, context); }
33
+
34
+ export function instantiateVariable(string, context) { return instantiate(variablePlaceholderRule, string, context); }
35
+
36
+ export function instantiateStatement(string, context) { return instantiate(statementPlaceholderRule, string, context); }
37
+
38
+ export function instantiateMetavariable(string, context) { return instantiate(metavariablePlaceholderRule, string, context); }
4
39
 
5
- const termSubtitutionnPlaceholderBNF = ` _ ::= termSubstitution... <END_OF_LINE> ; `,
6
- frameSubtitutionnPlaceholderBNF = ` _ ::= frameSubstitution... <END_OF_LINE> ; `,
7
- statementSubtitutionnPlaceholderBNF = ` _ ::= statementSubstitution... <END_OF_LINE> ; `,
8
- referenceSubtitutionnPlaceholderBNF = ` _ ::= referenceSubstitution... <END_OF_LINE> ; `,
9
- termSubtitutionnPlaceholderRule = ruleFromBNF(termSubtitutionnPlaceholderBNF),
10
- frameSubtitutionnPlaceholderRule = ruleFromBNF(frameSubtitutionnPlaceholderBNF),
11
- statementSubtitutionnPlaceholderRule = ruleFromBNF(statementSubtitutionnPlaceholderBNF),
12
- referenceSubtitutionnPlaceholderRule = ruleFromBNF(referenceSubtitutionnPlaceholderBNF);
40
+ export function instantiateTermSubstitution(string, context) { return instantiate(termSubstitutionPlaceholderRule, string, context); }
13
41
 
14
- export function instantiateTermSubstitution(string, context) { return instantiate(termSubtitutionnPlaceholderRule, string, context); }
42
+ export function instantiateFrameSubstitution(string, context) { return instantiate(frameSubstitutionPlaceholderRule, string, context); }
15
43
 
16
- export function instantiateFrameSubstitution(string, context) { return instantiate(frameSubtitutionnPlaceholderRule, string, context); }
44
+ export function instantiateStatementSubstitution(string, context) { return instantiate(statementSubstitutionPlaceholderRule, string, context); }
17
45
 
18
- export function instantiateStatementSubstitution(string, context) { return instantiate(statementSubtitutionnPlaceholderRule, string, context); }
46
+ export function instantiateReferenceSubstitution(string, context) { return instantiate(referenceSubstitutionPlaceholderRule, string, context); }
19
47
 
20
- export function instantiateReferenceSubstitution(string, context) { return instantiate(referenceSubtitutionnPlaceholderRule, string, context); }
48
+ export function instantiateBracketedConstructorTerm() {
49
+ if (bracketedConstructorTermNode === null) {
50
+ const placeholderRule = termPlaceholderRule, ///
51
+ string = bracketedConstructorTermString,
52
+ context = nominalContext, ///
53
+ node = instantiate(placeholderRule, string, context);
54
+
55
+ bracketedConstructorTermNode = node; ///
56
+ }
57
+
58
+ return bracketedConstructorTermNode;
59
+ }
60
+
61
+ export function instantiateBracketedCombinatorStatement() {
62
+ if (bracketedCombinatorStatementNode === null) {
63
+ const placeholderRule = statementPlaceholderRule, ///
64
+ string = bracketedCombinatorStatementString, ///
65
+ context = nominalContext, ///
66
+ node = instantiate(placeholderRule, string, context);
67
+
68
+ bracketedCombinatorStatementNode = node; ///
69
+ }
70
+
71
+ return bracketedCombinatorStatementNode;
72
+ }
21
73
 
22
74
  function instantiate(placeholderRule, string, context) {
23
75
  let node;
@@ -26,8 +78,8 @@ function instantiate(placeholderRule, string, context) {
26
78
  parser = context.getParser(),
27
79
  content = `${string}
28
80
  `,
29
- startRule = placeholderRule, ///
30
- tokens = lexer.tokenise(content);
81
+ tokens = lexer.tokenise(content),
82
+ startRule = placeholderRule; ///
31
83
 
32
84
  node = parser.parse(tokens, startRule);
33
85
 
@@ -37,7 +89,7 @@ function instantiate(placeholderRule, string, context) {
37
89
  node = childNode; ///
38
90
 
39
91
  return true;
40
- })
92
+ });
41
93
 
42
94
  return node;
43
95
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import ontology from "../ontology";
3
+ import elements from "../elements";
4
4
 
5
5
  import { nodeQuery } from "../utilities/query";
6
6
  import { terminalNodeMapFromNodes, areTerminalNodeMapsEqual, isLastRemainingArgumentFunction } from "../utilities/pass";
@@ -346,7 +346,7 @@ class CombinatorPass extends Pass {
346
346
 
347
347
  context = specificContext; ///
348
348
 
349
- const { Statement } = ontology,
349
+ const { Statement } = elements,
350
350
  statement = Statement.fromStatementNode(statementNode, context),
351
351
  statementVerifiesGivenType = statement.verifyGivenMetaType(metaType, assignments, stated, context);
352
352
 
@@ -375,7 +375,7 @@ class CombinatorPass extends Pass {
375
375
 
376
376
  context = specificContext; ///
377
377
 
378
- const { Frame } = ontology,
378
+ const { Frame } = elements,
379
379
  frame = Frame.fromFrameNode(frameNode, context),
380
380
  frameVerifiesGivenType = frame.verifyGivenMetaType(metaType, assignments, stated, context);
381
381
 
@@ -405,7 +405,7 @@ class CombinatorPass extends Pass {
405
405
  if (type !== null) {
406
406
  context = specificContext; ///
407
407
 
408
- const { Term } = ontology,
408
+ const { Term } = elements,
409
409
  term = Term.fromTermNode(termNode, context),
410
410
  termVerifiesGivenType = term.verifyGivenType(type, generalContext, specificContext);
411
411
 
@@ -441,7 +441,7 @@ class ConstructorPass extends Pass {
441
441
  if (type !== null) {
442
442
  context = specificContext; ///
443
443
 
444
- const { Term } = ontology,
444
+ const { Term } = elements,
445
445
  term = Term.fromTermNode(termNode, context),
446
446
  termVerifiesGivenType = term.verifyGivenType(type, generalContext, specificContext);
447
447
 
@@ -567,23 +567,6 @@ export function unifyMetavariable(generalMetavariable, specificMetavariable, gen
567
567
  return metavariableUnifies;
568
568
  }
569
569
 
570
- export function unifyTermWithConstructor(term, constructor, context) {
571
- let termUnifiesWithConstructor = false;
572
-
573
- const termNode = term.getNode(),
574
- generalContext = context, ///
575
- specificContext = context, ///
576
- constructorTerm = constructor.getTerm(),
577
- constructorTermNode = constructorTerm.getNode(),
578
- success = constructorPass.run(constructorTermNode, termNode, generalContext, specificContext);
579
-
580
- if (success) {
581
- termUnifiesWithConstructor = true;
582
- }
583
-
584
- return termUnifiesWithConstructor;
585
- }
586
-
587
570
  export function unifyStatementIntrinsically(generalStatement, specificStatement, substitutions, generalContext, specificContext) {
588
571
  let statementUnifiesIntrinsically = false;
589
572
 
@@ -600,23 +583,6 @@ export function unifyStatementIntrinsically(generalStatement, specificStatement,
600
583
  return statementUnifiesIntrinsically;
601
584
  }
602
585
 
603
- export function unifyStatementWithCombinator(statement, combinator, assignments, stated, context) {
604
- let statementUnifiesWithCombinator = false;
605
-
606
- const statementNode = statement.getNode(),
607
- generalContext = context, ///
608
- specificContext = context, ///
609
- combinatorStatement = combinator.getStatement(),
610
- combinatorStatementNode = combinatorStatement.getNode(),
611
- success = combinatorPass.run(combinatorStatementNode, statementNode, assignments, stated, generalContext, specificContext);
612
-
613
- if (success) {
614
- statementUnifiesWithCombinator = true;
615
- }
616
-
617
- return statementUnifiesWithCombinator;
618
- }
619
-
620
586
  export function unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, substitutions, generalContext, specificContext) {
621
587
  let metavariableUnifiesIntrinsically = false;
622
588
 
@@ -632,3 +598,35 @@ export function unifyMetavariableIntrinsically(generalMetavariable, specificMeta
632
598
 
633
599
  return metavariableUnifiesIntrinsically;
634
600
  }
601
+
602
+ export function unifyTermWithConstructorTerm(term, constructorTerm, context) {
603
+ let termUnifiesWithConstructor = false;
604
+
605
+ const termNode = term.getNode(),
606
+ generalContext = context, ///
607
+ specificContext = context, ///
608
+ constructorTermNode = constructorTerm.getNode(),
609
+ success = constructorPass.run(constructorTermNode, termNode, generalContext, specificContext);
610
+
611
+ if (success) {
612
+ termUnifiesWithConstructor = true;
613
+ }
614
+
615
+ return termUnifiesWithConstructor;
616
+ }
617
+
618
+ export function unifyStatementWithCombinatorStatement(statement, combinatorStatement, assignments, stated, context) {
619
+ let statementUnifiesWithCombinator = false;
620
+
621
+ const statementNode = statement.getNode(),
622
+ generalContext = context, ///
623
+ specificContext = context, ///
624
+ combinatorStatementNode = combinatorStatement.getNode(),
625
+ success = combinatorPass.run(combinatorStatementNode, statementNode, assignments, stated, generalContext, specificContext);
626
+
627
+ if (success) {
628
+ statementUnifiesWithCombinator = true;
629
+ }
630
+
631
+ return statementUnifiesWithCombinator;
632
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import ontology from "../ontology";
3
+ import elements from "../elements";
4
4
 
5
5
  import { nodeQuery } from "../utilities/query";
6
6
  import { isLastRemainingArgumentFunction } from "../utilities/pass";
@@ -182,7 +182,7 @@ class TopLevelPass extends Pass {
182
182
  run: (errorNode, context) => {
183
183
  let success = false;
184
184
 
185
- const { Error } = ontology,
185
+ const { Error } = elements,
186
186
  error = Error.fromErrorNode(errorNode, context),
187
187
  errorVerifies = error.verify();
188
188
 
@@ -198,7 +198,7 @@ class TopLevelPass extends Pass {
198
198
  run: (ruleNode, context) => {
199
199
  let success = false;
200
200
 
201
- const { Rule } = ontology,
201
+ const { Rule } = elements,
202
202
  rule = Rule.fromRuleNode(ruleNode, context),
203
203
  ruleVerifies = rule.verify();
204
204
 
@@ -214,7 +214,7 @@ class TopLevelPass extends Pass {
214
214
  run: (axiomNode, context) => {
215
215
  let success = false;
216
216
 
217
- const { Axiom } = ontology,
217
+ const { Axiom } = elements,
218
218
  axiom = Axiom.fromAxiomNode(axiomNode, context),
219
219
  axiomVerifies = axiom.verify();
220
220
 
@@ -230,7 +230,7 @@ class TopLevelPass extends Pass {
230
230
  run: (lemmaNode, context) => {
231
231
  let success = false;
232
232
 
233
- const { Lemma } = ontology,
233
+ const { Lemma } = elements,
234
234
  lemma = Lemma.fromLemmaNode(lemmaNode, context),
235
235
  lemmaVerifies = lemma.verify();
236
236
 
@@ -246,7 +246,7 @@ class TopLevelPass extends Pass {
246
246
  run: (sectionNode, context) => {
247
247
  let success = false;
248
248
 
249
- const { Section } = ontology,
249
+ const { Section } = elements,
250
250
  section = Section.fromSectionNode(sectionNode, context),
251
251
  sectionVerifies = section.verify();
252
252
 
@@ -262,7 +262,7 @@ class TopLevelPass extends Pass {
262
262
  run: (theoremNode, context) => {
263
263
  let success = false;
264
264
 
265
- const { Theorem } = ontology,
265
+ const { Theorem } = elements,
266
266
  theorem = Theorem.fromTheoremNode(theoremNode, context),
267
267
  theoremVerifies = theorem.verify();
268
268
 
@@ -278,7 +278,7 @@ class TopLevelPass extends Pass {
278
278
  run: (metaLemmaNode, context) => {
279
279
  let success = false;
280
280
 
281
- const { MetaLemma } = ontology,
281
+ const { MetaLemma } = elements,
282
282
  metaLemma = MetaLemma.fromMetaLemmaNode(metaLemmaNode, context),
283
283
  metaLemmaVerifies = metaLemma.verify();
284
284
 
@@ -294,7 +294,7 @@ class TopLevelPass extends Pass {
294
294
  run: (conjectureNode, context) => {
295
295
  let success = false;
296
296
 
297
- const { Conjecture } = ontology,
297
+ const { Conjecture } = elements,
298
298
  conjecture = Conjecture.fromConjectureNode(conjectureNode, context),
299
299
  conjectureVerifies = conjecture.verify();
300
300
 
@@ -310,7 +310,7 @@ class TopLevelPass extends Pass {
310
310
  run: (metatheoremNode, context) => {
311
311
  let success = false;
312
312
 
313
- const { Metatheorem } = ontology,
313
+ const { Metatheorem } = elements,
314
314
  metatheorem = Metatheorem.fromMetatheoremNode(metatheoremNode, context),
315
315
  metatheoremVerifies = metatheorem.verify();
316
316
 
@@ -326,7 +326,7 @@ class TopLevelPass extends Pass {
326
326
  run: (variableDeclarationNode, context) => {
327
327
  let success = false;
328
328
 
329
- const { VariableDeclaration } = ontology,
329
+ const { VariableDeclaration } = elements,
330
330
  variableDeclaration = VariableDeclaration.fromVariableDeclarationNode(variableDeclarationNode, context),
331
331
  variableDeclarationVerifies = variableDeclaration.verify();
332
332
 
@@ -342,7 +342,7 @@ class TopLevelPass extends Pass {
342
342
  run: (simpleTypeDeclarationNode, context) => {
343
343
  let success = false;
344
344
 
345
- const { SimpleTypeDeclaration } = ontology,
345
+ const { SimpleTypeDeclaration } = elements,
346
346
  simpleTypeDeclaration = SimpleTypeDeclaration.fromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context),
347
347
  simpleTypeDeclarationVerifies = simpleTypeDeclaration.verify();
348
348
 
@@ -358,7 +358,7 @@ class TopLevelPass extends Pass {
358
358
  run: (typePrefixDeclarationNode, context) => {
359
359
  let success = false;
360
360
 
361
- const { TypePrefixDeclaration } = ontology,
361
+ const { TypePrefixDeclaration } = elements,
362
362
  typePrefixDeclaration = TypePrefixDeclaration.fromTypePrefixDeclarationNode(typePrefixDeclarationNode, context),
363
363
  typePrefixDeclarationVerifies = typePrefixDeclaration.verify();
364
364
 
@@ -374,7 +374,7 @@ class TopLevelPass extends Pass {
374
374
  run: (combinatorDeclarationNode, context) => {
375
375
  let success = false;
376
376
 
377
- const { CombinatorDeclaration } = ontology,
377
+ const { CombinatorDeclaration } = elements,
378
378
  combinatorDeclaration = CombinatorDeclaration.fromCombinatorDeclarationNode(combinatorDeclarationNode, context),
379
379
  combinatorDeclarationVerifies = combinatorDeclaration.verify();
380
380
 
@@ -390,7 +390,7 @@ class TopLevelPass extends Pass {
390
390
  run: (constructorDeclarationNode, context) => {
391
391
  let success = false;
392
392
 
393
- const { ConstructorDeclaration } = ontology,
393
+ const { ConstructorDeclaration } = elements,
394
394
  constructorDeclaration = ConstructorDeclaration.fromConstructorDeclarationNode(constructorDeclarationNode, context),
395
395
  constructorDeclarationVerifies = constructorDeclaration.verify();
396
396
 
@@ -406,7 +406,7 @@ class TopLevelPass extends Pass {
406
406
  run: (complexTypeDeclarationNode, context) => {
407
407
  let success = false;
408
408
 
409
- const { ComplexTypeDeclaration } = ontology,
409
+ const { ComplexTypeDeclaration } = elements,
410
410
  complexTypeDeclaration = ComplexTypeDeclaration.fromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
411
411
  complexTypeDeclarationVerifies = complexTypeDeclaration.verify();
412
412
 
@@ -422,7 +422,7 @@ class TopLevelPass extends Pass {
422
422
  run: (metavariableDeclarationNode, context) => {
423
423
  let success = false;
424
424
 
425
- const { MetavariableDeclaration } = ontology,
425
+ const { MetavariableDeclaration } = elements,
426
426
  metavariableDeclaration = MetavariableDeclaration.fromMetavariableDeclarationNode(metavariableDeclarationNode, context),
427
427
  metavariableDeclarationVerifies = metavariableDeclaration.verify();
428
428
 
@@ -457,7 +457,7 @@ class CombinatorPass extends Pass {
457
457
  run: (statementNode, context) => {
458
458
  let success = false;
459
459
 
460
- const { Statement } = ontology,
460
+ const { Statement } = elements,
461
461
  statement = Statement.fromStatementNode(statementNode, context),
462
462
  assignments = null,
463
463
  stated = false,
@@ -475,7 +475,7 @@ class CombinatorPass extends Pass {
475
475
  run: (termNode, context) => {
476
476
  let success = false;
477
477
 
478
- const { Term } = ontology,
478
+ const { Term } = elements,
479
479
  term = Term.fromTermNode(termNode, context),
480
480
  termVerifies = term.verify(context, () => {
481
481
  const verifiesAhead = true;
@@ -529,7 +529,7 @@ class ConstructorPass extends Pass {
529
529
  run: (termNode, context, verifyAhead) => {
530
530
  let success = false;
531
531
 
532
- const { Term } = ontology,
532
+ const { Term } = elements,
533
533
  term = Term.fromTermNode(termNode, context),
534
534
  termVerifies = term.verify(context, verifyAhead);
535
535