occam-verify-cli 1.0.587 → 1.0.602

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 (105) hide show
  1. package/lib/context/ephemeral.js +74 -2
  2. package/lib/context/file/nominal.js +11 -9
  3. package/lib/context/liminal.js +161 -24
  4. package/lib/context/literal.js +8 -2
  5. package/lib/context/scoped.js +4 -28
  6. package/lib/context/synthetic.js +146 -0
  7. package/lib/context.js +170 -1
  8. package/lib/element/assertion/contained.js +21 -15
  9. package/lib/element/assertion/defined.js +45 -65
  10. package/lib/element/assertion/property.js +25 -19
  11. package/lib/element/assertion/satisfies.js +14 -8
  12. package/lib/element/assertion/subproof.js +12 -6
  13. package/lib/element/assertion.js +47 -1
  14. package/lib/element/assumption.js +12 -12
  15. package/lib/element/conclusion.js +2 -2
  16. package/lib/element/deduction.js +2 -2
  17. package/lib/element/frame.js +61 -29
  18. package/lib/element/judgement.js +7 -1
  19. package/lib/element/label.js +8 -8
  20. package/lib/element/metavariable.js +71 -59
  21. package/lib/element/procedureCall.js +24 -8
  22. package/lib/element/proof.js +43 -35
  23. package/lib/element/proofAssertion/premise.js +122 -97
  24. package/lib/element/proofAssertion/step.js +161 -115
  25. package/lib/element/proofAssertion/supposition.js +157 -118
  26. package/lib/element/proofAssertion.js +3 -3
  27. package/lib/element/reference.js +40 -7
  28. package/lib/element/rule.js +227 -95
  29. package/lib/element/signature.js +2 -1
  30. package/lib/element/statement.js +67 -34
  31. package/lib/element/substitution/frame.js +36 -16
  32. package/lib/element/substitution/reference.js +36 -16
  33. package/lib/element/substitution/statement.js +94 -55
  34. package/lib/element/substitution/term.js +36 -16
  35. package/lib/element/substitution.js +54 -17
  36. package/lib/element/substitutions.js +4 -276
  37. package/lib/element/term.js +60 -31
  38. package/lib/element/topLevelAssertion/axiom.js +13 -4
  39. package/lib/element/topLevelAssertion/conjecture.js +7 -2
  40. package/lib/element/topLevelAssertion/theorem.js +7 -2
  41. package/lib/element/topLevelAssertion.js +201 -134
  42. package/lib/element/topLevelMetaAssertion.js +310 -51
  43. package/lib/element/variable.js +15 -6
  44. package/lib/node/substitution/statement.js +33 -1
  45. package/lib/process/unify.js +6 -6
  46. package/lib/utilities/context.js +10 -25
  47. package/lib/utilities/element.js +34 -9
  48. package/lib/utilities/statement.js +1 -8
  49. package/lib/utilities/string.js +12 -1
  50. package/lib/utilities/substitutions.js +42 -16
  51. package/lib/utilities/unification.js +3 -1
  52. package/lib/utilities/validation.js +2 -2
  53. package/package.json +4 -4
  54. package/src/context/ephemeral.js +73 -1
  55. package/src/context/file/nominal.js +14 -11
  56. package/src/context/liminal.js +180 -25
  57. package/src/context/literal.js +3 -1
  58. package/src/context/scoped.js +3 -35
  59. package/src/context/synthetic.js +49 -0
  60. package/src/context.js +163 -1
  61. package/src/element/assertion/contained.js +28 -20
  62. package/src/element/assertion/defined.js +62 -34
  63. package/src/element/assertion/property.js +27 -19
  64. package/src/element/assertion/satisfies.js +15 -7
  65. package/src/element/assertion/subproof.js +13 -5
  66. package/src/element/assertion.js +35 -0
  67. package/src/element/assumption.js +5 -5
  68. package/src/element/conclusion.js +2 -4
  69. package/src/element/deduction.js +2 -4
  70. package/src/element/frame.js +71 -39
  71. package/src/element/judgement.js +2 -0
  72. package/src/element/label.js +4 -4
  73. package/src/element/metavariable.js +94 -75
  74. package/src/element/procedureCall.js +6 -6
  75. package/src/element/proof.js +6 -6
  76. package/src/element/proofAssertion/premise.js +101 -69
  77. package/src/element/proofAssertion/step.js +78 -39
  78. package/src/element/proofAssertion/supposition.js +141 -115
  79. package/src/element/proofAssertion.js +3 -2
  80. package/src/element/reference.js +52 -10
  81. package/src/element/rule.js +138 -76
  82. package/src/element/signature.js +2 -0
  83. package/src/element/statement.js +76 -45
  84. package/src/element/substitution/frame.js +44 -15
  85. package/src/element/substitution/reference.js +44 -15
  86. package/src/element/substitution/statement.js +124 -72
  87. package/src/element/substitution/term.js +43 -15
  88. package/src/element/substitution.js +55 -18
  89. package/src/element/substitutions.js +1 -258
  90. package/src/element/term.js +65 -34
  91. package/src/element/topLevelAssertion/axiom.js +1 -1
  92. package/src/element/topLevelAssertion/conjecture.js +1 -1
  93. package/src/element/topLevelAssertion/theorem.js +1 -1
  94. package/src/element/topLevelAssertion.js +128 -48
  95. package/src/element/topLevelMetaAssertion.js +86 -32
  96. package/src/element/variable.js +15 -5
  97. package/src/node/substitution/statement.js +33 -0
  98. package/src/process/unify.js +6 -8
  99. package/src/utilities/context.js +9 -8
  100. package/src/utilities/element.js +37 -10
  101. package/src/utilities/statement.js +0 -7
  102. package/src/utilities/string.js +14 -0
  103. package/src/utilities/substitutions.js +59 -17
  104. package/src/utilities/unification.js +4 -0
  105. package/src/utilities/validation.js +3 -1
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  import ProofAssertion from "../proofAssertion";
4
- import assignAssignments from "../../process/assign";
5
4
 
