feat(frontends/lean/decl_cmds): reject unnecessary "noncomputable" annotations

This commit is contained in:
Leonardo de Moura 2015-07-29 08:28:40 -07:00
parent 74be3031b1
commit 69ead0ddd8
4 changed files with 8 additions and 2 deletions

View file

@ -218,7 +218,7 @@ theorem rewrite_helper10 (a b c d : ) : c - d = (c - a) + (a - b) + (b - d) :
noncomputable definition rep (x : ) : s.reg_seq := some (quot.exists_rep x) noncomputable definition rep (x : ) : s.reg_seq := some (quot.exists_rep x)
noncomputable definition re_abs (x : ) : := definition re_abs (x : ) : :=
quot.lift_on x (λ a, quot.mk (s.r_abs a)) (take a b Hab, quot.sound (s.r_abs_well_defined Hab)) quot.lift_on x (λ a, quot.mk (s.r_abs a)) (take a b Hab, quot.sound (s.r_abs_well_defined Hab))
theorem r_abs_nonneg {x : } : zero ≤ x → re_abs x = x := theorem r_abs_nonneg {x : } : zero ≤ x → re_abs x = x :=

View file

@ -873,9 +873,13 @@ class definition_cmd_fn {
throw exception(sstream() << "definition '" << n << "' was marked as noncomputable because '" << *reason throw exception(sstream() << "definition '" << n << "' was marked as noncomputable because '" << *reason
<< "' is still in theorem queue (solution: use command 'reveal " << *reason << "'"); << "' is still in theorem queue (solution: use command 'reveal " << *reason << "'");
} else { } else {
throw exception(sstream() << "definition '" << n << "' is noncomputable, it depends on '" << *reason << "'"); throw exception(sstream() << "definition '" << n
<< "' is noncomputable, it depends on '" << *reason << "'");
} }
} }
if (m_is_noncomputable && !is_marked_noncomputable(m_env, real_n)) {
throw exception(sstream() << "definition '" << n << "' was incorrectly marked as noncomputable");
}
// TODO(Leo): register aux_decls // TODO(Leo): register aux_decls
if (!m_is_private) if (!m_is_private)
m_p.add_decl_index(real_n, m_pos, m_p.get_cmd_token(), type); m_p.add_decl_index(real_n, m_pos, m_p.get_cmd_token(), type);

View file

@ -0,0 +1 @@
noncomputable definition a := 2

View file

@ -0,0 +1 @@
noncomp_error.lean:1:0: error: definition 'a' was incorrectly marked as noncomputable