Commit graph

3373 commits

Author SHA1 Message Date
Leonardo de Moura
50f8d232c3 feat(frontends/lean/decl_attributes): add expr_to_syntax 2019-06-18 15:17:46 -07:00
Leonardo de Moura
d664486eca chore(util): move format to src/util 2019-06-07 10:58:23 -07:00
Leonardo de Moura
12809945ba chore(util/sexpr/format): use Lean implementation 2019-06-07 10:45:42 -07:00
Leonardo de Moura
f6b9a0fe9c chore(util/sexpr/format): preparing to switch to Lean implementation 2019-06-07 09:46:34 -07:00
Leonardo de Moura
7beb74fb0f chore(util/sexpr/format): remove dead code 2019-06-07 09:28:30 -07:00
Leonardo de Moura
0553d60dbf feat(library/compiler/util): switch to new attributes implemented in Lean 2019-06-06 15:40:39 -07:00
Leonardo de Moura
2a557b1bbd feat(frontends/lean/decl_attributes): connect old frontend to new attribute manager 2019-06-06 10:43:09 -07:00
Leonardo de Moura
95b3ad69f9 chore(frontends/lean): remove parsing_only and prio from old attribute parser
This is a preparation for adding new attribute manager to the old frontend.
2019-06-05 15:01:03 -07:00
Leonardo de Moura
9310c807e6 feat(library/private): use environment extension in Lean
Remark: we don't need the `m_inv_map` anymore.
2019-06-03 11:50:33 -07:00
Leonardo de Moura
377b1ca042 chore(library/private): cleanup 2019-06-03 09:38:10 -07:00
Leonardo de Moura
fc0ce5b97e chore(library/aliases, frontends/lean): remove local_ref's
We don't need them since we removed parameters
2019-05-27 21:28:22 -07:00
Leonardo de Moura
8c6ae127c9 chore(library/scoped_ext): remove dead code 2019-05-27 21:28:22 -07:00
Leonardo de Moura
aa138fe686 chore(*): get_obj_arg => to_obj_arg 2019-05-16 14:42:02 -07:00
Leonardo de Moura
9d9f546ad8 refactor(util/sexpr): move options and option_declarations to util 2019-05-16 14:37:24 -07:00
Leonardo de Moura
9c4da289b2 refactor(util/sexpr/options): options as a Lean object 2019-05-16 14:27:44 -07:00
Leonardo de Moura
31d4fa9f71 chore(util/sexpr/options): shrink options API
Motivation: move to the Lean implementation
2019-05-16 14:08:11 -07:00
Leonardo de Moura
edeae776da chore(library/module): module::add for declarations is not needed anymore 2019-05-14 11:23:35 -07:00
Leonardo de Moura
99e3cdc01b chore(frontends/lean): delete lean_environment 2019-05-13 13:05:04 -07:00
Leonardo de Moura
edb4d76ecd feat(kernel/environment): environment as a Lean object 2019-05-13 12:41:33 -07:00
Leonardo de Moura
fd487d8db7 chore(*): remove old VM 2019-05-08 15:15:44 -07:00
Leonardo de Moura
0d1a0c8b6e chore(library): toBool ==> decide
We want to define a type class similar to Haskell's `ToBool`.
2019-05-06 14:02:15 -07:00
Sebastian Ullrich
1aef9ac576 feat(frontends/lean/match_expr): terminate match on dedent between equations 2019-05-03 13:46:10 +02:00
Leonardo de Moura
cd21793b53 fix(frontends/lean/elaborator): assertion violation
Prevent assertion violation when processing examples such as:
```
@[pattern] def badPattern (x : Nat) : Nat := 0

def tst (y : Nat) : Nat :=
match y with
| (@badPattern _) := 1
| _               := 2
```

The `x` is not used in `badPattern`. Thus, the elaborator fails to
synthesize the metavariable corresponding to `_` at `@badPattern _`.

The fix detects this kind of instance, but I commented the code the
throws the error because we would prevent us from compiling `term.lean`.
The assertion violation was originally triggered by the pattern definition
```
@[pattern] def «explicitBinderContent» (requireType : optParam.{1} Bool Bool.false) :=
  {SyntaxNodeKind . name := `Lean.Parser.Term.explicitBinderContent}
at

...
  view := fun stx, let (stx, i) := match stx.asNode : _ -> Prod Syntax Nat with
  | some {kind := @«explicitBinderContent» requireType,   -- << HERE
          args := [stx], ..} := ...
