Class: Axiom::Function::Connective::Disjunction

Inherits:
Axiom::Function::Connective show all
Includes:
Binary, Binary::Invertible
Defined in:
lib/axiom/function/connective/disjunction.rb

Overview

A logical OR between expressions

Defined Under Namespace

Modules: Methods

Instance Attribute Summary

Attributes included from Operation::Binary

#left, #right

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Binary

#call, #rename, #type

Methods included from Operation::Binary

#initialize

Methods inherited from Axiom::Function::Connective

type

Methods inherited from Axiom::Function

extract_value, rename_attributes, #type

Methods included from Visitable

#accept

Class Method Details

.call(left, right) ⇒ Boolean

Evaluate the operands using a logical OR

Examples:

with true operands

Disjunction.call(true, true)  # => true

with true and false

Disjunction.call(true, false)  # => true

with false and true

Disjunction.call(false, true)  # => true

with false and false

Disjunction.call(false, false)  # => false

Parameters:

  • left (Boolean)
  • right (Boolean)

Returns:

  • (Boolean)


33
34
35
# File 'lib/axiom/function/connective/disjunction.rb', line 33

def self.call(left, right)
  left || right
end

Instance Method Details

#inverseConjunction

Return the inverse connective

Examples:

conjunction = disjunction.inverse

Returns:



45
46
47
48
# File 'lib/axiom/function/connective/disjunction.rb', line 45

def inverse
  Conjunction.new(Negation.new(left), Negation.new(right))
    .memoize(inverse: self)
end