conjunctive-normal-form

Algorithm for evaluating nested logical expression

孤街醉人 提交于 2019-12-22 06:41:36
问题 I have a logical expression that I would like to evaluate. The expression can be nested and consists of T (True) or F (False) and parenthesis. The parenthesis "(" means "logical OR". Two terms TF beside each others (or any other two combinations beside each others), should be ANDED (Logical AND). For example, the expression: ((TFT)T) = true I need an algorithm for solving this problem. I thought of converting the expression first to disjunctive or conjunctive normal form and then I can easily

Converting an expression to conjunctive normal form with a twist

梦想与她 提交于 2019-12-08 00:49:56
问题 I've got a library that I have to interface with which acts basically as a data source. When retrieving data, I can pass special "filter expressions" to that library, which later get translated to SQL WHERE part. These expressions are pretty limited. They must be in conjunctive normal form. Like: (A or B or C) and (D or E or F) and ... This of course isn't very comfortable for programming. So I want to make a little wrapper which can parse arbitrary expressions and translate them to this

Converting an expression to conjunctive normal form with a twist

眉间皱痕 提交于 2019-12-06 11:31:10
I've got a library that I have to interface with which acts basically as a data source. When retrieving data, I can pass special "filter expressions" to that library, which later get translated to SQL WHERE part. These expressions are pretty limited. They must be in conjunctive normal form. Like: (A or B or C) and (D or E or F) and ... This of course isn't very comfortable for programming. So I want to make a little wrapper which can parse arbitrary expressions and translate them to this normal form. Like: (A and (B or C) and D) or E would get translated to something like: (A or E) and (B or C