```
These definitions were generated by the node choice macro.

cc @kha
2019-03-27 16:42:59 -07:00
Leonardo de Moura
9a071c18e7 feat(library/equations_compiler): add support for partial definitions 2019-03-27 11:09:32 -07:00
Leonardo de Moura
9ddc778ac3 feat(library/equations_compiler/equations): add m_is_partial to equation header 2019-03-26 16:18:43 -07:00
Leonardo de Moura
1f11429f98 feat(frontends/lean): add partial keyword 2019-03-26 16:09:55 -07:00
Sebastian Ullrich
2df060be44 feat(frontends/lean/elaborator): node!: support parameterized parsers 2019-03-26 11:21:53 +01:00
Sebastian Ullrich
7c0912d41c refactor(frontends/lean/lean_environment): move environment parts out of lean_elaborator.cpp 2019-03-25 16:12:14 +01:00
Sebastian Ullrich
e3ea2e84d2 feat(frontends/lean/lean_elaborator): set position of #check output etc. 2019-03-23 23:13:09 +01:00
Leonardo de Moura
3d52298c69 chore(util/sexpr): preparing to port options to Lean 2019-03-22 13:58:16 -07:00
Leonardo de Moura
50207e2c5a chore(library/constants.txt): remove dead variables 2019-03-22 13:26:48 -07:00
Leonardo de Moura
930653f292 chore(library/init): Unit.star => Unit.unit
@kha Our stdlib is starting to match the names we used in our paper :)
2019-03-22 13:06:45 -07:00
Leonardo de Moura
c017686f70 fix(frontends/lean/lean_elaborator): pre_equations => preEquations 2019-03-21 15:11:05 -07:00
Leonardo de Moura
7982420d8d fix(library/init/lean/expander, frontends/lean/lean_elaborator): conversion issues 2019-03-21 15:06:46 -07:00
Leonardo de Moura
5f2b74df72 fix(frontends/lean/util): another mismatch to naming convention change 2019-03-21 15:06:46 -07:00
Leonardo de Moura
870a0456c4 fix(frontends/lean/builtin_exprs): match name used at elaborator.lean 2019-03-21 15:06:46 -07:00
Sebastian Ullrich
d5ec4a4606 chore(frontends/lean/pp): ppAnonymousCtor -> ppAsAnonymousCtor 2019-03-21 15:06:45 -07:00
Leonardo de Moura
2be87ecd92 chore(library/init): Bool.tt => Bool.true and Bool.ff => Bool.false 2019-03-21 15:06:44 -07:00
Leonardo de Moura
855dab52e0 chore(library/init/Lean): more fixes
`elaborator.lean` is almost working
2019-03-21 15:06:44 -07:00
Leonardo de Moura
7ac847877f chore(library/init/Lean/Parser): more fixes 2019-03-21 15:06:44 -07:00
Leonardo de Moura
5bbc80fdad chore(*): fixed token.lean 2019-03-21 15:06:44 -07:00
Leonardo de Moura
300aae08b3 chore(*): more fixes 2019-03-21 15:06:44 -07:00
Leonardo de Moura
35ddd49e7a chore(frontends/lean/structure_cmd): toParent instead of to_Parent 2019-03-21 15:06:44 -07:00
Leonardo de Moura
ac27bd092b chore(*): small fixes 2019-03-21 15:06:44 -07:00
Leonardo de Moura
e0b0ca4830 chore(*): adapt C++ code to camelCase 2019-03-21 15:06:43 -07:00
Leonardo de Moura
bc75a24127 chore(library, frontends): use camelCase for attribute names 2019-03-21 15:06:43 -07:00
Leonardo de Moura
039e7fab48 refactor(library): add suffixes.h with commonly used suffixes such as brec_on 2019-03-21 15:06:43 -07:00
Sebastian Ullrich
b325908d4a chore(frontends/lean/vm_elaborator): rename to lean_elaborator, update some comments 2019-03-16 19:29:12 +01:00
Sebastian Ullrich
e19ed79414 feat(shell/lean): pass environment to and from Lean, remove environment.mk_empty axiom
/cc @leodemoura

I didn't remove the implementation of `environment.mk_empty`, we may want to use
it in tests.
2019-03-16 19:27:16 +01:00
Leonardo de Moura
0b7d987699 feat(frontends/lean, library/init/lean): opaque constants
@kha I have added support for opaque constants to the old C++ frontend,
and made sure the new frontend can still parse `library/init/core.lean`.
The kernel should enforce that opaque constants are really opaque, and
the following example should fail
```
constant x : nat := 0
theorem foo : x = 0 := rfl
```
If it doesn't, it is a bug.

Here are some remaining issues:
1- `environment.mk_empty` is currently an axiom because we cannot create
an inhabitant of an opaque type. A possible solution is to use
`option environment` instead of `environment`.

2- There is no support for opaque constants in the new
frontend. However, I modified it to handle axioms, and fixed the literal
values with decl_cmd_kind. I tried to mark some of my changes with
comments, but it is probably much easier for you to just check the
commit change list.

3- I did not add any support for automatically constructing `e`
at `constant x : t := e`. I think we can do this later
after we replace the old frontend with the new one. BTW, it took only a
few minutes to provide the inhabitants manually.
2019-03-15 17:41:44 -07:00