occam-verify-cli 1.0.457 → 1.0.472
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/constants.js +13 -1
- package/lib/context/ephemeral.js +270 -0
- package/lib/context/file.js +102 -66
- package/lib/context/liminal.js +120 -0
- package/lib/context/literal.js +92 -0
- package/lib/context/nominal.js +15 -1
- package/lib/context/release.js +66 -7
- package/lib/context/scoped.js +48 -40
- package/lib/context/synthetic.js +133 -0
- package/lib/element/assertion/contained.js +66 -66
- package/lib/element/assertion/defined.js +32 -32
- package/lib/element/assertion/property.js +39 -39
- package/lib/element/assertion/satisfies.js +22 -22
- package/lib/element/assumption.js +5 -8
- package/lib/element/conclusion.js +14 -13
- package/lib/element/constructor.js +2 -2
- package/lib/element/deduction.js +14 -13
- package/lib/element/derivation.js +3 -3
- package/lib/element/equality.js +5 -5
- package/lib/element/equivalence.js +112 -107
- package/lib/element/equivalences.js +24 -10
- package/lib/element/error.js +3 -3
- package/lib/element/frame.js +38 -21
- package/lib/element/hypothesis.js +2 -2
- package/lib/element/judgement.js +6 -5
- package/lib/element/metaType.js +1 -2
- package/lib/element/metavariable.js +46 -35
- package/lib/element/parameter.js +13 -5
- package/lib/element/procedureCall.js +16 -16
- package/lib/element/proof.js +14 -13
- package/lib/element/proofAssertion/premise.js +41 -30
- package/lib/element/proofAssertion/step.js +39 -35
- package/lib/element/proofAssertion/supposition.js +43 -32
- package/lib/element/proofAssertion.js +19 -5
- package/lib/element/propertyRelation.js +2 -2
- package/lib/element/reference.js +50 -9
- package/lib/element/rule.js +26 -28
- package/lib/element/section.js +2 -2
- package/lib/element/signature.js +9 -6
- package/lib/element/statement.js +44 -31
- package/lib/element/subproof.js +18 -17
- package/lib/element/substitution/frame.js +83 -46
- package/lib/element/substitution/reference.js +101 -19
- package/lib/element/substitution/statement.js +122 -75
- package/lib/element/substitution/term.js +93 -57
- package/lib/element/substitution.js +20 -69
- package/lib/element/substitutions.js +49 -34
- package/lib/element/term.js +30 -21
- package/lib/element/topLevelAssertion/axiom.js +8 -6
- package/lib/element/topLevelAssertion/conjecture.js +4 -4
- package/lib/element/topLevelAssertion/lemma.js +4 -4
- package/lib/element/topLevelAssertion/theorem.js +2 -2
- package/lib/element/topLevelAssertion.js +30 -23
- package/lib/element/topLevelMetaAssertion/metaLemma.js +2 -2
- package/lib/element/topLevelMetaAssertion/metatheorem.js +2 -2
- package/lib/element/topLevelMetaAssertion.js +16 -12
- package/lib/element/variable.js +30 -22
- package/lib/index.js +3 -3
- package/lib/main.js +3 -3
- package/lib/node/frame.js +2 -2
- package/lib/node/metavariable.js +4 -4
- package/lib/node/parameter.js +28 -7
- package/lib/node/substitution/frame.js +9 -31
- package/lib/node/substitution/reference.js +137 -0
- package/lib/node/substitution/statement.js +9 -31
- package/lib/node/substitution/term.js +9 -23
- package/lib/nonTerminalNodeMap.js +3 -2
- package/lib/process/instantiate.js +2 -14
- package/lib/process/unify.js +5 -5
- package/lib/tokenTypes.js +22 -0
- package/lib/utilities/context.js +54 -19
- package/lib/utilities/element.js +161 -336
- package/lib/utilities/instance.js +4 -4
- package/lib/utilities/string.js +18 -4
- package/lib/utilities/unification.js +24 -18
- package/lib/utilities/validation.js +31 -31
- package/package.json +2 -2
- package/src/constants.js +12 -0
- package/src/context/{transient.js → ephemeral.js} +15 -112
- package/src/context/file.js +66 -67
- package/src/context/liminal.js +67 -0
- package/src/context/{fragment.js → literal.js} +17 -4
- package/src/context/nominal.js +12 -0
- package/src/context/release.js +44 -6
- package/src/context/scoped.js +41 -31
- package/src/context/synthetic.js +60 -0
- package/src/element/assertion/contained.js +49 -47
- package/src/element/assertion/defined.js +29 -27
- package/src/element/assertion/property.js +35 -35
- package/src/element/assertion/satisfies.js +19 -18
- package/src/element/assumption.js +4 -10
- package/src/element/conclusion.js +16 -19
- package/src/element/constructor.js +1 -1
- package/src/element/deduction.js +16 -21
- package/src/element/derivation.js +2 -2
- package/src/element/equality.js +4 -4
- package/src/element/equivalence.js +115 -135
- package/src/element/equivalences.js +9 -7
- package/src/element/error.js +4 -2
- package/src/element/frame.js +50 -23
- package/src/element/hypothesis.js +1 -1
- package/src/element/judgement.js +9 -4
- package/src/element/metaType.js +0 -1
- package/src/element/metavariable.js +54 -53
- package/src/element/parameter.js +10 -5
- package/src/element/procedureCall.js +20 -18
- package/src/element/proof.js +14 -16
- package/src/element/proofAssertion/premise.js +46 -42
- package/src/element/proofAssertion/step.js +45 -40
- package/src/element/proofAssertion/supposition.js +56 -45
- package/src/element/proofAssertion.js +23 -5
- package/src/element/propertyRelation.js +1 -1
- package/src/element/reference.js +64 -16
- package/src/element/rule.js +31 -37
- package/src/element/section.js +1 -1
- package/src/element/signature.js +8 -8
- package/src/element/statement.js +51 -40
- package/src/element/subproof.js +16 -18
- package/src/element/substitution/frame.js +99 -42
- package/src/element/substitution/reference.js +120 -20
- package/src/element/substitution/statement.js +160 -89
- package/src/element/substitution/term.js +104 -63
- package/src/element/substitution.js +16 -58
- package/src/element/substitutions.js +43 -41
- package/src/element/term.js +37 -32
- package/src/element/topLevelAssertion/axiom.js +8 -6
- package/src/element/topLevelAssertion/conjecture.js +1 -2
- package/src/element/topLevelAssertion/lemma.js +2 -3
- package/src/element/topLevelAssertion/theorem.js +1 -1
- package/src/element/topLevelAssertion.js +31 -27
- package/src/element/topLevelMetaAssertion/metaLemma.js +1 -2
- package/src/element/topLevelMetaAssertion/metatheorem.js +1 -2
- package/src/element/topLevelMetaAssertion.js +15 -13
- package/src/element/variable.js +30 -31
- package/src/index.js +2 -1
- package/src/main.js +2 -1
- package/src/node/frame.js +1 -1
- package/src/node/metavariable.js +3 -3
- package/src/node/parameter.js +32 -5
- package/src/node/substitution/frame.js +6 -32
- package/src/node/substitution/reference.js +38 -0
- package/src/node/substitution/statement.js +6 -32
- package/src/node/substitution/term.js +6 -22
- package/src/nonTerminalNodeMap.js +3 -0
- package/src/process/instantiate.js +0 -8
- package/src/process/unify.js +4 -4
- package/src/tokenTypes.js +4 -0
- package/src/utilities/context.js +43 -17
- package/src/utilities/element.js +187 -401
- package/src/utilities/instance.js +3 -3
- package/src/utilities/string.js +21 -5
- package/src/utilities/unification.js +26 -23
- package/src/utilities/validation.js +47 -47
- package/lib/context/fragment.js +0 -77
- package/lib/context/transient.js +0 -371
- package/lib/log.js +0 -150
- package/lib/utilities/fragment.js +0 -23
- package/src/log.js +0 -118
- package/src/utilities/fragment.js +0 -11
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import ProofAssertion from "../proofAssertion";
|
|
4
|
-
import TransientContext from "../../context/transient";
|
|
5
4
|
import assignAssignments from "../../process/assign";
|
|
6
5
|
|
|
7
6
|
import { define } from "../../elements";
|
|
7
|
+
import { attempt, synthetically } from "../../utilities/context";
|
|
8
8
|
import { termsFromJSON,
|
|
9
9
|
framesFromJSON,
|
|
10
10
|
termsToTermsJSON,
|
|
@@ -25,55 +25,59 @@ export default define(class Premise extends ProofAssertion {
|
|
|
25
25
|
return this.procedureCall;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
isStated() {
|
|
29
|
+
const stated = true; ///
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
return stated;
|
|
32
|
+
}
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
verify(context) {
|
|
35
|
+
let verifies = false;
|
|
34
36
|
|
|
35
37
|
const node = this.getNode(),
|
|
36
38
|
premiseString = this.getString(); ///
|
|
37
39
|
|
|
38
40
|
context.trace(`Verifying the '${premiseString}' premise...`, node);
|
|
39
41
|
|
|
40
|
-
const statement = this.getStatement()
|
|
42
|
+
const statement = this.getStatement(),
|
|
43
|
+
procedureCall = this.getProcedureCall();
|
|
41
44
|
|
|
42
|
-
if ((statement
|
|
43
|
-
context
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
assignments = [],
|
|
48
|
-
statementValidates = statement.validate(assignments, stated, context);
|
|
45
|
+
if ((statement !== null) || (procedureCall !== null)) {
|
|
46
|
+
attempt((context) => {
|
|
47
|
+
if (statement !== null) {
|
|
48
|
+
const assignments = [],
|
|
49
|
+
statementValidates = this.validateStatement(assignments, context);
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
if (statementValidates) {
|
|
52
|
+
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
if (assignmentsAssigned) {
|
|
55
|
+
const subproofOrProofAssertion = this; ///
|
|
55
56
|
|
|
56
|
-
|
|
57
|
+
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
57
58
|
|
|
58
|
-
|
|
59
|
+
this.setContext(context);
|
|
60
|
+
|
|
61
|
+
verifies = true;
|
|
62
|
+
}
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
|
-
}
|
|
62
65
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
if (procedureCall !== null) {
|
|
67
|
+
const procedureCallValidates = procedureCall.validate(context);
|
|
68
|
+
|
|
69
|
+
if (procedureCallValidates) {
|
|
70
|
+
this.setContext(context);
|
|
67
71
|
|
|
68
|
-
|
|
69
|
-
|
|
72
|
+
verifies = true;
|
|
73
|
+
}
|
|
70
74
|
}
|
|
71
|
-
}
|
|
75
|
+
}, context);
|
|
76
|
+
} else {
|
|
77
|
+
context.debug(`Unable to verify the '${premiseString}' premise because it is nonsense.`, node);
|
|
72
78
|
}
|
|
73
79
|
|
|
74
80
|
if (verifies) {
|
|
75
|
-
this.setContext(context);
|
|
76
|
-
|
|
77
81
|
context.debug(`...verified the '${premiseString}' premise.`, node);
|
|
78
82
|
}
|
|
79
83
|
|
|
@@ -131,7 +135,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
131
135
|
null :
|
|
132
136
|
subproofOrProofAssertion;
|
|
133
137
|
|
|
134
|
-
substitutions.snapshot();
|
|
138
|
+
substitutions.snapshot(context);
|
|
135
139
|
|
|
136
140
|
if (subproof !== null) {
|
|
137
141
|
const subproofUnifies = this.unifySubproof(subproof, substitutions, context);
|
|
@@ -154,7 +158,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
154
158
|
}
|
|
155
159
|
|
|
156
160
|
subproofOrProofAssertionUnifies ?
|
|
157
|
-
substitutions.continue() :
|
|
161
|
+
substitutions.continue(context) :
|
|
158
162
|
substitutions.rollback(context);
|
|
159
163
|
|
|
160
164
|
return subproofOrProofAssertionUnifies;
|
|
@@ -163,23 +167,26 @@ export default define(class Premise extends ProofAssertion {
|
|
|
163
167
|
unifyProofAssertion(proofAssertion, substitutions, context) {
|
|
164
168
|
let proofAssertionUnifies = false;
|
|
165
169
|
|
|
166
|
-
const premiseString = this.getString(),
|
|
170
|
+
const premiseString = this.getString(), ///
|
|
167
171
|
proofAssertionString = proofAssertion.getString();
|
|
168
172
|
|
|
169
173
|
context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${premiseString}' premise...`);
|
|
170
174
|
|
|
175
|
+
const specificContext = context; ///
|
|
176
|
+
|
|
171
177
|
context = this.getContext();
|
|
172
178
|
|
|
173
179
|
const generalContext = context; ///
|
|
174
180
|
|
|
175
|
-
context = proofAssertion.getContext();
|
|
176
|
-
|
|
177
|
-
const specificContext = context; ///
|
|
178
|
-
|
|
179
181
|
context = specificContext; ///
|
|
180
182
|
|
|
181
|
-
const
|
|
182
|
-
statementUnifies =
|
|
183
|
+
const proofAssertionContext = proofAssertion.getContext(),
|
|
184
|
+
statementUnifies = synthetically((specificContext) => {
|
|
185
|
+
const statement = proofAssertion.getStatement(),
|
|
186
|
+
statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
187
|
+
|
|
188
|
+
return statementUnifies;
|
|
189
|
+
}, specificContext, proofAssertionContext);
|
|
183
190
|
|
|
184
191
|
if (statementUnifies) {
|
|
185
192
|
proofAssertionUnifies = true;
|
|
@@ -270,8 +277,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
270
277
|
const terms = termsFromJSON(json, context),
|
|
271
278
|
frames = framesFromJSON(json, context),
|
|
272
279
|
statement = statementFromJSON(json, context),
|
|
273
|
-
procedureCall = procedureCallFromJSON(json, context)
|
|
274
|
-
transientContext = TransientContext.fromTermsAndFrames(terms, frames, context);
|
|
280
|
+
procedureCall = procedureCallFromJSON(json, context);
|
|
275
281
|
|
|
276
282
|
let string;
|
|
277
283
|
|
|
@@ -285,8 +291,6 @@ export default define(class Premise extends ProofAssertion {
|
|
|
285
291
|
|
|
286
292
|
const node = null;
|
|
287
293
|
|
|
288
|
-
context = transientContext; ///
|
|
289
|
-
|
|
290
294
|
const premise = new Premise(context, string, node, statement, procedureCall);
|
|
291
295
|
|
|
292
296
|
return premise;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import elements from "../../elements";
|
|
4
4
|
import ProofAssertion from "../proofAssertion";
|
|
5
|
-
import TransientContext from "../../context/transient";
|
|
6
5
|
|
|
7
6
|
import { define } from "../../elements";
|
|
8
7
|
import { unifyStatements } from "../../utilities/unification";
|
|
8
|
+
import { attempt, liminally } from "../../utilities/context";
|
|
9
9
|
import { propertyAssertionFromStatement } from "../../utilities/statement";
|
|
10
10
|
|
|
11
11
|
export default define(class Step extends ProofAssertion {
|
|
@@ -56,13 +56,9 @@ export default define(class Step extends ProofAssertion {
|
|
|
56
56
|
return comparesToTermAndPropertyRelation;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
verify(
|
|
59
|
+
verify(assignments, context) {
|
|
60
60
|
let verifies = false;
|
|
61
61
|
|
|
62
|
-
const transientContext = TransientContext.fromNothing(context);
|
|
63
|
-
|
|
64
|
-
context = transientContext; ///
|
|
65
|
-
|
|
66
62
|
const node = this.getNode(),
|
|
67
63
|
stepString = this.getString(); ///
|
|
68
64
|
|
|
@@ -70,38 +66,47 @@ export default define(class Step extends ProofAssertion {
|
|
|
70
66
|
|
|
71
67
|
const statement = this.getStatement();
|
|
72
68
|
|
|
73
|
-
if (statement
|
|
74
|
-
context
|
|
75
|
-
|
|
76
|
-
const referenceValidates = this.validateReference(context);
|
|
69
|
+
if (statement !== null) {
|
|
70
|
+
attempt((context) => {
|
|
71
|
+
const referenceValidates = this.validateReference(context);
|
|
77
72
|
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
if (referenceValidates) {
|
|
74
|
+
const satisfiesAssertioValidates = this.validateSatisfiesAssertion(context);
|
|
75
|
+
|
|
76
|
+
if (satisfiesAssertioValidates) {
|
|
77
|
+
const statementValidates = this.validateStatement(assignments, context);
|
|
78
|
+
|
|
79
|
+
if (statementValidates) {
|
|
80
|
+
const reference = this.getReference(),
|
|
81
|
+
satisfiesAssertion = this.getSatisfiesAssertion(),
|
|
82
|
+
statementUnifies = liminally((context) => {
|
|
83
|
+
const statementUnifies = unifyStatements.some((unifyStatement) => {
|
|
84
|
+
const statementUnifies = unifyStatement(statement, reference, satisfiesAssertion, context);
|
|
80
85
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
statementValidates = statement.validate(assignments, stated, context);
|
|
86
|
+
if (statementUnifies) {
|
|
87
|
+
this.setContext(context);
|
|
84
88
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
return statementUnifies;
|
|
94
|
+
}, context);
|
|
88
95
|
|
|
89
96
|
if (statementUnifies) {
|
|
90
|
-
|
|
97
|
+
verifies = true;
|
|
91
98
|
}
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
if (statementUnifies) {
|
|
95
|
-
verifies = true;
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
|
-
|
|
102
|
+
|
|
103
|
+
return verifies;
|
|
104
|
+
}, context);
|
|
105
|
+
} else {
|
|
106
|
+
context.debug(`Unable to verify the '${stepString}' step because it is nonsense.`, node);
|
|
100
107
|
}
|
|
101
108
|
|
|
102
109
|
if (verifies) {
|
|
103
|
-
this.setContext(context);
|
|
104
|
-
|
|
105
110
|
context.debug(`...verified the '${stepString}' step.`, node);
|
|
106
111
|
}
|
|
107
112
|
|
|
@@ -112,41 +117,41 @@ export default define(class Step extends ProofAssertion {
|
|
|
112
117
|
let referenceValidates = true;
|
|
113
118
|
|
|
114
119
|
if (this.reference !== null) {
|
|
115
|
-
const
|
|
116
|
-
|
|
120
|
+
const stepString = this.getString(), ///
|
|
121
|
+
referenceString = this.reference.getString();
|
|
117
122
|
|
|
118
|
-
context.trace(`Validating the '${stepString}' step's reference...
|
|
123
|
+
context.trace(`Validating the '${stepString}' step's '${referenceString}' reference... `);
|
|
119
124
|
|
|
120
125
|
referenceValidates = this.reference.validate(context);
|
|
121
126
|
|
|
122
127
|
if (referenceValidates) {
|
|
123
|
-
context.debug(`...
|
|
128
|
+
context.debug(`...validated the '${stepString}' step's '${referenceString}' reference. `);
|
|
124
129
|
}
|
|
125
130
|
}
|
|
126
131
|
|
|
127
132
|
return referenceValidates;
|
|
128
133
|
}
|
|
129
134
|
|
|
130
|
-
|
|
131
|
-
let
|
|
135
|
+
validateSatisfiesAssertion(context) {
|
|
136
|
+
let satisfiesAssertionValidates = true; ///
|
|
132
137
|
|
|
133
138
|
if (this.satisfiesAssertion !== null) {
|
|
134
|
-
const
|
|
135
|
-
|
|
139
|
+
const stepString = this.getString(), ///
|
|
140
|
+
satisfiesAssertion = this.satisfiesAssertion.getString();
|
|
136
141
|
|
|
137
|
-
context.trace(`
|
|
142
|
+
context.trace(`Validating the '${stepString}' step's '${satisfiesAssertion}' satisfies assertion... `);
|
|
138
143
|
|
|
139
144
|
const stated = true,
|
|
140
145
|
assignments = null;
|
|
141
146
|
|
|
142
|
-
|
|
147
|
+
satisfiesAssertionValidates = this.satisfiesAssertion.validate(assignments, stated, context);
|
|
143
148
|
|
|
144
|
-
if (
|
|
145
|
-
context.debug(`...
|
|
149
|
+
if (satisfiesAssertionValidates) {
|
|
150
|
+
context.debug(`...validating the '${stepString}' step's '${satisfiesAssertion}' satisfies assertion. `);
|
|
146
151
|
}
|
|
147
152
|
}
|
|
148
153
|
|
|
149
|
-
return
|
|
154
|
+
return satisfiesAssertionValidates;
|
|
150
155
|
}
|
|
151
156
|
|
|
152
157
|
unifyWithSatisfiesAssertion(satisfiesAssertion, context) {
|
|
@@ -163,7 +168,7 @@ export default define(class Step extends ProofAssertion {
|
|
|
163
168
|
if (axiom !== null) {
|
|
164
169
|
const { Substitutions } = elements,
|
|
165
170
|
step = this, ///
|
|
166
|
-
substitutions = Substitutions.fromNothing(),
|
|
171
|
+
substitutions = Substitutions.fromNothing(context),
|
|
167
172
|
stepUnifies = axiom.unifyStep(step, substitutions, context);
|
|
168
173
|
|
|
169
174
|
if (stepUnifies) {
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import ProofAssertion from "../proofAssertion";
|
|
4
|
-
import TransientContext from "../../context/transient";
|
|
5
4
|
import assignAssignments from "../../process/assign";
|
|
6
5
|
|
|
7
6
|
import { define } from "../../elements";
|
|
8
|
-
import {
|
|
7
|
+
import { attempt, synthetically } from "../../utilities/context";
|
|
8
|
+
import { termsFromJSON,
|
|
9
|
+
framesFromJSON,
|
|
10
|
+
termsToTermsJSON,
|
|
11
|
+
statementFromJSON,
|
|
12
|
+
framesToFramesJSON,
|
|
13
|
+
procedureCallFromJSON,
|
|
14
|
+
statementToStatementJSON,
|
|
15
|
+
procedureCallToProcedureCallJSON } from "../../utilities/json";
|
|
9
16
|
|
|
10
17
|
export default define(class Supposition extends ProofAssertion {
|
|
11
18
|
constructor(context, string, node, statement, procedureCall) {
|
|
@@ -18,55 +25,59 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
18
25
|
return this.procedureCall;
|
|
19
26
|
}
|
|
20
27
|
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
isStated() {
|
|
29
|
+
const stated = true; ///
|
|
23
30
|
|
|
24
|
-
|
|
31
|
+
return stated;
|
|
32
|
+
}
|
|
25
33
|
|
|
26
|
-
|
|
34
|
+
verify(context) {
|
|
35
|
+
let verifies = false;
|
|
27
36
|
|
|
28
37
|
const node = this.getNode(),
|
|
29
38
|
suppositionString = this.getString(); ///
|
|
30
39
|
|
|
31
40
|
context.trace(`Verifying the '${suppositionString}' supposition...`, node);
|
|
32
41
|
|
|
33
|
-
const statement = this.getStatement()
|
|
42
|
+
const statement = this.getStatement(),
|
|
43
|
+
procedureCall = this.getProcedureCall();
|
|
34
44
|
|
|
35
|
-
if ((statement
|
|
36
|
-
context
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
assignments = [],
|
|
41
|
-
statementValidates = statement.validate(assignments, stated, context);
|
|
45
|
+
if ((statement !== null) || (procedureCall !== null)) {
|
|
46
|
+
attempt((context) => {
|
|
47
|
+
if (statement !== null) {
|
|
48
|
+
const assignments = [],
|
|
49
|
+
statementValidates = this.validateStatement(assignments, context);
|
|
42
50
|
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
if (statementValidates) {
|
|
52
|
+
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
45
53
|
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
if (assignmentsAssigned) {
|
|
55
|
+
const subproofOrProofAssertion = this; ///
|
|
48
56
|
|
|
49
|
-
|
|
57
|
+
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
50
58
|
|
|
51
|
-
|
|
59
|
+
this.setContext(context);
|
|
60
|
+
|
|
61
|
+
verifies = true;
|
|
62
|
+
}
|
|
52
63
|
}
|
|
53
64
|
}
|
|
54
|
-
}
|
|
55
65
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
assignments = null,
|
|
59
|
-
procedureCallVerifies = this.procedureCall.verify(assignments, stated, context);
|
|
66
|
+
if (procedureCall !== null) {
|
|
67
|
+
const procedureCallValidates = procedureCall.validate(context);
|
|
60
68
|
|
|
61
|
-
|
|
62
|
-
|
|
69
|
+
if (procedureCallValidates) {
|
|
70
|
+
this.setContext(context);
|
|
71
|
+
|
|
72
|
+
verifies = true;
|
|
73
|
+
}
|
|
63
74
|
}
|
|
64
|
-
}
|
|
75
|
+
}, context);
|
|
76
|
+
} else {
|
|
77
|
+
context.debug(`Unable to verify the '${suppositionString}' supposition because it is nonsense.`, node);
|
|
65
78
|
}
|
|
66
79
|
|
|
67
80
|
if (verifies) {
|
|
68
|
-
this.setContext(context);
|
|
69
|
-
|
|
70
81
|
context.debug(`...verified the '${suppositionString}' supposition.`, node);
|
|
71
82
|
}
|
|
72
83
|
|
|
@@ -76,7 +87,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
76
87
|
unifyIndependently(substitutions, context) {
|
|
77
88
|
let unifiesIndependently = false;
|
|
78
89
|
|
|
79
|
-
const suppositionString = this.getString();
|
|
90
|
+
const suppositionString = this.getString(); ///
|
|
80
91
|
|
|
81
92
|
context.trace(`Unifying the '${suppositionString}' supposition independently...`);
|
|
82
93
|
|
|
@@ -124,7 +135,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
124
135
|
subproofOrProofAssertion :
|
|
125
136
|
null;
|
|
126
137
|
|
|
127
|
-
substitutions.snapshot();
|
|
138
|
+
substitutions.snapshot(context);
|
|
128
139
|
|
|
129
140
|
if (subproof !== null) {
|
|
130
141
|
const subproofUnifies = this.unifySubproof(subproof, substitutions, context);
|
|
@@ -147,7 +158,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
147
158
|
}
|
|
148
159
|
|
|
149
160
|
subproofOrProofAssertionUnifies ?
|
|
150
|
-
substitutions.continue() :
|
|
161
|
+
substitutions.continue(context) :
|
|
151
162
|
substitutions.rollback(context);
|
|
152
163
|
|
|
153
164
|
return subproofOrProofAssertionUnifies;
|
|
@@ -156,23 +167,26 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
156
167
|
unifyProofAssertion(proofAssertion, substitutions, context) {
|
|
157
168
|
let proofAssertionUnifies = false;
|
|
158
169
|
|
|
159
|
-
const suppositionString = this.getString(),
|
|
170
|
+
const suppositionString = this.getString(), ///
|
|
160
171
|
proofAssertionString = proofAssertion.getString();
|
|
161
172
|
|
|
162
173
|
context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition...`);
|
|
163
174
|
|
|
175
|
+
const specificContext = context; ///
|
|
176
|
+
|
|
164
177
|
context = this.getContext();
|
|
165
178
|
|
|
166
179
|
const generalContext = context; ///
|
|
167
180
|
|
|
168
|
-
context = proofAssertion.getContext();
|
|
169
|
-
|
|
170
|
-
const specificContext = context; ///
|
|
171
|
-
|
|
172
181
|
context = specificContext; ///
|
|
173
182
|
|
|
174
|
-
const
|
|
175
|
-
statementUnifies =
|
|
183
|
+
const proofAssertionContext = proofAssertion.getContext(),
|
|
184
|
+
statementUnifies = synthetically((specificContext) => {
|
|
185
|
+
const statement = proofAssertion.getStatement(),
|
|
186
|
+
statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
187
|
+
|
|
188
|
+
return statementUnifies;
|
|
189
|
+
}, specificContext, proofAssertionContext);
|
|
176
190
|
|
|
177
191
|
if (statementUnifies) {
|
|
178
192
|
proofAssertionUnifies = true;
|
|
@@ -190,7 +204,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
190
204
|
|
|
191
205
|
const node = this.getNode(),
|
|
192
206
|
subproofString = subproof.getString(),
|
|
193
|
-
suppositionString = this.getString();
|
|
207
|
+
suppositionString = this.getString(); ///
|
|
194
208
|
|
|
195
209
|
context.trace(`Unifying the '${subproofString}' subproof with the '${suppositionString}' supposition...`, node);
|
|
196
210
|
|
|
@@ -286,8 +300,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
286
300
|
const terms = termsFromJSON(json, context),
|
|
287
301
|
frames = framesFromJSON(json, context),
|
|
288
302
|
statement = statementFromJSON(json, context),
|
|
289
|
-
procedureCall = procedureCallFromJSON(json, context)
|
|
290
|
-
transientContext = TransientContext.fromTermsAndFrames(terms, frames, context);
|
|
303
|
+
procedureCall = procedureCallFromJSON(json, context);
|
|
291
304
|
|
|
292
305
|
let string;
|
|
293
306
|
|
|
@@ -301,8 +314,6 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
301
314
|
|
|
302
315
|
const node = null;
|
|
303
316
|
|
|
304
|
-
context = transientContext; ///
|
|
305
|
-
|
|
306
317
|
const supposition = new Supposition(context, string, node, statement, procedureCall);
|
|
307
318
|
|
|
308
319
|
return supposition;
|
|
@@ -25,7 +25,7 @@ export default class ProofAssertion extends Element {
|
|
|
25
25
|
let comparesToStatement = false;
|
|
26
26
|
|
|
27
27
|
const statementString = statement.getString(),
|
|
28
|
-
proofAssertionString = this.getString();
|
|
28
|
+
proofAssertionString = this.getString(); ///
|
|
29
29
|
|
|
30
30
|
context.trace(`Comparing the '${statementString}' statement to the '${proofAssertionString}' proof assertion...`);
|
|
31
31
|
|
|
@@ -46,21 +46,39 @@ export default class ProofAssertion extends Element {
|
|
|
46
46
|
return comparesToStatement;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
validateStatement(assignments, context) {
|
|
50
|
+
let statementValidates;
|
|
51
|
+
|
|
52
|
+
const statementString = this.statement.getString(),
|
|
53
|
+
proofAssertionString = this.getString(); ///
|
|
54
|
+
|
|
55
|
+
context.trace(`Validating the '${proofAssertionString}' proof assertion's '${statementString}' statement... `);
|
|
56
|
+
|
|
57
|
+
const stated = this.isStated();
|
|
58
|
+
|
|
59
|
+
statementValidates = this.statement.validate(assignments, stated, context);
|
|
60
|
+
|
|
61
|
+
if (statementValidates) {
|
|
62
|
+
context.debug(`...validated the '${proofAssertionString}' proof assertion's '${statementString}' reference. `);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return statementValidates;
|
|
66
|
+
}
|
|
67
|
+
|
|
49
68
|
unifyStatement(statement, substitutions, generalContext, specificContext) {
|
|
50
69
|
let statementUnifies = false;
|
|
51
70
|
|
|
52
71
|
if (this.statement !== null) {
|
|
53
|
-
const
|
|
54
|
-
context = specificContext, ///
|
|
72
|
+
const context = specificContext, ///
|
|
55
73
|
statementString = statement.getString(),
|
|
56
74
|
proorAssertionString = this.getString(); ///
|
|
57
75
|
|
|
58
|
-
context.trace(`Unifying the '${statementString}' statement with the '${proorAssertionString}' proof assertion
|
|
76
|
+
context.trace(`Unifying the '${statementString}' statement with the '${proorAssertionString}' proof assertion...`);
|
|
59
77
|
|
|
60
78
|
statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
61
79
|
|
|
62
80
|
if (statementUnifies) {
|
|
63
|
-
context.debug(`...unified the '${statementString}' statement with the '${proorAssertionString}' proof assertion
|
|
81
|
+
context.debug(`...unified the '${statementString}' statement with the '${proorAssertionString}' proof assertion.`);
|
|
64
82
|
}
|
|
65
83
|
}
|
|
66
84
|
|
|
@@ -23,7 +23,7 @@ export default define(class PropertyRelation extends Element {
|
|
|
23
23
|
verify(context) {
|
|
24
24
|
let verifies = false;
|
|
25
25
|
|
|
26
|
-
const propertyRelationString = this.
|
|
26
|
+
const propertyRelationString = this.getString(); ///
|
|
27
27
|
|
|
28
28
|
context.trace(`Verifying the '${propertyRelationString}' property relation...`);
|
|
29
29
|
|