Commit graph

12978 commits

Author SHA1 Message Date
Leonardo de Moura
ac0be0ecc6 chore(frontends/lean/elaborator): style 2017-08-22 15:41:12 -07: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
5cbc1470b9 chore(bin/leanpkg): return nicer error message if greadlink is not available on OSX
see issue #1788
2017-08-21 20:20:13 +02:00
Gabriel Ebner
7453148ad2 fix(library/tactic/simp_lemmas): only check has_idx_metavar in simp_lemmas.rewrite
This copies the change made in 2ca2920284
2017-08-20 09:30:16 +02:00
Gabriel Ebner
8a6d2e2a54 chore(library/init/meta/simp_tactic): typo 2017-08-20 09:25:44 +02:00
Gabriel Ebner
df5fb70c8a fix(emacs/lean-server): fix "error running timer"
This error occurred in files without trailing newlines.
2017-08-19 13:35:58 +02:00
Leonardo de Moura
049d940167 chore(frontends/lean/elaborator): cleanup 2017-08-18 17:50:29 -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
bb5ce6d04b fix(library/init/meta/interactive_base): incorrect pattern
@kha I'm trying to improve the equation compiler. I have added a
preprocessing step, and got the following wierd output when testing
tests/lean/interactive/info_goal.lean

```
> {"record":{"doc":"This tactic applies to any goal. It gives directly the exact proof\nterm of the goal. Let `T` be our goal, let `p` be a term of type `U` then\n`exact p` succeeds iff `T` and `U` are definitionally equal.","source":,"state":"⊢ ℕ → ℕ","tactic_params":["<error while executing interactive.param_desc: don't know how to pretty print lean.parser.pexpr 2>"],"text":"exact","type":"interactive.parse interactive.types.texpr → tactic unit"},"response":"ok","seq_num":4}
```

The problem seems to be the pattern
`(parser.pexpr)
which is sugar for
`(parser.pexpr std.prec.max)
and will not match `(pexpr 2)`

So, I fixed it by replacing the pattern with `(parser.pexpr %%v).
However, it is not clear to me why it was working before.
Any ideas?
2017-08-18 17:05:44 -07:00
Leonardo de Moura
c149286f44 fix(frontends/lean/elaborator): add instantiate_pattern_mvars 2017-08-18 16:49:45 -07:00
Leonardo de Moura
94e7b46214 fix(library/string): is_char_value bug
Type may be a metavariable, and the is_def_eq test may succeed by
unifying the metavariable with `char`
2017-08-18 15:29:51 -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
6b9bf5e2b7 fix(library/tactic/simp_lemmas): report invalid simplification lemmas also in add() 2017-08-18 19:32:51 +02:00
Gabriel Ebner
ef83c37973 fix(library/init/meta/simp_tactic): dsimp_target: instantiate_mvars 2017-08-18 09:24:04 +02:00
Gabriel Ebner
effd624911 fix(frontends/lean/parser): add check_system call 2017-08-18 08:54:04 +02:00
Gabriel Ebner
0d8e62ed40 feat(library/tactic/simp_lemmas): add both equational lemmas and the definition itself 2017-08-18 08:54:04 +02:00
Gabriel Ebner
256ca9789f fix(library/tactic/simp_lemmas): fix typo in pp 2017-08-18 08:54:03 +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
Leonardo de Moura
0660e18943 feat(library/metavar_context): add method for setting metavar user facing name 2017-08-17 16:03:32 -07:00
Leonardo de Moura
9927f331f4 chore(frontends/lean/elaborator): remove dead code 2017-08-17 16:03:32 -07:00
Sebastian Ullrich
b08158fcb8 feat(emacs): add searching definitions using helm on C-c C-d 2017-08-17 18:21:09 +02:00
Leonardo de Moura
9334a76810 chore(script/package_registry): remove library_dev from test suite 2017-08-17 07:41:35 -07:00
Mario Carneiro
97815e4eb3 feat(init/logic): false.elim eliminates to Sort 2017-08-17 11:42:55 +02: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
dbfee23682 chore(.github/CONTRIBUTING.md): update PR submission guidelines. 2017-08-16 14:22:32 -07:00
Leonardo de Moura
12b28546e8 chore(library/library.md): update documentation 2017-08-16 14:17:26 -07:00
Leonardo de Moura
d25ee51b43 refactor(library): move lazy_list back to core library 2017-08-16 14:08:46 -07:00
Leonardo de Moura
dc68cc7445 refactor(library): move stream back to the core library 2017-08-16 13:45:36 -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
32ddac5f40 feat(library/tactic/kabstract): expose kabstract to VM 2017-08-14 11:41:54 +02:00
Gabriel Ebner
867bc46d99 feat(library/vm/vm_parser): expose parse_command_like to the vm 2017-08-14 11:41:48 +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
7e4a5a78c8 chore(library/init/algebra/order): generalize lemma 2017-08-06 09:58:24 +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
66b80dde54 chore(library/init/algebra/order): remove unused lemmas 2017-08-02 14:41:35 +01:00
Gabriel Ebner
f5a6429efc doc(doc/changes): describe order type class changes 2017-08-02 14:41:35 +01:00