class Satre::Function

Attributes

function[R]
term_list[R]

Public Class Methods

new(function, term_list=[]) click to toggle source
# File lib/satre/formula/term/function.rb, line 8
def initialize(function, term_list=[])
  #fail(ArgumentError, '...') unless function.is_a?(String)
  #fail(ArgumentError, '...') unless term_list.is_a?(Array)
  @function = function.dup.freeze
  @term_list = term_list.dup.freeze
end

Public Instance Methods

to_s() click to toggle source
# File lib/satre/formula/term/function.rb, line 29
def to_s
  "#{function}(#{term_list.map(&:to_s).join(',')})"
end
validate(func, pred, valudation) click to toggle source

| Fn(f,args) -> func f (map (termval m v), args);;

# File lib/satre/formula/term/function.rb, line 25
def validate(func, pred, valudation)
  func.call(f, term_list.map { |t| t.validate(func, pred, valudation) })
end
wellformed?(sig) click to toggle source

A term $f(x_1,…,x_n)$ is well-formed if

(a) Each term $x_1,...,x_n$ is well formed
(b) There is a pair (a, m) in signature sig where s = f and n = m

sig is a hash containing the signature domain

# File lib/satre/formula/term/function.rb, line 20
def wellformed?(sig)
  term_list.all? { |x| x.wellformed?(sig) } && sig[function.to_sym] == term_list.length
end