Sha256: ec13bfae972b97f9ce715ec6e5e41f8ed3cd68847d398591585ab8fb9cb272c3

Contents?: true

Size: 1.36 KB

Versions: 4

Compression:

Stored size: 1.36 KB

Contents

# encoding: utf-8

module Veritas
  class Function
    class Proposition

      # A class representing a tautology
      class Tautology < Proposition
        include Connective::Negation::Methods

        # Return the inverse proposition class
        #
        # @example
        #   Tautology.inverse  # => Contradiction
        #
        # @return [Class<Contradiction>]
        #
        # @api public
        def self.inverse
          Contradiction
        end

        # Evaluate the proposition
        #
        # @example
        #   Tautology.call  # => true
        #
        # @return [true]
        #
        # @api public
        def self.call
          true
        end

        # Logically AND the proposition with another expression
        #
        # @example
        #   tautology.and(other)  # => other
        #
        # @param [Function] other
        #
        # @return [Function]
        #
        # @api public
        def and(other)
          other
        end

        # Logically OR the proposition with another expression
        #
        # @example
        #   tautology.or(other)  # => tautology
        #
        # @param [Function] other
        #
        # @return [self]
        #
        # @api public
        def or(other)
          self
        end

      end # class Tautology
    end # class Proposition
  end # module Algebra
end # module Veritas

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
veritas-0.0.7 lib/veritas/function/proposition/tautology.rb
veritas-0.0.6 lib/veritas/function/proposition/tautology.rb
veritas-0.0.5 lib/veritas/function/proposition/tautology.rb
veritas-0.0.4 lib/veritas/function/proposition/tautology.rb