occam-verify-cli 0.0.698 → 0.0.700
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/assignment/equality.js +4 -4
- package/lib/assignment/metavariable.js +4 -4
- package/lib/assignment/variable.js +4 -4
- package/lib/constructor.js +3 -10
- package/lib/context/file.js +4 -72
- package/lib/context/local.js +5 -7
- package/lib/context/localMeta.js +5 -9
- package/lib/context/release.js +2 -4
- package/lib/equality.js +3 -3
- package/lib/metaType.js +10 -10
- package/lib/metavariable.js +3 -10
- package/lib/mixins/context.js +107 -0
- package/lib/ruleNames.js +9 -1
- package/lib/type.js +23 -27
- package/lib/utilities/node.js +3 -73
- package/lib/utilities/tokens.js +1 -8
- package/lib/variable.js +11 -10
- package/lib/verifier/node/statementAsCombinator.js +1 -1
- package/lib/verify/axiom.js +3 -8
- package/lib/verify/conclusion.js +2 -2
- package/lib/verify/conjecture.js +4 -9
- package/lib/verify/derivation.js +3 -8
- package/lib/verify/equality.js +9 -9
- package/lib/verify/lemma.js +4 -9
- package/lib/verify/premises.js +28 -0
- package/lib/verify/rule.js +3 -8
- package/lib/verify/ruleDerivation.js +6 -8
- package/lib/verify/supposition.js +3 -9
- package/lib/verify/suppositions.js +37 -0
- package/lib/verify/term.js +3 -4
- package/lib/verify/theorem.js +3 -8
- package/lib/verify/typeAssertion.js +16 -12
- package/package.json +1 -1
- package/src/assignment/equality.js +5 -5
- package/src/assignment/metavariable.js +5 -5
- package/src/assignment/variable.js +7 -5
- package/src/constructor.js +2 -7
- package/src/context/file.js +9 -12
- package/src/context/local.js +6 -8
- package/src/context/localMeta.js +5 -7
- package/src/context/release.js +6 -9
- package/src/equality.js +2 -2
- package/src/metaType.js +10 -10
- package/src/metavariable.js +2 -7
- package/src/mixins/{file.js → context.js} +20 -2
- package/src/ruleNames.js +2 -0
- package/src/type.js +27 -39
- package/src/utilities/node.js +3 -81
- package/src/utilities/tokens.js +0 -8
- package/src/variable.js +9 -6
- package/src/verifier/node/statementAsCombinator.js +1 -1
- package/src/verify/axiom.js +2 -8
- package/src/verify/conclusion.js +1 -1
- package/src/verify/conjecture.js +3 -9
- package/src/verify/derivation.js +2 -8
- package/src/verify/equality.js +8 -8
- package/src/verify/lemma.js +3 -9
- package/src/verify/premises.js +17 -0
- package/src/verify/rule.js +2 -8
- package/src/verify/ruleDerivation.js +5 -7
- package/src/verify/supposition.js +1 -10
- package/src/verify/suppositions.js +29 -0
- package/src/verify/term.js +2 -4
- package/src/verify/theorem.js +2 -8
- package/src/verify/typeAssertion.js +16 -11
- package/lib/mixins/file.js +0 -83
- package/lib/mixins/logging.js +0 -39
- package/src/mixins/logging.js +0 -24
package/src/type.js
CHANGED
|
@@ -58,29 +58,29 @@ export default class Type {
|
|
|
58
58
|
return superTypeOf;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
isComparableTo(type) {
|
|
62
62
|
const equalTo = this.isEqualTo(type),
|
|
63
63
|
subTypeOf = this.isSubTypeOf(type),
|
|
64
|
-
|
|
64
|
+
superTypeOf = this.isSuperTypeOf(type),
|
|
65
|
+
comparableTo = equalTo || subTypeOf || superTypeOf;
|
|
65
66
|
|
|
66
|
-
return
|
|
67
|
+
return comparableTo;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
|
|
70
|
+
isEqualToOrSubTypeOf(type) {
|
|
70
71
|
const equalTo = this.isEqualTo(type),
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
subTypeOf = this.isSubTypeOf(type),
|
|
73
|
+
equalToOrSubTypeOf = equalTo || subTypeOf;
|
|
73
74
|
|
|
74
|
-
return
|
|
75
|
+
return equalToOrSubTypeOf;
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
|
|
78
|
+
isEqualToOrSuperTypeOf(type) {
|
|
78
79
|
const equalTo = this.isEqualTo(type),
|
|
79
|
-
subTypeOf = this.isSubTypeOf(type),
|
|
80
80
|
superTypeOf = this.isSuperTypeOf(type),
|
|
81
|
-
|
|
81
|
+
equalToOrSuperTypeOf = equalTo || superTypeOf;
|
|
82
82
|
|
|
83
|
-
return
|
|
83
|
+
return equalToOrSuperTypeOf;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
match(type) {
|
|
@@ -101,7 +101,7 @@ export default class Type {
|
|
|
101
101
|
return typeNameMatches;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
asString(tokens, noSuperType) {
|
|
104
|
+
asString(tokens, noSuperType = false) {
|
|
105
105
|
let string;
|
|
106
106
|
|
|
107
107
|
if (noSuperType) {
|
|
@@ -135,22 +135,6 @@ export default class Type {
|
|
|
135
135
|
return type;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
static fromJSONAndFileContext(json, fileContext) {
|
|
139
|
-
let type;
|
|
140
|
-
|
|
141
|
-
let { superType } = json;
|
|
142
|
-
|
|
143
|
-
const superTypeJSON = superType; ///
|
|
144
|
-
|
|
145
|
-
superType = superTypeFromSuperTypeJSONAndFileContext(superTypeJSON, fileContext);
|
|
146
|
-
|
|
147
|
-
const { name } = json;
|
|
148
|
-
|
|
149
|
-
type = new Type(name, superType);
|
|
150
|
-
|
|
151
|
-
return type;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
138
|
static fromTypeNameAndSuperType(typeName, superType) {
|
|
155
139
|
const name = typeName, ///
|
|
156
140
|
type = new Type(name, superType);
|
|
@@ -182,19 +166,23 @@ class ObjectType extends Type {
|
|
|
182
166
|
|
|
183
167
|
export const objectType = ObjectType.fromNothing();
|
|
184
168
|
|
|
185
|
-
function
|
|
186
|
-
let
|
|
169
|
+
export function typeFromJSONAndFileContext(json, fileContext) {
|
|
170
|
+
let type;
|
|
171
|
+
|
|
172
|
+
const { name } = json,
|
|
173
|
+
typeName = name; ///
|
|
187
174
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
type = fileContext.findTypeByTypeName(typeName);
|
|
175
|
+
type = fileContext.findTypeByTypeName(typeName);
|
|
176
|
+
|
|
177
|
+
if (type === null) {
|
|
178
|
+
let { superType } = json;
|
|
193
179
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
180
|
+
const superJSON = superType; ///
|
|
181
|
+
|
|
182
|
+
superType = typeFromJSONAndFileContext(superJSON, fileContext);
|
|
183
|
+
|
|
184
|
+
type = new Type(name, superType);
|
|
197
185
|
}
|
|
198
186
|
|
|
199
|
-
return
|
|
187
|
+
return type;
|
|
200
188
|
}
|
package/src/utilities/node.js
CHANGED
|
@@ -4,19 +4,14 @@ import { parsersUtilities } from "occam-custom-grammars";
|
|
|
4
4
|
|
|
5
5
|
import { nodeQuery } from "../utilities/query";
|
|
6
6
|
import { combinedCustomGrammarFromNothing } from "./customGrammar";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
VARIABLE_RULE_NAME,
|
|
10
|
-
META_TYPE_RULE_NAME,
|
|
11
|
-
METAVARIABLE_RULE_NAME,
|
|
7
|
+
import { LABEL_RULE_NAME,
|
|
8
|
+
VARIABLE_DECLARATION_RULE_NAME,
|
|
12
9
|
UNQUALIFIED_STATEMENT_RULE_NAME,
|
|
13
10
|
CONSTRUCTOR_DECLARATION_RULE_NAME,
|
|
14
11
|
UNQUALIFIED_METASTATEMENT_RULE_NAME } from "../ruleNames";
|
|
15
12
|
import { labelTokensFromLabelString,
|
|
16
|
-
constructorDeclarationTokensFromTermString,
|
|
17
13
|
variableDeclarationTokensFromVariableString,
|
|
18
14
|
unqualifiedStatementTokensFromStatementString,
|
|
19
|
-
metavariableDeclarationTokensFromMetavariableString,
|
|
20
15
|
unqualifiedMetastatementTokensFromMetastatementString } from "../utilities/tokens";
|
|
21
16
|
|
|
22
17
|
const { florenceParserFromCombinedCustomGrammar } = parsersUtilities;
|
|
@@ -25,20 +20,10 @@ const combinedCustomGrammar = combinedCustomGrammarFromNothing(),
|
|
|
25
20
|
florenceParser = florenceParserFromCombinedCustomGrammar(combinedCustomGrammar);
|
|
26
21
|
|
|
27
22
|
const termNodeQuery = nodeQuery("/constructorDeclaration/term!"),
|
|
28
|
-
typeNodeQuery = nodeQuery("/variableDeclaration/type!"),
|
|
29
23
|
variableNodeQuery = nodeQuery("/variableDeclaration/variable!"),
|
|
30
|
-
metaTypeNodeQuery = nodeQuery("/metavariableDeclaration/metaType!"),
|
|
31
24
|
statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!"),
|
|
32
|
-
metavariableNodeQuery = nodeQuery("/metavariableDeclaration/metavariable!"),
|
|
33
25
|
metastatementNodeQuery = nodeQuery("/unqualifiedMetastatement/metastatement!");
|
|
34
26
|
|
|
35
|
-
export function termNodeFromTermString(termString, lexer, parser) {
|
|
36
|
-
const constructorDeclarationTokens = constructorDeclarationTokensFromTermString(termString, parser),
|
|
37
|
-
termNode = termNodeFromConstructorDeclarationTokens(constructorDeclarationTokens, parser);
|
|
38
|
-
|
|
39
|
-
return termNode;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
27
|
export function labelNodeFromLabelString(labelString, lexer, parser) {
|
|
43
28
|
const labelTokens = labelTokensFromLabelString(labelString, lexer),
|
|
44
29
|
labelNode = labelNodeFromLabelTokens(labelTokens, parser);
|
|
@@ -46,13 +31,6 @@ export function labelNodeFromLabelString(labelString, lexer, parser) {
|
|
|
46
31
|
return labelNode;
|
|
47
32
|
}
|
|
48
33
|
|
|
49
|
-
export function typeNodeFromVariableString(variableString, lexer, parser) {
|
|
50
|
-
const variableDeclarationTokens = variableDeclarationTokensFromVariableString(variableString, lexer),
|
|
51
|
-
typeNode = typeNodeFromVariableVariableDeclarationTokens(variableDeclarationTokens, parser);
|
|
52
|
-
|
|
53
|
-
return typeNode;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
34
|
export function variableNodeFromVariableString(variableString, lexer, parser) {
|
|
57
35
|
const variableTDeclarationTokens = variableDeclarationTokensFromVariableString(variableString, lexer),
|
|
58
36
|
variableNode = variableNodeFromVariableVariableTDeclarationTokens(variableTDeclarationTokens, parser);
|
|
@@ -67,20 +45,6 @@ export function statementNodeFromStatementString(statementString, lexer, parser)
|
|
|
67
45
|
return statementNode;
|
|
68
46
|
}
|
|
69
47
|
|
|
70
|
-
export function metaTypeNodeFromMetavariableString(metavariableString, lexer, parser) {
|
|
71
|
-
const metavariableDeclarationTokens = metavariableDeclarationTokensFromMetavariableString(metavariableString, lexer),
|
|
72
|
-
metaTypeNode = metaTypeNodeFromMetavariableDeclarationTokens(metavariableDeclarationTokens, parser);
|
|
73
|
-
|
|
74
|
-
return metaTypeNode;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export function metavariableNodeFromMetavariableString(metavariableString, lexer, parser) {
|
|
78
|
-
const metavariableDeclarationTokens = metavariableDeclarationTokensFromMetavariableString(metavariableString, lexer),
|
|
79
|
-
metavariableNode = metavariableNodeFromMetavariableDeclarationTokens(metavariableDeclarationTokens, parser);
|
|
80
|
-
|
|
81
|
-
return metavariableNode;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
48
|
export function metastatementNodeFromMetastatementString(metastatementString, lexer, parser) {
|
|
85
49
|
const unqualifiedMetastatementTokens = unqualifiedMetastatementTokensFromMetastatementString(metastatementString, lexer),
|
|
86
50
|
metastatementNode = metastatementNodeFromUnqualifiedMetastatementTokens(unqualifiedMetastatementTokens, parser);
|
|
@@ -102,27 +66,6 @@ export function statementNodeFromUnqualifiedStatementTokens(unqualifiedStatement
|
|
|
102
66
|
return statementNode;
|
|
103
67
|
}
|
|
104
68
|
|
|
105
|
-
export function typeNodeFromVariableVariableDeclarationTokens(variableDeclarationTokens, parser) {
|
|
106
|
-
const typeDeclarationNode = typeDeclarationNodeFromVariableDeclarationTokens(variableDeclarationTokens, parser),
|
|
107
|
-
typeNode = typeNodeQuery(typeDeclarationNode);
|
|
108
|
-
|
|
109
|
-
return typeNode;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export function metaTypeNodeFromMetavariableDeclarationTokens(metavariableDeclarationTokens, parser) {
|
|
113
|
-
const metaTypeDeclarationNode = metaTypeDeclarationNodeFromMetavariableDeclarationTokens(metavariableDeclarationTokens, parser),
|
|
114
|
-
metaTypeNode = metaTypeNodeQuery(metaTypeDeclarationNode);
|
|
115
|
-
|
|
116
|
-
return metaTypeNode;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export function metavariableNodeFromMetavariableDeclarationTokens(metavariableDeclarationTokens, parser) {
|
|
120
|
-
const metavariableDeclarationNode = metavariableDeclarationNodeFromMetavariableDeclarationTokens(metavariableDeclarationTokens, parser),
|
|
121
|
-
metavariableNode = metavariableNodeQuery(metavariableDeclarationNode);
|
|
122
|
-
|
|
123
|
-
return metavariableNode;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
69
|
export function variableNodeFromVariableVariableTDeclarationTokens(variableTDeclarationTokens, parser) {
|
|
127
70
|
const variableDeclarationNode = variableDeclarationNodeFromVariableTDeclarationTokens(variableTDeclarationTokens, parser),
|
|
128
71
|
variableNode = variableNodeQuery(variableDeclarationNode);
|
|
@@ -144,15 +87,8 @@ export function labelNodeFromLabelTokens(labelTokens, parser) {
|
|
|
144
87
|
return labelNode;
|
|
145
88
|
}
|
|
146
89
|
|
|
147
|
-
export function typeDeclarationNodeFromVariableDeclarationTokens(variableDeclarationTokens, parser) {
|
|
148
|
-
const ruleName = TYPE_RULE_NAME,
|
|
149
|
-
typeDeclarationNode = nodeFromTokensRuleNameAndParser(variableDeclarationTokens, ruleName, parser);
|
|
150
|
-
|
|
151
|
-
return typeDeclarationNode;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
90
|
export function variableDeclarationNodeFromVariableTDeclarationTokens(variableTDeclarationTokens, parser) {
|
|
155
|
-
const ruleName =
|
|
91
|
+
const ruleName = VARIABLE_DECLARATION_RULE_NAME,
|
|
156
92
|
variableDeclarationNode = nodeFromTokensRuleNameAndParser(variableTDeclarationTokens, ruleName, parser);
|
|
157
93
|
|
|
158
94
|
return variableDeclarationNode;
|
|
@@ -165,13 +101,6 @@ export function unqualifiedStatementNodeFromUnqualifiedStatementTokens(unqualifi
|
|
|
165
101
|
return unqualifiedStatementNode;
|
|
166
102
|
}
|
|
167
103
|
|
|
168
|
-
export function metaTypeDeclarationNodeFromMetavariableDeclarationTokens(metavariableDeclarationTokens, parser) {
|
|
169
|
-
const ruleName = META_TYPE_RULE_NAME,
|
|
170
|
-
metaTypeDeclarationNode = nodeFromTokensRuleNameAndParser(metavariableDeclarationTokens, ruleName, parser);
|
|
171
|
-
|
|
172
|
-
return metaTypeDeclarationNode;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
104
|
export function constructorDeclarationNodeFromConstructorDeclarationTokens(constructorDeclarationTokens, parser) {
|
|
176
105
|
const ruleName = CONSTRUCTOR_DECLARATION_RULE_NAME,
|
|
177
106
|
constructorDeclarationNode = nodeFromTokensRuleNameAndParser(constructorDeclarationTokens, ruleName, parser);
|
|
@@ -179,13 +108,6 @@ export function constructorDeclarationNodeFromConstructorDeclarationTokens(const
|
|
|
179
108
|
return constructorDeclarationNode;
|
|
180
109
|
}
|
|
181
110
|
|
|
182
|
-
export function metavariableDeclarationNodeFromMetavariableDeclarationTokens(metavariableDeclarationTokens, parser) {
|
|
183
|
-
const ruleName = METAVARIABLE_RULE_NAME,
|
|
184
|
-
metavariableDeclarationNode = nodeFromTokensRuleNameAndParser(metavariableDeclarationTokens, ruleName, parser);
|
|
185
|
-
|
|
186
|
-
return metavariableDeclarationNode;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
111
|
export function unqualifiedMetastatementNodeFromUnqualifiedMetastatementTokens(unqualifiedMetastatementTokens, parser) {
|
|
190
112
|
const ruleName = UNQUALIFIED_METASTATEMENT_RULE_NAME,
|
|
191
113
|
unqualifiedMetastatementNode = nodeFromTokensRuleNameAndParser(unqualifiedMetastatementTokens, ruleName, parser);
|
package/src/utilities/tokens.js
CHANGED
|
@@ -40,14 +40,6 @@ export function unqualifiedStatementTokensFromStatementString(statementString, l
|
|
|
40
40
|
return unqualifiedStatementTokens;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export function metavariableDeclarationTokensFromMetavariableString(metavariableString, lexer) {
|
|
44
|
-
const metavariableDeclarationContent = `Metavariable ${metavariableString}
|
|
45
|
-
`,
|
|
46
|
-
metavariableDeclarationTokens = tokensFromContentAndLexer(metavariableDeclarationContent, lexer);
|
|
47
|
-
|
|
48
|
-
return metavariableDeclarationTokens;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
43
|
export function unqualifiedMetastatementTokensFromMetastatementString(metastatementString, lexer) {
|
|
52
44
|
const unqualifiedMetastatementContent = `${metastatementString}
|
|
53
45
|
`,
|
package/src/variable.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import Type from "./type";
|
|
4
|
-
|
|
5
3
|
import { nodeAsString } from "./utilities/string";
|
|
4
|
+
import { typeFromJSONAndFileContext } from "./type";
|
|
6
5
|
import { variableNodeFromVariableString } from "./utilities/node";
|
|
7
6
|
|
|
8
7
|
export default class Variable {
|
|
@@ -86,13 +85,17 @@ export default class Variable {
|
|
|
86
85
|
|
|
87
86
|
json = type; ///
|
|
88
87
|
|
|
89
|
-
type =
|
|
88
|
+
type = typeFromJSONAndFileContext(json, fileContext);
|
|
89
|
+
|
|
90
|
+
const variable = new Variable(node, type);
|
|
90
91
|
|
|
91
|
-
|
|
92
|
+
return variable;
|
|
93
|
+
}
|
|
92
94
|
|
|
93
|
-
|
|
95
|
+
static fromVariableAndType(variable, type) {
|
|
96
|
+
const node = variable.getNode();
|
|
94
97
|
|
|
95
|
-
|
|
98
|
+
variable = new Variable(node, type); ///
|
|
96
99
|
|
|
97
100
|
return variable;
|
|
98
101
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import NodeVerifier from "../../verifier/node";
|
|
4
4
|
import verifyStatement from "../../verify/statement";
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { verifyType, verifyStandaloneTerm } from "./../../verifier/node/termAsConstructor";
|
|
7
7
|
import { TYPE_RULE_NAME, TERM_RULE_NAME, STATEMENT_RULE_NAME } from "../../ruleNames";
|
|
8
8
|
|
|
9
9
|
class StatementAsCombinatorNodeVerifier extends NodeVerifier {
|
package/src/verify/axiom.js
CHANGED
|
@@ -4,7 +4,7 @@ import Axiom from "../axiom";
|
|
|
4
4
|
import LocalContext from "../context/local";
|
|
5
5
|
import verifyLabels from "../verify/labels";
|
|
6
6
|
import verifyConsequent from "../verify/consequent";
|
|
7
|
-
import
|
|
7
|
+
import verifySuppositions from "../verify/suppositions";
|
|
8
8
|
|
|
9
9
|
import { first } from "../utilities/array";
|
|
10
10
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
@@ -28,13 +28,7 @@ export default function verifyAxiom(axiomNode, fileContext) {
|
|
|
28
28
|
if (labelsVerified) {
|
|
29
29
|
const suppositions = [],
|
|
30
30
|
suppositionNodes = suppositionsNodeQuery(axiomNode),
|
|
31
|
-
suppositionsVerified = suppositionNodes
|
|
32
|
-
const suppositionVerified = verifySupposition(suppositionNode, suppositions, localContext);
|
|
33
|
-
|
|
34
|
-
if (suppositionVerified) {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
31
|
+
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
38
32
|
|
|
39
33
|
if (suppositionsVerified) {
|
|
40
34
|
const consequents = [],
|
package/src/verify/conclusion.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Conclusion from "../conclusion";
|
|
4
|
-
import verifyUnqualifiedMetastatement from "
|
|
4
|
+
import verifyUnqualifiedMetastatement from "../verify/metastatement/unqualified";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
7
7
|
|
package/src/verify/conjecture.js
CHANGED
|
@@ -4,8 +4,8 @@ import Conjecture from "../conjecture";
|
|
|
4
4
|
import verifyProof from "../verify/proof";
|
|
5
5
|
import LocalContext from "../context/local";
|
|
6
6
|
import verifyLabels from "../verify/labels";
|
|
7
|
-
import verifyConsequent from "
|
|
8
|
-
import
|
|
7
|
+
import verifyConsequent from "../verify/consequent";
|
|
8
|
+
import verifySuppositions from "../verify/suppositions";
|
|
9
9
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
@@ -30,13 +30,7 @@ export default function verifyConjecture(conjectureNode, fileContext) {
|
|
|
30
30
|
if (labelsVerified) {
|
|
31
31
|
const suppositions = [],
|
|
32
32
|
suppositionNodes = suppositionsNodeQuery(conjectureNode),
|
|
33
|
-
suppositionsVerified = suppositionNodes
|
|
34
|
-
const suppositionVerified = verifySupposition(suppositionNode, suppositions, localContext);
|
|
35
|
-
|
|
36
|
-
if (suppositionVerified) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
33
|
+
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
40
34
|
|
|
41
35
|
if (suppositionsVerified) {
|
|
42
36
|
const consequents = [],
|
package/src/verify/derivation.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import ProofStep from "../step/proof";
|
|
4
4
|
import LocalContext from "../context/local";
|
|
5
|
-
import
|
|
5
|
+
import verifySuppositions from "../verify/suppositions";
|
|
6
6
|
import verifyQualifiedStatement from "../verify/statement/qualified";
|
|
7
7
|
import verifyUnqualifiedStatement from "../verify/statement/unqualified";
|
|
8
8
|
|
|
@@ -53,13 +53,7 @@ function verifySubproof(subproofNode, localContext) {
|
|
|
53
53
|
|
|
54
54
|
const suppositions = [],
|
|
55
55
|
suppositionNodes = suppositionNodesQuery(subproofNode),
|
|
56
|
-
suppositionsVerified = suppositionNodes
|
|
57
|
-
const suppositionVerified = verifySupposition(suppositionNode, suppositions, localContext);
|
|
58
|
-
|
|
59
|
-
if (suppositionVerified) {
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
62
|
-
});
|
|
56
|
+
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
63
57
|
|
|
64
58
|
if (suppositionsVerified) {
|
|
65
59
|
const subDerivationNode = subDerivationNodeQuery(subproofNode),
|
package/src/verify/equality.js
CHANGED
|
@@ -19,7 +19,7 @@ export default function verifyEquality(equalityNode, assignments, derived, conte
|
|
|
19
19
|
|
|
20
20
|
const verifyEqualityFunctions = [
|
|
21
21
|
verifyDerivedEquality,
|
|
22
|
-
|
|
22
|
+
verifyGivenEquality
|
|
23
23
|
];
|
|
24
24
|
|
|
25
25
|
equalityVerified = verifyEqualityFunctions.some((verifyEqualityFunction) => {
|
|
@@ -82,13 +82,13 @@ function verifyDerivedEquality(equalityNode, assignments, derived, context, veri
|
|
|
82
82
|
return derivedEqualityVerified;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
function
|
|
86
|
-
let
|
|
85
|
+
function verifyGivenEquality(equalityNode, assignments, derived, context, verifyAhead) {
|
|
86
|
+
let givenEqualityVerified = false;
|
|
87
87
|
|
|
88
88
|
if (!derived) {
|
|
89
89
|
const equalityString = context.nodeAsString(equalityNode);
|
|
90
90
|
|
|
91
|
-
context.trace(`Verifying the '${equalityString}'
|
|
91
|
+
context.trace(`Verifying the '${equalityString}' given equality...`, equalityNode);
|
|
92
92
|
|
|
93
93
|
const terms = [],
|
|
94
94
|
leftTermNode = leftTermNodeQuery(equalityNode),
|
|
@@ -122,12 +122,12 @@ function verifyStandaloneEquality(equalityNode, assignments, derived, context, v
|
|
|
122
122
|
return verifiedAhead;
|
|
123
123
|
});
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
givenEqualityVerified = termsVerified; ///
|
|
126
126
|
|
|
127
|
-
if (
|
|
128
|
-
context.trace(`...verified the '${equalityString}'
|
|
127
|
+
if (givenEqualityVerified) {
|
|
128
|
+
context.trace(`...verified the '${equalityString}' given equality.`, equalityNode);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
return
|
|
132
|
+
return givenEqualityVerified;
|
|
133
133
|
}
|
package/src/verify/lemma.js
CHANGED
|
@@ -4,8 +4,8 @@ import Lemma from "../lemma";
|
|
|
4
4
|
import verifyProof from "../verify/proof";
|
|
5
5
|
import LocalContext from "../context/local";
|
|
6
6
|
import verifyLabels from "../verify/labels";
|
|
7
|
-
import verifyConsequent from "
|
|
8
|
-
import
|
|
7
|
+
import verifyConsequent from "../verify/consequent";
|
|
8
|
+
import verifySuppositions from "../verify/suppositions";
|
|
9
9
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { EMPTY_STRING } from "../constants";
|
|
@@ -33,13 +33,7 @@ export default function verifyLemma(lemmaNode, fileContext) {
|
|
|
33
33
|
if (labelsVerified) {
|
|
34
34
|
const suppositions = [],
|
|
35
35
|
suppositionNodes = suppositionsNodeQuery(lemmaNode),
|
|
36
|
-
suppositionsVerified = suppositionNodes
|
|
37
|
-
const suppositionVerified = verifySupposition(suppositionNode, suppositions, localContext);
|
|
38
|
-
|
|
39
|
-
if (suppositionVerified) {
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
36
|
+
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
43
37
|
|
|
44
38
|
if (suppositionsVerified) {
|
|
45
39
|
const consequents = [],
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import verifyPremise from "../verify/premise";
|
|
4
|
+
|
|
5
|
+
export default function verifyPremises(premiseNodes, premises, localMetaContext) {
|
|
6
|
+
let premisesVerified;
|
|
7
|
+
|
|
8
|
+
premisesVerified = premiseNodes.every((premiseNode) => {
|
|
9
|
+
const premiseVerified = verifyPremise(premiseNode, premises, localMetaContext);
|
|
10
|
+
|
|
11
|
+
if (premiseVerified) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
return premisesVerified;
|
|
17
|
+
}
|
package/src/verify/rule.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import Rule from "../rule";
|
|
4
4
|
import verifyLabels from "../verify/labels";
|
|
5
|
-
import
|
|
5
|
+
import verifyPremises from "../verify/premises";
|
|
6
6
|
import verifyRuleProof from "../verify/ruleProof";
|
|
7
7
|
import LocalMetaContext from "../context/localMeta";
|
|
8
8
|
import verifyConclusion from "../verify/conclusion";
|
|
@@ -30,13 +30,7 @@ export default function verifyRule(ruleNode, fileContext) {
|
|
|
30
30
|
if (labelsVerified) {
|
|
31
31
|
const premises = [],
|
|
32
32
|
premiseNodes = premisesNodeQuery(ruleNode),
|
|
33
|
-
premisesVerified = premiseNodes
|
|
34
|
-
const premiseVerified = verifyPremise(premiseNode, premises, localMetaContext);
|
|
35
|
-
|
|
36
|
-
if (premiseVerified) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
33
|
+
premisesVerified = verifyPremises(premiseNodes, premises, localMetaContext);
|
|
40
34
|
|
|
41
35
|
if (premisesVerified) {
|
|
42
36
|
const conclusions = [],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import MetaproofStep from "../step/metaproof";
|
|
4
|
-
import
|
|
4
|
+
import verifyPremises from "../verify/premises";
|
|
5
5
|
import LocalMetaContext from "../context/localMeta";
|
|
6
6
|
import verifyQualifiedMetastatement from "../verify/metastatement/qualified";
|
|
7
7
|
import verifyUnqualifiedMetastatement from "../verify/metastatement/unqualified";
|
|
@@ -53,13 +53,11 @@ function verifyRuleSubproof(ruleSubproofNode, localMetaContext) {
|
|
|
53
53
|
|
|
54
54
|
const premises = [],
|
|
55
55
|
premiseNodes = premiseNodesQuery(ruleSubproofNode),
|
|
56
|
-
premisesVerified = premiseNodes
|
|
57
|
-
const premiseVerified = verifyPremise(premiseNode, premises, localMetaContext);
|
|
56
|
+
premisesVerified = verifyPremises(premiseNodes, premises, localMetaContext);
|
|
58
57
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
});
|
|
58
|
+
if (premiseVerified) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
63
61
|
|
|
64
62
|
if (premisesVerified) {
|
|
65
63
|
const ruleSubDerivationNode = ruleSubDerivationNodeQuery(ruleSubproofNode),
|
|
@@ -9,7 +9,7 @@ import { nodeQuery } from "../utilities/query";
|
|
|
9
9
|
const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!"),
|
|
10
10
|
unqualifiedStatementNodeQuery = nodeQuery("/supposition/unqualifiedStatement!");
|
|
11
11
|
|
|
12
|
-
export default function verifySupposition(suppositionNode, suppositions, localContext) {
|
|
12
|
+
export default function verifySupposition(suppositionNode, suppositions, assignments, localContext) {
|
|
13
13
|
let suppositionVerified;
|
|
14
14
|
|
|
15
15
|
const suppositionString = localContext.nodeAsString(suppositionNode);
|
|
@@ -17,7 +17,6 @@ export default function verifySupposition(suppositionNode, suppositions, localCo
|
|
|
17
17
|
localContext.trace(`Verifying the '${suppositionString}' supposition...`, suppositionNode);
|
|
18
18
|
|
|
19
19
|
const derived = false,
|
|
20
|
-
assignments = [],
|
|
21
20
|
unqualifiedStatementNode = unqualifiedStatementNodeQuery(suppositionNode),
|
|
22
21
|
unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, assignments, derived, localContext);
|
|
23
22
|
|
|
@@ -30,14 +29,6 @@ export default function verifySupposition(suppositionNode, suppositions, localCo
|
|
|
30
29
|
|
|
31
30
|
localContext.addProofStep(proofStep);
|
|
32
31
|
|
|
33
|
-
assignments.every((assignment) => {
|
|
34
|
-
const assigned = assignment.assign(localContext);
|
|
35
|
-
|
|
36
|
-
if (assigned) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
32
|
suppositionVerified = true;
|
|
42
33
|
}
|
|
43
34
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import verifySupposition from "../verify/supposition";
|
|
4
|
+
|
|
5
|
+
export default function verifySuppositions(suppositionNodes, suppositions, localContext) {
|
|
6
|
+
let suppositionsVerified;
|
|
7
|
+
|
|
8
|
+
const assignments = [];
|
|
9
|
+
|
|
10
|
+
suppositionsVerified = suppositionNodes.every((suppositionNode) => {
|
|
11
|
+
const suppositionVerified = verifySupposition(suppositionNode, suppositions, assignments, localContext);
|
|
12
|
+
|
|
13
|
+
if (suppositionVerified) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
if (suppositionsVerified) {
|
|
19
|
+
suppositionsVerified = assignments.every((assignment) => { ///
|
|
20
|
+
const assigned = assignment.assign(localContext);
|
|
21
|
+
|
|
22
|
+
if (assigned) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return suppositionsVerified;
|
|
29
|
+
}
|
package/src/verify/term.js
CHANGED
|
@@ -67,13 +67,11 @@ export function verifyTermAsVariable(termNode, variables, context, verifyAhead)
|
|
|
67
67
|
|
|
68
68
|
context.trace(`Verifying the '${termString}' term as a variable...`, termNode);
|
|
69
69
|
|
|
70
|
-
const
|
|
70
|
+
const variable = context.findVariableByVariableNode(variableNode);
|
|
71
71
|
|
|
72
|
-
if (
|
|
72
|
+
if (variable !== null) {
|
|
73
73
|
let verifiedAhead;
|
|
74
74
|
|
|
75
|
-
const variable = context.findVariableByVariableNode(variableNode);
|
|
76
|
-
|
|
77
75
|
variables.push(variable);
|
|
78
76
|
|
|
79
77
|
verifiedAhead = verifyAhead();
|
package/src/verify/theorem.js
CHANGED
|
@@ -5,7 +5,7 @@ import verifyProof from "../verify/proof";
|
|
|
5
5
|
import LocalContext from "../context/local";
|
|
6
6
|
import verifyLabels from "../verify/labels";
|
|
7
7
|
import verifyConsequent from "../verify/consequent";
|
|
8
|
-
import
|
|
8
|
+
import verifySuppositions from "../verify/suppositions";
|
|
9
9
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
@@ -30,13 +30,7 @@ export default function verifyTheorem(theoremNode, fileContext) {
|
|
|
30
30
|
if (labelsVerified) {
|
|
31
31
|
const suppositions = [],
|
|
32
32
|
suppositionNodes = suppositionsNodeQuery(theoremNode),
|
|
33
|
-
suppositionsVerified = suppositionNodes
|
|
34
|
-
const suppositionVerified = verifySupposition(suppositionNode, suppositions, localContext);
|
|
35
|
-
|
|
36
|
-
if (suppositionVerified) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
33
|
+
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
40
34
|
|
|
41
35
|
if (suppositionsVerified) {
|
|
42
36
|
const consequents = [],
|