Commit graph

7042 commits

Author SHA1 Message Date
Sebastian Ullrich
230bf7e8d9 fix(frontends/lean/decl_cmds): constant/axiom cmds: apply attributes 2017-09-11 16:56:02 -07:00
Leonardo de Moura
d428eca8a7 fix(library/equations_compiler,frontends/lean): private name support and alias generation for auxialiary declarations
fixes #1804

Remark: now, all auxiliary definitions in a private declaration share
the same "private" prefix.
2017-09-11 16:46:56 -07:00
Sebastian Ullrich
d82df26ff0 fix(frontends/lean/elaborator): go back to ignoring implicit args in quote patterns 2017-09-11 09:33:38 -07:00
Sebastian Ullrich
869ac974b2 fix(init/meta/interactive): assume: use rbp 2 2017-09-10 09:53:07 +02:00
Leonardo de Moura
1f757ba84e fix(frontends/lean/pp): fixes #1817 2017-09-07 15:23:58 -07:00
Mario Carneiro
87f2ec08ad feat(init/meta/interactive): suffices tactic
Just a simple manipulation of the `have` tactic, but it allows the use of `suffices h : T, from p,` in tactic mode.
2017-09-06 10:50:31 -07:00
Gabriel Ebner
19777cf9eb fix(frontends/lean/definition_cmds): show trace messages in examples 2017-09-06 14:44:44 +02:00
Gabriel Ebner
5adb3630b2 chore(tests): update test output 2017-09-06 14:27:39 +02:00
Gabriel Ebner
5f8cf45073 feat(frontends/lean/elaborator): apply to-sort coercion also in arguments 2017-09-06 14:15:30 +02:00
Gabriel Ebner
7b18d5828d feat(frontends/lean/elaborator): trigger coe_to_fun even when expected type has metavariables
We only need to know that the expected type is a Π to perform
to-function coercion.  Related to #1402.

Fixes https://github.com/gebner/hott3/issues/2
2017-09-06 11:20:04 +02:00
Leonardo de Moura
88cd294a09 feat(src/kernel/error_msgs): show aliased variables when printing error messages
closes #1814

@kenmcmil: the error messages will now list aliased variables.
For example, in your file, the new error message is:

