occam-verify-cli 0.0.1073 → 0.0.1075
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/type.js +47 -54
- package/lib/assignment/equality.js +8 -2
- package/lib/assignment/variable.js +2 -2
- package/lib/axiom.js +9 -12
- package/lib/combinator/bracketed.js +3 -2
- package/lib/combinator.js +6 -6
- package/lib/conclusion.js +2 -3
- package/lib/conjecture.js +10 -15
- package/lib/consequent.js +2 -3
- package/lib/constructor/bracketed.js +3 -2
- package/lib/constructor.js +6 -6
- package/lib/context/file.js +48 -107
- package/lib/context/local.js +52 -73
- package/lib/declaration/combinator.js +5 -5
- package/lib/declaration/constructor.js +5 -5
- package/lib/declaration/metavariable.js +4 -5
- package/lib/declaration/type.js +3 -3
- package/lib/declaration/variable.js +5 -5
- package/lib/declaration.js +6 -2
- package/lib/derivation.js +6 -2
- package/lib/equality.js +53 -22
- package/lib/equivalence.js +22 -24
- package/lib/frame.js +11 -13
- package/lib/index.js +13 -1
- package/lib/judgement.js +11 -8
- package/lib/label.js +6 -7
- package/lib/lemma.js +10 -15
- package/lib/metaLemma.js +15 -15
- package/lib/metatheorem.js +9 -14
- package/lib/metavariable.js +17 -23
- package/lib/mixins/statement/qualified/unify.js +2 -2
- package/lib/mixins/statement/verify.js +8 -12
- package/lib/mixins/term/verify.js +4 -4
- package/lib/premise.js +2 -3
- package/lib/proof.js +8 -4
- package/lib/proofStep.js +10 -8
- package/lib/reference.js +3 -3
- package/lib/rule.js +11 -16
- package/lib/statement/qualified.js +6 -2
- package/lib/statement/unqualified.js +1 -1
- package/lib/statement.js +5 -5
- package/lib/subDerivation.js +6 -2
- package/lib/subproof.js +10 -7
- package/lib/substitution/statementForMetavariable.js +14 -15
- package/lib/substitution.js +13 -13
- package/lib/substitutions.js +51 -47
- package/lib/supposition.js +2 -3
- package/lib/term.js +5 -5
- package/lib/theorem.js +10 -15
- package/lib/topLevelAssertion.js +3 -3
- package/lib/type.js +15 -22
- package/lib/unifier/equality.js +2 -2
- package/lib/unifier/metaLevel.js +6 -6
- package/lib/unifier/metavariable.js +5 -5
- package/lib/unifier/statementWithCombinator.js +2 -2
- package/lib/utilities/brackets.js +2 -2
- package/lib/utilities/equivalences.js +8 -8
- package/lib/utilities/node.js +2 -7
- package/lib/utilities/nominal.js +26 -0
- package/lib/utilities/subproof.js +2 -2
- package/lib/utilities/tokens.js +3 -7
- package/lib/variable.js +13 -9
- package/lib/verifier/metaLevel.js +2 -2
- package/lib/verifier/statementAsCombinator.js +2 -2
- package/lib/verifier/termAsConstructor.js +2 -2
- package/lib/verifier/topLevel.js +9 -15
- package/package.json +1 -1
- package/src/assertion/type.js +52 -57
- package/src/assignment/equality.js +3 -1
- package/src/assignment/variable.js +2 -1
- package/src/axiom.js +6 -8
- package/src/combinator/bracketed.js +6 -3
- package/src/combinator.js +4 -4
- package/src/conclusion.js +2 -2
- package/src/conjecture.js +8 -11
- package/src/consequent.js +2 -2
- package/src/constructor/bracketed.js +6 -3
- package/src/constructor.js +4 -4
- package/src/context/file.js +46 -90
- package/src/context/local.js +51 -90
- package/src/declaration/combinator.js +5 -4
- package/src/declaration/constructor.js +5 -4
- package/src/declaration/metavariable.js +3 -4
- package/src/declaration/type.js +2 -2
- package/src/declaration/variable.js +5 -4
- package/src/declaration.js +7 -1
- package/src/derivation.js +7 -1
- package/src/equality.js +80 -27
- package/src/equivalence.js +30 -28
- package/src/frame.js +10 -9
- package/src/index.js +12 -0
- package/src/judgement.js +11 -5
- package/src/label.js +5 -5
- package/src/lemma.js +8 -11
- package/src/metaLemma.js +13 -11
- package/src/metatheorem.js +6 -10
- package/src/metavariable.js +18 -34
- package/src/mixins/statement/qualified/unify.js +1 -2
- package/src/mixins/statement/verify.js +19 -18
- package/src/mixins/term/verify.js +4 -3
- package/src/premise.js +2 -2
- package/src/proof.js +10 -3
- package/src/proofStep.js +12 -7
- package/src/reference.js +3 -2
- package/src/rule.js +10 -12
- package/src/statement/qualified.js +7 -1
- package/src/statement/unqualified.js +0 -1
- package/src/statement.js +3 -3
- package/src/subDerivation.js +8 -2
- package/src/subproof.js +12 -5
- package/src/substitution/statementForMetavariable.js +12 -12
- package/src/substitution.js +9 -9
- package/src/substitutions.js +42 -34
- package/src/supposition.js +2 -2
- package/src/term.js +3 -3
- package/src/theorem.js +8 -11
- package/src/topLevelAssertion.js +3 -2
- package/src/type.js +15 -28
- package/src/unifier/equality.js +1 -1
- package/src/unifier/metaLevel.js +8 -10
- package/src/unifier/metavariable.js +5 -5
- package/src/unifier/statementWithCombinator.js +5 -5
- package/src/utilities/brackets.js +2 -2
- package/src/utilities/equivalences.js +9 -9
- package/src/utilities/node.js +1 -10
- package/src/utilities/nominal.js +14 -0
- package/src/utilities/subproof.js +2 -2
- package/src/utilities/tokens.js +2 -9
- package/src/variable.js +16 -11
- package/src/verifier/metaLevel.js +2 -2
- package/src/verifier/statementAsCombinator.js +3 -3
- package/src/verifier/termAsConstructor.js +2 -2
- package/src/verifier/topLevel.js +15 -14
- package/lib/assignment/metavariable.js +0 -62
- package/lib/unifier/intrinsicLevel.js +0 -144
- package/lib/utilities/unify.js +0 -24
- package/lib/verifier/intrinsicLevel.js +0 -140
- package/src/assignment/metavariable.js +0 -30
- package/src/unifier/intrinsicLevel.js +0 -54
- package/src/utilities/unify.js +0 -23
- package/src/verifier/intrinsicLevel.js +0 -42
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import local from "../context/local";
|
|
4
|
+
|
|
3
5
|
export default class EqualityAssignment {
|
|
4
6
|
constructor(equality) {
|
|
5
7
|
this.equality = equality;
|
|
@@ -10,7 +12,7 @@ export default class EqualityAssignment {
|
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
assign(localContext) {
|
|
13
|
-
const equalityAdded = localContext.addEquality(this.equality),
|
|
15
|
+
const equalityAdded = localContext.addEquality(this.equality, localContext),
|
|
14
16
|
equalityString = this.equality.getString(),
|
|
15
17
|
equalityAssigned = equalityAdded; ///
|
|
16
18
|
|
|
@@ -10,7 +10,8 @@ export default class VariableAssignment {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
assign(localContext) {
|
|
13
|
-
const
|
|
13
|
+
const nested = false,
|
|
14
|
+
variableAdded = localContext.addVariable(this.variable, nested),
|
|
14
15
|
variableType = this.variable.getType(),
|
|
15
16
|
variableString = this.variable.getString(),
|
|
16
17
|
variableTypeName = variableType.getName(),
|
package/src/axiom.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import shim from "./shim";
|
|
4
|
-
import Label from "./label";
|
|
5
|
-
import Consequent from "./consequent";
|
|
6
|
-
import Supposition from "./supposition";
|
|
7
4
|
import LocalContext from "./context/local";
|
|
8
5
|
import TopLevelAssertion from "./topLevelAssertion";
|
|
9
6
|
|
|
@@ -22,15 +19,15 @@ class Axiom extends TopLevelAssertion {
|
|
|
22
19
|
|
|
23
20
|
this.fileContext.trace(`Verifying the '${axiomString}' axiom...`);
|
|
24
21
|
|
|
25
|
-
const
|
|
26
|
-
const
|
|
22
|
+
const labelsVerifiedWhenDeclared = this.labels.every((label) => {
|
|
23
|
+
const labelVVerifiedWhenDeclared = label.verifyWhenDeclared(this.fileContext);
|
|
27
24
|
|
|
28
|
-
if (
|
|
25
|
+
if (labelVVerifiedWhenDeclared) {
|
|
29
26
|
return true;
|
|
30
27
|
}
|
|
31
28
|
});
|
|
32
29
|
|
|
33
|
-
if (
|
|
30
|
+
if (labelsVerifiedWhenDeclared) {
|
|
34
31
|
const localContext = LocalContext.fromFileContext(this.fileContext),
|
|
35
32
|
suppositionsVerified = this.suppositions.every((supposition) => {
|
|
36
33
|
const suppositionVerified = supposition.verify(localContext);
|
|
@@ -63,7 +60,8 @@ class Axiom extends TopLevelAssertion {
|
|
|
63
60
|
static fromJSON(json, fileContext) { return TopLevelAssertion.fromJSON(Axiom, json, fileContext); }
|
|
64
61
|
|
|
65
62
|
static fromAxiomNode(axiomNode, fileContext) {
|
|
66
|
-
const
|
|
63
|
+
const { Label, Supposition, Consequent } = shim,
|
|
64
|
+
labelNodes = labelNodesQuery(axiomNode),
|
|
67
65
|
consequentNode = consequentNodeQuery(axiomNode),
|
|
68
66
|
suppositionNodes = suppositionNodesQuery(axiomNode),
|
|
69
67
|
labels = labelNodes.map((labelNode) => {
|
|
@@ -4,15 +4,18 @@ import shim from "../shim";
|
|
|
4
4
|
import Combinator from "../combinator";
|
|
5
5
|
|
|
6
6
|
import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
|
|
7
|
+
import { nominalLexer, nominalParser } from "../utilities/nominal";
|
|
7
8
|
import { statementTokensFromUnqualifiedStatementTokens, unqualifiedStatementTokensFromUnqualifiedStatementString } from "../utilities/tokens";
|
|
8
9
|
import { statementNodeFromUnqualifiedStatementNode,
|
|
9
10
|
unqualifiedStatementStringFromStatementString,
|
|
10
11
|
unqualifiedStatementNodeFromUnqualifiedStatementTokens } from "../utilities/node";
|
|
11
12
|
|
|
12
|
-
const
|
|
13
|
+
const lexer = nominalLexer, ///
|
|
14
|
+
parser = nominalParser, ///
|
|
15
|
+
statementString = `(${STATEMENT_META_TYPE_NAME})`,
|
|
13
16
|
unqualifiedStatementString = unqualifiedStatementStringFromStatementString(statementString),
|
|
14
|
-
unqualifiedStatementTokens = unqualifiedStatementTokensFromUnqualifiedStatementString(unqualifiedStatementString),
|
|
15
|
-
unqualifiedStatementNode = unqualifiedStatementNodeFromUnqualifiedStatementTokens(unqualifiedStatementTokens),
|
|
17
|
+
unqualifiedStatementTokens = unqualifiedStatementTokensFromUnqualifiedStatementString(unqualifiedStatementString, lexer),
|
|
18
|
+
unqualifiedStatementNode = unqualifiedStatementNodeFromUnqualifiedStatementTokens(unqualifiedStatementTokens, parser),
|
|
16
19
|
statementTokens = statementTokensFromUnqualifiedStatementTokens(unqualifiedStatementTokens),
|
|
17
20
|
statementNode = statementNodeFromUnqualifiedStatementNode(unqualifiedStatementNode),
|
|
18
21
|
nodeAsTokens = (node) => {
|
package/src/combinator.js
CHANGED
|
@@ -25,19 +25,19 @@ class Combinator {
|
|
|
25
25
|
return statementNode;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
verifyWhenDeclared(fileContext) {
|
|
29
29
|
let verifiedAtTopLevel;
|
|
30
30
|
|
|
31
31
|
const combinatorString = this.getString(); ///
|
|
32
32
|
|
|
33
|
-
fileContext.trace(`Verifying the '${combinatorString}' combinator
|
|
33
|
+
fileContext.trace(`Verifying the '${combinatorString}' combinator when declared...`);
|
|
34
34
|
|
|
35
|
-
const statementVerifiedAtTopLevel = this.statement.
|
|
35
|
+
const statementVerifiedAtTopLevel = this.statement.verifyWhenDeclared(fileContext);
|
|
36
36
|
|
|
37
37
|
verifiedAtTopLevel = statementVerifiedAtTopLevel; ///
|
|
38
38
|
|
|
39
39
|
if (verifiedAtTopLevel) {
|
|
40
|
-
fileContext.debug(`...verified the '${combinatorString}' combinator
|
|
40
|
+
fileContext.debug(`...verified the '${combinatorString}' combinator when declared.`);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
return verifiedAtTopLevel;
|
package/src/conclusion.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import shim from "./shim";
|
|
4
4
|
import LocalContext from "./context/local";
|
|
5
|
-
import UnqualifiedStatement from "./statement/unqualified";
|
|
6
5
|
|
|
7
6
|
import { nodeQuery } from "./utilities/query";
|
|
8
7
|
import { unqualifiedStatementFromJSON, unqualifiedStatementToUnqualifiedStatementJSON } from "./utilities/json";
|
|
@@ -90,7 +89,8 @@ class Conclusion {
|
|
|
90
89
|
}
|
|
91
90
|
|
|
92
91
|
static fromConclusionNode(conclusionNode, fileContext) {
|
|
93
|
-
const
|
|
92
|
+
const { UnqualifiedStatement } = shim,
|
|
93
|
+
unqualifiedStatementNode = unqualifiedStatementNodeQuery(conclusionNode),
|
|
94
94
|
unqualifiedStatement = UnqualifiedStatement.fromUnqualifiedStatementNode(unqualifiedStatementNode, fileContext),
|
|
95
95
|
conclusion = new Conclusion(fileContext, unqualifiedStatement);
|
|
96
96
|
|
package/src/conjecture.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import shim from "./shim";
|
|
4
|
-
import Label from "./label";
|
|
5
|
-
import Proof from "./proof";
|
|
6
|
-
import Consequent from "./consequent";
|
|
7
|
-
import Supposition from "./supposition";
|
|
8
4
|
import LocalContext from "./context/local";
|
|
9
|
-
import Substitutions from "./substitutions";
|
|
10
5
|
import TopLevelAssertion from "./topLevelAssertion";
|
|
11
6
|
|
|
12
7
|
import { stringFromLabels } from "./topLevelAssertion";
|
|
@@ -25,15 +20,15 @@ class Conjecture extends TopLevelAssertion {
|
|
|
25
20
|
|
|
26
21
|
this.fileContext.trace(`Verifying the '${conjectureString}' conjecture...`);
|
|
27
22
|
|
|
28
|
-
const
|
|
29
|
-
const
|
|
23
|
+
const labelsVerifiedWhenDeclared = this.labels.every((label) => {
|
|
24
|
+
const labelVVerifiedWhenDeclared = label.verifyWhenDeclared(this.fileContext);
|
|
30
25
|
|
|
31
|
-
if (
|
|
26
|
+
if (labelVVerifiedWhenDeclared) {
|
|
32
27
|
return true;
|
|
33
28
|
}
|
|
34
29
|
});
|
|
35
30
|
|
|
36
|
-
if (
|
|
31
|
+
if (labelsVerifiedWhenDeclared) {
|
|
37
32
|
const localContext = LocalContext.fromFileContext(this.fileContext),
|
|
38
33
|
suppositionsVerified = this.suppositions.every((supposition) => {
|
|
39
34
|
const suppositionVerified = supposition.verify(localContext);
|
|
@@ -48,7 +43,8 @@ class Conjecture extends TopLevelAssertion {
|
|
|
48
43
|
|
|
49
44
|
if (consequentVerified) {
|
|
50
45
|
if (this.proof !== null) {
|
|
51
|
-
const
|
|
46
|
+
const { Substitutions } = shim,
|
|
47
|
+
substitutions = Substitutions.fromNothing();
|
|
52
48
|
|
|
53
49
|
this.proof.verify(substitutions, this.consequent, localContext);
|
|
54
50
|
}
|
|
@@ -72,7 +68,8 @@ class Conjecture extends TopLevelAssertion {
|
|
|
72
68
|
static fromJSON(json, fileContext) { return TopLevelAssertion.fromJSON(Conjecture, json, fileContext); }
|
|
73
69
|
|
|
74
70
|
static fromConjectureNode(conjectureNode, fileContext) {
|
|
75
|
-
const
|
|
71
|
+
const { Label, Proof, Supposition, Consequent } = shim,
|
|
72
|
+
proofNode = proofNodeQuery(conjectureNode),
|
|
76
73
|
labelNodes = labelNodesQuery(conjectureNode),
|
|
77
74
|
consequentNode = consequentNodeQuery(conjectureNode),
|
|
78
75
|
suppositionNodes = suppositionNodesQuery(conjectureNode),
|
package/src/consequent.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import shim from "./shim";
|
|
4
4
|
import LocalContext from "./context/local";
|
|
5
|
-
import UnqualifiedStatement from "./statement/unqualified";
|
|
6
5
|
|
|
7
6
|
import { nodeQuery } from "./utilities/query";
|
|
8
7
|
import { unqualifiedStatementFromJSON, unqualifiedStatementToUnqualifiedStatementJSON } from "./utilities/json";
|
|
@@ -90,7 +89,8 @@ class Consequent {
|
|
|
90
89
|
}
|
|
91
90
|
|
|
92
91
|
static fromConsequentNode(consequentNode, fileContext) {
|
|
93
|
-
const
|
|
92
|
+
const { UnqualifiedStatement } = shim,
|
|
93
|
+
unqualifiedStatementNode = unqualifiedStatementNodeQuery(consequentNode),
|
|
94
94
|
unqualifiedStatement = UnqualifiedStatement.fromUnqualifiedStatementNode(unqualifiedStatementNode, fileContext),
|
|
95
95
|
consequent = new Consequent(fileContext, unqualifiedStatement);
|
|
96
96
|
|
|
@@ -5,15 +5,18 @@ import Constructor from "../constructor";
|
|
|
5
5
|
|
|
6
6
|
import { OBJECT_TYPE_NAME } from "../typeNames";
|
|
7
7
|
import { stringFromTermAndType } from "../constructor";
|
|
8
|
+
import { nominalLexer, nominalParser } from "../utilities/nominal";
|
|
8
9
|
import { termTokensFromConstructorDeclarationTokens, constructorDeclarationTokensFromConstructorDeclarationString } from "../utilities/tokens";
|
|
9
10
|
import { termNodeFromConstructorDeclarationNode,
|
|
10
11
|
constructorDeclarationStringFromTermString,
|
|
11
12
|
constructorDeclarationNodeFromConstructorDeclarationTokens } from "../utilities/node";
|
|
12
13
|
|
|
13
|
-
const
|
|
14
|
+
const lexer = nominalLexer, ///
|
|
15
|
+
parser = nominalParser, ///
|
|
16
|
+
termString = `(${OBJECT_TYPE_NAME})`, ///
|
|
14
17
|
constructorDeclarationString = constructorDeclarationStringFromTermString(termString),
|
|
15
|
-
constructorDeclarationTokens = constructorDeclarationTokensFromConstructorDeclarationString(constructorDeclarationString),
|
|
16
|
-
constructorDeclarationNode = constructorDeclarationNodeFromConstructorDeclarationTokens(constructorDeclarationTokens),
|
|
18
|
+
constructorDeclarationTokens = constructorDeclarationTokensFromConstructorDeclarationString(constructorDeclarationString, lexer),
|
|
19
|
+
constructorDeclarationNode = constructorDeclarationNodeFromConstructorDeclarationTokens(constructorDeclarationTokens, parser),
|
|
17
20
|
termNode = termNodeFromConstructorDeclarationNode(constructorDeclarationNode),
|
|
18
21
|
termTokens = termTokensFromConstructorDeclarationTokens(constructorDeclarationTokens),
|
|
19
22
|
nodeAsTokens = (node) => {
|
package/src/constructor.js
CHANGED
|
@@ -25,21 +25,21 @@ class Constructor {
|
|
|
25
25
|
|
|
26
26
|
getType() { return this.term.getType(); }
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
verifyWhenDeclared(fileContext) {
|
|
29
29
|
let verifiedAtTopLevel;
|
|
30
30
|
|
|
31
31
|
const constructorString = this.string; ///
|
|
32
32
|
|
|
33
|
-
fileContext.trace(`Verifying the '${constructorString}' constructor
|
|
33
|
+
fileContext.trace(`Verifying the '${constructorString}' constructor when declared...`);
|
|
34
34
|
|
|
35
|
-
const termVerifiedAtTopLevel = this.term.
|
|
35
|
+
const termVerifiedAtTopLevel = this.term.verifyWhenDeclared(fileContext);
|
|
36
36
|
|
|
37
37
|
if (termVerifiedAtTopLevel) {
|
|
38
38
|
verifiedAtTopLevel = true; ///
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
if (verifiedAtTopLevel) {
|
|
42
|
-
fileContext.debug(`...verified the '${constructorString}' constructor
|
|
42
|
+
fileContext.debug(`...verified the '${constructorString}' constructor when declared.`);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
return verifiedAtTopLevel;
|
package/src/context/file.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
+
import metavariableUnifier from "../unifier/metavariable";
|
|
6
|
+
|
|
5
7
|
import { objectType } from "../type";
|
|
6
8
|
import { frameMetaType, referenceMetaType, statementMetaType } from "../metaType";
|
|
7
9
|
import { nodeAsTokens, nodeAsString, nodesAsString, tokensAsString } from "../utilities/string";
|
|
@@ -302,6 +304,16 @@ export default class FileContext {
|
|
|
302
304
|
return this.metavariables;
|
|
303
305
|
}
|
|
304
306
|
|
|
307
|
+
getMetavariableNames(includeRelease = true) {
|
|
308
|
+
const metavariableNames = this.metavariables.map((metavariable) => {
|
|
309
|
+
const metavariableName = metavariable.getName();
|
|
310
|
+
|
|
311
|
+
return metavariableName;
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
return metavariableNames;
|
|
315
|
+
}
|
|
316
|
+
|
|
305
317
|
setReleaseContext(releaseContext) {
|
|
306
318
|
this.releaseContext = releaseContext;
|
|
307
319
|
}
|
|
@@ -314,58 +326,6 @@ export default class FileContext {
|
|
|
314
326
|
this.tokens = tokens;
|
|
315
327
|
}
|
|
316
328
|
|
|
317
|
-
setNode(node) {
|
|
318
|
-
this.node = node;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
setTypes(types) {
|
|
322
|
-
this.types = types;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
setRules(rules) {
|
|
326
|
-
this.rules = rules;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
setAxioms(axioms) {
|
|
330
|
-
this.axioms = axioms;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
setLemmas(lemmas) {
|
|
334
|
-
this.lemmas = lemmas;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
setTheorems(theorems) {
|
|
338
|
-
this.theorems = theorems;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
setVariables(variables) {
|
|
342
|
-
this.variables = variables;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
setMetaLemmas(metaLemmas) {
|
|
346
|
-
this.metaLemmas = metaLemmas;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
setConjectures(conjectures) {
|
|
350
|
-
this.conjectures = conjectures;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
setCombinators(combinators) {
|
|
354
|
-
this.combinators = combinators;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
setConstructors(constructors) {
|
|
358
|
-
this.constructors = constructors;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
setMetatheorems(metatheorems) {
|
|
362
|
-
this.metatheorems = metatheorems;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
setMetavariables(metavariables) {
|
|
366
|
-
this.metavariables = metavariables;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
329
|
findTypeByTypeName(typeName) {
|
|
370
330
|
let types = this.getTypes();
|
|
371
331
|
|
|
@@ -436,6 +396,13 @@ export default class FileContext {
|
|
|
436
396
|
return metavariablePresent;
|
|
437
397
|
}
|
|
438
398
|
|
|
399
|
+
isMetavariablePresentByMetavariableNode(metavariableNode, localContext) {
|
|
400
|
+
const metavariable = this.findMetavariableByMetavariableNode(metavariableNode, localContext),
|
|
401
|
+
metavariablePresent = (metavariable !== null);
|
|
402
|
+
|
|
403
|
+
return metavariablePresent;
|
|
404
|
+
}
|
|
405
|
+
|
|
439
406
|
findRuleByReference(reference) {
|
|
440
407
|
const rules = this.getRules(),
|
|
441
408
|
metavariableNode = reference.getMetavariableNode(),
|
|
@@ -537,9 +504,9 @@ export default class FileContext {
|
|
|
537
504
|
findVariableByVariableName(variableName) {
|
|
538
505
|
const variables = this.getVariables(),
|
|
539
506
|
variable = variables.find((variable) => {
|
|
540
|
-
const
|
|
507
|
+
const variableNameMatches = variable.matchVariableName(variableName);
|
|
541
508
|
|
|
542
|
-
if (
|
|
509
|
+
if (variableNameMatches) {
|
|
543
510
|
return true;
|
|
544
511
|
}
|
|
545
512
|
}) || null;
|
|
@@ -547,12 +514,12 @@ export default class FileContext {
|
|
|
547
514
|
return variable;
|
|
548
515
|
}
|
|
549
516
|
|
|
550
|
-
|
|
517
|
+
findJudgementByMetavariableNode(metavariableNode) {
|
|
551
518
|
const judgements = this.getJudgements(),
|
|
552
519
|
judgement = judgements.find((judgement) => {
|
|
553
|
-
const
|
|
520
|
+
const judgementMatchesMetavariableNode = judgement.matchMetavariableNode(metavariableNode);
|
|
554
521
|
|
|
555
|
-
if (
|
|
522
|
+
if (judgementMatchesMetavariableNode) {
|
|
556
523
|
return true;
|
|
557
524
|
}
|
|
558
525
|
}) || null;
|
|
@@ -561,11 +528,28 @@ export default class FileContext {
|
|
|
561
528
|
}
|
|
562
529
|
|
|
563
530
|
findMetavariableByMetavariableName(metavariableName) {
|
|
564
|
-
const
|
|
531
|
+
const metavariableNameB = metavariableName, ///
|
|
532
|
+
metavariableNames = this.getMetavariableNames(),
|
|
533
|
+
metavariable = metavariableNames.find((metavariableName) => {
|
|
534
|
+
const metavariableNameA = metavariableName; ///
|
|
535
|
+
|
|
536
|
+
if (metavariableNameA === metavariableNameB) {
|
|
537
|
+
return true;
|
|
538
|
+
}
|
|
539
|
+
}) || null;
|
|
540
|
+
|
|
541
|
+
return metavariable;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
findMetavariableByMetavariableNode(metavariableNode, localContext) {
|
|
545
|
+
const metavariableNodeB = metavariableNode, ///
|
|
546
|
+
metavariables = this.getMetavariables(),
|
|
565
547
|
metavariable = metavariables.find((metavariable) => {
|
|
566
|
-
const
|
|
548
|
+
const metavariableA = metavariable, ///
|
|
549
|
+
metavariableNodeA = metavariableA.getNode(), ///
|
|
550
|
+
metavariableUnified = metavariableUnifier.unify(metavariableNodeA, metavariableNodeB, localContext);
|
|
567
551
|
|
|
568
|
-
if (
|
|
552
|
+
if (metavariableUnified) {
|
|
569
553
|
return true;
|
|
570
554
|
}
|
|
571
555
|
}) || null;
|
|
@@ -636,24 +620,7 @@ export default class FileContext {
|
|
|
636
620
|
}
|
|
637
621
|
|
|
638
622
|
addVariable(variable) {
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
const variableNode = variable.getNode(),
|
|
642
|
-
variablePresent = this.variables.some((variable) => {
|
|
643
|
-
const variableMatchesNode = variable.matchVariableNode(variableNode);
|
|
644
|
-
|
|
645
|
-
if (variableMatchesNode) {
|
|
646
|
-
return true;
|
|
647
|
-
}
|
|
648
|
-
});
|
|
649
|
-
|
|
650
|
-
if (!variablePresent) {
|
|
651
|
-
this.variables.push(variable);
|
|
652
|
-
|
|
653
|
-
variableAdded = true;
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
return variableAdded;
|
|
623
|
+
this.variables.push(variable);
|
|
657
624
|
}
|
|
658
625
|
|
|
659
626
|
addMetaLemma(metaLemma) {
|
|
@@ -677,18 +644,7 @@ export default class FileContext {
|
|
|
677
644
|
}
|
|
678
645
|
|
|
679
646
|
addMetavariable(metavariable) {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
const metavariableName = metavariable.getName(),
|
|
683
|
-
metavariablePresent = this.isMetavariablePresentByMetavariableName(metavariableName);
|
|
684
|
-
|
|
685
|
-
if (!metavariablePresent) {
|
|
686
|
-
this.metavariables.push(metavariable);
|
|
687
|
-
|
|
688
|
-
metavariableAdded = true;
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
return metavariableAdded;
|
|
647
|
+
this.metavariables.push(metavariable);
|
|
692
648
|
}
|
|
693
649
|
|
|
694
650
|
trace(message) { this.releaseContext.trace(message, this.filePath); }
|