occam-verify-cli 1.0.388 → 1.0.404
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/action/verify.js +3 -3
- package/lib/assignment/equality.js +2 -2
- package/lib/context/file.js +11 -11
- package/lib/context/local.js +38 -61
- package/lib/context/partial.js +10 -10
- package/lib/context/temporary.js +755 -0
- package/lib/mixins/statement/verify.js +38 -16
- package/lib/mixins/step/unify.js +7 -8
- package/lib/node/argument.js +4 -4
- package/lib/node/assertion/contained.js +6 -6
- package/lib/node/assertion/defined.js +6 -6
- package/lib/node/assertion/property.js +6 -6
- package/lib/node/assertion/satisfies.js +6 -6
- package/lib/node/assertion/subproof.js +6 -6
- package/lib/node/assertion/type.js +6 -6
- package/lib/node/assertion.js +107 -0
- package/lib/node/assumption.js +134 -0
- package/lib/node/axiom.js +6 -6
- package/lib/node/{topLevelAssertion.js → axiomLemmaTheoremConjecture.js} +12 -12
- package/lib/node/body.js +4 -5
- package/lib/node/combinator.js +4 -4
- package/lib/node/conclusion.js +4 -4
- package/lib/node/conjecture.js +6 -6
- package/lib/node/constructor.js +4 -4
- package/lib/node/declaration/combinator.js +6 -6
- package/lib/node/declaration/complexType.js +6 -6
- package/lib/node/declaration/constructor.js +6 -6
- package/lib/node/declaration/metavariable.js +6 -6
- package/lib/node/declaration/property.js +6 -6
- package/lib/node/declaration/simpleType.js +6 -6
- package/lib/node/declaration/typePrefix.js +6 -6
- package/lib/node/declaration/variable.js +6 -6
- package/lib/node/declaration.js +6 -22
- package/lib/node/deduction.js +4 -4
- package/lib/node/derivation.js +4 -4
- package/lib/node/document.js +107 -0
- package/lib/node/equality.js +4 -4
- package/lib/node/error.js +4 -4
- package/lib/node/frame.js +25 -14
- package/lib/node/header.js +4 -4
- package/lib/node/hypothesis.js +4 -4
- package/lib/node/judgement.js +8 -8
- package/lib/node/label.js +4 -4
- package/lib/node/labels.js +4 -4
- package/lib/node/lemma.js +6 -6
- package/lib/node/metaArgument.js +4 -4
- package/lib/node/metaLemma.js +6 -6
- package/lib/node/{topLevelMetaAssertion.js → metaLemmaMetaTheorem.js} +12 -12
- package/lib/node/metaType.js +4 -4
- package/lib/node/metatheorem.js +6 -6
- package/lib/node/metavariable.js +4 -4
- package/lib/node/nonsense.js +4 -4
- package/lib/node/parameter.js +4 -4
- package/lib/node/parenthesisedLabel.js +4 -4
- package/lib/node/parenthesisedLabels.js +4 -4
- package/lib/node/placeholder.js +107 -0
- package/lib/node/premise.js +4 -4
- package/lib/node/procedureCall.js +4 -4
- package/lib/node/procedureReference.js +4 -4
- package/lib/node/proof.js +4 -4
- package/lib/node/property.js +4 -4
- package/lib/node/propertyRelation.js +4 -4
- package/lib/node/qualification.js +4 -4
- package/lib/node/reference.js +4 -4
- package/lib/node/rule.js +4 -4
- package/lib/node/section.js +4 -4
- package/lib/node/signature.js +4 -4
- package/lib/node/statement.js +15 -4
- package/lib/node/step.js +4 -4
- package/lib/node/subDerivation.js +4 -4
- package/lib/node/subproof.js +4 -4
- package/lib/node/substitution/frame.js +28 -6
- package/lib/node/substitution/statement.js +6 -6
- package/lib/node/substitution/term.js +28 -6
- package/lib/node/substitution.js +107 -0
- package/lib/node/supposition.js +4 -4
- package/lib/node/term.js +27 -4
- package/lib/node/theorem.js +6 -6
- package/lib/node/type.js +4 -4
- package/lib/node/typePrefix.js +4 -4
- package/lib/node/types.js +4 -4
- package/lib/node/variable.js +4 -4
- package/lib/nominal/parser.js +3 -3
- package/lib/nonTerminalNode.js +222 -0
- package/lib/nonTerminalNodeMap.js +5 -3
- package/lib/ontology/assertion/contained.js +80 -39
- package/lib/ontology/assertion/defined.js +80 -39
- package/lib/ontology/assertion/property.js +71 -29
- package/lib/ontology/assertion/satisfies.js +73 -25
- package/lib/ontology/assertion/subproof.js +95 -41
- package/lib/ontology/assertion/type.js +74 -18
- package/lib/ontology/assertion.js +66 -0
- package/lib/ontology/assumption.js +379 -0
- package/lib/ontology/axiom.js +8 -11
- package/lib/ontology/combinator/bracketed.js +17 -3
- package/lib/ontology/combinator.js +17 -3
- package/lib/ontology/conclusion.js +38 -9
- package/lib/ontology/constructor/bracketed.js +17 -3
- package/lib/ontology/constructor.js +17 -3
- package/lib/ontology/declaration/combinator.js +75 -33
- package/lib/ontology/declaration/complexType.js +110 -63
- package/lib/ontology/declaration/constructor.js +81 -38
- package/lib/ontology/declaration/metavariable.js +87 -39
- package/lib/ontology/declaration/simpleType.js +95 -48
- package/lib/ontology/declaration/typePrefix.js +87 -40
- package/lib/ontology/declaration/variable.js +87 -39
- package/lib/ontology/declaration.js +13 -313
- package/lib/ontology/deduction.js +38 -9
- package/lib/ontology/equivalence.js +295 -0
- package/lib/ontology/equivalences.js +264 -0
- package/lib/ontology/frame.js +83 -51
- package/lib/ontology/hypothesis.js +11 -11
- package/lib/ontology/judgement.js +8 -8
- package/lib/ontology/label.js +5 -6
- package/lib/ontology/metavariable.js +14 -15
- package/lib/ontology/premise.js +60 -21
- package/lib/ontology/procedureCall.js +15 -15
- package/lib/ontology/procedureReference.js +1 -1
- package/lib/ontology/proof.js +2 -2
- package/lib/ontology/reference.js +6 -13
- package/lib/ontology/rule.js +69 -71
- package/lib/ontology/section.js +2 -2
- package/lib/ontology/signature.js +2 -2
- package/lib/ontology/statement.js +36 -24
- package/lib/ontology/step.js +38 -26
- package/lib/ontology/subproof.js +12 -13
- package/lib/ontology/substitution/frame.js +69 -21
- package/lib/ontology/substitution/reference.js +24 -9
- package/lib/ontology/substitution/statement.js +137 -76
- package/lib/ontology/substitution/term.js +75 -35
- package/lib/ontology/substitution.js +50 -44
- package/lib/ontology/substitutions.js +425 -0
- package/lib/ontology/supposition.js +69 -29
- package/lib/ontology/term.js +35 -37
- package/lib/ontology/topLevelAssertion.js +16 -17
- package/lib/ontology/topLevelMetaAssertion.js +3 -4
- package/lib/ontology/variable.js +9 -14
- package/lib/preamble.js +7 -4
- package/lib/ruleNames.js +20 -12
- package/lib/unifier/intrinsicLevel.js +4 -5
- package/lib/unifier/metaLevel.js +24 -24
- package/lib/utilities/brackets.js +4 -21
- package/lib/utilities/context.js +6 -6
- package/lib/utilities/frame.js +18 -0
- package/lib/utilities/json.js +24 -1
- package/lib/utilities/metavariable.js +18 -0
- package/lib/utilities/statement.js +18 -0
- package/lib/utilities/substitutions.js +43 -30
- package/lib/utilities/unification.js +10 -16
- package/lib/utilities/variable.js +18 -0
- package/package.json +10 -10
- package/src/action/verify.js +2 -2
- package/src/assignment/equality.js +1 -1
- package/src/context/file.js +13 -11
- package/src/context/local.js +40 -65
- package/src/context/partial.js +9 -14
- package/src/context/temporary.js +463 -0
- package/src/mixins/statement/verify.js +60 -23
- package/src/mixins/step/unify.js +6 -6
- package/src/node/argument.js +1 -1
- package/src/node/assertion/contained.js +3 -3
- package/src/node/assertion/defined.js +3 -3
- package/src/node/assertion/property.js +3 -3
- package/src/node/assertion/satisfies.js +3 -3
- package/src/node/assertion/subproof.js +3 -3
- package/src/node/assertion/type.js +3 -3
- package/src/node/assertion.js +7 -0
- package/src/node/assumption.js +35 -0
- package/src/node/axiom.js +3 -3
- package/src/node/{topLevelAssertion.js → axiomLemmaTheoremConjecture.js} +2 -2
- package/src/node/body.js +1 -3
- package/src/node/combinator.js +1 -1
- package/src/node/conclusion.js +1 -1
- package/src/node/conjecture.js +3 -3
- package/src/node/constructor.js +1 -1
- package/src/node/declaration/combinator.js +3 -3
- package/src/node/declaration/complexType.js +3 -3
- package/src/node/declaration/constructor.js +3 -3
- package/src/node/declaration/metavariable.js +3 -3
- package/src/node/declaration/property.js +3 -3
- package/src/node/declaration/simpleType.js +3 -3
- package/src/node/declaration/typePrefix.js +3 -3
- package/src/node/declaration/variable.js +3 -3
- package/src/node/declaration.js +2 -18
- package/src/node/deduction.js +1 -1
- package/src/node/derivation.js +1 -1
- package/src/node/document.js +7 -0
- package/src/node/equality.js +1 -1
- package/src/node/error.js +1 -1
- package/src/node/frame.js +23 -11
- package/src/node/header.js +1 -1
- package/src/node/hypothesis.js +1 -1
- package/src/node/judgement.js +6 -6
- package/src/node/label.js +1 -1
- package/src/node/labels.js +1 -1
- package/src/node/lemma.js +3 -3
- package/src/node/metaArgument.js +1 -1
- package/src/node/metaLemma.js +3 -3
- package/src/node/{topLevelMetaAssertion.js → metaLemmaMetaTheorem.js} +2 -2
- package/src/node/metaType.js +1 -1
- package/src/node/metatheorem.js +3 -3
- package/src/node/metavariable.js +1 -1
- package/src/node/nonsense.js +1 -1
- package/src/node/parameter.js +1 -1
- package/src/node/parenthesisedLabel.js +1 -1
- package/src/node/parenthesisedLabels.js +1 -1
- package/src/node/placeholder.js +7 -0
- package/src/node/premise.js +1 -1
- package/src/node/procedureCall.js +1 -1
- package/src/node/procedureReference.js +1 -1
- package/src/node/proof.js +1 -1
- package/src/node/property.js +1 -1
- package/src/node/propertyRelation.js +1 -1
- package/src/node/qualification.js +1 -1
- package/src/node/reference.js +1 -1
- package/src/node/rule.js +2 -2
- package/src/node/section.js +1 -1
- package/src/node/signature.js +1 -1
- package/src/node/statement.js +13 -1
- package/src/node/step.js +1 -1
- package/src/node/subDerivation.js +1 -1
- package/src/node/subproof.js +1 -1
- package/src/node/substitution/frame.js +29 -3
- package/src/node/substitution/statement.js +3 -3
- package/src/node/substitution/term.js +29 -3
- package/src/node/substitution.js +7 -0
- package/src/node/supposition.js +1 -1
- package/src/node/term.js +27 -1
- package/src/node/theorem.js +3 -3
- package/src/node/type.js +1 -1
- package/src/node/typePrefix.js +1 -1
- package/src/node/types.js +1 -1
- package/src/node/variable.js +1 -1
- package/src/nominal/parser.js +2 -2
- package/src/{node/nonTerminal.js → nonTerminalNode.js} +31 -25
- package/src/nonTerminalNodeMap.js +10 -5
- package/src/ontology/assertion/contained.js +21 -32
- package/src/ontology/assertion/defined.js +20 -31
- package/src/ontology/assertion/property.js +7 -20
- package/src/ontology/assertion/satisfies.js +8 -16
- package/src/ontology/assertion/subproof.js +36 -42
- package/src/ontology/assertion/type.js +10 -11
- package/src/ontology/assertion.js +23 -0
- package/src/ontology/assumption.js +385 -0
- package/src/ontology/axiom.js +7 -16
- package/src/ontology/combinator/bracketed.js +2 -0
- package/src/ontology/combinator.js +2 -0
- package/src/ontology/conclusion.js +51 -10
- package/src/ontology/constructor/bracketed.js +2 -0
- package/src/ontology/constructor.js +2 -0
- package/src/ontology/declaration/combinator.js +15 -24
- package/src/ontology/declaration/complexType.js +57 -53
- package/src/ontology/declaration/constructor.js +25 -31
- package/src/ontology/declaration/metavariable.js +25 -30
- package/src/ontology/declaration/simpleType.js +34 -38
- package/src/ontology/declaration/typePrefix.js +23 -31
- package/src/ontology/declaration/variable.js +26 -31
- package/src/ontology/declaration.js +8 -339
- package/src/ontology/deduction.js +51 -10
- package/src/{equivalence.js → ontology/equivalence.js} +4 -3
- package/src/{equivalences.js → ontology/equivalences.js} +14 -12
- package/src/ontology/frame.js +93 -66
- package/src/ontology/hypothesis.js +8 -8
- package/src/ontology/judgement.js +8 -8
- package/src/ontology/label.js +2 -7
- package/src/ontology/metavariable.js +14 -17
- package/src/ontology/premise.js +82 -25
- package/src/ontology/procedureCall.js +14 -14
- package/src/ontology/procedureReference.js +2 -2
- package/src/ontology/proof.js +1 -1
- package/src/ontology/reference.js +5 -9
- package/src/ontology/rule.js +79 -82
- package/src/ontology/section.js +1 -1
- package/src/ontology/signature.js +1 -1
- package/src/ontology/statement.js +37 -27
- package/src/ontology/step.js +45 -28
- package/src/ontology/subproof.js +10 -10
- package/src/ontology/substitution/frame.js +72 -26
- package/src/ontology/substitution/reference.js +8 -6
- package/src/ontology/substitution/statement.js +95 -76
- package/src/ontology/substitution/term.js +81 -41
- package/src/ontology/substitution.js +35 -34
- package/src/{substitutions.js → ontology/substitutions.js} +29 -28
- package/src/ontology/supposition.js +88 -28
- package/src/ontology/term.js +31 -43
- package/src/ontology/topLevelAssertion.js +16 -18
- package/src/ontology/topLevelMetaAssertion.js +3 -3
- package/src/ontology/variable.js +10 -17
- package/src/preamble.js +6 -3
- package/src/ruleNames.js +10 -8
- package/src/unifier/intrinsicLevel.js +5 -6
- package/src/unifier/metaLevel.js +32 -29
- package/src/utilities/brackets.js +3 -29
- package/src/utilities/context.js +5 -5
- package/src/utilities/frame.js +13 -0
- package/src/utilities/json.js +28 -0
- package/src/utilities/metavariable.js +13 -0
- package/src/utilities/statement.js +13 -0
- package/src/utilities/substitutions.js +59 -33
- package/src/utilities/unification.js +8 -24
- package/src/utilities/variable.js +13 -0
- package/lib/equivalence.js +0 -294
- package/lib/equivalences.js +0 -263
- package/lib/node/nonTerminal.js +0 -218
- package/lib/substitutions.js +0 -424
package/src/ontology/frame.js
CHANGED
|
@@ -11,11 +11,11 @@ import { FRAME_META_TYPE_NAME } from "../metaTypeNames";
|
|
|
11
11
|
const { first } = arrayUtilities;
|
|
12
12
|
|
|
13
13
|
export default define(class Frame {
|
|
14
|
-
constructor(string, node, tokens,
|
|
14
|
+
constructor(string, node, tokens, assumptions) {
|
|
15
15
|
this.string = string;
|
|
16
16
|
this.node = node;
|
|
17
17
|
this.tokens = tokens;
|
|
18
|
-
this.
|
|
18
|
+
this.assumptions = assumptions;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
getString() {
|
|
@@ -30,42 +30,42 @@ export default define(class Frame {
|
|
|
30
30
|
return this.tokens;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
return this.
|
|
33
|
+
getAssumptions() {
|
|
34
|
+
return this.assumptions;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
getLength() { return this.
|
|
37
|
+
getLength() { return this.assumptions.length; }
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
let
|
|
39
|
+
getAssumption() {
|
|
40
|
+
let assumption = null;
|
|
41
41
|
|
|
42
|
-
const
|
|
42
|
+
const length = this.getLength();
|
|
43
43
|
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
declaration = firstDeclaration; ///
|
|
44
|
+
if (length === 1) {
|
|
45
|
+
const firstAssumption = first(this.assumptions);
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
assumption = firstAssumption; ///
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
return
|
|
50
|
+
return assumption;
|
|
52
51
|
}
|
|
53
52
|
|
|
54
|
-
|
|
55
|
-
let
|
|
53
|
+
getMetavariable() {
|
|
54
|
+
let metavariable = null;
|
|
56
55
|
|
|
57
|
-
const
|
|
56
|
+
const simple = this.isSimple();
|
|
58
57
|
|
|
59
|
-
if (
|
|
60
|
-
const
|
|
61
|
-
declaration = firstDeclaration; ///
|
|
58
|
+
if (simple) {
|
|
59
|
+
const assumption = this.getAssumption();
|
|
62
60
|
|
|
63
|
-
|
|
61
|
+
metavariable = assumption.getMetavariable();
|
|
64
62
|
}
|
|
65
63
|
|
|
66
|
-
return
|
|
64
|
+
return metavariable;
|
|
67
65
|
}
|
|
68
66
|
|
|
67
|
+
isSimple() { return this.node.isSimple();}
|
|
68
|
+
|
|
69
69
|
isEqualTo(frame) {
|
|
70
70
|
const frameString = frame.getString(),
|
|
71
71
|
equalTo = (frameString === this.string);
|
|
@@ -73,6 +73,8 @@ export default define(class Frame {
|
|
|
73
73
|
return equalTo;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
matchFrameNode(frameNode) { return this.node.match(frameNode); }
|
|
77
|
+
|
|
76
78
|
matchSubstitution(substitution, context) {
|
|
77
79
|
let substitutionMatches = false;
|
|
78
80
|
|
|
@@ -82,10 +84,10 @@ export default define(class Frame {
|
|
|
82
84
|
context.trace(`Matching the '${substitutionString}' substitution against the '${frameString}' frame...`);
|
|
83
85
|
|
|
84
86
|
if (!substitutionMatches) {
|
|
85
|
-
substitutionMatches = this.
|
|
86
|
-
const
|
|
87
|
+
substitutionMatches = this.assumptions.some((assumption) => {
|
|
88
|
+
const substitutionMatchesAssumption = assumption.matchSubstitution(substitution, context);
|
|
87
89
|
|
|
88
|
-
if (
|
|
90
|
+
if (substitutionMatchesAssumption) {
|
|
89
91
|
return true;
|
|
90
92
|
}
|
|
91
93
|
});
|
|
@@ -128,9 +130,9 @@ export default define(class Frame {
|
|
|
128
130
|
|
|
129
131
|
context.trace(`Verifying the '${frameString}' frame...`);
|
|
130
132
|
|
|
131
|
-
const
|
|
133
|
+
const assumptionsVerify = this.verifyAssumptions(assignments, stated, context);
|
|
132
134
|
|
|
133
|
-
if (
|
|
135
|
+
if (assumptionsVerify) {
|
|
134
136
|
let verifiesWhenStated = false,
|
|
135
137
|
verifiesWhenDerived = false;
|
|
136
138
|
|
|
@@ -146,6 +148,10 @@ export default define(class Frame {
|
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
if (verifies) {
|
|
151
|
+
const frame = this; ///
|
|
152
|
+
|
|
153
|
+
context.addFrame(frame);
|
|
154
|
+
|
|
149
155
|
context.debug(`...verified the '${frameString}' frame.`);
|
|
150
156
|
}
|
|
151
157
|
|
|
@@ -190,8 +196,8 @@ export default define(class Frame {
|
|
|
190
196
|
return verifiesWhenDerived;
|
|
191
197
|
}
|
|
192
198
|
|
|
193
|
-
|
|
194
|
-
let
|
|
199
|
+
verifyAssumptions(assignments, stated, context) {
|
|
200
|
+
let assumptionsVerify = true; ///
|
|
195
201
|
|
|
196
202
|
const length = this.getLength();
|
|
197
203
|
|
|
@@ -199,26 +205,26 @@ export default define(class Frame {
|
|
|
199
205
|
const sOrNothing = (length > 1) ?
|
|
200
206
|
S :
|
|
201
207
|
NOTHING,
|
|
202
|
-
|
|
208
|
+
assumptionsString = assumptionsStringFromAssumptions(this.assumptions);
|
|
203
209
|
|
|
204
|
-
context.trace(`Verifying the '${
|
|
210
|
+
context.trace(`Verifying the '${assumptionsString}' assumption${sOrNothing}...`);
|
|
205
211
|
|
|
206
212
|
stated = true; ///
|
|
207
213
|
|
|
208
214
|
assignments = null; ///
|
|
209
215
|
|
|
210
|
-
|
|
211
|
-
const
|
|
216
|
+
assumptionsVerify = this.assumptions.every((assumption) => {
|
|
217
|
+
const assumptionVerifies = assumption.verify(assignments, stated, context);
|
|
212
218
|
|
|
213
|
-
return
|
|
219
|
+
return assumptionVerifies;
|
|
214
220
|
});
|
|
215
221
|
|
|
216
|
-
if (
|
|
217
|
-
context.debug(`...verified the '${
|
|
222
|
+
if (assumptionsVerify) {
|
|
223
|
+
context.debug(`...verified the '${assumptionsString}' assumption${sOrNothing}.`);
|
|
218
224
|
}
|
|
219
225
|
}
|
|
220
226
|
|
|
221
|
-
return
|
|
227
|
+
return assumptionsVerify;
|
|
222
228
|
}
|
|
223
229
|
|
|
224
230
|
verifyGivenMetaType(metaType, assignments, stated, context) {
|
|
@@ -244,8 +250,42 @@ export default define(class Frame {
|
|
|
244
250
|
return verifiesGivenMetaType;
|
|
245
251
|
}
|
|
246
252
|
|
|
253
|
+
toJSON() {
|
|
254
|
+
let json = null;
|
|
255
|
+
|
|
256
|
+
const simple = this.isSimple();
|
|
257
|
+
|
|
258
|
+
if (simple) {
|
|
259
|
+
const assumption = this.getAssumption(),
|
|
260
|
+
assumptionJSON = assumption.toJSON();
|
|
261
|
+
|
|
262
|
+
json = assumptionJSON; ///
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return json;
|
|
266
|
+
}
|
|
267
|
+
|
|
247
268
|
static name = "Frame";
|
|
248
269
|
|
|
270
|
+
static fromJSON(json, context) {
|
|
271
|
+
let frame = null;
|
|
272
|
+
|
|
273
|
+
if (json !== null) {
|
|
274
|
+
const { Assumption } =ontology,
|
|
275
|
+
assumption = Assumption.fromJSON(json, context),
|
|
276
|
+
assumptions = [
|
|
277
|
+
assumption
|
|
278
|
+
],
|
|
279
|
+
string = null,
|
|
280
|
+
node = null,
|
|
281
|
+
tokens = null;
|
|
282
|
+
|
|
283
|
+
frame = new Frame(string, node, tokens, assumptions);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return frame;
|
|
287
|
+
}
|
|
288
|
+
|
|
249
289
|
static fromFrameNode(frameNode, context) {
|
|
250
290
|
let frame = null;
|
|
251
291
|
|
|
@@ -293,47 +333,34 @@ function frameFromFrameNode(frameNode, context) {
|
|
|
293
333
|
node = frameNode, ///
|
|
294
334
|
string = context.nodeAsString(node),
|
|
295
335
|
tokens = context.nodeAsTokens(node),
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
frame = new Frame(string, node, tokens, declarations, metavariables);
|
|
336
|
+
assumptions = assumptionsFromFrameNode(frameNode, context),
|
|
337
|
+
frame = new Frame(string, node, tokens, assumptions);
|
|
299
338
|
|
|
300
339
|
return frame;
|
|
301
340
|
}
|
|
302
341
|
|
|
303
|
-
function
|
|
304
|
-
const {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
return declaration;
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
return declarations;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
function metavariablesFromFrameNode(frameNode, context) {
|
|
316
|
-
const { Metavariable } = ontology,
|
|
317
|
-
metavariableNodes = frameNode.getMetavariableNodes(),
|
|
318
|
-
metavariables = metavariableNodes.map((metavariableNode) => {
|
|
319
|
-
const metavariable = Metavariable.fromMetavariableNode(metavariableNode, context);
|
|
342
|
+
function assumptionsFromFrameNode(frameNode, context) {
|
|
343
|
+
const { Assumption } = ontology,
|
|
344
|
+
assumptionNodes = frameNode.getAssumptionNodes(),
|
|
345
|
+
assumptions = assumptionNodes.map((assumptionNode) => {
|
|
346
|
+
const assumption = Assumption.fromAssumptionNode(assumptionNode, context);
|
|
320
347
|
|
|
321
|
-
return
|
|
348
|
+
return assumption;
|
|
322
349
|
});
|
|
323
350
|
|
|
324
|
-
return
|
|
351
|
+
return assumptions;
|
|
325
352
|
}
|
|
326
353
|
|
|
327
|
-
function
|
|
328
|
-
const
|
|
329
|
-
const
|
|
354
|
+
function assumptionsStringFromAssumptions(assumptions) {
|
|
355
|
+
const assumptionsString = assumptions.reduce((assumptionsString, assumption) => {
|
|
356
|
+
const assumptionString = assumption.getString();
|
|
330
357
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
`${
|
|
358
|
+
assumptionsString = (assumptionsString === null) ?
|
|
359
|
+
assumptionString :
|
|
360
|
+
`${assumptionsString}, ${assumptionString}`;
|
|
334
361
|
|
|
335
|
-
return
|
|
362
|
+
return assumptionsString;
|
|
336
363
|
}, null);
|
|
337
364
|
|
|
338
|
-
return
|
|
365
|
+
return assumptionsString;
|
|
339
366
|
}
|
|
@@ -7,20 +7,20 @@ import { assignAssignments } from "../utilities/assignments";
|
|
|
7
7
|
import { statementFromJSON, statementToStatementJSON } from "../utilities/json";
|
|
8
8
|
|
|
9
9
|
export default define(class Hypothesis {
|
|
10
|
-
constructor(
|
|
11
|
-
this.node = node;
|
|
10
|
+
constructor(string, node, statement) {
|
|
12
11
|
this.string = string;
|
|
12
|
+
this.node = node;
|
|
13
13
|
this.statement = statement;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
getNode() {
|
|
17
|
-
return this.node;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
16
|
getString() {
|
|
21
17
|
return this.string;
|
|
22
18
|
}
|
|
23
19
|
|
|
20
|
+
getNode() {
|
|
21
|
+
return this.node;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
24
|
getStatement() {
|
|
25
25
|
return this.statement;
|
|
26
26
|
}
|
|
@@ -107,7 +107,7 @@ export default define(class Hypothesis {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
const node = null,
|
|
110
|
-
hypothesis = new Hypothesis(
|
|
110
|
+
hypothesis = new Hypothesis(string, node, statement);
|
|
111
111
|
|
|
112
112
|
return hypothesis;
|
|
113
113
|
}
|
|
@@ -117,7 +117,7 @@ export default define(class Hypothesis {
|
|
|
117
117
|
node = hypothesisNode, ///
|
|
118
118
|
string = context.nodeAsString(node),
|
|
119
119
|
statement = Statement.fromHypothesisNode(hypothesisNode, context),
|
|
120
|
-
hypothesis = new Hypothesis(
|
|
120
|
+
hypothesis = new Hypothesis(string, node, statement);
|
|
121
121
|
|
|
122
122
|
return hypothesis
|
|
123
123
|
}
|
|
@@ -6,10 +6,10 @@ import JudgementAssignment from "../assignment/judgement";
|
|
|
6
6
|
import { define } from "../ontology";
|
|
7
7
|
|
|
8
8
|
export default define(class Judgement {
|
|
9
|
-
constructor(string, frame,
|
|
9
|
+
constructor(string, frame, assumption) {
|
|
10
10
|
this.string = string;
|
|
11
11
|
this.frame = frame;
|
|
12
|
-
this.
|
|
12
|
+
this.assumption = assumption;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
getString() {
|
|
@@ -21,7 +21,7 @@ export default define(class Judgement {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
getDeclaration() {
|
|
24
|
-
return this.
|
|
24
|
+
return this.assumption;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
isSimple() { return this.frame.isSimple(); }
|
|
@@ -88,7 +88,7 @@ export default define(class Judgement {
|
|
|
88
88
|
verifyDeclaration(assignments, stated, context) {
|
|
89
89
|
let declarationVerifies;
|
|
90
90
|
|
|
91
|
-
declarationVerifies = this.
|
|
91
|
+
declarationVerifies = this.assumption.verify(assignments, stated, context);
|
|
92
92
|
|
|
93
93
|
return declarationVerifies;
|
|
94
94
|
}
|
|
@@ -116,7 +116,7 @@ export default define(class Judgement {
|
|
|
116
116
|
|
|
117
117
|
context.trace(`Verifying the '${judgementString}' derived judgement...`);
|
|
118
118
|
|
|
119
|
-
const metavariable = this.
|
|
119
|
+
const metavariable = this.assumption.getMetavariable(),
|
|
120
120
|
reference = referenceFromMetavariable(metavariable, context),
|
|
121
121
|
metaLemmaMetatheorem = context.findMetaLemmaMetatheoremByReference(reference),
|
|
122
122
|
substitutions = metaLemmaMetatheorem.getSubstitutions(),
|
|
@@ -151,13 +151,13 @@ export default define(class Judgement {
|
|
|
151
151
|
const judgementNode = statementNode.getJudgementNode();
|
|
152
152
|
|
|
153
153
|
if (judgementNode !== null) {
|
|
154
|
-
const { Frame,
|
|
154
|
+
const { Frame, Assumption } = ontology,
|
|
155
155
|
node = judgementNode, ///
|
|
156
156
|
string = context.nodeAsString(node),
|
|
157
157
|
frame = Frame.fromJudgementNode(judgementNode, context),
|
|
158
|
-
|
|
158
|
+
assumption = Assumption.fromJudgementNode(judgementNode, context);
|
|
159
159
|
|
|
160
|
-
judgement = new Judgement(string, frame,
|
|
160
|
+
judgement = new Judgement(string, frame, assumption);
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
return judgement;
|
package/src/ontology/label.js
CHANGED
|
@@ -35,18 +35,13 @@ export default define(class Label {
|
|
|
35
35
|
|
|
36
36
|
matchReference(reference) {
|
|
37
37
|
const metavariable = reference.getMetavariable(),
|
|
38
|
-
metavariableEqualToMetavariable = this.
|
|
38
|
+
metavariableEqualToMetavariable = this.isMetavariableEqualToMetavariable(metavariable),
|
|
39
39
|
referenceMatches = metavariableEqualToMetavariable; ///
|
|
40
40
|
|
|
41
41
|
return referenceMatches;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
const equalTo = this.metavariable.isEqualTo(metavariable),
|
|
46
|
-
metavariableEqualTo = equalTo; ///
|
|
47
|
-
|
|
48
|
-
return metavariableEqualTo;
|
|
49
|
-
}
|
|
44
|
+
isMetavariableEqualToMetavariable(metavariable) { return this.metavariable.isEqualTo(metavariable); }
|
|
50
45
|
|
|
51
46
|
matchMetavariableName(metavariableName) { return this.metavariable.matchMetavariableName(metavariableName); }
|
|
52
47
|
|
|
@@ -95,9 +95,7 @@ export default define(class Metavariable {
|
|
|
95
95
|
context.trace(`Verifying the '${metavariableString}' metavariable...`);
|
|
96
96
|
|
|
97
97
|
const metavariable = this, ///
|
|
98
|
-
|
|
99
|
-
specificContext = context, ///
|
|
100
|
-
metavariablePresent = generalContext.isMetavariablePresent(metavariable, generalContext, specificContext);
|
|
98
|
+
metavariablePresent = context.isMetavariablePresent(metavariable);
|
|
101
99
|
|
|
102
100
|
verifies = metavariablePresent; ///
|
|
103
101
|
|
|
@@ -118,10 +116,7 @@ export default define(class Metavariable {
|
|
|
118
116
|
|
|
119
117
|
let metavariable = this; ///
|
|
120
118
|
|
|
121
|
-
|
|
122
|
-
generalContext = context; ///
|
|
123
|
-
|
|
124
|
-
metavariable = generalContext.findMetavariable(metavariable, generalContext, specificContext);
|
|
119
|
+
metavariable = context.findMetavariable(metavariable);
|
|
125
120
|
|
|
126
121
|
if (metavariable !== null) {
|
|
127
122
|
const metavariableMetaTypeEqualToMetaType = metavariable.isMetaTypeEqualTo(metaType);
|
|
@@ -155,7 +150,7 @@ export default define(class Metavariable {
|
|
|
155
150
|
if (simpleSubstitutionPresent) {
|
|
156
151
|
const simpleSubstitution = substitutions.findSimpleSubstitutionByMetavariable(metavariable),
|
|
157
152
|
substitution = simpleSubstitution, ///
|
|
158
|
-
substitutionFrameEqualToFrame = substitution.
|
|
153
|
+
substitutionFrameEqualToFrame = substitution.isFrameEqualToFrame(frame);
|
|
159
154
|
|
|
160
155
|
if (substitutionFrameEqualToFrame) {
|
|
161
156
|
frameUnifies = true;
|
|
@@ -167,7 +162,7 @@ export default define(class Metavariable {
|
|
|
167
162
|
frameSubstitution = FrameSubstitution.fromFrameAndMetavariable(frame, metavariable, context),
|
|
168
163
|
substitution = frameSubstitution; ///
|
|
169
164
|
|
|
170
|
-
substitutions.addSubstitution(substitution,
|
|
165
|
+
substitutions.addSubstitution(substitution, context);
|
|
171
166
|
|
|
172
167
|
frameUnifies = true;
|
|
173
168
|
}
|
|
@@ -200,7 +195,7 @@ export default define(class Metavariable {
|
|
|
200
195
|
if (simpleSubstitutionPresent) {
|
|
201
196
|
const simpleSubstitution = substitutions.findSimpleSubstitutionByMetavariable(metavariable), ///
|
|
202
197
|
substitution = simpleSubstitution, ///
|
|
203
|
-
substitutionReferenceEqualToReference = substitution.
|
|
198
|
+
substitutionReferenceEqualToReference = substitution.isReferenceEqualToReference(reference, context);
|
|
204
199
|
|
|
205
200
|
if (substitutionReferenceEqualToReference) {
|
|
206
201
|
referenceUnifies = true;
|
|
@@ -211,7 +206,7 @@ export default define(class Metavariable {
|
|
|
211
206
|
referenceSubstitution = ReferenceSubstitution.fromReferenceAndMetavariable(reference, metavariable, context),
|
|
212
207
|
substitution = referenceSubstitution; ///
|
|
213
208
|
|
|
214
|
-
substitutions.addSubstitution(substitution,
|
|
209
|
+
substitutions.addSubstitution(substitution, context);
|
|
215
210
|
|
|
216
211
|
referenceUnifies = true;
|
|
217
212
|
}
|
|
@@ -247,7 +242,7 @@ export default define(class Metavariable {
|
|
|
247
242
|
if (substitutionPresent) {
|
|
248
243
|
substitution = substitutions.findSubstitutionByMetavariableAndSubstitution(metavariable, substitution); ///
|
|
249
244
|
|
|
250
|
-
const substitutionStatementEqualToStatement = substitution.
|
|
245
|
+
const substitutionStatementEqualToStatement = substitution.isStatementEqualToStatement(statement, context);
|
|
251
246
|
|
|
252
247
|
if (substitutionStatementEqualToStatement) {
|
|
253
248
|
statementUnifies = true;
|
|
@@ -259,7 +254,7 @@ export default define(class Metavariable {
|
|
|
259
254
|
|
|
260
255
|
substitution = statementSubstitution; ///
|
|
261
256
|
|
|
262
|
-
substitutions.addSubstitution(substitution,
|
|
257
|
+
substitutions.addSubstitution(substitution, context);
|
|
263
258
|
|
|
264
259
|
statementUnifies = true;
|
|
265
260
|
}
|
|
@@ -272,10 +267,12 @@ export default define(class Metavariable {
|
|
|
272
267
|
return statementUnifies;
|
|
273
268
|
}
|
|
274
269
|
|
|
275
|
-
unifyMetavariable(metavariable,
|
|
270
|
+
unifyMetavariable(metavariable, context) {
|
|
276
271
|
let metavariableUnifies;
|
|
277
272
|
|
|
278
|
-
const
|
|
273
|
+
const generalContext = context, ///
|
|
274
|
+
specificContext = context, ///
|
|
275
|
+
generalMetavariable = this, ///
|
|
279
276
|
specificMetavariable = metavariable, ///
|
|
280
277
|
generalMetavariableString = generalMetavariable.getString(),
|
|
281
278
|
specificMetavariableString = specificMetavariable.getString();
|
|
@@ -477,8 +474,8 @@ export default define(class Metavariable {
|
|
|
477
474
|
return metavariable;
|
|
478
475
|
}
|
|
479
476
|
|
|
480
|
-
static
|
|
481
|
-
const metavariableNode =
|
|
477
|
+
static fromAssumptionNode(assumptionNode, context) {
|
|
478
|
+
const metavariableNode = assumptionNode.getMetavariableNode(),
|
|
482
479
|
metavariable = metavariableFromMetavariableNode(metavariableNode, context);
|
|
483
480
|
|
|
484
481
|
return metavariable;
|