Class: Negation
- Inherits:
-
Object
- Object
- Negation
- Defined in:
- lib/logical/formulas/negation.rb
Instance Method Summary collapse
- #evaluate(interpretation) ⇒ Object
-
#initialize(f) ⇒ Negation
constructor
A new instance of Negation.
- #literals ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(f) ⇒ Negation
Returns a new instance of Negation.
4 5 6 |
# File 'lib/logical/formulas/negation.rb', line 4 def initialize(f) @f = f end |
Instance Method Details
#evaluate(interpretation) ⇒ Object
8 9 10 |
# File 'lib/logical/formulas/negation.rb', line 8 def evaluate(interpretation) !(@f.evaluate(interpretation)) end |
#literals ⇒ Object
16 17 18 |
# File 'lib/logical/formulas/negation.rb', line 16 def literals @f.literals end |
#to_s ⇒ Object
12 13 14 |
# File 'lib/logical/formulas/negation.rb', line 12 def to_s "¬(#{@f.to_s})" end |