diff --git a/src/frontends/lean/decl_cmds.cpp b/src/frontends/lean/decl_cmds.cpp index 2555d661a..5c00834cf 100644 --- a/src/frontends/lean/decl_cmds.cpp +++ b/src/frontends/lean/decl_cmds.cpp @@ -172,9 +172,9 @@ optional parse_binder_info(parser & p, variable_kind k) { } static void check_variable_kind(parser & p, variable_kind k) { - if (in_context(p.env())) { + if (in_context(p.env()) || in_section(p.env())) { if (k == variable_kind::Axiom || k == variable_kind::Constant) - throw parser_error("invalid declaration, 'constant/axiom' cannot be used in contexts", + throw parser_error("invalid declaration, 'constant/axiom' cannot be used in sections/contexts", p.pos()); } else if (!in_section(p.env()) && !in_context(p.env()) && k == variable_kind::Parameter) { throw parser_error("invalid declaration, 'parameter/hypothesis/conjecture' "