Sha256: 35aaba2c3cfcec51921079bc858278706071fd5f90229ff3f433f9b48b9174d2
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
module DpllSolver module Formulas class And < BinaryFormula def to_s "(#{@f1.to_s} AND #{@f2.to_s})" end def clause? false end def min_term? @f1.min_term? && @f2.min_term? end def cnf? @f1.cnf? && @f2.cnf? end def and? true end def verum? false end alias falsum? verum? alias not? verum? alias or? verum? alias variable? verum? def simplify res_f1 = @f1.simplify res_f2 = @f2.simplify if res_f1.verum? #identity return res_f2 elsif res_f2.verum? #identity return res_f1 elsif res_f1.falsum? || res_f2.falsum? #anihilator return DpllSolver::Formulas::Falsum elsif res_f1 == res_f2 #idempotence return res_f1 else return self.class.new(res_f1, res_f2) end end def cnf nnf? ? self.class.new(@f1.cnf, @f2.cnf) : nnf.cnf end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dpll_solver-0.0.1 | lib/dpll_solver/formulas/and.rb |