occam-verify-cli 1.0.444 → 1.0.457
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 +1 -5
- package/lib/context/file.js +54 -82
- package/lib/context/fragment.js +77 -0
- package/lib/context/release.js +5 -9
- package/lib/context/scoped.js +314 -0
- package/lib/context/transient.js +371 -0
- package/lib/element/assumption.js +71 -84
- package/lib/element/combinator/bracketed.js +1 -10
- package/lib/element/conclusion.js +11 -8
- package/lib/element/constructor/bracketed.js +1 -10
- 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 +18 -13
- package/lib/element/derivation.js +14 -14
- package/lib/element/frame.js +40 -46
- package/lib/element/hypothesis.js +14 -55
- package/lib/element/judgement.js +35 -56
- package/lib/element/metaType.js +5 -4
- package/lib/element/metavariable.js +14 -10
- package/lib/element/proof.js +10 -10
- package/lib/element/proofAssertion/premise.js +308 -0
- package/lib/element/proofAssertion/step.js +305 -0
- package/lib/element/proofAssertion/supposition.js +322 -0
- package/lib/element/proofAssertion.js +199 -0
- package/lib/element/reference.js +28 -25
- package/lib/element/rule.js +29 -29
- package/lib/element/section.js +4 -4
- package/lib/element/statement.js +9 -14
- package/lib/element/subDerivation.js +14 -14
- package/lib/element/subproof.js +14 -14
- package/lib/element/substitution/frame.js +7 -7
- package/lib/element/substitution/statement.js +15 -39
- package/lib/element/substitution.js +5 -5
- package/lib/element/term.js +12 -10
- package/lib/element/topLevelAssertion/axiom.js +329 -0
- package/lib/element/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
- package/lib/element/{lemma.js → topLevelAssertion/lemma.js} +6 -6
- package/lib/element/{theorem.js → topLevelAssertion/theorem.js} +7 -7
- package/lib/element/topLevelAssertion.js +427 -0
- package/lib/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
- package/lib/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
- package/lib/element/topLevelMetaAssertion.js +289 -0
- package/lib/element/type.js +4 -4
- package/lib/element/variable.js +20 -20
- package/lib/metaTypes.js +33 -19
- 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/subDerivation.js +1 -8
- package/lib/node/subproof.js +1 -8
- package/lib/node/substitution/statement.js +2 -2
- 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 +13 -13
- package/lib/preamble.js +10 -10
- package/lib/process/instantiate.js +6 -9
- package/lib/process/unify.js +7 -6
- package/lib/types.js +3 -3
- package/lib/utilities/bnf.js +5 -5
- package/lib/utilities/brackets.js +6 -11
- package/lib/utilities/context.js +28 -0
- package/lib/utilities/element.js +101 -99
- package/lib/utilities/fragment.js +23 -0
- package/lib/utilities/instance.js +12 -21
- package/lib/utilities/json.js +3 -2
- package/lib/utilities/string.js +44 -23
- package/lib/utilities/unification.js +36 -36
- package/lib/utilities/validation.js +22 -25
- package/package.json +6 -6
- package/src/constants.js +0 -1
- package/src/context/file.js +51 -58
- package/src/context/fragment.js +38 -0
- package/src/context/release.js +6 -11
- package/src/context/{local.js → scoped.js} +35 -127
- package/src/context/{temporary.js → transient.js} +9 -131
- package/src/element/assumption.js +69 -85
- package/src/element/combinator/bracketed.js +0 -7
- package/src/element/conclusion.js +14 -10
- package/src/element/constructor/bracketed.js +0 -7
- 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 +22 -15
- package/src/element/derivation.js +12 -12
- package/src/element/frame.js +36 -48
- package/src/element/hypothesis.js +14 -16
- package/src/element/judgement.js +33 -58
- package/src/element/metaType.js +4 -4
- package/src/element/metavariable.js +17 -10
- package/src/element/proof.js +9 -9
- package/src/element/{premise.js → proofAssertion/premise.js} +107 -75
- package/src/element/{step.js → proofAssertion/step.js} +43 -89
- package/src/element/{supposition.js → proofAssertion/supposition.js} +89 -88
- package/src/element/proofAssertion.js +69 -0
- package/src/element/reference.js +27 -23
- package/src/element/rule.js +25 -25
- package/src/element/section.js +4 -4
- package/src/element/statement.js +8 -15
- package/src/element/subDerivation.js +12 -12
- package/src/element/subproof.js +10 -10
- package/src/element/substitution/frame.js +10 -13
- package/src/element/substitution/statement.js +20 -52
- package/src/element/substitution.js +3 -3
- package/src/element/term.js +10 -9
- package/src/element/{axiom.js → topLevelAssertion/axiom.js} +41 -41
- package/src/element/{conjecture.js → topLevelAssertion/conjecture.js} +4 -4
- package/src/element/{lemma.js → topLevelAssertion/lemma.js} +3 -3
- package/src/element/{theorem.js → topLevelAssertion/theorem.js} +4 -4
- package/src/element/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +30 -49
- package/src/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +4 -4
- package/src/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +4 -4
- package/src/element/{metaLemmaMetatheorem.js → topLevelMetaAssertion.js} +7 -72
- package/src/element/type.js +2 -4
- package/src/element/variable.js +17 -17
- package/src/metaTypes.js +42 -13
- 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/subDerivation.js +0 -7
- package/src/node/subproof.js +0 -7
- package/src/node/substitution/statement.js +1 -1
- 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 +12 -12
- package/src/preamble.js +9 -9
- package/src/process/instantiate.js +31 -32
- package/src/process/unify.js +6 -5
- package/src/types.js +4 -2
- package/src/utilities/bnf.js +3 -2
- package/src/utilities/brackets.js +5 -8
- package/src/utilities/context.js +20 -0
- package/src/utilities/element.js +169 -162
- package/src/utilities/fragment.js +11 -0
- package/src/utilities/instance.js +19 -24
- package/src/utilities/json.js +3 -1
- package/src/utilities/string.js +57 -32
- package/src/utilities/unification.js +39 -39
- package/src/utilities/validation.js +26 -35
- 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 -434
- package/lib/element/metaLemmaMetatheorem.js +0 -322
- package/lib/element/premise.js +0 -380
- package/lib/element/step.js +0 -390
- package/lib/element/supposition.js +0 -410
- package/lib/node/step.js +0 -166
- package/lib/node/supposition.js +0 -130
- 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,25 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
import ProofAssertion from "../proofAssertion";
|
|
4
|
+
import TransientContext from "../../context/transient";
|
|
5
|
+
import assignAssignments from "../../process/assign";
|
|
6
|
+
|
|
7
|
+
import { define } from "../../elements";
|
|
8
|
+
import { termsFromJSON,
|
|
9
|
+
framesFromJSON,
|
|
10
|
+
termsToTermsJSON,
|
|
11
|
+
statementFromJSON,
|
|
12
|
+
framesToFramesJSON,
|
|
13
|
+
procedureCallFromJSON,
|
|
14
|
+
statementToStatementJSON,
|
|
15
|
+
procedureCallToProcedureCallJSON } from "../../utilities/json";
|
|
16
|
+
|
|
17
|
+
export default define(class Premise extends ProofAssertion {
|
|
12
18
|
constructor(context, string, node, statement, procedureCall) {
|
|
13
|
-
super(context, string, node);
|
|
19
|
+
super(context, string, node, statement);
|
|
14
20
|
|
|
15
|
-
this.statement = statement;
|
|
16
21
|
this.procedureCall = procedureCall;
|
|
17
22
|
}
|
|
18
23
|
|
|
19
|
-
getStatement() {
|
|
20
|
-
return this.statement;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
24
|
getProcedureCall() {
|
|
24
25
|
return this.procedureCall;
|
|
25
26
|
}
|
|
@@ -27,32 +28,32 @@ export default define(class Premise extends Element {
|
|
|
27
28
|
verify(context) {
|
|
28
29
|
let verifies = false;
|
|
29
30
|
|
|
30
|
-
const
|
|
31
|
+
const transientContext = TransientContext.fromNothing(context);
|
|
31
32
|
|
|
32
|
-
context =
|
|
33
|
+
context = transientContext; ///
|
|
33
34
|
|
|
34
35
|
const node = this.getNode(),
|
|
35
36
|
premiseString = this.getString(); ///
|
|
36
37
|
|
|
37
38
|
context.trace(`Verifying the '${premiseString}' premise...`, node);
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
const statement = this.getStatement();
|
|
41
|
+
|
|
42
|
+
if ((statement === null) && (this.procedureCall === null)) {
|
|
40
43
|
context.debug(`Unable to verify the '${premiseString}' premise because it is nonsense.`, node);
|
|
41
44
|
} else {
|
|
42
|
-
if (
|
|
45
|
+
if (statement !== null) {
|
|
43
46
|
const stated = true,
|
|
44
47
|
assignments = [],
|
|
45
|
-
statementValidates =
|
|
48
|
+
statementValidates = statement.validate(assignments, stated, context);
|
|
46
49
|
|
|
47
50
|
if (statementValidates) {
|
|
48
51
|
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
49
52
|
|
|
50
53
|
if (assignmentsAssigned) {
|
|
51
|
-
const
|
|
52
|
-
step = Step.fromStatement(this.statement, context),
|
|
53
|
-
stepOrSubproof = step; ///
|
|
54
|
+
const subproofOrProofAssertion = this; ///
|
|
54
55
|
|
|
55
|
-
context.
|
|
56
|
+
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
56
57
|
|
|
57
58
|
verifies = true;
|
|
58
59
|
}
|
|
@@ -82,15 +83,22 @@ export default define(class Premise extends Element {
|
|
|
82
83
|
unifyIndependently(substitutions, context) {
|
|
83
84
|
let unifiesIndependently = false;
|
|
84
85
|
|
|
85
|
-
const
|
|
86
|
-
premiseString = this.getString(), ///
|
|
87
|
-
generalContext = this.context, ///
|
|
88
|
-
specificContext = context; ///
|
|
86
|
+
const premiseString = this.getString(); ///
|
|
89
87
|
|
|
90
|
-
context.trace(`Unifying the '${premiseString}' premise independently
|
|
88
|
+
context.trace(`Unifying the '${premiseString}' premise independently...`);
|
|
89
|
+
|
|
90
|
+
const specificContext = context; ///
|
|
91
|
+
|
|
92
|
+
context = this.getContext();
|
|
93
|
+
|
|
94
|
+
const generalContext = context; ///
|
|
95
|
+
|
|
96
|
+
context = specificContext; ///
|
|
91
97
|
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
const statement = this.getStatement();
|
|
99
|
+
|
|
100
|
+
if (statement !== null) {
|
|
101
|
+
const statementUnifiesIndependently = statement.unifyIndependently(substitutions, generalContext, specificContext);
|
|
94
102
|
|
|
95
103
|
if (statementUnifiesIndependently) {
|
|
96
104
|
unifiesIndependently = true;
|
|
@@ -106,84 +114,92 @@ export default define(class Premise extends Element {
|
|
|
106
114
|
}
|
|
107
115
|
|
|
108
116
|
if (unifiesIndependently) {
|
|
109
|
-
context.debug(`...unified the '${premiseString}' premise independenly
|
|
117
|
+
context.debug(`...unified the '${premiseString}' premise independenly.`);
|
|
110
118
|
}
|
|
111
119
|
|
|
112
120
|
return unifiesIndependently;
|
|
113
121
|
}
|
|
114
122
|
|
|
115
|
-
|
|
116
|
-
let
|
|
123
|
+
unifySubproofOrProofAssertion(subproofOrProofAssertion, substitutions, context) {
|
|
124
|
+
let subproofOrProofAssertionUnifies = false;
|
|
117
125
|
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
126
|
+
const subproofOrProofAssertionProofAssertion = subproofOrProofAssertion.isProofAssertion(),
|
|
127
|
+
proofAssertion = subproofOrProofAssertionProofAssertion ?
|
|
128
|
+
subproofOrProofAssertion :
|
|
129
|
+
null,
|
|
130
|
+
subproof = subproofOrProofAssertionProofAssertion ?
|
|
131
|
+
null :
|
|
132
|
+
subproofOrProofAssertion;
|
|
125
133
|
|
|
126
134
|
substitutions.snapshot();
|
|
127
135
|
|
|
128
136
|
if (subproof !== null) {
|
|
129
137
|
const subproofUnifies = this.unifySubproof(subproof, substitutions, context);
|
|
130
138
|
|
|
131
|
-
|
|
139
|
+
if (subproofUnifies) {
|
|
140
|
+
subproofOrProofAssertionUnifies = true;
|
|
141
|
+
}
|
|
132
142
|
}
|
|
133
143
|
|
|
134
|
-
if (
|
|
135
|
-
const
|
|
144
|
+
if (proofAssertion !== null) {
|
|
145
|
+
const proofAssertionUnifies = this.unifyProofAssertion(proofAssertion, substitutions, context);
|
|
136
146
|
|
|
137
|
-
|
|
147
|
+
if (proofAssertionUnifies) {
|
|
148
|
+
subproofOrProofAssertionUnifies = true;
|
|
149
|
+
}
|
|
138
150
|
}
|
|
139
151
|
|
|
140
|
-
if (
|
|
152
|
+
if (subproofOrProofAssertionUnifies) {
|
|
141
153
|
substitutions.resolve(context);
|
|
142
154
|
}
|
|
143
155
|
|
|
144
|
-
|
|
156
|
+
subproofOrProofAssertionUnifies ?
|
|
145
157
|
substitutions.continue() :
|
|
146
158
|
substitutions.rollback(context);
|
|
147
159
|
|
|
148
|
-
return
|
|
160
|
+
return subproofOrProofAssertionUnifies;
|
|
149
161
|
}
|
|
150
162
|
|
|
151
|
-
|
|
152
|
-
let
|
|
163
|
+
unifyProofAssertion(proofAssertion, substitutions, context) {
|
|
164
|
+
let proofAssertionUnifies = false;
|
|
153
165
|
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
premiseStatement = premise.getStatement(),
|
|
157
|
-
premiseStatementString = premiseStatement.getString();
|
|
166
|
+
const premiseString = this.getString(),
|
|
167
|
+
proofAssertionString = proofAssertion.getString();
|
|
158
168
|
|
|
159
|
-
context.trace(`Unifying the '${
|
|
160
|
-
|
|
161
|
-
const specificContext = context; ///
|
|
169
|
+
context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${premiseString}' premise...`);
|
|
162
170
|
|
|
163
171
|
context = this.getContext();
|
|
164
172
|
|
|
165
173
|
const generalContext = context; ///
|
|
166
174
|
|
|
175
|
+
context = proofAssertion.getContext();
|
|
176
|
+
|
|
177
|
+
const specificContext = context; ///
|
|
178
|
+
|
|
167
179
|
context = specificContext; ///
|
|
168
180
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
subproofAssertion = subproofAssertionFromStatement(this.statement, context);
|
|
181
|
+
const statement = proofAssertion.getStatement(),
|
|
182
|
+
statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
172
183
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
184
|
+
if (statementUnifies) {
|
|
185
|
+
proofAssertionUnifies = true;
|
|
176
186
|
}
|
|
177
187
|
|
|
178
|
-
if (
|
|
179
|
-
context.debug(`...unified the '${
|
|
188
|
+
if (proofAssertionUnifies) {
|
|
189
|
+
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${premiseString}' premise.`);
|
|
180
190
|
}
|
|
181
191
|
|
|
182
|
-
return
|
|
192
|
+
return proofAssertionUnifies;
|
|
183
193
|
}
|
|
184
194
|
|
|
185
|
-
|
|
186
|
-
let
|
|
195
|
+
unifySubproof(subproof, substitutions, context) {
|
|
196
|
+
let subproofUnifies = false;
|
|
197
|
+
|
|
198
|
+
const node = this.getNode(),
|
|
199
|
+
premiseString = this.getString(),
|
|
200
|
+
subproofString = subproof.getString();
|
|
201
|
+
|
|
202
|
+
context.trace(`Unifying the '${subproofString}' subproof with the '${premiseString}' premise...`, node);
|
|
187
203
|
|
|
188
204
|
const specificContext = context; ///
|
|
189
205
|
|
|
@@ -193,14 +209,30 @@ export default define(class Premise extends Element {
|
|
|
193
209
|
|
|
194
210
|
context = specificContext; ///
|
|
195
211
|
|
|
196
|
-
const statement =
|
|
197
|
-
statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
212
|
+
const statement = this.getStatement();
|
|
198
213
|
|
|
199
|
-
if (
|
|
200
|
-
|
|
214
|
+
if (statement !== null) {
|
|
215
|
+
const statementNode = statement.getNode(),
|
|
216
|
+
subproofAssertionNode = statementNode.getSubproofAssertionNode();
|
|
217
|
+
|
|
218
|
+
if (subproofAssertionNode !== null) {
|
|
219
|
+
const context = generalContext, ///
|
|
220
|
+
assertionNode = subproofAssertionNode, ///
|
|
221
|
+
assertion = context.findAssertionByAssertionNode(assertionNode)
|
|
222
|
+
|
|
223
|
+
if (assertion !== null) {
|
|
224
|
+
const subproofAssertion = assertion; ///
|
|
225
|
+
|
|
226
|
+
subproofUnifies = subproofAssertion.unifySubproof(subproof, substitutions, generalContext, specificContext);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
201
229
|
}
|
|
202
230
|
|
|
203
|
-
|
|
231
|
+
if (subproofUnifies) {
|
|
232
|
+
context.debug(`...unified the '${subproofString}' subproof with the '${premiseString}' premise.`, node);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return subproofUnifies;
|
|
204
236
|
}
|
|
205
237
|
|
|
206
238
|
toJSON() {
|
|
@@ -239,7 +271,7 @@ export default define(class Premise extends Element {
|
|
|
239
271
|
frames = framesFromJSON(json, context),
|
|
240
272
|
statement = statementFromJSON(json, context),
|
|
241
273
|
procedureCall = procedureCallFromJSON(json, context),
|
|
242
|
-
|
|
274
|
+
transientContext = TransientContext.fromTermsAndFrames(terms, frames, context);
|
|
243
275
|
|
|
244
276
|
let string;
|
|
245
277
|
|
|
@@ -253,7 +285,7 @@ export default define(class Premise extends Element {
|
|
|
253
285
|
|
|
254
286
|
const node = null;
|
|
255
287
|
|
|
256
|
-
context =
|
|
288
|
+
context = transientContext; ///
|
|
257
289
|
|
|
258
290
|
const premise = new Premise(context, string, node, statement, procedureCall);
|
|
259
291
|
|
|
@@ -1,29 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
import { define } from "
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import { propertyAssertionFromStatement } from "../utilities/statement";
|
|
13
|
-
|
|
14
|
-
export default define(class Step extends Element {
|
|
3
|
+
import elements from "../../elements";
|
|
4
|
+
import ProofAssertion from "../proofAssertion";
|
|
5
|
+
import TransientContext from "../../context/transient";
|
|
6
|
+
|
|
7
|
+
import { define } from "../../elements";
|
|
8
|
+
import { unifyStatements } from "../../utilities/unification";
|
|
9
|
+
import { propertyAssertionFromStatement } from "../../utilities/statement";
|
|
10
|
+
|
|
11
|
+
export default define(class Step extends ProofAssertion {
|
|
15
12
|
constructor(context, string, node, statement, reference, satisfiesAssertion) {
|
|
16
|
-
super(context, string, node);
|
|
13
|
+
super(context, string, node, statement);
|
|
17
14
|
|
|
18
|
-
this.statement = statement;
|
|
19
15
|
this.reference = reference;
|
|
20
16
|
this.satisfiesAssertion = satisfiesAssertion;
|
|
21
17
|
}
|
|
22
18
|
|
|
23
|
-
getStatement() {
|
|
24
|
-
return this.statement;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
19
|
getReference() {
|
|
28
20
|
return this.reference;
|
|
29
21
|
}
|
|
@@ -51,16 +43,11 @@ export default define(class Step extends Element {
|
|
|
51
43
|
return stated;
|
|
52
44
|
}
|
|
53
45
|
|
|
54
|
-
isStep() {
|
|
55
|
-
const step = true;
|
|
56
|
-
|
|
57
|
-
return step;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
46
|
compareTermAndPropertyRelation(term, propertyRelation, context) {
|
|
61
47
|
let comparesToTermAndPropertyRelation = false;
|
|
62
48
|
|
|
63
|
-
const
|
|
49
|
+
const statement = this.getStatement(),
|
|
50
|
+
propertyAssertion = propertyAssertionFromStatement(statement, context);
|
|
64
51
|
|
|
65
52
|
if (propertyAssertion !== null) {
|
|
66
53
|
comparesToTermAndPropertyRelation = propertyAssertion.compareTermAndPropertyRelation(term, propertyRelation, context);
|
|
@@ -72,30 +59,32 @@ export default define(class Step extends Element {
|
|
|
72
59
|
verify(substitutions, assignments, context) {
|
|
73
60
|
let verifies = false;
|
|
74
61
|
|
|
75
|
-
const
|
|
62
|
+
const transientContext = TransientContext.fromNothing(context);
|
|
76
63
|
|
|
77
|
-
context =
|
|
64
|
+
context = transientContext; ///
|
|
78
65
|
|
|
79
66
|
const node = this.getNode(),
|
|
80
67
|
stepString = this.getString(); ///
|
|
81
68
|
|
|
82
69
|
context.trace(`Verifying the '${stepString}' step...`, node);
|
|
83
70
|
|
|
84
|
-
|
|
71
|
+
const statement = this.getStatement();
|
|
72
|
+
|
|
73
|
+
if (statement === null) {
|
|
85
74
|
context.debug(`Unable to verify the '${stepString}' step because it is nonsense.`, node);
|
|
86
75
|
} else {
|
|
87
|
-
const
|
|
76
|
+
const referenceValidates = this.validateReference(context);
|
|
88
77
|
|
|
89
|
-
if (
|
|
78
|
+
if (referenceValidates) {
|
|
90
79
|
const satisfiesAssertioVeriries = this.verifySatisfiesAssertion(context);
|
|
91
80
|
|
|
92
81
|
if (satisfiesAssertioVeriries) {
|
|
93
82
|
const stated = this.isStated(),
|
|
94
|
-
statementValidates =
|
|
83
|
+
statementValidates = statement.validate(assignments, stated, context);
|
|
95
84
|
|
|
96
85
|
if (statementValidates) {
|
|
97
86
|
const statementUnifies = unifyStatements.some((unifyStatement) => {
|
|
98
|
-
const statementUnifies = unifyStatement(
|
|
87
|
+
const statementUnifies = unifyStatement(statement, this.reference, this.satisfiesAssertion, substitutions, context);
|
|
99
88
|
|
|
100
89
|
if (statementUnifies) {
|
|
101
90
|
return true;
|
|
@@ -103,14 +92,6 @@ export default define(class Step extends Element {
|
|
|
103
92
|
});
|
|
104
93
|
|
|
105
94
|
if (statementUnifies) {
|
|
106
|
-
const { Step } = elements,
|
|
107
|
-
step = Step.fromStatement(this.statement, context),
|
|
108
|
-
stepOrSubproof = step; ///
|
|
109
|
-
|
|
110
|
-
context.addStepOrSubproof(stepOrSubproof);
|
|
111
|
-
|
|
112
|
-
this.setContext(context);
|
|
113
|
-
|
|
114
95
|
verifies = true;
|
|
115
96
|
}
|
|
116
97
|
}
|
|
@@ -119,75 +100,59 @@ export default define(class Step extends Element {
|
|
|
119
100
|
}
|
|
120
101
|
|
|
121
102
|
if (verifies) {
|
|
103
|
+
this.setContext(context);
|
|
104
|
+
|
|
122
105
|
context.debug(`...verified the '${stepString}' step.`, node);
|
|
123
106
|
}
|
|
124
107
|
|
|
125
108
|
return verifies;
|
|
126
109
|
}
|
|
127
110
|
|
|
128
|
-
|
|
129
|
-
let
|
|
111
|
+
validateReference(context) {
|
|
112
|
+
let referenceValidates = true;
|
|
130
113
|
|
|
131
|
-
|
|
132
|
-
|
|
114
|
+
if (this.reference !== null) {
|
|
115
|
+
const node = this.getNode(),
|
|
116
|
+
stepString = this.getString();
|
|
133
117
|
|
|
134
|
-
|
|
118
|
+
context.trace(`Validating the '${stepString}' step's reference... `, node);
|
|
135
119
|
|
|
136
|
-
|
|
137
|
-
referenceVeriries = this.reference.verify(context);
|
|
138
|
-
} else {
|
|
139
|
-
referenceVeriries = true;
|
|
140
|
-
}
|
|
120
|
+
referenceValidates = this.reference.validate(context);
|
|
141
121
|
|
|
142
|
-
|
|
143
|
-
|
|
122
|
+
if (referenceValidates) {
|
|
123
|
+
context.debug(`...validating the '${stepString}' step's reference. `, node);
|
|
124
|
+
}
|
|
144
125
|
}
|
|
145
126
|
|
|
146
|
-
return
|
|
127
|
+
return referenceValidates;
|
|
147
128
|
}
|
|
148
129
|
|
|
149
130
|
verifySatisfiesAssertion(context) {
|
|
150
|
-
let satisfiesAssertionVerifies;
|
|
131
|
+
let satisfiesAssertionVerifies = true; ///
|
|
151
132
|
|
|
152
|
-
|
|
153
|
-
|
|
133
|
+
if (this.satisfiesAssertion !== null) {
|
|
134
|
+
const node = this.getNode(),
|
|
135
|
+
stepString = this.getString(); ///
|
|
154
136
|
|
|
155
|
-
|
|
137
|
+
context.trace(`Verifying the '${stepString}' step's satisfies assertion... `, node);
|
|
156
138
|
|
|
157
|
-
if (this.satisfiesAssertion !== null) {
|
|
158
139
|
const stated = true,
|
|
159
140
|
assignments = null;
|
|
160
141
|
|
|
161
142
|
satisfiesAssertionVerifies = this.satisfiesAssertion.validate(assignments, stated, context);
|
|
162
|
-
} else {
|
|
163
|
-
satisfiesAssertionVerifies = true;
|
|
164
|
-
}
|
|
165
143
|
|
|
166
|
-
|
|
167
|
-
|
|
144
|
+
if (satisfiesAssertionVerifies) {
|
|
145
|
+
context.debug(`...verified the '${stepString}' step's satisfies assertion. `, node);
|
|
146
|
+
}
|
|
168
147
|
}
|
|
169
148
|
|
|
170
149
|
return satisfiesAssertionVerifies;
|
|
171
150
|
}
|
|
172
151
|
|
|
173
|
-
compareStatment(statement, context) {
|
|
174
|
-
let comparesToStatement;
|
|
175
|
-
|
|
176
|
-
const leftStatement = statement, ///
|
|
177
|
-
rightStatement = this.statement, ///
|
|
178
|
-
leftStatementNode = leftStatement.getNode(),
|
|
179
|
-
rightStatementNode = rightStatement.getNode(),
|
|
180
|
-
statementsEquate = equateStatements(leftStatementNode, rightStatementNode, context);
|
|
181
|
-
|
|
182
|
-
comparesToStatement = statementsEquate; ///
|
|
183
|
-
|
|
184
|
-
return comparesToStatement;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
152
|
unifyWithSatisfiesAssertion(satisfiesAssertion, context) {
|
|
188
153
|
let unifiesWithSatisfiesAssertion = false;
|
|
189
154
|
|
|
190
|
-
const stepString = this.
|
|
155
|
+
const stepString = this.getString(), ///
|
|
191
156
|
satisfiesAssertionString = satisfiesAssertion.getString();
|
|
192
157
|
|
|
193
158
|
context.trace(`Unifying the '${stepString}' step with the '${satisfiesAssertionString}' satisfies assertion...`, this.node);
|
|
@@ -218,15 +183,4 @@ export default define(class Step extends Element {
|
|
|
218
183
|
}
|
|
219
184
|
|
|
220
185
|
static name = "Step";
|
|
221
|
-
|
|
222
|
-
static fromStatement(statement, context) {
|
|
223
|
-
const statementString = statement.getString(),
|
|
224
|
-
stepString = statementString, ///
|
|
225
|
-
string = `${stepString}
|
|
226
|
-
`,
|
|
227
|
-
stepNode = instantiateStep(string, context),
|
|
228
|
-
step = stepFromStepNode(stepNode, context);
|
|
229
|
-
|
|
230
|
-
return step;;
|
|
231
|
-
}
|
|
232
186
|
});
|