occam-verify-cli 0.0.464 → 0.0.466
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/antecedent.js +214 -0
- package/lib/axiom.js +93 -78
- package/lib/axiomLemmaTheorem.js +190 -0
- package/lib/consequent.js +157 -0
- package/lib/constants.js +9 -1
- package/lib/lemma.js +93 -78
- package/lib/ruleNames.js +4 -4
- package/lib/substitution.js +123 -0
- package/lib/theorem.js +93 -78
- package/lib/utilities/statement.js +45 -0
- package/lib/utilities/string.js +6 -6
- package/lib/verify/antecedentOrAntecedents.js +38 -0
- package/lib/verify/axiom.js +15 -14
- package/lib/verify/conditinalIndicative.js +32 -0
- package/lib/verify/{indicativeConditional.js → conditionalIndicative.js} +10 -10
- package/lib/verify/consequent.js +36 -0
- package/lib/verify/derivation.js +1 -1
- package/lib/verify/lemma.js +25 -19
- package/lib/verify/proof.js +26 -11
- package/lib/verify/statement/qualified.js +16 -4
- package/lib/verify/theorem.js +22 -17
- package/lib/verify/unconditionalIndicative.js +28 -0
- package/package.json +3 -3
- package/src/antecedent.js +235 -0
- package/src/axiom.js +5 -95
- package/src/axiomLemmaTheorem.js +190 -0
- package/src/consequent.js +187 -0
- package/src/constants.js +2 -0
- package/src/lemma.js +5 -95
- package/src/ruleNames.js +1 -1
- package/src/substitution.js +130 -0
- package/src/theorem.js +5 -95
- package/src/utilities/statement.js +50 -0
- package/src/utilities/string.js +6 -6
- package/src/verify/antecedentOrAntecedents.js +40 -0
- package/src/verify/axiom.js +21 -16
- package/src/verify/conditinalIndicative.js +31 -0
- package/src/verify/conditionalIndicative.js +29 -0
- package/src/verify/consequent.js +36 -0
- package/src/verify/derivation.js +1 -1
- package/src/verify/lemma.js +38 -21
- package/src/verify/proof.js +32 -14
- package/src/verify/statement/qualified.js +15 -6
- package/src/verify/theorem.js +32 -20
- package/src/verify/unconditionalIndicative.js +24 -0
- package/src/verify/indicativeConditional.js +0 -29
package/src/verify/theorem.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Theorem from "../theorem";
|
|
4
|
-
import
|
|
4
|
+
import verifyProof from "../verify/proof";
|
|
5
5
|
import ProofContext from "../context/proof";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import verifyLabels from "../verify/labels";
|
|
7
|
+
import verifyConditionalIndicative from "../verify/conditinalIndicative";
|
|
8
|
+
import verifyUnconditionalIndicative from "../verify/unconditionalIndicative";
|
|
8
9
|
|
|
10
|
+
import { first } from "../utilities/array";
|
|
9
11
|
import { nodesAsString } from "../utilities/string";
|
|
10
12
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
11
13
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
const proofNodeQuery = nodeQuery("/theorem/proof!"),
|
|
15
|
+
labelNodesQuery = nodesQuery("/theorem/label"),
|
|
16
|
+
conditionalIndicativeNodeQuery = nodeQuery("/theorem/conditionalIndicative!"),
|
|
17
|
+
unconditionalIndicativeNodeQuery = nodeQuery("/theorem/unconditionalIndicative!");
|
|
15
18
|
|
|
16
19
|
export default function verifyTheorem(theoremNode, fileContext) {
|
|
17
20
|
let theoremVerified = false;
|
|
@@ -25,29 +28,38 @@ export default function verifyTheorem(theoremNode, fileContext) {
|
|
|
25
28
|
fileContext.debug(`Verifying the '${labelsString}' theorem...`);
|
|
26
29
|
|
|
27
30
|
const labels = [],
|
|
28
|
-
|
|
31
|
+
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
29
32
|
|
|
30
33
|
if (labelsVerified) {
|
|
31
|
-
const
|
|
32
|
-
|
|
34
|
+
const antecedents = [],
|
|
35
|
+
consequents = [],
|
|
36
|
+
conditionalIndicativeNode = conditionalIndicativeNodeQuery(theoremNode),
|
|
37
|
+
unconditionalIndicativeNode = unconditionalIndicativeNodeQuery(theoremNode);
|
|
33
38
|
|
|
34
|
-
let
|
|
35
|
-
|
|
39
|
+
let conditionalIndicativeVerified = false,
|
|
40
|
+
unconditionalIndicativeVerified = false;
|
|
36
41
|
|
|
37
|
-
if (
|
|
38
|
-
|
|
42
|
+
if (conditionalIndicativeNode !== null) {
|
|
43
|
+
conditionalIndicativeVerified = verifyConditionalIndicative(conditionalIndicativeNode, antecedents, consequents, proofContext);
|
|
39
44
|
}
|
|
40
45
|
|
|
41
|
-
if (
|
|
42
|
-
|
|
46
|
+
if (unconditionalIndicativeNode !== null) {
|
|
47
|
+
unconditionalIndicativeVerified = verifyUnconditionalIndicative(unconditionalIndicativeNode, consequents, proofContext);
|
|
43
48
|
}
|
|
44
49
|
|
|
45
|
-
if (
|
|
46
|
-
const
|
|
50
|
+
if (conditionalIndicativeVerified || unconditionalIndicativeVerified) {
|
|
51
|
+
const proofNode = proofNodeQuery(theoremNode),
|
|
52
|
+
firstConsequent = first(consequents),
|
|
53
|
+
consequent = firstConsequent, ///
|
|
54
|
+
proofVerified = verifyProof(proofNode, consequent, proofContext);
|
|
55
|
+
|
|
56
|
+
if (proofVerified) {
|
|
57
|
+
const theorem = Theorem.fromLabelsAntecedentsAndConsequent(labels, antecedents, consequent);
|
|
47
58
|
|
|
48
|
-
|
|
59
|
+
fileContext.addTheorem(theorem);
|
|
49
60
|
|
|
50
|
-
|
|
61
|
+
theoremVerified = true;
|
|
62
|
+
}
|
|
51
63
|
}
|
|
52
64
|
}
|
|
53
65
|
|
|
@@ -57,7 +69,7 @@ export default function verifyTheorem(theoremNode, fileContext) {
|
|
|
57
69
|
|
|
58
70
|
theoremVerified ?
|
|
59
71
|
fileContext.complete(theoremNode) :
|
|
60
|
-
fileContext.
|
|
72
|
+
fileContext.complete(theoremNode);
|
|
61
73
|
|
|
62
74
|
return theoremVerified;
|
|
63
75
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import verifyConsequent from "../verify/consequent";
|
|
4
|
+
|
|
5
|
+
import { nodeQuery } from "../utilities/query";
|
|
6
|
+
|
|
7
|
+
const consequentNodeQuery = nodeQuery("/unconditionalIndicative/consequent!");
|
|
8
|
+
|
|
9
|
+
export default function verifyUnconditionalIndicative(conditionalIndicativeNode, consequents, proofContext) {
|
|
10
|
+
let unconditionalIndicativeVerified;
|
|
11
|
+
|
|
12
|
+
proofContext.begin(conditionalIndicativeNode);
|
|
13
|
+
|
|
14
|
+
const consequentNode = consequentNodeQuery(conditionalIndicativeNode),
|
|
15
|
+
consequentVerified = verifyConsequent(consequentNode, consequents, proofContext);
|
|
16
|
+
|
|
17
|
+
unconditionalIndicativeVerified = consequentVerified; ///
|
|
18
|
+
|
|
19
|
+
unconditionalIndicativeVerified ?
|
|
20
|
+
proofContext.complete(conditionalIndicativeNode) :
|
|
21
|
+
proofContext.halt(conditionalIndicativeNode);
|
|
22
|
+
|
|
23
|
+
return unconditionalIndicativeVerified;
|
|
24
|
+
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import verifyUnqualifiedStatement from "../verify/statement/unqualified";
|
|
4
|
-
|
|
5
|
-
import { nodesQuery } from "../utilities/query";
|
|
6
|
-
|
|
7
|
-
const unqualifiedStatementNodesQuery = nodesQuery("/indicativeConditional/unqualifiedStatement");
|
|
8
|
-
|
|
9
|
-
export default function verifyIndicativeConditional(indicativeConditionalNode, proofContext) {
|
|
10
|
-
let indicativeConditionalVerified;
|
|
11
|
-
|
|
12
|
-
proofContext.begin(indicativeConditionalNode);
|
|
13
|
-
|
|
14
|
-
const unqualifiedStatementNodes = unqualifiedStatementNodesQuery(indicativeConditionalNode);
|
|
15
|
-
|
|
16
|
-
indicativeConditionalVerified = unqualifiedStatementNodes.every((unqualifiedStatementNode) => {
|
|
17
|
-
const unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, proofContext);
|
|
18
|
-
|
|
19
|
-
if (unqualifiedStatementVerified) {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
indicativeConditionalVerified ?
|
|
25
|
-
proofContext.complete(indicativeConditionalNode) :
|
|
26
|
-
proofContext.halt(indicativeConditionalNode);
|
|
27
|
-
|
|
28
|
-
return indicativeConditionalVerified;
|
|
29
|
-
}
|