occam-verify-cli 0.0.1189 → 0.0.1190
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/dom/assertion/subproof.js +10 -9
- package/lib/dom/declaration/metavariable.js +6 -2
- package/lib/dom/derivation.js +9 -5
- package/lib/dom/equality.js +10 -2
- package/lib/dom/frame.js +16 -8
- package/lib/dom/judgement.js +10 -2
- package/lib/dom/procedureCall.js +11 -3
- package/lib/dom/rule.js +24 -8
- package/lib/dom/subDerivation.js +9 -5
- package/lib/dom/subproof.js +13 -5
- package/lib/dom/term.js +10 -16
- package/lib/dom/topLevelAssertion.js +24 -8
- package/lib/dom/type.js +10 -2
- package/lib/dom/variable.js +6 -2
- package/package.json +1 -1
- package/src/dom/assertion/subproof.js +16 -15
- package/src/dom/declaration/metavariable.js +10 -3
- package/src/dom/derivation.js +15 -9
- package/src/dom/equality.js +20 -7
- package/src/dom/frame.js +27 -14
- package/src/dom/judgement.js +19 -6
- package/src/dom/procedureCall.js +11 -3
- package/src/dom/rule.js +44 -17
- package/src/dom/subDerivation.js +15 -9
- package/src/dom/subproof.js +23 -10
- package/src/dom/term.js +14 -23
- package/src/dom/topLevelAssertion.js +44 -17
- package/src/dom/type.js +18 -6
- package/src/dom/variable.js +12 -6
- package/lib/dom/proofStep.old.js +0 -246
- package/src/dom/proofStep.old.js +0 -183
package/src/dom/proofStep.old.js
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import dom from "../dom";
|
|
4
|
-
import unifyMixins from "../mixins/proofStep/unify";
|
|
5
|
-
import Substitutions from "../substitutions";
|
|
6
|
-
|
|
7
|
-
import { domAssigned } from "../dom";
|
|
8
|
-
import { assignAssignments } from "../utilities/assignments";
|
|
9
|
-
|
|
10
|
-
export default domAssigned(class ProofStep {
|
|
11
|
-
constructor(string, subproof, statement, reference) {
|
|
12
|
-
this.string = string;
|
|
13
|
-
this.subproof = subproof;
|
|
14
|
-
this.statement = statement;
|
|
15
|
-
this.reference = reference;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
getString() {
|
|
19
|
-
return this.string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
getSubproof() {
|
|
23
|
-
return this.subproof;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
getStatement() {
|
|
27
|
-
return this.statement;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
getReference() {
|
|
31
|
-
return this.reference;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
isQualified() {
|
|
35
|
-
const qualified = (this.reference !== null);
|
|
36
|
-
|
|
37
|
-
return qualified;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
unify(substitutions, context) {
|
|
41
|
-
let unified;
|
|
42
|
-
|
|
43
|
-
if (this.subproof !== null) {
|
|
44
|
-
unified = true; ///
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (this.statement !== null) {
|
|
48
|
-
const proofStepString = this.string; ///
|
|
49
|
-
|
|
50
|
-
context.trace(`Unifying the '${proofStepString}' proof step...`);
|
|
51
|
-
|
|
52
|
-
unified = unifyMixins.some((unifyMixin) => {
|
|
53
|
-
const unified = unifyMixin(this.statement, this.reference, substitutions, context);
|
|
54
|
-
|
|
55
|
-
if (unified) {
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
if (unified) {
|
|
61
|
-
context.debug(`...unified the '${proofStepString}' proof step.`);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return unified;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
unifyStatement(statement, context) {
|
|
69
|
-
let statementUnified;
|
|
70
|
-
|
|
71
|
-
const specificContext = context, ///
|
|
72
|
-
generalContext = context, ///
|
|
73
|
-
substitutions = Substitutions.fromNothing();
|
|
74
|
-
|
|
75
|
-
if (this.subproof !== null) {
|
|
76
|
-
const subproofUnified = statement.unifySubproof(this.subproof, substitutions, generalContext, specificContext);
|
|
77
|
-
|
|
78
|
-
statementUnified = subproofUnified; ///
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (this.statement !== null) {
|
|
82
|
-
statementUnified = statement.unifyStatement(this.statement, substitutions, generalContext, specificContext);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (statementUnified) {
|
|
86
|
-
const equivalences = context.getEquivalences(),
|
|
87
|
-
substitutionsUnified = equivalences.unifySubstitutions(substitutions);
|
|
88
|
-
|
|
89
|
-
statementUnified = substitutionsUnified; ///
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return statementUnified;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
verifyAndUnify(substitutions, context) {
|
|
96
|
-
let verifiedAndUnified = false;
|
|
97
|
-
|
|
98
|
-
const assignments = [],
|
|
99
|
-
verified = this.verify(substitutions, assignments, context);
|
|
100
|
-
|
|
101
|
-
if (verified) {
|
|
102
|
-
const unified = this.unify(substitutions, context);
|
|
103
|
-
|
|
104
|
-
if (unified) {
|
|
105
|
-
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
106
|
-
|
|
107
|
-
if (assignmentsAssigned) {
|
|
108
|
-
const proofStep = this; ///
|
|
109
|
-
|
|
110
|
-
context.addProofStep(proofStep);
|
|
111
|
-
|
|
112
|
-
verifiedAndUnified = true; ///
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return verifiedAndUnified;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
verify(substitutions, assignments, context) {
|
|
121
|
-
let verified = false;
|
|
122
|
-
|
|
123
|
-
if (false) {
|
|
124
|
-
///
|
|
125
|
-
} else if (this.subproof !== null) {
|
|
126
|
-
const subproofVerified = this.subproof.verify(substitutions, context);
|
|
127
|
-
|
|
128
|
-
verified = subproofVerified; ///
|
|
129
|
-
} else if (this.statement !== null) {
|
|
130
|
-
const proofStepString = this.string; ///
|
|
131
|
-
|
|
132
|
-
context.trace(`Verifying the '${proofStepString}' proof step...`);
|
|
133
|
-
|
|
134
|
-
const qualified = this.isQualified(),
|
|
135
|
-
stated = qualified, ///
|
|
136
|
-
statementVerified = this.statement.verify(assignments, stated, context);
|
|
137
|
-
|
|
138
|
-
if (statementVerified) {
|
|
139
|
-
if (this.reference === null) {
|
|
140
|
-
verified = true;
|
|
141
|
-
} else {
|
|
142
|
-
const referenceVerified = this.reference.verify(context);
|
|
143
|
-
|
|
144
|
-
verified = referenceVerified; ///
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (verified) {
|
|
149
|
-
context.debug(`...verified the '${proofStepString}' proof step.`);
|
|
150
|
-
}
|
|
151
|
-
} else {
|
|
152
|
-
const proofStepString = this.string;
|
|
153
|
-
|
|
154
|
-
context.debug(`Cannot verify the '${proofStepString}' proof step because it is nonsense.`);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return verified;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
static name = "ProofStep";
|
|
161
|
-
|
|
162
|
-
static fromStatement(statement, context) {
|
|
163
|
-
const statementString = statement.getString(),
|
|
164
|
-
string = statementString, ///
|
|
165
|
-
subproof = null,
|
|
166
|
-
reference = null,
|
|
167
|
-
proofStep = new ProofStep(string, subproof, statement, reference);
|
|
168
|
-
|
|
169
|
-
return proofStep;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
static fromProofStepNode(proofStepNode, fileContext) {
|
|
173
|
-
const { Subproof, Statement, Reference } = dom,
|
|
174
|
-
node = proofStepNode, ///
|
|
175
|
-
string = fileContext.nodeAsString(node),
|
|
176
|
-
subproof = Subproof.fromProofStepNode(proofStepNode, fileContext),
|
|
177
|
-
statement = Statement.fromProofStepNode(proofStepNode, fileContext),
|
|
178
|
-
reference = Reference.fromProofStepNode(proofStepNode, fileContext),
|
|
179
|
-
proofStep = new ProofStep(string, subproof, statement, reference);
|
|
180
|
-
|
|
181
|
-
return proofStep;
|
|
182
|
-
}
|
|
183
|
-
});
|