class Satre::And

Attributes

left_conjunct[R]
right_conjunct[R]

Public Class Methods

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

Public Instance Methods

atoms() click to toggle source
# File lib/satre/formula/propositional_logic/and.rb, line 32
def atoms
  atoms = left_conjunct.atoms + right_conjunct.atoms
  atoms.uniq || []
end
eval(valudation) click to toggle source
# File lib/satre/formula/propositional_logic/and.rb, line 28
def eval(valudation)
  left_conjunct.eval(valudation) && right_conjunct.eval(valudation)
end
holds?(domain, func, pred, valudation) click to toggle source
# File lib/satre/formula/propositional_logic/and.rb, line 19
def holds?(domain, func, pred, valudation)
  left_conjunct.holds?(domain, func, pred, valudation) && right_conjunct.holds?(domain, func, pred, valudation)
end
to_s() click to toggle source
# File lib/satre/formula/propositional_logic/and.rb, line 15
def to_s
  "(#{left_conjunct} ∧ #{right_conjunct})"
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/and.rb, line 24
def wellformed?(sig)
  left_conjunct.wellformed?(sig) && right_conjunct.wellformed(sig)
end