occam-verify-cli 0.0.971 → 0.0.974
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 +1 -8
- package/lib/resolve/complexSubstitutionAgainstSimpleSubstitution.js +76 -0
- package/lib/resolve/substitution.js +27 -0
- package/lib/resolve/substitutions.js +8 -70
- package/lib/substitution/statementForMetavariable.js +2 -2
- package/lib/substitution.js +8 -1
- package/lib/substitutions.js +19 -7
- package/lib/type.js +3 -3
- package/lib/unify/complexSubstitutionStatementWithSimpleSubstitutionStatement.js +26 -0
- package/lib/unify/qualifiedStatement.js +117 -0
- package/lib/unify/statementWithCombinator.js +29 -0
- package/lib/unify/statementWithCombinators.js +4 -14
- package/lib/unify/termWithBracketedConstructor.js +3 -3
- package/lib/unify/termWithConstructor.js +37 -0
- package/lib/unify/termWithConstructors.js +6 -33
- package/lib/unify/unqualifiedStatement.js +25 -0
- package/lib/verifier/statementAsCombinator.js +2 -2
- package/lib/verify/assertion/contained.js +4 -4
- package/lib/verify/assertion/defined.js +6 -4
- package/lib/verify/assertion/type.js +5 -3
- package/lib/verify/conclusion.js +2 -2
- package/lib/verify/consequent.js +2 -2
- package/lib/verify/declaration.js +4 -4
- package/lib/verify/equality.js +11 -7
- package/lib/verify/frame.js +2 -2
- package/lib/verify/judgement.js +37 -29
- package/lib/verify/premise.js +3 -3
- package/lib/verify/statement/qualified.js +3 -3
- package/lib/verify/statement/unqualified.js +9 -53
- package/lib/verify/statement.js +8 -47
- package/lib/verify/term.js +11 -5
- package/package.json +2 -2
- package/src/context/file.js +0 -6
- package/src/resolve/complexSubstitutionAgainstSimpleSubstitution.js +94 -0
- package/src/resolve/substitution.js +19 -0
- package/src/resolve/substitutions.js +9 -112
- package/src/substitution/statementForMetavariable.js +1 -1
- package/src/substitution.js +6 -0
- package/src/substitutions.js +17 -6
- package/src/type.js +3 -3
- package/src/unify/complexSubstitutionStatementWithSimpleSubstitutionStatement.js +18 -0
- package/src/unify/{statement/qualified.js → qualifiedStatement.js} +1 -1
- package/src/unify/statementWithCombinator.js +22 -0
- package/src/unify/statementWithCombinators.js +3 -20
- package/src/unify/termWithBracketedConstructor.js +1 -1
- package/src/unify/termWithConstructor.js +39 -0
- package/src/unify/termWithConstructors.js +1 -37
- package/src/unify/{statement/unqualified.js → unqualifiedStatement.js} +1 -1
- package/src/verifier/statementAsCombinator.js +2 -2
- package/src/verify/assertion/contained.js +6 -6
- package/src/verify/assertion/defined.js +9 -4
- package/src/verify/assertion/type.js +6 -4
- package/src/verify/conclusion.js +1 -1
- package/src/verify/consequent.js +1 -1
- package/src/verify/declaration.js +4 -4
- package/src/verify/equality.js +12 -8
- package/src/verify/frame.js +1 -1
- package/src/verify/judgement.js +58 -50
- package/src/verify/premise.js +3 -3
- package/src/verify/statement/qualified.js +1 -1
- package/src/verify/statement/unqualified.js +8 -13
- package/src/verify/statement.js +3 -56
- package/src/verify/term.js +13 -6
- package/lib/unify/statement/qualified.js +0 -117
- package/lib/unify/statement/unqualified.js +0 -25
package/src/substitutions.js
CHANGED
|
@@ -87,9 +87,9 @@ export default class Substitutions {
|
|
|
87
87
|
|
|
88
88
|
findSubstitutionByVariableNode(variableNode) {
|
|
89
89
|
const substitution = this.findSubstitution((substitution) => {
|
|
90
|
-
const
|
|
90
|
+
const variableNodeMatches = substitution.matchVariableNode(variableNode);
|
|
91
91
|
|
|
92
|
-
if (
|
|
92
|
+
if (variableNodeMatches) {
|
|
93
93
|
return true;
|
|
94
94
|
}
|
|
95
95
|
});
|
|
@@ -97,11 +97,22 @@ export default class Substitutions {
|
|
|
97
97
|
return substitution;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
findSubstitutionByMetavariableNode(metavariableNode) {
|
|
101
|
+
const substitution = this.findSubstitution((substitution) => {
|
|
102
|
+
const metavariableNodeMatches = substitution.matchMetavariableNode(metavariableNode);
|
|
103
|
+
|
|
104
|
+
if (metavariableNodeMatches) {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
return substitution;
|
|
110
|
+
}
|
|
100
111
|
findSubstitutionsByMetavariableNode(metavariableNode) {
|
|
101
112
|
const substitutions = this.findSubstitutions((substitution) => {
|
|
102
|
-
const
|
|
113
|
+
const metavariableNodeMatches = substitution.matchMetavariableNode(metavariableNode);
|
|
103
114
|
|
|
104
|
-
if (
|
|
115
|
+
if (metavariableNodeMatches) {
|
|
105
116
|
return true;
|
|
106
117
|
}
|
|
107
118
|
});
|
|
@@ -139,9 +150,9 @@ export default class Substitutions {
|
|
|
139
150
|
|
|
140
151
|
findSubstitutionsByMetavariableNodeAndSubstitutionNode(metavariableNode, substitutionNode) {
|
|
141
152
|
const substitutions = this.findSubstitutions((substitution) => {
|
|
142
|
-
const
|
|
153
|
+
const metavariableNodeAndSubstitutionNodeMatch = substitution.matchMetavariableNodeAndSubstitutionNode(metavariableNode, substitutionNode);
|
|
143
154
|
|
|
144
|
-
if (
|
|
155
|
+
if (metavariableNodeAndSubstitutionNodeMatch) {
|
|
145
156
|
return true;
|
|
146
157
|
}
|
|
147
158
|
});
|
package/src/type.js
CHANGED
|
@@ -105,10 +105,10 @@ export default class Type {
|
|
|
105
105
|
|
|
106
106
|
matchTypeNode(typeNode) {
|
|
107
107
|
const typeName = typeNameFromTypeNode(typeNode),
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
typeNameMatches = this.matchTypeName(typeName),
|
|
109
|
+
typeNodeMatches = typeNameMatches; ///
|
|
110
110
|
|
|
111
|
-
return
|
|
111
|
+
return typeNodeMatches;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
asString(tokens, noSuperType = false) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import metaLevelUnifier from "../unifier/metaLevel";
|
|
4
|
+
|
|
5
|
+
export default function unifyComplexSubstitutionStatementWithSimpleSubstitutionStatement(complexSubstitutionStatementNode, simpleSubstitutionStatementNode, substitutions, localContextA, localContextB) {
|
|
6
|
+
let complexSubstitutionStatementWithSimpleSubstitutionStatement;
|
|
7
|
+
|
|
8
|
+
const nodeA = complexSubstitutionStatementNode, ///
|
|
9
|
+
nodeB = simpleSubstitutionStatementNode; ///
|
|
10
|
+
|
|
11
|
+
localContextA = localContextB; ///
|
|
12
|
+
|
|
13
|
+
const unified = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
14
|
+
|
|
15
|
+
complexSubstitutionStatementWithSimpleSubstitutionStatement = unified; ///
|
|
16
|
+
|
|
17
|
+
return complexSubstitutionStatementWithSimpleSubstitutionStatement;
|
|
18
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { nodeQuery } from "
|
|
3
|
+
import { nodeQuery } from "../utilities/query";
|
|
4
4
|
|
|
5
5
|
const statementNodeQuery = nodeQuery("/qualifiedStatement/statement!"),
|
|
6
6
|
metavariableNodeQuery = nodeQuery("/qualifiedStatement/reference/metavariable!");
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import statementWithCombinatorUnifier from "../unifier/statementWithCombinator";
|
|
4
|
+
|
|
5
|
+
export default function unifyStatementWithCombinator(statementNode, combinator, assignments, stated, localContext) {
|
|
6
|
+
let statementUnifiedWithCombinator;
|
|
7
|
+
|
|
8
|
+
const statementString = localContext.nodeAsString(statementNode),
|
|
9
|
+
combinatorString = combinator.getString();
|
|
10
|
+
|
|
11
|
+
localContext.trace(`Unifying the '${statementString}' statement with the '${combinatorString}' combinator...`, statementNode);
|
|
12
|
+
|
|
13
|
+
const combinatorStatementNode = combinator.getStatementNode();
|
|
14
|
+
|
|
15
|
+
statementUnifiedWithCombinator = statementWithCombinatorUnifier.unify(statementNode, combinatorStatementNode, assignments, stated, localContext);
|
|
16
|
+
|
|
17
|
+
if (statementUnifiedWithCombinator) {
|
|
18
|
+
localContext.debug(`...unified the '${statementString}' statement with the '${combinatorString}' combinator.`, statementNode);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return statementUnifiedWithCombinator;
|
|
22
|
+
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import unifyStatementWithCombinator from "../unify/statementWithCombinator";
|
|
4
4
|
|
|
5
5
|
export default function unifyStatementWithCombinators(statementNode, assignments, stated, localContext) {
|
|
6
6
|
let statementUnifiedWithCombinators;
|
|
7
7
|
|
|
8
8
|
const combinators = localContext.getCombinators();
|
|
9
9
|
|
|
10
|
+
assignments = null; ///
|
|
11
|
+
|
|
10
12
|
statementUnifiedWithCombinators = combinators.some((combinator) => {
|
|
11
13
|
const statementUnifiedWithCombinator = unifyStatementWithCombinator(statementNode, combinator, assignments, stated, localContext);
|
|
12
14
|
|
|
@@ -17,22 +19,3 @@ export default function unifyStatementWithCombinators(statementNode, assignments
|
|
|
17
19
|
|
|
18
20
|
return statementUnifiedWithCombinators;
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
function unifyStatementWithCombinator(statementNode, combinator, assignments, stated, localContext) {
|
|
22
|
-
let statementUnifiedWithCombinator;
|
|
23
|
-
|
|
24
|
-
const statementString = localContext.nodeAsString(statementNode),
|
|
25
|
-
combinatorString = combinator.getString();
|
|
26
|
-
|
|
27
|
-
localContext.trace(`Unifying the '${statementString}' statement with the '${combinatorString}' combinator...`, statementNode);
|
|
28
|
-
|
|
29
|
-
const combinatorStatementNode = combinator.getStatementNode();
|
|
30
|
-
|
|
31
|
-
statementUnifiedWithCombinator = statementWithCombinatorUnifier.unify(statementNode, combinatorStatementNode, assignments, stated, localContext);
|
|
32
|
-
|
|
33
|
-
if (statementUnifiedWithCombinator) {
|
|
34
|
-
localContext.debug(`...unified the '${statementString}' statement with the '${combinatorString}' combinator.`, statementNode);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return statementUnifiedWithCombinator;
|
|
38
|
-
}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import shim from "../shim";
|
|
4
4
|
import bracketedConstructor from "../constructor/bracketed";
|
|
5
|
+
import unifyTermWithConstructor from "../unify/termWithConstructor";
|
|
5
6
|
|
|
6
7
|
import { nodeQuery } from "../utilities/query";
|
|
7
|
-
import { unifyTermWithConstructor } from "../unify/termWithConstructors";
|
|
8
8
|
|
|
9
9
|
const termNodeQuery = nodeQuery("/term/argument/term");
|
|
10
10
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import Term from "../term";
|
|
4
|
+
import termWithConstructorUnifier from "../unifier/termWithConstructor";
|
|
5
|
+
|
|
6
|
+
export default function unifyTermWithConstructor(termNode, terms, constructor, localContext, verifyAhead) {
|
|
7
|
+
let termUnifiedWithConstructor = false;
|
|
8
|
+
|
|
9
|
+
const termString = localContext.nodeAsString(termNode),
|
|
10
|
+
constructorString = constructor.getString(),
|
|
11
|
+
constructorTermNode = constructor.getTermNode();
|
|
12
|
+
|
|
13
|
+
localContext.trace(`Unifying the '${termString}' term with the '${constructorString}' constructor...`, termNode);
|
|
14
|
+
|
|
15
|
+
const termNodeA = termNode, ///
|
|
16
|
+
constructorTermNodeB = constructorTermNode, ///
|
|
17
|
+
unified = termWithConstructorUnifier.unify(termNodeA, constructorTermNodeB, localContext);
|
|
18
|
+
|
|
19
|
+
if (unified) {
|
|
20
|
+
let verifiedAhead;
|
|
21
|
+
|
|
22
|
+
const type = constructor.getType(),
|
|
23
|
+
term = Term.fromTermNodeAndType(termNode, type);
|
|
24
|
+
|
|
25
|
+
terms.push(term);
|
|
26
|
+
|
|
27
|
+
verifiedAhead = verifyAhead();
|
|
28
|
+
|
|
29
|
+
terms.pop();
|
|
30
|
+
|
|
31
|
+
termUnifiedWithConstructor = verifiedAhead; ///
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (termUnifiedWithConstructor) {
|
|
35
|
+
localContext.debug(`...unified the '${termString}' term with the '${constructorString}' constructor.`, termNode);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return termUnifiedWithConstructor;
|
|
39
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import termWithConstructorUnifier from "../unifier/termWithConstructor";
|
|
3
|
+
import unifyTermWithConstructor from "../unify/termWithConstructor";
|
|
5
4
|
|
|
6
5
|
import { nodeQuery } from "../utilities/query";
|
|
7
6
|
|
|
@@ -26,38 +25,3 @@ export default function unifyTermWithConstructors(termNode, terms, localContext,
|
|
|
26
25
|
|
|
27
26
|
return termUnifiedWithConstructors;
|
|
28
27
|
}
|
|
29
|
-
|
|
30
|
-
export function unifyTermWithConstructor(termNode, terms, constructor, localContext, verifyAhead) {
|
|
31
|
-
let termUnifiedWithConstructor = false;
|
|
32
|
-
|
|
33
|
-
const termString = localContext.nodeAsString(termNode),
|
|
34
|
-
constructorString = constructor.getString(),
|
|
35
|
-
constructorTermNode = constructor.getTermNode();
|
|
36
|
-
|
|
37
|
-
localContext.trace(`Unifying the '${termString}' term with the '${constructorString}' constructor...`, termNode);
|
|
38
|
-
|
|
39
|
-
const termNodeA = termNode, ///
|
|
40
|
-
constructorTermNodeB = constructorTermNode, ///
|
|
41
|
-
unified = termWithConstructorUnifier.unify(termNodeA, constructorTermNodeB, localContext);
|
|
42
|
-
|
|
43
|
-
if (unified) {
|
|
44
|
-
let verifiedAhead;
|
|
45
|
-
|
|
46
|
-
const type = constructor.getType(),
|
|
47
|
-
term = Term.fromTermNodeAndType(termNode, type);
|
|
48
|
-
|
|
49
|
-
terms.push(term);
|
|
50
|
-
|
|
51
|
-
verifiedAhead = verifyAhead();
|
|
52
|
-
|
|
53
|
-
terms.pop();
|
|
54
|
-
|
|
55
|
-
termUnifiedWithConstructor = verifiedAhead; ///
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (termUnifiedWithConstructor) {
|
|
59
|
-
localContext.debug(`...unified the '${termString}' term with the '${constructorString}' constructor.`, termNode);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return termUnifiedWithConstructor;
|
|
63
|
-
}
|
|
@@ -29,8 +29,8 @@ class StatementAsCombinatorVerifier extends Verifier {
|
|
|
29
29
|
nodeQuery: statementNodeQuery,
|
|
30
30
|
verify: (statementNode, fileContext) => {
|
|
31
31
|
const { verifyStatement } = shim,
|
|
32
|
-
stated = false,
|
|
33
|
-
assignments =
|
|
32
|
+
stated = false,
|
|
33
|
+
assignments = null,
|
|
34
34
|
localContext = LocalContext.fromFileContext(fileContext),
|
|
35
35
|
statementVerified = verifyStatement(statementNode, assignments, stated, localContext);
|
|
36
36
|
|
|
@@ -5,10 +5,10 @@ import metaLevelVerifier from "../../verifier/metaLevel";
|
|
|
5
5
|
import { isAssertionNegated } from "../../utilities/assertion";
|
|
6
6
|
import { nodeQuery, nodesQuery } from "../../utilities/query";
|
|
7
7
|
|
|
8
|
-
const variableNodeQuery = nodeQuery("/containedAssertion/variable!"),
|
|
9
|
-
metavariableNodeQuery = nodeQuery("/containedAssertion/metavariable"),
|
|
10
|
-
statementVariableNodesQuery = nodesQuery("/containedAssertion/statement//variable"),
|
|
11
|
-
statementMetavariableNodesQuery = nodesQuery("/containedAssertion/statement//metavariable");
|
|
8
|
+
const variableNodeQuery = nodeQuery("/containedAssertion/term/variable!"),
|
|
9
|
+
metavariableNodeQuery = nodeQuery("/containedAssertion/statement[0]/metavariable"),
|
|
10
|
+
statementVariableNodesQuery = nodesQuery("/containedAssertion/statement[-1]//variable"),
|
|
11
|
+
statementMetavariableNodesQuery = nodesQuery("/containedAssertion/statement[-1]//metavariable");
|
|
12
12
|
|
|
13
13
|
const verifyContainedAssertionFunctions = [
|
|
14
14
|
verifyDerivedContainedAssertion,
|
|
@@ -23,7 +23,7 @@ export default function verifyContainedAssertion(containedAssertionNode, assignm
|
|
|
23
23
|
|
|
24
24
|
localContext.trace(`Verifying the '${containedAssertionString}' contained assertion...`, containedAssertionNode);
|
|
25
25
|
|
|
26
|
-
assignments =
|
|
26
|
+
assignments = null; ///
|
|
27
27
|
|
|
28
28
|
stated = true; ///
|
|
29
29
|
|
|
@@ -66,7 +66,7 @@ function verifyDerivedContainedAssertion(containedAssertionNode, assignments, st
|
|
|
66
66
|
} else if (metavariableNode !== null) {
|
|
67
67
|
const statementMetavariableNodes = statementMetavariableNodesQuery(containedAssertionNode),
|
|
68
68
|
variableNodeMatchesStatementMetavariableNode = statementMetavariableNodes.some((statementMetavariableNode) => {
|
|
69
|
-
const variableNodeMatchesStatementMetavariableNode =
|
|
69
|
+
const variableNodeMatchesStatementMetavariableNode = metavariableNode.match(statementMetavariableNode);
|
|
70
70
|
|
|
71
71
|
if (variableNodeMatchesStatementMetavariableNode) {
|
|
72
72
|
return true;
|
|
@@ -7,8 +7,8 @@ import { first } from "../../utilities/array";
|
|
|
7
7
|
import { nodeQuery } from "../../utilities/query";
|
|
8
8
|
import { isAssertionNegated } from "../../utilities/assertion";
|
|
9
9
|
|
|
10
|
-
const variableNodeQuery = nodeQuery("/definedAssertion/variable!"),
|
|
11
|
-
metavariableNodeQuery = nodeQuery("/definedAssertion/metavariable!");
|
|
10
|
+
const variableNodeQuery = nodeQuery("/definedAssertion/term/variable!"),
|
|
11
|
+
metavariableNodeQuery = nodeQuery("/definedAssertion/statement[-1]/metavariable!");
|
|
12
12
|
|
|
13
13
|
const verifyDefinedAssertionFunctions = [
|
|
14
14
|
verifyDerivedDefinedAssertion,
|
|
@@ -18,14 +18,19 @@ const verifyDefinedAssertionFunctions = [
|
|
|
18
18
|
export default function verifyDefinedAssertion(definedAssertionNode, assignments, stated, localContext) {
|
|
19
19
|
let definedAssertionVerified;
|
|
20
20
|
|
|
21
|
-
const definedAssertionString = localContext.nodeAsString(definedAssertionNode)
|
|
21
|
+
const definedAssertionString = localContext.nodeAsString(definedAssertionNode),
|
|
22
|
+
savedStated = stated; ///;
|
|
22
23
|
|
|
23
24
|
localContext.trace(`Verifying the '${definedAssertionString}' defined assertion...`, definedAssertionNode);
|
|
24
25
|
|
|
25
|
-
assignments =
|
|
26
|
+
assignments = null; ///
|
|
27
|
+
|
|
28
|
+
stated = true; ///
|
|
26
29
|
|
|
27
30
|
const verified = metaLevelVerifier.verify(definedAssertionNode, assignments, stated, localContext);
|
|
28
31
|
|
|
32
|
+
stated = savedStated; ///
|
|
33
|
+
|
|
29
34
|
if (verified) {
|
|
30
35
|
definedAssertionVerified = verifyDefinedAssertionFunctions.some((verifyDefinedAssertionFunction) => {
|
|
31
36
|
const definedAssertionVerified = verifyDefinedAssertionFunction(definedAssertionNode, assignments, stated, localContext);
|
|
@@ -112,11 +112,13 @@ function verifyStatedTypeAssertion(typeAssertionNode, assignments, stated, local
|
|
|
112
112
|
const variableNode = variableNodeQuery(termNode);
|
|
113
113
|
|
|
114
114
|
if (variableNode !== null) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
if (assignments !== null) {
|
|
116
|
+
const variable = Variable.fromVariableNodeAndType(variableNode, type),
|
|
117
|
+
variableAssignment = VariableAssignment.fromVariable(variable),
|
|
118
|
+
assignment = variableAssignment; ///
|
|
118
119
|
|
|
119
|
-
|
|
120
|
+
assignments.push(assignment);
|
|
121
|
+
}
|
|
120
122
|
}
|
|
121
123
|
|
|
122
124
|
verifiedAhead = true;
|
package/src/verify/conclusion.js
CHANGED
|
@@ -19,7 +19,7 @@ export default function verifyConclusion(conclusionNode, conclusions, localConte
|
|
|
19
19
|
|
|
20
20
|
if (unqualifiedStatementNode !== null) {
|
|
21
21
|
const stated = true,
|
|
22
|
-
assignments =
|
|
22
|
+
assignments = null,
|
|
23
23
|
statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
24
24
|
statementVerified = verifyStatement(statementNode, assignments, stated, localContext);
|
|
25
25
|
|
package/src/verify/consequent.js
CHANGED
|
@@ -19,7 +19,7 @@ export default function verifyConsequent(consequentNode, consequents, localConte
|
|
|
19
19
|
|
|
20
20
|
if (unqualifiedStatementNode !== null) {
|
|
21
21
|
const stated = true,
|
|
22
|
-
assignments =
|
|
22
|
+
assignments = null,
|
|
23
23
|
statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
24
24
|
statementVerified = verifyStatement(statementNode, assignments, stated, localContext);
|
|
25
25
|
|
|
@@ -6,8 +6,8 @@ import referenceMetaType from "../metaType/reference";
|
|
|
6
6
|
|
|
7
7
|
import { nodeQuery } from "../utilities/query";
|
|
8
8
|
|
|
9
|
-
const statementNodeQuery = nodeQuery("/declaration/statement
|
|
10
|
-
metavariableNodeQuery = nodeQuery("/declaration/metavariable!");
|
|
9
|
+
const statementNodeQuery = nodeQuery("/declaration/statement[1]"),
|
|
10
|
+
metavariableNodeQuery = nodeQuery("/declaration/statement[0]/metavariable!");
|
|
11
11
|
|
|
12
12
|
const verifyDeclarationFunctions = [
|
|
13
13
|
verifyDerivedDeclaration,
|
|
@@ -44,7 +44,7 @@ function verifyDerivedDeclaration(declarationNode, declarations, stated, localCo
|
|
|
44
44
|
|
|
45
45
|
localContext.trace(`Verifying the '${declarationString}' derived declaration...`, declarationNode);
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
derivedDeclarationVerified = false; ///
|
|
48
48
|
|
|
49
49
|
if (derivedDeclarationVerified) {
|
|
50
50
|
localContext.debug(`...verified the '${declarationString}' derived declaration.`, declarationNode);
|
|
@@ -68,7 +68,7 @@ function verifyStatedDeclaration(declarationNode, declarations, stated, localCon
|
|
|
68
68
|
if (metavariableVerified) {
|
|
69
69
|
const { verifyStatement } = shim,
|
|
70
70
|
stated = true,
|
|
71
|
-
assignments =
|
|
71
|
+
assignments = null,
|
|
72
72
|
statementNode = statementNodeQuery(declarationNode),
|
|
73
73
|
statementVerified = verifyStatement(statementNode, assignments, stated, localContext);
|
|
74
74
|
|
package/src/verify/equality.js
CHANGED
|
@@ -41,7 +41,7 @@ function verifyDerivedEquality(equalityNode, assignments, stated, localContext)
|
|
|
41
41
|
if (!stated) {
|
|
42
42
|
const equalityString = localContext.nodeAsString(equalityNode);
|
|
43
43
|
|
|
44
|
-
localContext.trace(`Verifying the '${equalityString}'
|
|
44
|
+
localContext.trace(`Verifying the '${equalityString}' derived equality...`, equalityNode);
|
|
45
45
|
|
|
46
46
|
const terms = [],
|
|
47
47
|
termNodes = termNodesQuery(equalityNode),
|
|
@@ -54,10 +54,12 @@ function verifyDerivedEquality(equalityNode, assignments, stated, localContext)
|
|
|
54
54
|
const equalityEqual = equality.isEqual(localContext);
|
|
55
55
|
|
|
56
56
|
if (equalityEqual) {
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
if (assignments !== null) {
|
|
58
|
+
const equalityAssignment = EqualityAssignment.fromEquality(equality),
|
|
59
|
+
assignment = equalityAssignment; ///
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
assignments.push(assignment);
|
|
62
|
+
}
|
|
61
63
|
|
|
62
64
|
verifiedAhead = true;
|
|
63
65
|
}
|
|
@@ -69,7 +71,7 @@ function verifyDerivedEquality(equalityNode, assignments, stated, localContext)
|
|
|
69
71
|
derivedEqualityVerified = termsVerified; ///
|
|
70
72
|
|
|
71
73
|
if (derivedEqualityVerified) {
|
|
72
|
-
localContext.debug(`...verified the '${equalityString}'
|
|
74
|
+
localContext.debug(`...verified the '${equalityString}' derived equality.`, equalityNode);
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
|
|
@@ -92,10 +94,12 @@ function verifyStatedEquality(equalityNode, assignments, stated, localContext) {
|
|
|
92
94
|
const equality = Equality.fromTermsAndEqualityNode(terms, equalityNode);
|
|
93
95
|
|
|
94
96
|
if (equality !== null) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
if (assignments !== null) {
|
|
98
|
+
const equalityAssignment = EqualityAssignment.fromEquality(equality),
|
|
99
|
+
assignment = equalityAssignment; ///
|
|
97
100
|
|
|
98
|
-
|
|
101
|
+
assignments.push(assignment);
|
|
102
|
+
}
|
|
99
103
|
|
|
100
104
|
verifiedAhead = true;
|
|
101
105
|
}
|
package/src/verify/frame.js
CHANGED
|
@@ -45,7 +45,7 @@ function verifyDerivedFrame(frameNode, frames, stated, localContext) {
|
|
|
45
45
|
|
|
46
46
|
localContext.trace(`Verifying the '${frameString}' derived frame...`, frameNode);
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
derivedFrameVerified = false; ///
|
|
49
49
|
|
|
50
50
|
if (derivedFrameVerified) {
|
|
51
51
|
localContext.debug(`...verified the '${frameString}' derived frame.`, frameNode);
|
package/src/verify/judgement.js
CHANGED
|
@@ -9,7 +9,7 @@ import { first } from "../utilities/array";
|
|
|
9
9
|
import { nodeQuery } from "../utilities/query";
|
|
10
10
|
|
|
11
11
|
const frameNodeQuery = nodeQuery("/judgement/frame!"),
|
|
12
|
-
metavariableNodeQuery = nodeQuery("/judgement/metavariable!");
|
|
12
|
+
metavariableNodeQuery = nodeQuery("/judgement/statement/metavariable!");
|
|
13
13
|
|
|
14
14
|
const verifyJudgementFunctions = [
|
|
15
15
|
verifyDerivedJudgement,
|
|
@@ -46,49 +46,52 @@ function verifyDerivedJudgement(judgementNode, assignments, stated, localContext
|
|
|
46
46
|
|
|
47
47
|
localContext.trace(`Verifying the '${judgementString}' derived judgement...`, judgementNode);
|
|
48
48
|
|
|
49
|
-
const metavariableNode = metavariableNodeQuery(judgementNode)
|
|
50
|
-
metavariableVerified = verifyMetavariable(metavariableNode, localContext);
|
|
49
|
+
const metavariableNode = metavariableNodeQuery(judgementNode);
|
|
51
50
|
|
|
52
|
-
if (
|
|
53
|
-
const
|
|
51
|
+
if (metavariableNode !== null) {
|
|
52
|
+
const metavariableVerified = verifyMetavariable(metavariableNode, localContext);
|
|
54
53
|
|
|
55
|
-
if (
|
|
56
|
-
const
|
|
57
|
-
frameNode = frameNodeQuery(judgementNode),
|
|
58
|
-
frameVerified = verifyFrame(frameNode, frames, assignments, stated, localContext);
|
|
54
|
+
if (metavariableVerified) {
|
|
55
|
+
const judgement = localContext.findJudgementByMetavariableNode(metavariableNode);
|
|
59
56
|
|
|
60
|
-
if (
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
57
|
+
if (judgement !== null) {
|
|
58
|
+
const frames = [],
|
|
59
|
+
frameNode = frameNodeQuery(judgementNode),
|
|
60
|
+
frameVerified = verifyFrame(frameNode, frames, stated, localContext);
|
|
61
|
+
|
|
62
|
+
if (frameVerified) {
|
|
63
|
+
const firstFrame = first(frames),
|
|
64
|
+
frame = firstFrame, ///
|
|
65
|
+
frameSingular = frame.isSingular();
|
|
66
|
+
|
|
67
|
+
if (frameSingular) {
|
|
68
|
+
const declaration = frame.getDeclaration(),
|
|
69
|
+
metavariableNode = declaration.getMetavariableNode(),
|
|
70
|
+
metaLemma = localContext.findMetaLemmaByMetavariableNode(metavariableNode),
|
|
71
|
+
metatheorem = localContext.findMetatheoremByMetavariableNode(metavariableNode),
|
|
72
|
+
metaLemmaMetatheorem = (metaLemma || metatheorem); ///
|
|
73
|
+
|
|
74
|
+
if (metaLemmaMetatheorem !== null) {
|
|
75
|
+
const metaLemmaMetatheoremUnifiedWithDeclaration = declaration.unifyMetaLemmaOrMetaTheorem(metaLemmaMetatheorem),
|
|
76
|
+
metaLemmaMetatheoremUnifiedWithJudgement = judgement.unifyMetaLemmaOrMetaTheorem(metaLemmaMetatheorem);
|
|
77
|
+
|
|
78
|
+
derivedJudgementVerified = (metaLemmaMetatheoremUnifiedWithDeclaration && metaLemmaMetatheoremUnifiedWithJudgement);
|
|
79
|
+
} else {
|
|
80
|
+
const metavariableString = localContext.nodeAsString(metavariableNode);
|
|
81
|
+
|
|
82
|
+
localContext.debug(`There are no meta-lemmas or metatheorems corresponding to the '${metavariableString}' metavariable.`, judgementNode);
|
|
83
|
+
}
|
|
77
84
|
} else {
|
|
78
|
-
const
|
|
85
|
+
const frameString = localContext.nodeAsString(frameNode);
|
|
79
86
|
|
|
80
|
-
localContext.debug(`
|
|
87
|
+
localContext.debug(`The '${frameString}' is not singular.`, judgementNode);
|
|
81
88
|
}
|
|
82
|
-
} else {
|
|
83
|
-
const frameString = localContext.nodeAsString(frameNode);
|
|
84
|
-
|
|
85
|
-
localContext.debug(`The '${frameString}' is not singular.`, judgementNode);
|
|
86
89
|
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const metavariableString = localContext.nodeAsString(metavariableNode);
|
|
90
|
+
} else {
|
|
91
|
+
const metavariableString = localContext.nodeAsString(metavariableNode);
|
|
90
92
|
|
|
91
|
-
|
|
93
|
+
localContext.debug(`There is no judgement present for the '${metavariableString}' metavariable.`, judgementNode);
|
|
94
|
+
}
|
|
92
95
|
}
|
|
93
96
|
}
|
|
94
97
|
|
|
@@ -108,24 +111,29 @@ function verifyStatedJudgement(judgementNode, assignments, stated, localContext)
|
|
|
108
111
|
|
|
109
112
|
localContext.trace(`Verifying the '${judgementString}' stated judgement...`, judgementNode);
|
|
110
113
|
|
|
111
|
-
const metavariableNode = metavariableNodeQuery(judgementNode)
|
|
112
|
-
metavariableVerified = verifyMetavariable(metavariableNode, localContext);
|
|
114
|
+
const metavariableNode = metavariableNodeQuery(judgementNode);
|
|
113
115
|
|
|
114
|
-
if (
|
|
115
|
-
const
|
|
116
|
-
frameNode = frameNodeQuery(judgementNode),
|
|
117
|
-
frameVerified = verifyFrame(frameNode, frames, stated, localContext);
|
|
116
|
+
if (metavariableNode !== null) {
|
|
117
|
+
const metavariableVerified = verifyMetavariable(metavariableNode, localContext);
|
|
118
118
|
|
|
119
|
-
if (
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
judgementAssignment = JudgementAssignment.fromJudgement(judgement),
|
|
124
|
-
assignment = judgementAssignment;
|
|
119
|
+
if (metavariableVerified) {
|
|
120
|
+
const frames = [],
|
|
121
|
+
frameNode = frameNodeQuery(judgementNode),
|
|
122
|
+
frameVerified = verifyFrame(frameNode, frames, stated, localContext);
|
|
125
123
|
|
|
126
|
-
|
|
124
|
+
if (frameVerified) {
|
|
125
|
+
if (assignments !== null) {
|
|
126
|
+
const firstFrame = first(frames),
|
|
127
|
+
frame = firstFrame, ///
|
|
128
|
+
judgement = Judgement.fromJudgementNodeFrameAndMetavariableNode(judgementNode, frame, metavariableNode),
|
|
129
|
+
judgementAssignment = JudgementAssignment.fromJudgement(judgement),
|
|
130
|
+
assignment = judgementAssignment;
|
|
131
|
+
|
|
132
|
+
assignments.push(assignment);
|
|
133
|
+
}
|
|
127
134
|
|
|
128
|
-
|
|
135
|
+
statedJudgementVerified = true;
|
|
136
|
+
}
|
|
129
137
|
}
|
|
130
138
|
}
|
|
131
139
|
|
package/src/verify/premise.js
CHANGED
|
@@ -29,12 +29,12 @@ export default function verifyPremise(premiseNode, premises, localContext) {
|
|
|
29
29
|
const assignmentsAssigned = assignAssignments(assignments, localContext);
|
|
30
30
|
|
|
31
31
|
if (assignmentsAssigned) {
|
|
32
|
-
const
|
|
33
|
-
|
|
32
|
+
const premise = Premise.fromStatementNode(statementNode),
|
|
33
|
+
proofStep = ProofStep.fromStatementNode(statementNode);
|
|
34
34
|
|
|
35
35
|
premises.push(premise);
|
|
36
36
|
|
|
37
|
-
localContext.addProofStep(
|
|
37
|
+
localContext.addProofStep(proofStep);
|
|
38
38
|
|
|
39
39
|
premiseVerified = true;
|
|
40
40
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import verifyStatement from "../../verify/statement";
|
|
4
|
-
import unifyQualifiedStatement from "../../unify/
|
|
4
|
+
import unifyQualifiedStatement from "../../unify/qualifiedStatement";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../../utilities/query";
|
|
7
7
|
import { assignAssignments } from "../../utilities/assignments";
|