occam-verify-cli 0.0.960 → 0.0.962
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/local.js +3 -9
- package/lib/proofStep.js +8 -5
- package/lib/substitution/termForVariable.js +24 -25
- package/lib/unifier/statementWithCombinator.js +6 -6
- package/lib/unify/statementAtainstStatement.js +16 -16
- package/lib/unify/statementWithBracketedCombinator.js +30 -0
- package/lib/unify/statementWithCombinators.js +40 -0
- package/lib/unify/statementWithMetaType.js +6 -30
- package/lib/unify/termWithBracketedConstructor.js +39 -0
- package/lib/unify/termWithConstructors.js +61 -0
- package/lib/unify/termWithType.js +4 -12
- package/lib/utilities/assignments.js +9 -12
- package/lib/verifier/intrinsicLevel.js +140 -0
- package/lib/verifier/metaLevel.js +11 -20
- package/lib/verifier/statementAsCombinator.js +9 -9
- package/lib/verifier/termAsConstructor.js +5 -5
- package/lib/verify/assertion/contained.js +2 -3
- package/lib/verify/assertion/defined.js +2 -4
- package/lib/verify/assertion/subproof.js +20 -18
- package/lib/verify/assertion/type.js +1 -2
- package/lib/verify/declaration.js +27 -9
- package/lib/verify/frame.js +25 -6
- package/lib/verify/premise.js +3 -3
- package/lib/verify/proofStep.js +23 -30
- package/lib/verify/statement/qualified.js +93 -137
- package/lib/verify/statement/unqualified.js +18 -104
- package/lib/verify/statement.js +95 -76
- package/lib/verify/statementAsCombinator.js +2 -2
- package/lib/verify/statementGivenMetaType.js +41 -0
- package/lib/verify/supposition.js +3 -3
- package/lib/verify/term.js +39 -65
- package/lib/verify/termAsConstructor.js +2 -2
- package/lib/verify/termGivenType.js +34 -0
- package/package.json +1 -1
- package/src/context/local.js +4 -13
- package/src/proofStep.js +10 -5
- package/src/substitution/termForVariable.js +33 -30
- package/src/unifier/statementWithCombinator.js +5 -5
- package/src/unify/statementAtainstStatement.js +13 -13
- package/src/unify/statementWithBracketedCombinator.js +22 -0
- package/src/unify/statementWithCombinators.js +38 -0
- package/src/unify/statementWithMetaType.js +6 -42
- package/src/unify/termWithBracketedConstructor.js +39 -0
- package/src/unify/termWithConstructors.js +63 -0
- package/src/unify/termWithType.js +4 -20
- package/src/utilities/assignments.js +6 -13
- package/src/verifier/intrinsicLevel.js +42 -0
- package/src/verifier/metaLevel.js +13 -21
- package/src/verifier/statementAsCombinator.js +11 -7
- package/src/verifier/termAsConstructor.js +4 -3
- package/src/verify/assertion/contained.js +1 -3
- package/src/verify/assertion/defined.js +1 -4
- package/src/verify/assertion/subproof.js +22 -18
- package/src/verify/assertion/type.js +0 -1
- package/src/verify/declaration.js +34 -11
- package/src/verify/frame.js +32 -5
- package/src/verify/premise.js +3 -3
- package/src/verify/proofStep.js +26 -38
- package/src/verify/statement/qualified.js +104 -184
- package/src/verify/statement/unqualified.js +19 -149
- package/src/verify/statement.js +126 -72
- package/src/verify/statementAsCombinator.js +1 -1
- package/src/verify/statementGivenMetaType.js +37 -0
- package/src/verify/supposition.js +3 -3
- package/src/verify/term.js +44 -93
- package/src/verify/termAsConstructor.js +1 -1
- package/src/verify/termGivenType.js +32 -0
|
@@ -1,50 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import verifyStatementGivenMetaType from "../verify/statementGivenMetaType";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
export default function unifyStatementWithMetaType(statementNode, metaTypeNode, assignments, derived, localContext) {
|
|
6
|
+
let statementUnifiedWithMetaType;
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
|
|
8
|
+
const metaType = localContext.findMetaTypeByMetaTypeNode(metaTypeNode),
|
|
9
|
+
statementVerifiedGivenMetaType = verifyStatementGivenMetaType(statementNode, metaType, assignments, derived, localContext);
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
let statementUnifiedWithMetaType = false;
|
|
13
|
-
|
|
14
|
-
const metaTypeTerminalNode = metaTypeTerminalNodeQuery(metaTypeNode),
|
|
15
|
-
metaTypeTerminalNodeContent = metaTypeTerminalNode.getContent(),
|
|
16
|
-
metaTypeName = metaTypeTerminalNodeContent; ///
|
|
17
|
-
|
|
18
|
-
switch (metaTypeName) {
|
|
19
|
-
case FRAME_META_TYPE_NAME: {
|
|
20
|
-
const metavariableNode = metavariableNodeQuery(statementNode);
|
|
21
|
-
|
|
22
|
-
if (metavariableNode !== null) {
|
|
23
|
-
const metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode);
|
|
24
|
-
|
|
25
|
-
if (metavariable !== null) {
|
|
26
|
-
const metavariableMetaTypeName = metavariable.getMetaTypeName();
|
|
27
|
-
|
|
28
|
-
if (metavariableMetaTypeName === metaTypeName) {
|
|
29
|
-
statementUnifiedWithMetaType = true;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
case STATEMENT_META_TYPE_NAME: {
|
|
38
|
-
const { verifyStatement } = shim,
|
|
39
|
-
derived = false,
|
|
40
|
-
assignments = [],
|
|
41
|
-
statementVerified = verifyStatement(statementNode, assignments, derived, localContext);
|
|
42
|
-
|
|
43
|
-
statementUnifiedWithMetaType = statementVerified;
|
|
44
|
-
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
11
|
+
statementUnifiedWithMetaType = statementVerifiedGivenMetaType; ///
|
|
48
12
|
|
|
49
13
|
return statementUnifiedWithMetaType;
|
|
50
14
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import shim from "../shim";
|
|
4
|
+
import bracketedConstructor from "../constructor/bracketed";
|
|
5
|
+
|
|
6
|
+
import { nodeQuery } from "../utilities/query";
|
|
7
|
+
import { unifyTermWithConstructor } from "../unify/termWithConstructors";
|
|
8
|
+
|
|
9
|
+
const termNodeQuery = nodeQuery("/term/argument/term");
|
|
10
|
+
|
|
11
|
+
export default function unifyTermWithBracketedConstructor(termNode, terms, localContext, verifyAhead) {
|
|
12
|
+
let termUnifiedWithBracketedConstructor;
|
|
13
|
+
|
|
14
|
+
const termString = localContext.nodeAsString(termNode),
|
|
15
|
+
bracketedTerms = [];
|
|
16
|
+
|
|
17
|
+
localContext.trace(`Unifying the '${termString}' term with the bracketed constructor...`, termNode);
|
|
18
|
+
|
|
19
|
+
termUnifiedWithBracketedConstructor = unifyTermWithConstructor(termNode, bracketedTerms, bracketedConstructor, localContext, () => {
|
|
20
|
+
let verifiedAhead;
|
|
21
|
+
|
|
22
|
+
const bracketedTermNode = termNode; ///
|
|
23
|
+
|
|
24
|
+
termNode = termNodeQuery(bracketedTermNode); ///
|
|
25
|
+
|
|
26
|
+
const { verifyTerm } = shim,
|
|
27
|
+
termVVerified = verifyTerm(termNode, terms, localContext, verifyAhead);
|
|
28
|
+
|
|
29
|
+
verifiedAhead = termVVerified; ///
|
|
30
|
+
|
|
31
|
+
return verifiedAhead;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
if (termUnifiedWithBracketedConstructor) {
|
|
35
|
+
localContext.debug(`...unified the '${termString}' term with the bracketed constructor.`, termNode);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return termUnifiedWithBracketedConstructor;
|
|
39
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import Term from "../term";
|
|
4
|
+
import termWithConstructorUnifier from "../unifier/termWithConstructor";
|
|
5
|
+
|
|
6
|
+
import { nodeQuery } from "../utilities/query";
|
|
7
|
+
|
|
8
|
+
const variableNodeQuery = nodeQuery("/term/variable!");
|
|
9
|
+
|
|
10
|
+
export default function unifyTermWithConstructors(termNode, terms, localContext, verifyAhead) {
|
|
11
|
+
let termUnifiedWithConstructors = false;
|
|
12
|
+
|
|
13
|
+
const variableNode = variableNodeQuery(termNode);
|
|
14
|
+
|
|
15
|
+
if (variableNode === null) {
|
|
16
|
+
const constructors = localContext.getConstructors();
|
|
17
|
+
|
|
18
|
+
termUnifiedWithConstructors = constructors.some((constructor) => {
|
|
19
|
+
const termUnifiedWithConstructor = unifyTermWithConstructor(termNode, terms, constructor, localContext, verifyAhead);
|
|
20
|
+
|
|
21
|
+
if (termUnifiedWithConstructor) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return termUnifiedWithConstructors;
|
|
28
|
+
}
|
|
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
|
+
}
|
|
@@ -1,31 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import { first } from "../utilities/array";
|
|
3
|
+
import verifyTermGivenType from "../verify/termGivenType";
|
|
6
4
|
|
|
7
5
|
export default function unifyTermWithType(termNode, typeNode, localContext) {
|
|
8
6
|
let termUnifiedWithType;
|
|
9
7
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
termVerified = verifyTerm(termNode, terms, localContext, () => {
|
|
13
|
-
let verifiedAhead = false;
|
|
14
|
-
|
|
15
|
-
const firstTerm = first(terms),
|
|
16
|
-
term = firstTerm, ///
|
|
17
|
-
termType = term.getType(),
|
|
18
|
-
type = localContext.findTypeByTypeNode(typeNode),
|
|
19
|
-
termTypeEqualToOrSubTypeOfType = termType.isEqualToOrSubTypeOf(type);
|
|
20
|
-
|
|
21
|
-
if (termTypeEqualToOrSubTypeOfType) {
|
|
22
|
-
verifiedAhead = true;
|
|
23
|
-
}
|
|
8
|
+
const type = localContext.findTypeByTypeNode(typeNode),
|
|
9
|
+
termVerifiedGivenType = verifyTermGivenType(termNode, type, localContext);
|
|
24
10
|
|
|
25
|
-
|
|
26
|
-
});
|
|
11
|
+
termUnifiedWithType = termVerifiedGivenType; ///
|
|
27
12
|
|
|
28
|
-
termUnifiedWithType = termVerified; ///
|
|
29
13
|
|
|
30
14
|
return termUnifiedWithType;
|
|
31
15
|
}
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export function assignAssignments(assignments, localContext) {
|
|
4
|
+
const assignmentsAssigned = assignments.every((assigment) => {
|
|
5
|
+
const assignmentAssigned = assigment.assign(localContext);
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
return assignmentAssigned
|
|
8
|
+
});
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (assignmentsLength === 1) {
|
|
11
|
-
const firstAssignment = first(assignments),
|
|
12
|
-
assignment = firstAssignment;
|
|
13
|
-
|
|
14
|
-
assignmentAssigned = assignment.assign(localContext);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return assignmentAssigned;
|
|
10
|
+
return assignmentsAssigned;
|
|
18
11
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import shim from "../shim";
|
|
4
|
+
import Verifier from "../verifier";
|
|
5
|
+
|
|
6
|
+
import { nodeQuery } from "../utilities/query";
|
|
7
|
+
|
|
8
|
+
const termNodeQuery = nodeQuery("/term!");
|
|
9
|
+
|
|
10
|
+
class IntrinsicLevelVerifier extends Verifier {
|
|
11
|
+
verify(node, localContext) {
|
|
12
|
+
let verified;
|
|
13
|
+
|
|
14
|
+
const nonTerminalNode = node, ///
|
|
15
|
+
nonTerminalNodeVerified = this.verifyNonTerminalNode(nonTerminalNode, localContext);
|
|
16
|
+
|
|
17
|
+
verified = nonTerminalNodeVerified; ///
|
|
18
|
+
|
|
19
|
+
return verified;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static maps = [
|
|
23
|
+
{
|
|
24
|
+
nodeQuery: termNodeQuery,
|
|
25
|
+
verify: (termNode, localContext) => {
|
|
26
|
+
const { verifyTerm } = shim,
|
|
27
|
+
terms = [],
|
|
28
|
+
termVerified = verifyTerm(termNode, terms, localContext, () => {
|
|
29
|
+
const verifiedAhead = true;
|
|
30
|
+
|
|
31
|
+
return verifiedAhead;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return termVerified;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const intrinsicLevelVerifier = new IntrinsicLevelVerifier();
|
|
41
|
+
|
|
42
|
+
export default intrinsicLevelVerifier;
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import shim from "../shim";
|
|
3
4
|
import Verifier from "../verifier";
|
|
4
|
-
import verifyTerm from "../verify/term";
|
|
5
|
-
import verifyVariable from "../verify/variable";
|
|
6
|
-
import verifyMetavariable from "../verify/metavariable";
|
|
7
5
|
|
|
8
6
|
import { nodeQuery } from "../utilities/query";
|
|
9
7
|
|
|
10
8
|
const termNodeQuery = nodeQuery("/term!"),
|
|
11
|
-
|
|
12
|
-
metavariableNodeQuery = nodeQuery("/metavariable!");
|
|
9
|
+
statementNodeQuery = nodeQuery("/statement!");
|
|
13
10
|
|
|
14
11
|
class MetaLevelVerifier extends Verifier {
|
|
15
|
-
verify(node, localContext) {
|
|
12
|
+
verify(node, assignments, derived, localContext) {
|
|
16
13
|
let verified;
|
|
17
14
|
|
|
18
15
|
const nonTerminalNode = node, ///
|
|
19
|
-
|
|
16
|
+
childNodes = nonTerminalNode.getChildNodes(),
|
|
17
|
+
nonTerminalNodeVerified = this.verifyChildNodes(childNodes, assignments, derived, localContext);
|
|
20
18
|
|
|
21
19
|
verified = nonTerminalNodeVerified; ///
|
|
22
20
|
|
|
@@ -25,25 +23,19 @@ class MetaLevelVerifier extends Verifier {
|
|
|
25
23
|
|
|
26
24
|
static maps = [
|
|
27
25
|
{
|
|
28
|
-
nodeQuery:
|
|
29
|
-
verify: (
|
|
30
|
-
const
|
|
26
|
+
nodeQuery: statementNodeQuery,
|
|
27
|
+
verify: (statementNode, assignments, derived, localContext) => {
|
|
28
|
+
const { verifyStatement } = shim,
|
|
29
|
+
statementVerified = verifyStatement(statementNode, assignments, derived, localContext);
|
|
31
30
|
|
|
32
|
-
return
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
nodeQuery: variableNodeQuery,
|
|
37
|
-
verify: (variableNode, localContext) => {
|
|
38
|
-
const variableVerified = verifyVariable(variableNode, localContext);
|
|
39
|
-
|
|
40
|
-
return variableVerified;
|
|
31
|
+
return statementVerified;
|
|
41
32
|
}
|
|
42
33
|
},
|
|
43
34
|
{
|
|
44
35
|
nodeQuery: termNodeQuery,
|
|
45
|
-
verify: (termNode, localContext) => {
|
|
46
|
-
const
|
|
36
|
+
verify: (termNode, assignments, derived, localContext) => {
|
|
37
|
+
const { verifyTerm } = shim,
|
|
38
|
+
terms = [],
|
|
47
39
|
termVerified = verifyTerm(termNode, terms, localContext, () => {
|
|
48
40
|
const verifiedAhead = true;
|
|
49
41
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import shim from "../shim";
|
|
3
4
|
import Verifier from "../verifier";
|
|
4
5
|
import verifyType from "../verify/type";
|
|
5
|
-
import verifyTerm from "../verify/term";
|
|
6
|
-
import verifyStatement from "../verify/statement";
|
|
7
6
|
|
|
8
7
|
import { nodeQuery } from "../utilities/query";
|
|
8
|
+
import LocalContext from "../context/local";
|
|
9
9
|
|
|
10
10
|
const termNodeQuery = nodeQuery("/term!"),
|
|
11
11
|
typeNodeQuery = nodeQuery("/type!"),
|
|
12
12
|
statementNodeQuery = nodeQuery("/statement!");
|
|
13
13
|
|
|
14
14
|
class StatementAsCombinatorVerifier extends Verifier {
|
|
15
|
-
|
|
15
|
+
verifyStatement(statementNode, fileContext) {
|
|
16
16
|
let statementVerifiedAsCombinator;
|
|
17
17
|
|
|
18
18
|
const nonTerminalNode = statementNode, ///
|
|
@@ -27,9 +27,11 @@ class StatementAsCombinatorVerifier extends Verifier {
|
|
|
27
27
|
static maps = [
|
|
28
28
|
{
|
|
29
29
|
nodeQuery: statementNodeQuery,
|
|
30
|
-
verify: (statementNode,
|
|
31
|
-
const
|
|
30
|
+
verify: (statementNode, fileContext) => {
|
|
31
|
+
const { verifyStatement } = shim,
|
|
32
|
+
derived = false,
|
|
32
33
|
assignments = [],
|
|
34
|
+
localContext = LocalContext.fromFileContext(fileContext),
|
|
33
35
|
statementVerified = verifyStatement(statementNode, assignments, derived, localContext);
|
|
34
36
|
|
|
35
37
|
return statementVerified;
|
|
@@ -37,8 +39,10 @@ class StatementAsCombinatorVerifier extends Verifier {
|
|
|
37
39
|
},
|
|
38
40
|
{
|
|
39
41
|
nodeQuery: termNodeQuery,
|
|
40
|
-
verify: (termNode,
|
|
41
|
-
const
|
|
42
|
+
verify: (termNode, fileContext) => {
|
|
43
|
+
const { verifyTerm } = shim,
|
|
44
|
+
terms = [],
|
|
45
|
+
localContext = LocalContext.fromFileContext(fileContext),
|
|
42
46
|
termVerified = verifyTerm(termNode, terms, localContext, () => {
|
|
43
47
|
const verifiedAhead = true;
|
|
44
48
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import shim from "../shim";
|
|
3
4
|
import Verifier from "../verifier";
|
|
4
|
-
import verifyTerm from "../verify/term";
|
|
5
5
|
import verifyType from "../verify/type";
|
|
6
6
|
import LocalContext from "../context/local";
|
|
7
7
|
|
|
@@ -11,7 +11,7 @@ const termNodeQuery = nodeQuery("/term!"),
|
|
|
11
11
|
typeNodeQuery = nodeQuery("/type!");
|
|
12
12
|
|
|
13
13
|
class TermAsConstructorVerifier extends Verifier {
|
|
14
|
-
|
|
14
|
+
verifyTerm(termNode, fileContext) {
|
|
15
15
|
let termVerifiedAsConstructor;
|
|
16
16
|
|
|
17
17
|
const nonTerminalNode = termNode, ///
|
|
@@ -31,7 +31,8 @@ class TermAsConstructorVerifier extends Verifier {
|
|
|
31
31
|
{
|
|
32
32
|
nodeQuery: termNodeQuery,
|
|
33
33
|
verify: (termNode, fileContext, verifyAhead) => {
|
|
34
|
-
const
|
|
34
|
+
const { verifyTerm } = shim,
|
|
35
|
+
terms = [],
|
|
35
36
|
localContext = LocalContext.fromFileContext(fileContext),
|
|
36
37
|
termVerified = verifyTerm(termNode, terms, localContext, verifyAhead);
|
|
37
38
|
|
|
@@ -83,9 +83,7 @@ function verifyStatedContainedAssertion(containedAssertionNode, assignments, der
|
|
|
83
83
|
|
|
84
84
|
localContext.trace(`Verifying the '${containedAssertionString}' stated contained assertion...`, containedAssertionNode);
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
statedContainedAssertionVerified = verified; ///
|
|
86
|
+
debugger
|
|
89
87
|
|
|
90
88
|
if (statedContainedAssertionVerified) {
|
|
91
89
|
localContext.debug(`...verified the '${containedAssertionString}' stated contained assertion.`, containedAssertionNode);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import verifyTerm from "../../verify/term";
|
|
4
|
-
import metaLevelVerifier from "../../verifier/metaLevel";
|
|
5
4
|
|
|
6
5
|
import { first } from "../../utilities/array";
|
|
7
6
|
import { nodeQuery } from "../../utilities/query";
|
|
@@ -112,9 +111,7 @@ function verifyStatedDefinedAssertion(definedAssertionNode, assignments, derived
|
|
|
112
111
|
|
|
113
112
|
localContext.trace(`Verifying the '${definedAssertionString}' stated defined assertion...`, definedAssertionNode);
|
|
114
113
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
statedDefinedAssertionVerified = verified; ///
|
|
114
|
+
debugger
|
|
118
115
|
|
|
119
116
|
if (statedDefinedAssertionVerified) {
|
|
120
117
|
localContext.debug(`...verified the '${definedAssertionString}' stated defined assertion.`, definedAssertionNode);
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import metaLevelVerifier from "../../verifier/metaLevel";
|
|
4
4
|
|
|
5
|
+
const verifySubproofAssertionFunctions = [
|
|
6
|
+
verifyDerivedSubproofAssertion,
|
|
7
|
+
verifyStatedSubproofAssertion
|
|
8
|
+
];
|
|
9
|
+
|
|
5
10
|
export default function verifySubproofAssertion(subproofAssertionNode, assignments, derived, localContext) {
|
|
6
11
|
let subproofAssertionVerified;
|
|
7
12
|
|
|
@@ -9,18 +14,17 @@ export default function verifySubproofAssertion(subproofAssertionNode, assignmen
|
|
|
9
14
|
|
|
10
15
|
localContext.trace(`Verifying the '${subproofAssertionString}' subproof assertion...`, subproofAssertionNode);
|
|
11
16
|
|
|
12
|
-
const
|
|
13
|
-
verifyDerivedSubproofAssertion,
|
|
14
|
-
verifyStatedSubproofAssertion
|
|
15
|
-
];
|
|
17
|
+
const verified = metaLevelVerifier.verify(subproofAssertionNode, assignments, derived, localContext);
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
if (verified) {
|
|
20
|
+
subproofAssertionVerified = verifySubproofAssertionFunctions.some((verifySubproofAssertionFunction) => {
|
|
21
|
+
const subproofAssertionVerified = verifySubproofAssertionFunction(subproofAssertionNode, assignments, derived, localContext);
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
if (subproofAssertionVerified) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
24
28
|
|
|
25
29
|
if (subproofAssertionVerified) {
|
|
26
30
|
localContext.debug(`...verified the '${subproofAssertionString}' subproof assertion.`, subproofAssertionNode);
|
|
@@ -30,30 +34,30 @@ export default function verifySubproofAssertion(subproofAssertionNode, assignmen
|
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
function verifyDerivedSubproofAssertion(subproofAssertionNode, assignments, derived, localContext) {
|
|
33
|
-
let derivedSubproofAssertionVerified
|
|
37
|
+
let derivedSubproofAssertionVerified;
|
|
34
38
|
|
|
35
39
|
if (derived) {
|
|
36
40
|
const subproofAssertionString = localContext.nodeAsString(subproofAssertionNode);
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
localContext.trace(`Verifying the '${subproofAssertionString}' derived subproof assertion...`, subproofAssertionNode);
|
|
43
|
+
|
|
44
|
+
derivedSubproofAssertionVerified = false;
|
|
45
|
+
|
|
46
|
+
localContext.debug(`The '${subproofAssertionString}' derived subproof assertion cannot be verified.`, subproofAssertionNode);
|
|
41
47
|
}
|
|
42
48
|
|
|
43
49
|
return derivedSubproofAssertionVerified;
|
|
44
50
|
}
|
|
45
51
|
|
|
46
52
|
function verifyStatedSubproofAssertion(subproofAssertionNode, assignments, derived, localContext) {
|
|
47
|
-
let statedSubproofAssertionVerified
|
|
53
|
+
let statedSubproofAssertionVerified;
|
|
48
54
|
|
|
49
55
|
if (!derived) {
|
|
50
56
|
const subproofAssertionString = localContext.nodeAsString(subproofAssertionNode);
|
|
51
57
|
|
|
52
58
|
localContext.trace(`Verifying the '${subproofAssertionString}' stated subproof assertion...`, subproofAssertionNode);
|
|
53
59
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
statedSubproofAssertionVerified = verified; ///
|
|
60
|
+
statedSubproofAssertionVerified = true;
|
|
57
61
|
|
|
58
62
|
if (statedSubproofAssertionVerified) {
|
|
59
63
|
localContext.debug(`...verified the '${subproofAssertionString}' stated subproof assertion.`, subproofAssertionNode);
|
|
@@ -6,7 +6,6 @@ import VariableAssignment from "../../assignment/variable";
|
|
|
6
6
|
|
|
7
7
|
import { first } from "../../utilities/array";
|
|
8
8
|
import { nodeQuery } from "../../utilities/query";
|
|
9
|
-
import local from "../../context/local";
|
|
10
9
|
|
|
11
10
|
const termNodeQuery = nodeQuery("/typeAssertion/term!"),
|
|
12
11
|
typeNodeQuery = nodeQuery("/typeAssertion/type!"),
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import shim from "../shim";
|
|
4
3
|
import Declaration from "../declaration"
|
|
5
4
|
import referenceMetaType from "../metaType/reference";
|
|
6
5
|
|
|
@@ -9,38 +8,62 @@ import { nodeQuery } from "../utilities/query";
|
|
|
9
8
|
const statementNodeQuery = nodeQuery("/declaration/statement!"),
|
|
10
9
|
metavariableNodeQuery = nodeQuery("/declaration/metavariable!");
|
|
11
10
|
|
|
12
|
-
export default function verifyDeclaration(declarationNode,
|
|
13
|
-
let declarationVerified
|
|
11
|
+
export default function verifyDeclaration(declarationNode, assignments, derived, localContext) {
|
|
12
|
+
let declarationVerified;
|
|
14
13
|
|
|
15
14
|
const declarationString = localContext.nodeAsString(declarationNode);
|
|
16
15
|
|
|
17
16
|
localContext.trace(`Verifying the '${declarationString}' declaration...`, declarationNode);
|
|
18
17
|
|
|
18
|
+
const verifyDeclarationFunctions = [
|
|
19
|
+
verifyDerivedDeclaration,
|
|
20
|
+
verifyStatedDeclaration
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
declarationVerified = verifyDeclarationFunctions.some((verifyDeclarationFunction) => {
|
|
24
|
+
const declarationVerified = verifyDeclarationFunction(declarationNode, assignments, derived, localContext);
|
|
25
|
+
|
|
26
|
+
if (declarationVerified) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
if (declarationVerified) {
|
|
32
|
+
localContext.debug(`...verified the '${declarationString}' declaration.`, declarationNode);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return declarationVerified;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function verifyStatedDeclaration(declarationNode, declarations, localContext) {
|
|
39
|
+
let statedDeclarationVerified = false;
|
|
40
|
+
|
|
41
|
+
const declarationString = localContext.nodeAsString(declarationNode);
|
|
42
|
+
|
|
43
|
+
localContext.trace(`Verifying the '${declarationString}' stated declaration...`, declarationNode);
|
|
44
|
+
|
|
19
45
|
const metavariableNode = metavariableNodeQuery(declarationNode),
|
|
20
46
|
metavariableVerified = verifyMetavariable(metavariableNode, localContext);
|
|
21
47
|
|
|
22
48
|
if (metavariableVerified) {
|
|
23
49
|
const statementNode = statementNodeQuery(declarationNode);
|
|
24
50
|
|
|
25
|
-
|
|
26
|
-
derived = false,
|
|
27
|
-
assignments = [],
|
|
28
|
-
statementVerified = verifyStatement(statementNode, assignments, derived, localContext);
|
|
51
|
+
debugger
|
|
29
52
|
|
|
30
53
|
if (statementVerified) {
|
|
31
54
|
const declaration = Declaration.fromMetavariableNodeAndStatementNode(metavariableNode, statementNode);
|
|
32
55
|
|
|
33
56
|
declarations.push(declaration);
|
|
34
57
|
|
|
35
|
-
|
|
58
|
+
statedDeclarationVerified = true;
|
|
36
59
|
}
|
|
37
60
|
}
|
|
38
61
|
|
|
39
|
-
if (
|
|
40
|
-
localContext.debug(`...verified the '${declarationString}' declaration.`, declarationNode);
|
|
62
|
+
if (statedDeclarationVerified) {
|
|
63
|
+
localContext.debug(`...verified the '${declarationString}' stated declaration.`, declarationNode);
|
|
41
64
|
}
|
|
42
65
|
|
|
43
|
-
return
|
|
66
|
+
return statedDeclarationVerified;
|
|
44
67
|
}
|
|
45
68
|
|
|
46
69
|
function verifyMetavariable(metavariableNode, localContext) {
|
package/src/verify/frame.js
CHANGED
|
@@ -10,13 +10,40 @@ import { nodesQuery } from "../utilities/query";
|
|
|
10
10
|
const declarationNodesQuery = nodesQuery("/frame/declaration"),
|
|
11
11
|
metavariableNodesQuery = nodesQuery("/frame/metavariable");
|
|
12
12
|
|
|
13
|
-
export default function verifyFrame(frameNode,
|
|
13
|
+
export default function verifyFrame(frameNode, assignments, derived, localContext) {
|
|
14
14
|
let frameVerified;
|
|
15
15
|
|
|
16
16
|
const frameString = localContext.nodeAsString(frameNode);
|
|
17
17
|
|
|
18
18
|
localContext.trace(`Verifying the '${frameString}' frame...`, frameNode);
|
|
19
19
|
|
|
20
|
+
const verifyFrameFunctions = [
|
|
21
|
+
verifyDerivedFrame,
|
|
22
|
+
verifyStatedFrame
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
frameVerified = verifyFrameFunctions.some((verifyFrameFunction) => {
|
|
26
|
+
const frameVerified = verifyFrameFunction(frameNode, assignments, derived, localContext);
|
|
27
|
+
|
|
28
|
+
if (frameVerified) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
if (frameVerified) {
|
|
34
|
+
localContext.debug(`...verified the '${frameString}' frame.`, frameNode);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return frameVerified;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function verifyStatedFrame(frameNode, frames, assignments, derived, localContext) {
|
|
41
|
+
let statedFrameVerified;
|
|
42
|
+
|
|
43
|
+
const frameString = localContext.nodeAsString(frameNode);
|
|
44
|
+
|
|
45
|
+
localContext.trace(`Verifying the '${frameString}' stated frame...`, frameNode);
|
|
46
|
+
|
|
20
47
|
const declarations = [],
|
|
21
48
|
declarationNodes = declarationNodesQuery(frameNode),
|
|
22
49
|
metavariableNodes = metavariableNodesQuery(frameNode),
|
|
@@ -36,14 +63,14 @@ export default function verifyFrame(frameNode, frames, assignments, derived, loc
|
|
|
36
63
|
|
|
37
64
|
frames.push(frame);
|
|
38
65
|
|
|
39
|
-
|
|
66
|
+
statedFrameVerified = true;
|
|
40
67
|
}
|
|
41
68
|
|
|
42
|
-
if (
|
|
43
|
-
localContext.debug(`...verified the '${frameString}' frame.`, frameNode);
|
|
69
|
+
if (statedFrameVerified) {
|
|
70
|
+
localContext.debug(`...verified the '${frameString}' stated frame.`, frameNode);
|
|
44
71
|
}
|
|
45
72
|
|
|
46
|
-
return
|
|
73
|
+
return statedFrameVerified;
|
|
47
74
|
}
|
|
48
75
|
|
|
49
76
|
function verifyMetavariable(metavariableNode, declarations, localContext) {
|