diff --git a/src/library/blast/blast.cpp b/src/library/blast/blast.cpp index 4511b00b2..203606574 100644 --- a/src/library/blast/blast.cpp +++ b/src/library/blast/blast.cpp @@ -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 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 { diff --git a/src/library/constants.cpp b/src/library/constants.cpp index ef28bb6b8..3cdddf03b 100644 --- a/src/library/constants.cpp +++ b/src/library/constants.cpp @@ -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; } diff --git a/src/library/constants.h b/src/library/constants.h index 7a68b2bff..d60a93531 100644 --- a/src/library/constants.h +++ b/src/library/constants.h @@ -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(); diff --git a/src/library/constants.txt b/src/library/constants.txt index 9177f7d1b..fc23fdf56 100644 --- a/src/library/constants.txt +++ b/src/library/constants.txt @@ -75,6 +75,7 @@ nat nat.of_num nat.succ nat.zero +ne neg not not_of_iff_false diff --git a/tests/lean/run/blast_cc12.lean b/tests/lean/run/blast_cc12.lean index 2dba59441..781d76a0a 100644 --- a/tests/lean/run/blast_cc12.lean +++ b/tests/lean/run/blast_cc12.lean @@ -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