@@ -780,9 +780,27 @@ namespace smtfd {
780
780
{}
781
781
782
782
void check_term (expr* t, unsigned round) override {
783
+ sort* s = m.get_sort (t);
783
784
if (round == 0 && is_uf (t)) {
784
785
TRACE (" smtfd_verbose" , tout << " check-term: " << mk_bounded_pp (t, m, 2 ) << " \n " ;);
785
- enforce_congruence (to_app (t)->get_decl (), to_app (t), m.get_sort (t));
786
+ enforce_congruence (to_app (t)->get_decl (), to_app (t), s);
787
+ }
788
+ else if (round == 1 && sort_covered (s) && m.is_value (t)) {
789
+ expr_ref v = eval_abs (t);
790
+ val2elem_t & v2e = get_table (s);
791
+ expr* e;
792
+ if (v2e.find (v, e)) {
793
+ if (e != t) {
794
+ m_context.add (m.mk_not (m.mk_eq (e, t)), __FUNCTION__);
795
+ }
796
+ }
797
+ else {
798
+ m_pinned.push_back (v);
799
+ v2e.insert (v, t);
800
+ }
801
+ }
802
+ if (m.is_value (t)) {
803
+ // std::cout << mk_bounded_pp(t, m, 2) << " " << eval_abs(t) << " " << mk_pp(s, m) << "\n";
786
804
}
787
805
}
788
806
@@ -797,7 +815,7 @@ namespace smtfd {
797
815
}
798
816
}
799
817
check_term (t, 0 );
800
- return is_uf (t) || is_uninterp_const (t);
818
+ return is_uf (t) || is_uninterp_const (t) || sort_covered (s) ;
801
819
}
802
820
803
821
bool sort_covered (sort* s) override {
@@ -1352,7 +1370,10 @@ namespace smtfd {
1352
1370
if (!m_model->eval_expr (q->get_expr (), tmp, true )) {
1353
1371
return l_undef;
1354
1372
}
1355
- if (m.is_true (tmp)) {
1373
+ if (is_forall (q) && m.is_true (tmp)) {
1374
+ return l_false;
1375
+ }
1376
+ if (is_exists (q) && m.is_false (tmp)) {
1356
1377
return l_false;
1357
1378
}
1358
1379
TRACE (" smtfd" ,
@@ -1664,27 +1685,31 @@ namespace smtfd {
1664
1685
m_context.reset (m_model);
1665
1686
expr_ref_vector terms (core);
1666
1687
terms.append (m_axioms);
1667
- TRACE (" smtfd" , tout << " axioms: " << m_axioms << " \n " ;);
1668
1688
for (expr* t : subterms (core)) {
1669
1689
if (is_forall (t) || is_exists (t)) {
1670
1690
has_q = true ;
1671
1691
}
1672
1692
}
1673
1693
for (expr* t : subterms (terms)) {
1674
- if (!m_context.term_covered (t) || !m_context.sort_covered (m.get_sort (t))) {
1694
+ if (!is_forall (t) && ! is_exists (t) && (! m_context.term_covered (t) || !m_context.sort_covered (m.get_sort (t) ))) {
1675
1695
is_decided = l_false;
1676
1696
}
1677
1697
}
1678
1698
m_context.populate_model (m_model, terms);
1679
1699
TRACE (" smtfd" ,
1680
- for (expr* a : subterms (terms)) {
1681
- expr_ref val0 = (*m_model)(a);
1682
- expr_ref val1 = (*m_model)(abs (a));
1683
- if (val0 != val1 && m.get_sort (val0) == m.get_sort (val1)) {
1684
- tout << mk_bounded_pp (a, m, 2 ) << " := " << val0 << " " << val1 << " \n " ;
1685
- }
1686
- });
1687
- TRACE (" smtfd" , tout << " has quantifier: " << has_q << " \n " << core << " \n " ;);
1700
+ tout << " axioms: " << m_axioms << " \n " ;
1701
+ for (expr* a : subterms (terms)) {
1702
+ expr_ref val0 = (*m_model)(a);
1703
+ expr_ref val1 = (*m_model)(abs (a));
1704
+ if (val0 != val1 && m.get_sort (val0) == m.get_sort (val1)) {
1705
+ tout << mk_bounded_pp (a, m, 2 ) << " := " << val0 << " " << val1 << " \n " ;
1706
+ }
1707
+ if (!is_forall (a) && !is_exists (a) && (!m_context.term_covered (a) || !m_context.sort_covered (m.get_sort (a)))) {
1708
+ tout << " not covered: " << mk_pp (a, m) << " " << mk_pp (m.get_sort (a), m) << " " ;
1709
+ tout << m_context.term_covered (a) << " " << m_context.sort_covered (m.get_sort (a)) << " \n " ;
1710
+ }
1711
+ }
1712
+ tout << " has quantifier: " << has_q << " \n " << core << " \n " ;);
1688
1713
if (!has_q) {
1689
1714
return is_decided;
1690
1715
}
@@ -1850,59 +1875,6 @@ namespace smtfd {
1850
1875
TRACE (" smtfd" , tout << " block:\n " << mk_bounded_pp (fml, m, 3 ) << " \n " << mk_bounded_pp (abs (fml), m, 3 ) << " \n " ;);
1851
1876
assert_fd (fml);
1852
1877
}
1853
- #if 0
1854
- lbool check_sat_core2(unsigned num_assumptions, expr * const * assumptions) override {
1855
- init();
1856
- flush_assertions();
1857
- lbool r;
1858
- expr_ref_vector core(m);
1859
- while (true) {
1860
- IF_VERBOSE(1, verbose_stream() << "(smtfd-check-sat :rounds " << m_stats.m_num_rounds << " lemmas: " << m_stats.m_num_lemmas << " :qi " << m_stats.m_num_mbqi << ")\n");
1861
- m_stats.m_num_rounds++;
1862
- checkpoint();
1863
-
1864
- // phase 1: check sat of abs
1865
- r = check_abs(num_assumptions, assumptions);
1866
- if (r != l_true) {
1867
- return r;
1868
- }
1869
-
1870
- // phase 2: find prime implicate over FD (abstraction)
1871
- r = get_prime_implicate(num_assumptions, assumptions, core);
1872
- if (r != l_false) {
1873
- return r;
1874
- }
1875
-
1876
- // phase 3: prime implicate over SMT
1877
- r = check_smt(core);
1878
- if (r == l_true) {
1879
- return r;
1880
- }
1881
-
1882
- // phase 4: add theory lemmas
1883
- if (r == l_false) {
1884
- block_core(core);
1885
- }
1886
- if (add_theory_axioms(core)) {
1887
- continue;
1888
- }
1889
- if (r != l_undef) {
1890
- continue;
1891
- }
1892
- switch (is_decided_sat(core)) {
1893
- case l_true:
1894
- return l_true;
1895
- case l_undef:
1896
- break;
1897
- case l_false:
1898
- // m_max_conflicts = UINT_MAX;
1899
- break;
1900
- }
1901
- }
1902
- return l_undef;
1903
- }
1904
-
1905
- #else
1906
1878
1907
1879
lbool check_sat_core2 (unsigned num_assumptions, expr * const * assumptions) override {
1908
1880
init ();
@@ -2008,9 +1980,6 @@ namespace smtfd {
2008
1980
return r;
2009
1981
}
2010
1982
2011
- #endif
2012
-
2013
-
2014
1983
void updt_params (params_ref const & p) override {
2015
1984
::solver::updt_params (p);
2016
1985
if (m_fd_sat_solver) {
0 commit comments