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.
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.
-
#type ⇒ Class<Attribute::Boolean>
Return the type returned from #call.
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
Methods included from Visitable
Class Method Details
.self.new(true) ⇒ Tautology .self.new(false) ⇒ Contradiction
Instantiate a new Proposition
40 41 42 43 44 45 46 |
# File 'lib/axiom/function/proposition.rb', line 40 def self.new(*args) if args.empty? super else (args.first.equal?(true) ? Tautology : Contradiction).instance end end |
Instance Method Details
#call ⇒ Boolean
Evaluate the proposition
56 57 58 |
# File 'lib/axiom/function/proposition.rb', line 56 def call(*) self.class.call end |
#inverse ⇒ Proposition
Return the inverse proposition
82 83 84 |
# File 'lib/axiom/function/proposition.rb', line 82 def inverse self.class.inverse.instance end |
#rename(_aliases) ⇒ self
A no-op when receiving #rename message
70 71 72 |
# File 'lib/axiom/function/proposition.rb', line 70 def rename(_aliases) self end |
#type ⇒ Class<Attribute::Boolean>
Return the type returned from #call
91 92 93 |
# File 'lib/axiom/function/proposition.rb', line 91 def type Attribute::Boolean end |