ThenTerm.nnf?   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 3
rs 10
1
module PropLogic
2
  class ThenTerm < Term
3
    def initialize(term1, term2)
4
      @terms = [term1, term2].freeze
5
    end
6
7
    def to_s(in_term = false)
8
      str = "#{@terms[0].to_s(true)} => #{@terms[1].to_s(true)}"
9
      in_term ? "( #{str} )" : str
10
    end
11
12
    def nnf?
13
      false
14
    end
15
16
    def to_nnf
17
      (~@terms[0]).to_nnf | @terms[1].to_nnf
18
    end
19
20
    def reduce
21
      to_nnf.reduce
22
    end
23
  end
24
25
end
26