How to evaluate a predicate in Alloy source code? -
i have predicate in alloy model, called ls, gets instance of sig called st. trying evaluate predicate on instance of st, called st$0, in source code. can find solution of type a4solution, called ans. don't know how can evaluate predicate on solution.
here how can in general evaluate predicates using api
string filename = "<file path alloy model>"; module world = computil.parseeverything_fromfile(rep, null, filename); a4options opt = new a4options(); opt.solver = a4options.satsolver.sat4j; // run first command sake of example command cmd = world.getallcommands().get(0); a4solution sol = translatealloytokodkod.execute_command(rep, world.getallreachablesigs(), cmd, opt); // evaluate first defined function/predicate applied first defined sig func func = world.getallfunc().get(0); sig sig = world.getallsigs().get(0); system.out.println(sol.eval(func.call(sig)));
Comments
Post a Comment