occam-verify-cli 0.0.1003 → 0.0.1006
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/README.md +0 -2
- package/bin/abbreviations.js +1 -3
- package/bin/action/help.js +0 -2
- package/bin/action/verify.js +4 -24
- package/bin/defaults.js +0 -2
- package/bin/main.js +3 -4
- package/bin/options.js +0 -2
- package/bin/utilities/releaseContext.js +9 -2
- package/lib/assertion/subproof.js +106 -0
- package/lib/assignment/metavariable.js +2 -2
- package/lib/combinator.js +50 -16
- package/lib/conclusion.js +74 -14
- package/lib/context/file.js +191 -31
- package/lib/context/local.js +37 -49
- package/lib/context/release.js +25 -81
- package/lib/declaration/combinator.js +83 -0
- package/lib/derivation.js +86 -0
- package/lib/equality.js +3 -11
- package/lib/index.js +1 -1
- package/lib/judgement.js +3 -10
- package/lib/label.js +58 -16
- package/lib/log.js +3 -11
- package/lib/metaType.js +31 -19
- package/lib/metavariable.js +39 -12
- package/lib/mixins/statement/qualified/unify.js +118 -0
- package/lib/mixins/statement/unify.js +57 -0
- package/lib/mixins/statement/verify.js +184 -0
- package/lib/node/statement/combinator/bracketed.js +15 -11
- package/lib/ocmbinator/bracketed.js +52 -8
- package/lib/premise.js +109 -55
- package/lib/proof.js +91 -0
- package/lib/proofStep.js +78 -25
- package/lib/reference.js +62 -16
- package/lib/rule.js +146 -26
- package/lib/ruleNames.js +5 -5
- package/lib/statement/qualified.js +127 -0
- package/lib/statement/unqualified.js +89 -0
- package/lib/statement.js +176 -0
- package/lib/subDerivation.js +86 -0
- package/lib/subproof.js +155 -0
- package/lib/substitution/frameForMetavariable.js +14 -15
- package/lib/substitution/statementForMetavariable.js +23 -24
- package/lib/substitution/termForVariable.js +11 -12
- package/lib/substitution.js +9 -2
- package/lib/substitutions.js +14 -14
- package/lib/supposition.js +92 -61
- package/lib/unifier/statementWithCombinator.js +3 -3
- package/lib/unify/metavariableWithFrame.js +2 -2
- package/lib/unify/metavariableWithStatement.js +2 -2
- package/lib/unify/metavariableWithStatementGivenSubstitution.js +2 -2
- package/lib/unify/variableWithTerm.js +2 -2
- package/lib/utilities/node.js +13 -11
- package/lib/utilities/releaseContext.js +5 -6
- package/lib/utilities/string.js +8 -2
- package/lib/utilities/subproof.js +5 -5
- package/lib/utilities/tokens.js +10 -10
- package/lib/variable.js +1 -10
- package/lib/verifier/metaLevel.js +2 -2
- package/lib/verifier/topLevel.js +5 -5
- package/lib/verify/axiom.js +3 -5
- package/lib/verify/conjecture.js +4 -7
- package/lib/verify/consequent.js +2 -3
- package/lib/verify/declaration/combinator.js +2 -14
- package/lib/verify/declaration/metavariable.js +9 -10
- package/lib/verify/files.js +4 -4
- package/lib/verify/frame.js +12 -12
- package/lib/verify/lemma.js +4 -7
- package/lib/verify/metaLemma.js +4 -7
- package/lib/verify/metatheorem.js +4 -7
- package/lib/verify/proofStep.js +2 -31
- package/lib/verify/theorem.js +4 -7
- package/package.json +1 -1
- package/src/assertion/subproof.js +84 -0
- package/src/assignment/metavariable.js +2 -2
- package/src/combinator.js +45 -15
- package/src/conclusion.js +85 -13
- package/src/context/file.js +223 -11
- package/src/context/local.js +12 -16
- package/src/context/release.js +31 -100
- package/src/declaration/combinator.js +44 -0
- package/src/derivation.js +50 -0
- package/src/equality.js +2 -9
- package/src/index.js +0 -1
- package/src/judgement.js +2 -8
- package/src/label.js +56 -13
- package/src/log.js +2 -9
- package/src/metaType.js +26 -14
- package/src/metavariable.js +57 -9
- package/src/mixins/statement/qualified/unify.js +186 -0
- package/src/mixins/statement/unify.js +70 -0
- package/src/mixins/statement/verify.js +274 -0
- package/src/node/statement/combinator/bracketed.js +4 -3
- package/src/ocmbinator/bracketed.js +15 -12
- package/src/premise.js +138 -44
- package/src/proof.js +58 -0
- package/src/proofStep.js +92 -22
- package/src/reference.js +58 -12
- package/src/rule.js +199 -30
- package/src/ruleNames.js +1 -1
- package/src/statement/qualified.js +104 -0
- package/src/statement/unqualified.js +60 -0
- package/src/statement.js +179 -0
- package/src/subDerivation.js +52 -0
- package/src/subproof.js +99 -0
- package/src/substitution/frameForMetavariable.js +20 -17
- package/src/substitution/statementForMetavariable.js +31 -29
- package/src/substitution/termForVariable.js +15 -14
- package/src/substitution.js +8 -0
- package/src/substitutions.js +12 -13
- package/src/supposition.js +96 -51
- package/src/unifier/statementWithCombinator.js +6 -3
- package/src/unify/metavariableWithFrame.js +1 -1
- package/src/unify/metavariableWithStatement.js +1 -1
- package/src/unify/metavariableWithStatementGivenSubstitution.js +1 -1
- package/src/unify/variableWithTerm.js +1 -1
- package/src/utilities/node.js +18 -12
- package/src/utilities/releaseContext.js +5 -8
- package/src/utilities/string.js +6 -2
- package/src/utilities/subproof.js +2 -2
- package/src/utilities/tokens.js +7 -7
- package/src/variable.js +0 -10
- package/src/verifier/metaLevel.js +3 -2
- package/src/verifier/topLevel.js +6 -4
- package/src/verify/axiom.js +1 -2
- package/src/verify/conjecture.js +2 -3
- package/src/verify/consequent.js +1 -1
- package/src/verify/declaration/combinator.js +0 -20
- package/src/verify/declaration/metavariable.js +8 -12
- package/src/verify/files.js +3 -3
- package/src/verify/frame.js +11 -11
- package/src/verify/lemma.js +2 -3
- package/src/verify/metaLemma.js +2 -3
- package/src/verify/metatheorem.js +2 -3
- package/src/verify/proofStep.js +0 -41
- package/src/verify/theorem.js +2 -3
- package/lib/tokens/combinatorStatement/bracketed.js +0 -17
- package/lib/unify/premiseWithProofStep.js +0 -41
- package/lib/unify/premisesWithProofSteps.js +0 -31
- package/lib/unify/qualifiedStatement.js +0 -136
- package/lib/unify/statementWithBracketedCombinator.js +0 -30
- package/lib/unify/statementWithCombinator.js +0 -29
- package/lib/unify/statementWithCombinators.js +0 -31
- package/lib/unify/statementWithMetaType.js +0 -24
- package/lib/verify/conclusion.js +0 -39
- package/lib/verify/derivation.js +0 -31
- package/lib/verify/label.js +0 -37
- package/lib/verify/labels.js +0 -28
- package/lib/verify/premise.js +0 -45
- package/lib/verify/premises.js +0 -28
- package/lib/verify/proof.js +0 -34
- package/lib/verify/rule.js +0 -56
- package/lib/verify/statement/qualified.js +0 -41
- package/lib/verify/statement/unqualified.js +0 -45
- package/lib/verify/statement.js +0 -219
- package/lib/verify/statementAsCombinator.js +0 -33
- package/lib/verify/statementGivenMetaType.js +0 -52
- package/lib/verify/subproof.js +0 -34
- package/lib/verify/supposition.js +0 -45
- package/lib/verify/suppositions.js +0 -28
- package/src/tokens/combinatorStatement/bracketed.js +0 -10
- package/src/unify/premiseWithProofStep.js +0 -54
- package/src/unify/premisesWithProofSteps.js +0 -23
- package/src/unify/qualifiedStatement.js +0 -208
- package/src/unify/statementWithBracketedCombinator.js +0 -22
- package/src/unify/statementWithCombinator.js +0 -22
- package/src/unify/statementWithCombinators.js +0 -23
- package/src/unify/statementWithMetaType.js +0 -14
- package/src/verify/conclusion.js +0 -40
- package/src/verify/derivation.js +0 -23
- package/src/verify/label.js +0 -34
- package/src/verify/labels.js +0 -17
- package/src/verify/premise.js +0 -49
- package/src/verify/premises.js +0 -17
- package/src/verify/proof.js +0 -31
- package/src/verify/rule.js +0 -71
- package/src/verify/statement/qualified.js +0 -40
- package/src/verify/statement/unqualified.js +0 -49
- package/src/verify/statement.js +0 -312
- package/src/verify/statementAsCombinator.js +0 -27
- package/src/verify/statementGivenMetaType.js +0 -52
- package/src/verify/subproof.js +0 -32
- package/src/verify/supposition.js +0 -49
- package/src/verify/suppositions.js +0 -17
package/src/utilities/node.js
CHANGED
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
import { parsersUtilities } from "occam-custom-grammars";
|
|
4
4
|
|
|
5
|
+
import { nodeQuery } from "../utilities/query";
|
|
5
6
|
import { combinedCustomGrammarFromNothing } from "./customGrammar";
|
|
6
|
-
import { TERM_RULE_NAME,
|
|
7
|
-
import { termTokensFromTermString,
|
|
7
|
+
import { TERM_RULE_NAME, UNQUALIFIED_STATEMENT_RULE_NAME } from "../ruleNames";
|
|
8
|
+
import { termTokensFromTermString, unqualifiedStatementTokensFromUnqualifiedStatementString } from "../utilities/tokens";
|
|
8
9
|
|
|
9
|
-
const {
|
|
10
|
+
const { nominalParserFromCombinedCustomGrammar } = parsersUtilities;
|
|
10
11
|
|
|
11
12
|
const combinedCustomGrammar = combinedCustomGrammarFromNothing(),
|
|
12
|
-
|
|
13
|
+
nominalParser = nominalParserFromCombinedCustomGrammar(combinedCustomGrammar);
|
|
14
|
+
|
|
15
|
+
const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement");
|
|
13
16
|
|
|
14
17
|
export function termNodeFromTermString(termString, lexer, parser) {
|
|
15
18
|
const termTokens = termTokensFromTermString(termString, lexer),
|
|
@@ -19,8 +22,11 @@ export function termNodeFromTermString(termString, lexer, parser) {
|
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
export function statementNodeFromStatementString(statementString, lexer, parser) {
|
|
22
|
-
const
|
|
23
|
-
|
|
25
|
+
const unqualifiedStatementString = `${statementString}
|
|
26
|
+
`,
|
|
27
|
+
unqualifiedStatementTokens = unqualifiedStatementTokensFromUnqualifiedStatementString(unqualifiedStatementString, lexer),
|
|
28
|
+
unqualifiedStatementNode = unqualifiedStatementNodeFromUnqualifiedStatementTokens(unqualifiedStatementTokens, parser),
|
|
29
|
+
statementNode = statementNodeQuery(unqualifiedStatementNode);
|
|
24
30
|
|
|
25
31
|
return statementNode;
|
|
26
32
|
}
|
|
@@ -33,15 +39,15 @@ export function termNodeFromTermTokens(termTokens, parser) {
|
|
|
33
39
|
return termNode;
|
|
34
40
|
}
|
|
35
41
|
|
|
36
|
-
export function
|
|
37
|
-
const tokens =
|
|
38
|
-
ruleName =
|
|
39
|
-
|
|
42
|
+
export function unqualifiedStatementNodeFromUnqualifiedStatementTokens(unqualifiedStatementTokens, parser) {
|
|
43
|
+
const tokens = unqualifiedStatementTokens, ///
|
|
44
|
+
ruleName = UNQUALIFIED_STATEMENT_RULE_NAME,
|
|
45
|
+
unqualifiedStatementNode = nodeFromTokensRuleNameAndParser(tokens, ruleName, parser);
|
|
40
46
|
|
|
41
|
-
return
|
|
47
|
+
return unqualifiedStatementNode;
|
|
42
48
|
}
|
|
43
49
|
|
|
44
|
-
function nodeFromTokensRuleNameAndParser(tokens, ruleName, parser =
|
|
50
|
+
function nodeFromTokensRuleNameAndParser(tokens, ruleName, parser = nominalParser) {
|
|
45
51
|
const ruleMap = parser.getRuleMap(),
|
|
46
52
|
rule = ruleMap[ruleName],
|
|
47
53
|
node = parser.parse(tokens, rule);
|
|
@@ -9,9 +9,8 @@ export function createReleaseContext(dependency, dependentNames, context, callba
|
|
|
9
9
|
releaseContext = releaseContextMap[releaseName] || null;
|
|
10
10
|
|
|
11
11
|
if (releaseContext !== null) {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
const error = null;
|
|
12
|
+
const error = null,
|
|
13
|
+
releaseMatchesDependency = checkReleaseMatchesDependency(releaseContext, dependency, dependentNames, context);
|
|
15
14
|
|
|
16
15
|
let success;
|
|
17
16
|
|
|
@@ -105,16 +104,14 @@ export function initialiseReleaseContext(dependency, context) {
|
|
|
105
104
|
const dependencyReleaseContextsInitialised = initialiseDependencyReleaseContexts(dependency, releaseContext, context);
|
|
106
105
|
|
|
107
106
|
if (dependencyReleaseContextsInitialised) {
|
|
108
|
-
const { log
|
|
107
|
+
const { log } = context,
|
|
109
108
|
releaseContexts = retrieveReleaseContexts(releaseContext, releaseContextMap);
|
|
110
109
|
|
|
111
110
|
log.debug(`Initialising the '${dependencyName}' context...`);
|
|
112
111
|
|
|
113
|
-
|
|
112
|
+
releaseContext.initialise(releaseContexts);
|
|
114
113
|
|
|
115
|
-
|
|
116
|
-
log.info(`...initialised the '${dependencyName}' context.`) :
|
|
117
|
-
log.warning(`...unable to initialise the '${dependencyName}' context.`);
|
|
114
|
+
log.info(`...initialised the '${dependencyName}' context.`);
|
|
118
115
|
}
|
|
119
116
|
}
|
|
120
117
|
}
|
package/src/utilities/string.js
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import { COMMA, EMPTY_STRING } from "../constants";
|
|
4
4
|
|
|
5
|
+
export function trim(string) {
|
|
6
|
+
string = string.replace(/\s+$/, EMPTY_STRING); ///
|
|
7
|
+
|
|
8
|
+
return string;
|
|
9
|
+
}
|
|
10
|
+
|
|
5
11
|
export function nodeAsString(node, tokens) {
|
|
6
12
|
let string;
|
|
7
13
|
|
|
@@ -17,8 +23,6 @@ export function nodeAsString(node, tokens) {
|
|
|
17
23
|
string = nonTerminalNodeAsString(nonTerminalNode, tokens);
|
|
18
24
|
}
|
|
19
25
|
|
|
20
|
-
string = string.replace(/\s+$/, EMPTY_STRING);
|
|
21
|
-
|
|
22
26
|
return string;
|
|
23
27
|
}
|
|
24
28
|
|
|
@@ -6,8 +6,8 @@ import { nodeAsString, nodesAsString } from "./string";
|
|
|
6
6
|
const subproofSuppositionStatementNodesQuery = nodesQuery("/subproof/supposition/unqualifiedStatement/statement!"),
|
|
7
7
|
subproofLastProofStepStatementNodeQuery = nodeQuery("/subproof/subDerivation/lastProofStep/unqualifiedStatement|qualifiedStatement/statement!");
|
|
8
8
|
|
|
9
|
-
export function
|
|
10
|
-
const tokens =
|
|
9
|
+
export function subproofStringFromSubproofNode(subproofNode, fileContext) {
|
|
10
|
+
const tokens = fileContext.getTokens(),
|
|
11
11
|
subproofSuppositionStatementNodes = subproofSuppositionStatementNodesQuery(subproofNode),
|
|
12
12
|
subproofLastProofStepStatementNode = subproofLastProofStepStatementNodeQuery(subproofNode),
|
|
13
13
|
subproofSuppositionStatementsString = nodesAsString(subproofSuppositionStatementNodes, tokens),
|
package/src/utilities/tokens.js
CHANGED
|
@@ -4,10 +4,10 @@ import { lexersUtilities } from "occam-custom-grammars";
|
|
|
4
4
|
|
|
5
5
|
import { combinedCustomGrammarFromNothing } from "./customGrammar";
|
|
6
6
|
|
|
7
|
-
const {
|
|
7
|
+
const { nominalLexerFromCombinedCustomGrammar } = lexersUtilities;
|
|
8
8
|
|
|
9
9
|
const combinedCustomGrammar = combinedCustomGrammarFromNothing(),
|
|
10
|
-
|
|
10
|
+
nominalLexer = nominalLexerFromCombinedCustomGrammar(combinedCustomGrammar);
|
|
11
11
|
|
|
12
12
|
export function termTokensFromTermString(termString, lexer) {
|
|
13
13
|
const content = termString, ///
|
|
@@ -16,14 +16,14 @@ export function termTokensFromTermString(termString, lexer) {
|
|
|
16
16
|
return termTokens;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export function
|
|
20
|
-
const content =
|
|
21
|
-
|
|
19
|
+
export function unqualifiedStatementTokensFromUnqualifiedStatementString(unqualifiedStatementString, lexer) {
|
|
20
|
+
const content = unqualifiedStatementString, ///
|
|
21
|
+
unqualifiedStatementTokens = tokensFromContentAndLexer(content, lexer);
|
|
22
22
|
|
|
23
|
-
return
|
|
23
|
+
return unqualifiedStatementTokens;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
function tokensFromContentAndLexer(content, lexer =
|
|
26
|
+
function tokensFromContentAndLexer(content, lexer = nominalLexer) {
|
|
27
27
|
const tokens = lexer.tokenise(content);
|
|
28
28
|
|
|
29
29
|
return tokens;
|
package/src/variable.js
CHANGED
|
@@ -46,16 +46,6 @@ export default class Variable {
|
|
|
46
46
|
return nodeAndTypeMatch;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
asString(tokens) {
|
|
50
|
-
const typeName = this.type.getName();
|
|
51
|
-
|
|
52
|
-
let string = nodeAsString(this.node, tokens);
|
|
53
|
-
|
|
54
|
-
string = `${string}:${typeName}`; ///
|
|
55
|
-
|
|
56
|
-
return string;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
49
|
static fromVariableNodeAndType(variableNode, type) {
|
|
60
50
|
const node = variableNode, ///
|
|
61
51
|
variable = new Variable(node, type);
|
|
@@ -25,8 +25,9 @@ class MetaLevelVerifier extends Verifier {
|
|
|
25
25
|
{
|
|
26
26
|
nodeQuery: statementNodeQuery,
|
|
27
27
|
verify: (statementNode, assignments, stated, localContext) => {
|
|
28
|
-
const {
|
|
29
|
-
|
|
28
|
+
const { Statement } = shim,
|
|
29
|
+
statement = Statement.fromStatementNode(statementNode, localContext),
|
|
30
|
+
statementVerified = statement.verify(assignments, stated, localContext);
|
|
30
31
|
|
|
31
32
|
return statementVerified;
|
|
32
33
|
}
|
package/src/verifier/topLevel.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import Rule from "../rule";
|
|
3
4
|
import Verifier from "../verifier";
|
|
4
5
|
import verifyError from "../verify/error";
|
|
5
|
-
import verifyRule from "../verify/rule";
|
|
6
6
|
import verifyAxiom from "../verify/axiom";
|
|
7
7
|
import verifyLemma from "../verify/lemma";
|
|
8
8
|
import verifyTheorem from "../verify/theorem";
|
|
9
9
|
import verifyMetaLemma from "../verify/metaLemma";
|
|
10
10
|
import verifyConjecture from "../verify/conjecture";
|
|
11
11
|
import verifyMetatheorem from "../verify/metatheorem";
|
|
12
|
+
import CombinatorDeclaration from "../declaration/combinator";
|
|
12
13
|
import verifyTypeDeclaration from "../verify/declaration/type";
|
|
13
14
|
import verifyVariableDeclaration from "../verify/declaration/variable";
|
|
14
|
-
import verifyCombinatorDeclaration from "../verify/declaration/combinator";
|
|
15
15
|
import verifyConstructorDeclaration from "../verify/declaration/constructor";
|
|
16
16
|
import verifyMetavariableDeclaration from "../verify/declaration/metavariable";
|
|
17
17
|
|
|
@@ -55,7 +55,8 @@ class TopLevelVerifier extends Verifier {
|
|
|
55
55
|
{
|
|
56
56
|
nodeQuery: ruleNodeQuery,
|
|
57
57
|
verify: (ruleNode, fileContext) => {
|
|
58
|
-
const
|
|
58
|
+
const rule = Rule.fromRuleNode(ruleNode, fileContext),
|
|
59
|
+
ruleVerified = rule.verify(fileContext);
|
|
59
60
|
|
|
60
61
|
return ruleVerified;
|
|
61
62
|
}
|
|
@@ -127,7 +128,8 @@ class TopLevelVerifier extends Verifier {
|
|
|
127
128
|
{
|
|
128
129
|
nodeQuery: combinatorDeclarationNodeQuery,
|
|
129
130
|
verify: (combinatorDeclarationNode, fileContext) => {
|
|
130
|
-
const
|
|
131
|
+
const combinatorDeclaration = CombinatorDeclaration.fromCombinatorDeclarationNode(combinatorDeclarationNode, fileContext),
|
|
132
|
+
combinatorDeclarationVerified = combinatorDeclaration.verify(fileContext);
|
|
131
133
|
|
|
132
134
|
return combinatorDeclarationVerified;
|
|
133
135
|
}
|
package/src/verify/axiom.js
CHANGED
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import Axiom from "../axiom";
|
|
4
4
|
import LocalContext from "../context/local";
|
|
5
|
-
import verifyLabels from "../verify/labels";
|
|
6
5
|
import Substitutions from "../substitutions";
|
|
7
6
|
import verifyConsequent from "../verify/consequent";
|
|
8
|
-
import verifySuppositions from "../verify/suppositions";
|
|
7
|
+
// import verifySuppositions from "../verify/suppositions";
|
|
9
8
|
|
|
10
9
|
import { first } from "../utilities/array";
|
|
11
10
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
package/src/verify/conjecture.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Conjecture from "../conjecture";
|
|
4
|
-
import verifyProof from "../verify/proof";
|
|
5
|
-
import verifyLabels from "../verify/labels";
|
|
4
|
+
// import verifyProof from "../verify/proof";
|
|
6
5
|
import LocalContext from "../context/local";
|
|
7
6
|
import Substitutions from "../substitutions";
|
|
8
7
|
import verifyConsequent from "../verify/consequent";
|
|
9
|
-
import verifySuppositions from "../verify/suppositions";
|
|
8
|
+
// import verifySuppositions from "../verify/suppositions";
|
|
10
9
|
|
|
11
10
|
import { first } from "../utilities/array";
|
|
12
11
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
package/src/verify/consequent.js
CHANGED
|
@@ -2,25 +2,5 @@
|
|
|
2
2
|
|
|
3
3
|
import verifyStatementAsCombinator from "../../verify/statementAsCombinator";
|
|
4
4
|
|
|
5
|
-
import { nodeQuery } from "../../utilities/query";
|
|
6
|
-
|
|
7
|
-
const statementNodeQuery = nodeQuery("/combinatorDeclaration/statement");
|
|
8
|
-
|
|
9
5
|
export default function verifyCombinatorDeclaration(combinatorDeclarationNode, fileContext) {
|
|
10
|
-
let combinatorDeclarationVerified;
|
|
11
|
-
|
|
12
|
-
const statementNode = statementNodeQuery(combinatorDeclarationNode),
|
|
13
|
-
statementString = fileContext.nodeAsString(statementNode);
|
|
14
|
-
|
|
15
|
-
fileContext.trace(`Verifying the '${statementString}' combinator declaration...`, combinatorDeclarationNode);
|
|
16
|
-
|
|
17
|
-
const statementVerifiedAsCombinator = verifyStatementAsCombinator(statementNode, fileContext);
|
|
18
|
-
|
|
19
|
-
combinatorDeclarationVerified = statementVerifiedAsCombinator; ///
|
|
20
|
-
|
|
21
|
-
if (combinatorDeclarationVerified) {
|
|
22
|
-
fileContext.debug(`...verified the '${statementString}' combinator declaration.`, combinatorDeclarationNode);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return combinatorDeclarationVerified;
|
|
26
6
|
}
|
|
@@ -5,7 +5,6 @@ import MetavariableAssignment from "../../assignment/metavariable";
|
|
|
5
5
|
|
|
6
6
|
import { first } from "../../utilities/array";
|
|
7
7
|
import { nodeQuery } from "../../utilities/query";
|
|
8
|
-
import { metavariableNameFromMetavariableNode } from "../../utilities/name";
|
|
9
8
|
|
|
10
9
|
const termNodeQuery = nodeQuery("/argument/term"),
|
|
11
10
|
typeNodeQuery = nodeQuery("/argument/type"),
|
|
@@ -21,14 +20,14 @@ export default function verifyMetavariableDeclaration(metavariableDeclarationNod
|
|
|
21
20
|
metaTypeString = fileContext.nodeAsString(metaTypeNode),
|
|
22
21
|
metavariableString = fileContext.nodeAsString(metavariableNode);
|
|
23
22
|
|
|
24
|
-
fileContext.trace(`Verifying the '${metavariableString}:${metaTypeString}' metavariable declaration
|
|
23
|
+
fileContext.trace(`Verifying the '${metavariableString}:${metaTypeString}' metavariable declaration...`);
|
|
25
24
|
|
|
26
25
|
const metavariableVVerified = verifyMetavariable(metavariableNode, metaTypeNode, fileContext);
|
|
27
26
|
|
|
28
27
|
metavariableDeclarationVerified = metavariableVVerified; ///
|
|
29
28
|
|
|
30
29
|
if (metavariableDeclarationVerified) {
|
|
31
|
-
fileContext.debug(`...verified the '${metavariableString}:${metaTypeString}' metavariable declaration
|
|
30
|
+
fileContext.debug(`...verified the '${metavariableString}:${metaTypeString}' metavariable declaration.`);
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
return metavariableDeclarationVerified;
|
|
@@ -39,12 +38,12 @@ function verifyMetavariable(metavariableNode, metaTypeNode, fileContext) {
|
|
|
39
38
|
|
|
40
39
|
const metavariableString = fileContext.nodeAsString(metavariableNode);
|
|
41
40
|
|
|
42
|
-
fileContext.trace(`Verifying the '${metavariableString}' metavariable
|
|
41
|
+
fileContext.trace(`Verifying the '${metavariableString}' metavariable...`);
|
|
43
42
|
|
|
44
43
|
const metavariablePresent = fileContext.isMetavariablePresentByMetavariableNode(metavariableNode);
|
|
45
44
|
|
|
46
45
|
if (metavariablePresent) {
|
|
47
|
-
fileContext.debug(`The metavariable '${metavariableString}' is already present
|
|
46
|
+
fileContext.debug(`The metavariable '${metavariableString}' is already present.`);
|
|
48
47
|
} else {
|
|
49
48
|
const termTypes = [],
|
|
50
49
|
metaTypes = [],
|
|
@@ -70,10 +69,7 @@ function verifyMetavariable(metavariableNode, metaTypeNode, fileContext) {
|
|
|
70
69
|
termType = firstTermType; ///
|
|
71
70
|
}
|
|
72
71
|
|
|
73
|
-
const
|
|
74
|
-
node = metavariableNode, ///
|
|
75
|
-
name = metavariableName, ///
|
|
76
|
-
metavariable = Metavariable.fromNodeNameTermTypeAndMetaType(node, name, termType, metaType),
|
|
72
|
+
const metavariable = Metavariable.fromMetavariableNodeNameTermTypeAndMetaType(metavariableNode, termType, metaType, fileContext),
|
|
77
73
|
metavariableAssignment = MetavariableAssignment.fromMetavariable(metavariable),
|
|
78
74
|
metavariableAssigned = metavariableAssignment.assign(fileContext);
|
|
79
75
|
|
|
@@ -84,7 +80,7 @@ function verifyMetavariable(metavariableNode, metaTypeNode, fileContext) {
|
|
|
84
80
|
}
|
|
85
81
|
|
|
86
82
|
if (metavariableVerified) {
|
|
87
|
-
fileContext.debug(`...verified the '${metavariableString}' metavariable
|
|
83
|
+
fileContext.debug(`...verified the '${metavariableString}' metavariable.`);
|
|
88
84
|
}
|
|
89
85
|
|
|
90
86
|
return metavariableVerified;
|
|
@@ -103,7 +99,7 @@ function verifyArgument(argumentNode, termTypes, fileContext) {
|
|
|
103
99
|
} else {
|
|
104
100
|
const termString = fileContext.nodeAsString(termNode);
|
|
105
101
|
|
|
106
|
-
fileContext.debug(`The '${termString}' term was found when a type should have been present
|
|
102
|
+
fileContext.debug(`The '${termString}' term was found when a type should have been present.`);
|
|
107
103
|
}
|
|
108
104
|
const typeNode = typeNodeQuery(argumentNode);
|
|
109
105
|
|
|
@@ -119,7 +115,7 @@ function verifyArgument(argumentNode, termTypes, fileContext) {
|
|
|
119
115
|
} else {
|
|
120
116
|
const typeString = fileContext.nodeAsString(typeNode);
|
|
121
117
|
|
|
122
|
-
fileContext.debug(`The '${typeString}' type is not present
|
|
118
|
+
fileContext.debug(`The '${typeString}' type is not present.`);
|
|
123
119
|
}
|
|
124
120
|
}
|
|
125
121
|
}
|
package/src/verify/files.js
CHANGED
|
@@ -6,7 +6,7 @@ import { filePathUtilities } from "occam-entities";
|
|
|
6
6
|
|
|
7
7
|
import { filter, leftDifference } from "../utilities/array";
|
|
8
8
|
|
|
9
|
-
const {
|
|
9
|
+
const { isFilePathNominalFilePath } = filePathUtilities;
|
|
10
10
|
|
|
11
11
|
export default function verifyFiles(releaseContext) {
|
|
12
12
|
let filesVerified = false;
|
|
@@ -14,9 +14,9 @@ export default function verifyFiles(releaseContext) {
|
|
|
14
14
|
const filePaths = releaseContext.getFilePaths();
|
|
15
15
|
|
|
16
16
|
filter(filePaths, (filePath) => {
|
|
17
|
-
const
|
|
17
|
+
const filePathNominalFilePath = isFilePathNominalFilePath(filePath);
|
|
18
18
|
|
|
19
|
-
if (
|
|
19
|
+
if (filePathNominalFilePath) {
|
|
20
20
|
return true;
|
|
21
21
|
}
|
|
22
22
|
})
|
package/src/verify/frame.js
CHANGED
|
@@ -23,7 +23,7 @@ function verifyFrame(frameNode, frames, stated, localContext) {
|
|
|
23
23
|
|
|
24
24
|
const frameString = localContext.nodeAsString(frameNode);
|
|
25
25
|
|
|
26
|
-
localContext.trace(`Verifying the '${frameString}' frame
|
|
26
|
+
localContext.trace(`Verifying the '${frameString}' frame...`);
|
|
27
27
|
|
|
28
28
|
frameVerified = verifyFrameFunctions.some((verifyFrameFunction) => {
|
|
29
29
|
const frameVerified = verifyFrameFunction(frameNode, frames, stated, localContext);
|
|
@@ -34,7 +34,7 @@ function verifyFrame(frameNode, frames, stated, localContext) {
|
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
if (frameVerified) {
|
|
37
|
-
localContext.debug(`...verified the '${frameString}' frame
|
|
37
|
+
localContext.debug(`...verified the '${frameString}' frame.`);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
return frameVerified;
|
|
@@ -52,7 +52,7 @@ function verifyDerivedFrame(frameNode, frames, stated, localContext) {
|
|
|
52
52
|
if (!stated) {
|
|
53
53
|
const frameString = localContext.nodeAsString(frameNode);
|
|
54
54
|
|
|
55
|
-
localContext.trace(`Verifying the '${frameString}' derived frame
|
|
55
|
+
localContext.trace(`Verifying the '${frameString}' derived frame...`);
|
|
56
56
|
|
|
57
57
|
const declarations = [],
|
|
58
58
|
declarationNodes = declarationNodesQuery(frameNode),
|
|
@@ -84,7 +84,7 @@ function verifyDerivedFrame(frameNode, frames, stated, localContext) {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
if (derivedFrameVerified) {
|
|
87
|
-
localContext.debug(`...verified the '${frameString}' derived frame
|
|
87
|
+
localContext.debug(`...verified the '${frameString}' derived frame.`);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -97,7 +97,7 @@ function verifyStatedFrame(frameNode, frames, stated, localContext) {
|
|
|
97
97
|
if (stated) {
|
|
98
98
|
const frameString = localContext.nodeAsString(frameNode);
|
|
99
99
|
|
|
100
|
-
localContext.trace(`Verifying the '${frameString}' stated frame
|
|
100
|
+
localContext.trace(`Verifying the '${frameString}' stated frame...`);
|
|
101
101
|
|
|
102
102
|
const declarationNodes = declarationNodesQuery(frameNode),
|
|
103
103
|
declarationNodesLength = declarationNodes.length;
|
|
@@ -117,14 +117,14 @@ function verifyStatedFrame(frameNode, frames, stated, localContext) {
|
|
|
117
117
|
statedFrameVerified = true;
|
|
118
118
|
}
|
|
119
119
|
} else {
|
|
120
|
-
localContext.trace(`The '${frameString}' stated frame cannot have more than one metavariable
|
|
120
|
+
localContext.trace(`The '${frameString}' stated frame cannot have more than one metavariable.`);
|
|
121
121
|
}
|
|
122
122
|
} else {
|
|
123
|
-
localContext.trace(`The '${frameString}' stated frame cannot have declarations
|
|
123
|
+
localContext.trace(`The '${frameString}' stated frame cannot have declarations.`);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
if (statedFrameVerified) {
|
|
127
|
-
localContext.debug(`...verified the '${frameString}' stated frame
|
|
127
|
+
localContext.debug(`...verified the '${frameString}' stated frame.`);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
|
|
@@ -136,7 +136,7 @@ function verifyMetavariable(metavariableNode, declarations, localContext) {
|
|
|
136
136
|
|
|
137
137
|
const metavariableString = localContext.nodeAsString(metavariableNode);
|
|
138
138
|
|
|
139
|
-
localContext.trace(`Verifying the '${metavariableString}' metavariable
|
|
139
|
+
localContext.trace(`Verifying the '${metavariableString}' metavariable...`);
|
|
140
140
|
|
|
141
141
|
const metaType = frameMetaType, ///
|
|
142
142
|
metavariableVerifiedGivenMetaType = verifyMetavariableGivenMetaType(metavariableNode, metaType, localContext);
|
|
@@ -152,12 +152,12 @@ function verifyMetavariable(metavariableNode, declarations, localContext) {
|
|
|
152
152
|
|
|
153
153
|
metavariableVerified = true;
|
|
154
154
|
} else {
|
|
155
|
-
localContext.trace(`There is no judgement for the '${metavariableString}' metavariable
|
|
155
|
+
localContext.trace(`There is no judgement for the '${metavariableString}' metavariable.`);
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
if (metavariableVerified) {
|
|
160
|
-
localContext.debug(`...verified the '${metavariableString}' metavariable
|
|
160
|
+
localContext.debug(`...verified the '${metavariableString}' metavariable.`);
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
return metavariableVerified;
|
package/src/verify/lemma.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Lemma from "../lemma";
|
|
4
|
-
import verifyProof from "../verify/proof";
|
|
5
|
-
import verifyLabels from "../verify/labels";
|
|
4
|
+
// import verifyProof from "../verify/proof";
|
|
6
5
|
import LocalContext from "../context/local";
|
|
7
6
|
import Substitutions from "../substitutions";
|
|
8
7
|
import verifyConsequent from "../verify/consequent";
|
|
9
|
-
import verifySuppositions from "../verify/suppositions";
|
|
8
|
+
// import verifySuppositions from "../verify/suppositions";
|
|
10
9
|
|
|
11
10
|
import { first } from "../utilities/array";
|
|
12
11
|
import { EMPTY_STRING } from "../constants";
|
package/src/verify/metaLemma.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import MetaLemma from "../metaLemma";
|
|
4
|
-
import verifyProof from "../verify/proof";
|
|
4
|
+
// import verifyProof from "../verify/proof";
|
|
5
5
|
import LocalContext from "../context/local";
|
|
6
|
-
import verifyLabels from "../verify/labels";
|
|
7
6
|
import Substitutions from "../substitutions";
|
|
8
7
|
import verifyConsequent from "../verify/consequent";
|
|
9
|
-
import verifySuppositions from "../verify/suppositions";
|
|
8
|
+
// import verifySuppositions from "../verify/suppositions";
|
|
10
9
|
|
|
11
10
|
import { first } from "../utilities/array";
|
|
12
11
|
import { EMPTY_STRING } from "../constants";
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import verifyProof from "../verify/proof";
|
|
3
|
+
// import verifyProof from "../verify/proof";
|
|
4
4
|
import Metatheorem from "../metatheorem";
|
|
5
|
-
import verifyLabels from "../verify/labels";
|
|
6
5
|
import LocalContext from "../context/local";
|
|
7
6
|
import Substitutions from "../substitutions";
|
|
8
7
|
import verifyConsequent from "../verify/consequent";
|
|
9
|
-
import verifySuppositions from "../verify/suppositions";
|
|
8
|
+
// import verifySuppositions from "../verify/suppositions";
|
|
10
9
|
|
|
11
10
|
import { first } from "../utilities/array";
|
|
12
11
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
package/src/verify/proofStep.js
CHANGED
|
@@ -14,47 +14,6 @@ const subproofNodeQuery = nodeQuery("/proofStep|lastProofStep/subproof!"),
|
|
|
14
14
|
unqualifiedStatementNodeQuery = nodeQuery("/proofStep|lastProofStep/unqualifiedStatement!");
|
|
15
15
|
|
|
16
16
|
export default function verifyProofStep(proofStepNode, substitutions, localContext) {
|
|
17
|
-
let proofStepVerified = false;
|
|
18
|
-
|
|
19
|
-
const subproofNode = subproofNodeQuery(proofStepNode),
|
|
20
|
-
qualifiedStatementNode = qualifiedStatementNodeQuery(proofStepNode),
|
|
21
|
-
unqualifiedStatementNode = unqualifiedStatementNodeQuery(proofStepNode);
|
|
22
|
-
|
|
23
|
-
let proofStep = null;
|
|
24
|
-
|
|
25
|
-
if (false) {
|
|
26
|
-
///
|
|
27
|
-
} else if (subproofNode !== null) {
|
|
28
|
-
const subproofVerified = verifySubproof(subproofNode, substitutions, localContext);
|
|
29
|
-
|
|
30
|
-
if (subproofVerified) {
|
|
31
|
-
proofStep = ProofStep.fromSubproofNode(subproofNode);
|
|
32
|
-
}
|
|
33
|
-
} else if (qualifiedStatementNode !== null) {
|
|
34
|
-
const qualifiedStatementVerified = verifyQualifiedStatement(qualifiedStatementNode, substitutions, localContext);
|
|
35
|
-
|
|
36
|
-
if (qualifiedStatementVerified) {
|
|
37
|
-
const statementNode = statementNodeQuery(qualifiedStatementNode);
|
|
38
|
-
|
|
39
|
-
proofStep = ProofStep.fromStatementNode(statementNode);
|
|
40
|
-
}
|
|
41
|
-
} else if (unqualifiedStatementNode !== null) {
|
|
42
|
-
const unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, localContext);
|
|
43
|
-
|
|
44
|
-
if (unqualifiedStatementVerified) {
|
|
45
|
-
const statementNode = statementNodeQuery(unqualifiedStatementNode);
|
|
46
|
-
|
|
47
|
-
proofStep = ProofStep.fromStatementNode(statementNode);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (proofStep !== null) {
|
|
52
|
-
localContext.addProofStep(proofStep);
|
|
53
|
-
|
|
54
|
-
proofStepVerified = true;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return proofStepVerified;
|
|
58
17
|
}
|
|
59
18
|
|
|
60
19
|
Object.assign(shim, {
|
package/src/verify/theorem.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Theorem from "../theorem";
|
|
4
|
-
import verifyProof from "../verify/proof";
|
|
5
|
-
import verifyLabels from "../verify/labels";
|
|
4
|
+
// import verifyProof from "../verify/proof";
|
|
6
5
|
import LocalContext from "../context/local";
|
|
7
6
|
import Substitutions from "../substitutions";
|
|
8
7
|
import verifyConsequent from "../verify/consequent";
|
|
9
|
-
import verifySuppositions from "../verify/suppositions";
|
|
8
|
+
// import verifySuppositions from "../verify/suppositions";
|
|
10
9
|
|
|
11
10
|
import { first } from "../utilities/array";
|
|
12
11
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return _default;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _metaTypeNames = require("../../metaTypeNames");
|
|
12
|
-
var _tokens = require("../../utilities/tokens");
|
|
13
|
-
var bracketedCombinatorStatementString = "(".concat(_metaTypeNames.STATEMENT_META_TYPE_NAME, ")");
|
|
14
|
-
var bracketedCombinatorStatementTokens = (0, _tokens.statementTokensFromStatementString)(bracketedCombinatorStatementString);
|
|
15
|
-
var _default = bracketedCombinatorStatementTokens;
|
|
16
|
-
|
|
17
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy90b2tlbnMvY29tYmluYXRvclN0YXRlbWVudC9icmFja2V0ZWQuanMiXSwic291cmNlc0NvbnRlbnQiOlsiXCJ1c2Ugc3RyaWN0XCI7XG5cbmltcG9ydCB7IFNUQVRFTUVOVF9NRVRBX1RZUEVfTkFNRSB9IGZyb20gXCIuLi8uLi9tZXRhVHlwZU5hbWVzXCI7XG5pbXBvcnQgeyBzdGF0ZW1lbnRUb2tlbnNGcm9tU3RhdGVtZW50U3RyaW5nIH0gZnJvbSBcIi4uLy4uL3V0aWxpdGllcy90b2tlbnNcIjtcblxuY29uc3QgYnJhY2tldGVkQ29tYmluYXRvclN0YXRlbWVudFN0cmluZyA9IGAoJHtTVEFURU1FTlRfTUVUQV9UWVBFX05BTUV9KWA7XG5cbmNvbnN0IGJyYWNrZXRlZENvbWJpbmF0b3JTdGF0ZW1lbnRUb2tlbnMgPSBzdGF0ZW1lbnRUb2tlbnNGcm9tU3RhdGVtZW50U3RyaW5nKGJyYWNrZXRlZENvbWJpbmF0b3JTdGF0ZW1lbnRTdHJpbmcpXG5cbmV4cG9ydCBkZWZhdWx0IGJyYWNrZXRlZENvbWJpbmF0b3JTdGF0ZW1lbnRUb2tlbnM7XG4iXSwibmFtZXMiOlsiYnJhY2tldGVkQ29tYmluYXRvclN0YXRlbWVudFN0cmluZyIsIlNUQVRFTUVOVF9NRVRBX1RZUEVfTkFNRSIsImJyYWNrZXRlZENvbWJpbmF0b3JTdGF0ZW1lbnRUb2tlbnMiLCJzdGF0ZW1lbnRUb2tlbnNGcm9tU3RhdGVtZW50U3RyaW5nIl0sIm1hcHBpbmdzIjoiQUFBQTs7OzsrQkFTQTs7O2VBQUE7Ozs2QkFQeUM7c0JBQ1U7QUFFbkQsSUFBTUEscUNBQXFDLEFBQUMsSUFBNEIsT0FBekJDLHVDQUF3QixFQUFDO0FBRXhFLElBQU1DLHFDQUFxQ0MsSUFBQUEsMENBQWtDLEVBQUNIO0lBRTlFLFdBQWVFIn0=
|