occam-verify-cli 0.0.958 → 0.0.960
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 +16 -5
- package/bin/utilities/releaseContext.js +5 -8
- package/lib/axiom.js +1 -7
- package/lib/combinator.js +1 -19
- package/lib/conclusion.js +1 -19
- package/lib/conjecture.js +1 -7
- package/lib/consequent.js +1 -19
- package/lib/constructor.js +1 -28
- package/lib/context/file.js +38 -14
- package/lib/context/local.js +1 -14
- package/lib/context/release.js +82 -52
- package/lib/frame.js +3 -3
- package/lib/index.js +5 -5
- package/lib/label.js +1 -16
- package/lib/lemma.js +1 -7
- package/lib/metaLemma.js +1 -7
- package/lib/metaType.js +1 -10
- package/lib/metatheorem.js +1 -7
- package/lib/metavariable.js +9 -34
- package/lib/premise.js +1 -18
- package/lib/proofStep.js +15 -15
- package/lib/releaseContext/create.js +8 -9
- package/lib/releaseContext/initialise.js +67 -0
- package/lib/rule.js +5 -49
- package/lib/ruleNames.js +1 -9
- package/lib/substitution/statementForMetavariable.js +8 -16
- package/lib/substitution/termForVariable.js +6 -6
- package/lib/substitution.js +7 -7
- package/lib/substitutions.js +7 -33
- package/lib/supposition.js +1 -18
- package/lib/theorem.js +1 -7
- package/lib/topLevelAssertion.js +5 -50
- package/lib/type.js +2 -38
- package/lib/unifier/equality.js +7 -7
- package/lib/unifier/intrinsicLevel.js +4 -4
- package/lib/unifier/metaLevel.js +10 -10
- package/lib/unifier/statementWithCombinator.js +147 -0
- package/lib/unifier/{termAgainstConstructor.js → termWithConstructor.js} +17 -17
- package/lib/unify/conclusionWithStatement.js +34 -0
- package/lib/unify/consequentWithStatement.js +34 -0
- package/lib/unify/metavariableWithStatement.js +74 -0
- package/lib/unify/premiseWithProofStep.js +41 -0
- package/lib/unify/premisesWithProofSteps.js +31 -0
- package/lib/unify/statementAtainstStatement.js +6 -6
- package/lib/unify/statementWithMetaType.js +48 -0
- package/lib/unify/suppositionWithProffStep.js +41 -0
- package/lib/unify/suppositionsWithProofSteps.js +31 -0
- package/lib/unify/termWithTerm.js +21 -0
- package/lib/unify/termWithType.js +32 -0
- package/lib/unify/variableWithTerm.js +54 -0
- package/lib/utilities/node.js +3 -42
- package/lib/utilities/tokens.js +1 -15
- package/lib/variable.js +1 -26
- package/lib/verify/error.js +2 -2
- package/lib/verify/judgement.js +3 -3
- package/lib/verify/metavariable.js +4 -4
- package/lib/verify/statement/qualified.js +51 -51
- package/lib/verify/statement.js +18 -18
- package/lib/verify/statementAsCombinator.js +2 -2
- package/lib/verify/term.js +25 -25
- package/package.json +1 -1
- package/src/axiom.js +0 -2
- package/src/combinator.js +0 -26
- package/src/conclusion.js +0 -24
- package/src/conjecture.js +0 -2
- package/src/consequent.js +0 -24
- package/src/constructor.js +0 -43
- package/src/context/file.js +42 -17
- package/src/context/local.js +0 -22
- package/src/context/release.js +84 -45
- package/src/frame.js +2 -2
- package/src/index.js +1 -1
- package/src/label.js +0 -18
- package/src/lemma.js +0 -2
- package/src/metaLemma.js +0 -2
- package/src/metaType.js +0 -9
- package/src/metatheorem.js +0 -2
- package/src/metavariable.js +6 -44
- package/src/premise.js +0 -22
- package/src/proofStep.js +14 -14
- package/src/releaseContext/create.js +8 -16
- package/src/releaseContext/{verify.js → initialise.js} +32 -23
- package/src/rule.js +4 -69
- package/src/ruleNames.js +0 -2
- package/src/substitution/statementForMetavariable.js +7 -21
- package/src/substitution/termForVariable.js +4 -4
- package/src/substitution.js +5 -5
- package/src/substitutions.js +5 -32
- package/src/supposition.js +0 -22
- package/src/theorem.js +0 -2
- package/src/topLevelAssertion.js +4 -72
- package/src/type.js +0 -44
- package/src/unifier/equality.js +6 -6
- package/src/unifier/intrinsicLevel.js +3 -3
- package/src/unifier/metaLevel.js +9 -9
- package/src/unifier/{statementAgainstCombinator.js → statementWithCombinator.js} +12 -12
- package/src/unifier/{termAgainstConstructor.js → termWithConstructor.js} +9 -9
- package/src/unify/{conclusionAgainstStatement.js → conclusionWithStatement.js} +3 -3
- package/src/unify/{consequentAgainstStatement.js → consequentWithStatement.js} +3 -3
- package/src/unify/{metavariableAgainstStatement.js → metavariableWithStatement.js} +12 -12
- package/src/unify/{premiseAgainstProofStep.js → premiseWithProofStep.js} +5 -5
- package/src/unify/{premisesAgainstProofSteps.js → premisesWithProofSteps.js} +3 -3
- package/src/unify/statementAtainstStatement.js +4 -4
- package/src/unify/{statementAgainstMetaType.js → statementWithMetaType.js} +5 -5
- package/src/unify/{suppositionAgainstProofStep.js → suppositionWithProffStep.js} +5 -5
- package/src/unify/{suppositionsAgainstProofSteps.js → suppositionsWithProofSteps.js} +3 -3
- package/src/unify/{termAgainstTerm.js → termWithTerm.js} +4 -4
- package/src/unify/{termAgainstType.js → termWithType.js} +4 -4
- package/src/unify/{variableAgainstTerm.js → variableWithTerm.js} +5 -5
- package/src/utilities/node.js +2 -48
- package/src/utilities/tokens.js +0 -15
- package/src/variable.js +0 -36
- package/src/verify/error.js +1 -1
- package/src/verify/judgement.js +3 -3
- package/src/verify/metavariable.js +3 -3
- package/src/verify/statement/qualified.js +50 -50
- package/src/verify/statement.js +17 -17
- package/src/verify/statementAsCombinator.js +1 -1
- package/src/verify/term.js +24 -24
- package/lib/releaseContext/verify.js +0 -66
- package/lib/unifier/statementAgainstCombinator.js +0 -147
- package/lib/unify/conclusionAgainstStatement.js +0 -34
- package/lib/unify/consequentAgainstStatement.js +0 -34
- package/lib/unify/metavariableAgainstStatement.js +0 -74
- package/lib/unify/premiseAgainstProofStep.js +0 -41
- package/lib/unify/premisesAgainstProofSteps.js +0 -31
- package/lib/unify/statementAgainstMetaType.js +0 -48
- package/lib/unify/suppositionAgainstProofStep.js +0 -41
- package/lib/unify/suppositionsAgainstProofSteps.js +0 -31
- package/lib/unify/termAgainstTerm.js +0 -21
- package/lib/unify/termAgainstType.js +0 -32
- package/lib/unify/variableAgainstTerm.js +0 -54
package/src/utilities/tokens.js
CHANGED
|
@@ -9,13 +9,6 @@ const { florenceLexerFromCombinedCustomGrammar } = lexersUtilities;
|
|
|
9
9
|
const combinedCustomGrammar = combinedCustomGrammarFromNothing(),
|
|
10
10
|
florenceLexer = florenceLexerFromCombinedCustomGrammar(combinedCustomGrammar);
|
|
11
11
|
|
|
12
|
-
export function metavariableTokensFromMetavariableString(metavariableString, lexer) {
|
|
13
|
-
const metavariableContent = `${metavariableString}`,
|
|
14
|
-
metavariableTokens = tokensFromContentAndLexer(metavariableContent, lexer);
|
|
15
|
-
|
|
16
|
-
return metavariableTokens;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
12
|
export function constructorDeclarationTokensFromTermString(termString, lexer) {
|
|
20
13
|
const constructorDeclarationContent = `Constructor ${termString}
|
|
21
14
|
`,
|
|
@@ -24,14 +17,6 @@ export function constructorDeclarationTokensFromTermString(termString, lexer) {
|
|
|
24
17
|
return constructorDeclarationTokens;
|
|
25
18
|
}
|
|
26
19
|
|
|
27
|
-
export function variableDeclarationTokensFromVariableString(variableString, lexer) {
|
|
28
|
-
const variableDeclarationContent = `Variable ${variableString}
|
|
29
|
-
`,
|
|
30
|
-
variableDeclarationTokens = tokensFromContentAndLexer(variableDeclarationContent, lexer);
|
|
31
|
-
|
|
32
|
-
return variableDeclarationTokens;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
20
|
export function unqualifiedStatementTokensFromStatementString(statementString, lexer) {
|
|
36
21
|
const unqualifiedStatementContent = `${statementString}
|
|
37
22
|
`,
|
package/src/variable.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { nodeAsString } from "./utilities/string";
|
|
4
|
-
import { typeFromJSONAndFileContext } from "./type";
|
|
5
|
-
import { variableNodeFromVariableString } from "./utilities/node";
|
|
6
4
|
|
|
7
5
|
export default class Variable {
|
|
8
6
|
constructor(node, type) {
|
|
@@ -58,40 +56,6 @@ export default class Variable {
|
|
|
58
56
|
return string;
|
|
59
57
|
}
|
|
60
58
|
|
|
61
|
-
toJSON(tokens) {
|
|
62
|
-
const typeJSON = this.type.toJSON(tokens),
|
|
63
|
-
string = nodeAsString(this.node, tokens),
|
|
64
|
-
node = string, //
|
|
65
|
-
type = typeJSON, ///
|
|
66
|
-
json = {
|
|
67
|
-
node,
|
|
68
|
-
type
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return json;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
static fromJSONAndFileContext(json, fileContext) {
|
|
75
|
-
let { node } = json;
|
|
76
|
-
|
|
77
|
-
const lexer = fileContext.getLexer(),
|
|
78
|
-
parser = fileContext.getParser(),
|
|
79
|
-
variableString = node, ///
|
|
80
|
-
variableNode = variableNodeFromVariableString(variableString, lexer, parser);
|
|
81
|
-
|
|
82
|
-
node = variableNode; ///
|
|
83
|
-
|
|
84
|
-
let { type } = json;
|
|
85
|
-
|
|
86
|
-
json = type; ///
|
|
87
|
-
|
|
88
|
-
type = typeFromJSONAndFileContext(json, fileContext);
|
|
89
|
-
|
|
90
|
-
const variable = new Variable(node, type);
|
|
91
|
-
|
|
92
|
-
return variable;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
59
|
static fromVariableAndType(variable, type) {
|
|
96
60
|
const node = variable.getNode();
|
|
97
61
|
|
package/src/verify/error.js
CHANGED
|
@@ -5,7 +5,7 @@ export default function verifyError(errorNode, fileContext) {
|
|
|
5
5
|
|
|
6
6
|
const errorString = fileContext.nodeAsString(errorNode)
|
|
7
7
|
|
|
8
|
-
fileContext.debug(`The '${errorString}' cannot be verified.`, errorNode);
|
|
8
|
+
fileContext.debug(`The '${errorString}' error cannot be verified.`, errorNode);
|
|
9
9
|
|
|
10
10
|
return errorVerified;
|
|
11
11
|
}
|
package/src/verify/judgement.js
CHANGED
|
@@ -70,10 +70,10 @@ function verifyDerivedJudgement(judgementNode, assignments, derived, localContex
|
|
|
70
70
|
metaLemmaMetatheorem = (metaLemma || metatheorem); ///
|
|
71
71
|
|
|
72
72
|
if (metaLemmaMetatheorem !== null) {
|
|
73
|
-
const
|
|
74
|
-
|
|
73
|
+
const metaLemmaMetatheoremUnifiedWithDeclaration = declaration.unifyMetaLemmaOrMetaTheorem(metaLemmaMetatheorem),
|
|
74
|
+
metaLemmaMetatheoremUnifiedWithJudgement = judgement.unifyMetaLemmaOrMetaTheorem(metaLemmaMetatheorem);
|
|
75
75
|
|
|
76
|
-
derivedJudgementVerified = (
|
|
76
|
+
derivedJudgementVerified = (metaLemmaMetatheoremUnifiedWithDeclaration && metaLemmaMetatheoremUnifiedWithJudgement);
|
|
77
77
|
} else {
|
|
78
78
|
const metavariableString = localContext.nodeAsString(metavariableNode);
|
|
79
79
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { nodeQuery } from "../utilities/query";
|
|
4
|
+
import { unifyTermWithTermType } from "../metavariable";
|
|
4
5
|
import { nameFromMetavariableNode } from "../utilities/name";
|
|
5
|
-
import { unifyTermAgainstTermType } from "../metavariable";
|
|
6
6
|
|
|
7
7
|
const termNodeQuery = nodeQuery("/metavariable/argument/term"),
|
|
8
8
|
typeNodeQuery = nodeQuery("/metavariable/argument/type");
|
|
@@ -43,9 +43,9 @@ export default function verifyMetavariable(metavariableNode, localContext) {
|
|
|
43
43
|
|
|
44
44
|
localContext.debug(`No term was found when the metavariable's term type is '${termTypeName}'.`, termNode);
|
|
45
45
|
} else {
|
|
46
|
-
const
|
|
46
|
+
const termUnifiedWithTermType = unifyTermWithTermType(termNode, termType, localContext);
|
|
47
47
|
|
|
48
|
-
metavariableVerified =
|
|
48
|
+
metavariableVerified = termUnifiedWithTermType; ///
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import verifyEquality from "../equality";
|
|
4
4
|
import verifyJudgement from "../judgement";
|
|
5
5
|
import verifyTypeAssertion from "../assertion/type";
|
|
6
|
-
import
|
|
6
|
+
import unifyMetavariableWithStatement from "../../unify/metavariableWithStatement";
|
|
7
7
|
|
|
8
8
|
import { nodeQuery } from "../../utilities/query";
|
|
9
9
|
|
|
@@ -21,12 +21,12 @@ export default function verifyQualifiedStatement(qualifiedStatementNode, substit
|
|
|
21
21
|
localContext.trace(`Verifying the '${qualifiedStatementString}' qualified statement...`, qualifiedStatementNode);
|
|
22
22
|
|
|
23
23
|
const unifyQualifiedStatementFunctions = [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
unifyQualifiedStatementAWithRule,
|
|
25
|
+
unifyQualifiedStatementAWithAxiom,
|
|
26
|
+
unifyQualifiedStatementAWithLemma,
|
|
27
|
+
unifyQualifiedStatementAWithTheorem,
|
|
28
|
+
unifyQualifiedStatementAWithConjecture,
|
|
29
|
+
unifyQualifiedStatementAWithReference
|
|
30
30
|
];
|
|
31
31
|
|
|
32
32
|
const qualifiedStatementUnified = unifyQualifiedStatementFunctions.some((unifyQualifiedStatementFunction) => { ///
|
|
@@ -52,8 +52,8 @@ export default function verifyQualifiedStatement(qualifiedStatementNode, substit
|
|
|
52
52
|
return qualifiedStatementVerified;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
function
|
|
56
|
-
let
|
|
55
|
+
function unifyQualifiedStatementAWithRule(qualifiedStatementNode, substitutions, localContext) {
|
|
56
|
+
let qualifiedStatementUnifiedWithRule = false;
|
|
57
57
|
|
|
58
58
|
const metavariableNode = metavariableNodeQuery(qualifiedStatementNode),
|
|
59
59
|
rule = localContext.findRuleByMetavariableNode(metavariableNode);
|
|
@@ -63,22 +63,22 @@ function unifyQualifiedStatementAAgainstRule(qualifiedStatementNode, substitutio
|
|
|
63
63
|
metavariableString = localContext.nodeAsString(metavariableNode),
|
|
64
64
|
qualifiedStatementString = localContext.nodeAsString(qualifiedStatementNode);
|
|
65
65
|
|
|
66
|
-
localContext.trace(`Unifying the '${qualifiedStatementString}' qualified statement
|
|
66
|
+
localContext.trace(`Unifying the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' rule...`, qualifiedStatementNode);
|
|
67
67
|
|
|
68
68
|
const ruleMatchesStatement = rule.unifyStatement(statementNode, localContext);
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
qualifiedStatementUnifiedWithRule = ruleMatchesStatement; ///
|
|
71
71
|
|
|
72
|
-
if (
|
|
73
|
-
localContext.debug(`...unified the '${qualifiedStatementString}' qualified statement
|
|
72
|
+
if (qualifiedStatementUnifiedWithRule) {
|
|
73
|
+
localContext.debug(`...unified the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' rule.`, qualifiedStatementNode);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
return
|
|
77
|
+
return qualifiedStatementUnifiedWithRule;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
function
|
|
81
|
-
let
|
|
80
|
+
function unifyQualifiedStatementAWithAxiom(qualifiedStatementNode, substitutions, localContext) {
|
|
81
|
+
let qualifiedStatementUnifiedWithAxiom = false;
|
|
82
82
|
|
|
83
83
|
const metavariableNode = metavariableNodeQuery(qualifiedStatementNode),
|
|
84
84
|
axiom = localContext.findAxiomByMetavariableNode(metavariableNode);
|
|
@@ -88,22 +88,22 @@ function unifyQualifiedStatementAAgainstAxiom(qualifiedStatementNode, substituti
|
|
|
88
88
|
metavariableString = localContext.nodeAsString(metavariableNode),
|
|
89
89
|
qualifiedStatementString = localContext.nodeAsString(qualifiedStatementNode);
|
|
90
90
|
|
|
91
|
-
localContext.trace(`Unifying the '${qualifiedStatementString}' qualified statement
|
|
91
|
+
localContext.trace(`Unifying the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' axiom...`, qualifiedStatementNode);
|
|
92
92
|
|
|
93
93
|
const axiomMatchesStatement = axiom.unifyStatement(statementNode, localContext);
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
qualifiedStatementUnifiedWithAxiom = axiomMatchesStatement; ///
|
|
96
96
|
|
|
97
|
-
if (
|
|
98
|
-
localContext.debug(`...unified the '${qualifiedStatementString}' qualified statement
|
|
97
|
+
if (qualifiedStatementUnifiedWithAxiom) {
|
|
98
|
+
localContext.debug(`...unified the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' axiom.`, qualifiedStatementNode);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
return
|
|
102
|
+
return qualifiedStatementUnifiedWithAxiom;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
function
|
|
106
|
-
let
|
|
105
|
+
function unifyQualifiedStatementAWithLemma(qualifiedStatementNode, substitutions, localContext) {
|
|
106
|
+
let qualifiedStatementUnifiedWithLemma = false;
|
|
107
107
|
|
|
108
108
|
const metavariableNode = metavariableNodeQuery(qualifiedStatementNode),
|
|
109
109
|
lemma = localContext.findLemmaByMetavariableNode(metavariableNode);
|
|
@@ -113,22 +113,22 @@ function unifyQualifiedStatementAAgainstLemma(qualifiedStatementNode, substituti
|
|
|
113
113
|
metavariableString = localContext.nodeAsString(metavariableNode),
|
|
114
114
|
qualifiedStatementString = localContext.nodeAsString(qualifiedStatementNode);
|
|
115
115
|
|
|
116
|
-
localContext.trace(`Unifying the '${qualifiedStatementString}' qualified statement
|
|
116
|
+
localContext.trace(`Unifying the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' lemma...`, qualifiedStatementNode);
|
|
117
117
|
|
|
118
118
|
const lemmaMatchesStatement = lemma.unifyStatement(statementNode, localContext);
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
qualifiedStatementUnifiedWithLemma = lemmaMatchesStatement; ///
|
|
121
121
|
|
|
122
|
-
if (
|
|
123
|
-
localContext.debug(`...unified the '${qualifiedStatementString}' qualified statement
|
|
122
|
+
if (qualifiedStatementUnifiedWithLemma) {
|
|
123
|
+
localContext.debug(`...unified the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' lemma.`, qualifiedStatementNode);
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
return
|
|
127
|
+
return qualifiedStatementUnifiedWithLemma;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
function
|
|
131
|
-
let
|
|
130
|
+
function unifyQualifiedStatementAWithTheorem(qualifiedStatementNode, substitutions, localContext) {
|
|
131
|
+
let qualifiedStatementUnifiedWithTheorem = false;
|
|
132
132
|
|
|
133
133
|
const metavariableNode = metavariableNodeQuery(qualifiedStatementNode),
|
|
134
134
|
theorem = localContext.findTheoremByMetavariableNode(metavariableNode);
|
|
@@ -138,22 +138,22 @@ function unifyQualifiedStatementAAgainstTheorem(qualifiedStatementNode, substitu
|
|
|
138
138
|
metavariableString = localContext.nodeAsString(metavariableNode),
|
|
139
139
|
qualifiedStatementString = localContext.nodeAsString(qualifiedStatementNode);
|
|
140
140
|
|
|
141
|
-
localContext.trace(`Unifying the '${qualifiedStatementString}' qualified statement
|
|
141
|
+
localContext.trace(`Unifying the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' theorem...`, qualifiedStatementNode);
|
|
142
142
|
|
|
143
143
|
const theoremMatchesStatement = theorem.unifyStatement(statementNode, localContext);
|
|
144
144
|
|
|
145
|
-
|
|
145
|
+
qualifiedStatementUnifiedWithTheorem = theoremMatchesStatement; ///
|
|
146
146
|
|
|
147
|
-
if (
|
|
148
|
-
localContext.debug(`...unified the '${qualifiedStatementString}' qualified statement
|
|
147
|
+
if (qualifiedStatementUnifiedWithTheorem) {
|
|
148
|
+
localContext.debug(`...unified the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' theorem.`, qualifiedStatementNode);
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
return
|
|
152
|
+
return qualifiedStatementUnifiedWithTheorem;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
function
|
|
156
|
-
let
|
|
155
|
+
function unifyQualifiedStatementAWithConjecture(qualifiedStatementNode, substitutions, localContext) {
|
|
156
|
+
let qualifiedStatementUnifiedWithConjecture = false;
|
|
157
157
|
|
|
158
158
|
const metavariableNode = metavariableNodeQuery(qualifiedStatementNode),
|
|
159
159
|
conjecture = localContext.findConjectureByMetavariableNode(metavariableNode);
|
|
@@ -163,29 +163,29 @@ function unifyQualifiedStatementAAgainstConjecture(qualifiedStatementNode, subst
|
|
|
163
163
|
metavariableString = localContext.nodeAsString(metavariableNode),
|
|
164
164
|
qualifiedStatementString = localContext.nodeAsString(qualifiedStatementNode);
|
|
165
165
|
|
|
166
|
-
localContext.trace(`Unifying the '${qualifiedStatementString}' qualified statement
|
|
166
|
+
localContext.trace(`Unifying the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' conjecture...`, qualifiedStatementNode);
|
|
167
167
|
|
|
168
168
|
const conjectureMatchesStatement = conjecture.unifyStatement(statementNode, localContext);
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
qualifiedStatementUnifiedWithConjecture = conjectureMatchesStatement; ///
|
|
171
171
|
|
|
172
|
-
if (
|
|
173
|
-
localContext.debug(`...unified the '${qualifiedStatementString}' qualified statement
|
|
172
|
+
if (qualifiedStatementUnifiedWithConjecture) {
|
|
173
|
+
localContext.debug(`...unified the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' conjecture.`, qualifiedStatementNode);
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
return
|
|
177
|
+
return qualifiedStatementUnifiedWithConjecture;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
function
|
|
181
|
-
let
|
|
180
|
+
function unifyQualifiedStatementAWithReference(qualifiedStatementNode, substitutions, localContext) {
|
|
181
|
+
let qualifiedStatementUnifiedWithReference = false;
|
|
182
182
|
|
|
183
183
|
const metavariableNode = metavariableNodeQuery(qualifiedStatementNode),
|
|
184
184
|
metavariableString = localContext.nodeAsString(metavariableNode),
|
|
185
185
|
metavariablePresent = localContext.isMetavariablePresentByMetavariableNode(metavariableNode),
|
|
186
186
|
qualifiedStatementString = localContext.nodeAsString(qualifiedStatementNode);
|
|
187
187
|
|
|
188
|
-
localContext.trace(`Unifying the '${qualifiedStatementString}' qualified statement
|
|
188
|
+
localContext.trace(`Unifying the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' reference...`, qualifiedStatementNode);
|
|
189
189
|
|
|
190
190
|
if (metavariablePresent) {
|
|
191
191
|
const statementNode = statementNodeQuery(qualifiedStatementNode),
|
|
@@ -194,20 +194,20 @@ function unifyQualifiedStatementAAgainstReference(qualifiedStatementNode, substi
|
|
|
194
194
|
statementNodeB = statementNode, ///
|
|
195
195
|
substitutionNodeA = null,
|
|
196
196
|
metavariableNodeA = metavariableNode, ///
|
|
197
|
-
|
|
197
|
+
metavariableUnifiedWithStatement = unifyMetavariableWithStatement(metavariableNodeA, statementNodeB, substitutionNodeA, substitutions, localContextA, localContextB, () => {
|
|
198
198
|
const verifiedAhead = true;
|
|
199
199
|
|
|
200
200
|
return verifiedAhead;
|
|
201
201
|
});
|
|
202
202
|
|
|
203
|
-
|
|
203
|
+
qualifiedStatementUnifiedWithReference = metavariableUnifiedWithStatement; ///
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
if (
|
|
207
|
-
localContext.debug(`...unified the '${qualifiedStatementString}' qualified statement
|
|
206
|
+
if (qualifiedStatementUnifiedWithReference) {
|
|
207
|
+
localContext.debug(`...unified the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' reference.`, qualifiedStatementNode);
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
return
|
|
210
|
+
return qualifiedStatementUnifiedWithReference;
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
function verifyStatedStatement(statementNode, assignments, derived, localContext) {
|
package/src/verify/statement.js
CHANGED
|
@@ -9,7 +9,7 @@ import verifyTypeAssertion from "../verify/assertion/type";
|
|
|
9
9
|
import verifyDefinedAssertion from "../verify/assertion/defined";
|
|
10
10
|
import verifySubproofAssertion from "../verify/assertion/subproof";
|
|
11
11
|
import verifyContainedAssertion from "../verify/assertion/contained";
|
|
12
|
-
import
|
|
12
|
+
import statementWithCombinatorUnifier from "../unifier/statementWithCombinator";
|
|
13
13
|
|
|
14
14
|
import { nodeQuery } from "../utilities/query";
|
|
15
15
|
|
|
@@ -28,9 +28,9 @@ function verifyStatement(statementNode, assignments, derived, localContext) {
|
|
|
28
28
|
|
|
29
29
|
localContext.trace(`Verifying the '${statementString}' statement...`, statementNode);
|
|
30
30
|
|
|
31
|
-
const
|
|
31
|
+
const statementUnifiedWithCombinators = unifyStatementWithCombinators(statementNode, assignments, derived, localContext);
|
|
32
32
|
|
|
33
|
-
if (
|
|
33
|
+
if (statementUnifiedWithCombinators) {
|
|
34
34
|
statementVerified = true;
|
|
35
35
|
} else {
|
|
36
36
|
const verifyStatementFunctions = [
|
|
@@ -41,7 +41,7 @@ function verifyStatement(statementNode, assignments, derived, localContext) {
|
|
|
41
41
|
verifyStatementAsDefinedAssertion,
|
|
42
42
|
verifyStatementAsSubproofAssertion,
|
|
43
43
|
verifyStatementAsContainedAssertion,
|
|
44
|
-
|
|
44
|
+
unifyStatementWithCombinators
|
|
45
45
|
];
|
|
46
46
|
|
|
47
47
|
statementVerified = verifyStatementFunctions.some((verifyStatementFunction) => {
|
|
@@ -220,8 +220,8 @@ function verifyStatementAsContainedAssertion(statementNode, assignments, derived
|
|
|
220
220
|
return statementVerifiedAsContainedAssertion;
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
function
|
|
224
|
-
let
|
|
223
|
+
function unifyStatementWithCombinators(statementNode, assignments, derived, localContext) {
|
|
224
|
+
let statementUnifiedWithCombinators = false;
|
|
225
225
|
|
|
226
226
|
const equalityNode = equalityNodeQuery(statementNode),
|
|
227
227
|
judgementNode = judgementNodeQuery(statementNode),
|
|
@@ -246,33 +246,33 @@ function unifyStatementAgainstCombinators(statementNode, assignments, derived, l
|
|
|
246
246
|
...combinators
|
|
247
247
|
];
|
|
248
248
|
|
|
249
|
-
|
|
250
|
-
const
|
|
249
|
+
statementUnifiedWithCombinators = combinators.some((combinator) => {
|
|
250
|
+
const statementUnifiedWithCombinator = unifyStatementWithCombinator(statementNode, combinator, localContext);
|
|
251
251
|
|
|
252
|
-
if (
|
|
252
|
+
if (statementUnifiedWithCombinator) {
|
|
253
253
|
return true;
|
|
254
254
|
}
|
|
255
255
|
});
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
-
return
|
|
258
|
+
return statementUnifiedWithCombinators;
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
-
function
|
|
262
|
-
let
|
|
261
|
+
function unifyStatementWithCombinator(statementNode, combinator, localContext) {
|
|
262
|
+
let statementUnifiedWithCombinator;
|
|
263
263
|
|
|
264
264
|
const statementString = localContext.nodeAsString(statementNode),
|
|
265
265
|
combinatorString = combinator.getString();
|
|
266
266
|
|
|
267
|
-
localContext.trace(`Unifying the '${statementString}' statement
|
|
267
|
+
localContext.trace(`Unifying the '${statementString}' statement with the '${combinatorString}' combinator...`, statementNode);
|
|
268
268
|
|
|
269
269
|
const combinatorStatementNode = combinator.getStatementNode();
|
|
270
270
|
|
|
271
|
-
|
|
271
|
+
statementUnifiedWithCombinator = statementWithCombinatorUnifier.unify(statementNode, combinatorStatementNode, localContext);
|
|
272
272
|
|
|
273
|
-
if (
|
|
274
|
-
localContext.debug(`...unified the '${statementString}' statement
|
|
273
|
+
if (statementUnifiedWithCombinator) {
|
|
274
|
+
localContext.debug(`...unified the '${statementString}' statement with the '${combinatorString}' combinator.`, statementNode);
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
-
return
|
|
277
|
+
return statementUnifiedWithCombinator;
|
|
278
278
|
}
|
|
@@ -8,7 +8,7 @@ export default function verifyStatementAsCombinator(statementNode, fileContext)
|
|
|
8
8
|
|
|
9
9
|
const statementString = fileContext.nodeAsString(statementNode);
|
|
10
10
|
|
|
11
|
-
fileContext.trace(`Verifying the '${statementString}' statement as a combinator
|
|
11
|
+
fileContext.trace(`Verifying the '${statementString}' statement as a combinator...`, statementNode);
|
|
12
12
|
|
|
13
13
|
statementVerifiedAsCombinator = statementAsCombinatorVerifier.verify(statementNode, fileContext);
|
|
14
14
|
|
package/src/verify/term.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import shim from "../shim";
|
|
4
4
|
import Term from "../term";
|
|
5
5
|
import bracketedConstructor from "../constructor/bracketed";
|
|
6
|
-
import
|
|
6
|
+
import termWithConstructorUnifier from "../unifier/termWithConstructor";
|
|
7
7
|
|
|
8
8
|
import { nodeQuery } from "../utilities/query";
|
|
9
9
|
|
|
@@ -19,8 +19,8 @@ function verifyTerm(termNode, terms, localContext, verifyAhead) {
|
|
|
19
19
|
|
|
20
20
|
const verifyTermFunctions = [
|
|
21
21
|
verifyTermAsVariable,
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
unifyTermWithConstructors,
|
|
23
|
+
unifyTermWithBracketedConstructor
|
|
24
24
|
];
|
|
25
25
|
|
|
26
26
|
termVerified = verifyTermFunctions.some((verifyTermFunction) => {
|
|
@@ -79,35 +79,35 @@ function verifyTermAsVariable(termNode, terms, localContext, verifyAhead) {
|
|
|
79
79
|
return termVerifiedAsVariable;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
function
|
|
83
|
-
let
|
|
82
|
+
function unifyTermWithConstructors(termNode, terms, localContext, verifyAhead) {
|
|
83
|
+
let termUnifiedWithConstructors = false;
|
|
84
84
|
|
|
85
85
|
const variableNode = variableNodeQuery(termNode);
|
|
86
86
|
|
|
87
87
|
if (variableNode === null) {
|
|
88
88
|
const constructors = localContext.getConstructors();
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
const
|
|
90
|
+
termUnifiedWithConstructors = constructors.some((constructor) => {
|
|
91
|
+
const termUnifiedWithConstructor = unifyTermWithConstructor(termNode, terms, constructor, localContext, verifyAhead);
|
|
92
92
|
|
|
93
|
-
if (
|
|
93
|
+
if (termUnifiedWithConstructor) {
|
|
94
94
|
return true;
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
return
|
|
99
|
+
return termUnifiedWithConstructors;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
function
|
|
103
|
-
let
|
|
102
|
+
function unifyTermWithBracketedConstructor(termNode, terms, localContext, verifyAhead) {
|
|
103
|
+
let termUnifiedWithBracketedConstructor;
|
|
104
104
|
|
|
105
105
|
const termString = localContext.nodeAsString(termNode),
|
|
106
106
|
bracketedTerms = [];
|
|
107
107
|
|
|
108
|
-
localContext.trace(`Unifying the '${termString}' term
|
|
108
|
+
localContext.trace(`Unifying the '${termString}' term with the bracketed constructor...`, termNode);
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
termUnifiedWithBracketedConstructor = unifyTermWithConstructor(termNode, bracketedTerms, bracketedConstructor, localContext, () => {
|
|
111
111
|
let verifiedAhead;
|
|
112
112
|
|
|
113
113
|
const bracketedTermNode = termNode; ///
|
|
@@ -121,25 +121,25 @@ function unifyTermAgainstBracketedConstructor(termNode, terms, localContext, ver
|
|
|
121
121
|
return verifiedAhead;
|
|
122
122
|
});
|
|
123
123
|
|
|
124
|
-
if (
|
|
125
|
-
localContext.debug(`...unified the '${termString}' term
|
|
124
|
+
if (termUnifiedWithBracketedConstructor) {
|
|
125
|
+
localContext.debug(`...unified the '${termString}' term with the bracketed constructor.`, termNode);
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
return
|
|
128
|
+
return termUnifiedWithBracketedConstructor;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
function
|
|
132
|
-
let
|
|
131
|
+
function unifyTermWithConstructor(termNode, terms, constructor, localContext, verifyAhead) {
|
|
132
|
+
let termUnifiedWithConstructor = false;
|
|
133
133
|
|
|
134
134
|
const termString = localContext.nodeAsString(termNode),
|
|
135
135
|
constructorString = constructor.getString(),
|
|
136
136
|
constructorTermNode = constructor.getTermNode();
|
|
137
137
|
|
|
138
|
-
localContext.trace(`Unifying the '${termString}' term
|
|
138
|
+
localContext.trace(`Unifying the '${termString}' term with the '${constructorString}' constructor...`, termNode);
|
|
139
139
|
|
|
140
140
|
const termNodeA = termNode, ///
|
|
141
141
|
constructorTermNodeB = constructorTermNode, ///
|
|
142
|
-
unified =
|
|
142
|
+
unified = termWithConstructorUnifier.unify(termNodeA, constructorTermNodeB, localContext);
|
|
143
143
|
|
|
144
144
|
if (unified) {
|
|
145
145
|
let verifiedAhead;
|
|
@@ -153,13 +153,13 @@ function unifyTermAgainstConstructor(termNode, terms, constructor, localContext,
|
|
|
153
153
|
|
|
154
154
|
terms.pop();
|
|
155
155
|
|
|
156
|
-
|
|
156
|
+
termUnifiedWithConstructor = verifiedAhead; ///
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
if (
|
|
160
|
-
localContext.debug(`...unified the '${termString}' term
|
|
159
|
+
if (termUnifiedWithConstructor) {
|
|
160
|
+
localContext.debug(`...unified the '${termString}' term with the '${constructorString}' constructor.`, termNode);
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
return
|
|
163
|
+
return termUnifiedWithConstructor;
|
|
164
164
|
}
|
|
165
165
|
|
|
@@ -1,66 +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 verifyReleaseContext;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
function verifyReleaseContext(dependency, dependentName, dependentReleased, context) {
|
|
12
|
-
var releaseContextVerified = false;
|
|
13
|
-
var releaseContextMap = context.releaseContextMap, dependencyName = dependency.getName(), releaseName = dependencyName, releaseContext = releaseContextMap[releaseName] || null;
|
|
14
|
-
if (releaseContext === null) {
|
|
15
|
-
var log = context.log;
|
|
16
|
-
log.error("Unable to verify the '".concat(dependencyName, "' dependency's context because it has not been created."));
|
|
17
|
-
} else {
|
|
18
|
-
var verified = releaseContext.isVerified();
|
|
19
|
-
if (verified) {
|
|
20
|
-
releaseContextVerified = true;
|
|
21
|
-
} else {
|
|
22
|
-
var released = releaseContext.isReleased();
|
|
23
|
-
if (!released && dependentReleased) {
|
|
24
|
-
var log1 = context.log;
|
|
25
|
-
log1.error("Unable to verify the '".concat(dependencyName, "' dependency's context because its '").concat(dependentName, "' dependent is a package."));
|
|
26
|
-
} else {
|
|
27
|
-
var dependencies = releaseContext.getDependencies();
|
|
28
|
-
dependentName = dependencyName; ///
|
|
29
|
-
dependentReleased = released; ///
|
|
30
|
-
releaseContextVerified = dependencies.everyDependency(function(dependency) {
|
|
31
|
-
var releaseContextVerified = verifyReleaseContext(dependency, dependentName, dependentReleased, context);
|
|
32
|
-
if (releaseContextVerified) {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
if (releaseContextVerified) {
|
|
37
|
-
var releaseContexts = retrieveReleaseContexts(releaseContext, releaseContextMap);
|
|
38
|
-
releaseContext.verify(releaseContexts);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return releaseContextVerified;
|
|
44
|
-
}
|
|
45
|
-
function retrieveReleaseContexts(releaseContext, releaseContextMap) {
|
|
46
|
-
var releaseContexts = [], remainingReleaseContext = releaseContext, remainingReleaseContexts = [
|
|
47
|
-
remainingReleaseContext
|
|
48
|
-
];
|
|
49
|
-
var remainingReleaseContextsLength = remainingReleaseContexts.length;
|
|
50
|
-
while(remainingReleaseContextsLength > 0){
|
|
51
|
-
var remainingReleaseContext1 = remainingReleaseContexts.shift(), _$releaseContext = remainingReleaseContext1; ///
|
|
52
|
-
releaseContexts.push(_$releaseContext);
|
|
53
|
-
var dependencies = _$releaseContext.getDependencies();
|
|
54
|
-
dependencies.forEachDependency(function(dependency) {
|
|
55
|
-
var dependencyName = dependency.getName(), releaseName = dependencyName, _$releaseContext = releaseContextMap[releaseName], releaseContextsIncludesReleaseContext = releaseContexts.includes(_$releaseContext), remainingReleaseContextsIncludesReleaseContext = remainingReleaseContexts.includes(_$releaseContext);
|
|
56
|
-
if (!releaseContextsIncludesReleaseContext && !remainingReleaseContextsIncludesReleaseContext) {
|
|
57
|
-
var remainingReleaseContext = _$releaseContext; ///
|
|
58
|
-
remainingReleaseContexts.push(remainingReleaseContext);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
remainingReleaseContextsLength = remainingReleaseContexts.length;
|
|
62
|
-
}
|
|
63
|
-
return releaseContexts;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9yZWxlYXNlQ29udGV4dC92ZXJpZnkuanMiXSwic291cmNlc0NvbnRlbnQiOlsiXCJ1c2Ugc3RyaWN0XCI7XG5cbmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIHZlcmlmeVJlbGVhc2VDb250ZXh0KGRlcGVuZGVuY3ksIGRlcGVuZGVudE5hbWUsIGRlcGVuZGVudFJlbGVhc2VkLCBjb250ZXh0KSB7XG4gIGxldCByZWxlYXNlQ29udGV4dFZlcmlmaWVkID0gZmFsc2U7XG5cbiAgY29uc3QgeyByZWxlYXNlQ29udGV4dE1hcCB9ID0gY29udGV4dCxcbiAgICAgICAgZGVwZW5kZW5jeU5hbWUgPSBkZXBlbmRlbmN5LmdldE5hbWUoKSxcbiAgICAgICAgcmVsZWFzZU5hbWUgPSBkZXBlbmRlbmN5TmFtZSwgLy8vXG4gICAgICAgIHJlbGVhc2VDb250ZXh0ID0gcmVsZWFzZUNvbnRleHRNYXBbcmVsZWFzZU5hbWVdIHx8IG51bGw7XG5cbiAgaWYgKHJlbGVhc2VDb250ZXh0ID09PSBudWxsKSB7XG4gICAgY29uc3QgeyBsb2cgfSA9IGNvbnRleHQ7XG5cbiAgICBsb2cuZXJyb3IoYFVuYWJsZSB0byB2ZXJpZnkgdGhlICcke2RlcGVuZGVuY3lOYW1lfScgZGVwZW5kZW5jeSdzIG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