occam-verify-cli 1.0.388 → 1.0.404

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (305) hide show
  1. package/lib/action/verify.js +3 -3
  2. package/lib/assignment/equality.js +2 -2
  3. package/lib/context/file.js +11 -11
  4. package/lib/context/local.js +38 -61
  5. package/lib/context/partial.js +10 -10
  6. package/lib/context/temporary.js +755 -0
  7. package/lib/mixins/statement/verify.js +38 -16
  8. package/lib/mixins/step/unify.js +7 -8
  9. package/lib/node/argument.js +4 -4
  10. package/lib/node/assertion/contained.js +6 -6
  11. package/lib/node/assertion/defined.js +6 -6
  12. package/lib/node/assertion/property.js +6 -6
  13. package/lib/node/assertion/satisfies.js +6 -6
  14. package/lib/node/assertion/subproof.js +6 -6
  15. package/lib/node/assertion/type.js +6 -6
  16. package/lib/node/assertion.js +107 -0
  17. package/lib/node/assumption.js +134 -0
  18. package/lib/node/axiom.js +6 -6
  19. package/lib/node/{topLevelAssertion.js → axiomLemmaTheoremConjecture.js} +12 -12
  20. package/lib/node/body.js +4 -5
  21. package/lib/node/combinator.js +4 -4
  22. package/lib/node/conclusion.js +4 -4
  23. package/lib/node/conjecture.js +6 -6
  24. package/lib/node/constructor.js +4 -4
  25. package/lib/node/declaration/combinator.js +6 -6
  26. package/lib/node/declaration/complexType.js +6 -6
  27. package/lib/node/declaration/constructor.js +6 -6
  28. package/lib/node/declaration/metavariable.js +6 -6
  29. package/lib/node/declaration/property.js +6 -6
  30. package/lib/node/declaration/simpleType.js +6 -6
  31. package/lib/node/declaration/typePrefix.js +6 -6
  32. package/lib/node/declaration/variable.js +6 -6
  33. package/lib/node/declaration.js +6 -22
  34. package/lib/node/deduction.js +4 -4
  35. package/lib/node/derivation.js +4 -4
  36. package/lib/node/document.js +107 -0
  37. package/lib/node/equality.js +4 -4
  38. package/lib/node/error.js +4 -4
  39. package/lib/node/frame.js +25 -14
  40. package/lib/node/header.js +4 -4
  41. package/lib/node/hypothesis.js +4 -4
  42. package/lib/node/judgement.js +8 -8
  43. package/lib/node/label.js +4 -4
  44. package/lib/node/labels.js +4 -4
  45. package/lib/node/lemma.js +6 -6
  46. package/lib/node/metaArgument.js +4 -4
  47. package/lib/node/metaLemma.js +6 -6
  48. package/lib/node/{topLevelMetaAssertion.js → metaLemmaMetaTheorem.js} +12 -12
  49. package/lib/node/metaType.js +4 -4
  50. package/lib/node/metatheorem.js +6 -6
  51. package/lib/node/metavariable.js +4 -4
  52. package/lib/node/nonsense.js +4 -4
  53. package/lib/node/parameter.js +4 -4
  54. package/lib/node/parenthesisedLabel.js +4 -4
  55. package/lib/node/parenthesisedLabels.js +4 -4
  56. package/lib/node/placeholder.js +107 -0
  57. package/lib/node/premise.js +4 -4
  58. package/lib/node/procedureCall.js +4 -4
  59. package/lib/node/procedureReference.js +4 -4
  60. package/lib/node/proof.js +4 -4
  61. package/lib/node/property.js +4 -4
  62. package/lib/node/propertyRelation.js +4 -4
  63. package/lib/node/qualification.js +4 -4
  64. package/lib/node/reference.js +4 -4
  65. package/lib/node/rule.js +4 -4
  66. package/lib/node/section.js +4 -4
  67. package/lib/node/signature.js +4 -4
  68. package/lib/node/statement.js +15 -4
  69. package/lib/node/step.js +4 -4
  70. package/lib/node/subDerivation.js +4 -4
  71. package/lib/node/subproof.js +4 -4
  72. package/lib/node/substitution/frame.js +28 -6
  73. package/lib/node/substitution/statement.js +6 -6
  74. package/lib/node/substitution/term.js +28 -6
  75. package/lib/node/substitution.js +107 -0
  76. package/lib/node/supposition.js +4 -4
  77. package/lib/node/term.js +27 -4
  78. package/lib/node/theorem.js +6 -6
  79. package/lib/node/type.js +4 -4
  80. package/lib/node/typePrefix.js +4 -4
  81. package/lib/node/types.js +4 -4
  82. package/lib/node/variable.js +4 -4
  83. package/lib/nominal/parser.js +3 -3
  84. package/lib/nonTerminalNode.js +222 -0
  85. package/lib/nonTerminalNodeMap.js +5 -3
  86. package/lib/ontology/assertion/contained.js +80 -39
  87. package/lib/ontology/assertion/defined.js +80 -39
  88. package/lib/ontology/assertion/property.js +71 -29
  89. package/lib/ontology/assertion/satisfies.js +73 -25
  90. package/lib/ontology/assertion/subproof.js +95 -41
  91. package/lib/ontology/assertion/type.js +74 -18
  92. package/lib/ontology/assertion.js +66 -0
  93. package/lib/ontology/assumption.js +379 -0
  94. package/lib/ontology/axiom.js +8 -11
  95. package/lib/ontology/combinator/bracketed.js +17 -3
  96. package/lib/ontology/combinator.js +17 -3
  97. package/lib/ontology/conclusion.js +38 -9
  98. package/lib/ontology/constructor/bracketed.js +17 -3
  99. package/lib/ontology/constructor.js +17 -3
  100. package/lib/ontology/declaration/combinator.js +75 -33
  101. package/lib/ontology/declaration/complexType.js +110 -63
  102. package/lib/ontology/declaration/constructor.js +81 -38
  103. package/lib/ontology/declaration/metavariable.js +87 -39
  104. package/lib/ontology/declaration/simpleType.js +95 -48
  105. package/lib/ontology/declaration/typePrefix.js +87 -40
  106. package/lib/ontology/declaration/variable.js +87 -39
  107. package/lib/ontology/declaration.js +13 -313
  108. package/lib/ontology/deduction.js +38 -9
  109. package/lib/ontology/equivalence.js +295 -0
  110. package/lib/ontology/equivalences.js +264 -0
  111. package/lib/ontology/frame.js +83 -51
  112. package/lib/ontology/hypothesis.js +11 -11
  113. package/lib/ontology/judgement.js +8 -8
  114. package/lib/ontology/label.js +5 -6
  115. package/lib/ontology/metavariable.js +14 -15
  116. package/lib/ontology/premise.js +60 -21
  117. package/lib/ontology/procedureCall.js +15 -15
  118. package/lib/ontology/procedureReference.js +1 -1
  119. package/lib/ontology/proof.js +2 -2
  120. package/lib/ontology/reference.js +6 -13
  121. package/lib/ontology/rule.js +69 -71
  122. package/lib/ontology/section.js +2 -2
  123. package/lib/ontology/signature.js +2 -2
  124. package/lib/ontology/statement.js +36 -24
  125. package/lib/ontology/step.js +38 -26
  126. package/lib/ontology/subproof.js +12 -13
  127. package/lib/ontology/substitution/frame.js +69 -21
  128. package/lib/ontology/substitution/reference.js +24 -9
  129. package/lib/ontology/substitution/statement.js +137 -76
  130. package/lib/ontology/substitution/term.js +75 -35
  131. package/lib/ontology/substitution.js +50 -44
  132. package/lib/ontology/substitutions.js +425 -0
  133. package/lib/ontology/supposition.js +69 -29
  134. package/lib/ontology/term.js +35 -37
  135. package/lib/ontology/topLevelAssertion.js +16 -17
  136. package/lib/ontology/topLevelMetaAssertion.js +3 -4
  137. package/lib/ontology/variable.js +9 -14
  138. package/lib/preamble.js +7 -4
  139. package/lib/ruleNames.js +20 -12
  140. package/lib/unifier/intrinsicLevel.js +4 -5
  141. package/lib/unifier/metaLevel.js +24 -24
  142. package/lib/utilities/brackets.js +4 -21
  143. package/lib/utilities/context.js +6 -6
  144. package/lib/utilities/frame.js +18 -0
  145. package/lib/utilities/json.js +24 -1
  146. package/lib/utilities/metavariable.js +18 -0
  147. package/lib/utilities/statement.js +18 -0
  148. package/lib/utilities/substitutions.js +43 -30
  149. package/lib/utilities/unification.js +10 -16
  150. package/lib/utilities/variable.js +18 -0
  151. package/package.json +10 -10
  152. package/src/action/verify.js +2 -2
  153. package/src/assignment/equality.js +1 -1
  154. package/src/context/file.js +13 -11
  155. package/src/context/local.js +40 -65
  156. package/src/context/partial.js +9 -14
  157. package/src/context/temporary.js +463 -0
  158. package/src/mixins/statement/verify.js +60 -23
  159. package/src/mixins/step/unify.js +6 -6
  160. package/src/node/argument.js +1 -1
  161. package/src/node/assertion/contained.js +3 -3
  162. package/src/node/assertion/defined.js +3 -3
  163. package/src/node/assertion/property.js +3 -3
  164. package/src/node/assertion/satisfies.js +3 -3
  165. package/src/node/assertion/subproof.js +3 -3
  166. package/src/node/assertion/type.js +3 -3
  167. package/src/node/assertion.js +7 -0
  168. package/src/node/assumption.js +35 -0
  169. package/src/node/axiom.js +3 -3
  170. package/src/node/{topLevelAssertion.js → axiomLemmaTheoremConjecture.js} +2 -2
  171. package/src/node/body.js +1 -3
  172. package/src/node/combinator.js +1 -1
  173. package/src/node/conclusion.js +1 -1
  174. package/src/node/conjecture.js +3 -3
  175. package/src/node/constructor.js +1 -1
  176. package/src/node/declaration/combinator.js +3 -3
  177. package/src/node/declaration/complexType.js +3 -3
  178. package/src/node/declaration/constructor.js +3 -3
  179. package/src/node/declaration/metavariable.js +3 -3
  180. package/src/node/declaration/property.js +3 -3
  181. package/src/node/declaration/simpleType.js +3 -3
  182. package/src/node/declaration/typePrefix.js +3 -3
  183. package/src/node/declaration/variable.js +3 -3
  184. package/src/node/declaration.js +2 -18
  185. package/src/node/deduction.js +1 -1
  186. package/src/node/derivation.js +1 -1
  187. package/src/node/document.js +7 -0
  188. package/src/node/equality.js +1 -1
  189. package/src/node/error.js +1 -1
  190. package/src/node/frame.js +23 -11
  191. package/src/node/header.js +1 -1
  192. package/src/node/hypothesis.js +1 -1
  193. package/src/node/judgement.js +6 -6
  194. package/src/node/label.js +1 -1
  195. package/src/node/labels.js +1 -1
  196. package/src/node/lemma.js +3 -3
  197. package/src/node/metaArgument.js +1 -1
  198. package/src/node/metaLemma.js +3 -3
  199. package/src/node/{topLevelMetaAssertion.js → metaLemmaMetaTheorem.js} +2 -2
  200. package/src/node/metaType.js +1 -1
  201. package/src/node/metatheorem.js +3 -3
  202. package/src/node/metavariable.js +1 -1
  203. package/src/node/nonsense.js +1 -1
  204. package/src/node/parameter.js +1 -1
  205. package/src/node/parenthesisedLabel.js +1 -1
  206. package/src/node/parenthesisedLabels.js +1 -1
  207. package/src/node/placeholder.js +7 -0
  208. package/src/node/premise.js +1 -1
  209. package/src/node/procedureCall.js +1 -1
  210. package/src/node/procedureReference.js +1 -1
  211. package/src/node/proof.js +1 -1
  212. package/src/node/property.js +1 -1
  213. package/src/node/propertyRelation.js +1 -1
  214. package/src/node/qualification.js +1 -1
  215. package/src/node/reference.js +1 -1
  216. package/src/node/rule.js +2 -2
  217. package/src/node/section.js +1 -1
  218. package/src/node/signature.js +1 -1
  219. package/src/node/statement.js +13 -1
  220. package/src/node/step.js +1 -1
  221. package/src/node/subDerivation.js +1 -1
  222. package/src/node/subproof.js +1 -1
  223. package/src/node/substitution/frame.js +29 -3
  224. package/src/node/substitution/statement.js +3 -3
  225. package/src/node/substitution/term.js +29 -3
  226. package/src/node/substitution.js +7 -0
  227. package/src/node/supposition.js +1 -1
  228. package/src/node/term.js +27 -1
  229. package/src/node/theorem.js +3 -3
  230. package/src/node/type.js +1 -1
  231. package/src/node/typePrefix.js +1 -1
  232. package/src/node/types.js +1 -1
  233. package/src/node/variable.js +1 -1
  234. package/src/nominal/parser.js +2 -2
  235. package/src/{node/nonTerminal.js → nonTerminalNode.js} +31 -25
  236. package/src/nonTerminalNodeMap.js +10 -5
  237. package/src/ontology/assertion/contained.js +21 -32
  238. package/src/ontology/assertion/defined.js +20 -31
  239. package/src/ontology/assertion/property.js +7 -20
  240. package/src/ontology/assertion/satisfies.js +8 -16
  241. package/src/ontology/assertion/subproof.js +36 -42
  242. package/src/ontology/assertion/type.js +10 -11
  243. package/src/ontology/assertion.js +23 -0
  244. package/src/ontology/assumption.js +385 -0
  245. package/src/ontology/axiom.js +7 -16
  246. package/src/ontology/combinator/bracketed.js +2 -0
  247. package/src/ontology/combinator.js +2 -0
  248. package/src/ontology/conclusion.js +51 -10
  249. package/src/ontology/constructor/bracketed.js +2 -0
  250. package/src/ontology/constructor.js +2 -0
  251. package/src/ontology/declaration/combinator.js +15 -24
  252. package/src/ontology/declaration/complexType.js +57 -53
  253. package/src/ontology/declaration/constructor.js +25 -31
  254. package/src/ontology/declaration/metavariable.js +25 -30
  255. package/src/ontology/declaration/simpleType.js +34 -38
  256. package/src/ontology/declaration/typePrefix.js +23 -31
  257. package/src/ontology/declaration/variable.js +26 -31
  258. package/src/ontology/declaration.js +8 -339
  259. package/src/ontology/deduction.js +51 -10
  260. package/src/{equivalence.js → ontology/equivalence.js} +4 -3
  261. package/src/{equivalences.js → ontology/equivalences.js} +14 -12
  262. package/src/ontology/frame.js +93 -66
  263. package/src/ontology/hypothesis.js +8 -8
  264. package/src/ontology/judgement.js +8 -8
  265. package/src/ontology/label.js +2 -7
  266. package/src/ontology/metavariable.js +14 -17
  267. package/src/ontology/premise.js +82 -25
  268. package/src/ontology/procedureCall.js +14 -14
  269. package/src/ontology/procedureReference.js +2 -2
  270. package/src/ontology/proof.js +1 -1
  271. package/src/ontology/reference.js +5 -9
  272. package/src/ontology/rule.js +79 -82
  273. package/src/ontology/section.js +1 -1
  274. package/src/ontology/signature.js +1 -1
  275. package/src/ontology/statement.js +37 -27
  276. package/src/ontology/step.js +45 -28
  277. package/src/ontology/subproof.js +10 -10
  278. package/src/ontology/substitution/frame.js +72 -26
  279. package/src/ontology/substitution/reference.js +8 -6
  280. package/src/ontology/substitution/statement.js +95 -76
  281. package/src/ontology/substitution/term.js +81 -41
  282. package/src/ontology/substitution.js +35 -34
  283. package/src/{substitutions.js → ontology/substitutions.js} +29 -28
  284. package/src/ontology/supposition.js +88 -28
  285. package/src/ontology/term.js +31 -43
  286. package/src/ontology/topLevelAssertion.js +16 -18
  287. package/src/ontology/topLevelMetaAssertion.js +3 -3
  288. package/src/ontology/variable.js +10 -17
  289. package/src/preamble.js +6 -3
  290. package/src/ruleNames.js +10 -8
  291. package/src/unifier/intrinsicLevel.js +5 -6
  292. package/src/unifier/metaLevel.js +32 -29
  293. package/src/utilities/brackets.js +3 -29
  294. package/src/utilities/context.js +5 -5
  295. package/src/utilities/frame.js +13 -0
  296. package/src/utilities/json.js +28 -0
  297. package/src/utilities/metavariable.js +13 -0
  298. package/src/utilities/statement.js +13 -0
  299. package/src/utilities/substitutions.js +59 -33
  300. package/src/utilities/unification.js +8 -24
  301. package/src/utilities/variable.js +13 -0
  302. package/lib/equivalence.js +0 -294
  303. package/lib/equivalences.js +0 -263
  304. package/lib/node/nonTerminal.js +0 -218
  305. package/lib/substitutions.js +0 -424
