Class: Udb::FreeTerm Private

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Includes:
Comparable
Defined in:
lib/udb/logic.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

represents a “free” term, i.e., one that is not bound to the problem at hand used by the Tseytin Transformation, which introduces new propositions to represent subformula

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



1113
1114
1115
1116
# File 'lib/udb/logic.rb', line 1113

def initialize
  @id = FreeTerm.instance_variable_get(:@next_id)
  FreeTerm.instance_variable_set(:@next_id, @id + 1)
end

Instance Attribute Details

#idInteger (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Integer)


1110
1111
1112
# File 'lib/udb/logic.rb', line 1110

def id
  @id
end

Instance Method Details

#<=>(other) ⇒ Integer?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • other (T.untyped)

Returns:

  • (Integer, nil)


1142
1143
1144
1145
1146
# File 'lib/udb/logic.rb', line 1142

def <=>(other)
  return nil unless other.is_a?(FreeTerm)

  @id <=> other.id
end

#eql?(other) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • other (T.untyped)

Returns:

  • (Boolean)


1162
1163
1164
1165
1166
# File 'lib/udb/logic.rb', line 1162

def eql?(other)
  return false unless other.is_a?(FreeTerm)

  (self <=> other) == 0
end

#hashInteger

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

hash and eql? must be implemented to use ParameterTerm as a Hash key

Returns:

  • (Integer)


1154
# File 'lib/udb/logic.rb', line 1154

def hash = @id.hash

#to_hObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



1131
# File 'lib/udb/logic.rb', line 1131

def to_h = {}

#to_idl(cfg_arch) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

Returns:

  • (String)


1127
1128
1129
# File 'lib/udb/logic.rb', line 1127

def to_idl(cfg_arch)
  "FreeTerm"
end

#to_sString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


1122
1123
1124
# File 'lib/udb/logic.rb', line 1122

def to_s
  "t#{@id}"
end

#to_s_prettyString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


1134
# File 'lib/udb/logic.rb', line 1134

def to_s_pretty = to_s