Class: ADSL::Parser::ASTForAll

Inherits:
ASTNode show all
Defined in:
lib/adsl/parser/ast_nodes.rb

Instance Method Summary collapse

Methods inherited from ASTNode

#==, #adsl_ast, #adsl_ast_size, #block_replace, #dup, #hash, is_formula?, is_objset?, is_statement?, node_type, #objset_has_side_effects?, #optimize, #preorder_traverse

Methods included from Verification::FormulaGenerators

#[], #and, #binary_op, #binary_op_with_any_number_of_params, #equiv, #exists, #false, #forall, #handle_quantifier, #implies, #in_formula_builder, #not, #or, #true

Methods included from Verification::Utils

#classname_for_classname, #infer_classname_from_varname, #t

Instance Method Details

#to_adslObject



1229
1230
1231
1232
# File 'lib/adsl/parser/ast_nodes.rb', line 1229

def to_adsl
  v = @vars.map{ |var, objset| "#{ var.text } in #{ objset.to_adsl }" }.join ", " 
  "forall(#{v}: #{ @subformula.to_adsl })"
end

#typecheck_and_resolve(context) ⇒ Object



1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
# File 'lib/adsl/parser/ast_nodes.rb', line 1211

def typecheck_and_resolve(context)
  context.in_stack_frame do
    vars = []
    objsets = []
    @vars.each do |var_node, objset_node|
      objset = objset_node.typecheck_and_resolve context
      
      var = ADSL::DS::DSVariable.new :name => var_node.text, :type => objset.type
      context.define_var var, var_node

      vars << var
      objsets << objset
    end
    subformula = @subformula.typecheck_and_resolve context
    return ADSL::DS::DSForAll.new :vars => vars, :objsets => objsets, :subformula => subformula
  end
end