module PropLogic::Functions

Utility methods for PropLogic.

Public Instance Methods

all_and(*args) click to toggle source

Combine all terms with and. @param [Term] terms to combine @return [Term] combined term

# File lib/prop_logic/functions.rb, line 19
def all_and(*args)
  Term.get AndTerm, *args
end
all_or(*args) click to toggle source

Combine all terms with or. @param [Term] terms to combine @return [Term] combined term

# File lib/prop_logic/functions.rb, line 12
def all_or(*args)
  Term.get OrTerm, *args
end
new_variable(*args) click to toggle source

Create new variable.

# File lib/prop_logic/functions.rb, line 24
def new_variable(*args)
  Variable.new(*args)
end
sat_loop(initial_term) { |sat, incremental| ... } click to toggle source

loop while satisfiable. Note: Loop continues infinitely if no addition was given inside the loop. @yield [Term, IncrementalSolver] yield for each term.

# File lib/prop_logic/functions.rb, line 31
def sat_loop(initial_term)
  incremental = PropLogic.incremental_solver.new initial_term
  loop do
    sat = incremental.sat?
    break unless sat
    yield sat, incremental
  end
end