/** * Creates a new complete constructor {@code AForAllExp} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param bindList_ the {@link NodeList} node for the {@code bindList} child of this {@link AForAllExp} node * @param predicate_ the {@link PExp} node for the {@code predicate} child of this {@link AForAllExp} node */ public AForAllExp(PType type_, ILexLocation location_, List<? extends PMultipleBind> bindList_, PExp predicate_) { super(type_,location_); this.setBindList(bindList_); this.setPredicate(predicate_); }
/** * Creates a new tree field only constructor {@code AForAllExp TAG=forAll} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param bindList_ the {@link NodeList} node for the {@code bindList} child of this {@link AForAllExp} node * @param predicate_ the {@link PExp} node for the {@code predicate} child of this {@link AForAllExp} node */ public AForAllExp(ILexLocation location_, List<? extends PMultipleBind> bindList_, PExp predicate_) { super(null,location_); this.setBindList(bindList_); this.setPredicate(predicate_); }
public static AForAllExp newAForAllExp(ILexLocation start, List<PMultipleBind> bindList, PExp predicate) { AForAllExp result = new AForAllExp(); initExpression(result, start); result.setBindList(bindList); result.setPredicate(predicate); return result; }
protected AForAllExp getSuperContext(PExp stitch) { AForAllExp forAllExp = new AForAllExp(); forAllExp.setType(new ABooleanBasicType()); forAllExp.setBindList(cloneBinds(bindings)); forAllExp.setPredicate(stitch); return forAllExp; }
/** * forall a:A, b:B & p(a,b) => exists idx in set dom m & m(idx) = { a |-> b } */ private PExp getForallExp(AMapCompMapExp exp, ILexNameToken finmap, ILexNameToken findex) { AForAllExp forallExp = new AForAllExp(); forallExp.setBindList(exp.clone().getBindings()); forallExp.setPredicate(getImpliesExpression(exp, finmap, findex)); return forallExp; }
/** * forall a:A & p(a) => exists idx in set dom m & m(idx) = f(a) */ private PExp getForallExp(ASetCompSetExp exp, ILexNameToken finmap, ILexNameToken findex) { AForAllExp forallExp = new AForAllExp(); forallExp.setBindList(exp.clone().getBindings()); forallExp.setPredicate(getImpliesExpression(exp, finmap, findex)); return forallExp; }
/** * Create the context (forall x,y,z...) for a Proof Obligation for * eq and ord relations. */ protected AForAllExp makeRelContext(ATypeDefinition node, AVariableExp... exps){ AForAllExp forall_exp = new AForAllExp(); forall_exp.setType(new ABooleanBasicType()); ATypeMultipleBind tmb = new ATypeMultipleBind(); List<PPattern> pats = new LinkedList<>(); for (AVariableExp exp : exps) { pats.add(AstFactory.newAIdentifierPattern(exp.getName().clone())); } tmb.setPlist(pats); tmb.setType(node.getType().clone()); List<PMultipleBind> binds = new LinkedList<>(); binds.add(tmb); forall_exp.setBindList(binds); return forall_exp; }
private AForAllExp getChangedVarsExp(AExplicitFunctionDefinition postDef, SOperationDefinitionBase calledOp) { AForAllExp r = new AForAllExp(); List<PMultipleBind> binds = new LinkedList<PMultipleBind>(); if (calledOp instanceof AExplicitOperationDefinition) { refreshAllState(calledOp, binds); } if (calledOp instanceof AImplicitOperationDefinition) { AImplicitOperationDefinition implicitOp = (AImplicitOperationDefinition) calledOp; if (implicitOp.getExternals().size() > 0) { for (AExternalClause external : implicitOp.getExternals()) { if (external.getMode().getType().equals(VDMToken.WRITE)) { binds.addAll(introduceFreshVars(external.getIdentifiers(), getStateVars(calledOp))); } } } else { refreshAllState(calledOp, binds); } } r.setBindList(binds); return r; }
@Override public PExp getContextNode(PExp stitch) { AForAllExp forAllExp = new AForAllExp(); forAllExp.setBindList(makeBinds()); forAllExp.setType(new ABooleanBasicType()); if (deftype.getParameters().isEmpty()) { return stitch; } if (addPrecond && precondition != null) { AImpliesBooleanBinaryExp implies = AstExpressionFactory .newAImpliesBooleanBinaryExp(precondition.clone(), stitch); implies.setType(new ABooleanBasicType()); forAllExp.setPredicate(implies); } else { forAllExp.setPredicate(stitch); } return forAllExp; }
forallExp.setBindList(forallBindList);
domForallExp.setBindList(domBinding); domForallExp.setPredicate(implies); List<PMultipleBind> setBindList = new LinkedList<PMultipleBind>(); setBindList.add(setBind); forallExp.setBindList(setBindList); forallExp.setPredicate(domForallExp);
@Override public PExp getContextNode(PExp stitch) { if (anyBinds()) { AForAllExp forAllExp = new AForAllExp(); forAllExp.setType(new ABooleanBasicType()); forAllExp.setBindList(makeBinds()); if (addPrecond && precondition != null) { AImpliesBooleanBinaryExp impliesExp = AstExpressionFactory.newAImpliesBooleanBinaryExp(precondition.clone(), stitch); forAllExp.setPredicate(impliesExp); } else { forAllExp.setPredicate(stitch); } return forAllExp; } else { if (addPrecond && precondition != null) { AImpliesBooleanBinaryExp impliesExp = AstExpressionFactory.newAImpliesBooleanBinaryExp(precondition.clone(), stitch); return impliesExp; } } return stitch; }
forallExp.setBindList(bindings); forallExp.setPredicate(implies);
forallExp.setBindList(getMultipleTypeBindList(leftPType, arg)); PExp firstPart = null;
public FuncIterationObligation(AStarStarBinaryExp exp, ILexNameToken preName, IPOContextStack ctxt, IPogAssistantFactory assistantFactory) throws AnalysisException { super(exp, POType.FUNC_ITERATION, ctxt, exp.getLocation(), assistantFactory); // n > 1 AGreaterNumericBinaryExp gTExp = AstExpressionFactory.newAGreaterNumericBinaryExp(exp.getRight().clone(), getIntLiteral(1)); // forall n :T & P(X) AForAllExp forAllExp = new AForAllExp(); ILexNameToken arg = getUnique("arg"); List<PMultipleBind> bindList = getMultipleTypeBindList(assistantFactory.createPTypeAssistant().getNumeric(exp.getRight().getType().clone()), arg); forAllExp.setBindList(bindList); forAllExp.setPredicate(getPredicate(exp.clone(), preName.clone(), arg)); // n > 1 => forall n :T & P(X) AImpliesBooleanBinaryExp impliesExp = AstExpressionFactory.newAImpliesBooleanBinaryExp(gTExp, forAllExp); stitch = impliesExp.clone(); valuetree.setPredicate(ctxt.getPredWithContext(impliesExp)); }
domBinding.addAll(getMultipleSetBindList(domM2, d2)); domForallExp.setBindList(domBinding); domForallExp.setPredicate(implies); forallExp.setBindList(m1m2binding); forallExp.setPredicate(domForallExp);