mirror of
				https://github.com/Z3Prover/z3
				synced 2025-10-31 19:52:29 +00:00 
			
		
		
		
	adding support for distinct for dt2bv, re-entry harness for ~Context
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
		
							parent
							
								
									375682e98d
								
							
						
					
					
						commit
						5f5ef8b38d
					
				
					 2 changed files with 20 additions and 2 deletions
				
			
		|  | @ -4940,11 +4940,12 @@ namespace Microsoft.Z3 | |||
|             // Console.WriteLine("Context Finalizer from " + System.Threading.Thread.CurrentThread.ManagedThreadId); | ||||
|             Dispose(); | ||||
| 
 | ||||
|             if (refCount == 0) | ||||
|             if (refCount == 0 && m_ctx != IntPtr.Zero) | ||||
|             { | ||||
|                 m_n_err_handler = null; | ||||
|                 Native.Z3_del_context(m_ctx); | ||||
|                 IntPtr ctx = m_ctx; | ||||
|                 m_ctx = IntPtr.Zero; | ||||
|                 Native.Z3_del_context(ctx); | ||||
|             } | ||||
|             else | ||||
|                 GC.ReRegisterForFinalize(this); | ||||
|  |  | |||
|  | @ -60,10 +60,15 @@ class dt2bv_tactic : public tactic { | |||
| 
 | ||||
|         br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) { | ||||
|             expr_ref a0(m), a1(m); | ||||
|             expr_ref_vector _args(m); | ||||
|             if (m.is_eq(f) && reduce_arg(args[0], a0) && reduce_arg(args[1], a1)) { | ||||
|                 result = m.mk_eq(a0, a1); | ||||
|                 return BR_DONE; | ||||
|             } | ||||
|             else if (m.is_distinct(f) && reduce_args(num, args, _args)) { | ||||
|                 result = m.mk_distinct(_args.size(), _args.c_ptr()); | ||||
|                 return BR_DONE; | ||||
|             } | ||||
|             else if (m_t.m_dt.is_recognizer(f) && reduce_arg(args[0], a0)) { | ||||
|                 unsigned idx = m_t.m_dt.get_recognizer_constructor_idx(f); | ||||
|                 a1 = m_t.m_bv.mk_numeral(rational(idx), get_sort(a0)); | ||||
|  | @ -75,6 +80,15 @@ class dt2bv_tactic : public tactic { | |||
|             } | ||||
|         } | ||||
| 
 | ||||
|         bool reduce_args(unsigned sz, expr*const* as, expr_ref_vector& result) { | ||||
|             expr_ref tmp(m); | ||||
|             for (unsigned i = 0; i < sz; ++i) { | ||||
|                 if (!reduce_arg(as[i], tmp)) return false; | ||||
|                 result.push_back(tmp); | ||||
|             } | ||||
|             return true; | ||||
|         } | ||||
| 
 | ||||
|         bool reduce_arg(expr* a, expr_ref& result) { | ||||
|             expr* b; | ||||
|             if (m_cache.find(a, b)) { | ||||
|  | @ -203,6 +217,9 @@ class dt2bv_tactic : public tactic { | |||
|             if (m.is_eq(a)) { | ||||
|                 return; | ||||
|             } | ||||
|             if (m.is_distinct(a)) { | ||||
|                 return; | ||||
|             } | ||||
|             if (m_t.m_dt.is_recognizer(a->get_decl()) && | ||||
|                 m_t.is_fd(a->get_arg(0))) { | ||||
|                 m_t.m_fd_sorts.insert(get_sort(a->get_arg(0))); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue