Commit graph

31 commits

Author SHA1 Message Date
Leonardo de Moura
e9f843ddf6 refactor(kernel/expr): remove mlocal_* functions
The constructors `mvar` and `fvar` have different memory layouts.
2018-06-22 14:25:31 -07:00
Leonardo de Moura
bc57c66ae3 refactor(kernel/level): naming consistency 2018-06-22 10:29:56 -07:00
Leonardo de Moura
3d1faee826 chore(kernel/abstract_type_context): remove dead method abstract_type_context::abstract
We needed this method when we were using delayed abstractions
2018-06-07 16:28:54 -07:00
Leonardo de Moura
6333043adf refactor(kernel): abstract_local(s) ==> abstract 2018-06-07 16:28:54 -07:00
Leonardo de Moura
330c9afbc0 feat(library/metavar_context): store user_name at metavar_decl 2018-06-05 14:29:55 -07:00
Leonardo de Moura
ff3a3177c3 chore(library/local_context): get_pp_name => get_user_name 2018-06-04 16:08:28 -07:00
Leonardo de Moura
2ddb9d1598 refactor(library): remove delayed_abstraction macro
We replace them with a new kind of (delayed) assignment at `metavar_context`
```
mvar := (lctx, locals, v)
```
where `lctx` is a local context, `locals` is a list of local
constants, and `v` is an expression.
When all metavariables in `v` are assigned, this assignment is replaced with
```
mvar := Fun(locals, v)
```
2018-05-30 10:04:04 -07:00
Leonardo de Moura
5692baaaf8 chore(library/metavar_context): remove m_ngen field
It was a bad idea to try to store the name_generator here.
We copy/restore metavar_context objects in a few places.
These operations would trigger the regeneration of previously generated
fresh names, and would violate the assumptions made at persistent_context_cache.

We should have a name_generator at type_context instead.
2018-02-23 17:43:48 -08:00
Leonardo de Moura
2cb018734e chore(library/metavar_context): add TODO's 2018-02-23 10:35:21 -08:00
Leonardo de Moura
eb648a3298 feat(library/metavar_context): add name_generator field.
This is work-in-progress. The change exposed many problems in the
metavar_context propagation.
2018-02-23 10:34:00 -08:00
Leonardo de Moura
e9650d835d chore(library/type_context): cleanup metavar method names
This commit also fixes some corner case bugs at is_def_eq
2018-01-03 13:49:42 -08:00
Leonardo de Moura
0660e18943 feat(library/metavar_context): add method for setting metavar user facing name 2017-08-17 16:03:32 -07:00
Sebastian Ullrich
26ac6d31f2 fix(library/metavar_util): do not compress mvar assignments in tmp mode 2017-04-16 09:35:49 -07:00
Leonardo de Moura
ca31ad0107 perf(library/metavar_util): quadratic behavior when assembling the final proof
The peformance problem was affecting theorems that contain many `intro`
tactic applications.

@gebner After this optimization, the GAPT benchmark elaboration time went from
1.6 secs to 0.6 secs.
2017-02-21 21:02:43 -08:00
Leonardo de Moura
53667dd602 fix(library): change API and make sure we don't crash when searching for a non existing local decl
Fixes #1363

After error recovery has been implemented in the elaborator, a few
assumptions made in the type context are not valid anymore since we may
be recovering from errors, and the local and metavariable contexts may
be invalid.

I used the approach used in the class environment.

- find* methods return optional<...>
- get* methods throw exception for unknown elements

Remarks:

I preserved code patterns such as

     optional<local_decl> d = lctx.find_local_decl(...)
     lean_assert(d)

and did not convert them into

     local_decl d = lctx.get_local_decl(...)

Reason: the intention is clear that the local must be defined there.
If it is not we should analyze the problem and decide whether we should
throw an exception or not.

However, I converted code patterns such as

    local_decl d = *lctx.find_local_decl(...)

into

    local_decl d = lctx.get_local_decl(...)

Disclaimer: this change fixes issue #1363, but it may obfuscate other bugs.
2017-02-07 09:38:19 -08:00
Leonardo de Moura
fa3475fa66 fix(library/type_context): allow assigned regular meta-variables to be "read" in tmp-mode
This commit also removes a "hack" that tried to fix this problem for
universe meta-variables only. Moreover, the hack was incomplete, since
it would not consider nested metavars.
2016-10-21 13:33:07 -07:00
Leonardo de Moura
78f81034c6 feat(library): add helper methods 2016-08-29 08:31:33 -07:00
Leonardo de Moura
8b533a54c2 feat(frontends/lean/pp): improve purify_metavars 2016-07-30 15:31:06 -07:00
Leonardo de Moura
b53e50c968 fix(library/metavar_context): incorrect assertions 2016-07-25 19:11:01 -07:00
Leonardo de Moura
d9fb21ecc8 feat(library/tactic/cases_tactic): clear auxiliary indices 2016-07-14 16:54:04 -04:00
Daniel Selsam
0742b65183 fix(library/metavar_context): comment out problematic assertion 2016-07-09 10:14:45 -07:00
Leonardo de Moura
80cf1e8353 feat(library/metavar_context): use head_beta_reduce at mk_metavar_decl 2016-07-05 13:50:44 -07:00
Leonardo de Moura
61a845c005 feat(library/tactic): add 'apply' tactic 2016-06-17 20:11:52 -07:00
Leonardo de Moura
26c10c368a refactor(library): instantiate ==> instantiate_mvars
Motivation: avoid confusion with 'instantiate' procedure for variables
2016-06-14 10:29:47 -07:00
Leonardo de Moura
4c6de9f8e4 fix(library/metavar_context): incorrect assertions 2016-06-11 20:29:10 -07:00
Leonardo de Moura
8038ca5f0c refactor(metavar_context): metavar_decl contains a local_context instead of local_decls
Motivations:
- A goal is essentially a metavar_decl
- We need the local_context to implement restrict_metavars_context method
2016-03-15 12:52:30 -07:00
Leonardo de Moura
9ecd4a2c85 dec(library/type_context): basic backtracking support 2016-03-13 13:22:48 -07:00
Leonardo de Moura
011b388247 feat(library): add metavar_util template to avoid code duplication 2016-03-10 14:07:57 -08:00
Leonardo de Moura
ea2d3de71b dev(library/type_context): is_def_eq for universes 2016-03-10 12:13:32 -08:00
Leonardo de Moura
c0fc9e5479 feat(library/local_context, library/metavar_context): add new well_formed methods and procedures 2016-03-05 14:56:13 -08:00
Leonardo de Moura
4543dc4a7f feat(library): add metavar_context 2016-03-05 12:53:45 -08:00