public static IEnumerable <ProofState> EvalStep(ProofState state) { Contract.Requires <ArgumentNullException>(state != null, "state"); // one step // call the IEnumerable <ProofState> enumerable = null; var stmt = state.GetStmt(); if (stmt is TacticVarDeclStmt) { enumerable = RegisterVariable(stmt as TacticVarDeclStmt, state); } else if (stmt is UpdateStmt) { var us = stmt as UpdateStmt; if (state.IsLocalAssignment(us)) { enumerable = UpdateLocalValue(us, state); } else if (state.IsArgumentApplication(us)) { //TODO: argument application } else if (state.IsTacticCall(us)) { enumerable = ApplyNestedTactic(state.Copy(), state.DafnyVars(), us); } } else if (stmt is AssignSuchThatStmt) { enumerable = EvaluateSuchThatStmt((AssignSuchThatStmt)stmt, state); } else if (stmt is PredicateStmt) { enumerable = ResolvePredicateStmt((PredicateStmt)stmt, state); } else if (stmt is TStatement || stmt is IfStmt || stmt is WhileStmt) { //TODO: } else { enumerable = DefaultAction(stmt, state); } foreach (var item in enumerable) { yield return(item.Copy()); } }
public static IEnumerable<ProofState> EvalStep(ProofState state) { Contract.Requires<ArgumentNullException>(state != null, "state"); // one step // call the IEnumerable<ProofState> enumerable = null; var stmt = state.GetStmt(); if (stmt is TacticVarDeclStmt) { enumerable = RegisterVariable(stmt as TacticVarDeclStmt, state); } else if (stmt is UpdateStmt) { var us = stmt as UpdateStmt; if (state.IsLocalAssignment(us)) { enumerable = UpdateLocalValue(us, state); } else if (state.IsArgumentApplication(us)) { //TODO: argument application } else if (state.IsTacticCall(us)) { enumerable = ApplyNestedTactic(state.Copy(), state.DafnyVars(), us); } } else if (stmt is AssignSuchThatStmt) { enumerable = EvaluateSuchThatStmt((AssignSuchThatStmt)stmt, state); } else if (stmt is PredicateStmt) { enumerable = ResolvePredicateStmt((PredicateStmt)stmt, state); } else if (stmt is TStatement || stmt is IfStmt || stmt is WhileStmt) { //TODO: } else { enumerable = DefaultAction(stmt, state); } foreach (var item in enumerable) yield return item.Copy(); }
public static IEnumerable<ProofState> EvalStep(ProofState state) { Contract.Requires<ArgumentNullException>(state != null, "state"); IEnumerable<ProofState> enumerable = null; var stmt = state.GetStmt(); //if the current frame is a control flow, e.g. match, no need to get stmt if(FlowControlMng.IsFlowControlFrame(state)) { enumerable = FlowControlMng.EvalNextControlFlow(stmt, state); } else { if(stmt is TacticVarDeclStmt) { enumerable = RegisterVariable(stmt as TacticVarDeclStmt, state); } else if(stmt is UpdateStmt) { var us = stmt as UpdateStmt; if(state.IsLocalAssignment(us)) { enumerable = UpdateLocalValue(us, state); } else if(state.IsArgumentApplication(us)) { //TODO: argument application ?? } else if(state.IsTacticCall(us)){ enumerable = EvalTacApp(us, state); } else { // apply atomic string sig = Util.GetSignature(us); //Firstly, check if this is a projection function var types = Assembly.GetAssembly(typeof(Atomic.Atomic)) .GetTypes() .Where(t => t.IsSubclassOf(typeof(Atomic.Atomic))); foreach(var fType in types) { var porjInst = Activator.CreateInstance(fType) as Atomic.Atomic; if(sig == porjInst?.Signature) { //TODO: validate input countx enumerable = porjInst?.Generate(us, state); } } } } else if(stmt is AssignSuchThatStmt) { enumerable = EvalSuchThatStmt((AssignSuchThatStmt)stmt, state); } else if(stmt is PredicateStmt) { enumerable = EvalPredicateStmt((PredicateStmt)stmt, state); } else if(FlowControlMng.IsFlowControl(stmt)) { if(stmt is TacnyCasesBlockStmt) { enumerable = new Match().EvalInit(stmt, state); } //TODO: to implement if and while control flow } else { enumerable = DefaultAction(stmt, state); } } foreach(var item in enumerable) yield return item.Copy(); }
public static IEnumerable <ProofState> EvalStep(ProofState state) { Contract.Requires <ArgumentNullException>(state != null, "state"); IEnumerable <ProofState> enumerable = null; var stmt = state.GetStmt(); //if the current frame is a control flow, e.g. match, no need to get stmt if (FlowControlMng.IsFlowControlFrame(state)) { enumerable = FlowControlMng.EvalNextControlFlow(stmt, state); } else { if (stmt is TacticVarDeclStmt) { enumerable = RegisterVariable(stmt as TacticVarDeclStmt, state); } else if (stmt is UpdateStmt) { var us = stmt as UpdateStmt; if (state.IsLocalAssignment(us)) { enumerable = UpdateLocalValue(us, state); } else if (state.IsArgumentApplication(us)) { //TODO: argument application ?? } else if (state.IsTacticCall(us)) { enumerable = EvalTacApp(us, state); } else { // apply atomic string sig = Util.GetSignature(us); //Firstly, check if this is a projection function var types = Assembly.GetAssembly(typeof(Atomic.Atomic)) .GetTypes() .Where(t => t.IsSubclassOf(typeof(Atomic.Atomic))); foreach (var fType in types) { var porjInst = Activator.CreateInstance(fType) as Atomic.Atomic; if (sig == porjInst?.Signature) { //TODO: validate input countx enumerable = porjInst?.Generate(us, state); } } } } else if (stmt is AssignSuchThatStmt) { enumerable = EvalSuchThatStmt((AssignSuchThatStmt)stmt, state); } else if (stmt is PredicateStmt) { enumerable = EvalPredicateStmt((PredicateStmt)stmt, state); } else if (FlowControlMng.IsFlowControl(stmt)) { if (stmt is TacnyCasesBlockStmt) { enumerable = new Match().EvalInit(stmt, state); } //TODO: to implement if and while control flow } else { enumerable = DefaultAction(stmt, state); } } foreach (var item in enumerable) { yield return(item.Copy()); } }