Class: BinaryFormula

Inherits:
Object
  • Object
show all
Defined in:
lib/dpll_solver/formulas/binary_formula.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(f1, f2) ⇒ BinaryFormula

Returns a new instance of BinaryFormula.



3
4
5
6
# File 'lib/dpll_solver/formulas/binary_formula.rb', line 3

def initialize(f1, f2)
  @f1 = f1
  @f2 = f2
end

Instance Attribute Details

#f1Object

Returns the value of attribute f1.



2
3
4
# File 'lib/dpll_solver/formulas/binary_formula.rb', line 2

def f1
  @f1
end

#f2Object

Returns the value of attribute f2.



2
3
4
# File 'lib/dpll_solver/formulas/binary_formula.rb', line 2

def f2
  @f2
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?

syntactic equivalenz



8
9
10
# File 'lib/dpll_solver/formulas/binary_formula.rb', line 8

def ==(other)
  other.class == self.class && other.f1 == @f1 && other.f2 == @f2
end

#atomic_formula?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/dpll_solver/formulas/binary_formula.rb', line 17

def atomic_formula?
  false
end

#dnf?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/dpll_solver/formulas/binary_formula.rb', line 25

def dnf?
  @f1.dnf? && @f2.dnf?
end

#literal?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/dpll_solver/formulas/binary_formula.rb', line 13

def literal?
  false
end

#nnfObject



29
30
31
# File 'lib/dpll_solver/formulas/binary_formula.rb', line 29

def nnf
  self.class.new(@f1.nnf, @f2.nnf)
end

#nnf?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/dpll_solver/formulas/binary_formula.rb', line 21

def nnf?
  @f1.nnf? && @f2.nnf?
end