Sha256: ddc3d24c6117869d0e3bc3b02cdae56aa6124531864292445a28982464035258

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

module Veritas
  module Logic
    class Proposition

      # A class representing a tautology
      class True < Proposition

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

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

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

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

      end # class True
    end # class Proposition
  end # module Algebra
end # module Veritas

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
veritas-0.0.2 lib/veritas/logic/proposition/true.rb
veritas-0.0.1 lib/veritas/logic/proposition/true.rb