private static IEnumerable <ProofState> UpdateLocalValue(UpdateStmt us, ProofState state) { Contract.Requires <ArgumentNullException>(us != null, "stmt"); Contract.Requires <ArgumentNullException>(state != null, "state"); Contract.Requires <ArgumentException>(state.IsLocalAssignment(us), "stmt"); foreach (var item in us.Rhss) { int index = us.Rhss.IndexOf(item); Contract.Assert(us.Lhss.ElementAtOrDefault(index) != null, "register var err"); var exprRhs = item as ExprRhs; if (exprRhs?.Expr is ApplySuffix) { var aps = (ApplySuffix)exprRhs.Expr; var result = SimpExpr.UnfoldTacticProjection(state, aps); state.UpdateTacticVar(((NameSegment)us.Lhss[index]).Name, result); } else if (exprRhs?.Expr is Microsoft.Dafny.LiteralExpr) { state.UpdateTacticVar(((NameSegment)us.Lhss[index]).Name, (Microsoft.Dafny.LiteralExpr)exprRhs?.Expr); } else { throw new NotSupportedException("Not supported update statement"); } } yield return(state.Copy()); }
/// <summary> /// Insert the statement as is into the state /// </summary> /// <param name="stmt"></param> /// <param name="state"></param> /// <returns></returns> private static IEnumerable <ProofState> DefaultAction(Statement stmt, ProofState state) { Contract.Requires <ArgumentNullException>(stmt != null, "stmt"); Contract.Requires <ArgumentNullException>(state != null, "state"); state.AddStatement(stmt); yield return(state.Copy()); }
private void UndfoldTacticCall(Statement stmt, ApplySuffix aps, Dictionary <IVariable, Type> varList) { // this is a top level tactic call if (IfEvalTac) { _branches.Add( TacnyInterpreter.EvalTopLevelTactic(_state.Copy(), varList, stmt, aps, _errorReporterDelegate, _state.TargetMethod.CallsTactic != _tacticCalls + 1)); _tacticCalls++; } }
public static IEnumerable <ProofState> EvalPredicateStmt(PredicateStmt predicate, ProofState state) { Contract.Requires <ArgumentNullException>(predicate != null, "predicate"); var newPredicate = SimpExpr.SimpTacticExpr(state, predicate); var copy = state.Copy(); copy.AddStatement(newPredicate); copy.NeedVerify = true; yield return(copy); }