occam-verify-cli 1.0.448 → 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 -5
- package/lib/context/ephemeral.js +270 -0
- package/lib/context/file.js +136 -128
- 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 +68 -9
- package/lib/context/scoped.js +322 -0
- 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 +71 -87
- package/lib/element/combinator/bracketed.js +1 -10
- package/lib/element/conclusion.js +19 -15
- package/lib/element/constructor/bracketed.js +1 -10
- package/lib/element/constructor.js +2 -2
- package/lib/element/declaration/combinator.js +1 -2
- package/lib/element/declaration/metavariable.js +3 -3
- package/lib/element/declaration/variable.js +3 -3
- package/lib/element/deduction.js +26 -20
- 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 +73 -62
- package/lib/element/hypothesis.js +2 -2
- package/lib/element/judgement.js +40 -60
- package/lib/element/metaType.js +4 -4
- package/lib/element/metavariable.js +49 -38
- 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 +319 -0
- package/lib/element/proofAssertion/step.js +309 -0
- package/lib/element/proofAssertion/supposition.js +333 -0
- package/lib/element/proofAssertion.js +20 -10
- package/lib/element/propertyRelation.js +2 -2
- package/lib/element/reference.js +72 -30
- package/lib/element/rule.js +26 -28
- package/lib/element/section.js +5 -5
- package/lib/element/signature.js +9 -6
- package/lib/element/statement.js +44 -36
- package/lib/element/subproof.js +18 -17
- package/lib/element/substitution/frame.js +86 -49
- package/lib/element/substitution/reference.js +101 -19
- package/lib/element/substitution/statement.js +128 -105
- 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 +41 -30
- package/lib/element/topLevelAssertion/axiom.js +331 -0
- package/lib/element/{conjecture.js → topLevelAssertion/conjecture.js} +10 -10
- package/lib/element/{lemma.js → topLevelAssertion/lemma.js} +9 -9
- package/lib/element/{theorem.js → topLevelAssertion/theorem.js} +8 -8
- package/lib/element/topLevelAssertion.js +434 -0
- package/lib/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +8 -8
- package/lib/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +8 -8
- package/lib/element/topLevelMetaAssertion.js +293 -0
- package/lib/element/type.js +4 -4
- package/lib/element/variable.js +48 -40
- package/lib/index.js +3 -3
- package/lib/main.js +3 -3
- package/lib/metaTypes.js +18 -15
- package/lib/node/frame.js +2 -2
- package/lib/node/metavariable.js +4 -4
- package/lib/node/parameter.js +28 -7
- package/lib/node/proofAssertion/premise.js +116 -0
- package/lib/node/proofAssertion/step.js +152 -0
- package/lib/node/proofAssertion/supposition.js +116 -0
- package/lib/node/{premise.js → proofAssertion.js} +11 -18
- package/lib/node/statement.js +2 -2
- 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/node/{axiom.js → topLevelAssertion/axiom.js} +7 -7
- package/lib/node/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
- package/lib/node/{lemma.js → topLevelAssertion/lemma.js} +7 -7
- package/lib/node/{theorem.js → topLevelAssertion/theorem.js} +7 -7
- package/lib/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +9 -9
- package/lib/node/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
- package/lib/node/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
- package/lib/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +9 -9
- package/lib/nonTerminalNodeMap.js +15 -14
- package/lib/preamble.js +10 -10
- package/lib/process/instantiate.js +6 -21
- package/lib/process/unify.js +11 -10
- package/lib/tokenTypes.js +22 -0
- package/lib/types.js +3 -3
- package/lib/utilities/bnf.js +5 -5
- package/lib/utilities/context.js +63 -0
- package/lib/utilities/element.js +235 -408
- package/lib/utilities/instance.js +12 -34
- package/lib/utilities/json.js +3 -2
- package/lib/utilities/string.js +56 -21
- package/lib/utilities/unification.js +38 -32
- package/lib/utilities/validation.js +47 -50
- package/package.json +2 -2
- package/src/constants.js +12 -1
- package/src/context/ephemeral.js +257 -0
- package/src/context/file.js +108 -116
- package/src/context/liminal.js +67 -0
- package/src/context/literal.js +51 -0
- package/src/context/nominal.js +12 -0
- package/src/context/release.js +48 -8
- package/src/context/{local.js → scoped.js} +43 -125
- 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 +71 -93
- package/src/element/combinator/bracketed.js +0 -7
- package/src/element/conclusion.js +25 -24
- package/src/element/constructor/bracketed.js +0 -7
- package/src/element/constructor.js +1 -1
- package/src/element/declaration/combinator.js +0 -1
- package/src/element/declaration/metavariable.js +2 -2
- package/src/element/declaration/variable.js +5 -5
- package/src/element/deduction.js +33 -31
- 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 +80 -65
- package/src/element/hypothesis.js +1 -1
- package/src/element/judgement.js +42 -62
- package/src/element/metaType.js +3 -4
- package/src/element/metavariable.js +59 -56
- package/src/element/parameter.js +10 -5
- package/src/element/procedureCall.js +20 -18
- package/src/element/proof.js +14 -16
- package/src/element/{premise.js → proofAssertion/premise.js} +57 -53
- package/src/element/{step.js → proofAssertion/step.js} +59 -62
- package/src/element/{supposition.js → proofAssertion/supposition.js} +67 -56
- package/src/element/proofAssertion.js +24 -13
- package/src/element/propertyRelation.js +1 -1
- package/src/element/reference.js +87 -37
- package/src/element/rule.js +31 -37
- package/src/element/section.js +5 -5
- package/src/element/signature.js +8 -8
- package/src/element/statement.js +52 -48
- package/src/element/subproof.js +16 -18
- package/src/element/substitution/frame.js +104 -50
- package/src/element/substitution/reference.js +120 -20
- package/src/element/substitution/statement.js +169 -130
- 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 +47 -41
- package/src/element/{axiom.js → topLevelAssertion/axiom.js} +22 -20
- package/src/element/{conjecture.js → topLevelAssertion/conjecture.js} +5 -6
- package/src/element/{lemma.js → topLevelAssertion/lemma.js} +5 -6
- package/src/element/{theorem.js → topLevelAssertion/theorem.js} +5 -5
- package/src/element/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +37 -33
- package/src/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +5 -6
- package/src/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +5 -6
- package/src/element/{metaLemmaMetatheorem.js → topLevelMetaAssertion.js} +19 -17
- package/src/element/type.js +2 -4
- package/src/element/variable.js +47 -48
- package/src/index.js +2 -1
- package/src/main.js +2 -1
- package/src/metaTypes.js +25 -9
- package/src/node/frame.js +1 -1
- package/src/node/metavariable.js +3 -3
- package/src/node/parameter.js +32 -5
- package/src/node/proofAssertion/premise.js +16 -0
- package/src/node/{step.js → proofAssertion/step.js} +4 -18
- package/src/node/proofAssertion/supposition.js +16 -0
- package/src/node/proofAssertion.js +23 -0
- package/src/node/statement.js +1 -1
- 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/node/topLevelAssertion/axiom.js +13 -0
- package/src/node/topLevelAssertion/conjecture.js +13 -0
- package/src/node/topLevelAssertion/lemma.js +13 -0
- package/src/node/topLevelAssertion/theorem.js +13 -0
- package/src/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +1 -1
- package/src/node/topLevelMetaAssertion/metaLemma.js +13 -0
- package/src/node/topLevelMetaAssertion/metatheorem.js +13 -0
- package/src/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +1 -1
- package/src/nonTerminalNodeMap.js +15 -12
- package/src/preamble.js +9 -9
- package/src/process/instantiate.js +27 -36
- package/src/process/unify.js +10 -9
- package/src/tokenTypes.js +4 -0
- package/src/types.js +4 -2
- package/src/utilities/bnf.js +3 -2
- package/src/utilities/context.js +46 -0
- package/src/utilities/element.js +302 -509
- package/src/utilities/instance.js +19 -42
- package/src/utilities/json.js +3 -1
- package/src/utilities/string.js +69 -28
- package/src/utilities/unification.js +41 -38
- package/src/utilities/validation.js +66 -75
- package/lib/context/local.js +0 -605
- package/lib/context/temporary.js +0 -752
- package/lib/element/axiom.js +0 -329
- package/lib/element/axiomLemmaTheoremConjecture.js +0 -427
- package/lib/element/metaLemmaMetatheorem.js +0 -289
- package/lib/element/premise.js +0 -307
- package/lib/element/step.js +0 -311
- package/lib/element/supposition.js +0 -320
- package/lib/log.js +0 -150
- package/lib/node/step.js +0 -166
- package/lib/node/supposition.js +0 -130
- package/src/context/temporary.js +0 -476
- package/src/log.js +0 -118
- package/src/node/axiom.js +0 -13
- package/src/node/conjecture.js +0 -13
- package/src/node/lemma.js +0 -13
- package/src/node/metaLemma.js +0 -13
- package/src/node/metatheorem.js +0 -13
- package/src/node/premise.js +0 -30
- package/src/node/supposition.js +0 -30
- package/src/node/theorem.js +0 -13
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import ProofAssertion from "
|
|
4
|
-
import
|
|
5
|
-
import assignAssignments from "../process/assign";
|
|
3
|
+
import ProofAssertion from "../proofAssertion";
|
|
4
|
+
import assignAssignments from "../../process/assign";
|
|
6
5
|
|
|
7
|
-
import { define } from "
|
|
6
|
+
import { define } from "../../elements";
|
|
7
|
+
import { attempt, synthetically } from "../../utilities/context";
|
|
8
8
|
import { termsFromJSON,
|
|
9
9
|
framesFromJSON,
|
|
10
10
|
termsToTermsJSON,
|
|
@@ -12,7 +12,7 @@ import { termsFromJSON,
|
|
|
12
12
|
framesToFramesJSON,
|
|
13
13
|
procedureCallFromJSON,
|
|
14
14
|
statementToStatementJSON,
|
|
15
|
-
procedureCallToProcedureCallJSON } from "
|
|
15
|
+
procedureCallToProcedureCallJSON } from "../../utilities/json";
|
|
16
16
|
|
|
17
17
|
export default define(class Premise extends ProofAssertion {
|
|
18
18
|
constructor(context, string, node, statement, procedureCall) {
|
|
@@ -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
|
|
|
@@ -83,16 +87,15 @@ export default define(class Premise extends ProofAssertion {
|
|
|
83
87
|
unifyIndependently(substitutions, context) {
|
|
84
88
|
let unifiesIndependently = false;
|
|
85
89
|
|
|
86
|
-
const
|
|
87
|
-
premiseString = this.getString(); ///
|
|
90
|
+
const premiseString = this.getString(); ///
|
|
88
91
|
|
|
89
|
-
context.trace(`Unifying the '${premiseString}' premise independently
|
|
92
|
+
context.trace(`Unifying the '${premiseString}' premise independently...`);
|
|
90
93
|
|
|
91
|
-
const
|
|
94
|
+
const specificContext = context; ///
|
|
92
95
|
|
|
93
96
|
context = this.getContext();
|
|
94
97
|
|
|
95
|
-
const
|
|
98
|
+
const generalContext = context; ///
|
|
96
99
|
|
|
97
100
|
context = specificContext; ///
|
|
98
101
|
|
|
@@ -115,7 +118,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
115
118
|
}
|
|
116
119
|
|
|
117
120
|
if (unifiesIndependently) {
|
|
118
|
-
context.debug(`...unified the '${premiseString}' premise independenly
|
|
121
|
+
context.debug(`...unified the '${premiseString}' premise independenly.`);
|
|
119
122
|
}
|
|
120
123
|
|
|
121
124
|
return unifiesIndependently;
|
|
@@ -126,13 +129,13 @@ export default define(class Premise extends ProofAssertion {
|
|
|
126
129
|
|
|
127
130
|
const subproofOrProofAssertionProofAssertion = subproofOrProofAssertion.isProofAssertion(),
|
|
128
131
|
proofAssertion = subproofOrProofAssertionProofAssertion ?
|
|
129
|
-
|
|
130
|
-
|
|
132
|
+
subproofOrProofAssertion :
|
|
133
|
+
null,
|
|
131
134
|
subproof = subproofOrProofAssertionProofAssertion ?
|
|
132
135
|
null :
|
|
133
136
|
subproofOrProofAssertion;
|
|
134
137
|
|
|
135
|
-
substitutions.snapshot();
|
|
138
|
+
substitutions.snapshot(context);
|
|
136
139
|
|
|
137
140
|
if (subproof !== null) {
|
|
138
141
|
const subproofUnifies = this.unifySubproof(subproof, substitutions, context);
|
|
@@ -155,7 +158,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
155
158
|
}
|
|
156
159
|
|
|
157
160
|
subproofOrProofAssertionUnifies ?
|
|
158
|
-
substitutions.continue() :
|
|
161
|
+
substitutions.continue(context) :
|
|
159
162
|
substitutions.rollback(context);
|
|
160
163
|
|
|
161
164
|
return subproofOrProofAssertionUnifies;
|
|
@@ -164,11 +167,10 @@ export default define(class Premise extends ProofAssertion {
|
|
|
164
167
|
unifyProofAssertion(proofAssertion, substitutions, context) {
|
|
165
168
|
let proofAssertionUnifies = false;
|
|
166
169
|
|
|
167
|
-
const
|
|
168
|
-
premiseString = this.getString(),
|
|
170
|
+
const premiseString = this.getString(), ///
|
|
169
171
|
proofAssertionString = proofAssertion.getString();
|
|
170
172
|
|
|
171
|
-
context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${premiseString}' premise
|
|
173
|
+
context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${premiseString}' premise...`);
|
|
172
174
|
|
|
173
175
|
const specificContext = context; ///
|
|
174
176
|
|
|
@@ -178,15 +180,20 @@ export default define(class Premise extends ProofAssertion {
|
|
|
178
180
|
|
|
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;
|
|
186
193
|
}
|
|
187
194
|
|
|
188
195
|
if (proofAssertionUnifies) {
|
|
189
|
-
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${premiseString}' premise
|
|
196
|
+
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${premiseString}' premise.`);
|
|
190
197
|
}
|
|
191
198
|
|
|
192
199
|
return proofAssertionUnifies;
|
|
@@ -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
|
-
temporaryContext = TemporaryContext.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 = temporaryContext; ///
|
|
289
|
-
|
|
290
294
|
const premise = new Premise(context, string, node, statement, procedureCall);
|
|
291
295
|
|
|
292
296
|
return premise;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import elements from "
|
|
4
|
-
import ProofAssertion from "
|
|
5
|
-
import TemporaryContext from "../context/temporary";
|
|
3
|
+
import elements from "../../elements";
|
|
4
|
+
import ProofAssertion from "../proofAssertion";
|
|
6
5
|
|
|
7
|
-
import { define } from "
|
|
8
|
-
import { unifyStatements } from "
|
|
9
|
-
import {
|
|
6
|
+
import { define } from "../../elements";
|
|
7
|
+
import { unifyStatements } from "../../utilities/unification";
|
|
8
|
+
import { attempt, liminally } from "../../utilities/context";
|
|
9
|
+
import { propertyAssertionFromStatement } from "../../utilities/statement";
|
|
10
10
|
|
|
11
11
|
export default define(class Step extends ProofAssertion {
|
|
12
12
|
constructor(context, string, node, statement, reference, satisfiesAssertion) {
|
|
@@ -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 temporaryContext = TemporaryContext.fromNothing(context);
|
|
63
|
-
|
|
64
|
-
context = temporaryContext; ///
|
|
65
|
-
|
|
66
62
|
const node = this.getNode(),
|
|
67
63
|
stepString = this.getString(); ///
|
|
68
64
|
|
|
@@ -70,39 +66,44 @@ 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 referenceVerifies = this.verifyReference(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);
|
|
80
75
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
statementValidates = statement.validate(assignments, stated, context);
|
|
76
|
+
if (satisfiesAssertioValidates) {
|
|
77
|
+
const statementValidates = this.validateStatement(assignments, context);
|
|
84
78
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
});
|
|
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);
|
|
93
85
|
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
if (statementUnifies) {
|
|
87
|
+
this.setContext(context);
|
|
96
88
|
|
|
97
|
-
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
98
92
|
|
|
99
|
-
|
|
93
|
+
return statementUnifies;
|
|
94
|
+
}, context);
|
|
100
95
|
|
|
101
|
-
|
|
96
|
+
if (statementUnifies) {
|
|
97
|
+
verifies = true;
|
|
98
|
+
}
|
|
102
99
|
}
|
|
103
100
|
}
|
|
104
101
|
}
|
|
105
|
-
|
|
102
|
+
|
|
103
|
+
return verifies;
|
|
104
|
+
}, context);
|
|
105
|
+
} else {
|
|
106
|
+
context.debug(`Unable to verify the '${stepString}' step because it is nonsense.`, node);
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
if (verifies) {
|
|
@@ -112,55 +113,51 @@ export default define(class Step extends ProofAssertion {
|
|
|
112
113
|
return verifies;
|
|
113
114
|
}
|
|
114
115
|
|
|
115
|
-
|
|
116
|
-
let
|
|
116
|
+
validateReference(context) {
|
|
117
|
+
let referenceValidates = true;
|
|
117
118
|
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
if (this.reference !== null) {
|
|
120
|
+
const stepString = this.getString(), ///
|
|
121
|
+
referenceString = this.reference.getString();
|
|
120
122
|
|
|
121
|
-
|
|
123
|
+
context.trace(`Validating the '${stepString}' step's '${referenceString}' reference... `);
|
|
122
124
|
|
|
123
|
-
|
|
124
|
-
referenceVeriries = this.reference.verify(context);
|
|
125
|
-
} else {
|
|
126
|
-
referenceVeriries = true;
|
|
127
|
-
}
|
|
125
|
+
referenceValidates = this.reference.validate(context);
|
|
128
126
|
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
if (referenceValidates) {
|
|
128
|
+
context.debug(`...validated the '${stepString}' step's '${referenceString}' reference. `);
|
|
129
|
+
}
|
|
131
130
|
}
|
|
132
131
|
|
|
133
|
-
return
|
|
132
|
+
return referenceValidates;
|
|
134
133
|
}
|
|
135
134
|
|
|
136
|
-
|
|
137
|
-
let
|
|
135
|
+
validateSatisfiesAssertion(context) {
|
|
136
|
+
let satisfiesAssertionValidates = true; ///
|
|
138
137
|
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
if (this.satisfiesAssertion !== null) {
|
|
139
|
+
const stepString = this.getString(), ///
|
|
140
|
+
satisfiesAssertion = this.satisfiesAssertion.getString();
|
|
141
141
|
|
|
142
|
-
|
|
142
|
+
context.trace(`Validating the '${stepString}' step's '${satisfiesAssertion}' satisfies assertion... `);
|
|
143
143
|
|
|
144
|
-
if (this.satisfiesAssertion !== null) {
|
|
145
144
|
const stated = true,
|
|
146
145
|
assignments = null;
|
|
147
146
|
|
|
148
|
-
|
|
149
|
-
} else {
|
|
150
|
-
satisfiesAssertionVerifies = true;
|
|
151
|
-
}
|
|
147
|
+
satisfiesAssertionValidates = this.satisfiesAssertion.validate(assignments, stated, context);
|
|
152
148
|
|
|
153
|
-
|
|
154
|
-
|
|
149
|
+
if (satisfiesAssertionValidates) {
|
|
150
|
+
context.debug(`...validating the '${stepString}' step's '${satisfiesAssertion}' satisfies assertion. `);
|
|
151
|
+
}
|
|
155
152
|
}
|
|
156
153
|
|
|
157
|
-
return
|
|
154
|
+
return satisfiesAssertionValidates;
|
|
158
155
|
}
|
|
159
156
|
|
|
160
157
|
unifyWithSatisfiesAssertion(satisfiesAssertion, context) {
|
|
161
158
|
let unifiesWithSatisfiesAssertion = false;
|
|
162
159
|
|
|
163
|
-
const stepString = this.
|
|
160
|
+
const stepString = this.getString(), ///
|
|
164
161
|
satisfiesAssertionString = satisfiesAssertion.getString();
|
|
165
162
|
|
|
166
163
|
context.trace(`Unifying the '${stepString}' step with the '${satisfiesAssertionString}' satisfies assertion...`, this.node);
|
|
@@ -171,7 +168,7 @@ export default define(class Step extends ProofAssertion {
|
|
|
171
168
|
if (axiom !== null) {
|
|
172
169
|
const { Substitutions } = elements,
|
|
173
170
|
step = this, ///
|
|
174
|
-
substitutions = Substitutions.fromNothing(),
|
|
171
|
+
substitutions = Substitutions.fromNothing(context),
|
|
175
172
|
stepUnifies = axiom.unifyStep(step, substitutions, context);
|
|
176
173
|
|
|
177
174
|
if (stepUnifies) {
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import ProofAssertion from "
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import { termsFromJSON,
|
|
3
|
+
import ProofAssertion from "../proofAssertion";
|
|
4
|
+
import assignAssignments from "../../process/assign";
|
|
5
|
+
|
|
6
|
+
import { define } from "../../elements";
|
|
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) {
|
|
12
|
-
super(context, string, node);
|
|
19
|
+
super(context, string, node, statement);
|
|
13
20
|
|
|
14
21
|
this.procedureCall = procedureCall;
|
|
15
22
|
}
|
|
@@ -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
|
-
|
|
59
|
-
|
|
66
|
+
if (procedureCall !== null) {
|
|
67
|
+
const procedureCallValidates = procedureCall.validate(context);
|
|
68
|
+
|
|
69
|
+
if (procedureCallValidates) {
|
|
70
|
+
this.setContext(context);
|
|
60
71
|
|
|
61
|
-
|
|
62
|
-
|
|
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,10 +87,9 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
76
87
|
unifyIndependently(substitutions, context) {
|
|
77
88
|
let unifiesIndependently = false;
|
|
78
89
|
|
|
79
|
-
const
|
|
80
|
-
suppositionString = this.getString();
|
|
90
|
+
const suppositionString = this.getString(); ///
|
|
81
91
|
|
|
82
|
-
context.trace(`Unifying the '${suppositionString}' supposition independently
|
|
92
|
+
context.trace(`Unifying the '${suppositionString}' supposition independently...`);
|
|
83
93
|
|
|
84
94
|
const specificContext = context; ///
|
|
85
95
|
|
|
@@ -108,7 +118,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
108
118
|
}
|
|
109
119
|
|
|
110
120
|
if (unifiesIndependently) {
|
|
111
|
-
context.debug(`...unified the '${suppositionString}' supposition independenly
|
|
121
|
+
context.debug(`...unified the '${suppositionString}' supposition independenly.`);
|
|
112
122
|
}
|
|
113
123
|
|
|
114
124
|
return unifiesIndependently;
|
|
@@ -125,7 +135,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
125
135
|
subproofOrProofAssertion :
|
|
126
136
|
null;
|
|
127
137
|
|
|
128
|
-
substitutions.snapshot();
|
|
138
|
+
substitutions.snapshot(context);
|
|
129
139
|
|
|
130
140
|
if (subproof !== null) {
|
|
131
141
|
const subproofUnifies = this.unifySubproof(subproof, substitutions, context);
|
|
@@ -148,20 +158,19 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
148
158
|
}
|
|
149
159
|
|
|
150
160
|
subproofOrProofAssertionUnifies ?
|
|
151
|
-
substitutions.continue() :
|
|
161
|
+
substitutions.continue(context) :
|
|
152
162
|
substitutions.rollback(context);
|
|
153
163
|
|
|
154
164
|
return subproofOrProofAssertionUnifies;
|
|
155
165
|
}
|
|
156
166
|
|
|
157
167
|
unifyProofAssertion(proofAssertion, substitutions, context) {
|
|
158
|
-
let
|
|
168
|
+
let proofAssertionUnifies = false;
|
|
159
169
|
|
|
160
|
-
const
|
|
161
|
-
suppositionString = this.getString(),
|
|
170
|
+
const suppositionString = this.getString(), ///
|
|
162
171
|
proofAssertionString = proofAssertion.getString();
|
|
163
172
|
|
|
164
|
-
context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition
|
|
173
|
+
context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition...`);
|
|
165
174
|
|
|
166
175
|
const specificContext = context; ///
|
|
167
176
|
|
|
@@ -171,18 +180,23 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
171
180
|
|
|
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;
|
|
179
193
|
}
|
|
180
194
|
|
|
181
|
-
if (
|
|
182
|
-
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition
|
|
195
|
+
if (proofAssertionUnifies) {
|
|
196
|
+
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition.`);
|
|
183
197
|
}
|
|
184
198
|
|
|
185
|
-
return
|
|
199
|
+
return proofAssertionUnifies;
|
|
186
200
|
}
|
|
187
201
|
|
|
188
202
|
unifySubproof(subproof, substitutions, context) {
|
|
@@ -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
|
-
temporaryContext = TemporaryContext.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 = temporaryContext; ///
|
|
305
|
-
|
|
306
317
|
const supposition = new Supposition(context, string, node, statement, procedureCall);
|
|
307
318
|
|
|
308
319
|
return supposition;
|