// 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);