Class: Axiom::Function::Proposition
- Inherits:
-
Axiom::Function
- Object
- Axiom::Function
- Axiom::Function::Proposition
- Includes:
- AbstractType, Connective::Conjunction::Methods, Connective::Disjunction::Methods, Connective::Negation::Methods, Singleton
- Defined in:
- lib/axiom/function/proposition.rb,
lib/axiom/function/proposition/tautology.rb,
lib/axiom/function/proposition/contradiction.rb
Overview
Abstract base class for logical propositions
Direct Known Subclasses
Defined Under Namespace
Classes: Contradiction, Tautology
Class Method Summary collapse
-
.new(*args) ⇒ Proposition
Instantiate a new Proposition.
-
.type ⇒ Class<Types::Boolean>
Return the type returned from #call.
Instance Method Summary collapse
-
#call ⇒ Boolean
Evaluate the proposition.
-
#inverse ⇒ Proposition
Return the inverse proposition.
-
#rename(_aliases) ⇒ self
A no-op when receiving #rename message.
Methods included from Connective::Conjunction::Methods
Methods included from Aliasable
Methods included from Connective::Disjunction::Methods
Methods included from Connective::Negation::Methods
Methods inherited from Axiom::Function
extract_value, rename_attributes, #type
Methods included from Visitable
Class Method Details
.self.new(true) ⇒ Tautology .self.new(false) ⇒ Contradiction
Instantiate a new Proposition
52 53 54 55 56 57 58 |
# File 'lib/axiom/function/proposition.rb', line 52 def self.new(*args) if args.empty? super else (args.first.equal?(true) ? Tautology : Contradiction).instance end end |
.type ⇒ Class<Types::Boolean>
Return the type returned from #call
23 24 25 |
# File 'lib/axiom/function/proposition.rb', line 23 def self.type Types::Boolean end |
Instance Method Details
#call ⇒ Boolean
Evaluate the proposition
68 69 70 |
# File 'lib/axiom/function/proposition.rb', line 68 def call(*) self.class.call end |
#inverse ⇒ Proposition
Return the inverse proposition
94 95 96 |
# File 'lib/axiom/function/proposition.rb', line 94 def inverse self.class.inverse.instance end |
#rename(_aliases) ⇒ self
A no-op when receiving #rename message
82 83 84 |
# File 'lib/axiom/function/proposition.rb', line 82 def rename(_aliases) self end |