occam-verify-cli 1.0.905 → 1.0.910

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 (55) hide show
  1. package/lib/context.js +5 -1
  2. package/lib/element/assertion/contained.js +6 -3
  3. package/lib/element/assertion/defined.js +6 -3
  4. package/lib/element/assertion/property.js +6 -3
  5. package/lib/element/assertion/satisfies.js +25 -8
  6. package/lib/element/assertion/subproof.js +5 -3
  7. package/lib/element/assertion/type.js +6 -3
  8. package/lib/element/assumption/metaLevel.js +5 -3
  9. package/lib/element/assumption.js +6 -3
  10. package/lib/element/equality.js +6 -3
  11. package/lib/element/frame.js +8 -5
  12. package/lib/element/judgement.js +6 -3
  13. package/lib/element/metavariable.js +8 -5
  14. package/lib/element/property.js +12 -5
  15. package/lib/element/propertyRelation.js +6 -3
  16. package/lib/element/reference.js +8 -4
  17. package/lib/element/signature.js +73 -60
  18. package/lib/element/statement.js +7 -3
  19. package/lib/element/substitution/frame.js +7 -4
  20. package/lib/element/substitution/reference.js +7 -4
  21. package/lib/element/substitution/statement.js +7 -4
  22. package/lib/element/substitution/term.js +6 -4
  23. package/lib/element/term.js +26 -7
  24. package/lib/element/topLevelAssertion/axiom.js +14 -16
  25. package/lib/element/variable.js +2 -2
  26. package/lib/process/unify.js +56 -24
  27. package/lib/utilities/element.js +3 -14
  28. package/package.json +4 -4
  29. package/src/context.js +7 -0
  30. package/src/element/assertion/contained.js +8 -4
  31. package/src/element/assertion/defined.js +8 -4
  32. package/src/element/assertion/property.js +8 -4
  33. package/src/element/assertion/satisfies.js +34 -9
  34. package/src/element/assertion/subproof.js +6 -4
  35. package/src/element/assertion/type.js +8 -4
  36. package/src/element/assumption/metaLevel.js +6 -4
  37. package/src/element/assumption.js +8 -4
  38. package/src/element/equality.js +8 -4
  39. package/src/element/frame.js +10 -7
  40. package/src/element/judgement.js +8 -4
  41. package/src/element/metavariable.js +10 -7
  42. package/src/element/property.js +14 -6
  43. package/src/element/propertyRelation.js +8 -4
  44. package/src/element/reference.js +11 -5
  45. package/src/element/signature.js +118 -37
  46. package/src/element/statement.js +9 -3
  47. package/src/element/substitution/frame.js +9 -5
  48. package/src/element/substitution/reference.js +9 -5
  49. package/src/element/substitution/statement.js +9 -5
  50. package/src/element/substitution/term.js +7 -5
  51. package/src/element/term.js +39 -9
  52. package/src/element/topLevelAssertion/axiom.js +23 -26
  53. package/src/element/variable.js +2 -2
  54. package/src/process/unify.js +84 -35
  55. package/src/utilities/element.js +3 -20
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "occam-verify-cli",
3
3
  "author": "James Smith",
4
- "version": "1.0.905",
4
+ "version": "1.0.910",
5
5
  "license": "MIT, Anti-996",
6
6
  "homepage": "https://github.com/djalbat/occam-verify-cli",
7
7
  "description": "Occam's Verifier",
@@ -12,12 +12,12 @@
12
12
  "dependencies": {
13
13
  "argumentative": "^2.0.47",
14
14
  "necessary": "^17.1.7",
15
- "occam-furtle": "^3.0.192",
15
+ "occam-furtle": "^3.0.193",
16
16
  "occam-grammars": "^1.3.520",
17
- "occam-languages": "^0.0.196",
17
+ "occam-languages": "^0.0.197",
18
18
  "occam-lexers": "^23.1.44",
19
19
  "occam-model": "^1.0.505",
20
- "occam-nominal": "^1.0.100",
20
+ "occam-nominal": "^1.0.101",
21
21
  "occam-parsers": "^23.1.50",
22
22
  "occam-server": "^7.0.6"
23
23
  },
