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.
- package/lib/context/ephemeral.js +74 -2
- package/lib/context/file/nominal.js +11 -9
- package/lib/context/liminal.js +161 -24
- package/lib/context/literal.js +8 -2
- package/lib/context/scoped.js +4 -28
- package/lib/context/synthetic.js +146 -0
- package/lib/context.js +170 -1
- package/lib/element/assertion/contained.js +21 -15
- package/lib/element/assertion/defined.js +45 -65
- package/lib/element/assertion/property.js +25 -19
- package/lib/element/assertion/satisfies.js +14 -8
- package/lib/element/assertion/subproof.js +12 -6
- package/lib/element/assertion.js +47 -1
- package/lib/element/assumption.js +12 -12
- package/lib/element/conclusion.js +2 -2
- package/lib/element/deduction.js +2 -2
- package/lib/element/frame.js +61 -29
- package/lib/element/judgement.js +7 -1
- package/lib/element/label.js +8 -8
- package/lib/element/metavariable.js +71 -59
- package/lib/element/procedureCall.js +24 -8
- package/lib/element/proof.js +43 -35
- package/lib/element/proofAssertion/premise.js +122 -97
- package/lib/element/proofAssertion/step.js +161 -115
- package/lib/element/proofAssertion/supposition.js +157 -118
- package/lib/element/proofAssertion.js +3 -3
- package/lib/element/reference.js +40 -7
- package/lib/element/rule.js +227 -95
- package/lib/element/signature.js +2 -1
- package/lib/element/statement.js +67 -34
- package/lib/element/substitution/frame.js +36 -16
- package/lib/element/substitution/reference.js +36 -16
- package/lib/element/substitution/statement.js +94 -55
- package/lib/element/substitution/term.js +36 -16
- package/lib/element/substitution.js +54 -17
- package/lib/element/substitutions.js +4 -276
- package/lib/element/term.js +60 -31
- package/lib/element/topLevelAssertion/axiom.js +13 -4
- package/lib/element/topLevelAssertion/conjecture.js +7 -2
- package/lib/element/topLevelAssertion/theorem.js +7 -2
- package/lib/element/topLevelAssertion.js +201 -134
- package/lib/element/topLevelMetaAssertion.js +310 -51
- package/lib/element/variable.js +15 -6
- package/lib/node/substitution/statement.js +33 -1
- package/lib/process/unify.js +6 -6
- package/lib/utilities/context.js +10 -25
- package/lib/utilities/element.js +34 -9
- package/lib/utilities/statement.js +1 -8
- package/lib/utilities/string.js +12 -1
- package/lib/utilities/substitutions.js +42 -16
- package/lib/utilities/unification.js +3 -1
- package/lib/utilities/validation.js +2 -2
- package/package.json +4 -4
- package/src/context/ephemeral.js +73 -1
- package/src/context/file/nominal.js +14 -11
- package/src/context/liminal.js +180 -25
- package/src/context/literal.js +3 -1
- package/src/context/scoped.js +3 -35
- package/src/context/synthetic.js +49 -0
- package/src/context.js +163 -1
- package/src/element/assertion/contained.js +28 -20
- package/src/element/assertion/defined.js +62 -34
- package/src/element/assertion/property.js +27 -19
- package/src/element/assertion/satisfies.js +15 -7
- package/src/element/assertion/subproof.js +13 -5
- package/src/element/assertion.js +35 -0
- package/src/element/assumption.js +5 -5
- package/src/element/conclusion.js +2 -4
- package/src/element/deduction.js +2 -4
- package/src/element/frame.js +71 -39
- package/src/element/judgement.js +2 -0
- package/src/element/label.js +4 -4
- package/src/element/metavariable.js +94 -75
- package/src/element/procedureCall.js +6 -6
- package/src/element/proof.js +6 -6
- package/src/element/proofAssertion/premise.js +101 -69
- package/src/element/proofAssertion/step.js +78 -39
- package/src/element/proofAssertion/supposition.js +141 -115
- package/src/element/proofAssertion.js +3 -2
- package/src/element/reference.js +52 -10
- package/src/element/rule.js +138 -76
- package/src/element/signature.js +2 -0
- package/src/element/statement.js +76 -45
- package/src/element/substitution/frame.js +44 -15
- package/src/element/substitution/reference.js +44 -15
- package/src/element/substitution/statement.js +124 -72
- package/src/element/substitution/term.js +43 -15
- package/src/element/substitution.js +55 -18
- package/src/element/substitutions.js +1 -258
- package/src/element/term.js +65 -34
- package/src/element/topLevelAssertion/axiom.js +1 -1
- package/src/element/topLevelAssertion/conjecture.js +1 -1
- package/src/element/topLevelAssertion/theorem.js +1 -1
- package/src/element/topLevelAssertion.js +128 -48
- package/src/element/topLevelMetaAssertion.js +86 -32
- package/src/element/variable.js +15 -5
- package/src/node/substitution/statement.js +33 -0
- package/src/process/unify.js +6 -8
- package/src/utilities/context.js +9 -8
- package/src/utilities/element.js +37 -10
- package/src/utilities/statement.js +0 -7
- package/src/utilities/string.js +14 -0
- package/src/utilities/substitutions.js +59 -17
- package/src/utilities/unification.js +4 -0
- 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
|
-
|
|
28
|
-
let
|
|
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(`
|
|
31
|
+
context.trace(`Validatting the '${premiseString}' premise...`);
|
|
35
32
|
|
|
36
33
|
const statement = this.getStatement(),
|
|
37
34
|
procedureCall = this.getProcedureCall();
|
|
38
35
|
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}, context);
|
|
47
|
+
if (procedureCallValidates) {
|
|
48
|
+
validates = true;
|
|
49
|
+
}
|
|
70
50
|
} else {
|
|
71
|
-
context.debug(`Unable to
|
|
51
|
+
context.debug(`Unable to validate the '${premiseString}' premise because it is nonsense.`);
|
|
72
52
|
}
|
|
73
53
|
|
|
74
|
-
if (
|
|
75
|
-
context.debug(`...
|
|
54
|
+
if (validates) {
|
|
55
|
+
context.debug(`...validated the '${premiseString}' premise.`);
|
|
76
56
|
}
|
|
77
57
|
|
|
78
|
-
return
|
|
58
|
+
return validates;
|
|
79
59
|
}
|
|
80
60
|
|
|
81
|
-
|
|
82
|
-
let
|
|
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
|
-
|
|
91
|
-
|
|
64
|
+
const premiseString = this.getString(), ///
|
|
65
|
+
procedureCallString = this.procedureCall.getString();
|
|
92
66
|
|
|
93
|
-
|
|
94
|
-
unifiesIndependently = true;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
67
|
+
context.trace(`Validatting the '${premiseString}' premise's '${procedureCallString}' procedure call...`);
|
|
97
68
|
|
|
98
|
-
|
|
99
|
-
const procedureCallResolvedIndependently = await this.procedureCall.unifyIndependently(context);
|
|
69
|
+
procedureCallValidates = this.procedureCall.validate(context);
|
|
100
70
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
71
|
+
if (procedureCallValidates) {
|
|
72
|
+
context.debug(`...validated the '${premiseString}' premise's '${procedureCallString}' procedure call.`);
|
|
104
73
|
}
|
|
105
74
|
|
|
106
|
-
|
|
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
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
|
|
63
|
-
let
|
|
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(`
|
|
67
|
+
context.trace(`Validating the '${stepString}' step...`);
|
|
70
68
|
|
|
71
69
|
const statement = this.getStatement();
|
|
72
70
|
|
|
73
71
|
if (statement !== null) {
|
|
74
|
-
|
|
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
|
-
|
|
84
|
-
|
|
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
|
-
|
|
98
|
-
|
|
77
|
+
if (satisfiesAssertioValidates) {
|
|
78
|
+
const statementValidates = this.validateStatement(assignments, context);
|
|
99
79
|
|
|
100
|
-
|
|
101
|
-
|
|
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
|
|
86
|
+
context.debug(`Unable to validate the '${stepString}' step because it is nonsense.`);
|
|
111
87
|
}
|
|
112
88
|
|
|
113
|
-
if (
|
|
114
|
-
context.debug(`...
|
|
89
|
+
if (validates) {
|
|
90
|
+
context.debug(`...validate the '${stepString}' step.`);
|
|
115
91
|
}
|
|
116
92
|
|
|
117
|
-
return
|
|
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
|
});
|