lean4-htt/src/frontends/lean
Leonardo de Moura 34291e2151 feat: add Name.simpMacroScopes
@Kha We currently have a few macros that create binder names
such as `x`. These macros rely on the hygienic framework. This part is
great. Before this commit we were simply erasing the macro
scopes when creating the actual binders at `Expr.lean`.
The result produced expressions that were hard to debug.
For example, consider the following scenario

1- Macro creates a few binder names using ``x <- `(x)``
2- We create a lambda expression `t` with these binder names.
3- Then, we use `lambdaTelescope t fun xs body => ...`
   Now, if we trace `xs` and `body`, we get `#[x, x, ... x]` and
   we can't distinguish the different `x`s in `body`.
   So, it is really hard to debug anything using the traces.

This commit adds `Name.simpMacroScopes` for simplying "macro scoped"
names. Example: given `x._@.Init.Data.List.Basic._hyg.2.5`, it
produces `x.2.5`. I exported this function, and used it in the old
pretty printer.

I have considered modifying `lambdaTelescope` to make sure it creates
unused names. I think this option is bad because it introduces
overhead, and in a few places we want to preserve the binder names.

I have also considered replacing the `let x := x.eraseMacroScopes` at
`Expr.lean` with `let x := x.simpMacroScopes`. I think this option is
bad since we are destroying scoping information and will not be able
to distiguish which variables have macro scopes when processing
tactics.

Anyway, the solution in this commit is good for this week, but we
should discuss a more permanent solution next week.
2020-09-08 18:22:44 -07:00
..
brackets.cpp fix: { ... : <expected-type> } syntax in the old frontend 2020-05-20 15:49:40 -07:00
brackets.h
builtin_cmds.cpp feat: replace OS-specific stream redirection with pure-Lean Stream redirection 2020-08-28 10:04:32 -07:00
builtin_cmds.h
builtin_exprs.cpp fix: compiler do a; b as a >>= fun _ => b 2020-08-15 15:51:00 -07:00
builtin_exprs.h
choice.cpp
choice.h
CMakeLists.txt chore: remove dead code 2019-11-14 15:24:18 -08:00
cmd_table.h
decl_attributes.cpp chore: disable attribute features that are not currently being used 2020-01-08 15:49:55 -08:00
decl_attributes.h feat: allow attributes to be applied before elaboration 2019-11-13 15:40:19 -08:00
decl_cmds.cpp chore: fix includes 2020-05-22 14:17:25 -07:00
decl_cmds.h feat(frontends/lean, library/init/lean): opaque constants 2019-03-15 17:41:44 -07:00
decl_util.cpp refactor: remove Expr.FVar hack 2019-11-15 14:04:26 -08:00
decl_util.h feat(frontends/lean): add simple parser! macro 2019-06-24 15:48:11 -07:00
definition_cmds.cpp chore: rename ST.Ref primitives 2020-08-23 12:28:14 -07:00
definition_cmds.h
elaborator.cpp chore: fix includes 2020-05-22 14:17:25 -07:00
elaborator.h chore: remove silent | matchFailed support 2020-02-10 13:15:21 -08:00
inductive_cmds.cpp chore: fix includes 2020-05-22 14:17:25 -07:00
inductive_cmds.h
init_module.cpp chore(frontends/lean): delete lean_environment 2019-05-13 13:05:04 -07:00
init_module.h
json.cpp
json.h
local_context_adapter.cpp refactor: remove Expr.FVar hack 2019-11-15 14:04:26 -08:00
local_context_adapter.h
local_decls.h chore: fix C++ warnings 2020-08-14 14:42:44 +02:00
local_level_decls.h chore: fix C++ warnings 2020-08-14 14:42:44 +02:00
match_expr.cpp feat(library/init): use new "empty match" syntax 2019-07-15 16:25:14 -07:00
match_expr.h feat(frontends/lean): add new "empty/no match" syntax to old parser 2019-07-15 16:18:44 -07:00
notation_cmd.cpp chore: fix includes 2020-05-22 14:17:25 -07:00
notation_cmd.h
parse_table.cpp chore: fix includes 2020-05-22 14:17:25 -07:00
parse_table.h
parser.cpp chore: fix includes 2020-05-22 14:17:25 -07:00
parser.h chore: fix includes 2020-05-22 14:17:25 -07:00
parser_config.cpp chore: fix includes 2020-05-22 14:17:25 -07:00
parser_config.h chore: fix includes 2020-05-22 14:17:25 -07:00
parser_pos_provider.h
parser_state.h
pp.cpp feat: add Name.simpMacroScopes 2020-09-08 18:22:44 -07:00
pp.h chore: fix includes 2020-05-22 14:17:25 -07:00
prenum.cpp chore: fix includes 2020-05-22 14:17:25 -07:00
prenum.h chore: fix includes 2020-05-22 14:17:25 -07:00
print_cmd.cpp chore: fix includes 2020-05-22 14:17:25 -07:00
print_cmd.h
scanner.cpp chore: fix includes 2020-05-22 14:17:25 -07:00
scanner.h chore: fix includes 2020-05-22 14:17:25 -07:00
simple_pos_info_provider.h
structure_cmd.cpp chore: remove dead code 2020-07-24 09:52:35 -07:00
structure_cmd.h
structure_instance.cpp chore: fix includes 2020-05-22 14:17:25 -07:00
structure_instance.h
token_table.cpp feat: adjust fun/do precedence in old frontend 2020-06-16 10:41:42 -07:00
token_table.h
tokens.cpp chore(frontends/lean): fun x, e ==> fun x => e 2019-07-02 13:22:11 -07:00
tokens.h chore(frontends/lean): fun x, e ==> fun x => e 2019-07-02 13:22:11 -07:00
tokens.txt chore(frontends/lean): fun x, e ==> fun x => e 2019-07-02 13:22:11 -07:00
type_util.cpp feat: make RelaxedImplicit the default behavior 2020-05-12 15:02:03 -07:00
type_util.h
typed_expr.cpp
typed_expr.h
util.cpp chore: fix includes 2020-05-22 14:17:25 -07:00
util.h refactor(util/sexpr/options): options as a Lean object 2019-05-16 14:27:44 -07:00