package/src/context.js CHANGED
@@ -206,6 +206,13 @@ export default class Context extends ContextBase {
206
206
  return rule;
207
207
  }
208
208
 
209
+ findAxiomByReference(reference) {
210
+ const context = this.getContext(),
211
+ axiom = context.findAxiomByReference(reference);
212
+
213
+ return axiom;
214
+ }
215
+
209
216
  findTopLevelAssertionByReference(reference) {
210
217
  const context = this.getContext(),
211
218
  topLevelAssertion = context.findTopLevelAssertionByReference(reference);
@@ -52,15 +52,17 @@ export default define(class ContainedAssertion extends Assertion {
52
52
 
53
53
  context.trace(`Validating the '${containedAssertionString}' contained assertion...`);
54
54
 
55
+ let validates = false;
56
+
55
57
  const validAssertion = this.findValidAssertion(context);
56
58
 
57
59
  if (validAssertion !== null) {
60
+ validates = true;
61
+
58
62
  containedAssertion = validAssertion; ///
59
63
 
60
64
  context.debug(`...the '${containedAssertionString}' contained assertion is already valid.`);
61
65
  } else {
62
- let validates = false;
63
-
64
66
  const termValidates = this.validateTerm(context),
65
67
  frameValidates = this.validateFrame(context),
66
68
  statementValidates = this.validateStatement(context)
@@ -88,11 +90,13 @@ export default define(class ContainedAssertion extends Assertion {
88
90
  containedAssertion = assertion; ///
89
91
 
90
92
  context.addAssertion(assertion);
91
-
92
- context.debug(`...validated the '${containedAssertionString}' contained assertion.`);
93
93
  }
94
94
  }
95
95
 
96
+ if (validates) {
97
+ context.debug(`...validated the '${containedAssertionString}' contained assertion.`);
98
+ }
99
+
96
100
  return containedAssertion;
97
101
  }
98
102
 
@@ -44,15 +44,17 @@ export default define(class DefinedAssertion extends Assertion {
44
44
 
45
45
  context.trace(`Validating the '${definedAssertionString}' defined assertion...`);
46
46
 
47
+ let validates = false;
48
+
47
49
  const validAssertion = this.findValidAssertion(context);
48
50
 
49
51
  if (validAssertion !== null) {
52
+ validates = true;
53
+
50
54
  definedAssertion = validAssertion; ///
51
55
 
52
56
  context.debug(`...the '${definedAssertionString}' defined definedAssertion is already valid.`);
53
57
  } else {
54
- let validates = false;
55
-
56
58
  const termValidates = this.validateTerm(context),
57
59
  frameValidates = this.validateFrame(context);
58
60
 
@@ -79,11 +81,13 @@ export default define(class DefinedAssertion extends Assertion {
79
81
  definedAssertion = assertion; ///
80
82
 
81
83
  context.addAssertion(assertion);
82
-
83
- context.debug(`...validated the '${definedAssertionString}' defined assertion.`);
84
84
  }
85
85
  }
86
86
 
87
+ if (validates) {
88
+ context.debug(`...validated the '${definedAssertionString}' defined assertion.`);
89
+ }
90
+
87
91
  return definedAssertion;
88
92
  }
89
93
 
@@ -66,15 +66,17 @@ export default define(class PropertyAssertion extends Assertion {
66
66
 
67
67
  context.trace(`Validating the '${propertyAssertionString}' property assertion...`);
68
68
 
69
+ let validates = false;
70
+
69
71
  const validAssertion = this.findValidAssertion(context);
70
72
 
71
73
  if (validAssertion) {
74
+ validates = true;
75
+
72
76
  propertyAssertion = validAssertion; ///
73
77
 
74
78
  context.debug(`...the '${propertyAssertionString}' property assertion is already valid.`);
75
79
  } else {
76
- let validates = false;
77
-
78
80
  const propertyRelationVerifies = this.validatePropertyRelation(context);
79
81
 
80
82
  if (propertyRelationVerifies) {
@@ -106,11 +108,13 @@ export default define(class PropertyAssertion extends Assertion {
106
108
  this.assign(context);
107
109
 
108
110
  context.addAssertion(assertion);
109
-
110
- context.debug(`...validated the '${propertyAssertionString}' property assertion.`);
111
111
  }
112
112
  }
113
113
 
114
+ if (validates) {
115
+ context.debug(`...validated the '${propertyAssertionString}' property assertion.`);
116
+ }
117
+
114
118
  return propertyAssertion;
115
119
  }
116
120
 
@@ -41,15 +41,17 @@ export default define(class SatisfiesAssertion extends Assertion {
41
41
 
42
42
  context.trace(`Validating the '${satisfiesAssertionString}' satisfies assertion...`);
43
43
 
44
+ let validates = true;
45
+
44
46
  const validAssertion = this.findValidAssertion(context);
45
47
 
46
48
  if (validAssertion) {
49
+ validates = true;
50
+
47
51
  satisfiesAssertion = validAssertion; ///
48
52
 
49
53
  context.debug(`...the '${satisfiesAssertionString}' satisfies satisfiesAssertion is already valid.`);
50
54
  } else {
51
- let validates = true;
52
-
53
55
  const signatureVerifies = this.validateSignature(context);
54
56
 
55
57
  if (signatureVerifies) {
@@ -68,11 +70,13 @@ export default define(class SatisfiesAssertion extends Assertion {
68
70
  satisfiesAssertion = assertion; ///
69
71
 
70
72
  context.addAssertion(satisfiesAssertion);
71
-
72
- context.debug(`...validated the '${satisfiesAssertionString}' satisfies assertion.`);
73
73
  }
74
74
  }
75
75
 
76
+ if (validates) {
77
+ context.debug(`...validated the '${satisfiesAssertionString}' satisfies assertion.`);
78
+ }
79
+
76
80
  return satisfiesAssertion;
77
81
  }
78
82
 
@@ -86,6 +90,8 @@ export default define(class SatisfiesAssertion extends Assertion {
86
90
  const signature = this.signature.validate(context);
87
91
 
88
92
  if (signature !== null) {
93
+ this.signature = signature;
94
+
89
95
  signatureValidates = true;
90
96
  }
91
97
 
@@ -103,13 +109,32 @@ export default define(class SatisfiesAssertion extends Assertion {
103
109
 
104
110
  context.trace(`Validating the '${satisfiesAssertionString}' satisfies assertino's reference...`);
105
111
 
106
- const axiom = context.findAxiomByReference(this.reference);
112
+ const reference = this.reference.validate(context);
113
+
114
+ if (reference !== null) {
115
+ const axiom = context.findAxiomByReference(reference);
116
+
117
+ if (axiom !== null) {
118
+ const satisfiable = axiom.isSatisfiable();
119
+
120
+ if (satisfiable) {
121
+ const signatureUnifies = axiom.unifySignature(this.signature, context);
122
+
123
+ if (signatureUnifies) {
124
+ this.reference = reference;
125
+
126
+ referenceVerifies = true;
127
+ }
128
+ } else {
129
+ const axiomString = axiom.getString();
130
+
131
+ context.debug(`The '${axiomString}' axiom is not satisfiable.`);
132
+ }
107
133
 
108
- if (axiom !== null) {
109
- const axiomSatisfiable = axiom.isSatisfiable();
134
+ } else {
135
+ const referencdString = reference.getString();
110
136
 
111
- if (axiomSatisfiable) {
112
- referenceVerifies = true;
137
+ context.debug(`There is no axiom for the '${referencdString}' reference.`);
113
138
  }
114
139
  }
115
140
 
@@ -57,6 +57,8 @@ export default define(class SubproofAssertion extends Assertion {
57
57
 
58
58
  context.trace(`Validating the '${subproofAssertionString}' subproof assertion...`);
59
59
 
60
+ let validates = false;
61
+
60
62
  const validAssertion = this.findValidAssertion(context);
61
63
 
62
64
  if (validAssertion) {
@@ -64,8 +66,6 @@ export default define(class SubproofAssertion extends Assertion {
64
66
 
65
67
  context.debug(`...the '${subproofAssertionString}' subproof assertion is already valid.`);
66
68
  } else {
67
- let validates = false;
68
-
69
69
  const statementsValidate = this.validateStatements(context);
70
70
 
71
71
  if (statementsValidate) {
@@ -78,11 +78,13 @@ export default define(class SubproofAssertion extends Assertion {
78
78
  subproofAssertion = assertion; ///
79
79
 
80
80
  context.addAssertion(assertion);
81
-
82
- context.debug(`...validated the '${subproofAssertionString}' subproof assertion.`);
83
81
  }
84
82
  }
85
83
 
84
+ if (validates) {
85
+ context.debug(`...validated the '${subproofAssertionString}' subproof assertion.`);
86
+ }
87
+
86
88
  return subproofAssertion;
87
89
  }
88
90
 
@@ -39,15 +39,17 @@ export default define(class TypeAssertion extends Assertion {
39
39
 
40
40
  context.trace(`Validating the '${typeAssertionString}' type assertion...`);
41
41
 
42
+ let validates = false;
43
+
42
44
  const validAssertion = this.findValidAssertion(context);
43
45
 
44
46
  if (validAssertion) {
47
+ validates = true;
48
+
45
49
  typeAssertion = validAssertion; ///
46
50
 
47
51
  context.debug(`...the '${typeAssertionString}' type assertion is already valid.`);
48
52
  } else {
49
- let validates = false;
50
-
51
53
  const typeValidates = this.validateType(context);
52
54
 
53
55
  if (typeValidates) {
@@ -75,11 +77,13 @@ export default define(class TypeAssertion extends Assertion {
75
77
  this.assign(context);
76
78
 
77
79
  context.addAssertion(assertion);
78
-
79
- context.debug(`...verified the '${typeAssertionString}' type assertion.`);
80
80
  }
81
81
  }
82
82
 
83
+ if (validates) {
84
+ context.debug(`...verified the '${typeAssertionString}' type assertion.`);
85
+ }
86
+
83
87
  return typeAssertion;
84
88
  }
85
89
 
@@ -105,13 +105,15 @@ export default define(class MetaLevelAssumption extends Element {
105
105
  this.commit(context);
106
106
  }
107
107
  }, context);
108
- }
109
108
 
110
- if (validates) {
111
- metaLevelAssumption = this; ///
109
+ if (validates) {
110
+ metaLevelAssumption = this; ///
112
111
 
113
- context.addMetaLevelAssumption(metaLevelAssumption);
112
+ context.addMetaLevelAssumption(metaLevelAssumption);
113
+ }
114
+ }
114
115
 
116
+ if (validates) {
115
117
  context.debug(`...validated the '${metaLevelAssumptionString}' meta-level assumption.`);
116
118
  }
117
119
 
@@ -64,15 +64,17 @@ export default define(class Assumption extends Element {
64
64
 
65
65
  context.trace(`Validating the '${assumptionString}' assumption...`);
66
66
 
67
+ let validates = false;
68
+
67
69
  const validAssumption = this.findValidAssumption(context);
68
70
 
69
71
  if (validAssumption) {
72
+ validates = true;
73
+
70
74
  assumption = validAssumption; ///
71
75
 
72
76
  context.debug(`...the '${assumptionString}' assumption is already valid.`);
73
77
  } else {
74
- let validates = false;
75
-
76
78
  const statementValidates = this.validateStatement(context);
77
79
 
78
80
  if (statementValidates) {
@@ -100,11 +102,13 @@ export default define(class Assumption extends Element {
100
102
  assumption = this; ///
101
103
 
102
104
  context.addAssumption(assumption);
103
-
104
- context.debug(`...validated the '${assumptionString}' assumption.`);
105
105
  }
106
106
  }
107
107
 
108
+ if (validates) {
109
+ context.debug(`...validated the '${assumptionString}' assumption.`);
110
+ }
111
+
108
112
  return assumption;
109
113
  }
110
114
 
@@ -123,15 +123,17 @@ export default define(class Equality extends Element {
123
123
 
124
124
  context.trace(`Validating the '${equalityString}' equality...`);
125
125
 
126
+ let validates = false;
127
+
126
128
  const validEquality = this.findValidEquality(context);
127
129
 
128
130
  if (validEquality !== null) {
131
+ validates = true;
132
+
129
133
  equality = validEquality; ///
130
134
 
131
135
  context.debug(`...the '${equalityString}' equality is already valid.`);
132
136
  } else {
133
- let validates = false;
134
-
135
137
  const termsValidate = this.validateTerms(context);
136
138
 
137
139
  if (termsValidate) {
@@ -157,11 +159,13 @@ export default define(class Equality extends Element {
157
159
  this.assign(context);
158
160
 
159
161
  context.addEquality(equality);
160
-
161
- context.debug(`...validated the '${equalityString}' equality.`);
162
162
  }
163
163
  }
164
164
 
165
+ if (validates) {
166
+ context.debug(`...validated the '${equalityString}' equality.`);
167
+ }
168
+
165
169
  return equality;
166
170
  }
167
171
 
@@ -120,16 +120,17 @@ export default define(class Frame extends Element {
120
120
 
121
121
  context.trace(`Validating the '${frameString}' frame...`);
122
122
 
123
- const validFrame = this.findValidFrame(context),
124
- valid = (validFrame !== null);
123
+ let validates = false;
124
+
125
+ const validFrame = this.findValidFrame(context);
126
+
127
+ if (validFrame !== null) {
128
+ validates = true;
125
129
 
126
- if (valid) {
127
130
  frame = validFrame; ///
128
131
 
129
132
  context.debug(`...the '${frameString}' frame is already valid.`);
130
133
  } else {
131
- let validates = false;
132
-
133
134
  const metavariableValidates = this.validatMetavariable(context);
134
135
 
135
136
  if (metavariableValidates) {
@@ -157,11 +158,13 @@ export default define(class Frame extends Element {
157
158
  frame = this; ///
158
159
 
159
160
  context.addFrame(frame);
160
-
161
- context.debug(`...validated the '${frameString}' frame.`);
162
161
  }
163
162
  }
164
163
 
164
+ if (validates) {
165
+ context.debug(`...validated the '${frameString}' frame.`);
166
+ }
167
+
165
168
  return frame;
166
169
  }
167
170
 
@@ -81,15 +81,17 @@ export default define(class Judgement extends Element {
81
81
 
82
82
  context.trace(`Validating the '${judgementString}' judgement...`);
83
83
 
84
+ let validates = false;
85
+
84
86
  const validJudgement = this.findValidJudgement(context);
85
87
 
86
88
  if (validJudgement !== null) {
89
+ validates = true;
90
+
87
91
  judgement = validJudgement; ///
88
92
 
89
93
  context.debug(`...the '${judgementString}' judgement is already valid.`);
90
94
  } else {
91
- let validates = false;
92
-
93
95
  const frameValidates = this.validateFrame(context);
94
96
 
95
97
  if (frameValidates) {
@@ -119,11 +121,13 @@ export default define(class Judgement extends Element {
119
121
  this.assign(context);
120
122
 
121
123
  context.addJudgement(judgement);
122
-
123
- context.debug(`...validated the '${judgementString}' judgement.`);
124
124
  }
125
125
  }
126
126
 
127
+ if (validates) {
128
+ context.debug(`...validated the '${judgementString}' judgement.`);
129
+ }
130
+
127
131
  return judgement;
128
132
  }
129
133
 
@@ -182,16 +182,17 @@ export default define(class Metavariable extends Element {
182
182
 
183
183
  context.trace(`Validating the '${metavariableString}' metavariable...`);
184
184
 
185
- const validMetavariable = this.findValidMetavariable(context),
186
- valid = (validMetavariable !== null);
185
+ let validates = false;
186
+
187
+ const validMetavariable = this.findValidMetavariable(context);
188
+
189
+ if (validMetavariable !== null) {
190
+ validates = true;
187
191
 
188
- if (valid) {
189
192
  metavariable = validMetavariable; ///
190
193
 
191
194
  context.debug(`...the '${metavariableString}' metavariable is already valid.`);
192
195
  } else {
193
- let validates = false;
194
-
195
196
  const nameValidates = this.validateName(strict, context);
196
197
 
197
198
  if (nameValidates) {
@@ -214,11 +215,13 @@ export default define(class Metavariable extends Element {
214
215
  if (declared) {
215
216
  context.addMetavariable(metavariable);
216
217
  }
217
-
218
- context.debug(`...validated the '${metavariableString}' metavariable.`);
219
218
  }
220
219
  }
221
220
 
221
+ if (validates) {
222
+ context.debug(`...validated the '${metavariableString}' metavariable.`);
223
+ }
224
+
222
225
  return metavariable;
223
226
  }
224
227
 
@@ -129,27 +129,31 @@ export default define(class Property extends Element {
129
129
 
130
130
  context.trace(`Validating the '${propertyString}' property...`);
131
131
 
132
+ let validates = false;
133
+
132
134
  const validProperty = this.findValidProperty(context);
133
135
 
134
- if (validProperty) {
136
+ if (validProperty !== null) {
135
137
  property = validProperty; ///
136
138
 
137
- context.debug(`...the '${propertyString}' property is already valid.`);
138
-
139
139
  const validatesForward = validateForwards(property);
140
140
 
141
- if (!validatesForward) {
141
+ if (validatesForward) {
142
+ validates = true;
143
+
144
+ context.debug(`...the '${propertyString}' property is already valid.`);
145
+ } else {
142
146
  property = null;
143
147
  }
144
148
  } else {
145
- let validates = false;
146
-
147
149
  property = this; ///
148
150
 
149
151
  const validatesForward = validateForwards(property);
150
152
 
151
153
  if (validatesForward) {
152
154
  validates = true;
155
+ } else {
156
+ property = null;
153
157
  }
154
158
 
155
159
  if (validates) {
@@ -159,6 +163,10 @@ export default define(class Property extends Element {
159
163
  }
160
164
  }
161
165
 
166
+ if (validates) {
167
+ context.debug(`...validated the '${propertyString}' property.`);
168
+ }
169
+
162
170
  return property;
163
171
  }
164
172
 
@@ -63,15 +63,17 @@ export default define(class PropertyRelation extends Element {
63
63
 
64
64
  context.trace(`Validating the '${propertyRelationString}' property relation...`);
65
65
 
66
+ let validates = false;
67
+
66
68
  const validPropertyRelation = this.findValidPropertyRelation(context);
67
69
 
68
70
  if (validPropertyRelation) {
71
+ validates = true;
72
+
69
73
  propertyRelation = validPropertyRelation; ///
70
74
 
71
75
  context.debug(`...the '${propertyRelationString}' property relation is already valid.`);
72
76
  } else {
73
- let validates = false;
74
-
75
77
  const termValidates = this.validateTerm(context);
76
78
 
77
79
  if (termValidates) {
@@ -84,11 +86,13 @@ export default define(class PropertyRelation extends Element {
84
86
  propertyRelation = this; ///
85
87
 
86
88
  context.addPropertyRelation(propertyRelation);
87
-
88
- context.debug(`...validated the '${propertyRelationString}' property relation.`);
89
89
  }
90
90
  }
91
91
 
92
+ if (validates) {
93
+ context.debug(`...validated the '${propertyRelationString}' property relation.`);
94
+ }
95
+
92
96
  return propertyRelation;
93
97
  }
94
98
 
@@ -123,7 +123,9 @@ export default define(class Reference extends Element {
123
123
 
124
124
  context.debug(`...the '${referenceString}' reference is already valid.`);
125
125
  } else {
126
- const context = this.getContext();
126
+ const specificContext = context; ///
127
+
128
+ context = this.getContext();
127
129
 
128
130
  attempt((context) => {
129
131
  const metavariableValidates = this.validateMetavariable(context);
@@ -161,13 +163,17 @@ export default define(class Reference extends Element {
161
163
  this.commit(context);
162
164
  }
163
165
  }, context);
164
- }
165
166
 
166
- if (validates) {
167
- reference = this; ///
167
+ context = specificContext; ///
168
168
 
169
- context.addReference(reference);
169
+ if (validates) {
170
+ reference = this; ///
170
171
 
172
+ context.addReference(reference);
173
+ }
174
+ }
175
+
176
+ if (validates) {
171
177
  context.debug(`...validated the '${referenceString}' reference.`);
172
178
  }
173
179