Class: Implication
- Inherits:
-
Object
- Object
- Implication
- Defined in:
- lib/logical/formulas/implication.rb
Instance Method Summary collapse
- #evaluate(interpretation) ⇒ Object
-
#initialize(f, g) ⇒ Implication
constructor
A new instance of Implication.
- #literals ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(f, g) ⇒ Implication
Returns a new instance of Implication.
4 5 6 7 |
# File 'lib/logical/formulas/implication.rb', line 4 def initialize(f, g) @f = f @g = g end |
Instance Method Details
#evaluate(interpretation) ⇒ Object
9 10 11 12 |
# File 'lib/logical/formulas/implication.rb', line 9 def evaluate(interpretation) # Since F → G ≡ ¬F ∨ G !(@f.evaluate(interpretation)) || @g.evaluate(interpretation) end |
#literals ⇒ Object
14 15 16 |
# File 'lib/logical/formulas/implication.rb', line 14 def literals @f.literals | @g.literals end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/logical/formulas/implication.rb', line 18 def to_s "(#{@f.to_s}→#{@g.to_s})" end |