occam-verify-cli 1.0.421 → 1.0.428

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 (278) 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 +312 -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/equivalence.js +116 -0
  79. package/lib/node/substitution/frame.js +15 -1
  80. package/lib/node/substitution/statement.js +37 -1
  81. package/lib/node/substitution/term.js +15 -1
  82. package/lib/nonTerminalNodeMap.js +4 -3
  83. package/lib/preamble.js +63 -63
  84. package/lib/process/assign.js +58 -0
  85. package/lib/process/instantiate.js +74 -7
  86. package/lib/process/unify.js +26 -26
  87. package/lib/process/verify.js +21 -21
  88. package/lib/ruleNames.js +5 -1
  89. package/lib/utilities/brackets.js +9 -18
  90. package/lib/utilities/customGrammar.js +1 -1
  91. package/lib/utilities/element.js +1141 -0
  92. package/lib/utilities/json.js +32 -32
  93. package/lib/utilities/node.js +49 -61
  94. package/lib/utilities/statement.js +83 -0
  95. package/lib/utilities/string.js +80 -57
  96. package/package.json +6 -6
  97. package/src/action/verify.js +8 -1
  98. package/src/context/file.js +9 -39
  99. package/src/context/local.js +5 -11
  100. package/src/context/nominal.js +30 -0
  101. package/src/context/release.js +1 -1
  102. package/src/context/temporary.js +6 -63
  103. package/src/{ontology → element}/assertion/contained.js +4 -25
  104. package/src/{ontology → element}/assertion/defined.js +7 -26
  105. package/src/{ontology → element}/assertion/property.js +7 -26
  106. package/src/{ontology → element}/assertion/satisfies.js +5 -53
  107. package/src/{ontology → element}/assertion/subproof.js +3 -32
  108. package/src/{ontology → element}/assertion/type.js +7 -26
  109. package/src/{ontology → element}/assertion.js +6 -6
  110. package/src/{ontology → element}/assumption.js +3 -27
  111. package/src/{ontology → element}/axiom.js +4 -11
  112. package/src/{ontology/topLevelAssertion.js → element/axiomLemmaTheoremConjecture.js} +9 -105
  113. package/src/{ontology → element}/conclusion.js +4 -19
  114. package/src/{ontology → element}/conjecture.js +4 -11
  115. package/src/{ontology → element}/declaration/combinator.js +3 -14
  116. package/src/{ontology → element}/declaration/complexType.js +3 -19
  117. package/src/{ontology → element}/declaration/constructor.js +3 -14
  118. package/src/{ontology → element}/declaration/metavariable.js +3 -39
  119. package/src/{ontology → element}/declaration/simpleType.js +3 -19
  120. package/src/{ontology → element}/declaration/typePrefix.js +3 -15
  121. package/src/{ontology → element}/declaration/variable.js +3 -14
  122. package/src/{ontology → element}/declaration.js +6 -6
  123. package/src/{ontology → element}/deduction.js +9 -22
  124. package/src/{ontology → element}/derivation.js +2 -32
  125. package/src/{ontology → element}/equality.js +18 -42
  126. package/src/{ontology → element}/equivalence.js +37 -22
  127. package/src/{ontology → element}/equivalences.js +1 -2
  128. package/src/{ontology → element}/error.js +8 -8
  129. package/src/{ontology → element}/frame.js +8 -56
  130. package/src/{ontology → element}/hypothesis.js +5 -5
  131. package/src/{ontology → element}/judgement.js +7 -7
  132. package/src/{ontology → element}/label.js +3 -3
  133. package/src/{ontology → element}/lemma.js +4 -4
  134. package/src/{ontology → element}/metaLemma.js +5 -5
  135. package/src/{ontology/topLevelMetaAssertion.js → element/metaLemmaMetatheorem.js} +11 -11
  136. package/src/{ontology → element}/metaType.js +11 -7
  137. package/src/{ontology → element}/metatheorem.js +5 -5
  138. package/src/{ontology → element}/metavariable.js +10 -60
  139. package/src/{ontology → element}/parameter.js +1 -1
  140. package/src/{ontology → element}/premise.js +14 -14
  141. package/src/{ontology → element}/procedureCall.js +4 -4
  142. package/src/{ontology → element}/procedureReference.js +1 -1
  143. package/src/{ontology → element}/proof.js +3 -3
  144. package/src/{ontology → element}/property.js +7 -15
  145. package/src/{ontology → element}/propertyRelation.js +5 -11
  146. package/src/{ontology → element}/reference.js +5 -19
  147. package/src/{ontology → element}/rule.js +13 -13
  148. package/src/{ontology → element}/section.js +10 -10
  149. package/src/{ontology → element}/signature.js +12 -15
  150. package/src/element/statement/combinator/bracketed.js +38 -0
  151. package/src/element/statement/combinator.js +59 -0
  152. package/src/{ontology → element}/statement.js +11 -27
  153. package/src/{ontology → element}/step.js +10 -44
  154. package/src/{ontology → element}/subDerivation.js +3 -24
  155. package/src/{ontology → element}/subproof.js +3 -43
  156. package/src/{ontology → element}/substitution/frame.js +4 -21
  157. package/src/{ontology → element}/substitution/reference.js +3 -3
  158. package/src/{ontology → element}/substitution/statement.js +6 -10
  159. package/src/{ontology → element}/substitution/term.js +7 -23
  160. package/src/{ontology → element}/substitutions.js +1 -1
  161. package/src/{ontology → element}/supposition.js +10 -10
  162. package/src/{ontology → element/term}/constructor/bracketed.js +12 -13
  163. package/src/element/term/constructor.js +82 -0
  164. package/src/{ontology → element}/term.js +6 -38
  165. package/src/{ontology → element}/theorem.js +5 -5
  166. package/src/{ontology → element}/type.js +17 -64
  167. package/src/{ontology → element}/typePrefix.js +8 -12
  168. package/src/{ontology → element}/variable.js +9 -20
  169. package/src/elements.js +13 -0
  170. package/src/mixins/statement/verify.js +4 -4
  171. package/src/mixins/step/unify.js +6 -6
  172. package/src/mixins/term/verify.js +3 -3
  173. package/src/node/equivalence.js +16 -0
  174. package/src/node/substitution/frame.js +14 -0
  175. package/src/node/substitution/statement.js +40 -0
  176. package/src/node/substitution/term.js +15 -0
  177. package/src/nonTerminalNodeMap.js +4 -1
  178. package/src/preamble.js +62 -62
  179. package/src/process/assign.js +59 -0
  180. package/src/process/instantiate.js +71 -15
  181. package/src/process/unify.js +37 -39
  182. package/src/process/verify.js +20 -20
  183. package/src/ruleNames.js +1 -0
  184. package/src/utilities/brackets.js +12 -17
  185. package/src/utilities/customGrammar.js +3 -3
  186. package/src/utilities/element.js +1399 -0
  187. package/src/utilities/json.js +31 -31
  188. package/src/utilities/node.js +56 -64
  189. package/src/utilities/{context.js → statement.js} +10 -39
  190. package/src/utilities/string.js +83 -53
  191. package/lib/assignment/equality.js +0 -62
  192. package/lib/assignment/judgement.js +0 -62
  193. package/lib/assignment/variable.js +0 -64
  194. package/lib/context/bracketed/combinator.js +0 -121
  195. package/lib/context/bracketed/constructor.js +0 -121
  196. package/lib/context/bracketted.js +0 -86
  197. package/lib/context/partial/metavariable.js +0 -180
  198. package/lib/context/partial/statement.js +0 -180
  199. package/lib/context/partial/term.js +0 -192
  200. package/lib/context/partial/variable.js +0 -192
  201. package/lib/context/partial.js +0 -93
  202. package/lib/ontology/assertion/contained.js +0 -357
  203. package/lib/ontology/assertion/defined.js +0 -331
  204. package/lib/ontology/assertion/property.js +0 -313
  205. package/lib/ontology/assertion/satisfies.js +0 -302
  206. package/lib/ontology/assertion/subproof.js +0 -240
  207. package/lib/ontology/assertion/type.js +0 -308
  208. package/lib/ontology/assumption.js +0 -383
  209. package/lib/ontology/axiom.js +0 -339
  210. package/lib/ontology/combinator/bracketed.js +0 -202
  211. package/lib/ontology/combinator.js +0 -155
  212. package/lib/ontology/conclusion.js +0 -201
  213. package/lib/ontology/constructor.js +0 -185
  214. package/lib/ontology/declaration/combinator.js +0 -210
  215. package/lib/ontology/declaration/complexType.js +0 -393
  216. package/lib/ontology/declaration/constructor.js +0 -242
  217. package/lib/ontology/declaration/metavariable.js +0 -257
  218. package/lib/ontology/declaration/simpleType.js +0 -290
  219. package/lib/ontology/declaration/typePrefix.js +0 -228
  220. package/lib/ontology/declaration/variable.js +0 -245
  221. package/lib/ontology/deduction.js +0 -215
  222. package/lib/ontology/derivation.js +0 -155
  223. package/lib/ontology/equality.js +0 -288
  224. package/lib/ontology/equivalence.js +0 -295
  225. package/lib/ontology/equivalences.js +0 -264
  226. package/lib/ontology/frame.js +0 -419
  227. package/lib/ontology/hypothesis.js +0 -190
  228. package/lib/ontology/judgement.js +0 -248
  229. package/lib/ontology/label.js +0 -198
  230. package/lib/ontology/metavariable.js +0 -502
  231. package/lib/ontology/parameter.js +0 -108
  232. package/lib/ontology/premise.js +0 -310
  233. package/lib/ontology/procedureCall.js +0 -243
  234. package/lib/ontology/property.js +0 -166
  235. package/lib/ontology/propertyRelation.js +0 -202
  236. package/lib/ontology/reference.js +0 -315
  237. package/lib/ontology/rule.js +0 -373
  238. package/lib/ontology/section.js +0 -255
  239. package/lib/ontology/signature.js +0 -217
  240. package/lib/ontology/statement.js +0 -398
  241. package/lib/ontology/step.js +0 -295
  242. package/lib/ontology/subDerivation.js +0 -147
  243. package/lib/ontology/subproof.js +0 -265
  244. package/lib/ontology/substitution/frame.js +0 -261
  245. package/lib/ontology/substitution/term.js +0 -269
  246. package/lib/ontology/substitution.js +0 -206
  247. package/lib/ontology/substitutions.js +0 -425
  248. package/lib/ontology/supposition.js +0 -323
  249. package/lib/ontology/term.js +0 -351
  250. package/lib/ontology/topLevelAssertion.js +0 -431
  251. package/lib/ontology/topLevelMetaAssertion.js +0 -234
  252. package/lib/ontology/type.js +0 -556
  253. package/lib/ontology/typePrefix.js +0 -99
  254. package/lib/ontology/variable.js +0 -343
  255. package/lib/ontology.js +0 -27
  256. package/lib/utilities/assignments.js +0 -19
  257. package/lib/utilities/context.js +0 -101
  258. package/lib/utilities/subproof.js +0 -42
  259. package/lib/utilities/type.js +0 -40
  260. package/src/assignment/equality.js +0 -29
  261. package/src/assignment/judgement.js +0 -29
  262. package/src/assignment/variable.js +0 -34
  263. package/src/context/bracketed/combinator.js +0 -31
  264. package/src/context/bracketed/constructor.js +0 -31
  265. package/src/context/bracketted.js +0 -41
  266. package/src/context/partial/metavariable.js +0 -39
  267. package/src/context/partial/statement.js +0 -39
  268. package/src/context/partial/term.js +0 -49
  269. package/src/context/partial/variable.js +0 -49
  270. package/src/context/partial.js +0 -71
  271. package/src/ontology/combinator/bracketed.js +0 -38
  272. package/src/ontology/combinator.js +0 -72
  273. package/src/ontology/constructor.js +0 -105
  274. package/src/ontology.js +0 -13
  275. package/src/utilities/assignments.js +0 -11
  276. package/src/utilities/subproof.js +0 -56
  277. package/src/utilities/type.js +0 -35
  278. /package/src/{ontology → element}/substitution.js +0 -0
