feat(library/blast/blast): force 'ne' to be always transparent

This commit is contained in:
Leonardo de Moura 2015-12-04 17:58:39 -08:00
parent af01e7fea8
commit 2682fe9525
5 changed files with 24 additions and 3 deletions

View file

@ -105,6 +105,17 @@ class blastenv {
unfold_macro_pred m_unfold_macro_pred;
bool m_classical{false};
bool is_extra_opaque(name const & n) const {
// TODO(Leo, Daniel): should we force 'not' to be always opaque?
// If we do that, we can remove the whnf-trick from unit_propagate.
// We can also avoid the `is_pi(type) && !is_prop(type)`
if (n == get_ne_name())
return false;
return
(m_not_reducible_pred(n) ||
m_projection_info.contains(n));
}
class tctx : public type_context {
blastenv & m_benv;
std::vector<state::assignment_snapshot> m_stack;
@ -114,8 +125,7 @@ class blastenv {
m_benv(benv) {}
virtual bool is_extra_opaque(name const & n) const override {
// TODO(Leo): class and instances
return m_benv.m_not_reducible_pred(n) || m_benv.m_projection_info.contains(n);
return m_benv.is_extra_opaque(n);
}
virtual bool should_unfold_macro(expr const & e) const override {

View file

@ -80,6 +80,7 @@ name const * g_nat = nullptr;
name const * g_nat_of_num = nullptr;
name const * g_nat_succ = nullptr;
name const * g_nat_zero = nullptr;
name const * g_ne = nullptr;
name const * g_neg = nullptr;
name const * g_not = nullptr;
name const * g_not_of_iff_false = nullptr;
@ -265,6 +266,7 @@ void initialize_constants() {
g_nat_of_num = new name{"nat", "of_num"};
g_nat_succ = new name{"nat", "succ"};
g_nat_zero = new name{"nat", "zero"};
g_ne = new name{"ne"};
g_neg = new name{"neg"};
g_not = new name{"not"};
g_not_of_iff_false = new name{"not_of_iff_false"};
@ -451,6 +453,7 @@ void finalize_constants() {
delete g_nat_of_num;
delete g_nat_succ;
delete g_nat_zero;
delete g_ne;
delete g_neg;
delete g_not;
delete g_not_of_iff_false;
@ -636,6 +639,7 @@ name const & get_nat_name() { return *g_nat; }
name const & get_nat_of_num_name() { return *g_nat_of_num; }
name const & get_nat_succ_name() { return *g_nat_succ; }
name const & get_nat_zero_name() { return *g_nat_zero; }
name const & get_ne_name() { return *g_ne; }
name const & get_neg_name() { return *g_neg; }
name const & get_not_name() { return *g_not; }
name const & get_not_of_iff_false_name() { return *g_not_of_iff_false; }

View file

@ -82,6 +82,7 @@ name const & get_nat_name();
name const & get_nat_of_num_name();
name const & get_nat_succ_name();
name const & get_nat_zero_name();
name const & get_ne_name();
name const & get_neg_name();
name const & get_not_name();
name const & get_not_of_iff_false_name();

View file

@ -75,6 +75,7 @@ nat
nat.of_num
nat.succ
nat.zero
ne
neg
not
not_of_iff_false

View file

@ -22,4 +22,9 @@ attribute not [reducible]
definition foo4 (a b c d : nat) (p : Prop) : a ≠ d → (d ≠ a → p) → p :=
by blast
print foo4
attribute ne [semireducible]
definition foo5 (a b c d : nat) (p : Prop) : a ≠ d → (d ≠ a → p) → p :=
by blast
print foo5