occam-verify-cli 1.0.582 → 1.0.583

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.
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.582",
4
+ "version": "1.0.583",
5
5
  "license": "MIT, Anti-996",
6
6
  "homepage": "https://github.com/djalbat/occam-verify-cli",
7
7
  "description": "Occam's Verifier",
@@ -13,12 +13,12 @@
13
13
  "argumentative": "^2.0.36",
14
14
  "necessary": "^17.0.9",
15
15
  "occam-file-system": "^6.0.505",
16
- "occam-furtle": "^3.0.94",
16
+ "occam-furtle": "^3.0.95",
17
17
  "occam-grammars": "^1.3.510",
18
- "occam-languages": "^0.0.67",
18
+ "occam-languages": "^0.0.69",
19
19
  "occam-lexers": "^23.1.34",
20
20
  "occam-model": "^1.0.494",
21
- "occam-nominal": "^1.0.32",
21
+ "occam-nominal": "^1.0.33",
22
22
  "occam-parsers": "^23.1.37"
23
23
  },
24
24
  "devDependencies": {
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
 
3
- import { Element } from "occam-languages";
4
3
  import { arrayUtilities } from "necessary";
4
+ import { Element, asynchronousUtilities } from "occam-languages";
5
5
 
6
6
  import assignAssignments from "../process/assign";
7
7
 
8
8
  import { define } from "../elements";
9
9
 
10
- const { last } = arrayUtilities;
10
+ const { last } = arrayUtilities,
11
+ { asyncEvery } = asynchronousUtilities;
11
12
 
12
13
  export default define(class Derivation extends Element {
13
14
  constructor(context, string, node, subproofOrProofAssertions) {
@@ -27,12 +28,12 @@ export default define(class Derivation extends Element {
27
28
  return lastProofAssertion;
28
29
  }
29
30
 
30
- verify(context) {
31
+ async verify(context) {
31
32
  let verifies;
32
33
 
33
- verifies = this.subproofOrProofAssertions.every((subproofOrProofAssertion) => { ///
34
+ verifies = await asyncEvery(this.subproofOrProofAssertions, async (subproofOrProofAssertion) => { ///
34
35
  const assignments = [],
35
- subproofOrProofAssertionVerifies = subproofOrProofAssertion.verify(assignments, context);
36
+ subproofOrProofAssertionVerifies = await subproofOrProofAssertion.verify(assignments, context);
36
37
 
37
38
  if (subproofOrProofAssertionVerifies) {
38
39
  const assignmentsAssigned = assignAssignments(assignments, context);
@@ -66,7 +66,7 @@ export default define(class ProcedureCall extends Element {
66
66
  return validates;
67
67
  }
68
68
 
69
- unifyIndependently(context) {
69
+ async unifyIndependently(context) {
70
70
  let unifiesIndependently = false;
71
71
 
72
72
  const procedureCallString = this.getString(); ///
@@ -80,9 +80,17 @@ export default define(class ProcedureCall extends Element {
80
80
 
81
81
  try {
82
82
  const term = procedure.call(terms, context),
83
- boolean = term.isBoolean();
83
+ boolean = await term.isBoolean();
84
84
 
85
- unifiesIndependently = boolean; ///
85
+ if (!boolean) {
86
+ context.info(`The '${procedureCallString}' procedure call did not return a boolean.`);
87
+ } else {
88
+ const primitiveValue = term.getPrimitiveValue();
89
+
90
+ if (primitiveValue) {
91
+ unifiesIndependently = true;
92
+ }
93
+ }
86
94
  } catch (exception) {
87
95
  const message = exception.getMessage();
88
96
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  import { Element } from "occam-languages";
4
4
 
5
- import { scope } from "../utilities/context";
6
5
  import { define } from "../elements";
6
+ import { asyncScope } from "../utilities/context";
7
7
 
8
8
  export default define(class Proof extends Element {
9
9
  constructor(context, string, node, derivation) {
@@ -26,11 +26,11 @@ export default define(class Proof extends Element {
26
26
  return statement;
27
27
  }
28
28
 
29
- verify(conclusion, context) {
29
+ async verify(conclusion, context) {
30
30
  let verifies = false;
31
31
 
32
- scope((context) => {
33
- const derivationVerifies = this.derivation.verify(context);
32
+ asyncScope(async (context) => {
33
+ const derivationVerifies = await this.derivation.verify(context);
34
34
 
35
35
  if (derivationVerifies) {
36
36
  const lastProofAssertion = context.getLastProofAssertion();
@@ -24,10 +24,10 @@ export default define(class Premise extends ProofAssertion {
24
24
  return stated;
25
25
  }
26
26
 
27
- verify(context) {
27
+ async verify(context) {
28
28
  let verifies = false;
29
29
 
30
- this.break(context);
30
+ await this.break(context);
31
31
 
32
32
  const premiseString = this.getString(); ///
33
33
 
@@ -78,7 +78,7 @@ export default define(class Premise extends ProofAssertion {
78
78
  return verifies;
79
79
  }
80
80
 
81
- unifyIndependently(context) {
81
+ async unifyIndependently(context) {
82
82
  let unifiesIndependently = false;
83
83
 
84
84
  const premiseString = this.getString(); ///
@@ -96,7 +96,7 @@ export default define(class Premise extends ProofAssertion {
96
96
  }
97
97
 
98
98
  if (this.procedureCall !== null) {
99
- const procedureCallResolvedIndependently = this.procedureCall.unifyIndependently(context);
99
+ const procedureCallResolvedIndependently = await this.procedureCall.unifyIndependently(context);
100
100
 
101
101
  if (procedureCallResolvedIndependently) {
102
102
  unifiesIndependently = true;
@@ -3,8 +3,7 @@
3
3
  import ProofAssertion from "../proofAssertion";
4
4
 
5
5
  import { define } from "../../elements";
6
- import { unifyStatements } from "../../utilities/unification";
7
- import { attempt, liminally } from "../../utilities/context";
6
+ import { asyncAttempt, asyncLiminally } from "../../utilities/context";
8
7
  import { propertyAssertionFromStatement } from "../../utilities/statement";
9
8
 
10
9
  export default define(class Step extends ProofAssertion {
@@ -55,10 +54,10 @@ export default define(class Step extends ProofAssertion {
55
54
  return comparesToTermAndPropertyRelation;
56
55
  }
57
56
 
58
- verify(assignments, context) {
57
+ async verify(assignments, context) {
59
58
  let verifies = false;
60
59
 
61
- this.break(context);
60
+ await this.break(context);
62
61
 
63
62
  const stepString = this.getString(); ///
64
63
 
@@ -67,7 +66,7 @@ export default define(class Step extends ProofAssertion {
67
66
  const statement = this.getStatement();
68
67
 
69
68
  if (statement !== null) {
70
- attempt((context) => {
69
+ asyncAttempt(async (context) => {
71
70
  const referenceValidates = this.validateReference(context);
72
71
 
73
72
  if (referenceValidates) {
@@ -79,9 +78,9 @@ export default define(class Step extends ProofAssertion {
79
78
  if (statementValidates) {
80
79
  const reference = this.getReference(),
81
80
  satisfiesAssertion = this.getSatisfiesAssertion(),
82
- statementUnifies = liminally((context) => {
83
- const statementUnifies = unifyStatements.some((unifyStatement) => {
84
- const statementUnifies = unifyStatement(statement, reference, satisfiesAssertion, context);
81
+ statementUnifies = await asyncLiminally(async (context) => {
82
+ const statementUnifies = await asyncSome(async (unifyStatement) => {
83
+ const statementUnifies = await unifyStatement(statement, reference, satisfiesAssertion, context);
85
84
 
86
85
  if (statementUnifies) {
87
86
  this.setContext(context);
@@ -27,7 +27,7 @@ export default define(class Supposition extends ProofAssertion {
27
27
  async verify(context) {
28
28
  let verifies = false;
29
29
 
30
- this.break(context);
30
+ await this.break(context);
31
31
 
32
32
  const suppositionString = this.getString(); ///
33
33
 
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
 
3
- import { Element } from "occam-languages";
4
3
  import { arrayUtilities } from "necessary";
4
+ import { Element, asynchronousUtilities } from "occam-languages";
5
5
 
6
- import { scope } from "../utilities/context";
7
6
  import { define } from "../elements";
8
7
  import { labelsFromJSON,
9
8
  premisesFromJSON,
@@ -11,9 +10,9 @@ import { labelsFromJSON,
11
10
  labelsToLabelsJSON,
12
11
  premisesToPremisesJSON,
13
12
  conclusionToConclusionJSON } from "../utilities/json";
14
- import { subproofOrProofAssertionsStringFromSubproofOrProofAssertions } from "../utilities/string";
15
13
 
16
- const { reverse, extract, backwardsEvery } = arrayUtilities;
14
+ const { reverse, extract } = arrayUtilities,
15
+ { asyncBackwardsEvery } = asynchronousUtilities;
17
16
 
18
17
  export default define(class Rule extends Element {
19
18
  constructor(context, string, node, proof, labels, premises, conclusion) {
@@ -126,13 +125,13 @@ export default define(class Rule extends Element {
126
125
  return statementUnifiesWithConclusion;
127
126
  }
128
127
 
129
- unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, context) {
128
+ async unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, context) {
130
129
  let statementAndSubproofOrProofAssertionsUnify = false;
131
130
 
132
131
  const statementUnifiesWithConclusion = this.unifyStatementWithConclusion(statement, context);
133
132
 
134
133
  if (statementUnifiesWithConclusion) {
135
- const subproofOrProofAssertionsUnifiesWithPremises = this.unifySubproofOrProofAssertionsWithPremises(subproofOrProofAssertions, context);
134
+ const subproofOrProofAssertionsUnifiesWithPremises = await this.unifySubproofOrProofAssertionsWithPremises(subproofOrProofAssertions, context);
136
135
 
137
136
  if (subproofOrProofAssertionsUnifiesWithPremises) {
138
137
  const substitutionsResolved = context.areSubstitutionsResolved();
@@ -146,13 +145,13 @@ export default define(class Rule extends Element {
146
145
  return statementAndSubproofOrProofAssertionsUnify;
147
146
  }
148
147
 
149
- unifySubproofOrProofAssertionsWithPremises(subproofOrProofAssertions, context) {
148
+ async unifySubproofOrProofAssertionsWithPremises(subproofOrProofAssertions, context) {
150
149
  let subproofOrProofAssertionsUnifiesWithPremises;
151
150
 
152
151
  subproofOrProofAssertions = reverse(subproofOrProofAssertions); ///
153
152
 
154
- subproofOrProofAssertionsUnifiesWithPremises = backwardsEvery(this.premises, (premise) => {
155
- const stepUnifiesWithPremise = this.unifySubproofOrProofAssertionsWithPremise(subproofOrProofAssertions, premise, context);
153
+ subproofOrProofAssertionsUnifiesWithPremises = asyncBackwardsEvery(this.premises, async (premise) => {
154
+ const stepUnifiesWithPremise = await this.unifySubproofOrProofAssertionsWithPremise(subproofOrProofAssertions, premise, context);
156
155
 
157
156
  if (stepUnifiesWithPremise) {
158
157
  return true;
@@ -162,7 +161,7 @@ export default define(class Rule extends Element {
162
161
  return subproofOrProofAssertionsUnifiesWithPremises;
163
162
  }
164
163
 
165
- unifySubproofOrProofAssertionsWithPremise(subproofOrProofAssertions, premise, context) {
164
+ async unifySubproofOrProofAssertionsWithPremise(subproofOrProofAssertions, premise, context) {
166
165
  let subproofOrProofAssertionsUnifiesWithPremise = false;
167
166
 
168
167
  if (!subproofOrProofAssertionsUnifiesWithPremise) {
@@ -180,7 +179,7 @@ export default define(class Rule extends Element {
180
179
  }
181
180
 
182
181
  if (!subproofOrProofAssertionsUnifiesWithPremise) {
183
- const premiseUnifiesIndependently = premise.unifyIndependently(context);
182
+ const premiseUnifiesIndependently = await premise.unifyIndependently(context);
184
183
 
185
184
  if (premiseUnifiesIndependently) {
186
185
  subproofOrProofAssertionsUnifiesWithPremise = true;
@@ -195,7 +194,7 @@ export default define(class Rule extends Element {
195
194
 
196
195
  const context = this.getContext();
197
196
 
198
- this.break(context);
197
+ await this.break(context);
199
198
 
200
199
  const ruleString = this.getString(); ///
201
200
 
@@ -10,7 +10,7 @@ export default define(class MetaLemma extends TopLevelMetaAssertion {
10
10
 
11
11
  const context = this.getContext();
12
12
 
13
- this.break(context);
13
+ await this.break(context);
14
14
 
15
15
  const metaLemmaString = this.getString(); ///
16
16
 
@@ -10,7 +10,7 @@ export default define(class Metatheorem extends TopLevelMetaAssertion {
10
10
 
11
11
  const context = this.getContext();
12
12
 
13
- this.break(context);
13
+ await this.break(context);
14
14
 
15
15
  const metaLemmaString = this.getString(); ///
16
16
 
@@ -37,6 +37,14 @@ export function literally(innerFunction, context) {
37
37
  return innerFunction(context);
38
38
  }
39
39
 
40
+ export async function asyncScope(innerFunction, context) {
41
+ const scopedContext = ScopedContext.fromNothing(context);
42
+
43
+ context = scopedContext; ///
44
+
45
+ return await innerFunction(context);
46
+ }
47
+
40
48
  export async function asyncAttempt(innerFunction, context) {
41
49
  const ephemeralContext = EphemeralContext.fromNothing(context);
42
50
 
@@ -45,10 +53,18 @@ export async function asyncAttempt(innerFunction, context) {
45
53
  return await innerFunction(context);
46
54
  }
47
55
 
48
- export async function asyncScope(innerFunction, context) {
49
- const scopedContext = ScopedContext.fromNothing(context);
56
+ export async function asyncLiminally(innerFunction, context) {
57
+ const liminalContext = LiminalContext.fromNothing(context);
50
58
 
51
- context = scopedContext; ///
59
+ context = liminalContext; ///
60
+
61
+ return await innerFunction(context);
62
+ }
63
+
64
+ export async function asyncLiterally(innerFunction, context) {
65
+ const literalContext = LiteralContext.fromNothing(context);
66
+
67
+ context = literalContext; ///
52
68
 
53
69
  return await innerFunction(context);
54
70
  }
@@ -12,7 +12,7 @@ import { equalityFromStatement,
12
12
 
13
13
  const { backwardsSome } = arrayUtilities;
14
14
 
15
- function unifyStatementWithRule(statement, reference, satisfiesAssertion, context) {
15
+ async function unifyStatementWithRule(statement, reference, satisfiesAssertion, context) {
16
16
  let statementUnifiesWithRule = false;
17
17
 
18
18
  if (reference !== null) {
@@ -25,7 +25,7 @@ function unifyStatementWithRule(statement, reference, satisfiesAssertion, contex
25
25
  context.trace(`Unifying the '${statementString}' statement with the '${ruleString}' rule...`);
26
26
 
27
27
  const subproofOrProofAssertions = context.getSubproofOrProofAssertions(),
28
- statementAndSubproofOrProofAssertionsUnify = rule.unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, context);
28
+ statementAndSubproofOrProofAssertionsUnify = await rule.unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, context);
29
29
 
30
30
  if (statementAndSubproofOrProofAssertionsUnify) {
31
31
  statementUnifiesWithRule = true;
@@ -40,7 +40,7 @@ function unifyStatementWithRule(statement, reference, satisfiesAssertion, contex
40
40
  return statementUnifiesWithRule;
41
41
  }
42
42
 
43
- function unifyStatementWithReference(statement, reference, satisfiesAssertion, context) {
43
+ async function unifyStatementWithReference(statement, reference, satisfiesAssertion, context) {
44
44
  let statementUnifiesWithReference = false;
45
45
 
46
46
  if (reference !== null) {
@@ -74,7 +74,7 @@ function unifyStatementWithReference(statement, reference, satisfiesAssertion, c
74
74
  return statementUnifiesWithReference;
75
75
  }
76
76
 
77
- function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAssertion, context) {
77
+ async function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAssertion, context) {
78
78
  let statementUnifiesAsSatisfiesAssertion = false;
79
79
 
80
80
  satisfiesAssertion = satisfiesAssertionFromStatement(statement, context);
@@ -138,7 +138,7 @@ function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAsser
138
138
  return statementUnifiesAsSatisfiesAssertion;
139
139
  }
140
140
 
141
- function unifyStatementWithTopLevelAssertion(statement, reference, satisfiesAssertion, context) {
141
+ async function unifyStatementWithTopLevelAssertion(statement, reference, satisfiesAssertion, context) {
142
142
  let statementUnifiesWithTopLevelAssertion = false;
143
143
 
144
144
  if (reference !== null) {
@@ -179,7 +179,7 @@ function unifyStatementWithTopLevelAssertion(statement, reference, satisfiesAsse
179
179
  return statementUnifiesWithTopLevelAssertion;
180
180
  }
181
181
 
182
- function unifyStatementAEquality(statement, reference, satisfiesAssertion, context) {
182
+ async function unifyStatementAEquality(statement, reference, satisfiesAssertion, context) {
183
183
  let statementUnifiesAEquality = false;
184
184
 
185
185
  if (reference === null) {
@@ -205,7 +205,7 @@ function unifyStatementAEquality(statement, reference, satisfiesAssertion, conte
205
205
  return statementUnifiesAEquality;
206
206
  }
207
207
 
208
- function unifyStatementAsJudgement(statement, reference, satisfiesAssertion, context) {
208
+ async function unifyStatementAsJudgement(statement, reference, satisfiesAssertion, context) {
209
209
  let statementUnifiesAsJudgement = false;
210
210
 
211
211
  if (reference === null) {
@@ -227,7 +227,7 @@ function unifyStatementAsJudgement(statement, reference, satisfiesAssertion, con
227
227
  return statementUnifiesAsJudgement;
228
228
  }
229
229
 
230
- function unifyStatementAsTypeAssertion(statement, reference, satisfiesAssertion, context) {
230
+ async function unifyStatementAsTypeAssertion(statement, reference, satisfiesAssertion, context) {
231
231
  let statementUnifiesAsTypeAssertion = false;
232
232
 
233
233
  if (reference === null) {
@@ -247,7 +247,7 @@ function unifyStatementAsTypeAssertion(statement, reference, satisfiesAssertion,
247
247
  return statementUnifiesAsTypeAssertion;
248
248
  }
249
249
 
250
- function unifyStatementAsPropertyAssertion(statement, reference, satisfiesAssertion, context) {
250
+ async function unifyStatementAsPropertyAssertion(statement, reference, satisfiesAssertion, context) {
251
251
  let statementUnifiesAsPropertyAssertion = false;
252
252
 
253
253
  if (reference === null) {
@@ -285,7 +285,7 @@ function unifyStatementAsPropertyAssertion(statement, reference, satisfiesAssert
285
285
  return statementUnifiesAsPropertyAssertion;
286
286
  }
287
287
 
288
- function unifyStatementWithSatisfiesAssertion(statement, reference, satisfiesAssertion, context) {
288
+ async function unifyStatementWithSatisfiesAssertion(statement, reference, satisfiesAssertion, context) {
289
289
  let statementUnifiesWithSatisfiesAssertion = false;
290
290
 
291
291
  if (satisfiesAssertion !== null) {
@@ -309,7 +309,7 @@ function unifyStatementWithSatisfiesAssertion(statement, reference, satisfiesAss
309
309
  return statementUnifiesWithSatisfiesAssertion;
310
310
  }
311
311
 
312
- function compareStatementWithSubproofOrProofAssertions(statement, reference, satisfiesAssertion, context) {
312
+ async function compareStatementWithSubproofOrProofAssertions(statement, reference, satisfiesAssertion, context) {
313
313
  let statementEquatesWithStepOrSubproofs = false;
314
314
 
315
315
  if (reference === null) {