Package kodkod.ast

Examples of kodkod.ast.Decl


   * @return { d: Declaration |  d.variable = decl.variable && d.multiplicity = decl.multiplicity &&
   *                             d.expression = decl.expression.accept(this) }
   */
  @Override
  public final Decl visit(Decl decl) {
    Decl ret = lookup(decl);
    if (ret!=null) return ret;
    final int oldDepth = skolemDepth;
    skolemDepth = -1; // can't skolemize inside a decl
    final Expression expression = decl.expression().accept(this);
    skolemDepth = oldDepth;
View Full Code Here


    if (skolemDepth>=0 && (negated && quant==ALL || !negated && quant==SOME)) { // skolemizable formula
      final List<Formula> rangeConstraints = new LinkedList<Formula>();
      final List<Formula> domConstraints = new LinkedList<Formula>();
     
      for(Decl decl : decls) { 
        final Decl skolemDecl = visit(decl);
       
        final Relation skolem = Relation.nary("$"+ skolemDecl.variable().name(), nonSkolems.size() + skolemDecl.variable().arity());
        reporter.skolemizing(decl, skolem, nonSkolemsView);
       
        final Expression skolemExpr = skolemExpr(skolemDecl, skolem);
       
        final Multiplicity mult = decl.multiplicity();
        rangeConstraints.add(source(skolemExpr.in(skolemDecl.expression()), decl));
        if (mult!=Multiplicity.SET) {
          rangeConstraints.add(source(skolemExpr.apply(mult), decl));
        }

        if (!nonSkolems.isEmpty())
View Full Code Here

    if (currentDecl==decls.size()) {
      matrix.set(partialIndex, factory.and(declConstraints, formula.accept(this)));
      return;
    }

    final Decl decl = decls.get(currentDecl);
    final BooleanMatrix declTransl = visit(decl);
    final int position = (int)StrictMath.pow(interpreter.universe().size(), decls.size()-currentDecl-1);
    final BooleanMatrix groundValue = factory.matrix(declTransl.dimensions());
    env = env.extend(decl.variable(), groundValue);
    for(IndexedEntry<BooleanValue> entry : declTransl) {
      groundValue.set(entry.index(), BooleanConstant.TRUE);
      comprehension(decls, formula, currentDecl+1, factory.and(entry.value(), declConstraints),
          partialIndex + entry.index()*position, matrix);
      groundValue.set(entry.index(), BooleanConstant.FALSE)
View Full Code Here

    if (decls.size()==currentDecl) {
      acc.add(factory.or(declConstraints, formula.accept(this)));
      return;
    }

    final Decl decl = decls.get(currentDecl);
    final BooleanMatrix declTransl = visit(decl);
    final BooleanMatrix groundValue = factory.matrix(declTransl.dimensions());
    env = env.extend(decl.variable(), groundValue);
    for(IndexedEntry<BooleanValue> entry : declTransl) {
      groundValue.set(entry.index(), BooleanConstant.TRUE);
      all(decls, formula, currentDecl+1, factory.or(factory.not(entry.value()), declConstraints), acc);
      groundValue.set(entry.index(), BooleanConstant.FALSE)
    }
View Full Code Here

    if (decls.size()==currentDecl) {
      acc.add(factory.and(declConstraints, formula.accept(this)));
      return;
    }

    final Decl decl = decls.get(currentDecl);
    final BooleanMatrix declTransl = visit(decl);
    final BooleanMatrix groundValue = factory.matrix(declTransl.dimensions());
    env = env.extend(decl.variable(), groundValue);
    for(IndexedEntry<BooleanValue> entry : declTransl) {
      groundValue.set(entry.index(), BooleanConstant.TRUE);
      some(decls, formula, currentDecl+1, factory.and(entry.value(), declConstraints), acc);
      groundValue.set(entry.index(), BooleanConstant.FALSE)
    }
View Full Code Here

    if (decls.size()==currentDecl) {
      values.add( expr.accept(this).choice(declConstraints, factory.integer(0)) );
      return;
    }

    final Decl decl = decls.get(currentDecl);
    final BooleanMatrix declTransl = visit(decl);
    final BooleanMatrix groundValue = factory.matrix(declTransl.dimensions());
    env = env.extend(decl.variable(), groundValue);
    for(IndexedEntry<BooleanValue> entry : declTransl) {
      groundValue.set(entry.index(), BooleanConstant.TRUE);
      sum(decls, expr, currentDecl+1, factory.and(entry.value(), declConstraints), values);
      groundValue.set(entry.index(), BooleanConstant.FALSE)
    }
View Full Code Here

   * @return { d: Declaration |  d.variable = declaration.variable.accept(this) &&
   *                             d.multiplicity = decl.multiplicity &&
   *                             d.expression = declaration.expression.accept(this)
   */
  public Decl visit(Decl decl) {
    Decl ret = lookup(decl);
    if (ret!=null) return ret;
   
    final Variable variable = (Variable) decl.variable().accept(this);
    final Expression expression = decl.expression().accept(this);
    ret = (variable==decl.variable() && expression==decl.expression()) ?
View Full Code Here

TOP

Related Classes of kodkod.ast.Decl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.