Module: PropLogic::Functions
Overview
Utility methods for PropLogic.
Class Method Summary collapse
-
.all_and(*args) ⇒ Term
Combine all terms with and.
-
.all_or(*args) ⇒ Term
Combine all terms with or.
-
.new_variable(*args) ⇒ Object
Create new variable.
-
.sat_loop(initial_term) {|Term, IncrementalSolver| ... } ⇒ Object
loop while satisfiable.
Class Method Details
.all_and(*args) ⇒ Term
Combine all terms with and.
19 20 21 |
# File 'lib/prop_logic/functions.rb', line 19 def all_and(*args) Term.get AndTerm, *args end |
.all_or(*args) ⇒ Term
Combine all terms with or.
12 13 14 |
# File 'lib/prop_logic/functions.rb', line 12 def all_or(*args) Term.get OrTerm, *args end |
.new_variable(*args) ⇒ Object
Create new variable.
24 25 26 |
# File 'lib/prop_logic/functions.rb', line 24 def new_variable(*args) Variable.new(*args) end |
.sat_loop(initial_term) {|Term, IncrementalSolver| ... } ⇒ Object
loop while satisfiable. Note: Loop continues infinitely if no addition was given inside the loop.
31 32 33 34 35 36 37 38 |
# 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 |