occam-verify-cli 1.0.612 → 1.0.631
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 +210 -77
- package/lib/context/file/nominal.js +157 -135
- package/lib/context/liminal.js +34 -59
- package/lib/context/scoped.js +37 -58
- package/lib/context.js +103 -53
- package/lib/element/assertion/contained.js +3 -1
- package/lib/element/assertion/defined.js +3 -1
- package/lib/element/assertion/property.js +10 -58
- package/lib/element/assertion/satisfies.js +3 -1
- package/lib/element/assertion/subproof.js +3 -1
- package/lib/element/assertion/type.js +63 -109
- package/lib/element/assertion.js +5 -9
- package/lib/element/assumption.js +50 -19
- package/lib/element/combinator.js +8 -1
- package/lib/element/conclusion.js +8 -1
- package/lib/element/constructor.js +8 -1
- package/lib/element/declaration.js +3 -7
- package/lib/element/deduction.js +8 -1
- package/lib/element/derivation.js +15 -10
- package/lib/element/equality.js +109 -62
- package/lib/element/equivalence.js +13 -6
- package/lib/element/equivalences.js +11 -4
- package/lib/element/error.js +10 -7
- package/lib/element/frame.js +21 -21
- package/lib/element/hypothesis.js +12 -7
- package/lib/element/judgement.js +55 -26
- package/lib/element/label.js +8 -1
- package/lib/element/metaType.js +9 -2
- package/lib/element/metavariable.js +16 -10
- package/lib/element/parameter.js +8 -1
- package/lib/element/procedureCall.js +21 -29
- package/lib/element/procedureReference.js +15 -1
- package/lib/element/proof.js +8 -1
- package/lib/element/proofAssertion.js +8 -1
- package/lib/element/property.js +8 -1
- package/lib/element/propertyRelation.js +8 -1
- package/lib/element/reference.js +16 -28
- package/lib/element/rule.js +22 -21
- package/lib/element/section.js +8 -1
- package/lib/element/signature.js +8 -1
- package/lib/element/statement.js +34 -40
- package/lib/element/subDerivation.js +11 -6
- package/lib/element/subproof.js +8 -1
- package/lib/element/substitution/frame.js +6 -6
- package/lib/element/substitution/reference.js +6 -6
- package/lib/element/substitution/statement.js +6 -6
- package/lib/element/substitution/term.js +9 -3
- package/lib/element/substitution.js +73 -49
- package/lib/element/term.js +15 -1
- package/lib/element/topLevelAssertion/axiom.js +8 -1
- package/lib/element/topLevelAssertion/conjecture.js +8 -1
- package/lib/element/topLevelAssertion/lemma.js +8 -1
- package/lib/element/topLevelAssertion/theorem.js +8 -1
- package/lib/element/topLevelAssertion.js +11 -17
- package/lib/element/topLevelMetaAssertion/metaLemma.js +8 -1
- package/lib/element/topLevelMetaAssertion/metatheorem.js +8 -1
- package/lib/element/topLevelMetaAssertion.js +9 -11
- package/lib/element/type.js +8 -1
- package/lib/element/typePrefix.js +8 -1
- package/lib/element/variable.js +51 -5
- package/lib/preamble.js +1 -2
- package/lib/process/assign.js +96 -27
- package/lib/process/unify.js +3 -4
- package/lib/process/validate.js +2 -2
- package/lib/process/verify.js +2 -2
- package/lib/utilities/element.js +74 -12
- package/lib/utilities/json.js +2 -2
- package/lib/utilities/string.js +9 -24
- package/lib/utilities/substitutions.js +15 -23
- package/package.json +2 -2
- package/src/context/ephemeral.js +234 -82
- package/src/context/file/nominal.js +195 -135
- package/src/context/liminal.js +43 -80
- package/src/context/scoped.js +56 -81
- package/src/context.js +97 -46
- package/src/element/assertion/contained.js +4 -0
- package/src/element/assertion/defined.js +4 -0
- package/src/element/assertion/property.js +15 -26
- package/src/element/assertion/satisfies.js +4 -0
- package/src/element/assertion/subproof.js +4 -0
- package/src/element/assertion/type.js +67 -77
- package/src/element/assertion.js +4 -8
- package/src/element/assumption.js +57 -18
- package/src/element/combinator.js +7 -0
- package/src/element/conclusion.js +7 -0
- package/src/element/constructor.js +7 -0
- package/src/element/declaration.js +1 -3
- package/src/element/deduction.js +7 -0
- package/src/element/derivation.js +10 -5
- package/src/element/equality.js +116 -74
- package/src/element/equivalence.js +15 -7
- package/src/element/equivalences.js +14 -5
- package/src/element/error.js +5 -2
- package/src/element/frame.js +25 -25
- package/src/element/hypothesis.js +11 -6
- package/src/element/judgement.js +62 -26
- package/src/element/label.js +7 -0
- package/src/element/metaType.js +8 -1
- package/src/element/metavariable.js +20 -14
- package/src/element/parameter.js +7 -0
- package/src/element/procedureCall.js +21 -14
- package/src/element/procedureReference.js +13 -0
- package/src/element/proof.js +7 -0
- package/src/element/proofAssertion.js +7 -0
- package/src/element/property.js +7 -0
- package/src/element/propertyRelation.js +7 -0
- package/src/element/reference.js +20 -33
- package/src/element/rule.js +16 -19
- package/src/element/section.js +7 -0
- package/src/element/signature.js +7 -0
- package/src/element/statement.js +36 -44
- package/src/element/subDerivation.js +10 -5
- package/src/element/subproof.js +7 -0
- package/src/element/substitution/frame.js +3 -3
- package/src/element/substitution/reference.js +3 -3
- package/src/element/substitution/statement.js +3 -3
- package/src/element/substitution/term.js +4 -2
- package/src/element/substitution.js +60 -40
- package/src/element/term.js +20 -2
- package/src/element/topLevelAssertion/axiom.js +7 -0
- package/src/element/topLevelAssertion/conjecture.js +7 -0
- package/src/element/topLevelAssertion/lemma.js +7 -0
- package/src/element/topLevelAssertion/theorem.js +7 -0
- package/src/element/topLevelAssertion.js +5 -15
- package/src/element/topLevelMetaAssertion/metaLemma.js +7 -0
- package/src/element/topLevelMetaAssertion/metatheorem.js +7 -0
- package/src/element/topLevelMetaAssertion.js +4 -6
- package/src/element/type.js +7 -0
- package/src/element/typePrefix.js +7 -0
- package/src/element/variable.js +9 -4
- package/src/preamble.js +0 -1
- package/src/process/assign.js +113 -38
- package/src/process/unify.js +2 -3
- package/src/process/validate.js +1 -1
- package/src/process/verify.js +1 -1
- package/src/utilities/element.js +83 -26
- package/src/utilities/json.js +1 -1
- package/src/utilities/string.js +7 -29
- package/src/utilities/substitutions.js +19 -30
- package/lib/element/substitutions.js +0 -225
- package/src/element/substitutions.js +0 -84
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import elements from "../../elements";
|
|
4
3
|
import Assertion from "../assertion";
|
|
5
4
|
|
|
6
5
|
import { define } from "../../elements";
|
|
7
|
-
import {
|
|
6
|
+
import { variableAssignmentFromPrepertyAssertion } from "../../process/assign";
|
|
8
7
|
|
|
9
8
|
export default define(class PropertyAssertion extends Assertion {
|
|
10
9
|
constructor(context, string, node, term, propertyRelation) {
|
|
@@ -76,7 +75,7 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
76
75
|
|
|
77
76
|
if (propertyRelationVerifies) {
|
|
78
77
|
let validatesWhenStated = false,
|
|
79
|
-
|
|
78
|
+
validatesWhenDerived = false;
|
|
80
79
|
|
|
81
80
|
if (stated) {
|
|
82
81
|
validatesWhenStated = this.validateWhenStated(assignments, context);
|
|
@@ -91,12 +90,12 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
91
90
|
}
|
|
92
91
|
|
|
93
92
|
if (validates) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
const assertion = this; ///
|
|
94
|
+
|
|
95
|
+
context.addAssertion(assertion);
|
|
96
|
+
|
|
97
|
+
this.assign(assignments, stated, context);
|
|
98
98
|
|
|
99
|
-
if (validates) {
|
|
100
99
|
context.debug(`...validated the '${propertyAssertionString}' property assertion.`);
|
|
101
100
|
}
|
|
102
101
|
}
|
|
@@ -172,30 +171,20 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
172
171
|
return validatesWhenDerived;
|
|
173
172
|
}
|
|
174
173
|
|
|
175
|
-
assign(assignments, context) {
|
|
174
|
+
assign(assignments, stated, context) {
|
|
176
175
|
if (assignments === null) {
|
|
177
176
|
return;
|
|
178
177
|
}
|
|
179
178
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
termNode = this.term.getNode();
|
|
184
|
-
|
|
185
|
-
variable = Variable.fromTermNode(termNode, context);
|
|
186
|
-
|
|
187
|
-
if (variable !== null) {
|
|
188
|
-
const variableIdentifier = variable.getIdentifier();
|
|
189
|
-
|
|
190
|
-
variable = context.findVariableByVariableIdentifier(variableIdentifier);
|
|
191
|
-
|
|
192
|
-
variable = Variable.fromVariableAndPropertyRelation(variable, this.propertyRelation);
|
|
179
|
+
if (!stated) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
193
182
|
|
|
194
|
-
|
|
195
|
-
|
|
183
|
+
const propertyAssertion = this, ///
|
|
184
|
+
variableAssigment = variableAssignmentFromPrepertyAssertion(propertyAssertion, context),
|
|
185
|
+
assignment = variableAssigment; ///
|
|
196
186
|
|
|
197
|
-
|
|
198
|
-
}
|
|
187
|
+
assignments.push(assignment);
|
|
199
188
|
}
|
|
200
189
|
|
|
201
190
|
static name = "PropertyAssertion";
|
|
@@ -54,6 +54,10 @@ export default define(class SatisfiesAssertion extends Assertion {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
if (validates) {
|
|
57
|
+
const assertion = this; ///
|
|
58
|
+
|
|
59
|
+
context.addAssertion(assertion);
|
|
60
|
+
|
|
57
61
|
context.debug(`...validated the '${satisfiesAssertionString}' satisfies assertion.`);
|
|
58
62
|
}
|
|
59
63
|
}
|
|
@@ -48,6 +48,10 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
if (validates) {
|
|
51
|
+
const assertion = this; ///
|
|
52
|
+
|
|
53
|
+
context.addAssertion(assertion);
|
|
54
|
+
|
|
51
55
|
context.debug(`...validated the '${subproofAssertionString}' subproof assertion.`);
|
|
52
56
|
}
|
|
53
57
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import elements from "../../elements";
|
|
4
3
|
import Assertion from "../assertion";
|
|
5
4
|
|
|
6
5
|
import { define } from "../../elements";
|
|
7
|
-
import {
|
|
6
|
+
import { variableAssignmentFromTypeAssertion } from "../../process/assign";
|
|
8
7
|
|
|
9
8
|
export default define(class TypeAssertion extends Assertion {
|
|
10
9
|
constructor(context, string, node, term, type) {
|
|
@@ -29,49 +28,57 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
29
28
|
return typeAssertionNode;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
let
|
|
31
|
+
validate(assignments, stated, context) {
|
|
32
|
+
let validates = false;
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
const typeAssertionString = this.getString(); ///
|
|
36
35
|
|
|
37
|
-
context.trace(`
|
|
36
|
+
context.trace(`Validating the '${typeAssertionString}' type assertion...`);
|
|
38
37
|
|
|
39
|
-
const
|
|
38
|
+
const valid = this.isValid();
|
|
40
39
|
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
verifiesWhenDerived = false;
|
|
40
|
+
if (valid) {
|
|
41
|
+
validates = true;
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
verifiesWhenDerived = this.verifyWhenDerived(context);
|
|
49
|
-
}
|
|
43
|
+
context.debug(`...the '${typeAssertionString}' type assertion is already valid.`);
|
|
44
|
+
} else {
|
|
45
|
+
const typeValidates = this.validateType(context);
|
|
50
46
|
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
if (typeValidates) {
|
|
48
|
+
let validatesWhenStated = false,
|
|
49
|
+
validatesWhenDerived = false;
|
|
50
|
+
|
|
51
|
+
if (stated) {
|
|
52
|
+
validatesWhenStated = this.validateWhenStated(assignments, context);
|
|
53
|
+
} else {
|
|
54
|
+
validatesWhenDerived = this.validateWhenDerived(context);
|
|
55
|
+
}
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
if (validatesWhenStated || validatesWhenDerived) {
|
|
58
|
+
validates = true;
|
|
59
|
+
}
|
|
59
60
|
}
|
|
60
|
-
}
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
if (validates) {
|
|
63
|
+
const assertion = this; ///
|
|
64
|
+
|
|
65
|
+
context.addAssertion(assertion);
|
|
66
|
+
|
|
67
|
+
this.assign(assignments, stated, context);
|
|
68
|
+
|
|
69
|
+
context.debug(`...verified the '${typeAssertionString}' type assertion.`);
|
|
70
|
+
}
|
|
64
71
|
}
|
|
65
72
|
|
|
66
|
-
return
|
|
73
|
+
return validates;
|
|
67
74
|
}
|
|
68
75
|
|
|
69
|
-
|
|
70
|
-
let
|
|
76
|
+
validateType(context) {
|
|
77
|
+
let typeValidates;
|
|
71
78
|
|
|
72
79
|
const typeString = this.type.getString();
|
|
73
80
|
|
|
74
|
-
context.trace(`
|
|
81
|
+
context.trace(`Validating the '${typeString}' type...`);
|
|
75
82
|
|
|
76
83
|
const nominalTypeName = this.type.getNominalTypeName(),
|
|
77
84
|
type = context.findTypeByNominalTypeName(nominalTypeName);
|
|
@@ -79,58 +86,58 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
79
86
|
if (type !== null) {
|
|
80
87
|
this.type = type;
|
|
81
88
|
|
|
82
|
-
|
|
89
|
+
typeValidates = true;
|
|
83
90
|
} else {
|
|
84
91
|
context.debug(`The '${typeString}' type is not present.`);
|
|
85
92
|
}
|
|
86
93
|
|
|
87
|
-
if (
|
|
94
|
+
if (typeValidates) {
|
|
88
95
|
context.debug(`...verified the '${typeString}' type.`);
|
|
89
96
|
}
|
|
90
97
|
|
|
91
|
-
return
|
|
98
|
+
return typeValidates;
|
|
92
99
|
}
|
|
93
100
|
|
|
94
|
-
|
|
95
|
-
let
|
|
101
|
+
validateWhenStated(assignments, context) {
|
|
102
|
+
let validatesWhenStated = false;
|
|
96
103
|
|
|
97
104
|
const typeAssertionString = this.getString(); ///
|
|
98
105
|
|
|
99
|
-
context.trace(`
|
|
106
|
+
context.trace(`Validating the '${typeAssertionString}' stated type assertion...`);
|
|
100
107
|
|
|
101
|
-
const
|
|
102
|
-
let
|
|
108
|
+
const termValidates = this.term.validate(context, () => {
|
|
109
|
+
let validatesForwards;
|
|
103
110
|
|
|
104
111
|
const termType = this.term.getType(),
|
|
105
112
|
typeEqualToOrSubTypeOfTermType = this.type.isEqualToOrSubTypeOf(termType);
|
|
106
113
|
|
|
107
114
|
if (typeEqualToOrSubTypeOfTermType) {
|
|
108
|
-
|
|
115
|
+
validatesForwards = true;
|
|
109
116
|
}
|
|
110
117
|
|
|
111
|
-
return
|
|
118
|
+
return validatesForwards;
|
|
112
119
|
});
|
|
113
120
|
|
|
114
|
-
if (
|
|
115
|
-
|
|
121
|
+
if (termValidates) {
|
|
122
|
+
validatesWhenStated = true;
|
|
116
123
|
}
|
|
117
124
|
|
|
118
|
-
if (
|
|
125
|
+
if (validatesWhenStated) {
|
|
119
126
|
context.debug(`...verified the '${typeAssertionString}' stated type assertion.`);
|
|
120
127
|
}
|
|
121
128
|
|
|
122
|
-
return
|
|
129
|
+
return validatesWhenStated;
|
|
123
130
|
}
|
|
124
131
|
|
|
125
|
-
|
|
126
|
-
let
|
|
132
|
+
validateWhenDerived(context) {
|
|
133
|
+
let validatesWhenDerived;
|
|
127
134
|
|
|
128
135
|
const typeAssertionString = this.getString(); ///
|
|
129
136
|
|
|
130
|
-
context.trace(`
|
|
137
|
+
context.trace(`Validating the '${typeAssertionString}' derived type assertion...`);
|
|
131
138
|
|
|
132
|
-
const
|
|
133
|
-
let
|
|
139
|
+
const termValidates = this.term.validate(context, () => {
|
|
140
|
+
let validatesForwards = false;
|
|
134
141
|
|
|
135
142
|
const termType = this.term.getType(),
|
|
136
143
|
termTypeProvisional = termType.isProvisional();
|
|
@@ -138,52 +145,35 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
138
145
|
if (!termTypeProvisional) {
|
|
139
146
|
const typeEqualToOrSuperTypeOfTermType = this.type.isEqualToOrSuperTypeOf(termType);
|
|
140
147
|
|
|
141
|
-
|
|
148
|
+
validatesForwards = typeEqualToOrSuperTypeOfTermType; ///
|
|
142
149
|
}
|
|
143
150
|
|
|
144
|
-
return
|
|
151
|
+
return validatesForwards;
|
|
145
152
|
});
|
|
146
153
|
|
|
147
|
-
|
|
154
|
+
validatesWhenDerived = termValidates; ///
|
|
148
155
|
|
|
149
|
-
if (
|
|
156
|
+
if (validatesWhenDerived) {
|
|
150
157
|
context.debug(`...verified the '${typeAssertionString}' derived type assertion.`);
|
|
151
158
|
}
|
|
152
159
|
|
|
153
|
-
return
|
|
160
|
+
return validatesWhenDerived;
|
|
154
161
|
}
|
|
155
162
|
|
|
156
|
-
assign(assignments, context) {
|
|
163
|
+
assign(assignments, stated, context) {
|
|
157
164
|
if (assignments === null) {
|
|
158
165
|
return;
|
|
159
166
|
}
|
|
160
167
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
let type,
|
|
165
|
-
provisional;
|
|
166
|
-
|
|
167
|
-
provisional = this.type.isProvisional();
|
|
168
|
-
|
|
169
|
-
if (!provisional) {
|
|
170
|
-
type = this.type;
|
|
171
|
-
} else {
|
|
172
|
-
provisional = false;
|
|
173
|
-
|
|
174
|
-
type = Type.fromTypeAndProvisional(this.type, provisional);
|
|
168
|
+
if (!stated) {
|
|
169
|
+
return;
|
|
175
170
|
}
|
|
176
171
|
|
|
177
|
-
const
|
|
172
|
+
const typeAssertion = this, ///
|
|
173
|
+
variableAssigment = variableAssignmentFromTypeAssertion(typeAssertion, context),
|
|
174
|
+
assignment = variableAssigment; ///
|
|
178
175
|
|
|
179
|
-
|
|
180
|
-
const variableNode = singularVariableNode, ///
|
|
181
|
-
variable = Variable.fromVariableNodeAndType(variableNode, type, context),
|
|
182
|
-
variableAssignment = variableAssignmentFromVariable(variable),
|
|
183
|
-
assignment = variableAssignment; ///
|
|
184
|
-
|
|
185
|
-
assignments.push(assignment);
|
|
186
|
-
}
|
|
176
|
+
assignments.push(assignment);
|
|
187
177
|
}
|
|
188
178
|
|
|
189
179
|
static name = "TypeAssertion";
|
package/src/element/assertion.js
CHANGED
|
@@ -3,10 +3,6 @@
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
export default class Assertion extends Element {
|
|
6
|
-
constructor(context, string, node) {
|
|
7
|
-
super(context, string, node);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
6
|
getAssertionNode() {
|
|
11
7
|
const node = this.getNode(),
|
|
12
8
|
assertionNode = node; ///
|
|
@@ -21,9 +17,9 @@ export default class Assertion extends Element {
|
|
|
21
17
|
|
|
22
18
|
const assertionNodeB = assertionNode, ///
|
|
23
19
|
assertionNodeAAMatchesAssertionBNodeB = assertionNodeA.match(assertionNodeB),
|
|
24
|
-
|
|
20
|
+
assertionNodeMatches = assertionNodeAAMatchesAssertionBNodeB; ///
|
|
25
21
|
|
|
26
|
-
return
|
|
22
|
+
return assertionNodeMatches;
|
|
27
23
|
}
|
|
28
24
|
|
|
29
25
|
isValid(context) {
|
|
@@ -36,8 +32,8 @@ export default class Assertion extends Element {
|
|
|
36
32
|
|
|
37
33
|
isEqualTo(assertion) {
|
|
38
34
|
const assertionNode = assertion.getNode(),
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
assertionNodeMatches = this.matchAssertionNode(assertionNode),
|
|
36
|
+
equalTo = assertionNodeMatches; ///
|
|
41
37
|
|
|
42
38
|
return equalTo;
|
|
43
39
|
}
|
|
@@ -14,16 +14,35 @@ export default define(class Assumption extends Element {
|
|
|
14
14
|
this.reference = reference;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
getReference() {
|
|
18
|
+
return this.reference;
|
|
19
|
+
}
|
|
20
|
+
|
|
17
21
|
getStatement() {
|
|
18
22
|
return this.statement;
|
|
19
23
|
}
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
getAssumptionNode() {
|
|
26
|
+
const node = this.getNode(),
|
|
27
|
+
assumptionNode = node; ///
|
|
28
|
+
|
|
29
|
+
return assumptionNode;
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
getMetavariable() { return this.reference.getMetavariable(); }
|
|
26
33
|
|
|
34
|
+
matchAssumptionNode(assumptionode) {
|
|
35
|
+
const assumptionodeA = assumptionode; ///
|
|
36
|
+
|
|
37
|
+
assumptionode = this.getAssumptionNode();
|
|
38
|
+
|
|
39
|
+
const assumptionodeB = assumptionode, ///
|
|
40
|
+
assumptionodeAAMatchesAssumptionBNodeB = assumptionodeA.match(assumptionodeB),
|
|
41
|
+
assumptionodeMatches = assumptionodeAAMatchesAssumptionBNodeB; ///
|
|
42
|
+
|
|
43
|
+
return assumptionodeMatches;
|
|
44
|
+
}
|
|
45
|
+
|
|
27
46
|
compareSubstitution(substitution, context) {
|
|
28
47
|
let comparesToSubstituion = false;
|
|
29
48
|
|
|
@@ -48,6 +67,14 @@ export default define(class Assumption extends Element {
|
|
|
48
67
|
return comparesToSubstituion;
|
|
49
68
|
}
|
|
50
69
|
|
|
70
|
+
isValid(context) {
|
|
71
|
+
const assumptionNode = this.getAssumptionNode(),
|
|
72
|
+
assumptionPresent = context.isAssumptionPresentByAssumptionNode(assumptionNode),
|
|
73
|
+
valid = assumptionPresent; ///
|
|
74
|
+
|
|
75
|
+
return valid;
|
|
76
|
+
}
|
|
77
|
+
|
|
51
78
|
validate(assignments, stated, context) {
|
|
52
79
|
let validates = false;
|
|
53
80
|
|
|
@@ -55,29 +82,41 @@ export default define(class Assumption extends Element {
|
|
|
55
82
|
|
|
56
83
|
context.trace(`Validating the '${assumptionString}' assumption...`);
|
|
57
84
|
|
|
58
|
-
const
|
|
85
|
+
const valid = this.isValid(context);
|
|
59
86
|
|
|
60
|
-
if (
|
|
61
|
-
|
|
87
|
+
if (valid) {
|
|
88
|
+
validates = true;
|
|
62
89
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
90
|
+
context.debug(`...the '${assumptionString}' assumption is already valid.`);
|
|
91
|
+
} else {
|
|
92
|
+
const referenceValidates = this.validateReference(assignments, stated, context);
|
|
66
93
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
} else {
|
|
70
|
-
validatesWhenDerived = this.validateWhenDerived(context);
|
|
71
|
-
}
|
|
94
|
+
if (referenceValidates) {
|
|
95
|
+
const statementValidates = this.validateStatement(assignments, stated, context);
|
|
72
96
|
|
|
73
|
-
if (
|
|
74
|
-
|
|
97
|
+
if (statementValidates) {
|
|
98
|
+
let validatesWhenStated = false,
|
|
99
|
+
validatesWhenDerived = false;
|
|
100
|
+
|
|
101
|
+
if (stated) {
|
|
102
|
+
validatesWhenStated = this.validateWhenStated(assignments, context);
|
|
103
|
+
} else {
|
|
104
|
+
validatesWhenDerived = this.validateWhenDerived(context);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (validatesWhenStated || validatesWhenDerived) {
|
|
108
|
+
validates = true;
|
|
109
|
+
}
|
|
75
110
|
}
|
|
76
111
|
}
|
|
77
|
-
}
|
|
78
112
|
|
|
79
|
-
|
|
80
|
-
|
|
113
|
+
if (validates) {
|
|
114
|
+
const assumption = this; ///
|
|
115
|
+
|
|
116
|
+
context.addAssumption(assumption);
|
|
117
|
+
|
|
118
|
+
context.debug(`...validated the '${assumptionString}' assumption.`);
|
|
119
|
+
}
|
|
81
120
|
}
|
|
82
121
|
|
|
83
122
|
return validates;
|
|
@@ -17,6 +17,13 @@ export default define(class Conclusion extends Element {
|
|
|
17
17
|
return this.statement;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
getConclusionNode() {
|
|
21
|
+
const node = this.getNode(),
|
|
22
|
+
conclusionNode = node; ///
|
|
23
|
+
|
|
24
|
+
return conclusionNode;
|
|
25
|
+
}
|
|
26
|
+
|
|
20
27
|
verify(context) {
|
|
21
28
|
let verifies = false;
|
|
22
29
|
|
|
@@ -17,6 +17,13 @@ export default define(class Constructor extends Element {
|
|
|
17
17
|
return this.term;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
getConclusionNode() {
|
|
21
|
+
const node = this.getNode(),
|
|
22
|
+
constructorNode = node; ///
|
|
23
|
+
|
|
24
|
+
return constructorNode;
|
|
25
|
+
}
|
|
26
|
+
|
|
20
27
|
isProvisional() { return this.term.isProvisional(); }
|
|
21
28
|
|
|
22
29
|
getType() { return this.term.getType(); }
|
package/src/element/deduction.js
CHANGED
|
@@ -17,6 +17,13 @@ export default define(class Deduction extends Element {
|
|
|
17
17
|
return this.statement;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
getDeductionNode() {
|
|
21
|
+
const node = this.getNode(),
|
|
22
|
+
deductionNode = node; ///
|
|
23
|
+
|
|
24
|
+
return deductionNode;
|
|
25
|
+
}
|
|
26
|
+
|
|
20
27
|
verify(context) {
|
|
21
28
|
let verifies = false;
|
|
22
29
|
|
|
@@ -21,6 +21,13 @@ export default define(class Derivation extends Element {
|
|
|
21
21
|
return this.subproofOrProofAssertions;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
getDerivationNode() {
|
|
25
|
+
const node = this.getNode(),
|
|
26
|
+
derivationNode = node; ///
|
|
27
|
+
|
|
28
|
+
return derivationNode;
|
|
29
|
+
}
|
|
30
|
+
|
|
24
31
|
getLastProofAssertion() {
|
|
25
32
|
const lastSubproofOrProofAssertion = last(this.subproofOrProofAssertions),
|
|
26
33
|
lastProofAssertion = lastSubproofOrProofAssertion; ///
|
|
@@ -36,13 +43,11 @@ export default define(class Derivation extends Element {
|
|
|
36
43
|
subproofOrProofAssertionVerifies = await subproofOrProofAssertion.verify(assignments, context);
|
|
37
44
|
|
|
38
45
|
if (subproofOrProofAssertionVerifies) {
|
|
39
|
-
|
|
46
|
+
assignAssignments(assignments, context);
|
|
40
47
|
|
|
41
|
-
|
|
42
|
-
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
48
|
+
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
43
49
|
|
|
44
|
-
|
|
45
|
-
}
|
|
50
|
+
return true;
|
|
46
51
|
}
|
|
47
52
|
});
|
|
48
53
|
|