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/step.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import dom from "../dom";
|
|
4
4
|
import unifyMixins from "../mixins/step/unify";
|
|
5
|
-
import LocalContext from "../context/local";
|
|
6
5
|
import Substitutions from "../substitutions";
|
|
6
|
+
import equationalUnifier from "../unifier/equantional";
|
|
7
7
|
|
|
8
8
|
import { domAssigned } from "../dom";
|
|
9
9
|
import { propertyAssertionFromStatement } from "../utilities/context";
|
|
@@ -52,29 +52,29 @@ export default domAssigned(class Step {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
unify(substitutions, context) {
|
|
55
|
-
let
|
|
55
|
+
let unifies;
|
|
56
56
|
|
|
57
57
|
const stepString = this.string; ///
|
|
58
58
|
|
|
59
59
|
context.trace(`Unifying the '${stepString}' step...`);
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
const
|
|
61
|
+
unifies = unifyMixins.some((unifyMixin) => {
|
|
62
|
+
const unifies = unifyMixin(this.statement, this.reference, substitutions, context);
|
|
63
63
|
|
|
64
|
-
if (
|
|
64
|
+
if (unifies) {
|
|
65
65
|
return true;
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
-
if (
|
|
69
|
+
if (unifies) {
|
|
70
70
|
context.debug(`...unified the '${stepString}' step.`);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
return
|
|
73
|
+
return unifies;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
verify(substitutions, assignments, context) {
|
|
77
|
-
let
|
|
77
|
+
let verifies = false;
|
|
78
78
|
|
|
79
79
|
const stepString = this.string; ///
|
|
80
80
|
|
|
@@ -83,77 +83,71 @@ export default domAssigned(class Step {
|
|
|
83
83
|
if (this.statement !== null) {
|
|
84
84
|
const qualified = this.isQualified(),
|
|
85
85
|
stated = qualified, ///
|
|
86
|
-
|
|
86
|
+
statementVerifies = this.statement.verify(assignments, stated, context);
|
|
87
87
|
|
|
88
|
-
if (
|
|
88
|
+
if (statementVerifies) {
|
|
89
89
|
if (this.reference === null) {
|
|
90
|
-
|
|
90
|
+
verifies = true;
|
|
91
91
|
} else {
|
|
92
|
-
const
|
|
92
|
+
const referenceVerifies = this.reference.verify(context);
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
verifies = referenceVerifies; ///
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
} else {
|
|
98
98
|
context.debug(`Cannot verify the '${stepString}' step because it is nonsense.`);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
if (
|
|
101
|
+
if (verifies) {
|
|
102
102
|
context.debug(`...verified the '${stepString}' step.`);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
return
|
|
105
|
+
return verifies;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
let
|
|
108
|
+
equateWithStatement(statement, context) {
|
|
109
|
+
let statementEquates;
|
|
110
110
|
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
const statementA = statement, ///
|
|
112
|
+
statementB = this.statement, ///
|
|
113
|
+
statementANode = statementA.getNode(),
|
|
114
|
+
statementBNode = statementB.getNode(),
|
|
115
|
+
statementsEquates = equationalUnifier.equateStatements(statementANode, statementBNode, context);
|
|
114
116
|
|
|
115
|
-
|
|
117
|
+
statementEquates = statementsEquates; ///
|
|
116
118
|
|
|
117
|
-
|
|
118
|
-
substitutions.removeTrivialSubstitutions();
|
|
119
|
-
|
|
120
|
-
const equivalences = context.getEquivalences(),
|
|
121
|
-
substitutionsUnified = equivalences.unifySubstitutions(substitutions);
|
|
122
|
-
|
|
123
|
-
statementUnified = substitutionsUnified; ///
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return statementUnified;
|
|
119
|
+
return statementEquates;
|
|
127
120
|
}
|
|
128
121
|
|
|
129
122
|
unifySatisfiesAssertion(satisfiesAssertion, context) {
|
|
130
123
|
let unifySatisfiesAssertion = false;
|
|
131
124
|
|
|
125
|
+
const stepString = this.string, ///
|
|
126
|
+
satisfiesAssertionString = satisfiesAssertion.getString();
|
|
127
|
+
|
|
128
|
+
context.trace(`Unifying hte '${satisfiesAssertionString}' with the '${stepString}' step...`);
|
|
129
|
+
|
|
132
130
|
const reference = satisfiesAssertion.getReference(),
|
|
133
131
|
axiom = context.findAxiomByReference(reference);
|
|
134
132
|
|
|
135
133
|
if (axiom !== null) {
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
statementUnified = axiom.unifyStep(step, substitutions, generalContext, specificContext);
|
|
146
|
-
|
|
147
|
-
if (statementUnified) {
|
|
148
|
-
const substitutionsMatch = satisfiesAssertion.matchSubstitutions(substitutions, context);
|
|
149
|
-
|
|
150
|
-
if (substitutionsMatch) {
|
|
151
|
-
unifySatisfiesAssertion = true;
|
|
152
|
-
}
|
|
134
|
+
const step = this, ///
|
|
135
|
+
substitutions = Substitutions.fromNothing(),
|
|
136
|
+
stepUnifies = axiom.unifyStep(step, substitutions, context);
|
|
137
|
+
|
|
138
|
+
if (stepUnifies) {
|
|
139
|
+
const substitutionsMatch = satisfiesAssertion.matchSubstitutions(substitutions, context);
|
|
140
|
+
|
|
141
|
+
if (substitutionsMatch) {
|
|
142
|
+
unifySatisfiesAssertion = true;
|
|
153
143
|
}
|
|
154
144
|
}
|
|
155
145
|
}
|
|
156
146
|
|
|
147
|
+
if (unifySatisfiesAssertion) {
|
|
148
|
+
context.debug(`...unified hte '${satisfiesAssertionString}' with the '${stepString}' step.`);
|
|
149
|
+
}
|
|
150
|
+
|
|
157
151
|
return unifySatisfiesAssertion;
|
|
158
152
|
}
|
|
159
153
|
|
package/src/dom/subDerivation.js
CHANGED
|
@@ -26,16 +26,16 @@ export default domAssigned(class SubDerivation {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
verify(substitutions, context) {
|
|
29
|
-
let
|
|
29
|
+
let verifies;
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
verifies = this.stepsOrSubproofs.every((stepOrSubproof) => { ///
|
|
32
32
|
const assignments = [],
|
|
33
|
-
|
|
33
|
+
stepOrSubproofVerifies = stepOrSubproof.verify(substitutions, assignments, context);
|
|
34
34
|
|
|
35
|
-
if (
|
|
36
|
-
const
|
|
35
|
+
if (stepOrSubproofVerifies) {
|
|
36
|
+
const stepOrSubproofUnifies = stepOrSubproof.unify(substitutions, context);
|
|
37
37
|
|
|
38
|
-
if (
|
|
38
|
+
if (stepOrSubproofUnifies) {
|
|
39
39
|
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
40
40
|
|
|
41
41
|
if (assignmentsAssigned) {
|
|
@@ -47,7 +47,7 @@ export default domAssigned(class SubDerivation {
|
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
return
|
|
50
|
+
return verifies;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
static name = "SubDerivation";
|
package/src/dom/subproof.js
CHANGED
|
@@ -55,81 +55,67 @@ export default domAssigned(class Subproof {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
unify(substitutions, context) {
|
|
58
|
-
let
|
|
58
|
+
let unifies;
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
unifies = true; ///
|
|
61
61
|
|
|
62
|
-
return
|
|
62
|
+
return unifies;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
verify(substitutions, assignments, context) {
|
|
66
|
-
let
|
|
66
|
+
let subproofVerifies = false;
|
|
67
67
|
|
|
68
68
|
const localContext = LocalContext.fromContext(context); ///
|
|
69
69
|
|
|
70
70
|
context = localContext; ///
|
|
71
71
|
|
|
72
|
-
const
|
|
73
|
-
const
|
|
72
|
+
const suppositionsVerify = this.suppositions.every((supposition) => {
|
|
73
|
+
const suppositionVerifies = supposition.verify(context);
|
|
74
74
|
|
|
75
|
-
if (
|
|
75
|
+
if (suppositionVerifies) {
|
|
76
76
|
return true;
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
|
|
80
|
-
if (
|
|
81
|
-
const
|
|
80
|
+
if (suppositionsVerify) {
|
|
81
|
+
const subDerivationVerifies = this.subDerivation.verify(substitutions, context);
|
|
82
82
|
|
|
83
|
-
if (
|
|
84
|
-
|
|
83
|
+
if (subDerivationVerifies) {
|
|
84
|
+
subproofVerifies = true;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
return
|
|
88
|
+
return subproofVerifies;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
let
|
|
91
|
+
equateWithStatement(statement, context) {
|
|
92
|
+
let statementUnifies = false;
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
substitutions = Substitutions.fromNothing(),
|
|
96
|
-
generalContext = context, ///
|
|
97
|
-
specificContext = context, ///
|
|
98
|
-
subproofUnified = statement.unifySubproof(subproof, substitutions, generalContext, specificContext);
|
|
94
|
+
debugger
|
|
99
95
|
|
|
100
|
-
|
|
101
|
-
if (statementUnified) {
|
|
102
|
-
const equivalences = context.getEquivalences(),
|
|
103
|
-
substitutionsUnified = equivalences.unifySubstitutions(substitutions);
|
|
104
|
-
|
|
105
|
-
if (substitutionsUnified) {
|
|
106
|
-
statementUnified = true;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return statementUnified;
|
|
96
|
+
return statementUnifies;
|
|
112
97
|
}
|
|
113
98
|
|
|
114
99
|
unifySatisfiesAssertion(satisfiesAssertion, context) {
|
|
115
100
|
let unifySatisfiesAssertion = false;
|
|
116
101
|
|
|
102
|
+
const subproofString = this.string, ///
|
|
103
|
+
satisfiesAssertionString = satisfiesAssertion.getString();
|
|
104
|
+
|
|
105
|
+
context.trace(`Unifying the '${satisfiesAssertionString}' satisfies assertion with the '${subproofString}' subproof...`)
|
|
106
|
+
|
|
117
107
|
const reference = satisfiesAssertion.getReference(),
|
|
118
108
|
axiom = context.findAxiomByReference(reference);
|
|
119
109
|
|
|
120
110
|
if (axiom !== null) {
|
|
121
|
-
const
|
|
111
|
+
const axiomSatisfiable = axiom.isSatisfiable();
|
|
122
112
|
|
|
123
|
-
if (
|
|
124
|
-
const subproof = this,
|
|
125
|
-
fileContext = axiom.getFileContext(),
|
|
126
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
113
|
+
if (axiomSatisfiable) {
|
|
114
|
+
const subproof = this, ///
|
|
127
115
|
substitutions = Substitutions.fromNothing(),
|
|
128
|
-
|
|
129
|
-
specificContext = context, ///
|
|
130
|
-
statementUnified = axiom.unifySubproof(subproof, substitutions, generalContext, specificContext);
|
|
116
|
+
statementUnifies = axiom.unifySubproof(subproof, substitutions, context);
|
|
131
117
|
|
|
132
|
-
if (
|
|
118
|
+
if (statementUnifies) {
|
|
133
119
|
const substitutionsMatch = satisfiesAssertion.matchSubstitutions(substitutions, context);
|
|
134
120
|
|
|
135
121
|
if (substitutionsMatch) {
|
|
@@ -139,6 +125,10 @@ export default domAssigned(class Subproof {
|
|
|
139
125
|
}
|
|
140
126
|
}
|
|
141
127
|
|
|
128
|
+
if (unifySatisfiesAssertion) {
|
|
129
|
+
context.debug(`...unified the '${satisfiesAssertionString}' satisfies assertion with the '${subproofString}' subproof.`)
|
|
130
|
+
}
|
|
131
|
+
|
|
142
132
|
return unifySatisfiesAssertion;
|
|
143
133
|
}
|
|
144
134
|
|
|
@@ -116,18 +116,18 @@ export default domAssigned(class StatementSubstitution extends Substitution {
|
|
|
116
116
|
|
|
117
117
|
specificContext.trace(`Unifying the '${specificSubstitutionString}' substitution with the '${generalSubstitutionString}' substitution...`);
|
|
118
118
|
|
|
119
|
-
const
|
|
119
|
+
const substitutionUnifies = unifySubstitution(generalSubstitution, specificSubstitution, substitutions, generalContext, specificContext);
|
|
120
120
|
|
|
121
121
|
|
|
122
|
-
if (
|
|
122
|
+
if (substitutionUnifies) {
|
|
123
123
|
specificContext.trace(`...unified the '${specificSubstitutionString}' substitution with the '${generalSubstitutionString}' substitution.`);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
substitutionUnifies ?
|
|
127
127
|
substitutions.continue() :
|
|
128
128
|
substitutions.rollback(specificContext);
|
|
129
129
|
|
|
130
|
-
substitutionResolved =
|
|
130
|
+
substitutionResolved = substitutionUnifies; ///
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
if (substitutionResolved) {
|
|
@@ -141,9 +141,9 @@ export default domAssigned(class StatementSubstitution extends Substitution {
|
|
|
141
141
|
let specificSubstitution = null;
|
|
142
142
|
|
|
143
143
|
const substitutions = Substitutions.fromNothing(),
|
|
144
|
-
|
|
144
|
+
statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
145
145
|
|
|
146
|
-
if (
|
|
146
|
+
if (statementUnifies) {
|
|
147
147
|
const substitutionsLength = substitutions.getLength();
|
|
148
148
|
|
|
149
149
|
if (substitutionsLength === 1) {
|
|
@@ -33,7 +33,7 @@ export default domAssigned(class TermSubstitution extends Substitution {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
isTermEqualTo(term, context) {
|
|
36
|
-
term = stripBracketsFromTerm(term); ///
|
|
36
|
+
term = stripBracketsFromTerm(term, context); ///
|
|
37
37
|
|
|
38
38
|
const termEqualTo = this.term.isEqualTo(term);
|
|
39
39
|
|
|
@@ -51,24 +51,6 @@ export default domAssigned(class TermSubstitution extends Substitution {
|
|
|
51
51
|
|
|
52
52
|
matchName(name) { return this.variable.matchName(name); }
|
|
53
53
|
|
|
54
|
-
unifyWithEquivalence(equivalence) {
|
|
55
|
-
let unifiedWithEquivalence;
|
|
56
|
-
|
|
57
|
-
const termNode = this.term.getNode(),
|
|
58
|
-
equivalenceMatchesTermNode = equivalence.matchTermNode(termNode);
|
|
59
|
-
|
|
60
|
-
if (equivalenceMatchesTermNode) {
|
|
61
|
-
const variableNode = this.variable.getNode(),
|
|
62
|
-
equivalenceMatchesVariableNode = equivalence.matchVariableNode(variableNode);
|
|
63
|
-
|
|
64
|
-
if (equivalenceMatchesVariableNode) {
|
|
65
|
-
unifiedWithEquivalence = true;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return unifiedWithEquivalence;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
54
|
static fromStatementNode(statementNode, context) {
|
|
73
55
|
let termSubstitution = null;
|
|
74
56
|
|
package/src/dom/substitution.js
CHANGED
|
@@ -135,13 +135,6 @@ export default class Substitution {
|
|
|
135
135
|
return resolved;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
match(substitution) {
|
|
139
|
-
const equalTo = this.isEqualTo(substitution),
|
|
140
|
-
matches = equalTo; ///
|
|
141
|
-
|
|
142
|
-
return matches;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
138
|
matchName(name) {
|
|
146
139
|
const nameMatches = false;
|
|
147
140
|
|
|
@@ -153,10 +146,4 @@ export default class Substitution {
|
|
|
153
146
|
|
|
154
147
|
return replacementNode;
|
|
155
148
|
}
|
|
156
|
-
|
|
157
|
-
unifyWithEquivalence(equivalence) {
|
|
158
|
-
let unifiedWithEquivalence = false;
|
|
159
|
-
|
|
160
|
-
return unifiedWithEquivalence;
|
|
161
|
-
}
|
|
162
149
|
}
|
package/src/dom/supposition.js
CHANGED
|
@@ -27,7 +27,7 @@ export default domAssigned(class Supposition {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
verify(context) {
|
|
30
|
-
let
|
|
30
|
+
let verifies = false;
|
|
31
31
|
|
|
32
32
|
const suppositionString = this.string; ///
|
|
33
33
|
|
|
@@ -38,9 +38,9 @@ export default domAssigned(class Supposition {
|
|
|
38
38
|
} else if (this.statement !== null) {
|
|
39
39
|
const stated = true,
|
|
40
40
|
assignments = [],
|
|
41
|
-
|
|
41
|
+
statementVerifies = this.statement.verify(assignments, stated, context);
|
|
42
42
|
|
|
43
|
-
if (
|
|
43
|
+
if (statementVerifies) {
|
|
44
44
|
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
45
45
|
|
|
46
46
|
if (assignmentsAssigned) {
|
|
@@ -50,30 +50,30 @@ export default domAssigned(class Supposition {
|
|
|
50
50
|
|
|
51
51
|
context.addStepOrSubproof(stepOrSubproof);
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
verifies = true;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
} else if (this.procedureCall !== null) {
|
|
57
57
|
const stated = true,
|
|
58
58
|
assignments = null,
|
|
59
|
-
|
|
59
|
+
procedureCallVerifies = this.procedureCall.verify(assignments, stated, context);
|
|
60
60
|
|
|
61
|
-
if (
|
|
62
|
-
|
|
61
|
+
if (procedureCallVerifies) {
|
|
62
|
+
verifies = true;
|
|
63
63
|
}
|
|
64
64
|
} else {
|
|
65
65
|
context.debug(`Unable to verify the '${suppositionString}' supposition because it is nonsense.`);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
if (
|
|
68
|
+
if (verifies) {
|
|
69
69
|
context.debug(`...verified the '${suppositionString}' supposition.`);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
return
|
|
72
|
+
return verifies;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
unifySupposition(supposition, substitutions, generalContext, specificContext) {
|
|
76
|
-
let
|
|
76
|
+
let suppositionUnifies;
|
|
77
77
|
|
|
78
78
|
const context = specificContext, ///
|
|
79
79
|
specificSupposition = supposition, ///
|
|
@@ -83,37 +83,37 @@ export default domAssigned(class Supposition {
|
|
|
83
83
|
context.trace(`Unifying the '${specificSuppositionString}' supposition with the '${generalSuppositionString}' supposition...`);
|
|
84
84
|
|
|
85
85
|
const statement = specificSupposition.getStatement(),
|
|
86
|
-
|
|
86
|
+
statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
suppositionUnifies = statementUnifies; ///
|
|
89
89
|
|
|
90
|
-
if (
|
|
90
|
+
if (suppositionUnifies) {
|
|
91
91
|
context.debug(`...unified the '${specificSuppositionString}' supposition with the '${generalSuppositionString}' supposition.`);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
return
|
|
94
|
+
return suppositionUnifies;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
unifyIndependently(substitutions, context) {
|
|
98
|
-
let
|
|
98
|
+
let unifiesIndependently;
|
|
99
99
|
|
|
100
100
|
if (this.statement !== null) {
|
|
101
101
|
const statementResolvedIndependently = this.statement.unifyIndependently(substitutions, context);
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
unifiesIndependently = statementResolvedIndependently; ///
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
if (this.procedureCall !== null) {
|
|
107
107
|
const procedureCallResolvedIndependently = this.procedureCall.unifyIndependently(substitutions, context);
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
unifiesIndependently = procedureCallResolvedIndependently; ///
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
return
|
|
112
|
+
return unifiesIndependently;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
unifyStepOrSubproof(stepOrSubproof, substitutions, generalContext, specificContext) {
|
|
116
|
-
let
|
|
116
|
+
let stepOrSubproofUnifies = false;
|
|
117
117
|
|
|
118
118
|
const stepOrSubProofStep = stepOrSubproof.isStep(),
|
|
119
119
|
subproof = stepOrSubProofStep ?
|
|
@@ -126,41 +126,41 @@ export default domAssigned(class Supposition {
|
|
|
126
126
|
substitutions.snapshot();
|
|
127
127
|
|
|
128
128
|
if (subproof !== null) {
|
|
129
|
-
const
|
|
129
|
+
const subproofUnifies = this.unifySubproof(subproof, substitutions, generalContext, specificContext);
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
stepOrSubproofUnifies = subproofUnifies; ///
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
if (step !== null) {
|
|
135
|
-
const
|
|
135
|
+
const statementUnifies = this.unifyStep(step, substitutions, generalContext, specificContext);
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
stepOrSubproofUnifies = statementUnifies; ///
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
if (
|
|
140
|
+
if (stepOrSubproofUnifies) {
|
|
141
141
|
substitutions.resolve(generalContext, specificContext);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
stepOrSubproofUnifies ?
|
|
145
145
|
substitutions.continue() :
|
|
146
146
|
substitutions.rollback(specificContext);
|
|
147
147
|
|
|
148
|
-
return
|
|
148
|
+
return stepOrSubproofUnifies;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
unifyStep(step, substitutions, generalContext, specificContext) {
|
|
152
|
-
let
|
|
152
|
+
let stepUnifies;
|
|
153
153
|
|
|
154
154
|
const statement = step.getStatement(),
|
|
155
|
-
|
|
155
|
+
statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
156
156
|
|
|
157
|
-
|
|
157
|
+
stepUnifies = statementUnifies; ///
|
|
158
158
|
|
|
159
|
-
return
|
|
159
|
+
return stepUnifies;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
unifySubproof(subproof, substitutions, generalContext, specificContext) {
|
|
163
|
-
let
|
|
163
|
+
let subproofUnifies = false;
|
|
164
164
|
|
|
165
165
|
const supposition = this, ///
|
|
166
166
|
subproofString = subproof.getString(),
|
|
@@ -174,19 +174,19 @@ export default domAssigned(class Supposition {
|
|
|
174
174
|
subproofAssertion = subproofAssertionFromStatement(this.statement, context);
|
|
175
175
|
|
|
176
176
|
if (subproofAssertion !== null) {
|
|
177
|
-
|
|
177
|
+
subproofUnifies = subproofAssertion.unifySubproof(subproof, substitutions, generalContext, specificContext);
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
if (
|
|
181
|
+
if (subproofUnifies) {
|
|
182
182
|
specificContext.debug(`...unified the '${subproofString}' subproof with the supposition's '${suppositionStatementString}' statement.`);
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
return
|
|
185
|
+
return subproofUnifies;
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
unifyStatement(statement, substitutions, generalContext, specificContext) {
|
|
189
|
-
let
|
|
189
|
+
let statementUnifies;
|
|
190
190
|
|
|
191
191
|
const supposition = this, ///
|
|
192
192
|
statementString = statement.getString(),
|
|
@@ -195,14 +195,14 @@ export default domAssigned(class Supposition {
|
|
|
195
195
|
specificContext.trace(`Unifying the '${statementString}' statement with the '${suppositionString}' supposition...`);
|
|
196
196
|
|
|
197
197
|
if (this.statement !== null) {
|
|
198
|
-
|
|
198
|
+
statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
if (
|
|
201
|
+
if (statementUnifies) {
|
|
202
202
|
specificContext.debug(`...unified the '${statementString}' statement with the '${suppositionString}' supposition.`);
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
return
|
|
205
|
+
return statementUnifies;
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
toJSON() {
|
package/src/dom/term.js
CHANGED
|
@@ -122,30 +122,30 @@ export default domAssigned(class Term {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
verify(context, verifyAhead) {
|
|
125
|
-
let
|
|
125
|
+
let verifies;
|
|
126
126
|
|
|
127
127
|
const termString = this.string; ///
|
|
128
128
|
|
|
129
129
|
context.trace(`Verifying the '${termString}' term...`);
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
verifies = verifyMixins.some((verifyMixin) => {
|
|
132
132
|
const term = this, ///
|
|
133
|
-
|
|
133
|
+
verifies = verifyMixin(term, context, verifyAhead);
|
|
134
134
|
|
|
135
|
-
if (
|
|
135
|
+
if (verifies) {
|
|
136
136
|
return true;
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
139
|
|
|
140
|
-
if (
|
|
140
|
+
if (verifies) {
|
|
141
141
|
context.debug(`...verified the '${termString}' term.`);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
return
|
|
144
|
+
return verifies;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
verifyGivenType(type, generalContext, specificContext) {
|
|
148
|
-
let
|
|
148
|
+
let verifiesGivenType;
|
|
149
149
|
|
|
150
150
|
const typeString = type.getString(),
|
|
151
151
|
termString = this.getString(); ///
|
|
@@ -153,25 +153,25 @@ export default domAssigned(class Term {
|
|
|
153
153
|
specificContext.trace(`Verifying the '${termString}' term given the '${typeString}' type...`);
|
|
154
154
|
|
|
155
155
|
const context = specificContext, ///
|
|
156
|
-
|
|
157
|
-
let
|
|
156
|
+
verifies = this.verify(context, () => {
|
|
157
|
+
let verifiesAhead;
|
|
158
158
|
|
|
159
159
|
const typeEqualToOrSubTypeOfGivenTypeType = this.type.isEqualToOrSubTypeOf(type);
|
|
160
160
|
|
|
161
161
|
if (typeEqualToOrSubTypeOfGivenTypeType) {
|
|
162
|
-
|
|
162
|
+
verifiesAhead = true;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
return
|
|
165
|
+
return verifiesAhead;
|
|
166
166
|
});
|
|
167
167
|
|
|
168
|
-
|
|
168
|
+
verifiesGivenType = verifies; ///
|
|
169
169
|
|
|
170
|
-
if (
|
|
170
|
+
if (verifiesGivenType) {
|
|
171
171
|
specificContext.debug(`...verified the '${termString}' term given the '${typeString}' type.`);
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
return
|
|
174
|
+
return verifiesGivenType;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
toJSON() {
|