class Satre::Iff

Attributes

left_conditional[R]
right_conditional[R]

Public Class Methods

new(left_conditional, right_conditional) click to toggle source
# File lib/satre/formula/propositional_logic/iff.rb, line 8
def initialize(left_conditional, right_conditional)
  fail(ArgumentError, 'Argument must be a Formula') unless left_conditional.is_a?(Formula)
  fail(ArgumentError, 'Argument must be a Formula') unless right_conditional.is_a?(Formula)
  @left_conditional = left_conditional.dup.freeze
  @right_conditional = right_conditional.dup.freeze
end

Public Instance Methods

atoms() click to toggle source
# File lib/satre/formula/propositional_logic/iff.rb, line 32
def atoms
  atoms = left_conditional.atoms + right_conditional.atoms
  atoms.uniq || []
end
eval(valudation) click to toggle source
# File lib/satre/formula/propositional_logic/iff.rb, line 28
def eval(valudation)
  left_conditional.eval(valudation) == right_conditional.eval(valudation)
end
holds?(domain, func, pred, valudation) click to toggle source
# File lib/satre/formula/propositional_logic/iff.rb, line 15
def holds?(domain, func, pred, valudation)
  left_conditional.holds?(domain, func, pred, valudation) == right_conditional.holds?(domain, func, pred, valudation)
end
to_s() click to toggle source
# File lib/satre/formula/propositional_logic/iff.rb, line 24
def to_s
  "(#{left_conditional} ⇔ #{right_conditional})"
end
wellformed?(sig) click to toggle source

p <=> q is well-formed if p and q are well-formed

# File lib/satre/formula/propositional_logic/iff.rb, line 20
def wellformed?(sig)
  left_conjunct.wellformed?(sig) && right_conjunct.wellformed(sig)
end