UNPKG

chop-logic-core

Version:

Core classes, methods and functions for calculating logical formulas and constructing proofs within the Chop Logic project.

18 lines (17 loc) 870 B
import type { PropFormula, PropFormulaVariablesMap } from "../../models"; /** * Evaluates a propositional formula based on a given truth assignment. * * @param {Object} params - Function parameters: * @param {PropFormula} params.formula - The propositional formula in tree-like structure. * @param {boolean[]} params.assignment - The truth assignment for the variables. * @param {variablesMap} [params.variablesMap] - The map of formula variables ordered alphabetically * @returns {boolean} - The boolean result of the evaluated formula. * @throws {Error} If the number of variables in the formula does not match the assignment length. * @category Evaluators */ export declare function calculatePropFormula({ formula, assignment, variablesMap, }: { formula: PropFormula; assignment: boolean[]; variablesMap?: PropFormulaVariablesMap; }): boolean;