```
invalid type ascription, term has type
  triple (ctxpre c' s_1 ∧ ctxpre c'_1 s_1) (bndngapp b s_1) (ctxpost c' s_1 ∧ ctxpost c'_1 s_1)
but is expected to have type
  triple (ctxpre c' s_1 ∧ ctxpre c'_1 s_1) (bndngapp b s_1) (ctxpost c' s_1 ∧ ctxpost c'_1 s_1)
types contain aliased name(s): c'
remark: the tactic `dedup` can be used to rename aliases
state:
...
```
2017-09-05 16:46:44 -07:00
Leonardo de Moura
51bac2918f chore(library/init/core): declare and using structure
This change was requested by several users.
2017-09-05 15:08:20 -07:00
Leonardo de Moura
3af8ca11bc chore(tests/lean/run/1797): add test for #1797 2017-09-05 14:36:51 -07:00
Leonardo de Moura
8a10d4c72c fix(library/init/meta/injection_tactic): fixes #1805 2017-09-05 14:20:22 -07:00
Sebastian Ullrich
1544c3d390 feat(library/tactic/user_attribute,init/meta/attribute): user_attribute.set_param 2017-09-05 23:14:34 +02:00
Sebastian Ullrich
52a9f82bc2 feat(init/meta/derive): implement [derive] attribute 2017-09-05 23:14:34 +02:00
Sebastian Ullrich
ea6a4159a9 feat(library/tactic/user_attribute,init/meta/attribute): implement parameterized user attributes 2017-09-05 23:14:34 +02:00
Sebastian Ullrich
3188c4cbcf refactor(library/tactic/user_attribute,init/meta/attribute): merge caching_user_attribute into user_attribute
The inheritance-based approach doesn't scale to a second subclass for parameterized attributes
2017-09-05 23:14:34 +02:00
Leonardo de Moura
da46862b46 fix(library/init/meta/interactive): fixes #1813 2017-09-05 13:33:05 -07:00
Gabriel Ebner
40de4f14c1 feat(library/tactic/simp_lemmas): allow simplification with let-bindings in the local context 2017-09-05 10:24:02 +02:00
Gabriel Ebner
488850e03a fix(library/util): get_num_inductive_hypotheses_for: use whnf to detect recursive arguments
Fixes #1812.
2017-09-05 08:28:32 +02:00
Gabriel Ebner
2d69fc9cd7 fix(library/init/meta/coinductive_predicates): bug with reflexive occurrences 2017-09-04 09:54:12 +02:00
Gabriel Ebner
de0fc09ab9 fix(library/congr_lemma): always return heq in mk_hcongr_lemma 2017-08-29 16:36:37 +02:00
Gabriel Ebner
9920062b69 fix(kernel/expr,library/constructions/projection): preserve instance-implicitness in structure parameters 2017-08-27 16:47:04 +02:00
Sebastian Ullrich
9e53147e0a feat(frontends/lean/elaborator): allow field notation for recursive calls 2017-08-22 15:33:37 -07:00
Leonardo de Moura
e99ce26b16 fix(library/type_context): fixes #1801
This commit also fixes the decay in error message quality reported at
c6a10b127f
2017-08-22 14:03:58 -07:00
Leonardo de Moura
971ae34521 feat(frontends/lean/elaborator): closes #1760
As described at issue #1760, the new error message is:
```
1760.lean:6:18: error: type mismatch at application
  f x
term
  x
has type
  big_type : Type 1
but is expected to have type
  ?m_1 : Type
```
2017-08-21 16:15:03 -07:00
Leonardo de Moura
fb2186334a fix(library/init/meta/relation_tactics,library/tactic/subst_tactic): fixes #1772 2017-08-21 14:51:30 -07:00
Leonardo de Moura
c6a10b127f chore(tests/lean): fix tests
Remarks:
- Some tests do not produce error messages anymore because they can be
  processed using the new equation compiler preprocessor.

- Some error messages got worse because of the preprocessing step.
  We use metavariables in the preprocessing step. This information
  may "leak" to users. Another problem is that some variable names
  are lost. Example: in the following definition

  def to_nat : ∀ {n}, fi n → nat
  | (succ n) f0     := 0
  | (succ n) (fs i) := succ (to_nat i)

  The preprocessing step uses metavariables for pattern variables.
  Thus, we have

  def to_nat : ∀ {n}, fi n → nat
  | (succ ?n) (@f0 ?x)    := 0
  | (succ ?n) (@fs ?x ?i) := succ (to_nat i)

  when solving the constraint `succ ?n =?= succ ?x`, Lean assigns
        ?n := ?x
  after solving these constraints, the preprocessor converts
  metavariables into pattern variables again, and we have

  def to_nat : ∀ {n}, fi n → nat
  | (succ x) (@f0 x)   := 0
  | (succ x) (@fs x i) := succ (to_nat i)

  So, we get the following equation lemmas:

  to_nat.equations._eqn_1 : ∀ (x : ℕ), @to_nat (succ x) (@f0 x) = 0
  to_nat.equations._eqn_2 : ∀ (x : ℕ) (i : fi x), @to_nat (succ x) (@fs x i) = succ (@to_nat x i)

  instead of

  to_nat.equations._eqn_1 : ∀ (n : ℕ), @to_nat (succ n) (@f0 n) = 0
  to_nat.equations._eqn_2 : ∀ (n : ℕ) (i : fi n), @to_nat (succ n) (@fs n i) = succ (@to_nat n i)
2017-08-18 17:32:13 -07:00
Leonardo de Moura
b6e24ba5c3 chore(tests/lean/run/bin_tree): fix test 2017-08-18 17:05:52 -07:00
Leonardo de Moura
d4f2bb77b8 feat(frontends/lean): recursive equation preprocessor
To make the equation compiler more convenient to use, we will add a
couple of preprocessing steps.
This commit adds the first one of them. In this step, we use
type inference to refine pattern variables, and we relax the
restrictions on inaccessible annotations.

