Minimize store queries
This commit is contained in:
1 parent
03840ea7ea
commit
00ccf99be6
11 files changed
+1234
-519
No files matched your search
@@ -18,8 +18,6 @@
|
||||
*/
|
||||
|
||||
import { map, mapAsync, parseLikePattern } from "./expression-parser";
|
||||
import { booleanCnf } from "./expression-cnf";
|
||||
import { naiveDpll } from "./sat-solver";
|
||||
import { Expression } from "../types";
|
||||
|
||||
const isArray = Array.isArray;
|
||||
@@ -317,18 +315,6 @@ export function or(exp1: Expression, exp2: Expression): Expression {
|
||||
return res;
|
||||
}
|
||||
|
||||
export function not(exp: Expression): Expression {
|
||||
if (isArray(exp) && exp[0] === "NOT") return exp[1];
|
||||
return ["NOT", exp];
|
||||
}
|
||||
|
||||
export function subset(exp1: Expression, exp2: Expression): boolean {
|
||||
const e = evaluate(["NOT", ["OR", ["NOT", exp1], exp2]]);
|
||||
if (!isArray(e)) return !e;
|
||||
const { vars, clauses } = booleanCnf(e);
|
||||
return !naiveDpll(clauses, vars);
|
||||
}
|
||||
|
||||
export function extractParams(exp: Expression): Expression[] {
|
||||
const params = new Set<Expression>();
|
||||
map(exp, (e) => {
|
||||
|
||||
Reference in new issue
Block a user