Skip to content

Commit

Permalink
fix(frontends/lean/brackets): fix {(0,1)} (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
gebner committed Jul 28, 2020
1 parent 0c7d574 commit cbfee49
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/frontends/lean/brackets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,14 @@ expr parse_curly_bracket(parser & p, unsigned, expr const *, pos_info const & po
parser::local_scope scope(p);
parser::all_id_local_scope scope_assumption(p);
e = parse_lparen(p, 0, NULL, pos); // parses the `expr ')'` part of the expression
p.check_token_next(get_bar_tk(), "invalid set replacement notation, '|' expected");
return parse_set_replacement(p, pos, e);
if (p.curr_is_token(get_rcurly_tk())) {
// singleton `{ (...) }`
p.next();
return mk_singleton(p, pos, e);
} else {
p.check_token_next(get_bar_tk(), "invalid set replacement notation, '|' expected");
return parse_set_replacement(p, pos, e);
}
} else if (p.curr_is_token(get_period_tk())) {
p.next();
p.check_token_next(get_rcurly_tk(), "invalid empty structure instance, '}' expected");
Expand Down
2 changes: 2 additions & 0 deletions tests/lean/run/singleton_pair.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
example : {(0,1)} = (singleton (0, 1) : set (ℕ × ℕ)) := rfl
example : {(0,1)} = [(0,1)] := rfl

0 comments on commit cbfee49

Please sign in to comment.