diff --git a/src/frontends/lean/parser.cpp b/src/frontends/lean/parser.cpp
index 63c6363085..2868f79482 100644
--- a/src/frontends/lean/parser.cpp
+++ b/src/frontends/lean/parser.cpp
@@ -1178,7 +1178,7 @@ class parser::imp {
\remark If implicit_decls is true, then we allow declarations
with curly braces. These declarations are used to tag implicit
arguments. Such as:
- Definition f {A : Type} (a b : A), A := ...
+ Definition f {A : Type} (a b : A) : A := ...
\see parse_simple_bindings
*/
@@ -1213,16 +1213,21 @@ class parser::imp {
}
}
- /** \brief Parse bindings for object such as: definitions, theorems, axioms, variables ... */
- void parse_object_bindings(bindings_buffer & result) {
- parse_bindings(result, true, false);
- }
-
/** \brief Parse bindings for expressions such as: lambda, pi, forall, exists */
void parse_expr_bindings(bindings_buffer & result) {
parse_bindings(result, false, true);
}
+ /** \brief Parse bindings for object such as: axioms, variables ... */
+ void parse_var_decl_bindings(bindings_buffer & result) {
+ parse_bindings(result, true, false);
+ }
+
+ /** \brief Parse bindings for object such as: theorems, definitions ... */
+ void parse_definition_bindings(bindings_buffer & result) {
+ parse_bindings(result, true, true);
+ }
+
/**
\brief Create a lambda/Pi abstraction, using the giving binders
and body.
@@ -1859,7 +1864,7 @@ class parser::imp {
pre_val = parse_expr();
} else {
mk_scope scope(*this);
- parse_object_bindings(bindings);
+ parse_definition_bindings(bindings);
expr type_body;
if (curr_is_colon()) {
next();
@@ -1935,7 +1940,7 @@ class parser::imp {
type = p.first;
} else {
mk_scope scope(*this);
- parse_object_bindings(bindings);
+ parse_var_decl_bindings(bindings);
check_colon_next("invalid variable/axiom declaration, ':' expected");
expr type_body = parse_expr();
auto p = m_elaborator(mk_abstraction(false, bindings, type_body));
diff --git a/tests/lean/compact_def.lean b/tests/lean/compact_def.lean
new file mode 100644
index 0000000000..9d20c5fd2d
--- /dev/null
+++ b/tests/lean/compact_def.lean
@@ -0,0 +1,4 @@
+Definition f x y := x + y
+Definition g x y := sin x + y
+Definition h x y := x * sin (x + y)
+Show Environment 3
\ No newline at end of file
diff --git a/tests/lean/compact_def.lean.expected.out b/tests/lean/compact_def.lean.expected.out
new file mode 100644
index 0000000000..c2800a677d
--- /dev/null
+++ b/tests/lean/compact_def.lean.expected.out
@@ -0,0 +1,8 @@
+ Set: pp::colors
+ Set: pp::unicode
+ Defined: f
+ Defined: g
+ Defined: h
+Definition f (x y : ℕ) : ℕ := x + y
+Definition g (x y : ℝ) : ℝ := sin x + y
+Definition h (x y : ℝ) : ℝ := x * sin (x + y)