forked from ethereum/solc-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
smtchecker.js
30 lines (26 loc) · 934 Bytes
/
smtchecker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// This function checks the standard JSON output for auxiliaryInputRequested,
// where smtlib2queries represent the queries created by the SMTChecker.
// The function runs an SMT solver on each query and adjusts the input for
// another run.
// Returns null if no solving is requested.
function handleSMTQueries (inputJSON, outputJSON, solver) {
var auxInputReq = outputJSON.auxiliaryInputRequested;
if (!auxInputReq) {
return null;
}
var queries = auxInputReq.smtlib2queries;
if (!queries || Object.keys(queries).length === 0) {
return null;
}
var responses = {};
for (var query in queries) {
responses[query] = solver(queries[query]);
}
// Note: all existing solved queries are replaced.
// This assumes that all neccessary queries are quested above.
inputJSON.auxiliaryInput = { smtlib2responses: responses };
return inputJSON;
}
module.exports = {
handleSMTQueries: handleSMTQueries
};