occam-verify-cli 0.0.968 → 0.0.971
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/bin/action/verify.js +6 -8
- package/lib/constants.js +5 -1
- package/lib/context/file.js +48 -53
- package/lib/context/local.js +45 -39
- package/lib/context/release.js +3 -3
- package/lib/declaration.js +9 -7
- package/lib/equivalence.js +23 -21
- package/lib/judgement.js +3 -3
- package/lib/label.js +3 -3
- package/lib/log.js +3 -3
- package/lib/metaType.js +7 -7
- package/lib/metavariable.js +7 -7
- package/lib/node/term/bracketed.js +16 -0
- package/lib/proofStep.js +3 -29
- package/lib/releaseContext/initialise.js +11 -17
- package/lib/resolve/substitutions.js +99 -0
- package/lib/rule.js +10 -6
- package/lib/substitution/statementForMetavariable.js +93 -98
- package/lib/substitution/termForVariable.js +45 -54
- package/lib/substitution.js +51 -9
- package/lib/substitutions.js +165 -12
- package/lib/term.js +8 -1
- package/lib/topLevelAssertion.js +10 -6
- package/lib/type.js +5 -5
- package/lib/unifier/metaLevel.js +10 -3
- package/lib/unifier/statementWithCombinator.js +6 -6
- package/lib/unifier.js +2 -2
- package/lib/unify/metavariableWithStatement.js +13 -48
- package/lib/unify/metavariableWithStatementGivenSubstitution.js +39 -0
- package/lib/unify/premiseWithProofStep.js +3 -3
- package/lib/unify/statement/qualified.js +117 -0
- package/lib/unify/statement/unqualified.js +25 -0
- package/lib/unify/statementWithBracketedCombinator.js +3 -3
- package/lib/unify/statementWithCombinators.js +5 -5
- package/lib/unify/statementWithMetaType.js +3 -3
- package/lib/unify/statementWithSttaemetnGivenEquivalences.js +45 -0
- package/lib/unify/suppositionWithProffStep.js +3 -3
- package/lib/unify/variableWithTerm.js +11 -26
- package/lib/utilities/array.js +5 -14
- package/lib/utilities/assertion.js +24 -0
- package/lib/utilities/brackets.js +60 -0
- package/lib/utilities/message.js +52 -0
- package/lib/utilities/name.js +7 -7
- package/lib/utilities/node.js +10 -17
- package/lib/utilities/string.js +1 -7
- package/lib/utilities/subproof.js +19 -0
- package/lib/utilities/unify.js +30 -11
- package/lib/variable.js +8 -8
- package/lib/verifier/metaLevel.js +6 -6
- package/lib/verifier/statementAsCombinator.js +2 -2
- package/lib/verify/assertion/contained.js +66 -32
- package/lib/verify/assertion/defined.js +51 -46
- package/lib/verify/assertion/subproof.js +9 -9
- package/lib/verify/assertion/type.js +11 -11
- package/lib/verify/conclusion.js +6 -6
- package/lib/verify/consequent.js +6 -6
- package/lib/verify/declaration/metavariable.js +2 -2
- package/lib/verify/declaration.js +34 -20
- package/lib/verify/equality.js +13 -13
- package/lib/verify/frame.js +38 -24
- package/lib/verify/judgement.js +13 -13
- package/lib/verify/metavariable.js +2 -2
- package/lib/verify/premise.js +5 -5
- package/lib/verify/proofStep.js +15 -24
- package/lib/verify/statement/qualified.js +15 -124
- package/lib/verify/statement/unqualified.js +23 -24
- package/lib/verify/statement.js +24 -24
- package/lib/verify/statementGivenMetaType.js +3 -3
- package/lib/verify/supposition.js +5 -5
- package/package.json +2 -2
- package/src/constants.js +1 -0
- package/src/context/file.js +49 -55
- package/src/context/local.js +34 -31
- package/src/context/release.js +2 -2
- package/src/declaration.js +12 -10
- package/src/equivalence.js +27 -26
- package/src/judgement.js +2 -2
- package/src/label.js +2 -2
- package/src/log.js +1 -1
- package/src/metaType.js +7 -7
- package/src/metavariable.js +7 -7
- package/src/node/term/bracketed.js +9 -0
- package/src/proofStep.js +3 -48
- package/src/releaseContext/initialise.js +13 -24
- package/src/resolve/substitutions.js +134 -0
- package/src/rule.js +10 -5
- package/src/substitution/statementForMetavariable.js +99 -85
- package/src/substitution/termForVariable.js +50 -65
- package/src/substitution.js +46 -8
- package/src/substitutions.js +176 -10
- package/src/term.js +6 -0
- package/src/topLevelAssertion.js +10 -5
- package/src/type.js +4 -4
- package/src/unifier/metaLevel.js +11 -3
- package/src/unifier/statementWithCombinator.js +5 -5
- package/src/unifier.js +1 -1
- package/src/unify/metavariableWithStatement.js +17 -71
- package/src/unify/metavariableWithStatementGivenSubstitution.js +39 -0
- package/src/unify/premiseWithProofStep.js +1 -1
- package/src/unify/statement/qualified.js +183 -0
- package/src/unify/statement/unqualified.js +24 -0
- package/src/unify/statementWithBracketedCombinator.js +2 -2
- package/src/unify/statementWithCombinators.js +4 -4
- package/src/unify/statementWithMetaType.js +2 -2
- package/src/unify/statementWithSttaemetnGivenEquivalences.js +51 -0
- package/src/unify/suppositionWithProffStep.js +1 -1
- package/src/unify/variableWithTerm.js +14 -35
- package/src/utilities/array.js +1 -16
- package/src/utilities/assertion.js +19 -0
- package/src/utilities/brackets.js +56 -0
- package/src/utilities/name.js +8 -8
- package/src/utilities/node.js +14 -17
- package/src/utilities/string.js +2 -2
- package/src/utilities/subproof.js +18 -0
- package/src/utilities/unify.js +24 -12
- package/src/variable.js +11 -11
- package/src/verifier/metaLevel.js +5 -5
- package/src/verifier/statementAsCombinator.js +2 -2
- package/src/verify/assertion/contained.js +80 -38
- package/src/verify/assertion/defined.js +64 -55
- package/src/verify/assertion/subproof.js +8 -8
- package/src/verify/assertion/type.js +11 -11
- package/src/verify/conclusion.js +8 -8
- package/src/verify/consequent.js +8 -8
- package/src/verify/declaration/metavariable.js +4 -3
- package/src/verify/declaration.js +46 -23
- package/src/verify/equality.js +13 -13
- package/src/verify/frame.js +48 -28
- package/src/verify/judgement.js +13 -13
- package/src/verify/metavariable.js +3 -3
- package/src/verify/premise.js +6 -6
- package/src/verify/proofStep.js +14 -31
- package/src/verify/statement/qualified.js +18 -199
- package/src/verify/statement/unqualified.js +25 -31
- package/src/verify/statement.js +23 -23
- package/src/verify/statementGivenMetaType.js +2 -2
- package/src/verify/supposition.js +6 -6
- package/lib/unify/statementAtainstStatement.js +0 -49
- package/lib/utilities/lineIndex.js +0 -52
- package/lib/utilities/match.js +0 -59
- package/lib/utilities/verify.js +0 -19
- package/src/unify/statementAtainstStatement.js +0 -56
- package/src/utilities/match.js +0 -53
- package/src/utilities/verify.js +0 -14
- /package/src/utilities/{lineIndex.js → message.js} +0 -0
|
@@ -7,18 +7,18 @@ const verifySubproofAssertionFunctions = [
|
|
|
7
7
|
verifyStatedSubproofAssertion
|
|
8
8
|
];
|
|
9
9
|
|
|
10
|
-
export default function verifySubproofAssertion(subproofAssertionNode, assignments,
|
|
11
|
-
let subproofAssertionVerified;
|
|
10
|
+
export default function verifySubproofAssertion(subproofAssertionNode, assignments, stated, localContext) {
|
|
11
|
+
let subproofAssertionVerified = false;
|
|
12
12
|
|
|
13
13
|
const subproofAssertionString = localContext.nodeAsString(subproofAssertionNode);
|
|
14
14
|
|
|
15
15
|
localContext.trace(`Verifying the '${subproofAssertionString}' subproof assertion...`, subproofAssertionNode);
|
|
16
16
|
|
|
17
|
-
const verified = metaLevelVerifier.verify(subproofAssertionNode, assignments,
|
|
17
|
+
const verified = metaLevelVerifier.verify(subproofAssertionNode, assignments, stated, localContext);
|
|
18
18
|
|
|
19
19
|
if (verified) {
|
|
20
20
|
subproofAssertionVerified = verifySubproofAssertionFunctions.some((verifySubproofAssertionFunction) => {
|
|
21
|
-
const subproofAssertionVerified = verifySubproofAssertionFunction(subproofAssertionNode, assignments,
|
|
21
|
+
const subproofAssertionVerified = verifySubproofAssertionFunction(subproofAssertionNode, assignments, stated, localContext);
|
|
22
22
|
|
|
23
23
|
if (subproofAssertionVerified) {
|
|
24
24
|
return true;
|
|
@@ -33,10 +33,10 @@ export default function verifySubproofAssertion(subproofAssertionNode, assignmen
|
|
|
33
33
|
return subproofAssertionVerified;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
function verifyDerivedSubproofAssertion(subproofAssertionNode, assignments,
|
|
36
|
+
function verifyDerivedSubproofAssertion(subproofAssertionNode, assignments, stated, localContext) {
|
|
37
37
|
let derivedSubproofAssertionVerified;
|
|
38
38
|
|
|
39
|
-
if (
|
|
39
|
+
if (!stated) {
|
|
40
40
|
const subproofAssertionString = localContext.nodeAsString(subproofAssertionNode);
|
|
41
41
|
|
|
42
42
|
localContext.trace(`Verifying the '${subproofAssertionString}' derived subproof assertion...`, subproofAssertionNode);
|
|
@@ -49,10 +49,10 @@ function verifyDerivedSubproofAssertion(subproofAssertionNode, assignments, deri
|
|
|
49
49
|
return derivedSubproofAssertionVerified;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
function verifyStatedSubproofAssertion(subproofAssertionNode, assignments,
|
|
52
|
+
function verifyStatedSubproofAssertion(subproofAssertionNode, assignments, stated, localContext) {
|
|
53
53
|
let statedSubproofAssertionVerified;
|
|
54
54
|
|
|
55
|
-
if (
|
|
55
|
+
if (stated) {
|
|
56
56
|
const subproofAssertionString = localContext.nodeAsString(subproofAssertionNode);
|
|
57
57
|
|
|
58
58
|
localContext.trace(`Verifying the '${subproofAssertionString}' stated subproof assertion...`, subproofAssertionNode);
|
|
@@ -11,20 +11,20 @@ const termNodeQuery = nodeQuery("/typeAssertion/term!"),
|
|
|
11
11
|
typeNodeQuery = nodeQuery("/typeAssertion/type!"),
|
|
12
12
|
variableNodeQuery = nodeQuery("/term/variable!");
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
const verifyTypeAssertionFunctions = [
|
|
15
|
+
verifyDerivedTypeAssertion,
|
|
16
|
+
verifyStatedTypeAssertion
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
export default function verifyTypeAssertion(typeAssertionNode, assignments, stated, localContext) {
|
|
15
20
|
let typeAssertionVerified;
|
|
16
21
|
|
|
17
22
|
const typeAssertionString = localContext.nodeAsString(typeAssertionNode);
|
|
18
23
|
|
|
19
24
|
localContext.trace(`Verifying the '${typeAssertionString}' type assertion...`, typeAssertionNode);
|
|
20
25
|
|
|
21
|
-
const verifyTypeAssertionFunctions = [
|
|
22
|
-
verifyDerivedTypeAssertion,
|
|
23
|
-
verifyStatedTypeAssertion
|
|
24
|
-
];
|
|
25
|
-
|
|
26
26
|
typeAssertionVerified = verifyTypeAssertionFunctions.some((verifyTypeAssertionFunction) => {
|
|
27
|
-
const typeAssertionVerified = verifyTypeAssertionFunction(typeAssertionNode, assignments,
|
|
27
|
+
const typeAssertionVerified = verifyTypeAssertionFunction(typeAssertionNode, assignments, stated, localContext);
|
|
28
28
|
|
|
29
29
|
if (typeAssertionVerified) {
|
|
30
30
|
return true;
|
|
@@ -38,10 +38,10 @@ export default function verifyTypeAssertion(typeAssertionNode, assignments, deri
|
|
|
38
38
|
return typeAssertionVerified;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
function verifyDerivedTypeAssertion(typeAssertionNode, assignments,
|
|
41
|
+
function verifyDerivedTypeAssertion(typeAssertionNode, assignments, stated, localContext) {
|
|
42
42
|
let derivedTypeAssertionVerified = false;
|
|
43
43
|
|
|
44
|
-
if (
|
|
44
|
+
if (!stated) {
|
|
45
45
|
const typeAssertionString = localContext.nodeAsString(typeAssertionNode);
|
|
46
46
|
|
|
47
47
|
localContext.trace(`Verifying the '${typeAssertionString}' derived type assertion...`, typeAssertionNode);
|
|
@@ -82,10 +82,10 @@ function verifyDerivedTypeAssertion(typeAssertionNode, assignments, derived, loc
|
|
|
82
82
|
return derivedTypeAssertionVerified;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
function verifyStatedTypeAssertion(typeAssertionNode, assignments,
|
|
85
|
+
function verifyStatedTypeAssertion(typeAssertionNode, assignments, stated, localContext) {
|
|
86
86
|
let statedTypeAssertionVerified = false;
|
|
87
87
|
|
|
88
|
-
if (
|
|
88
|
+
if (stated) {
|
|
89
89
|
const typeAssertionString = localContext.nodeAsString(typeAssertionNode);
|
|
90
90
|
|
|
91
91
|
localContext.trace(`Verifying the '${typeAssertionString}' stated type assertion...`, typeAssertionNode);
|
package/src/verify/conclusion.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Conclusion from "../conclusion";
|
|
4
|
-
import
|
|
4
|
+
import verifyStatement from "../verify/statement";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
7
7
|
|
|
@@ -15,16 +15,16 @@ export default function verifyConclusion(conclusionNode, conclusions, localConte
|
|
|
15
15
|
|
|
16
16
|
localContext.trace(`Verifying the '${conclusionString}' conclusion...`, conclusionNode);
|
|
17
17
|
|
|
18
|
-
const
|
|
19
|
-
assignments = [],
|
|
20
|
-
unqualifiedStatementNode = unqualifiedStatementNodeQuery(conclusionNode);
|
|
18
|
+
const unqualifiedStatementNode = unqualifiedStatementNodeQuery(conclusionNode);
|
|
21
19
|
|
|
22
20
|
if (unqualifiedStatementNode !== null) {
|
|
23
|
-
const
|
|
21
|
+
const stated = true,
|
|
22
|
+
assignments = [],
|
|
23
|
+
statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
24
|
+
statementVerified = verifyStatement(statementNode, assignments, stated, localContext);
|
|
24
25
|
|
|
25
|
-
if (
|
|
26
|
-
const
|
|
27
|
-
conclusion = Conclusion.fromStatementNode(statementNode);
|
|
26
|
+
if (statementVerified) {
|
|
27
|
+
const conclusion = Conclusion.fromStatementNode(statementNode);
|
|
28
28
|
|
|
29
29
|
conclusions.push(conclusion);
|
|
30
30
|
|
package/src/verify/consequent.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Consequent from "../consequent";
|
|
4
|
-
import
|
|
4
|
+
import verifyStatement from "../verify/statement";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
7
7
|
|
|
@@ -15,16 +15,16 @@ export default function verifyConsequent(consequentNode, consequents, localConte
|
|
|
15
15
|
|
|
16
16
|
localContext.trace(`Verifying the '${consequentString}' consequent...`, consequentNode);
|
|
17
17
|
|
|
18
|
-
const
|
|
19
|
-
assignments = [],
|
|
20
|
-
unqualifiedStatementNode = unqualifiedStatementNodeQuery(consequentNode);
|
|
18
|
+
const unqualifiedStatementNode = unqualifiedStatementNodeQuery(consequentNode);
|
|
21
19
|
|
|
22
20
|
if (unqualifiedStatementNode !== null) {
|
|
23
|
-
const
|
|
21
|
+
const stated = true,
|
|
22
|
+
assignments = [],
|
|
23
|
+
statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
24
|
+
statementVerified = verifyStatement(statementNode, assignments, stated, localContext);
|
|
24
25
|
|
|
25
|
-
if (
|
|
26
|
-
const
|
|
27
|
-
consequent = Consequent.fromStatementNode(statementNode);
|
|
26
|
+
if (statementVerified) {
|
|
27
|
+
const consequent = Consequent.fromStatementNode(statementNode);
|
|
28
28
|
|
|
29
29
|
consequents.push(consequent);
|
|
30
30
|
|
|
@@ -5,7 +5,7 @@ import MetavariableAssignment from "../../assignment/metavariable";
|
|
|
5
5
|
|
|
6
6
|
import { first } from "../../utilities/array";
|
|
7
7
|
import { nodeQuery } from "../../utilities/query";
|
|
8
|
-
import {
|
|
8
|
+
import { metavariableNameFromMetavariableNode } from "../../utilities/name";
|
|
9
9
|
|
|
10
10
|
const termNodeQuery = nodeQuery("/argument/term"),
|
|
11
11
|
typeNodeQuery = nodeQuery("/argument/type"),
|
|
@@ -70,8 +70,9 @@ function verifyMetavariable(metavariableNode, metaTypeNode, fileContext) {
|
|
|
70
70
|
termType = firstTermType; ///
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
const
|
|
74
|
-
|
|
73
|
+
const metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
|
|
74
|
+
node = metavariableNode, ///
|
|
75
|
+
name = metavariableName, ///
|
|
75
76
|
metavariable = Metavariable.fromNodeNameTermTypeAndMetaType(node, name, termType, metaType),
|
|
76
77
|
metavariableAssignment = MetavariableAssignment.fromMetavariable(metavariable),
|
|
77
78
|
metavariableAssigned = metavariableAssignment.assign(fileContext);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import shim from "../shim";
|
|
3
4
|
import Declaration from "../declaration"
|
|
4
5
|
import referenceMetaType from "../metaType/reference";
|
|
5
6
|
|
|
@@ -8,20 +9,20 @@ import { nodeQuery } from "../utilities/query";
|
|
|
8
9
|
const statementNodeQuery = nodeQuery("/declaration/statement!"),
|
|
9
10
|
metavariableNodeQuery = nodeQuery("/declaration/metavariable!");
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
const verifyDeclarationFunctions = [
|
|
13
|
+
verifyDerivedDeclaration,
|
|
14
|
+
verifyStatedDeclaration
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
export default function verifyDeclaration(declarationNode, declarations, stated, localContext) {
|
|
12
18
|
let declarationVerified;
|
|
13
19
|
|
|
14
20
|
const declarationString = localContext.nodeAsString(declarationNode);
|
|
15
21
|
|
|
16
22
|
localContext.trace(`Verifying the '${declarationString}' declaration...`, declarationNode);
|
|
17
23
|
|
|
18
|
-
const verifyDeclarationFunctions = [
|
|
19
|
-
verifyDerivedDeclaration,
|
|
20
|
-
verifyStatedDeclaration
|
|
21
|
-
];
|
|
22
|
-
|
|
23
24
|
declarationVerified = verifyDeclarationFunctions.some((verifyDeclarationFunction) => {
|
|
24
|
-
const declarationVerified = verifyDeclarationFunction(declarationNode,
|
|
25
|
+
const declarationVerified = verifyDeclarationFunction(declarationNode, declarations, stated, localContext);
|
|
25
26
|
|
|
26
27
|
if (declarationVerified) {
|
|
27
28
|
return true;
|
|
@@ -35,32 +36,54 @@ export default function verifyDeclaration(declarationNode, assignments, derived,
|
|
|
35
36
|
return declarationVerified;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
function
|
|
39
|
-
let
|
|
39
|
+
function verifyDerivedDeclaration(declarationNode, declarations, stated, localContext) {
|
|
40
|
+
let derivedDeclarationVerified;
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
if (!stated) {
|
|
43
|
+
const declarationString = localContext.nodeAsString(declarationNode);
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
localContext.trace(`Verifying the '${declarationString}' derived declaration...`, declarationNode);
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
metavariableVerified = verifyMetavariable(metavariableNode, localContext);
|
|
47
|
+
debugger
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
if (derivedDeclarationVerified) {
|
|
50
|
+
localContext.debug(`...verified the '${declarationString}' derived declaration.`, declarationNode);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
50
53
|
|
|
51
|
-
|
|
54
|
+
return derivedDeclarationVerified;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function verifyStatedDeclaration(declarationNode, declarations, stated, localContext) {
|
|
58
|
+
let statedDeclarationVerified = false;
|
|
59
|
+
|
|
60
|
+
if (stated) {
|
|
61
|
+
const declarationString = localContext.nodeAsString(declarationNode);
|
|
62
|
+
|
|
63
|
+
localContext.trace(`Verifying the '${declarationString}' stated declaration...`, declarationNode);
|
|
52
64
|
|
|
53
|
-
|
|
54
|
-
|
|
65
|
+
const metavariableNode = metavariableNodeQuery(declarationNode),
|
|
66
|
+
metavariableVerified = verifyMetavariable(metavariableNode, localContext);
|
|
55
67
|
|
|
56
|
-
|
|
68
|
+
if (metavariableVerified) {
|
|
69
|
+
const { verifyStatement } = shim,
|
|
70
|
+
stated = true,
|
|
71
|
+
assignments = [],
|
|
72
|
+
statementNode = statementNodeQuery(declarationNode),
|
|
73
|
+
statementVerified = verifyStatement(statementNode, assignments, stated, localContext);
|
|
57
74
|
|
|
58
|
-
|
|
75
|
+
if (statementVerified) {
|
|
76
|
+
const declaration = Declaration.fromMetavariableNodeAndStatementNode(metavariableNode, statementNode);
|
|
77
|
+
|
|
78
|
+
declarations.push(declaration);
|
|
79
|
+
|
|
80
|
+
statedDeclarationVerified = true;
|
|
81
|
+
}
|
|
59
82
|
}
|
|
60
|
-
}
|
|
61
83
|
|
|
62
|
-
|
|
63
|
-
|
|
84
|
+
if (statedDeclarationVerified) {
|
|
85
|
+
localContext.debug(`...verified the '${declarationString}' stated declaration.`, declarationNode);
|
|
86
|
+
}
|
|
64
87
|
}
|
|
65
88
|
|
|
66
89
|
return statedDeclarationVerified;
|
package/src/verify/equality.js
CHANGED
|
@@ -8,20 +8,20 @@ import { nodesQuery } from "../utilities/query";
|
|
|
8
8
|
|
|
9
9
|
const termNodesQuery = nodesQuery("/equality/term");
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const verifyEqualityFunctions = [
|
|
12
|
+
verifyDerivedEquality,
|
|
13
|
+
verifyStatedEquality
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
export default function verifyEquality(equalityNode, assignments, stated, localContext) {
|
|
12
17
|
let equalityVerified;
|
|
13
18
|
|
|
14
19
|
const equalityString = localContext.nodeAsString(equalityNode);
|
|
15
20
|
|
|
16
21
|
localContext.trace(`Verifying the '${equalityString}' equality...`, equalityNode);
|
|
17
22
|
|
|
18
|
-
const verifyEqualityFunctions = [
|
|
19
|
-
verifyDerivedEquality,
|
|
20
|
-
verifyStatedEquality
|
|
21
|
-
];
|
|
22
|
-
|
|
23
23
|
equalityVerified = verifyEqualityFunctions.some((verifyEqualityFunction) => {
|
|
24
|
-
const equalityVerified = verifyEqualityFunction(equalityNode, assignments,
|
|
24
|
+
const equalityVerified = verifyEqualityFunction(equalityNode, assignments, stated, localContext);
|
|
25
25
|
|
|
26
26
|
if (equalityVerified) {
|
|
27
27
|
return true;
|
|
@@ -35,13 +35,13 @@ export default function verifyEquality(equalityNode, assignments, derived, local
|
|
|
35
35
|
return equalityVerified;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
function verifyDerivedEquality(equalityNode, assignments,
|
|
38
|
+
function verifyDerivedEquality(equalityNode, assignments, stated, localContext) {
|
|
39
39
|
let derivedEqualityVerified = false;
|
|
40
40
|
|
|
41
|
-
if (
|
|
41
|
+
if (!stated) {
|
|
42
42
|
const equalityString = localContext.nodeAsString(equalityNode);
|
|
43
43
|
|
|
44
|
-
localContext.trace(`Verifying the '${equalityString}'
|
|
44
|
+
localContext.trace(`Verifying the '${equalityString}' stated equality...`, equalityNode);
|
|
45
45
|
|
|
46
46
|
const terms = [],
|
|
47
47
|
termNodes = termNodesQuery(equalityNode),
|
|
@@ -69,17 +69,17 @@ function verifyDerivedEquality(equalityNode, assignments, derived, localContext)
|
|
|
69
69
|
derivedEqualityVerified = termsVerified; ///
|
|
70
70
|
|
|
71
71
|
if (derivedEqualityVerified) {
|
|
72
|
-
localContext.debug(`...verified the '${equalityString}'
|
|
72
|
+
localContext.debug(`...verified the '${equalityString}' stated equality.`, equalityNode);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
return derivedEqualityVerified;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
function verifyStatedEquality(equalityNode, assignments,
|
|
79
|
+
function verifyStatedEquality(equalityNode, assignments, stated, localContext) {
|
|
80
80
|
let statedEqualityVerified = false;
|
|
81
81
|
|
|
82
|
-
if (
|
|
82
|
+
if (stated) {
|
|
83
83
|
const equalityString = localContext.nodeAsString(equalityNode);
|
|
84
84
|
|
|
85
85
|
localContext.trace(`Verifying the '${equalityString}' stated equality...`, equalityNode);
|
package/src/verify/frame.js
CHANGED
|
@@ -10,20 +10,20 @@ import { nodesQuery } from "../utilities/query";
|
|
|
10
10
|
const declarationNodesQuery = nodesQuery("/frame/declaration"),
|
|
11
11
|
metavariableNodesQuery = nodesQuery("/frame/metavariable");
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
const verifyFrameFunctions = [
|
|
14
|
+
verifyDerivedFrame,
|
|
15
|
+
verifyStatedFrame
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
export default function verifyFrame(frameNode, frames, stated, localContext) {
|
|
14
19
|
let frameVerified;
|
|
15
20
|
|
|
16
21
|
const frameString = localContext.nodeAsString(frameNode);
|
|
17
22
|
|
|
18
23
|
localContext.trace(`Verifying the '${frameString}' frame...`, frameNode);
|
|
19
24
|
|
|
20
|
-
const verifyFrameFunctions = [
|
|
21
|
-
verifyDerivedFrame,
|
|
22
|
-
verifyStatedFrame
|
|
23
|
-
];
|
|
24
|
-
|
|
25
25
|
frameVerified = verifyFrameFunctions.some((verifyFrameFunction) => {
|
|
26
|
-
const frameVerified = verifyFrameFunction(frameNode,
|
|
26
|
+
const frameVerified = verifyFrameFunction(frameNode, frames, stated, localContext);
|
|
27
27
|
|
|
28
28
|
if (frameVerified) {
|
|
29
29
|
return true;
|
|
@@ -37,37 +37,57 @@ export default function verifyFrame(frameNode, assignments, derived, localContex
|
|
|
37
37
|
return frameVerified;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
function
|
|
40
|
+
function verifyDerivedFrame(frameNode, frames, stated, localContext) {
|
|
41
|
+
let derivedFrameVerified;
|
|
42
|
+
|
|
43
|
+
if (!stated) {
|
|
44
|
+
const frameString = localContext.nodeAsString(frameNode);
|
|
45
|
+
|
|
46
|
+
localContext.trace(`Verifying the '${frameString}' derived frame...`, frameNode);
|
|
47
|
+
|
|
48
|
+
debugger
|
|
49
|
+
|
|
50
|
+
if (derivedFrameVerified) {
|
|
51
|
+
localContext.debug(`...verified the '${frameString}' derived frame.`, frameNode);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return derivedFrameVerified;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function verifyStatedFrame(frameNode, frames, stated, localContext) {
|
|
41
59
|
let statedFrameVerified;
|
|
42
60
|
|
|
43
|
-
|
|
61
|
+
if (stated) {
|
|
62
|
+
const frameString = localContext.nodeAsString(frameNode);
|
|
44
63
|
|
|
45
|
-
|
|
64
|
+
localContext.trace(`Verifying the '${frameString}' stated frame...`, frameNode);
|
|
46
65
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
66
|
+
const declarations = [],
|
|
67
|
+
declarationNodes = declarationNodesQuery(frameNode),
|
|
68
|
+
metavariableNodes = metavariableNodesQuery(frameNode),
|
|
69
|
+
declarationsVerified = declarationNodes.every((declarationNode) => {
|
|
70
|
+
const declarationVerified = verifyDeclaration(declarationNode, declarations, stated, localContext);
|
|
52
71
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
72
|
+
return declarationVerified;
|
|
73
|
+
}),
|
|
74
|
+
metavariablesVerified = metavariableNodes.every((metavariableNode) => {
|
|
75
|
+
const metavariableVerified = verifyMetavariable(metavariableNode, declarations, localContext);
|
|
57
76
|
|
|
58
|
-
|
|
59
|
-
|
|
77
|
+
return metavariableVerified;
|
|
78
|
+
});
|
|
60
79
|
|
|
61
|
-
|
|
62
|
-
|
|
80
|
+
if (declarationsVerified && metavariablesVerified) {
|
|
81
|
+
const frame = Frame.fromDeclarations(declarations);
|
|
63
82
|
|
|
64
|
-
|
|
83
|
+
frames.push(frame);
|
|
65
84
|
|
|
66
|
-
|
|
67
|
-
|
|
85
|
+
statedFrameVerified = true;
|
|
86
|
+
}
|
|
68
87
|
|
|
69
|
-
|
|
70
|
-
|
|
88
|
+
if (statedFrameVerified) {
|
|
89
|
+
localContext.debug(`...verified the '${frameString}' stated frame.`, frameNode);
|
|
90
|
+
}
|
|
71
91
|
}
|
|
72
92
|
|
|
73
93
|
return statedFrameVerified;
|
package/src/verify/judgement.js
CHANGED
|
@@ -11,20 +11,20 @@ import { nodeQuery } from "../utilities/query";
|
|
|
11
11
|
const frameNodeQuery = nodeQuery("/judgement/frame!"),
|
|
12
12
|
metavariableNodeQuery = nodeQuery("/judgement/metavariable!");
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
const verifyJudgementFunctions = [
|
|
15
|
+
verifyDerivedJudgement,
|
|
16
|
+
verifyStatedJudgement
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
export default function verifyJudgement(judgementNode, assignments, stated, localContext) {
|
|
15
20
|
let judgementVerified;
|
|
16
21
|
|
|
17
22
|
const judgementString = localContext.nodeAsString(judgementNode);
|
|
18
23
|
|
|
19
24
|
localContext.trace(`Verifying the '${judgementString}' judgement...`, judgementNode);
|
|
20
25
|
|
|
21
|
-
const verifyJudgementFunctions = [
|
|
22
|
-
verifyDerivedJudgement,
|
|
23
|
-
verifyStatedJudgement
|
|
24
|
-
];
|
|
25
|
-
|
|
26
26
|
judgementVerified = verifyJudgementFunctions.some((verifyJudgementFunction) => {
|
|
27
|
-
const judgementVerified = verifyJudgementFunction(judgementNode, assignments,
|
|
27
|
+
const judgementVerified = verifyJudgementFunction(judgementNode, assignments, stated, localContext);
|
|
28
28
|
|
|
29
29
|
if (judgementVerified) {
|
|
30
30
|
return true;
|
|
@@ -38,10 +38,10 @@ export default function verifyJudgement(judgementNode, assignments, derived, loc
|
|
|
38
38
|
return judgementVerified;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
function verifyDerivedJudgement(judgementNode, assignments,
|
|
41
|
+
function verifyDerivedJudgement(judgementNode, assignments, stated, localContext) {
|
|
42
42
|
let derivedJudgementVerified = false;
|
|
43
43
|
|
|
44
|
-
if (
|
|
44
|
+
if (!stated) {
|
|
45
45
|
const judgementString = localContext.nodeAsString(judgementNode);
|
|
46
46
|
|
|
47
47
|
localContext.trace(`Verifying the '${judgementString}' derived judgement...`, judgementNode);
|
|
@@ -55,7 +55,7 @@ function verifyDerivedJudgement(judgementNode, assignments, derived, localContex
|
|
|
55
55
|
if (judgement !== null) {
|
|
56
56
|
const frames = [],
|
|
57
57
|
frameNode = frameNodeQuery(judgementNode),
|
|
58
|
-
frameVerified = verifyFrame(frameNode, frames, assignments,
|
|
58
|
+
frameVerified = verifyFrame(frameNode, frames, assignments, stated, localContext);
|
|
59
59
|
|
|
60
60
|
if (frameVerified) {
|
|
61
61
|
const firstFrame = first(frames),
|
|
@@ -100,10 +100,10 @@ function verifyDerivedJudgement(judgementNode, assignments, derived, localContex
|
|
|
100
100
|
return derivedJudgementVerified;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
function verifyStatedJudgement(judgementNode, assignments,
|
|
103
|
+
function verifyStatedJudgement(judgementNode, assignments, stated, localContext) {
|
|
104
104
|
let statedJudgementVerified = false;
|
|
105
105
|
|
|
106
|
-
if (
|
|
106
|
+
if (stated) {
|
|
107
107
|
const judgementString = localContext.nodeAsString(judgementNode);
|
|
108
108
|
|
|
109
109
|
localContext.trace(`Verifying the '${judgementString}' stated judgement...`, judgementNode);
|
|
@@ -114,7 +114,7 @@ function verifyStatedJudgement(judgementNode, assignments, derived, localContext
|
|
|
114
114
|
if (metavariableVerified) {
|
|
115
115
|
const frames = [],
|
|
116
116
|
frameNode = frameNodeQuery(judgementNode),
|
|
117
|
-
frameVerified = verifyFrame(frameNode, frames,
|
|
117
|
+
frameVerified = verifyFrame(frameNode, frames, stated, localContext);
|
|
118
118
|
|
|
119
119
|
if (frameVerified) {
|
|
120
120
|
const firstFrame = first(frames),
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { nodeQuery } from "../utilities/query";
|
|
4
4
|
import { unifyTermWithTermType } from "../metavariable";
|
|
5
|
-
import {
|
|
5
|
+
import { metavariableNameFromMetavariableNode } from "../utilities/name";
|
|
6
6
|
|
|
7
7
|
const termNodeQuery = nodeQuery("/metavariable/argument/term"),
|
|
8
8
|
typeNodeQuery = nodeQuery("/metavariable/argument/type");
|
|
@@ -14,8 +14,8 @@ export default function verifyMetavariable(metavariableNode, localContext) {
|
|
|
14
14
|
|
|
15
15
|
localContext.trace(`Verifying the '${metavariableString}' metavariable...`, metavariableNode);
|
|
16
16
|
|
|
17
|
-
const
|
|
18
|
-
metavariable = localContext.
|
|
17
|
+
const metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
|
|
18
|
+
metavariable = localContext.findMetavariableByMetavariableName(metavariableName);
|
|
19
19
|
|
|
20
20
|
if (metavariable === null) {
|
|
21
21
|
localContext.debug(`The metavariable '${metavariableString}' is not present.`, metavariableNode);
|
package/src/verify/premise.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import Premise from "../premise";
|
|
4
4
|
import ProofStep from "../proofStep";
|
|
5
|
-
import
|
|
5
|
+
import verifyStatement from "../verify/statement";
|
|
6
6
|
|
|
7
7
|
import { nodeQuery } from "../utilities/query";
|
|
8
8
|
import { assignAssignments } from "../utilities/assignments";
|
|
@@ -20,16 +20,16 @@ export default function verifyPremise(premiseNode, premises, localContext) {
|
|
|
20
20
|
const unqualifiedStatementNode = unqualifiedStatementNodeQuery(premiseNode);
|
|
21
21
|
|
|
22
22
|
if (unqualifiedStatementNode !== null) {
|
|
23
|
-
const
|
|
23
|
+
const stated = true,
|
|
24
24
|
assignments = [],
|
|
25
|
-
|
|
25
|
+
statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
26
|
+
statementVerified = verifyStatement(statementNode, assignments, stated, localContext);
|
|
26
27
|
|
|
27
|
-
if (
|
|
28
|
+
if (statementVerified) {
|
|
28
29
|
const assignmentsAssigned = assignAssignments(assignments, localContext);
|
|
29
30
|
|
|
30
31
|
if (assignmentsAssigned) {
|
|
31
|
-
const
|
|
32
|
-
metaproofStep = ProofStep.fromStatementNode(statementNode),
|
|
32
|
+
const metaproofStep = ProofStep.fromStatementNode(statementNode),
|
|
33
33
|
premise = Premise.fromStatementNode(statementNode);
|
|
34
34
|
|
|
35
35
|
premises.push(premise);
|
package/src/verify/proofStep.js
CHANGED
|
@@ -7,7 +7,6 @@ import verifyQualifiedStatement from "../verify/statement/qualified";
|
|
|
7
7
|
import verifyUnqualifiedStatement from "../verify/statement/unqualified";
|
|
8
8
|
|
|
9
9
|
import { nodeQuery } from "../utilities/query";
|
|
10
|
-
import { assignAssignments } from "../utilities/assignments";
|
|
11
10
|
|
|
12
11
|
const subproofNodeQuery = nodeQuery("/proofStep|lastProofStep/subproof!"),
|
|
13
12
|
statementNodeQuery = nodeQuery("/qualifiedStatement|unqualifiedStatement/statement!"),
|
|
@@ -23,45 +22,29 @@ export default function verifyProofStep(proofStepNode, substitutions, localConte
|
|
|
23
22
|
|
|
24
23
|
let proofStep = null;
|
|
25
24
|
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
subproofVerified = verifySubproof(subproofNode, substitutions, localContext);
|
|
25
|
+
if (false) {
|
|
26
|
+
///
|
|
27
|
+
} else if (subproofNode !== null) {
|
|
28
|
+
const subproofVerified = verifySubproof(subproofNode, substitutions, localContext);
|
|
30
29
|
|
|
31
30
|
if (subproofVerified) {
|
|
32
31
|
proofStep = ProofStep.fromSubproofNode(subproofNode);
|
|
33
32
|
}
|
|
34
|
-
} else {
|
|
35
|
-
|
|
36
|
-
const derived = false, ///
|
|
37
|
-
assignments = [],
|
|
38
|
-
qualifiedStatementVerified = verifyQualifiedStatement(qualifiedStatementNode, substitutions, assignments, derived, localContext);
|
|
39
|
-
|
|
40
|
-
if (qualifiedStatementVerified) {
|
|
41
|
-
const assignmentsAssigned = assignAssignments(assignments, localContext);
|
|
33
|
+
} else if (qualifiedStatementNode !== null) {
|
|
34
|
+
const qualifiedStatementVerified = verifyQualifiedStatement(qualifiedStatementNode, substitutions, localContext);
|
|
42
35
|
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
if (qualifiedStatementVerified) {
|
|
37
|
+
const statementNode = statementNodeQuery(qualifiedStatementNode);
|
|
45
38
|
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
}
|
|
39
|
+
proofStep = ProofStep.fromStatementNode(statementNode);
|
|
49
40
|
}
|
|
41
|
+
} else if (unqualifiedStatementNode !== null) {
|
|
42
|
+
const unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, localContext);
|
|
50
43
|
|
|
51
|
-
if (
|
|
52
|
-
const
|
|
53
|
-
assignments = [],
|
|
54
|
-
unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, assignments, derived, localContext);
|
|
55
|
-
|
|
56
|
-
if (unqualifiedStatementVerified) {
|
|
57
|
-
const assignmentsAssigned = assignAssignments(assignments, localContext);
|
|
58
|
-
|
|
59
|
-
if (assignmentsAssigned) {
|
|
60
|
-
const statementNode = statementNodeQuery(unqualifiedStatementNode);
|
|
44
|
+
if (unqualifiedStatementVerified) {
|
|
45
|
+
const statementNode = statementNodeQuery(unqualifiedStatementNode);
|
|
61
46
|
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
}
|
|
47
|
+
proofStep = ProofStep.fromStatementNode(statementNode);
|
|
65
48
|
}
|
|
66
49
|
}
|
|
67
50
|
|