occam-verify-cli 0.0.1050 → 0.0.1052
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/assertion/subproof.js +16 -12
- package/lib/assertion/type.js +6 -2
- package/lib/conjecture.js +108 -6
- package/lib/constructor.js +2 -3
- package/lib/equality.js +6 -2
- package/lib/mixins/statement/verify.js +9 -9
- package/lib/mixins/term/unify.js +4 -5
- package/lib/mixins/term/verify.js +4 -4
- package/lib/premise.js +2 -2
- package/lib/proofStep.js +2 -13
- package/lib/statement/qualified.js +9 -6
- package/lib/statement/unqualified.js +9 -6
- package/lib/statement.js +1 -1
- package/lib/subproof.js +9 -5
- package/lib/supposition.js +2 -2
- package/lib/term.js +6 -2
- package/lib/verifier/topLevel.js +3 -3
- package/package.json +1 -1
- package/src/assertion/subproof.js +17 -13
- package/src/assertion/type.js +14 -9
- package/src/conjecture.js +88 -1
- package/src/constructor.js +1 -4
- package/src/equality.js +13 -8
- package/src/mixins/statement/verify.js +11 -11
- package/src/mixins/term/unify.js +4 -5
- package/src/mixins/term/verify.js +4 -4
- package/src/premise.js +2 -1
- package/src/proofStep.js +5 -17
- package/src/statement/qualified.js +15 -11
- package/src/statement/unqualified.js +13 -9
- package/src/statement.js +3 -3
- package/src/subproof.js +16 -11
- package/src/supposition.js +2 -1
- package/src/term.js +9 -4
- package/src/verifier/topLevel.js +3 -2
- package/lib/verify/conjecture.js +0 -49
- package/src/verify/conjecture.js +0 -66
package/src/mixins/term/unify.js
CHANGED
|
@@ -20,15 +20,14 @@ function unifyTermWithBracketedConstructor(term, localContext, verifyAhead) {
|
|
|
20
20
|
termUnifiedWithBracketedConstructor = unifyTermWithConstructor(term, bracketedConstructor, localContext, () => {
|
|
21
21
|
let verifiedAhead = false;
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const { Term } = shim,
|
|
24
|
+
bracketedTerm = term, ///
|
|
24
25
|
bracketedTermNode = bracketedTerm.getNode(),
|
|
25
26
|
termNode = termNodeQuery(bracketedTermNode); ///
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
const { Term } = shim;
|
|
29
|
-
|
|
30
|
-
term = Term.fromTermNode(termNode, localContext);
|
|
28
|
+
term = Term.fromTermNode(termNode, localContext);
|
|
31
29
|
|
|
30
|
+
if (term !== null) {
|
|
32
31
|
const termVVerified = term.verify(localContext, () => {
|
|
33
32
|
let verifiedAhead;
|
|
34
33
|
|
|
@@ -10,15 +10,15 @@ function verifyTermAsVariable(term, localContext, verifyAhead) {
|
|
|
10
10
|
let termVerifiedAsVariable = false;
|
|
11
11
|
|
|
12
12
|
const termNode = term.getNode(),
|
|
13
|
-
variableNode = variableNodeQuery(termNode)
|
|
13
|
+
variableNode = variableNodeQuery(termNode),
|
|
14
|
+
variable = Variable.fromVariableNode(variableNode, localContext);
|
|
14
15
|
|
|
15
|
-
if (
|
|
16
|
+
if (variable !== null) {
|
|
16
17
|
const termString = localContext.nodeAsString(termNode);
|
|
17
18
|
|
|
18
19
|
localContext.trace(`Verifying the '${termString}' term as a variable...`, termNode);
|
|
19
20
|
|
|
20
|
-
const
|
|
21
|
-
variableVerified = variable.verify(localContext);
|
|
21
|
+
const variableVerified = variable.verify(localContext);
|
|
22
22
|
|
|
23
23
|
if (variableVerified) {
|
|
24
24
|
let verifiedAhead;
|
package/src/premise.js
CHANGED
|
@@ -40,7 +40,8 @@ export default class Premise {
|
|
|
40
40
|
localContext.trace(`Unifying the '${subproofString}' subproof with the premise's '${premiseStatementString}' statement...`);
|
|
41
41
|
|
|
42
42
|
const statement = this.unqualifiedStatement.getStatement(),
|
|
43
|
-
|
|
43
|
+
statementNode = statement.getNode(),
|
|
44
|
+
subproofAssertion = SubproofAssertion.fromStatementNode(statementNode, this.fileContext);
|
|
44
45
|
|
|
45
46
|
if (subproofAssertion !== null) {
|
|
46
47
|
subproofUnified = subproofAssertion.unifySubproof(subproof, substitutions, this.fileContext, localContext);
|
package/src/proofStep.js
CHANGED
|
@@ -90,23 +90,11 @@ class ProofStep {
|
|
|
90
90
|
static fromProofStepNode(proofStepNode, fileContext) {
|
|
91
91
|
const subproofNode = subproofNodeQuery(proofStepNode),
|
|
92
92
|
qualifiedStatementNode = qualifiedStatementNodeQuery(proofStepNode),
|
|
93
|
-
unqualifiedStatementNode = unqualifiedStatementNodeQuery(proofStepNode)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (false) {
|
|
100
|
-
///
|
|
101
|
-
} else if (subproofNode !== null) {
|
|
102
|
-
subproof = Subproof.fromSubproofNode(subproofNode, fileContext);
|
|
103
|
-
} else if (qualifiedStatementNode !== null) {
|
|
104
|
-
qualifiedStatement = QualifiedStatement.fromQualifiedStatementNode(qualifiedStatementNode, fileContext);
|
|
105
|
-
} else if (unqualifiedStatementNode !== null) {
|
|
106
|
-
unqualifiedStatement = UnqualifiedStatement.fromUnqualifiedStatementNode(unqualifiedStatementNode, fileContext);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const proofStep = new ProofStep(subproof, qualifiedStatement, unqualifiedStatement);
|
|
93
|
+
unqualifiedStatementNode = unqualifiedStatementNodeQuery(proofStepNode),
|
|
94
|
+
subproof = Subproof.fromSubproofNode(subproofNode, fileContext),
|
|
95
|
+
qualifiedStatement = QualifiedStatement.fromQualifiedStatementNode(qualifiedStatementNode, fileContext),
|
|
96
|
+
unqualifiedStatement = UnqualifiedStatement.fromUnqualifiedStatementNode(unqualifiedStatementNode, fileContext),
|
|
97
|
+
proofStep = new ProofStep(subproof, qualifiedStatement, unqualifiedStatement);
|
|
110
98
|
|
|
111
99
|
return proofStep;
|
|
112
100
|
}
|
|
@@ -87,21 +87,25 @@ export default class QualifiedStatement {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
static fromQualifiedStatementNode(qualifiedStatementNode, fileContext) {
|
|
90
|
-
let
|
|
90
|
+
let qualifiedStatement = null;
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
referenceNode = referenceNodeQuery(qualifiedStatementNode),
|
|
95
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
96
|
-
statement = Statement.fromStatementNode(statementNode, localContext),
|
|
97
|
-
reference = Reference.fromReferenceNode(referenceNode, fileContext),
|
|
98
|
-
node = qualifiedStatementNode; ///
|
|
92
|
+
if (qualifiedStatementNode !== null) {
|
|
93
|
+
let string;
|
|
99
94
|
|
|
100
|
-
|
|
95
|
+
const { Statement } = shim,
|
|
96
|
+
statementNode = statementNodeQuery(qualifiedStatementNode),
|
|
97
|
+
referenceNode = referenceNodeQuery(qualifiedStatementNode),
|
|
98
|
+
localContext = LocalContext.fromFileContext(fileContext),
|
|
99
|
+
statement = Statement.fromStatementNode(statementNode, localContext),
|
|
100
|
+
reference = Reference.fromReferenceNode(referenceNode, fileContext),
|
|
101
|
+
node = qualifiedStatementNode; ///
|
|
101
102
|
|
|
102
|
-
|
|
103
|
+
string = fileContext.nodeAsString(node);
|
|
103
104
|
|
|
104
|
-
|
|
105
|
+
string = trim(string); ///
|
|
106
|
+
|
|
107
|
+
qualifiedStatement = new QualifiedStatement(string, statement, reference);
|
|
108
|
+
}
|
|
105
109
|
|
|
106
110
|
return qualifiedStatement;
|
|
107
111
|
}
|
|
@@ -73,19 +73,23 @@ export default class UnqualifiedStatement {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
static fromUnqualifiedStatementNode(unqualifiedStatementNode, fileContext) {
|
|
76
|
-
let
|
|
76
|
+
let unqualifiedStatement = null;
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
81
|
-
statement = Statement.fromStatementNode(statementNode, localContext),
|
|
82
|
-
node = unqualifiedStatementNode; ///
|
|
78
|
+
if (unqualifiedStatementNode !== null) {
|
|
79
|
+
let string;
|
|
83
80
|
|
|
84
|
-
|
|
81
|
+
const { Statement } = shim,
|
|
82
|
+
statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
83
|
+
localContext = LocalContext.fromFileContext(fileContext),
|
|
84
|
+
statement = Statement.fromStatementNode(statementNode, localContext),
|
|
85
|
+
node = unqualifiedStatementNode; ///
|
|
85
86
|
|
|
86
|
-
|
|
87
|
+
string = fileContext.nodeAsString(node);
|
|
87
88
|
|
|
88
|
-
|
|
89
|
+
string = trim(string); ///
|
|
90
|
+
|
|
91
|
+
unqualifiedStatement = new UnqualifiedStatement(string, statement);
|
|
92
|
+
}
|
|
89
93
|
|
|
90
94
|
return unqualifiedStatement;
|
|
91
95
|
}
|
package/src/statement.js
CHANGED
|
@@ -153,9 +153,9 @@ class Statement {
|
|
|
153
153
|
|
|
154
154
|
if (statementNode !== null) {
|
|
155
155
|
const node = statementNode, ///
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
string = localContext.nodeAsString(node),
|
|
157
|
+
statementSubstitution = StatementSubstitution.fromStatementNode(statementNode, localContext),
|
|
158
|
+
substitution = statementSubstitution; ///
|
|
159
159
|
|
|
160
160
|
statement = new Statement(string, node, substitution);
|
|
161
161
|
}
|
package/src/subproof.js
CHANGED
|
@@ -77,17 +77,22 @@ export default class Subproof {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
static fromSubproofNode(subproofNode, fileContext) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
80
|
+
let subproof = null;
|
|
81
|
+
|
|
82
|
+
if (subproofNode !== null) {
|
|
83
|
+
const subproofString = subproofStringFromSubproofNode(subproofNode, fileContext),
|
|
84
|
+
suppositionNodes = suppositionNodesQuery(subproofNode),
|
|
85
|
+
subDerivationNode = subDerivationNodeQuery(subproofNode),
|
|
86
|
+
string = subproofString, ///
|
|
87
|
+
suppositions = suppositionNodes.map((suppositionNode) => {
|
|
88
|
+
const supposition = Supposition.fromSuppositionNode(suppositionNode, fileContext);
|
|
89
|
+
|
|
90
|
+
return supposition;
|
|
91
|
+
}),
|
|
92
|
+
subDerivation = SubDerivation.fromSubDerivationNode(subDerivationNode, fileContext);
|
|
93
|
+
|
|
94
|
+
subproof = new Subproof(string, suppositions, subDerivation);
|
|
95
|
+
}
|
|
91
96
|
|
|
92
97
|
return subproof;
|
|
93
98
|
}
|
package/src/supposition.js
CHANGED
|
@@ -71,7 +71,8 @@ export default class Supposition {
|
|
|
71
71
|
localContext.trace(`Unifying the '${subproofString}' subproof with the supposition's '${suppositionStatementString}' statement...`);
|
|
72
72
|
|
|
73
73
|
const statement = this.unqualifiedStatement.getStatement(),
|
|
74
|
-
|
|
74
|
+
statementNode = statement.getNode(),
|
|
75
|
+
subproofAssertion = SubproofAssertion.fromStatementNode(statementNode, this.fileContext);
|
|
75
76
|
|
|
76
77
|
if (subproofAssertion !== null) {
|
|
77
78
|
subproofUnified = subproofAssertion.unifySubproof(subproof, substitutions, this.fileContext, localContext);
|
package/src/term.js
CHANGED
|
@@ -240,10 +240,15 @@ class Term {
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
static fromTermNode(termNode, localContext) {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
243
|
+
let term = null;
|
|
244
|
+
|
|
245
|
+
if (termNode !== null) {
|
|
246
|
+
const node = termNode, ///
|
|
247
|
+
string = localContext.nodeAsString(node),
|
|
248
|
+
type = null;
|
|
249
|
+
|
|
250
|
+
term = new Term(string, node, type);
|
|
251
|
+
}
|
|
247
252
|
|
|
248
253
|
return term;
|
|
249
254
|
}
|
package/src/verifier/topLevel.js
CHANGED
|
@@ -5,6 +5,7 @@ import Error from "../error";
|
|
|
5
5
|
import Axiom from "../axiom";
|
|
6
6
|
import Lemma from "../lemma";
|
|
7
7
|
import Theorem from "../theorem";
|
|
8
|
+
import Conjecture from "../conjecture";
|
|
8
9
|
import TypeDeclaration from "../declaration/type";
|
|
9
10
|
import VariableDeclaration from "../declaration/variable";
|
|
10
11
|
import CombinatorDeclaration from "../declaration/combinator";
|
|
@@ -13,7 +14,6 @@ import MetavariableDeclaration from "../declaration/metavariable";
|
|
|
13
14
|
|
|
14
15
|
import Verifier from "../verifier";
|
|
15
16
|
import verifyMetaLemma from "../verify/metaLemma";
|
|
16
|
-
import verifyConjecture from "../verify/conjecture";
|
|
17
17
|
import verifyMetatheorem from "../verify/metatheorem";
|
|
18
18
|
|
|
19
19
|
import { nodeQuery } from "../utilities/query";
|
|
@@ -101,7 +101,8 @@ class TopLevelVerifier extends Verifier {
|
|
|
101
101
|
{
|
|
102
102
|
nodeQuery: conjectureNodeQuery,
|
|
103
103
|
verify: (conjectureNode, fileContext) => {
|
|
104
|
-
const
|
|
104
|
+
const conjecture = Conjecture.fromConjectureNode(conjectureNode, fileContext),
|
|
105
|
+
conjectureVerified = conjecture.verify();
|
|
105
106
|
|
|
106
107
|
return conjectureVerified;
|
|
107
108
|
}
|
package/lib/verify/conjecture.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return verifyConjecture;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _conjecture = /*#__PURE__*/ _interop_require_default(require("../conjecture"));
|
|
12
|
-
var _local = /*#__PURE__*/ _interop_require_default(require("../context/local"));
|
|
13
|
-
var _substitutions = /*#__PURE__*/ _interop_require_default(require("../substitutions"));
|
|
14
|
-
var _array = require("../utilities/array");
|
|
15
|
-
var _query = require("../utilities/query");
|
|
16
|
-
function _interop_require_default(obj) {
|
|
17
|
-
return obj && obj.__esModule ? obj : {
|
|
18
|
-
default: obj
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
var proofNodeQuery = (0, _query.nodeQuery)("/conjecture/proof!"), labelNodesQuery = (0, _query.nodesQuery)("/conjecture/label!"), consequentNodeQuery = (0, _query.nodeQuery)("/conjecture/consequent!"), suppositionsNodeQuery = (0, _query.nodesQuery)("/conjecture/supposition");
|
|
22
|
-
function verifyConjecture(conjectureNode, fileContext) {
|
|
23
|
-
var conjectureVerified = false;
|
|
24
|
-
var labelNodes = labelNodesQuery(conjectureNode), labelsString = fileContext.nodesAsString(labelNodes);
|
|
25
|
-
fileContext.trace("Verifying the '".concat(labelsString, "' conjecture..."), conjectureNode);
|
|
26
|
-
var labels = [], labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
27
|
-
if (labelsVerified) {
|
|
28
|
-
var localContext = _local.default.fromFileContext(fileContext), suppositions = [], suppositionNodes = suppositionsNodeQuery(conjectureNode), suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
29
|
-
if (suppositionsVerified) {
|
|
30
|
-
var consequents = [], consequentNode = consequentNodeQuery(conjectureNode), consequentVerified = verifyConsequent(consequentNode, consequents, localContext);
|
|
31
|
-
if (consequentVerified) {
|
|
32
|
-
var proofNode = proofNodeQuery(conjectureNode), firstConsequent = (0, _array.first)(consequents), consequent = firstConsequent; ///
|
|
33
|
-
if (proofNode !== null) {
|
|
34
|
-
var substitutions = _substitutions.default.fromNothing();
|
|
35
|
-
verifyProof(proofNode, consequent, substitutions, localContext);
|
|
36
|
-
}
|
|
37
|
-
var substitutions1 = _substitutions.default.fromNothing(), conjecture = _conjecture.default.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions1, fileContext);
|
|
38
|
-
fileContext.addConjecture(conjecture);
|
|
39
|
-
conjectureVerified = true;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (conjectureVerified) {
|
|
44
|
-
fileContext.debug("...verified the '".concat(labelsString, "' conjecture."), conjectureNode);
|
|
45
|
-
}
|
|
46
|
-
return conjectureVerified;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FekUsSUFBSVMsb0JBQW9CO2dCQUN0QixJQUFNRSxZQUFZM0IsZUFBZU0saUJBQzNCc0Isa0JBQWtCQyxJQUFBQSxZQUFLLEVBQUNOLGNBQ3hCTyxhQUFhRixpQkFBaUIsR0FBRztnQkFFdkMsSUFBSUQsY0FBYyxNQUFNO29CQUN0QixJQUFNSSxnQkFBZ0JDLHNCQUFhLENBQUNDLFdBQVc7b0JBRS9DQyxZQUFZUCxXQUFXRyxZQUFZQyxlQUFlZjtnQkFDcEQ7Z0JBRUEsSUFBTWUsaUJBQWdCQyxzQkFBYSxDQUFDQyxXQUFXLElBQ3pDRSxhQUFhQyxtQkFBVSxDQUFDQywyREFBMkQsQ0FBQ3hCLFFBQVFNLGNBQWNXLFlBQVlDLGdCQUFleEI7Z0JBRTNJQSxZQUFZK0IsYUFBYSxDQUFDSDtnQkFFMUIzQixxQkFBcUI7WUFDdkI7UUFDRjtJQUNGO0lBRUEsSUFBSUEsb0JBQW9CO1FBQ3RCRCxZQUFZZ0MsS0FBSyxDQUFDLEFBQUMsb0JBQWdDLE9BQWI3QixjQUFhLGtCQUFnQko7SUFDckU7SUFFQSxPQUFPRTtBQUNUIn0=
|
package/src/verify/conjecture.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import Conjecture from "../conjecture";
|
|
4
|
-
// import verifyProof from "../verify/proof";
|
|
5
|
-
import LocalContext from "../context/local";
|
|
6
|
-
import Substitutions from "../substitutions";
|
|
7
|
-
// import verifyConsequent from "../verify/consequent";
|
|
8
|
-
// import verifySuppositions from "../verify/suppositions";
|
|
9
|
-
|
|
10
|
-
import { first } from "../utilities/array";
|
|
11
|
-
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
12
|
-
|
|
13
|
-
const proofNodeQuery = nodeQuery("/conjecture/proof!"),
|
|
14
|
-
labelNodesQuery = nodesQuery("/conjecture/label!"),
|
|
15
|
-
consequentNodeQuery = nodeQuery("/conjecture/consequent!"),
|
|
16
|
-
suppositionsNodeQuery = nodesQuery("/conjecture/supposition");
|
|
17
|
-
|
|
18
|
-
export default function verifyConjecture(conjectureNode, fileContext) {
|
|
19
|
-
let conjectureVerified = false;
|
|
20
|
-
|
|
21
|
-
const labelNodes = labelNodesQuery(conjectureNode),
|
|
22
|
-
labelsString = fileContext.nodesAsString(labelNodes);
|
|
23
|
-
|
|
24
|
-
fileContext.trace(`Verifying the '${labelsString}' conjecture...`, conjectureNode);
|
|
25
|
-
|
|
26
|
-
const labels = [],
|
|
27
|
-
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
28
|
-
|
|
29
|
-
if (labelsVerified) {
|
|
30
|
-
const localContext = LocalContext.fromFileContext(fileContext),
|
|
31
|
-
suppositions = [],
|
|
32
|
-
suppositionNodes = suppositionsNodeQuery(conjectureNode),
|
|
33
|
-
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
34
|
-
|
|
35
|
-
if (suppositionsVerified) {
|
|
36
|
-
const consequents = [],
|
|
37
|
-
consequentNode = consequentNodeQuery(conjectureNode),
|
|
38
|
-
consequentVerified = verifyConsequent(consequentNode, consequents, localContext);
|
|
39
|
-
|
|
40
|
-
if (consequentVerified) {
|
|
41
|
-
const proofNode = proofNodeQuery(conjectureNode),
|
|
42
|
-
firstConsequent = first(consequents),
|
|
43
|
-
consequent = firstConsequent; ///
|
|
44
|
-
|
|
45
|
-
if (proofNode !== null) {
|
|
46
|
-
const substitutions = Substitutions.fromNothing();
|
|
47
|
-
|
|
48
|
-
verifyProof(proofNode, consequent, substitutions, localContext);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const substitutions = Substitutions.fromNothing(),
|
|
52
|
-
conjecture = Conjecture.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext);
|
|
53
|
-
|
|
54
|
-
fileContext.addConjecture(conjecture);
|
|
55
|
-
|
|
56
|
-
conjectureVerified = true;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (conjectureVerified) {
|
|
62
|
-
fileContext.debug(`...verified the '${labelsString}' conjecture.`, conjectureNode);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return conjectureVerified;
|
|
66
|
-
}
|