Package edu.mit.csail.sdg.alloy4compiler.ast.Sig

Examples of edu.mit.csail.sdg.alloy4compiler.ast.Sig.Field


  //
  // return result;
  // }

  private Field getField(String key, SafeList<Field> cuFields) {
    Field result = null;

    for (Field field : cuFields) {
      if (field.toString().contains(key)) {
        result = field;
        break;
View Full Code Here


       int arity;
       if (type==null || (arity=type.type().arity())<2) throw new IOException("Field "+label+" is maltyped.");
       String parentID = node.getAttribute("parentID");
       Sig parent = id2sig.get(parentID);
       if (parent==null) throw new IOException("ID "+parentID+" is not a sig.");
       Field field = null;
       for(Field f: parent.getFields())
           if (f.label.equals(label) && f.type().arity()==arity && choices.contains(f))
              { field=f; choices.remove(f); break; }
       if (field==null) field = parent.addTrickyField(Pos.UNKNOWN, isPrivate, null, null, isMeta, new String[] {label}, UNIV.join(type)) [0];
       TupleSet ts = parseTuples(node, arity);
View Full Code Here

      // add the field facts and appended facts
      for(Sig s: frame.getAllReachableSigs()) {
         for(Decl d: s.getFieldDecls()) {
            k2pos_enabled = false;
            for(ExprHasName n: d.names) {
               Field f = (Field)n;
               Expr form = s.decl.get().join(f).in(d.expr);
               form = s.isOne==null ? form.forAll(s.decl) : ExprLet.make(null, (ExprVar)(s.decl.get()), s, form);
               frame.addFormula(cform(form), f);
               // Given the above, we can be sure that every column is well-bounded (except possibly the first column).
               // Thus, we need to add a bound that the first column is a subset of s.
               if (s.isOne==null) {
                   Expression sr = a2k(s), fr = a2k(f);
                   for(int i=f.type().arity(); i>1; i--) fr=fr.join(Relation.UNIV);
                   frame.addFormula(fr.in(sr), f);
               }
            }
            if (s.isOne==null && d.disjoint2!=null) for(ExprHasName f: d.names) {
               Decl that = s.oneOf("that");
               Expr formula = s.decl.get().equal(that.get()).not().implies(s.decl.get().join(f).intersect(that.get().join(f)).no());
               frame.addFormula(cform(formula.forAll(that).forAll(s.decl)), d.disjoint2);
            }
            if (d.names.size()>1 && d.disjoint!=null) {  frame.addFormula(cform(ExprList.makeDISJOINT(d.disjoint, null, d.names)), d.disjoint)}
         }
         k2pos_enabled = true;
         for(Expr f: s.getFacts()) {
            Expr form = s.isOne==null ? f.forAll(s.decl) : ExprLet.make(null, (ExprVar)(s.decl.get()), s, f);
            frame.addFormula(cform(form), f);
         }
      }
      k2pos_enabled = true;
      recursiveAddFormula(facts);
View Full Code Here

              if (list.op!=ExprList.Op.TOTALORDER || list.args.size()!=3) break;
              if (((ExprUnary)b1).op!=ExprUnary.Op.SETOF) break; else b1 = ((ExprUnary)b1).sub.deNOP();
              if (((ExprBinary)b2).op!=ExprBinary.Op.ARROW) break; else { b3 = ((ExprBinary)b2).right.deNOP(); b2 = ((ExprBinary)b2).left.deNOP(); }
              if (!(b1 instanceof PrimSig) || b1!=b2 || b1!=b3) break;
              PrimSig sub = (PrimSig)b1;
              Field f1 = s.getFields().get(0), f2 = s.getFields().get(1);
              if (sub.isEnum==null || !list.args.get(0).isSame(sub) || !list.args.get(1).isSame(s.join(f1)) || !list.args.get(2).isSame(s.join(f2))) break;
              // Now, we've confirmed it is a total ordering on an enum. Let's pre-bind the relations
              TupleSet me = sol.query(true, sol.a2k(s), false), firstTS = factory.noneOf(2), lastTS = null, nextTS = factory.noneOf(3);
              if (me.size()!=1 || me.arity()!=1) break;
              int n = sub.children().size();
View Full Code Here

TOP

Related Classes of edu.mit.csail.sdg.alloy4compiler.ast.Sig.Field

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.