private void SearchCounterexample(Implementation impl, DoomErrorHandler errh, VerifierCallback callback) { Contract.Requires(impl != null); Contract.Requires(errh != null); Contract.Requires(callback != null); Contract.Requires(errh.m_Reachvar != null); //if (errh.m_Reachvar==null) { // Contract.Assert(false);throw new cce.UnreachableException(); //} m_doomedCmds.Clear(); Dictionary <Block, List <Cmd> > cmdbackup = new Dictionary <Block, List <Cmd> >(); BruteForceCESearch(errh.m_Reachvar, impl, callback, cmdbackup, 0, impl.Blocks.Count / 2 - 1); BruteForceCESearch(errh.m_Reachvar, impl, callback, cmdbackup, impl.Blocks.Count / 2, impl.Blocks.Count - 1); List <Cmd> causals = CollectCausalStatements(impl.Blocks[0]); foreach (Cmd c in causals) { Contract.Assert(c != null); GenerateErrorMessage(c, causals); } #region Undo all modifications foreach (KeyValuePair <Block, List <Cmd> > kvp in cmdbackup) { Contract.Assert(kvp.Key != null); Contract.Assert(kvp.Value != null); kvp.Key.Cmds = kvp.Value; } #endregion }
protected List <Block> m_GetErrorTraceFromCE(DoomErrorHandler cb) { BlockHierachyNode tn = null; List <Block> errortrace = new List <Block>(); foreach (Block b in cb.TraceNodes) { if (errortrace.Contains(b)) { continue; } if (m_BlockH.BlockToHierachyMap.TryGetValue(b, out tn)) { foreach (Block b_ in tn.Unavoidable) { if (!errortrace.Contains(b_)) { errortrace.Add(b_); } } foreach (Block b_ in tn.Content) { if (!errortrace.Contains(b_)) { errortrace.Add(b_); } } } } return(errortrace); }
private void SearchCounterexample(Implementation impl, DoomErrorHandler errh, VerifierCallback callback) { Contract.Requires(impl != null); Contract.Requires(errh != null); Contract.Requires(callback != null); Contract.Requires(errh.m_Reachvar != null); //if (errh.m_Reachvar==null) { // Contract.Assert(false);throw new cce.UnreachableException(); //} m_doomedCmds.Clear(); Dictionary<Block, List<Cmd>> cmdbackup = new Dictionary<Block, List<Cmd>>(); BruteForceCESearch(errh.m_Reachvar, impl, callback, cmdbackup, 0, impl.Blocks.Count / 2 - 1); BruteForceCESearch(errh.m_Reachvar, impl, callback, cmdbackup, impl.Blocks.Count / 2, impl.Blocks.Count - 1); List<Cmd> causals = CollectCausalStatements(impl.Blocks[0]); foreach (Cmd c in causals) { Contract.Assert(c != null); GenerateErrorMessage(c, causals); } #region Undo all modifications foreach (KeyValuePair<Block, List<Cmd>> kvp in cmdbackup) { Contract.Assert(kvp.Key != null); Contract.Assert(kvp.Value != null); kvp.Key.Cmds = kvp.Value; } #endregion }
// This method is called to inform about the prover outcome for the previous GetNextBlock call. abstract public bool SetCurrentResult(List <Variable> reachvar, ProverInterface.Outcome outcome, DoomErrorHandler cb);
override public bool SetCurrentResult(List <Variable> reachvar, ProverInterface.Outcome outcome, DoomErrorHandler cb) { this.__DEBUG_BlocksChecked++; // Valid means infeasible... int oldk = MaxBlocks; int oldl = MinBlocks; int oldsize = m_Uncheckedlocks.Count; if (outcome == ProverInterface.Outcome.Valid) { this.__DEBUG_InfeasibleTraces++; if (MaxBlocks == 1) { m_NoMoreMoves = true; } else { MaxBlocks /= 2; } } else if (outcome == ProverInterface.Outcome.Invalid) { this.__DEBUG_TracesChecked++; List <Block> errortrace = m_GetErrorTraceFromCE(cb); foreach (Block b in errortrace) { if (m_Uncheckedlocks.Contains(b)) { m_Uncheckedlocks.Remove(b); } } cb.TraceNodes.Clear(); int k = m_BlockH.GetMaxK(m_Uncheckedlocks); MaxBlocks = (k > MaxBlocks) ? MaxBlocks : k; } else { m_NoMoreMoves = true; m_Uncheckedlocks.Clear(); } if (__DEBUGOUT) { Console.WriteLine("K := {0,3}, L := {1,3}, deltaSp {2,3}, out {3,8}, time {4,8}", oldk, oldl, (oldsize - m_Uncheckedlocks.Count), outcome, sw.ElapsedTicks); } sw.Stop(); sw.Reset(); return(true); }
// This method is called to inform about the prover outcome for the previous GetNextBlock call. override public bool SetCurrentResult(List <Variable> reachvar, ProverInterface.Outcome outcome, DoomErrorHandler cb) { this.__DEBUG_BlocksChecked++; // outcome==Valid means that there is no feasible execution for the current block/path (i.e., might be doomed) if (outcome == ProverInterface.Outcome.Valid && m_Current != null) { m_doomedBlocks.Add(m_Current); } else if (outcome == ProverInterface.Outcome.Invalid) { List <Block> errortrace = m_GetErrorTraceFromCE(cb); foreach (Block b in errortrace) { if (m_Blocks.Contains(b)) { m_Blocks.Remove(b); } } cb.TraceNodes.Clear(); } return(true); }
// This method is called to inform about the prover outcome for the previous GetNextBlock call. override public bool SetCurrentResult(List <Variable> reachvar, ProverInterface.Outcome outcome, DoomErrorHandler cb) { this.__DEBUG_BlocksChecked++; // outcome==Valid means that there is no feasible execution for the current block/path (i.e., might be doomed) if (outcome == ProverInterface.Outcome.Valid && m_Current <= m_Blocks.Count) { m_doomedBlocks.Add(m_Blocks[m_Current - 1]); } if (__DEBUGOUT) { Console.WriteLine("K := {0,3} , out {1,8}, time {2,12}", MaxBlocks, outcome, sw.ElapsedTicks); } sw.Stop(); sw.Reset(); return(true); }
// This method is called to inform about the prover outcome for the previous GetNextBlock call. override public bool SetCurrentResult(List <Variable> reachvar, ProverInterface.Outcome outcome, DoomErrorHandler cb) { this.__DEBUG_BlocksChecked++; // outcome==Valid means that there is no feasible execution for the current block/path (i.e., might be doomed) if (outcome == ProverInterface.Outcome.Valid && m_Current <= m_Blocks.Count) { List <Block> lb = new List <Block>(); lb.Add(m_Blocks[m_Current - 1]); DetectedBlock.Add(lb); } return(true); }
protected List<Block> m_GetErrorTraceFromCE(DoomErrorHandler cb) { BlockHierachyNode tn=null; List<Block> errortrace = new List<Block>(); foreach (Block b in cb.TraceNodes) { if (errortrace.Contains(b)) continue; if (m_BlockH.BlockToHierachyMap.TryGetValue(b, out tn)) { foreach (Block b_ in tn.Unavoidable) { if (!errortrace.Contains(b_)) errortrace.Add(b_); } foreach (Block b_ in tn.Content) { if (!errortrace.Contains(b_)) errortrace.Add(b_); } } } return errortrace; }
// This method is called to inform about the prover outcome for the previous GetNextBlock call. abstract public bool SetCurrentResult(List<Variable> reachvar, ProverInterface.Outcome outcome, DoomErrorHandler cb);
override public bool SetCurrentResult(List<Variable> reachvar, ProverInterface.Outcome outcome, DoomErrorHandler cb) { this.__DEBUG_BlocksChecked++; // Valid means infeasible... int oldk = MaxBlocks; int oldl = MinBlocks; int oldsize = m_Uncheckedlocks.Count; if (outcome == ProverInterface.Outcome.Valid) { this.__DEBUG_InfeasibleTraces++; if (MaxBlocks == 1) { m_NoMoreMoves = true; } else { MaxBlocks /= 2; } } else if (outcome == ProverInterface.Outcome.Invalid) { this.__DEBUG_TracesChecked++; List<Block> errortrace = m_GetErrorTraceFromCE(cb); foreach (Block b in errortrace) { if (m_Uncheckedlocks.Contains(b)) { m_Uncheckedlocks.Remove(b); } } cb.TraceNodes.Clear(); int k = m_BlockH.GetMaxK(m_Uncheckedlocks); MaxBlocks = (k > MaxBlocks) ? MaxBlocks : k; } else { m_NoMoreMoves = true; m_Uncheckedlocks.Clear(); } if (__DEBUGOUT) Console.WriteLine("K := {0,3}, L := {1,3}, deltaSp {2,3}, out {3,8}, time {4,8}", oldk, oldl, (oldsize - m_Uncheckedlocks.Count), outcome, sw.ElapsedTicks); sw.Stop(); sw.Reset(); return true; }
// This method is called to inform about the prover outcome for the previous GetNextBlock call. override public bool SetCurrentResult(List<Variable> reachvar, ProverInterface.Outcome outcome, DoomErrorHandler cb) { this.__DEBUG_BlocksChecked++; // outcome==Valid means that there is no feasible execution for the current block/path (i.e., might be doomed) if (outcome == ProverInterface.Outcome.Valid && m_Current != null) { m_doomedBlocks.Add(m_Current); } else if (outcome == ProverInterface.Outcome.Invalid) { List<Block> errortrace = m_GetErrorTraceFromCE(cb); foreach (Block b in errortrace) { if (m_Blocks.Contains(b)) { m_Blocks.Remove(b); } } cb.TraceNodes.Clear(); } return true; }
// This method is called to inform about the prover outcome for the previous GetNextBlock call. override public bool SetCurrentResult(List<Variable> reachvar, ProverInterface.Outcome outcome, DoomErrorHandler cb) { this.__DEBUG_BlocksChecked++; // outcome==Valid means that there is no feasible execution for the current block/path (i.e., might be doomed) if (outcome == ProverInterface.Outcome.Valid && m_Current <= m_Blocks.Count) { m_doomedBlocks.Add(m_Blocks[m_Current - 1]); } if (__DEBUGOUT) Console.WriteLine("K := {0,3} , out {1,8}, time {2,12}", MaxBlocks, outcome, sw.ElapsedTicks); sw.Stop(); sw.Reset(); return true; }
// This method is called to inform about the prover outcome for the previous GetNextBlock call. override public bool SetCurrentResult(List<Variable> reachvar, ProverInterface.Outcome outcome, DoomErrorHandler cb) { this.__DEBUG_BlocksChecked++; // outcome==Valid means that there is no feasible execution for the current block/path (i.e., might be doomed) if (outcome == ProverInterface.Outcome.Valid && m_Current <= m_Blocks.Count) { List<Block> lb = new List<Block>(); lb.Add(m_Blocks[m_Current - 1]); DetectedBlock.Add(lb); } return true; }