occam-verify-cli 1.0.438 → 1.0.448
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/file.js +42 -39
- package/lib/context/local.js +34 -34
- package/lib/context/release.js +3 -7
- package/lib/context/temporary.js +26 -26
- package/lib/element/assertion/contained.js +45 -45
- package/lib/element/assertion/defined.js +13 -13
- package/lib/element/assertion/property.js +23 -22
- package/lib/element/assertion/satisfies.js +7 -6
- package/lib/element/assertion/subproof.js +20 -17
- package/lib/element/assertion/type.js +3 -2
- package/lib/element/assertion.js +1 -23
- package/lib/element/assumption.js +24 -22
- package/lib/element/axiom.js +27 -30
- package/lib/element/axiomLemmaTheoremConjecture.js +50 -57
- package/lib/element/{statement/combinator → combinator}/bracketed.js +16 -16
- package/lib/element/combinator.js +229 -0
- package/lib/element/conclusion.js +11 -9
- package/lib/element/{term/constructor → constructor}/bracketed.js +5 -5
- package/lib/element/constructor.js +232 -0
- package/lib/element/declaration/combinator.js +2 -16
- package/lib/element/declaration/complexType.js +12 -12
- package/lib/element/declaration/constructor.js +13 -11
- package/lib/element/declaration/simpleType.js +4 -4
- package/lib/element/declaration/typePrefix.js +2 -2
- package/lib/element/declaration/variable.js +3 -3
- package/lib/element/deduction.js +11 -9
- package/lib/element/derivation.js +17 -20
- package/lib/element/equivalence.js +10 -10
- package/lib/element/equivalences.js +5 -5
- package/lib/element/frame.js +32 -38
- package/lib/element/hypothesis.js +16 -57
- package/lib/element/judgement.js +6 -4
- package/lib/element/label.js +8 -8
- package/lib/element/metaLemmaMetatheorem.js +6 -39
- package/lib/element/metaType.js +17 -80
- package/lib/element/metavariable.js +38 -34
- package/lib/element/parameter.js +3 -3
- package/lib/element/premise.js +92 -174
- package/lib/element/proof.js +7 -7
- package/lib/element/proofAssertion.js +203 -0
- package/lib/element/property.js +9 -9
- package/lib/element/propertyRelation.js +13 -13
- package/lib/element/reference.js +16 -17
- package/lib/element/rule.js +46 -46
- package/lib/element/signature.js +11 -11
- package/lib/element/statement.js +18 -18
- package/lib/element/step.js +73 -124
- package/lib/element/subDerivation.js +17 -20
- package/lib/element/subproof.js +16 -24
- package/lib/element/substitution/frame.js +1 -7
- package/lib/element/substitution/reference.js +2 -3
- package/lib/element/substitution/statement.js +44 -15
- package/lib/element/substitution/term.js +10 -57
- package/lib/element/substitution.js +5 -11
- package/lib/element/substitutions.js +29 -29
- package/lib/element/supposition.js +95 -177
- package/lib/element/term.js +21 -34
- package/lib/element/type.js +47 -60
- package/lib/element/typePrefix.js +5 -5
- package/lib/element/variable.js +9 -9
- package/lib/element.js +9 -3
- package/lib/metaTypes.js +63 -0
- package/lib/node/axiomLemmaTheoremConjecture.js +9 -9
- package/lib/node/body/axiom.js +2 -25
- package/lib/node/body/conjecture.js +2 -25
- package/lib/node/body/lemma.js +2 -25
- package/lib/node/body/metaLemma.js +2 -25
- package/lib/node/body/metatheorem.js +2 -25
- package/lib/node/body/rule.js +15 -1
- package/lib/node/body/theorem.js +2 -25
- package/lib/node/body.js +25 -2
- package/lib/node/combinator.js +11 -2
- package/lib/node/constructor.js +11 -2
- package/lib/node/declaration/combinator.js +5 -5
- package/lib/node/declaration/constructor.js +8 -8
- package/lib/node/declaration/property.js +15 -15
- package/lib/node/declaration/simpleType.js +31 -31
- package/lib/node/declaration/variable.js +8 -8
- package/lib/node/equality.js +8 -8
- package/lib/node/frame.js +20 -20
- package/lib/node/header.js +22 -22
- package/lib/node/metaLemmaMetaTheorem.js +16 -16
- package/lib/node/metavariable.js +15 -15
- package/lib/node/property.js +8 -8
- package/lib/node/propertyRelation.js +8 -8
- package/lib/node/rule.js +16 -16
- package/lib/node/statement.js +12 -12
- package/lib/node/step.js +22 -22
- package/lib/node/subDerivation.js +1 -8
- package/lib/node/subproof.js +5 -12
- package/lib/node/substitution/frame.js +19 -19
- package/lib/node/substitution/statement.js +19 -19
- package/lib/node/substitution/term.js +19 -19
- package/lib/node/term.js +35 -35
- package/lib/preamble.js +5 -5
- package/lib/process/instantiate.js +20 -2
- package/lib/process/unify.js +39 -42
- package/lib/process/validate.js +431 -0
- package/lib/process/verify.js +44 -135
- package/lib/types.js +27 -0
- package/lib/utilities/brackets.js +9 -14
- package/lib/utilities/element.js +91 -55
- package/lib/utilities/instance.js +41 -28
- package/lib/utilities/statement.js +2 -2
- package/lib/utilities/string.js +25 -14
- package/lib/utilities/unification.js +237 -0
- package/lib/utilities/validation.js +251 -0
- package/package.json +6 -6
- package/src/context/file.js +40 -34
- package/src/context/local.js +34 -34
- package/src/context/release.js +2 -6
- package/src/context/temporary.js +15 -15
- package/src/element/assertion/contained.js +19 -20
- package/src/element/assertion/defined.js +11 -12
- package/src/element/assertion/property.js +20 -20
- package/src/element/assertion/satisfies.js +6 -6
- package/src/element/assertion/subproof.js +17 -15
- package/src/element/assertion/type.js +2 -2
- package/src/element/assertion.js +0 -2
- package/src/element/assumption.js +22 -19
- package/src/element/axiom.js +33 -37
- package/src/element/axiomLemmaTheoremConjecture.js +54 -73
- package/src/element/{statement/combinator → combinator}/bracketed.js +7 -7
- package/src/element/combinator.js +90 -0
- package/src/element/conclusion.js +12 -10
- package/src/element/{term/constructor → constructor}/bracketed.js +5 -5
- package/src/element/{term/constructor.js → constructor.js} +17 -25
- package/src/element/declaration/combinator.js +1 -22
- package/src/element/declaration/complexType.js +11 -11
- package/src/element/declaration/constructor.js +13 -10
- package/src/element/declaration/simpleType.js +3 -3
- package/src/element/declaration/typePrefix.js +1 -1
- package/src/element/declaration/variable.js +2 -2
- package/src/element/deduction.js +12 -9
- package/src/element/derivation.js +15 -19
- package/src/element/equivalence.js +8 -8
- package/src/element/equivalences.js +4 -4
- package/src/element/frame.js +28 -30
- package/src/element/hypothesis.js +16 -18
- package/src/element/judgement.js +6 -3
- package/src/element/label.js +4 -4
- package/src/element/metaLemmaMetatheorem.js +5 -69
- package/src/element/metaType.js +9 -45
- package/src/element/metavariable.js +34 -31
- package/src/element/parameter.js +2 -2
- package/src/element/premise.js +124 -99
- package/src/element/proof.js +6 -6
- package/src/element/proofAssertion.js +76 -0
- package/src/element/property.js +6 -6
- package/src/element/propertyRelation.js +11 -11
- package/src/element/reference.js +14 -21
- package/src/element/rule.js +39 -38
- package/src/element/signature.js +10 -9
- package/src/element/statement.js +16 -18
- package/src/element/step.js +78 -78
- package/src/element/subDerivation.js +15 -19
- package/src/element/subproof.js +11 -19
- package/src/element/substitution/frame.js +0 -2
- package/src/element/substitution/reference.js +1 -5
- package/src/element/substitution/statement.js +44 -14
- package/src/element/substitution/term.js +10 -13
- package/src/element/substitution.js +3 -5
- package/src/element/substitutions.js +48 -30
- package/src/element/supposition.js +127 -108
- package/src/element/term.js +18 -28
- package/src/element/type.js +42 -36
- package/src/element/typePrefix.js +3 -3
- package/src/element/variable.js +7 -7
- package/src/element.js +3 -1
- package/src/metaTypes.js +55 -0
- package/src/node/axiomLemmaTheoremConjecture.js +6 -6
- package/src/node/body/axiom.js +0 -21
- package/src/node/body/conjecture.js +0 -23
- package/src/node/body/lemma.js +0 -23
- package/src/node/body/metaLemma.js +0 -23
- package/src/node/body/metatheorem.js +0 -23
- package/src/node/body/rule.js +12 -0
- package/src/node/body/theorem.js +0 -23
- package/src/node/body.js +23 -0
- package/src/node/combinator.js +9 -0
- package/src/node/constructor.js +9 -0
- package/src/node/declaration/combinator.js +5 -5
- package/src/node/declaration/constructor.js +8 -8
- package/src/node/declaration/property.js +14 -14
- package/src/node/declaration/simpleType.js +31 -31
- package/src/node/declaration/variable.js +7 -7
- package/src/node/equality.js +7 -7
- package/src/node/frame.js +21 -21
- package/src/node/header.js +22 -22
- package/src/node/metaLemmaMetaTheorem.js +14 -14
- package/src/node/metavariable.js +14 -14
- package/src/node/property.js +7 -7
- package/src/node/propertyRelation.js +7 -7
- package/src/node/rule.js +15 -15
- package/src/node/statement.js +12 -12
- package/src/node/step.js +21 -21
- package/src/node/subDerivation.js +0 -7
- package/src/node/subproof.js +4 -11
- package/src/node/substitution/frame.js +18 -18
- package/src/node/substitution/statement.js +18 -18
- package/src/node/substitution/term.js +18 -18
- package/src/node/term.js +34 -34
- package/src/preamble.js +4 -4
- package/src/process/instantiate.js +12 -0
- package/src/process/unify.js +53 -57
- package/src/process/validate.js +316 -0
- package/src/process/verify.js +50 -138
- package/src/types.js +18 -0
- package/src/utilities/brackets.js +15 -14
- package/src/utilities/element.js +125 -82
- package/src/utilities/instance.js +42 -24
- package/src/utilities/statement.js +2 -2
- package/src/utilities/string.js +38 -24
- package/src/{mixins/step/unify.js → utilities/unification.js} +99 -85
- package/src/{mixins/statement/validate.js → utilities/validation.js} +143 -69
- package/lib/element/statement/combinator.js +0 -105
- package/lib/element/term/constructor.js +0 -172
- package/lib/mixins/statement/validate.js +0 -198
- package/lib/mixins/step/unify.js +0 -228
- package/lib/mixins/term/verify.js +0 -65
- package/src/element/statement/combinator.js +0 -59
- package/src/mixins/term/verify.js +0 -81
package/src/element/premise.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import elements from "../elements";
|
|
3
|
+
import ProofAssertion from "./proofAssertion";
|
|
5
4
|
import TemporaryContext from "../context/temporary";
|
|
6
5
|
import assignAssignments from "../process/assign";
|
|
7
6
|
|
|
8
7
|
import { define } from "../elements";
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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 {
|
|
13
18
|
constructor(context, string, node, statement, procedureCall) {
|
|
14
|
-
super(context, string, node);
|
|
19
|
+
super(context, string, node, statement);
|
|
15
20
|
|
|
16
|
-
this.statement = statement;
|
|
17
21
|
this.procedureCall = procedureCall;
|
|
18
22
|
}
|
|
19
23
|
|
|
20
|
-
getStatement() {
|
|
21
|
-
return this.statement;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
24
|
getProcedureCall() {
|
|
25
25
|
return this.procedureCall;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
let
|
|
28
|
+
verify(context) {
|
|
29
|
+
let verifies = false;
|
|
30
30
|
|
|
31
31
|
const temporaryContext = TemporaryContext.fromNothing(context);
|
|
32
32
|
|
|
@@ -35,60 +35,71 @@ export default define(class Premise extends Element {
|
|
|
35
35
|
const node = this.getNode(),
|
|
36
36
|
premiseString = this.getString(); ///
|
|
37
37
|
|
|
38
|
-
context.trace(`
|
|
38
|
+
context.trace(`Verifying the '${premiseString}' premise...`, node);
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
const statement = this.getStatement();
|
|
41
|
+
|
|
42
|
+
if ((statement === null) && (this.procedureCall === null)) {
|
|
43
|
+
context.debug(`Unable to verify the '${premiseString}' premise because it is nonsense.`, node);
|
|
44
|
+
} else {
|
|
45
|
+
if (statement !== null) {
|
|
46
|
+
const stated = true,
|
|
47
|
+
assignments = [],
|
|
48
|
+
statementValidates = statement.validate(assignments, stated, context);
|
|
46
49
|
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
if (statementValidates) {
|
|
51
|
+
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
49
52
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
step = Step.fromStatement(this.statement, context),
|
|
53
|
-
stepOrSubproof = step; ///
|
|
53
|
+
if (assignmentsAssigned) {
|
|
54
|
+
const subproofOrProofAssertion = this; ///
|
|
54
55
|
|
|
55
|
-
|
|
56
|
+
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
verifies = true;
|
|
59
|
+
}
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
|
-
} else if (this.procedureCall !== null) {
|
|
61
|
-
const stated = true,
|
|
62
|
-
assignments = null,
|
|
63
|
-
procedureCallVerifies = this.procedureCall.verify(assignments, stated, context);
|
|
64
62
|
|
|
65
|
-
if (
|
|
66
|
-
|
|
63
|
+
if (this.procedureCall !== null) {
|
|
64
|
+
const stated = true,
|
|
65
|
+
assignments = null,
|
|
66
|
+
procedureCallVerifies = this.procedureCall.verify(assignments, stated, context);
|
|
67
|
+
|
|
68
|
+
if (procedureCallVerifies) {
|
|
69
|
+
verifies = true;
|
|
70
|
+
}
|
|
67
71
|
}
|
|
68
|
-
} else {
|
|
69
|
-
context.debug(`Unable to validate the '${premiseString}' premise because it is nonsense.`, node);
|
|
70
72
|
}
|
|
71
73
|
|
|
72
|
-
if (
|
|
74
|
+
if (verifies) {
|
|
73
75
|
this.setContext(context);
|
|
74
76
|
|
|
75
|
-
context.debug(`...
|
|
77
|
+
context.debug(`...verified the '${premiseString}' premise.`, node);
|
|
76
78
|
}
|
|
77
79
|
|
|
78
|
-
return
|
|
80
|
+
return verifies;
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
unifyIndependently(substitutions, context) {
|
|
82
84
|
let unifiesIndependently = false;
|
|
83
85
|
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
specificContext = context; ///
|
|
86
|
+
const node = this.getNode(),
|
|
87
|
+
premiseString = this.getString(); ///
|
|
87
88
|
|
|
88
89
|
context.trace(`Unifying the '${premiseString}' premise independently...`, node);
|
|
89
90
|
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
const generalContext = context; ///
|
|
92
|
+
|
|
93
|
+
context = this.getContext();
|
|
94
|
+
|
|
95
|
+
const specificContext = context; ///
|
|
96
|
+
|
|
97
|
+
context = specificContext; ///
|
|
98
|
+
|
|
99
|
+
const statement = this.getStatement();
|
|
100
|
+
|
|
101
|
+
if (statement !== null) {
|
|
102
|
+
const statementUnifiesIndependently = statement.unifyIndependently(substitutions, generalContext, specificContext);
|
|
92
103
|
|
|
93
104
|
if (statementUnifiesIndependently) {
|
|
94
105
|
unifiesIndependently = true;
|
|
@@ -110,104 +121,118 @@ export default define(class Premise extends Element {
|
|
|
110
121
|
return unifiesIndependently;
|
|
111
122
|
}
|
|
112
123
|
|
|
113
|
-
|
|
114
|
-
let
|
|
124
|
+
unifySubproofOrProofAssertion(subproofOrProofAssertion, substitutions, context) {
|
|
125
|
+
let subproofOrProofAssertionUnifies = false;
|
|
115
126
|
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
127
|
+
const subproofOrProofAssertionProofAssertion = subproofOrProofAssertion.isProofAssertion(),
|
|
128
|
+
proofAssertion = subproofOrProofAssertionProofAssertion ?
|
|
129
|
+
subproofOrProofAssertion :
|
|
130
|
+
null,
|
|
131
|
+
subproof = subproofOrProofAssertionProofAssertion ?
|
|
132
|
+
null :
|
|
133
|
+
subproofOrProofAssertion;
|
|
123
134
|
|
|
124
135
|
substitutions.snapshot();
|
|
125
136
|
|
|
126
137
|
if (subproof !== null) {
|
|
127
138
|
const subproofUnifies = this.unifySubproof(subproof, substitutions, context);
|
|
128
139
|
|
|
129
|
-
|
|
140
|
+
if (subproofUnifies) {
|
|
141
|
+
subproofOrProofAssertionUnifies = true;
|
|
142
|
+
}
|
|
130
143
|
}
|
|
131
144
|
|
|
132
|
-
if (
|
|
133
|
-
const
|
|
145
|
+
if (proofAssertion !== null) {
|
|
146
|
+
const proofAssertionUnifies = this.unifyProofAssertion(proofAssertion, substitutions, context);
|
|
134
147
|
|
|
135
|
-
|
|
148
|
+
if (proofAssertionUnifies) {
|
|
149
|
+
subproofOrProofAssertionUnifies = true;
|
|
150
|
+
}
|
|
136
151
|
}
|
|
137
152
|
|
|
138
|
-
if (
|
|
153
|
+
if (subproofOrProofAssertionUnifies) {
|
|
139
154
|
substitutions.resolve(context);
|
|
140
155
|
}
|
|
141
156
|
|
|
142
|
-
|
|
157
|
+
subproofOrProofAssertionUnifies ?
|
|
143
158
|
substitutions.continue() :
|
|
144
159
|
substitutions.rollback(context);
|
|
145
160
|
|
|
146
|
-
return
|
|
161
|
+
return subproofOrProofAssertionUnifies;
|
|
147
162
|
}
|
|
148
163
|
|
|
149
|
-
|
|
150
|
-
let
|
|
164
|
+
unifyProofAssertion(proofAssertion, substitutions, context) {
|
|
165
|
+
let proofAssertionUnifies = false;
|
|
166
|
+
|
|
167
|
+
const node = this.getNode(),
|
|
168
|
+
premiseString = this.getString(),
|
|
169
|
+
proofAssertionString = proofAssertion.getString();
|
|
151
170
|
|
|
152
|
-
context
|
|
171
|
+
context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${premiseString}' premise...`, node);
|
|
153
172
|
|
|
154
|
-
const
|
|
155
|
-
|
|
173
|
+
const specificContext = context; ///
|
|
174
|
+
|
|
175
|
+
context = this.getContext();
|
|
176
|
+
|
|
177
|
+
const generalContext = context; ///
|
|
178
|
+
|
|
179
|
+
context = specificContext; ///
|
|
180
|
+
|
|
181
|
+
const statement = proofAssertion.getStatement(),
|
|
182
|
+
statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
156
183
|
|
|
157
184
|
if (statementUnifies) {
|
|
158
|
-
|
|
185
|
+
proofAssertionUnifies = true;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (proofAssertionUnifies) {
|
|
189
|
+
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${premiseString}' premise.`, node);
|
|
159
190
|
}
|
|
160
191
|
|
|
161
|
-
return
|
|
192
|
+
return proofAssertionUnifies;
|
|
162
193
|
}
|
|
163
194
|
|
|
164
|
-
unifySubproof(subproof, substitutions,
|
|
195
|
+
unifySubproof(subproof, substitutions, context) {
|
|
165
196
|
let subproofUnifies = false;
|
|
166
197
|
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
premiseStatementString = premiseStatement.getString();
|
|
198
|
+
const node = this.getNode(),
|
|
199
|
+
premiseString = this.getString(),
|
|
200
|
+
subproofString = subproof.getString();
|
|
171
201
|
|
|
172
|
-
|
|
202
|
+
context.trace(`Unifying the '${subproofString}' subproof with the '${premiseString}' premise...`, node);
|
|
173
203
|
|
|
174
|
-
|
|
175
|
-
const context = generalContext,
|
|
176
|
-
subproofAssertion = subproofAssertionFromStatement(this.statement, context);
|
|
204
|
+
const specificContext = context; ///
|
|
177
205
|
|
|
178
|
-
|
|
179
|
-
subproofUnifies = subproofAssertion.unifySubproof(subproof, substitutions, generalContext, specificContext);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
206
|
+
context = this.getContext();
|
|
182
207
|
|
|
183
|
-
|
|
184
|
-
specificContext.debug(`...unified the '${subproofString}' subproof with the premise's '${premiseStatementString}' statement.`);
|
|
185
|
-
}
|
|
208
|
+
const generalContext = context; ///
|
|
186
209
|
|
|
187
|
-
|
|
188
|
-
}
|
|
210
|
+
context = specificContext; ///
|
|
189
211
|
|
|
190
|
-
|
|
191
|
-
let statementUnifies;
|
|
212
|
+
const statement = this.getStatement();
|
|
192
213
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
214
|
+
if (statement !== null) {
|
|
215
|
+
const statementNode = statement.getNode(),
|
|
216
|
+
subproofAssertionNode = statementNode.getSubproofAssertionNode();
|
|
196
217
|
|
|
197
|
-
|
|
218
|
+
if (subproofAssertionNode !== null) {
|
|
219
|
+
const context = generalContext, ///
|
|
220
|
+
assertionNode = subproofAssertionNode, ///
|
|
221
|
+
assertion = context.findAssertionByAssertionNode(assertionNode)
|
|
198
222
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
specificContext = context; ///
|
|
223
|
+
if (assertion !== null) {
|
|
224
|
+
const subproofAssertion = assertion; ///
|
|
202
225
|
|
|
203
|
-
|
|
226
|
+
subproofUnifies = subproofAssertion.unifySubproof(subproof, substitutions, generalContext, specificContext);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
204
229
|
}
|
|
205
230
|
|
|
206
|
-
if (
|
|
207
|
-
context.debug(`...unified the '${
|
|
231
|
+
if (subproofUnifies) {
|
|
232
|
+
context.debug(`...unified the '${subproofString}' subproof with the '${premiseString}' premise.`, node);
|
|
208
233
|
}
|
|
209
234
|
|
|
210
|
-
return
|
|
235
|
+
return subproofUnifies;
|
|
211
236
|
}
|
|
212
237
|
|
|
213
238
|
toJSON() {
|
package/src/element/proof.js
CHANGED
|
@@ -16,12 +16,12 @@ export default define(class Proof extends Element {
|
|
|
16
16
|
return this.derivation;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
getLastProofAssertion() { return this.derivation.getLastProofAssertion(); }
|
|
20
20
|
|
|
21
21
|
getStatement() {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
statement =
|
|
22
|
+
const lastProofAssertion = this.getLastProofAssertion(),
|
|
23
|
+
lastProofAssertionStatement = lastProofAssertion.getStatement(),
|
|
24
|
+
statement = lastProofAssertionStatement; ///
|
|
25
25
|
|
|
26
26
|
return statement;
|
|
27
27
|
}
|
|
@@ -36,9 +36,9 @@ export default define(class Proof extends Element {
|
|
|
36
36
|
const derivationVerifies = this.derivation.verify(substitutions, context);
|
|
37
37
|
|
|
38
38
|
if (derivationVerifies) {
|
|
39
|
-
const
|
|
39
|
+
const lastProofAssertion = context.getLastProofAssertion();
|
|
40
40
|
|
|
41
|
-
if (
|
|
41
|
+
if (lastProofAssertion !== null) {
|
|
42
42
|
const statement = this.getStatement(),
|
|
43
43
|
conclusionStatement = conclusion.getStatement(),
|
|
44
44
|
conclusionStatementEqualToStatement = conclusionStatement.isEqualTo(statement);
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import Element from "../element";
|
|
4
|
+
|
|
5
|
+
import { equateStatements } from "../process/equate";
|
|
6
|
+
|
|
7
|
+
export default class ProofAssertion extends Element {
|
|
8
|
+
constructor(context, string, node, statement) {
|
|
9
|
+
super(context, string, node);
|
|
10
|
+
|
|
11
|
+
this.statement = statement;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
getStatement() {
|
|
15
|
+
return this.statement;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
isProofAssertion() {
|
|
19
|
+
const proofAssertion = true;
|
|
20
|
+
|
|
21
|
+
return proofAssertion;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
compareStatement(statement, context) {
|
|
25
|
+
let comparesToStatement = false;
|
|
26
|
+
|
|
27
|
+
const statementString = statement.getString(),
|
|
28
|
+
proofAssertionString = this.getString();
|
|
29
|
+
|
|
30
|
+
context.trace(`Comparing the '${statementString}' statement to the '${proofAssertionString}' proof assertion...`);
|
|
31
|
+
|
|
32
|
+
const leftStatement = statement, ///
|
|
33
|
+
rightStatement = this.statement, ///
|
|
34
|
+
leftStatementNode = leftStatement.getNode(),
|
|
35
|
+
rightStatementNode = rightStatement.getNode(),
|
|
36
|
+
statementsEquate = equateStatements(leftStatementNode, rightStatementNode, context);
|
|
37
|
+
|
|
38
|
+
if (statementsEquate) {
|
|
39
|
+
comparesToStatement = true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (comparesToStatement) {
|
|
43
|
+
context.debug(`...compared the '${statementString}' statement to the '${proofAssertionString}' proof assertion.`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return comparesToStatement;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
unifyStatement(statement, substitutions, context) {
|
|
50
|
+
let statementUnifies = false;
|
|
51
|
+
|
|
52
|
+
if (this.statement !== null) {
|
|
53
|
+
const node = this.getNode(),
|
|
54
|
+
premiseString = this.getString(), ///
|
|
55
|
+
statementString = statement.getString();
|
|
56
|
+
|
|
57
|
+
context.trace(`Unifying the '${statementString}' statement with the '${premiseString}' premise...`, node);
|
|
58
|
+
|
|
59
|
+
const specificContext = context; ///
|
|
60
|
+
|
|
61
|
+
context = this.getContext(); ///
|
|
62
|
+
|
|
63
|
+
const generalContext = context; ///
|
|
64
|
+
|
|
65
|
+
context = specificContext; ///
|
|
66
|
+
|
|
67
|
+
statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
68
|
+
|
|
69
|
+
if (statementUnifies) {
|
|
70
|
+
context.debug(`...unified the '${statementString}' statement with the '${premiseString}' premise.`, node);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return statementUnifies;
|
|
75
|
+
}
|
|
76
|
+
}
|
package/src/element/property.js
CHANGED
|
@@ -20,16 +20,16 @@ export default define(class Property extends Element {
|
|
|
20
20
|
return this.nominalTypeName;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
const
|
|
23
|
+
comparePropertyName(propertyName) {
|
|
24
|
+
const comparesToPropertyName = (this.name === propertyName);
|
|
25
25
|
|
|
26
|
-
return
|
|
26
|
+
return comparesToPropertyName;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
const
|
|
29
|
+
compareNominalTypeName(nominalTypeName) {
|
|
30
|
+
const comparesToNominalTypeName = (this.nominalTypeName === nominalTypeName);
|
|
31
31
|
|
|
32
|
-
return
|
|
32
|
+
return comparesToNominalTypeName;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
toJSON() {
|
|
@@ -27,9 +27,9 @@ export default define(class PropertyRelation extends Element {
|
|
|
27
27
|
|
|
28
28
|
context.trace(`Verifying the '${propertyRelationString}' property relation...`);
|
|
29
29
|
|
|
30
|
-
const
|
|
30
|
+
const termValidates = this.validateTerm(context);
|
|
31
31
|
|
|
32
|
-
if (
|
|
32
|
+
if (termValidates) {
|
|
33
33
|
const propertyVerifies = this.verifyProperty(context);
|
|
34
34
|
|
|
35
35
|
verifies = propertyVerifies;
|
|
@@ -42,24 +42,24 @@ export default define(class PropertyRelation extends Element {
|
|
|
42
42
|
return verifies;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
let
|
|
45
|
+
validateTerm(context) {
|
|
46
|
+
let termValidates;
|
|
47
47
|
|
|
48
48
|
const termString = this.term.getString();
|
|
49
49
|
|
|
50
|
-
context.trace(`
|
|
50
|
+
context.trace(`Validating the '${termString}' term...`);
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
termValidates = this.term.validate(context, () => {
|
|
53
53
|
const verifiesAhead = true;
|
|
54
54
|
|
|
55
55
|
return verifiesAhead;
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
if (
|
|
59
|
-
context.debug(`...
|
|
58
|
+
if (termValidates) {
|
|
59
|
+
context.debug(`...validated the '${termString}' term.`);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
return
|
|
62
|
+
return termValidates;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
verifyProperty(context) {
|
|
@@ -73,9 +73,9 @@ export default define(class PropertyRelation extends Element {
|
|
|
73
73
|
propertyName = this.property.getName(),
|
|
74
74
|
termTypeProperties = termType.getProperties(),
|
|
75
75
|
variableTypeProperty = termTypeProperties.find((termTypeProperty) => {
|
|
76
|
-
const
|
|
76
|
+
const termTypePropertyComparesToPropertyName = termTypeProperty.comparePropertyName(propertyName);
|
|
77
77
|
|
|
78
|
-
if (
|
|
78
|
+
if (termTypePropertyComparesToPropertyName) {
|
|
79
79
|
return true;
|
|
80
80
|
}
|
|
81
81
|
}) || null;
|
package/src/element/reference.js
CHANGED
|
@@ -4,7 +4,7 @@ import Element from "../element";
|
|
|
4
4
|
import elements from "../elements";
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
|
-
import {
|
|
7
|
+
import { referenceMetaTypeFromNothing } from "../metaTypes";
|
|
8
8
|
import { unifyMetavariableIntrinsically } from "../process/unify";
|
|
9
9
|
import { metavariableFromJSON, metavariableToMetavariableJSON } from "../utilities/json";
|
|
10
10
|
|
|
@@ -35,19 +35,9 @@ export default define(class Reference extends Element {
|
|
|
35
35
|
|
|
36
36
|
isMetavariableEqualToMetavariable(metavariable) { return this.metavariable.isEqualTo(metavariable); }
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
compareMetavariableName(metavariableName) { return this.metavariable.compareMetavariableName(metavariableName); }
|
|
39
39
|
|
|
40
|
-
matchMetavariableNode(metavariableNode) {
|
|
41
|
-
const metavariableNodeA = metavariableNode; ///
|
|
42
|
-
|
|
43
|
-
metavariableNode = this.metavariable.getNode();
|
|
44
|
-
|
|
45
|
-
const metavariableNodeB = metavariableNode, ///
|
|
46
|
-
matches = metavariableNodeA.match(metavariableNodeB),
|
|
47
|
-
metavariableNodeMatches = matches; ///
|
|
48
|
-
|
|
49
|
-
return metavariableNodeMatches; ///
|
|
50
|
-
}
|
|
40
|
+
matchMetavariableNode(metavariableNode) { return this.metavariable.matchNode(metavariableNode); }
|
|
51
41
|
|
|
52
42
|
verify(context) {
|
|
53
43
|
let verifies = false;
|
|
@@ -57,9 +47,9 @@ export default define(class Reference extends Element {
|
|
|
57
47
|
context.trace(`Verifying the '${referenceString}' reference...`);
|
|
58
48
|
|
|
59
49
|
if (!verifies) {
|
|
60
|
-
const
|
|
50
|
+
const metavariableValidates = this.validateMetavariable(context);
|
|
61
51
|
|
|
62
|
-
verifies =
|
|
52
|
+
verifies = metavariableValidates; ///
|
|
63
53
|
}
|
|
64
54
|
|
|
65
55
|
if (!verifies) {
|
|
@@ -80,15 +70,18 @@ export default define(class Reference extends Element {
|
|
|
80
70
|
return verifies;
|
|
81
71
|
}
|
|
82
72
|
|
|
83
|
-
|
|
84
|
-
let
|
|
73
|
+
validateMetavariable(context) {
|
|
74
|
+
let metavariableValidates = false;
|
|
85
75
|
|
|
86
|
-
const
|
|
87
|
-
|
|
76
|
+
const referenceMetaType = referenceMetaTypeFromNothing(),
|
|
77
|
+
metaType = referenceMetaType, ///
|
|
78
|
+
metavariableValidatesGivenMetaType = this.metavariable.validateGivenMetaType(metaType, context);
|
|
88
79
|
|
|
89
|
-
|
|
80
|
+
if (metavariableValidatesGivenMetaType) {
|
|
81
|
+
metavariableValidates = true;
|
|
82
|
+
}
|
|
90
83
|
|
|
91
|
-
return
|
|
84
|
+
return metavariableValidates;
|
|
92
85
|
}
|
|
93
86
|
|
|
94
87
|
unifyLabel(label, substitutions, context) {
|