We will also add a preprocessing step that implements the "complete
transition" step before we execute the elim_match step.
2017-08-18 15:06:11 -07:00
Gabriel Ebner
bbfbf1d8f5 doc(library/tactic/simp_lemmas): document and test change in ext_add_core 2017-08-18 19:34:08 +02:00
Gabriel Ebner
6bd3fe2449 feat(library/tactic/simp_lemmas): support congruence lemmas that are metavariable applications 2017-08-18 08:54:03 +02:00
Leonardo de Moura
c0a55cb3ed test(tests/lean/run): add backward chaining examples 2017-08-17 16:36:21 -07:00
Mario Carneiro
c5bb5cb1eb fix(init/meta/interactive_base): declare |- notation 2017-08-17 11:34:00 +02:00
Leonardo de Moura
6315136279 fix(frontends/lean/definition_cmds): fixes #1790 2017-08-16 15:57:55 -07:00
Leonardo de Moura
19ee270c60 refactor(library): remove vector and bitvec from init
Reason: vector in in init folder was introducing an overload (`::`) for
all Lean users. The workaround (use `local infix ::`) was
counterintuitive.

We currently have no special support for bitvectors in the code
generator. Thus, there is no need to have vector and bitvec in the init
folder right now. Moreover, the new parser and elaborator (issue #1674) should
provide better ways of managing overloaded symbols.
2017-08-16 13:40:50 -07:00
Sebastian Ullrich
987e681323 chore(test/lean): add overlooked test 2017-08-15 12:45:14 +02:00
Sebastian Ullrich
579d4a459e chore(init/meta/interactive): check simp lemmas for ambiguous overloads
Fixes #1786
2017-08-15 12:43:02 +02:00
Gabriel Ebner
b50597228b chore(tests/lean/print_ax2): remove duplicate and broken test 2017-08-06 10:33:33 +02:00
Gabriel Ebner
e2717ec2c5 fix(library/compiler/inliner): inline auxiliary declarations
Fixes #1763.
2017-08-06 10:24:26 +02:00
Gabriel Ebner
0c15724e8e fix(library/tactic/simplify): handle universe polymorphic simplification rules
The issue was that instantiate_mvars(infer(m)) had a metavariable, while
infer(instantiate_mvars(m)) did not.  Changing the call from assign to
is_def_eq also unifies the type, assigning the metavariable inside the
type.
2017-08-03 17:42:07 +01:00
Leonardo de Moura
b6c691cead test(tests/lean/run/whnf_mvar): add test to check whether whnf instantiate mvars or not
@digama0 As I suspected, `whnf` already instantiates metavariables.
2017-08-03 11:29:22 +01:00
Gabriel Ebner
22011dcde4 chore(init/algebra/order): typo
Thanks to @fpvandoorn for proof-reading!
2017-08-02 15:41:51 +01:00
Leonardo de Moura
f39e42bf2d fix(library/tactic/destruct_tactic): fixes #1766 2017-08-02 15:35:33 +01:00
Leonardo de Moura
fdaa26f2fd feat(library/equations_compiler/wf_rec): fixes #1782 2017-08-02 15:12:04 +01:00
Gabriel Ebner
5922f71c50 feat(library/init/algebra/order): add default value for lt 2017-08-02 14:41:35 +01:00
Gabriel Ebner
ce509e621a refactor(library/init/algebra): remove order_pair classes 2017-08-02 14:41:35 +01:00
Sebastian Ullrich
4f66673fc2 feat(init/meta/attribute,library/tactic/attribute): user_attribute apply handlers 2017-08-02 14:32:39 +01:00
Gabriel Ebner
becec82311 fix(frontends/lean/structure_cmd): simplify parser 2017-08-02 11:27:13 +01:00