@@ -161,30 +161,32 @@ struct evaluator_cfg : public default_rewriter_cfg {
161
161
return st;
162
162
}
163
163
164
- bool contains_as_array (expr* e) {
164
+ bool contains_redex (expr* e) {
165
165
if (m_ar.is_as_array (e))
166
166
return true ;
167
167
if (is_var (e))
168
168
return false ;
169
169
if (is_app (e) && to_app (e)->get_num_args () == 0 )
170
170
return false ;
171
171
172
- struct has_as_array {};
173
- struct has_as_array_finder {
172
+ struct has_redex {};
173
+ struct has_redex_finder {
174
174
array_util& au;
175
- has_as_array_finder (array_util& au): au(au) {}
175
+ has_redex_finder (array_util& au): au(au) {}
176
176
void operator ()(var* v) {}
177
177
void operator ()(quantifier* q) {}
178
178
void operator ()(app* a) {
179
179
if (au.is_as_array (a->get_decl ()))
180
- throw has_as_array ();
180
+ throw has_redex ();
181
+ if (au.get_manager ().is_eq (a))
182
+ throw has_redex ();
181
183
}
182
184
};
183
- has_as_array_finder ha (m_ar);
185
+ has_redex_finder ha (m_ar);
184
186
try {
185
187
for_each_expr (ha, e);
186
188
}
187
- catch (has_as_array ) {
189
+ catch (has_redex ) {
188
190
return true ;
189
191
}
190
192
return false ;
@@ -216,8 +218,8 @@ struct evaluator_cfg : public default_rewriter_cfg {
216
218
expr* val = m_model.get_const_interp (f);
217
219
if (val != nullptr ) {
218
220
result = val;
219
- st = contains_as_array (val) ? BR_REWRITE_FULL : BR_DONE;
220
- TRACE (" model_evaluator" , tout << result << " \n " ;);
221
+ st = contains_redex (val) ? BR_REWRITE_FULL : BR_DONE;
222
+ TRACE (" model_evaluator" , tout << st << " " << result << " \n " ;);
221
223
return st;
222
224
}
223
225
if (!m_model_completion)
@@ -443,10 +445,22 @@ struct evaluator_cfg : public default_rewriter_cfg {
443
445
result = m.get_some_value (f->get_range ());
444
446
return BR_DONE;
445
447
}
446
- else if (m_dt.is_accessor (f) && !is_ground (args[0 ])) {
447
- result = m.mk_app (f, num, args);
448
- return BR_DONE;
448
+ else if (m_dt.is_accessor (f)) {
449
+ expr* arg = args[0 ];
450
+ if (is_ground (arg) && !fi) {
451
+ fi = alloc (func_interp, m, f->get_arity ());
452
+ expr* val = m_model.get_some_value (f->get_range ());
453
+ fi->set_else (val);
454
+ m_model.register_decl (f, fi);
455
+ result = val;
456
+ return BR_DONE;
457
+ }
458
+ if (!is_ground (arg)) {
459
+ result = m.mk_app (f, num, args);
460
+ return BR_DONE;
461
+ }
449
462
}
463
+
450
464
if (fi) {
451
465
if (fi->is_partial ())
452
466
fi->set_else (m.get_some_value (f->get_range ()));
0 commit comments