occam-verify-cli 1.0.220 → 1.0.224
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 +19 -19
- package/lib/context/local.js +5 -43
- package/lib/context/release.js +11 -11
- package/lib/dom/assertion/contained.js +44 -44
- package/lib/dom/assertion/defined.js +40 -40
- package/lib/dom/assertion/property.js +37 -35
- package/lib/dom/assertion/satisfies.js +26 -25
- package/lib/dom/assertion/subproof.js +16 -16
- package/lib/dom/assertion/type.js +34 -32
- package/lib/dom/axiom.js +52 -52
- package/lib/dom/combinator/bracketed.js +5 -5
- package/lib/dom/combinator.js +6 -6
- package/lib/dom/conclusion.js +10 -10
- package/lib/dom/conjecture.js +5 -5
- package/lib/dom/constructor/bracketed.js +12 -12
- package/lib/dom/constructor.js +9 -9
- package/lib/dom/declaration/combinator.js +11 -11
- package/lib/dom/declaration/complexType.js +133 -63
- package/lib/dom/declaration/constructor.js +17 -17
- package/lib/dom/declaration/metavariable.js +17 -17
- package/lib/dom/declaration/simpleType.js +229 -0
- package/lib/dom/declaration/variable.js +17 -17
- package/lib/dom/declaration.js +54 -52
- package/lib/dom/deduction.js +15 -15
- package/lib/dom/derivation.js +8 -8
- package/lib/dom/equality.js +49 -34
- package/lib/dom/error.js +3 -3
- package/lib/dom/frame.js +38 -38
- package/lib/dom/judgement.js +31 -29
- package/lib/dom/label.js +5 -5
- package/lib/dom/lemma.js +5 -5
- package/lib/dom/metaLemma.js +5 -5
- package/lib/dom/metatheorem.js +5 -5
- package/lib/dom/metavariable.js +55 -55
- package/lib/dom/premise.js +36 -34
- package/lib/dom/procedureCall.js +9 -9
- package/lib/dom/proof.js +6 -6
- package/lib/dom/propertyRelation.js +18 -18
- package/lib/dom/reference.js +28 -28
- package/lib/dom/rule.js +63 -48
- package/lib/dom/signature.js +17 -17
- package/lib/dom/statement.js +36 -36
- package/lib/dom/step.js +32 -35
- package/lib/dom/subDerivation.js +8 -8
- package/lib/dom/subproof.js +27 -30
- package/lib/dom/substitution/statement.js +7 -7
- package/lib/dom/substitution/term.js +2 -16
- package/lib/dom/substitution.js +1 -15
- package/lib/dom/supposition.js +39 -39
- package/lib/dom/term.js +15 -15
- package/lib/dom/theorem.js +5 -5
- package/lib/dom/topLevelAssertion.js +60 -71
- package/lib/dom/topLevelMetaAssertion.js +28 -20
- package/lib/dom/type.js +18 -24
- package/lib/dom/variable.js +16 -16
- package/lib/equivalence.js +54 -33
- package/lib/equivalences.js +57 -101
- package/lib/index.js +2 -2
- package/lib/mixins/statement/verify.js +52 -52
- package/lib/mixins/step/unify.js +79 -61
- package/lib/mixins/term/verify.js +17 -17
- package/lib/substitutions.js +7 -7
- package/lib/unifier/equantional.js +170 -0
- package/lib/unifier/intrinsicLevel.js +8 -8
- package/lib/unifier/metaLevel.js +21 -21
- package/lib/unifier/metavariable.js +9 -9
- package/lib/unifier/statementWithCombinator.js +18 -18
- package/lib/unifier/termWithConstructor.js +10 -10
- package/lib/unifier.js +41 -41
- package/lib/utilities/brackets.js +2 -2
- package/lib/utilities/release.js +18 -17
- package/lib/utilities/subproof.js +2 -2
- package/lib/utilities/type.js +2 -2
- package/lib/utilities/unification.js +28 -34
- package/lib/verifier/combinator.js +14 -14
- package/lib/verifier/constructor.js +18 -18
- package/lib/verifier/topLevel.js +38 -38
- package/lib/verifier.js +30 -30
- package/package.json +1 -1
- package/src/context/file.js +18 -18
- package/src/context/local.js +5 -48
- package/src/context/release.js +11 -11
- package/src/dom/assertion/contained.js +46 -46
- package/src/dom/assertion/defined.js +41 -41
- package/src/dom/assertion/property.js +37 -35
- package/src/dom/assertion/satisfies.js +26 -25
- package/src/dom/assertion/subproof.js +15 -15
- package/src/dom/assertion/type.js +34 -32
- package/src/dom/axiom.js +56 -54
- package/src/dom/combinator/bracketed.js +4 -4
- package/src/dom/combinator.js +5 -5
- package/src/dom/conclusion.js +9 -9
- package/src/dom/conjecture.js +4 -4
- package/src/dom/constructor/bracketed.js +11 -11
- package/src/dom/constructor.js +8 -8
- package/src/dom/declaration/combinator.js +10 -10
- package/src/dom/declaration/complexType.js +129 -64
- package/src/dom/declaration/constructor.js +16 -16
- package/src/dom/declaration/metavariable.js +16 -16
- package/src/dom/declaration/simpleType.js +179 -0
- package/src/dom/declaration/variable.js +16 -16
- package/src/dom/declaration.js +54 -52
- package/src/dom/deduction.js +14 -14
- package/src/dom/derivation.js +7 -7
- package/src/dom/equality.js +55 -38
- package/src/dom/error.js +2 -2
- package/src/dom/frame.js +38 -38
- package/src/dom/judgement.js +31 -29
- package/src/dom/label.js +4 -4
- package/src/dom/lemma.js +4 -4
- package/src/dom/metaLemma.js +4 -4
- package/src/dom/metatheorem.js +4 -4
- package/src/dom/metavariable.js +54 -54
- package/src/dom/premise.js +35 -33
- package/src/dom/procedureCall.js +8 -8
- package/src/dom/proof.js +5 -5
- package/src/dom/propertyRelation.js +17 -17
- package/src/dom/reference.js +27 -27
- package/src/dom/rule.js +72 -49
- package/src/dom/signature.js +15 -15
- package/src/dom/statement.js +34 -34
- package/src/dom/step.js +42 -48
- package/src/dom/subDerivation.js +7 -7
- package/src/dom/subproof.js +30 -40
- package/src/dom/substitution/statement.js +6 -6
- package/src/dom/substitution/term.js +1 -19
- package/src/dom/substitution.js +0 -13
- package/src/dom/supposition.js +38 -38
- package/src/dom/term.js +14 -14
- package/src/dom/theorem.js +4 -4
- package/src/dom/topLevelAssertion.js +62 -81
- package/src/dom/topLevelMetaAssertion.js +35 -20
- package/src/dom/type.js +23 -33
- package/src/dom/variable.js +16 -15
- package/src/equivalence.js +69 -46
- package/src/equivalences.js +53 -115
- package/src/index.js +1 -1
- package/src/mixins/statement/verify.js +51 -51
- package/src/mixins/step/unify.js +88 -67
- package/src/mixins/term/verify.js +16 -16
- package/src/substitutions.js +5 -6
- package/src/unifier/equantional.js +90 -0
- package/src/unifier/intrinsicLevel.js +7 -7
- package/src/unifier/metaLevel.js +20 -21
- package/src/unifier/metavariable.js +8 -8
- package/src/unifier/statementWithCombinator.js +17 -17
- package/src/unifier/termWithConstructor.js +9 -9
- package/src/unifier.js +40 -40
- package/src/utilities/brackets.js +1 -1
- package/src/utilities/release.js +18 -18
- package/src/utilities/subproof.js +1 -1
- package/src/utilities/type.js +1 -1
- package/src/utilities/unification.js +27 -37
- package/src/verifier/combinator.js +13 -13
- package/src/verifier/constructor.js +17 -17
- package/src/verifier/topLevel.js +41 -41
- package/src/verifier.js +29 -29
- package/lib/dom/declaration/type.js +0 -209
- package/lib/unifier/equality.js +0 -155
- package/src/dom/declaration/type.js +0 -150
- package/src/unifier/equality.js +0 -70
package/src/dom/reference.js
CHANGED
|
@@ -44,45 +44,45 @@ export default domAssigned(class Reference {
|
|
|
44
44
|
matchMetavariableName(metavariableName) { return this.metavariable.matchMetavariableName(metavariableName); }
|
|
45
45
|
|
|
46
46
|
verify(context) {
|
|
47
|
-
let
|
|
47
|
+
let verifies = false;
|
|
48
48
|
|
|
49
49
|
const referenceString = this.getString(); ///
|
|
50
50
|
|
|
51
51
|
context.trace(`Verifying the '${referenceString}' reference...`);
|
|
52
52
|
|
|
53
|
-
if (!
|
|
54
|
-
const
|
|
53
|
+
if (!verifies) {
|
|
54
|
+
const metavariableVerifies = this.verifyMetavariable(context);
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
verifies = metavariableVerifies; ///
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
if (!
|
|
59
|
+
if (!verifies) {
|
|
60
60
|
const reference = this, ///
|
|
61
61
|
labelPresent = context.isLabelPresentByReference(reference);
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
verifies = labelPresent; ///
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
if (
|
|
66
|
+
if (verifies) {
|
|
67
67
|
context.debug(`...verified the '${referenceString}' reference.`);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
return
|
|
70
|
+
return verifies;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
verifyMetavariable(context) {
|
|
74
|
-
let
|
|
74
|
+
let metavariableVerifies;
|
|
75
75
|
|
|
76
76
|
const metaType = referenceMetaType, ///
|
|
77
|
-
|
|
77
|
+
metavariableVerifiesGivenMetaType = this.metavariable.verifyGivenMetaType(metaType, context);
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
metavariableVerifies = metavariableVerifiesGivenMetaType; ///
|
|
80
80
|
|
|
81
|
-
return
|
|
81
|
+
return metavariableVerifies;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
unifyLabel(label, substitutions, context) {
|
|
85
|
-
let
|
|
85
|
+
let labelUnifies;
|
|
86
86
|
|
|
87
87
|
const reference = this, ///
|
|
88
88
|
labelString = label.getString(),
|
|
@@ -96,19 +96,19 @@ export default domAssigned(class Reference {
|
|
|
96
96
|
labelMetavariable = label.getMetavariable(),
|
|
97
97
|
generalMetavariable = this.metavariable, ///
|
|
98
98
|
specificMetavariable = labelMetavariable, ///
|
|
99
|
-
|
|
99
|
+
metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, substitutions, generalContext, specificContext);
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
labelUnifies = metavariableUnifiesIntrinsically; ///
|
|
102
102
|
|
|
103
|
-
if (
|
|
103
|
+
if (labelUnifies) {
|
|
104
104
|
context.debug(`...unified the '${labelString}' label with the '${referenceString}' reference.`);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
return
|
|
107
|
+
return labelUnifies;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
unifyMetavariable(metavariable, context) {
|
|
111
|
-
let
|
|
111
|
+
let metavariableUnifies;
|
|
112
112
|
|
|
113
113
|
const reference = this, ///
|
|
114
114
|
metavariableString = metavariable.getString(),
|
|
@@ -122,19 +122,19 @@ export default domAssigned(class Reference {
|
|
|
122
122
|
specificContext = fileContext, ///
|
|
123
123
|
generalMetavariable = this.metavariable, ///
|
|
124
124
|
specificMetavariable = metavariable, ///
|
|
125
|
-
|
|
125
|
+
metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, substitutions, generalContext, specificContext);
|
|
126
126
|
|
|
127
|
-
|
|
127
|
+
metavariableUnifies = metavariableUnifiesIntrinsically; ///
|
|
128
128
|
|
|
129
|
-
if (
|
|
129
|
+
if (metavariableUnifies) {
|
|
130
130
|
context.debug(`...unified the '${metavariableString}' metavariable with the '${referenceString}' reference.`);
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
return
|
|
133
|
+
return metavariableUnifies;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context) {
|
|
137
|
-
let
|
|
137
|
+
let metaLemmaMetatheoremUnifies;
|
|
138
138
|
|
|
139
139
|
const reference = this, ///
|
|
140
140
|
referenceString = reference.getString(),
|
|
@@ -144,15 +144,15 @@ export default domAssigned(class Reference {
|
|
|
144
144
|
|
|
145
145
|
const label = metaLemmaMetatheorem.getLabel(),
|
|
146
146
|
substitutions = Substitutions.fromNothing(),
|
|
147
|
-
|
|
147
|
+
labelUnifies = this.unifyLabel(label, substitutions, context);
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
metaLemmaMetatheoremUnifies = labelUnifies; ///
|
|
150
150
|
|
|
151
|
-
if (
|
|
151
|
+
if (metaLemmaMetatheoremUnifies) {
|
|
152
152
|
context.trace(`...unified the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${referenceString}' reference.`);
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
return
|
|
155
|
+
return metaLemmaMetatheoremUnifies;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
toJSON() {
|
package/src/dom/rule.js
CHANGED
|
@@ -64,137 +64,145 @@ export default domAssigned(class Rule {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
unifyStatementAndStepsOrSubproofs(statement, stepsOrSubproofs, context) {
|
|
67
|
-
let
|
|
67
|
+
let statementAndStepsOrSubproofsUnify = false;
|
|
68
68
|
|
|
69
69
|
const localContext = LocalContext.fromFileContext(this.fileContext),
|
|
70
70
|
generalContext = localContext, ///
|
|
71
71
|
specificContext = context; ///
|
|
72
72
|
|
|
73
73
|
const substitutions = Substitutions.fromNothing(),
|
|
74
|
-
|
|
74
|
+
statementUnifiesWithConclusion = this.unifyStatementWithConclusion(statement, substitutions, generalContext, specificContext);
|
|
75
75
|
|
|
76
|
-
if (
|
|
77
|
-
const
|
|
76
|
+
if (statementUnifiesWithConclusion) {
|
|
77
|
+
const stepsOrSubproofsUnifyWithPremises = this.unifyStepsOrSubproofsWithPremises(stepsOrSubproofs, substitutions, generalContext, specificContext);
|
|
78
78
|
|
|
79
|
-
if (
|
|
79
|
+
if (stepsOrSubproofsUnifyWithPremises) {
|
|
80
80
|
const substitutionsResolved = substitutions.areResolved();
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
if (substitutionsResolved) {
|
|
83
|
+
statementAndStepsOrSubproofsUnify = true;
|
|
84
|
+
}
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
87
|
|
|
86
|
-
return
|
|
88
|
+
return statementAndStepsOrSubproofsUnify;
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
unifyStatementWithConclusion(statement, substitutions, generalContext, specificContext) {
|
|
90
|
-
let
|
|
92
|
+
let statementUnifiesWithConclusion = false;
|
|
91
93
|
|
|
92
|
-
const
|
|
94
|
+
const statementUnifies = this.conclusion.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
93
95
|
|
|
94
|
-
|
|
96
|
+
if (statementUnifies) {
|
|
97
|
+
statementUnifiesWithConclusion = true;
|
|
98
|
+
}
|
|
95
99
|
|
|
96
|
-
return
|
|
100
|
+
return statementUnifiesWithConclusion;
|
|
97
101
|
}
|
|
98
102
|
|
|
99
103
|
unifyStepsOrSubproofsWithPremises(stepsOrSubproofs, substitutions, generalContext, specificContext) {
|
|
100
104
|
stepsOrSubproofs = reverse(stepsOrSubproofs); ///
|
|
101
105
|
|
|
102
|
-
const
|
|
103
|
-
const
|
|
106
|
+
const stepsOrSubproofsUnifyWithPremises = backwardsEvery(this.premises, (premise) => {
|
|
107
|
+
const stepUnifiesWithPremise = this.unifyStepsOrSubproofsWithPremise(stepsOrSubproofs, premise, substitutions, generalContext, specificContext);
|
|
104
108
|
|
|
105
|
-
if (
|
|
109
|
+
if (stepUnifiesWithPremise) {
|
|
106
110
|
return true;
|
|
107
111
|
}
|
|
108
112
|
});
|
|
109
113
|
|
|
110
|
-
return
|
|
114
|
+
return stepsOrSubproofsUnifyWithPremises;
|
|
111
115
|
}
|
|
112
116
|
|
|
113
117
|
unifyStepsOrSubproofsWithPremise(stepsOrSubproofs, premise, substitutions, generalContext, specificContext) {
|
|
114
|
-
let
|
|
118
|
+
let stepsOrSubproofsUnifyWithPremise = false;
|
|
119
|
+
|
|
120
|
+
if (!stepsOrSubproofsUnifyWithPremise) {
|
|
121
|
+
const context = specificContext, ///
|
|
122
|
+
premiseUnifiesIndependently = premise.unifyIndependently(substitutions, context);
|
|
115
123
|
|
|
116
|
-
|
|
117
|
-
|
|
124
|
+
if (premiseUnifiesIndependently) {
|
|
125
|
+
stepsOrSubproofsUnifyWithPremise = true;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
118
128
|
|
|
119
|
-
if (
|
|
120
|
-
stepsOrSubproofsUnifiedWithPremise = true;
|
|
121
|
-
} else {
|
|
129
|
+
if (!stepsOrSubproofsUnifyWithPremise) {
|
|
122
130
|
const stepOrSubproof = extract(stepsOrSubproofs, (stepOrSubproof) => {
|
|
123
|
-
const
|
|
131
|
+
const stepOrSubproofUnifies = premise.unifyStepOrSubproof(stepOrSubproof, substitutions, generalContext, specificContext);
|
|
124
132
|
|
|
125
|
-
if (
|
|
133
|
+
if (stepOrSubproofUnifies) {
|
|
126
134
|
return true;
|
|
127
135
|
}
|
|
128
136
|
}) || null;
|
|
129
137
|
|
|
130
138
|
if (stepOrSubproof !== null) {
|
|
131
|
-
|
|
139
|
+
stepsOrSubproofsUnifyWithPremise = true;
|
|
132
140
|
}
|
|
133
141
|
}
|
|
134
142
|
|
|
135
|
-
return
|
|
143
|
+
return stepsOrSubproofsUnifyWithPremise;
|
|
136
144
|
}
|
|
137
145
|
|
|
138
146
|
verify() {
|
|
139
|
-
let
|
|
147
|
+
let verifies = false;
|
|
140
148
|
|
|
141
149
|
const ruleString = this.string; ///
|
|
142
150
|
|
|
143
151
|
this.fileContext.trace(`Verifying the '${ruleString}' rule...`);
|
|
144
152
|
|
|
145
|
-
const
|
|
153
|
+
const labelsVerify = this.verifyLabels();
|
|
146
154
|
|
|
147
|
-
if (
|
|
155
|
+
if (labelsVerify) {
|
|
148
156
|
const context = LocalContext.fromFileContext(this.fileContext),
|
|
149
|
-
|
|
150
|
-
const
|
|
157
|
+
premisesVerify = this.premises.every((premise) => {
|
|
158
|
+
const premiseVerifies = premise.verify(context);
|
|
151
159
|
|
|
152
|
-
if (
|
|
160
|
+
if (premiseVerifies) {
|
|
153
161
|
return true;
|
|
154
162
|
}
|
|
155
163
|
});
|
|
156
164
|
|
|
157
|
-
if (
|
|
158
|
-
const
|
|
165
|
+
if (premisesVerify) {
|
|
166
|
+
const conclusionVerifies = this.conclusion.verify(context);
|
|
159
167
|
|
|
160
|
-
if (
|
|
161
|
-
let
|
|
168
|
+
if (conclusionVerifies) {
|
|
169
|
+
let proofVerifies = true; ///
|
|
162
170
|
|
|
163
171
|
if (this.proof !== null) {
|
|
164
172
|
const substitutions = Substitutions.fromNothing();
|
|
165
173
|
|
|
166
|
-
|
|
174
|
+
proofVerifies = this.proof.verify(substitutions, this.conclusion, context);
|
|
167
175
|
}
|
|
168
176
|
|
|
169
|
-
if (
|
|
177
|
+
if (proofVerifies) {
|
|
170
178
|
const rule = this; ///
|
|
171
179
|
|
|
172
180
|
this.fileContext.addRule(rule);
|
|
173
181
|
|
|
174
|
-
|
|
182
|
+
verifies = true;
|
|
175
183
|
}
|
|
176
184
|
}
|
|
177
185
|
}
|
|
178
186
|
}
|
|
179
187
|
|
|
180
|
-
if (
|
|
188
|
+
if (verifies) {
|
|
181
189
|
this.fileContext.debug(`...verified the '${ruleString}' rule.`);
|
|
182
190
|
}
|
|
183
191
|
|
|
184
|
-
return
|
|
192
|
+
return verifies;
|
|
185
193
|
}
|
|
186
194
|
|
|
187
195
|
verifyLabels() {
|
|
188
|
-
const
|
|
196
|
+
const labelsVerify = this.labels.every((label) => {
|
|
189
197
|
const nameOnly = true,
|
|
190
|
-
|
|
198
|
+
labelVerifies = label.verify(nameOnly);
|
|
191
199
|
|
|
192
|
-
if (
|
|
200
|
+
if (labelVerifies) {
|
|
193
201
|
return true;
|
|
194
202
|
}
|
|
195
203
|
});
|
|
196
204
|
|
|
197
|
-
return
|
|
205
|
+
return labelsVerify;
|
|
198
206
|
}
|
|
199
207
|
|
|
200
208
|
toJSON() {
|
|
@@ -222,7 +230,7 @@ export default domAssigned(class Rule {
|
|
|
222
230
|
labels = labelsFromJSON(json, fileContext),
|
|
223
231
|
premises = premisesFromJSON(json, fileContext),
|
|
224
232
|
conclusion = conclusionFromJSON(json, fileContext),
|
|
225
|
-
string =
|
|
233
|
+
string = stringFromLabelsPremisesAndConclusion(labels, premises, conclusion);
|
|
226
234
|
|
|
227
235
|
rule = new Rule(fileContext, string, labels, premises, conclusion, proof);
|
|
228
236
|
|
|
@@ -234,7 +242,7 @@ export default domAssigned(class Rule {
|
|
|
234
242
|
labels = labelsFromRuleNode(ruleNode, fileContext),
|
|
235
243
|
premises = premisesFromRuleNode(ruleNode, fileContext),
|
|
236
244
|
conclusion = conclusionFromRuleNode(ruleNode, fileContext),
|
|
237
|
-
string =
|
|
245
|
+
string = stringFromLabelsPremisesAndConclusion(labels, premises, conclusion),
|
|
238
246
|
rule = new Rule(fileContext, string, labels, premises, conclusion, proof);
|
|
239
247
|
|
|
240
248
|
return rule;
|
|
@@ -281,10 +289,25 @@ function conclusionFromRuleNode(ruleNode, fileContext) {
|
|
|
281
289
|
return conclusion;
|
|
282
290
|
}
|
|
283
291
|
|
|
284
|
-
function
|
|
285
|
-
const
|
|
292
|
+
function premisesStringFromPremises(premises) {
|
|
293
|
+
const premisesString = premises.reduce((premisesString, premise) => {
|
|
294
|
+
const premiseString = premise.getString();
|
|
295
|
+
|
|
296
|
+
premisesString = (premisesString !== null) ?
|
|
297
|
+
`${premisesString}, ${premiseString}` :
|
|
298
|
+
premiseString; ///
|
|
299
|
+
|
|
300
|
+
return premisesString;
|
|
301
|
+
}, null);
|
|
302
|
+
|
|
303
|
+
return premisesString;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function stringFromLabelsPremisesAndConclusion(labels, premises, conclusion) {
|
|
307
|
+
const premisesString = premisesStringFromPremises(premises),
|
|
308
|
+
conclusionString = conclusion.getString(),
|
|
286
309
|
labelsString = labelsStringFromLabels(labels),
|
|
287
|
-
string = `${labelsString} :: ${conclusionString}`;
|
|
310
|
+
string = `${labelsString} :: [${premisesString}] ... ${conclusionString}`;
|
|
288
311
|
|
|
289
312
|
return string;
|
|
290
313
|
}
|
package/src/dom/signature.js
CHANGED
|
@@ -25,29 +25,29 @@ export default domAssigned(class Signature {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
verify(context) {
|
|
28
|
-
let
|
|
28
|
+
let verifies;
|
|
29
29
|
|
|
30
30
|
const signatureString = this.string;
|
|
31
31
|
|
|
32
32
|
context.trace(`Verifying the ${signatureString} signature...`);
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
const
|
|
34
|
+
verifies = this.terms.every((term) => {
|
|
35
|
+
const termVerifies = term.verify(context, () => {
|
|
36
|
+
const verifiesAhead = true;
|
|
37
37
|
|
|
38
|
-
return
|
|
38
|
+
return verifiesAhead;
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
if (
|
|
41
|
+
if (termVerifies) {
|
|
42
42
|
return true;
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
if (
|
|
46
|
+
if (verifies) {
|
|
47
47
|
context.debug(`...verified the ${signatureString} signature.`);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
return
|
|
50
|
+
return verifies;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
match(signature, substitutions, generalContext, specificContext) {
|
|
@@ -87,13 +87,13 @@ export default domAssigned(class Signature {
|
|
|
87
87
|
return matches;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
let
|
|
90
|
+
correlateSubstitutions(substitutions, context) {
|
|
91
|
+
let substitutionsCorrelates;
|
|
92
92
|
|
|
93
93
|
const signatureString = this.string,
|
|
94
94
|
substitutionsString = substitutions.asString();
|
|
95
95
|
|
|
96
|
-
context.trace(`
|
|
96
|
+
context.trace(`Correlating the '${substitutionsString}' substitutions against the ${signatureString} signature...`);
|
|
97
97
|
|
|
98
98
|
const array = substitutions.getArray(),
|
|
99
99
|
correlates = correlate(this.terms, array, (term, substitution) => {
|
|
@@ -105,13 +105,13 @@ export default domAssigned(class Signature {
|
|
|
105
105
|
}
|
|
106
106
|
});
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
substitutionsCorrelates = correlates; ///
|
|
109
109
|
|
|
110
|
-
if (
|
|
111
|
-
context.debug(`...
|
|
110
|
+
if (substitutionsCorrelates) {
|
|
111
|
+
context.debug(`...correlated the '${substitutionsString}' substitutions against the ${signatureString} signature.`);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
return
|
|
114
|
+
return substitutionsCorrelates;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
toJSON() {
|
package/src/dom/statement.js
CHANGED
|
@@ -96,30 +96,30 @@ export default domAssigned(class Statement {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
verify(assignments, stated, context) {
|
|
99
|
-
let
|
|
99
|
+
let verifies;
|
|
100
100
|
|
|
101
101
|
const statementString = this.string; ///
|
|
102
102
|
|
|
103
103
|
context.trace(`Verifying the '${statementString}' statement...`);
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
verifies = verifyMixins.some((verifyMixin) => {
|
|
106
106
|
const statement = this, ///
|
|
107
|
-
|
|
107
|
+
verifies = verifyMixin(statement, assignments, stated, context);
|
|
108
108
|
|
|
109
|
-
if (
|
|
109
|
+
if (verifies) {
|
|
110
110
|
return true;
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
113
|
|
|
114
|
-
if (
|
|
114
|
+
if (verifies) {
|
|
115
115
|
context.debug(`...verified the '${statementString}' statement.`);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
return
|
|
118
|
+
return verifies;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
verifyGivenMetaType(metaType, assignments, stated, context) {
|
|
122
|
-
let
|
|
122
|
+
let verifiesGivenMetaType = false;
|
|
123
123
|
|
|
124
124
|
const metaTypeString = metaType.getString(),
|
|
125
125
|
statementString = this.string; ///
|
|
@@ -129,20 +129,20 @@ export default domAssigned(class Statement {
|
|
|
129
129
|
const metaTypeName = metaType.getName();
|
|
130
130
|
|
|
131
131
|
if (metaTypeName === STATEMENT_META_TYPE_NAME) {
|
|
132
|
-
const
|
|
132
|
+
const verifies = this.verify(assignments, stated, context)
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
verifiesGivenMetaType = verifies; ///
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
if (
|
|
137
|
+
if (verifiesGivenMetaType) {
|
|
138
138
|
context.debug(`...verified the '${statementString}' statement given the '${metaTypeString}' meta-type.`);
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
return
|
|
141
|
+
return verifiesGivenMetaType;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
unifySubproof(subproof, substitutions, generalContext, specificContext) {
|
|
145
|
-
let
|
|
145
|
+
let subproofUnifies = false;
|
|
146
146
|
|
|
147
147
|
const context = specificContext, ///
|
|
148
148
|
statement = this, ///
|
|
@@ -157,26 +157,26 @@ export default domAssigned(class Statement {
|
|
|
157
157
|
const subproofStatements = subproof.getStatements(),
|
|
158
158
|
subproofAssertionStatements = subproofAssertion.getStatements();
|
|
159
159
|
|
|
160
|
-
|
|
160
|
+
subproofUnifies = match(subproofAssertionStatements, subproofStatements, (subproofAssertionStatement, subproofStatement) => {
|
|
161
161
|
const generalStatement = subproofAssertionStatement, ///
|
|
162
162
|
specificStatement = subproofStatement, ///
|
|
163
|
-
|
|
163
|
+
statementUnifies = unifyStatement(generalStatement, specificStatement, substitutions, generalContext, specificContext);
|
|
164
164
|
|
|
165
|
-
if (
|
|
165
|
+
if (statementUnifies) {
|
|
166
166
|
return true;
|
|
167
167
|
}
|
|
168
168
|
});
|
|
169
169
|
|
|
170
|
-
if (
|
|
170
|
+
if (subproofUnifies) {
|
|
171
171
|
specificContext.debug(`...unified the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion.`);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
return
|
|
175
|
+
return subproofUnifies;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
unifyStatement(statement, substitutions, generalContext, specificContext) {
|
|
179
|
-
let
|
|
179
|
+
let statementUnifies;
|
|
180
180
|
|
|
181
181
|
const generalStatement = this, ///
|
|
182
182
|
specificStatement = statement, ///
|
|
@@ -185,17 +185,17 @@ export default domAssigned(class Statement {
|
|
|
185
185
|
|
|
186
186
|
specificContext.trace(`Unifying the '${specificStatementString}' statement with the '${generalStatementString}' statement...`);
|
|
187
187
|
|
|
188
|
-
|
|
188
|
+
statementUnifies = unifyStatement(generalStatement, specificStatement, substitutions, generalContext, specificContext);
|
|
189
189
|
|
|
190
|
-
if (
|
|
190
|
+
if (statementUnifies) {
|
|
191
191
|
specificContext.debug(`...unified the '${specificStatementString}' statement with the '${generalStatementString}' statement.`);
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
return
|
|
194
|
+
return statementUnifies;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
unifyIndependently(substitutions, context) {
|
|
198
|
-
let
|
|
198
|
+
let unifiesIndependently = false;
|
|
199
199
|
|
|
200
200
|
const statement = this, ///
|
|
201
201
|
statementString = this.string; ///
|
|
@@ -206,37 +206,37 @@ export default domAssigned(class Statement {
|
|
|
206
206
|
containedAssertion = containedAssertionFromStatement(statement, context);
|
|
207
207
|
|
|
208
208
|
if (definedAssertion !== null) {
|
|
209
|
-
const
|
|
209
|
+
const definedAssertionUnifiesIndependently = definedAssertion.unifyIndependently(substitutions, context);
|
|
210
210
|
|
|
211
|
-
|
|
211
|
+
unifiesIndependently = definedAssertionUnifiesIndependently; ///
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
if (containedAssertion !== null) {
|
|
215
|
-
const
|
|
215
|
+
const containedAssertionUnifiesIndependently = containedAssertion.unifyIndependently(substitutions, context);
|
|
216
216
|
|
|
217
|
-
|
|
217
|
+
unifiesIndependently = containedAssertionUnifiesIndependently; ///
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
if (
|
|
220
|
+
if (unifiesIndependently) {
|
|
221
221
|
context.debug(`...unified the '${statementString}' statement independently.`);
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
return
|
|
224
|
+
return unifiesIndependently;
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
|
|
228
|
-
let
|
|
227
|
+
equateWithStepsOrSubproofs(stepsOrSubproofs, context) {
|
|
228
|
+
let equatesWithStepsOrSubproofs;
|
|
229
229
|
|
|
230
|
-
|
|
230
|
+
equatesWithStepsOrSubproofs = backwardsSome(stepsOrSubproofs, (stepOrSubproof) => {
|
|
231
231
|
const statement = this, ///
|
|
232
|
-
|
|
232
|
+
statementUnifies = stepOrSubproof.equateWithStatement(statement, context);
|
|
233
233
|
|
|
234
|
-
if (
|
|
234
|
+
if (statementUnifies) {
|
|
235
235
|
return true;
|
|
236
236
|
}
|
|
237
237
|
});
|
|
238
238
|
|
|
239
|
-
return
|
|
239
|
+
return equatesWithStepsOrSubproofs;
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
toJSON() {
|