@@ -127,13 +127,12 @@ export default define(class Variable {
127
127
 
128
128
  variable = this; ///
129
129
 
130
- const substitutionPresent = substitutions.isSubstitutionPresentByVariable(variable);
130
+ const substitution = substitutions.findSubstitutionByVariable(variable);
131
131
 
132
- if (substitutionPresent) {
132
+ if (substitution !== null) {
133
133
  context = specificContext; ///
134
134
 
135
- const substitution = substitutions.findSubstitutionByVariable(variable),
136
- substitutionTermEqualToTerm = substitution.isTermEqualTo(term, context);
135
+ const substitutionTermEqualToTerm = substitution.isTermEqualToTerm(term, context);
137
136
 
138
137
  if (substitutionTermEqualToTerm) {
139
138
  termUnifies = true;
@@ -147,26 +146,20 @@ export default define(class Variable {
147
146
 
148
147
  context = specificContext; ///
149
148
 
150
- const termVerifies = term.verify(context, () => {
151
- let verifiesAhead = false;
149
+ const termNode = term.getNode();
152
150
 
153
- const termType = term.getType(),
154
- variableType = variable.getType(),
155
- termTypeEqualToOrSubTypeOfVariableType = termType.isEqualToOrSubTypeOf(variableType);
151
+ term = context.findTermByTermNode(termNode);
156
152
 
157
- if (termTypeEqualToOrSubTypeOfVariableType) {
158
- verifiesAhead = true;
159
- }
153
+ const termType = term.getType(),
154
+ variableType = variable.getType(),
155
+ termTypeEqualToOrSubTypeOfVariableType = termType.isEqualToOrSubTypeOf(variableType);
160
156
 
161
- return verifiesAhead;
162
- });
163
-
164
- if (termVerifies) {
157
+ if (termTypeEqualToOrSubTypeOfVariableType) {
165
158
  const { TermSubstitution } = ontology,
166
159
  termSubstitution = TermSubstitution.fromTernAndVariable(term, variable, context),
167
160
  substitution = termSubstitution; ///
168
161
 
169
- substitutions.addSubstitution(substitution, specificContext);
162
+ substitutions.addSubstitution(substitution, context);
170
163
 
171
164
  termUnifies = true;
172
165
  }
package/src/preamble.js CHANGED
@@ -31,23 +31,26 @@ import Conclusion from "./ontology/conclusion";
31
31
  import Derivation from "./ontology/derivation";
32
32
  import Combinator from "./ontology/combinator";
33
33
  import Hypothesis from "./ontology/hypothesis";
34
+ import Assumption from "./ontology/assumption";
34
35
  import Constructor from "./ontology/constructor";
35
- import Declaration from "./ontology/declaration";
36
36
  import Supposition from "./ontology/supposition";
37
37
  import Metatheorem from "./ontology/metatheorem";
38
+ import Equivalence from "./ontology/equivalence";
39
+ import Equivalences from "./ontology/equivalences";
38
40
  import Metavariable from "./ontology/metavariable";
41
+ import Substitutions from "./ontology/substitutions";
39
42
  import ProcedureCall from "./ontology/procedureCall";
40
43
  import SubDerivation from "./ontology/subDerivation";
41
44
  import TypeAssertion from "./ontology/assertion/type";
42
- import DefinedAssertion from "./ontology/assertion/defined";
43
45
  import PropertyRelation from "./ontology/propertyRelation";
46
+ import DefinedAssertion from "./ontology/assertion/defined";
44
47
  import TermSubstitution from "./ontology/substitution/term";
45
48
  import FrameSubstitution from "./ontology/substitution/frame";
46
49
  import SubproofAssertion from "./ontology/assertion/subproof";
47
50
  import PropertyAssertion from "./ontology/assertion/property";
51
+ import ProcedureReference from "./ontology/procedureReference";
48
52
  import ContainedAssertion from "./ontology/assertion/contained";
49
53
  import SatisfiesAssertion from "./ontology/assertion/satisfies";
50
- import ProcedureReference from "./ontology/procedureReference";
51
54
  import VariableDeclaration from "./ontology/declaration/variable";
52
55
  import BracketedCombinator from "./ontology/combinator/bracketed";
53
56
  import BracketedConstructor from "./ontology/constructor/bracketed";
package/src/ruleNames.js CHANGED
@@ -21,28 +21,30 @@ export const EQUALITY_RULE_NAME = "equality";
21
21
  export const VARIABLE_RULE_NAME = "variable";
22
22
  export const SUBPROOF_RULE_NAME = "subproof";
23
23
  export const NONSENSE_RULE_NAME = "nonsense";
24
- export const SIGNATURE_RULE_NAME = "signature";
24
+ export const DOCUMENT_RULE_NAME = "document";
25
+ export const RULE_BODY_RULE_NAME = "ruleBody";
25
26
  export const META_TYPE_RULE_NAME = "metaType";
27
+ export const SIGNATURE_RULE_NAME = "signature";
26
28
  export const PARAMETER_RULE_NAME = "parameter";
27
29
  export const DEDUCTION_RULE_NAME = "deduction";
28
30
  export const JUDGEMENT_RULE_NAME = "judgement";
29
31
  export const REFERENCE_RULE_NAME = "reference";
30
32
  export const STATEMENT_RULE_NAME = "statement";
31
- export const RULE_BODY_RULE_NAME = "ruleBody";
32
33
  export const META_LEMMA_RULE_NAME = "metaLemma";
34
+ export const AXIOM_BODY_RULE_NAME = "axiomBody";
35
+ export const LEMMA_BODY_RULE_NAME = "lemmaBody";
33
36
  export const COMBINATOR_RULE_NAME = "combinator";
34
37
  export const CONCLUSION_RULE_NAME = "conclusion";
35
38
  export const CONJECTURE_RULE_NAME = "conjecture";
36
39
  export const DERIVATION_RULE_NAME = "derivation";
37
40
  export const HYPOTHESIS_RULE_NAME = "hypothesis";
38
- export const AXIOM_BODY_RULE_NAME = "axiomBody";
39
- export const LEMMA_BODY_RULE_NAME = "lemmaBody";
41
+ export const ASSUMPTION_RULE_NAME = "assumption";
42
+ export const PLACEHOLDER_RULE_NAME = "_"; ///
43
+ export const RULE_HEADER_RULE_NAME = "ruleHeader";
40
44
  export const TYPE_PREFIX_RULE_NAME = "typePrefix";
41
45
  export const SUPPOSITION_RULE_NAME = "supposition";
42
46
  export const CONSTRUCTOR_RULE_NAME = "constructor";
43
- export const DECLARATION_RULE_NAME = "declaration";
44
47
  export const METATHEOREM_RULE_NAME = "metatheorem";
45
- export const RULE_HEADER_RULE_NAME = "ruleHeader";
46
48
  export const AXIOM_HEADER_RULE_NAME = "axiomHeader";
47
49
  export const LEMMA_HEADER_RULE_NAME = "lemmaHeader";
48
50
  export const THEOREM_BODY_RULE_NAME = "theoremBody";
@@ -57,18 +59,18 @@ export const META_LEMMA_BODY_RULE_NAME = "metaLemmaBody";
57
59
  export const CONJECTURE_BODY_RULE_NAME = "conjectureBody";
58
60
  export const METATHEOREM_BODY_RULE_NAME = "metatheoremBody";
59
61
  export const META_LEMMA_HEADER_RULE_NAME = "metaLemmaHeader";
62
+ export const CONJECTURE_HEADER_RULE_NAME = "conjectureHeader";
60
63
  export const PROPERTY_RELATION_RULE_NAME = "propertyRelation";
61
64
  export const DEFINED_ASSERTION_RULE_NAME = "definedAssertion";
62
65
  export const TERM_SUBSTITUTION_RULE_NAME = "termSubstitution";
63
- export const CONJECTURE_HEADER_RULE_NAME = "conjectureHeader";
64
66
  export const METATHEOREM_HEADER_RULE_NAME = "metatheoremHeader";
65
67
  export const PROPERTY_ASSERTION_RULE_NAME = "propertyAssertion";
66
68
  export const SUBPROOF_ASSERTION_RULE_NAME = "subproofAssertion";
67
69
  export const FRAME_SUBSTITUTION_RULE_NAME = "frameSubstitution";
70
+ export const PARENTHESISED_LABEL_RULE_NAME = "parenthesisedLabel";
68
71
  export const PROCEDURE_REFERENCE_RULE_NAME = "procedureReference";
69
72
  export const CONTAINED_ASSERTION_RULE_NAME = "containedAssertion";
70
73
  export const SATISFIES_ASSERTION_RULE_NAME = "satisfiesAssertion";
71
- export const PARENTHESISED_LABEL_RULE_NAME = "parenthesisedLabel";
72
74
  export const PARENTHESISED_LABELS_RULE_NAME = "parenthesisedLabels";
73
75
  export const PROPERTY_DECLARATION_RULE_NAME = "propertyDeclaration";
74
76
  export const VARIABLE_DECLARATION_RULE_NAME = "variableDeclaration";
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- import ontology from "../ontology";
4
3
  import Unifier from "../unifier";
5
4
 
6
5
  import { nodeQuery } from "../utilities/query";
@@ -26,19 +25,19 @@ class IntrinsicLevelUnifier extends Unifier {
26
25
  unify: (generalTermVariableNode, specificTermNode, substitutions, generalContext, specificContext) => {
27
26
  let termUnifies;
28
27
 
29
- const { Term, Variable } = ontology,
30
- termNode = specificTermNode, ///
31
- variableNode = generalTermVariableNode; ///
28
+ const termNode = specificTermNode, ///
29
+ variableNode = generalTermVariableNode, ///
30
+ variableIdentifier = variableNode.getVariableIdentifier();
32
31
 
33
32
  let context;
34
33
 
35
34
  context = generalContext; ///
36
35
 
37
- const variable = Variable.fromVariableNode(variableNode, context);
36
+ const variable = context.findVariableByVariableIdentifier(variableIdentifier);
38
37
 
39
38
  context = specificContext; ///
40
39
 
41
- const term = Term.fromTermNode(termNode, context);
40
+ const term = context.findTermByTermNode(termNode);
42
41
 
43
42
  termUnifies = variable.unifyTerm(term, substitutions, generalContext, specificContext);
44
43
 
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
 
3
- import ontology from "../ontology";
4
3
  import Unifier from "../unifier";
4
+ import ontology from "../ontology";
5
5
 
6
6
  import { nodeQuery } from "../utilities/query";
7
- import Metavariable from "./metavariable";
7
+ import { metavariableNameFromMetavariableNode } from "../utilities/metavariable";
8
8
 
9
9
  const termNodeQuery = nodeQuery("/term"),
10
10
  frameNodeQuery = nodeQuery("/frame"),
11
11
  statementNodeQuery = nodeQuery("/statement"),
12
12
  termVariableNodeQuery = nodeQuery("/term/variable!"),
13
13
  statementMetavariableNodeQuery = nodeQuery("/statement/metavariable!"),
14
- declarationMetavariableNodeQuery = nodeQuery("/declaration/metavariable!"),
15
- frameDeclarationMetavariableNodeQuery = nodeQuery("/frame/declaration!/metavariable!");
14
+ assumptionMetavariableNodeQuery = nodeQuery("/assumption/metavariable!"),
15
+ frameAssumptionMetavariableNodeQuery = nodeQuery("/frame/assumption!/metavariable!");
16
16
 
17
17
  class MetaLevelUnifier extends Unifier {
18
18
  unify(generalNonTerminalNode, specificNonTerminalNode, substitutions, generalContext, specificContext) {
@@ -32,30 +32,32 @@ class MetaLevelUnifier extends Unifier {
32
32
  unify: (generalStatementMetavariableNode, specificStatementNode, substitutions, generalContext, specificContext) => {
33
33
  let statementUnifies;
34
34
 
35
- const { Metavariable, Statement } = ontology; ///
36
-
37
35
  let context,
36
+ statement,
38
37
  statementNode;
39
38
 
40
39
  context = generalContext; ///
41
40
 
42
41
  const metavariableNode = generalStatementMetavariableNode, ///
43
- metavariable = Metavariable.fromMetavariableNode(metavariableNode, context);
42
+ metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
43
+ metavariable = context.findMetavariableByMetavariableName(metavariableName);
44
44
 
45
45
  const metavariableNodeParentNode = metavariableNode.getParentNode();
46
46
 
47
47
  statementNode = metavariableNodeParentNode; ///
48
48
 
49
+ statement = context.findStatementByStatementNode(statementNode);
50
+
49
51
  const { TermSubstitution, FrameSubstitution } = ontology,
50
- frameSubstitution = FrameSubstitution.fromStatementNode(statementNode, context),
51
- termSubstitution = TermSubstitution.fromStatementNode(statementNode, context),
52
+ frameSubstitution = FrameSubstitution.fromStatement(statement, context),
53
+ termSubstitution = TermSubstitution.fromStatement(statement, context),
52
54
  substitution = (frameSubstitution || termSubstitution);
53
55
 
54
56
  context = specificContext; ///
55
57
 
56
58
  statementNode = specificStatementNode; ///
57
59
 
58
- const statement = Statement.fromStatementNode(statementNode, context);
60
+ statement = context.findStatementByStatementNode(statementNode);
59
61
 
60
62
  statementUnifies = metavariable.unifyStatement(statement, substitution, substitutions, generalContext, specificContext);
61
63
 
@@ -63,24 +65,24 @@ class MetaLevelUnifier extends Unifier {
63
65
  }
64
66
  },
65
67
  {
66
- generalNodeQuery: frameDeclarationMetavariableNodeQuery,
68
+ generalNodeQuery: frameAssumptionMetavariableNodeQuery,
67
69
  specificNodeQuery: frameNodeQuery,
68
- unify: (generalFrameDeclarationMetavariableNode, specificFrameNode, substitutions, generalContext, specificContext) => {
70
+ unify: (generalFrameAssumptionMetavariableNode, specificFrameNode, substitutions, generalContext, specificContext) => {
69
71
  let frameUnifies;
70
72
 
71
- const { Frame, Metavariable } = ontology,
72
- frameNode = specificFrameNode, ///
73
- metavariableNode = generalFrameDeclarationMetavariableNode; ///
73
+ const frameNode = specificFrameNode, ///
74
+ metavariableNode = generalFrameAssumptionMetavariableNode, ///
75
+ metavariableName = metavariableNameFromMetavariableNode(metavariableNode);
74
76
 
75
77
  let context;
76
78
 
77
79
  context = generalContext; ///
78
80
 
79
- const metavariable = Metavariable.fromMetavariableNode(metavariableNode, context);
81
+ const metavariable = context.findMetavariableByMetavariableName(metavariableName);
80
82
 
81
83
  context = specificContext; ///
82
84
 
83
- const frame = Frame.fromFrameNode(frameNode, context);
85
+ const frame = context.findFrameByFrameNode(frameNode);
84
86
 
85
87
  frameUnifies = metavariable.unifyFrame(frame, substitutions, generalContext, specificContext);
86
88
 
@@ -93,19 +95,19 @@ class MetaLevelUnifier extends Unifier {
93
95
  unify: (generalTermVariableNode, specificTermNode, substitutions, generalContext, specificContext) => {
94
96
  let termUnifies;
95
97
 
96
- const { Term, Variable } = ontology,
97
- termNode = specificTermNode, ///
98
- variableNode = generalTermVariableNode; ///
98
+ const termNode = specificTermNode, ///
99
+ variableNode = generalTermVariableNode, ///
100
+ variableIdentifier = variableNode.getVariableIdentifier();
99
101
 
100
102
  let context;
101
103
 
102
104
  context = generalContext; ///
103
105
 
104
- const variable = Variable.fromVariableNode(variableNode, context);
106
+ const variable = context.findVariableByVariableIdentifier(variableIdentifier);
105
107
 
106
108
  context = specificContext; ///
107
109
 
108
- const term = Term.fromTermNode(termNode, context);
110
+ const term = context.findTermByTermNode(termNode);
109
111
 
110
112
  termUnifies = variable.unifyTerm(term, substitutions, generalContext, specificContext);
111
113
 
@@ -113,25 +115,26 @@ class MetaLevelUnifier extends Unifier {
113
115
  }
114
116
  },
115
117
  {
116
- generalNodeQuery: declarationMetavariableNodeQuery,
117
- specificNodeQuery: declarationMetavariableNodeQuery,
118
- unify: (generalDeclarationMetavariableNode, specificDeclarationMetavariableNode, substitutions, generalContext, specificContext) => {
118
+ generalNodeQuery: assumptionMetavariableNodeQuery,
119
+ specificNodeQuery: assumptionMetavariableNodeQuery,
120
+ unify: (generalAssumptionMetavariableNode, specificAssumptionMetavariableNode, substitutions, generalContext, specificContext) => {
119
121
  let referenceUnifies;
120
122
 
121
- const { Metavariable, Reference } = ontology;
123
+ const { Reference } = ontology;
122
124
 
123
125
  let context,
124
126
  metavariableNode;
125
127
 
126
128
  context = generalContext; ///
127
129
 
128
- metavariableNode = generalDeclarationMetavariableNode; ///
130
+ metavariableNode = generalAssumptionMetavariableNode; ///
129
131
 
130
- const metavariable = Metavariable.fromMetavariableNode(metavariableNode, context); ///
132
+ const metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
133
+ metavariable = context.findMetavariableByMetavariableName(metavariableName);
131
134
 
132
135
  context = specificContext; ///
133
136
 
134
- metavariableNode = specificDeclarationMetavariableNode; ///
137
+ metavariableNode = specificAssumptionMetavariableNode; ///
135
138
 
136
139
  const reference = Reference.fromMetavariableNode(metavariableNode, context);
137
140
 
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  import ontology from "../ontology";
4
- import LocalContext from "../context/local";
4
+ import TemporaryContext from "../context/temporary";
5
5
  import combinatorBracketedContext from "../context/bracketed/combinator";
6
6
  import constructorBracketedContext from "../context/bracketed/constructor";
7
7
 
@@ -21,22 +21,6 @@ export function stripBracketsFromTerm(term, context) {
21
21
  return term;
22
22
  }
23
23
 
24
- export function stripBracketsFromReference(reference, context) {
25
- const referenceNode = reference.getNode(),
26
- bracketedReferenceChildNode = bracketedReferenceChildNodeFromReferenceNode(referenceNode);
27
-
28
- if (bracketedReferenceChildNode !== null) {
29
- context = contextFromReference(reference, context); ///
30
-
31
- const { Reference } = ontology,
32
- referenceNode = bracketedReferenceChildNode; ///
33
-
34
- reference = Reference.fromReferenceNode(referenceNode, context);
35
- }
36
-
37
- return reference;
38
- }
39
-
40
24
  export function stripBracketsFromStatement(statement, context) {
41
25
  const statementNode = statement.getNode(),
42
26
  bracketedStatementChildNode = bracketedStatementChildNodeFromStatementNode(statementNode);
@@ -105,22 +89,12 @@ export function bracketedStatementChildNodeFromStatementNode(statementNode) {
105
89
  return bracketedStatementChildNode;
106
90
  }
107
91
 
108
- function contextFromReference(reference, context) {
109
- const referenceTokens = reference.getTokens(),
110
- tokens = referenceTokens, ///
111
- localContext = LocalContext.fromContextAndTokens(context, tokens);
112
-
113
- context = localContext; ///
114
-
115
- return context;
116
- }
117
-
118
92
  function contextFromStatement(statement, context) {
119
93
  const statementTokens = statement.getTokens(),
120
94
  tokens = statementTokens, ///
121
- localContext = LocalContext.fromContextAndTokens(context, tokens);
95
+ temporaryContext = TemporaryContext.fromContextAndTokens(context, tokens);
122
96
 
123
- context = localContext; ///
97
+ context = temporaryContext; ///
124
98
 
125
99
  return context;
126
100
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  import ontology from "../ontology";
4
- import LocalContext from "../context/local";
4
+ import TemporaryContext from "../context/temporary";
5
5
 
6
6
  export function metavariableFromFrame(frame, context) {
7
7
  context = contextFromFrame(frame, context); ///
@@ -106,9 +106,9 @@ export function satisfiesAssertionFromStatement(statement, context) {
106
106
  function contextFromFrame(frame, context) {
107
107
  const frameTokens = frame.getTokens(),
108
108
  tokens = frameTokens, ///
109
- localContext = LocalContext.fromContextAndTokens(context, tokens);
109
+ temporaryContext = TemporaryContext.fromContextAndTokens(context, tokens);
110
110
 
111
- context = localContext; ///
111
+ context = temporaryContext; ///
112
112
 
113
113
  return context;
114
114
  }
@@ -116,9 +116,9 @@ function contextFromFrame(frame, context) {
116
116
  function contextFromStatement(statement, context) {
117
117
  const statementTokens = statement.getTokens(),
118
118
  tokens = statementTokens, ///
119
- localContext = LocalContext.fromContextAndTokens(context, tokens);
119
+ temporaryContext = TemporaryContext.fromContextAndTokens(context, tokens);
120
120
 
121
- context = localContext; ///
121
+ context = temporaryContext; ///
122
122
 
123
123
  return context;
124
124
  }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ import { nodeQuery } from "../utilities/query";
4
+
5
+ const frameMetavariableNameNodeQuery = nodeQuery("/frame/assumption!/metavariable!/@name!");
6
+
7
+ export function frameMetavariableNameFromFrameNode(frmaeNode) {
8
+ const frameMetavariableNameTerminalNode = frameMetavariableNameNodeQuery(frmaeNode),
9
+ frameMetavariableNameTerminalNodeContent = frameMetavariableNameTerminalNode.getContent(),
10
+ frameMetavariableName = frameMetavariableNameTerminalNodeContent; ///
11
+
12
+ return frameMetavariableName;
13
+ }
@@ -203,6 +203,22 @@ export function labelFromJSON(json, context) {
203
203
  return label;
204
204
  }
205
205
 
206
+ export function framesFromJSON(json, context) {
207
+ let { frames } = json;
208
+
209
+ const { Frame } = ontology,
210
+ framesJSON = frames; ///
211
+
212
+ frames = framesJSON.map((frameJSON) => {
213
+ const json = frameJSON, ///
214
+ frame = Frame.fromJSON(json, context);
215
+
216
+ return frame;
217
+ });
218
+
219
+ return frames;
220
+ }
221
+
206
222
  export function labelsFromJSON(json, context) {
207
223
  let { labels } = json;
208
224
 
@@ -600,6 +616,18 @@ export function rulesToRulesJSON(rules) {
600
616
  return rulesJSON;
601
617
  }
602
618
 
619
+ export function framesToFramesJSON(frames) {
620
+ const framesJSON = frames.map((frame) => {
621
+ const frameJSON = frame.toJSON();
622
+
623
+ frame = frameJSON; ///
624
+
625
+ return frame;
626
+ });
627
+
628
+ return framesJSON;
629
+ }
630
+
603
631
  export function labelsToLabelsJSON(labels) {
604
632
  const labelsJSON = labels.map((label) => {
605
633
  const labelJSON = label.toJSON();
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ import { nodeQuery } from "../utilities/query";
4
+
5
+ const metavariableNameNodeQuery = nodeQuery("/metavariable/@name!");
6
+
7
+ export function metavariableNameFromMetavariableNode(metavariableNode) {
8
+ const metavariableNameTerminalNode = metavariableNameNodeQuery(metavariableNode),
9
+ metavariableNameTerminalNodeContent = metavariableNameTerminalNode.getContent(),
10
+ metavariableName = metavariableNameTerminalNodeContent; ///
11
+
12
+ return metavariableName;
13
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ import { nodeQuery } from "../utilities/query";
4
+
5
+ const statementMetavariableNameNodeQuery = nodeQuery("/statement/metavariable!/@name!");
6
+
7
+ export function statementMetavariableNameFromFrameNode(frmaeNode) {
8
+ const statementMetavariableNameTerminalNode = statementMetavariableNameNodeQuery(frmaeNode),
9
+ statementMetavariableNameTerminalNodeContent = statementMetavariableNameTerminalNode.getContent(),
10
+ statementMetavariableName = statementMetavariableNameTerminalNodeContent; ///
11
+
12
+ return statementMetavariableName;
13
+ }
@@ -1,20 +1,32 @@
1
1
  "use strict";
2
2
 
3
- import ontology from "../ontology";
3
+ import { nodeQuery } from "../utilities/query";
4
+ import { frameMetavariableNameFromFrameNode } from "../utilities/frame";
5
+ import { termVariableIdentifierFromTermNode } from "../utilities/variable";
6
+ import { statementMetavariableNameFromFrameNode } from "../utilities/statement";
4
7
 
5
- export function termFromTermAndSubstitutions(term, substitutions, context) {
8
+ const substitutionNodeQuery = nodeQuery("/statement/termSubstitution|frameSubstitution!");
9
+
10
+ export function termFromTermAndSubstitutions(term, substitutions, generalContext, specificContext) {
6
11
  if (term !== null) {
7
- const { Variable } = ontology,
8
- termNode = term.getNode(),
9
- variable = Variable.fromTermNode(termNode, context);
12
+ const termNode = term.getNode(),
13
+ termSimple = term.isSimple();
10
14
 
11
15
  term = null; ///
12
16
 
13
- if (variable !== null) {
14
- const substitution = substitutions.findSubstitutionByVariable(variable);
17
+ if (termSimple) {
18
+ const termVariableIdentifier = termVariableIdentifierFromTermNode(termNode),
19
+ variableIdentifier = termVariableIdentifier, ///
20
+ variable = generalContext.findVariableByVariableIdentifier(variableIdentifier);
21
+
22
+ if (variable !== null) {
23
+ const substitution = substitutions.findSubstitutionByVariable(variable);
24
+
25
+ if (substitution !== null) {
26
+ const termSubstitution = substitution; ///
15
27
 
16
- if (substitution !== null) {
17
- term = substitution.getTerm();
28
+ term = termSubstitution.getTerm();
29
+ }
18
30
  }
19
31
  }
20
32
  }
@@ -22,21 +34,28 @@ export function termFromTermAndSubstitutions(term, substitutions, context) {
22
34
  return term;
23
35
  }
24
36
 
25
- export function frameFromFrameAndSubstitutions(frame, substitutions, context) {
37
+ export function frameFromFrameAndSubstitutions(frame, substitutions, generalContext, specificContext) {
26
38
  if (frame !== null) {
27
- const { Metavariable } = ontology,
28
- frameNode = frame.getNode(),
29
- metavariable = Metavariable.fromFrameNode(frameNode, context);
39
+ const frameNode = frame.getNode(),
40
+ frameSimple = frame.isSimple();
30
41
 
31
- frame = null; ///
42
+ frame = null; ///
32
43
 
33
- if (metavariable !== null) {
34
- let substitution = null;
44
+ if (frameSimple) {
45
+ const frameMetavariableName = frameMetavariableNameFromFrameNode(frameNode),
46
+ metavariableName = frameMetavariableName, ///
47
+ metavariable = generalContext.findMetavariableByMetavariableName(metavariableName);
48
+
49
+ if (metavariable !== null) {
50
+ let substitution = null;
35
51
 
36
- substitution = substitutions.findSubstitutionByMetavariableAndSubstitution(metavariable, substitution);
52
+ substitution = substitutions.findSubstitutionByMetavariableAndSubstitution(metavariable, substitution);
37
53
 
38
- if (substitution !== null) {
39
- frame = substitution.getFrame();
54
+ if (substitution !== null) {
55
+ const frameSubstitution = substitution; ///
56
+
57
+ frame = frameSubstitution.getFrame();
58
+ }
40
59
  }
41
60
  }
42
61
  }
@@ -44,27 +63,34 @@ export function frameFromFrameAndSubstitutions(frame, substitutions, context) {
44
63
  return frame;
45
64
  }
46
65
 
47
- export function statementFromStatementAndSubstitutions(statement, substitutions, context) {
66
+ export function statementFromStatementAndSubstitutions(statement, substitutions, generalContext, specificContext) {
48
67
  if (statement !== null) {
49
- const { Metavariable } = ontology,
50
- statementNode = statement.getNode(),
51
- metavariable = Metavariable.fromStatementNode(statementNode, context);
68
+ const statementNode = statement.getNode(),
69
+ statementSimple = statement.isSimple();
70
+
71
+ if (statementSimple) {
72
+ statement = null;
52
73
 
53
- statement = null; ///
74
+ let substitution = null;
54
75
 
55
- if (metavariable !== null) {
56
- let substitution;
76
+ const substitutionNode = substitutionNodeQuery(statementNode);
77
+
78
+ if (substitutionNode !== null) {
79
+ substitution = generalContext.findSubstitutionBySubstitutionNode(substitutionNode);
80
+ }
57
81
 
58
- const { TermSubstitution, FrameSubstitution } = ontology,
59
- termSubstitution = TermSubstitution.fromStatementNode(statementNode, context),
60
- frameSubstitution = FrameSubstitution.fromStatementNode(statementNode, context);
82
+ const statementMetavariableName = statementMetavariableNameFromFrameNode(statementNode),
83
+ metavariableName = statementMetavariableName, ///
84
+ metavariable = generalContext.findMetavariableByMetavariableName(metavariableName);
61
85
 
62
- substitution = (termSubstitution || frameSubstitution);
86
+ if (metavariable !== null) {
87
+ substitution = substitutions.findSubstitutionByMetavariableAndSubstitution(metavariable, substitution);
63
88
 
64
- substitution = substitutions.findSubstitutionByMetavariableAndSubstitution(metavariable, substitution); ///
89
+ if (substitution !== null) {
90
+ const statementSubstitution = substitution; ///
65
91
 
66
- if (substitution !== null) {
67
- statement = substitution.getStatement();
92
+ statement = statementSubstitution.getStatement();
93
+ }
68
94
  }
69
95
  }
70
96
  }