6
5
  import { define } from "../../elements";
7
6
  import { attempt, liminally } from "../../utilities/context";
@@ -24,90 +23,56 @@ export default define(class Premise extends ProofAssertion {
24
23
  return stated;
25
24
  }
26
25
 
27
- async verify(context) {
28
- let verifies = false;
29
-
30
- await this.break(context);
26
+ validate(assignments, context) {
27
+ let validates = false;
31
28
 
32
29
  const premiseString = this.getString(); ///
33
30
 
34
- context.trace(`Verifying the '${premiseString}' premise...`);
31
+ context.trace(`Validatting the '${premiseString}' premise...`);
35
32
 
36
33
  const statement = this.getStatement(),
37
34
  procedureCall = this.getProcedureCall();
38
35
 
39
- if ((statement !== null) || (procedureCall !== null)) {
40
- attempt((context) => {
41
- if (statement !== null) {
42
- const assignments = [],
43
- statementValidates = this.validateStatement(assignments, context);
44
-
45
- if (statementValidates) {
46
- const assignmentsAssigned = assignAssignments(assignments, context);
47
-
48
- if (assignmentsAssigned) {
49
- const subproofOrProofAssertion = this; ///
36
+ if (false) {
37
+ ///
38
+ } else if (statement !== null) {
39
+ const statementValidates = this.validateStatement(assignments, context);
50
40
 
51
- context.addSubproofOrProofAssertion(subproofOrProofAssertion);
52
-
53
- this.setContext(context);
54
-
55
- verifies = true;
56
- }
57
- }
58
- }
59
-
60
- if (procedureCall !== null) {
61
- const procedureCallValidates = procedureCall.validate(context);
62
-
63
- if (procedureCallValidates) {
64
- this.setContext(context);
41
+ if (statementValidates) {
42
+ validates = true;
43
+ }
44
+ } else if (procedureCall !== null) {
45
+ const procedureCallValidates = this.validateProcedureCall(assignments, context);
65
46
 
66
- verifies = true;
67
- }
68
- }
69
- }, context);
47
+ if (procedureCallValidates) {
48
+ validates = true;
49
+ }
70
50
  } else {
71
- context.debug(`Unable to verify the '${premiseString}' premise because it is nonsense.`);
51
+ context.debug(`Unable to validate the '${premiseString}' premise because it is nonsense.`);
72
52
  }
73
53
 
74
- if (verifies) {
75
- context.debug(`...verified the '${premiseString}' premise.`);
54
+ if (validates) {
55
+ context.debug(`...validated the '${premiseString}' premise.`);
76
56
  }
77
57
 
78
- return verifies;
58
+ return validates;
79
59
  }
80
60
 
81
- async unifyIndependently(context) {
82
- let unifiesIndependently = false;
83
-
84
- const premiseString = this.getString(); ///
85
-
86
- context.trace(`Unifying the '${premiseString}' premise independently...`);
87
-
88
- const statement = this.getStatement();
61
+ validateProcedureCall(assignments, context) {
62
+ let procedureCallValidates = false;
89
63
 
90
- if (statement !== null) {
91
- const statementUnifiesIndependently = statement.unifyIndependently(context);
64
+ const premiseString = this.getString(), ///
65
+ procedureCallString = this.procedureCall.getString();
92
66
 
93
- if (statementUnifiesIndependently) {
94
- unifiesIndependently = true;
95
- }
96
- }
67
+ context.trace(`Validatting the '${premiseString}' premise's '${procedureCallString}' procedure call...`);
97
68
 
98
- if (this.procedureCall !== null) {
99
- const procedureCallResolvedIndependently = await this.procedureCall.unifyIndependently(context);
69
+ procedureCallValidates = this.procedureCall.validate(context);
100
70
 
101
- if (procedureCallResolvedIndependently) {
102
- unifiesIndependently = true;
103
- }
71
+ if (procedureCallValidates) {
72
+ context.debug(`...validated the '${premiseString}' premise's '${procedureCallString}' procedure call.`);
104
73
  }
105
74
 
106
- if (unifiesIndependently) {
107
- context.debug(`...unified the '${premiseString}' premise independenly.`);
108
- }
109
-
110
- return unifiesIndependently;
75
+ return procedureCallValidates;
111
76
  }
112
77
 
113
78
  unifySubproofOrProofAssertion(subproofOrProofAssertion, context) {
@@ -119,12 +84,12 @@ export default define(class Premise extends ProofAssertion {
119
84
  context.trace(`Unifying the '${subproofOrProofAssertionString}' subproof or proof assertion with the '${premiseString}' premise...`);
120
85
 
121
86
  const subproofOrProofAssertionProofAssertion = subproofOrProofAssertion.isProofAssertion(),
122
- proofAssertion = subproofOrProofAssertionProofAssertion ?
123
- subproofOrProofAssertion :
124
- null,
125
- subproof = subproofOrProofAssertionProofAssertion ?
126
- null :
127
- subproofOrProofAssertion;
87
+ proofAssertion = subproofOrProofAssertionProofAssertion ?
88
+ subproofOrProofAssertion :
89
+ null,
90
+ subproof = subproofOrProofAssertionProofAssertion ?
91
+ null :
92
+ subproofOrProofAssertion;
128
93
 
129
94
  if (proofAssertion !== null) {
130
95
  const proofAssertionUnifies = this.unifyProofAssertion(proofAssertion, context);
@@ -222,6 +187,73 @@ export default define(class Premise extends ProofAssertion {
222
187
  return subproofUnifies;
223
188
  }
224
189
 
190
+ async verify(assignments, context) {
191
+ let verifies = false;
192
+
193
+ await this.break(context);
194
+
195
+ const premiseString = this.getString();
196
+
197
+ context.trace(`Verifying the '${premiseString}' premise...`);
198
+
199
+ attempt((context) => {
200
+ const validates = this.validate(assignments, context);
201
+
202
+ if (validates) {
203
+ this.setContext(context);
204
+
205
+ verifies = true;
206
+ }
207
+ }, context);
208
+
209
+ if (verifies) {
210
+ context.debug(`...verified the '${premiseString}' premise.`);
211
+ }
212
+
213
+ return verifies;
214
+ }
215
+
216
+ async unifyIndependently(context) {
217
+ let unifiesIndependently = false;
218
+
219
+ const premiseString = this.getString(); ///
220
+
221
+ context.trace(`Unifying the '${premiseString}' premise independently...`);
222
+
223
+ const statement = this.getStatement(),
224
+ procedureCall = this.getProcedureCall();
225
+
226
+ if (statement !== null) {
227
+ const specificContext = context; ///
228
+
229
+ context = this.getContext();
230
+
231
+ const generalContext = context; ///
232
+
233
+ context = specificContext; ///
234
+
235
+ const statementUnifiesIndependently = statement.unifyIndependently(generalContext, specificContext);
236
+
237
+ if (statementUnifiesIndependently) {
238
+ unifiesIndependently = true;
239
+ }
240
+ }
241
+
242
+ if (procedureCall !== null) {
243
+ const procedureCallResolvedIndependently = await procedureCall.unifyIndependently(context);
244
+
245
+ if (procedureCallResolvedIndependently) {
246
+ unifiesIndependently = true;
247
+ }
248
+ }
249
+
250
+ if (unifiesIndependently) {
251
+ context.debug(`...unified the '${premiseString}' premise independenly.`);
252
+ }
253
+
254
+ return unifiesIndependently;
255
+ }
256
+
225
257
  toJSON() {
226
258
  const procedureCallJSON = procedureCallToProcedureCallJSON(this.procedureCall),
227
259
  statementJSON = statementToStatementJSON(this.statement),
@@ -59,62 +59,38 @@ export default define(class Step extends ProofAssertion {
59
59
  return comparesToTermAndPropertyRelation;
60
60
  }
61
61
 
62
- async verify(assignments, context) {
63
- let verifies = false;
64
-
65
- await this.break(context);
62
+ validate(assignments, context) {
63
+ let validates = false;
66
64
 
67
65
  const stepString = this.getString(); ///
68
66
 
69
- context.trace(`Verifying the '${stepString}' step...`);
67
+ context.trace(`Validating the '${stepString}' step...`);
70
68
 
71
69
  const statement = this.getStatement();
72
70
 
73
71
  if (statement !== null) {
74
- asyncAttempt(async (context) => {
75
- const referenceValidates = this.validateReference(context);
76
-
77
- if (referenceValidates) {
78
- const satisfiesAssertioValidates = this.validateSatisfiesAssertion(context);
79
-
80
- if (satisfiesAssertioValidates) {
81
- const statementValidates = this.validateStatement(assignments, context);
72
+ const referenceValidates = this.validateReference(context);
82
73
 
83
- if (statementValidates) {
84
- const reference = this.getReference(),
85
- satisfiesAssertion = this.getSatisfiesAssertion(),
86
- statementUnifies = await asyncLiminally(async (context) => {
87
- const statementUnifies = await asyncSome(unifyStatements, async (unifyStatement) => {
88
- const statementUnifies = await unifyStatement(statement, reference, satisfiesAssertion, context);
89
-
90
- if (statementUnifies) {
91
- this.setContext(context);
92
-
93
- return true;
94
- }
95
- });
74
+ if (referenceValidates) {
75
+ const satisfiesAssertioValidates = this.validateSatisfiesAssertion(context);
96
76
 
97
- return statementUnifies;
98
- }, context);
77
+ if (satisfiesAssertioValidates) {
78
+ const statementValidates = this.validateStatement(assignments, context);
99
79
 
100
- if (statementUnifies) {
101
- verifies = true;
102
- }
103
- }
80
+ if (statementValidates) {
81
+ validates = true;
104
82
  }
105
83
  }
106
-
107
- return verifies;
108
- }, context);
84
+ }
109
85
  } else {
110
- context.debug(`Unable to verify the '${stepString}' step because it is nonsense.`);
86
+ context.debug(`Unable to validate the '${stepString}' step because it is nonsense.`);
111
87
  }
112
88
 
113
- if (verifies) {
114
- context.debug(`...verified the '${stepString}' step.`);
89
+ if (validates) {
90
+ context.debug(`...validate the '${stepString}' step.`);
115
91
  }
116
92
 
117
- return verifies;
93
+ return validates;
118
94
  }
119
95
 
120
96
  validateReference(context) {
@@ -190,5 +166,68 @@ export default define(class Step extends ProofAssertion {
190
166
  return unifiesWithSatisfiesAssertion;
191
167
  }
192
168
 
169
+ async verify(assignments, context) {
170
+ let verifies = false;
171
+
172
+ await this.break(context);
173
+
174
+ const stepString = this.getString(); ///
175
+
176
+ context.trace(`Verifying the '${stepString}' step...`);
177
+
178
+ await asyncAttempt(async (context) => {
179
+ const validates = this.validate(assignments, context);
180
+
181
+ if (validates) {
182
+ const unifies = await this.unify(context);
183
+
184
+ if (unifies) {
185
+ this.setContext(context);
186
+
187
+ verifies = true;
188
+ }
189
+ }
190
+ }, context);
191
+
192
+ if (verifies) {
193
+ context.debug(`...verified the '${stepString}' step.`);
194
+ }
195
+
196
+ return verifies;
197
+ }
198
+
199
+ async unify(context) {
200
+ let unifies = false;
201
+
202
+ const stepString = this.getString(); ///
203
+
204
+ context.trace(`Unifying the '${stepString}' step...`);
205
+
206
+ const statement = this.getStatement(),
207
+ reference = this.getReference(),
208
+ satisfiesAssertion = this.getSatisfiesAssertion(),
209
+ statementUnifies = await asyncLiminally(async (context) => {
210
+ const statementUnifies = await asyncSome(unifyStatements, async (unifyStatement) => {
211
+ const statementUnifies = await unifyStatement(statement, reference, satisfiesAssertion, context);
212
+
213
+ if (statementUnifies) {
214
+ return true;
215
+ }
216
+ });
217
+
218
+ return statementUnifies;
219
+ }, context);
220
+
221
+ if (statementUnifies) {
222
+ unifies = true;
223
+ }
224
+
225
+ if (unifies) {
226
+ context.debug(`...unified the '${stepString}' step.`);
227
+ }
228
+
229
+ return unifies;
230
+ }
231
+
193
232
  static name = "Step";
194
233
  });