Conditions | 2 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
1 | module PropLogic |
||
3 | class << self |
||
4 | def call(term) |
||
5 | # obvious value |
||
6 | return True if term == True |
||
7 | variables = term.variables |
||
8 | PropLogic.all_combination(variables) do |trues| |
||
9 | falses = variables - trues |
||
10 | next unless term.assign(trues, falses).reduce == True |
||
11 | # SAT |
||
12 | negated_falses = falses.map(&:not) |
||
13 | return PropLogic.all_and(*trues, *negated_falses) |
||
14 | end |
||
15 | # UNSAT |
||
16 | false |
||
17 | end |
||
21 |