@@ -5,6 +5,20 @@ import SubstitutionNode from "../../node/substitution";
5
5
  import { TERM_RULE_NAME } from "../../ruleNames";
6
6
 
7
7
  export default class TermSubstitutionNode extends SubstitutionNode {
8
+ getVariableNode() {
9
+ const lastVariableNode = this.getLastVariableNode(),
10
+ variableNode = lastVariableNode; ///
11
+
12
+ return variableNode;
13
+ }
14
+
15
+ getTermNode() {
16
+ const firstTermNode = this.getFirstTermNode(),
17
+ termNode = firstTermNode; ///
18
+
19
+ return termNode;
20
+ }
21
+
8
22
  getLastTermNode() {
9
23
  const ruleName = TERM_RULE_NAME,
10
24
  lastTermNode = this.getLastNodeByRuleName(ruleName);
@@ -37,3 +51,4 @@ export default class TermSubstitutionNode extends SubstitutionNode {
37
51
 
38
52
  static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return SubstitutionNode.fromRuleNameChildNodesOpacityAndPrecedence(TermSubstitutionNode, ruleName, childNodes, opacity, precedence); }
39
53
  }
54
+
@@ -44,10 +44,11 @@ import RuleHeaderNode from "./node/header/rule";
44
44
  import SuppositionNode from "./node/supposition";
45
45
  import PlaceholderNode from "./node/placeholder";
46
46
  import ConstructorNode from "./node/constructor";
47
- import MetatheoremNode from "./node/metatheorem";
48
47
  import TheoremBodyNode from "./node/body/theorem";
49
48
  import AxiomHeaderNode from "./node/header/axiom";
50
49
  import LemmaHeaderNode from "./node/header/lemma";
50
+ import MetatheoremNode from "./node/metatheorem";
51
+ import EquivalenceNode from "./node/equivalence";
51
52
  import MetaArgumentNode from "./node/metaArgument";
52
53
  import MetavariableNode from "./node/metavariable";
53
54
  import QualificationNode from "./node/qualification";
@@ -128,6 +129,7 @@ import {
128
129
  RULE_HEADER_RULE_NAME,
129
130
  CONSTRUCTOR_RULE_NAME,
130
131
  METATHEOREM_RULE_NAME,
132
+ EQUIVALENCE_RULE_NAME,
131
133
  AXIOM_HEADER_RULE_NAME,
132
134
  LEMMA_HEADER_RULE_NAME,
133
135
  THEOREM_BODY_RULE_NAME,
@@ -211,6 +213,7 @@ const NonTerminalNodeMap = {
211
213
  [SUPPOSITION_RULE_NAME]: SuppositionNode,
212
214
  [CONSTRUCTOR_RULE_NAME]: ConstructorNode,
213
215
  [METATHEOREM_RULE_NAME]: MetatheoremNode,
216
+ [EQUIVALENCE_RULE_NAME]: EquivalenceNode,
214
217
  [AXIOM_HEADER_RULE_NAME]: AxiomHeaderNode,
215
218
  [LEMMA_HEADER_RULE_NAME]: LemmaHeaderNode,
216
219
  [THEOREM_BODY_RULE_NAME]: TheoremBodyNode,
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,79 @@
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
+ equivalencePlaceholderBNF = ` _ ::= equivalence... <END_OF_LINE> ; `,
13
+ metavariablePlaceholderBNF = ` _ ::= metavariable... <END_OF_LINE> ; `,
14
+ termSubstitutionPlaceholderBNF = ` _ ::= termSubstitution... <END_OF_LINE> ; `,
15
+ frameSubstitutionPlaceholderBNF = ` _ ::= frameSubstitution... <END_OF_LINE> ; `,
16
+ statementSubstitutionPlaceholderBNF = ` _ ::= statementSubstitution... <END_OF_LINE> ; `,
17
+ referenceSubstitutionPlaceholderBNF = ` _ ::= referenceSubstitution... <END_OF_LINE> ; `,
18
+ termPlaceholderRule = ruleFromBNF(termPlaceholderBNF),
19
+ variablePlaceholderRule = ruleFromBNF(variablePlaceholderBNF),
20
+ statementPlaceholderRule = ruleFromBNF(statementPlaceholderBNF),
21
+ equivalencePlaceholderRule = ruleFromBNF(equivalencePlaceholderBNF),
22
+ metavariablePlaceholderRule = ruleFromBNF(metavariablePlaceholderBNF),
23
+ termSubstitutionPlaceholderRule = ruleFromBNF(termSubstitutionPlaceholderBNF),
24
+ frameSubstitutionPlaceholderRule = ruleFromBNF(frameSubstitutionPlaceholderBNF),
25
+ statementSubstitutionPlaceholderRule = ruleFromBNF(statementSubstitutionPlaceholderBNF),
26
+ referenceSubstitutionPlaceholderRule = ruleFromBNF(referenceSubstitutionPlaceholderBNF);
27
+
28
+ let bracketedConstructorTermNode = null,
29
+ bracketedCombinatorStatementNode = null;
30
+
31
+ export const bracketedConstructorTermString = `(${BASE_TYPE_SYMBOL})`;
32
+ export const bracketedCombinatorStatementString = `(${STATEMENT_META_TYPE_NAME})`;
33
+
34
+ export function instantiateTerm(string, context) { return instantiate(termPlaceholderRule, string, context); }
35
+
36
+ export function instantiateVariable(string, context) { return instantiate(variablePlaceholderRule, string, context); }
37
+
38
+ export function instantiateStatement(string, context) { return instantiate(statementPlaceholderRule, string, context); }
39
+
40
+ export function instantiateEquivalence(string, context) { return instantiate(equivalencePlaceholderRule, string, context); }
4
41
 
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);
42
+ export function instantiateMetavariable(string, context) { return instantiate(metavariablePlaceholderRule, string, context); }
13
43
 
14
- export function instantiateTermSubstitution(string, context) { return instantiate(termSubtitutionnPlaceholderRule, string, context); }
44
+ export function instantiateTermSubstitution(string, context) { return instantiate(termSubstitutionPlaceholderRule, string, context); }
15
45
 
16
- export function instantiateFrameSubstitution(string, context) { return instantiate(frameSubtitutionnPlaceholderRule, string, context); }
46
+ export function instantiateFrameSubstitution(string, context) { return instantiate(frameSubstitutionPlaceholderRule, string, context); }
17
47
 
18
- export function instantiateStatementSubstitution(string, context) { return instantiate(statementSubtitutionnPlaceholderRule, string, context); }
48
+ export function instantiateStatementSubstitution(string, context) { return instantiate(statementSubstitutionPlaceholderRule, string, context); }
19
49
 
20
- export function instantiateReferenceSubstitution(string, context) { return instantiate(referenceSubtitutionnPlaceholderRule, string, context); }
50
+ export function instantiateReferenceSubstitution(string, context) { return instantiate(referenceSubstitutionPlaceholderRule, string, context); }
51
+
52
+ export function instantiateBracketedConstructorTerm() {
53
+ if (bracketedConstructorTermNode === null) {
54
+ const placeholderRule = termPlaceholderRule, ///
55
+ string = bracketedConstructorTermString,
56
+ context = nominalContext, ///
57
+ node = instantiate(placeholderRule, string, context);
58
+
59
+ bracketedConstructorTermNode = node; ///
60
+ }
61
+
62
+ return bracketedConstructorTermNode;
63
+ }
64
+
65
+ export function instantiateBracketedCombinatorStatement() {
66
+ if (bracketedCombinatorStatementNode === null) {
67
+ const placeholderRule = statementPlaceholderRule, ///
68
+ string = bracketedCombinatorStatementString, ///
69
+ context = nominalContext, ///
70
+ node = instantiate(placeholderRule, string, context);
71
+
72
+ bracketedCombinatorStatementNode = node; ///
73
+ }
74
+
75
+ return bracketedCombinatorStatementNode;
76
+ }
21
77
 
22
78
  function instantiate(placeholderRule, string, context) {
23
79
  let node;
@@ -26,8 +82,8 @@ function instantiate(placeholderRule, string, context) {
26
82
  parser = context.getParser(),
27
83
  content = `${string}
28
84
  `,
29
- startRule = placeholderRule, ///
30
- tokens = lexer.tokenise(content);
85
+ tokens = lexer.tokenise(content),
86
+ startRule = placeholderRule; ///
31
87
 
32
88
  node = parser.parse(tokens, startRule);
33
89
 
@@ -37,7 +93,7 @@ function instantiate(placeholderRule, string, context) {
37
93
  node = childNode; ///
38
94
 
39
95
  return true;
40
- })
96
+ });
41
97
 
42
98
  return node;
43
99
  }
@@ -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