Class: Axiom::Function::Connective::Conjunction

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

Overview

A logical AND 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 AND

Examples:

with true operands

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

with true and false

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

with false and true

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

with false and false

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

Parameters:

  • left (Boolean)
  • right (Boolean)

Returns:

  • (Boolean)


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

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

Instance Method Details

#inverseDisjunction

Return the inverse connective

Examples:

disjunction = conjunction.inverse

Returns:



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

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