Commit graph

438 commits

Author SHA1 Message Date
Leonardo de Moura
44a2ef8f6f fix(frontends/lean/parser_config): binder(s) rbp was not being saved in .olean file 2014-11-23 17:49:14 -08:00
Leonardo de Moura
64686c1278 feat(frontends/lean): allow user to associate precedence to binders, closes #323 2014-11-23 17:30:46 -08:00
Leonardo de Moura
cf3b0e1087 feat(frontends/lean/placeholder_elaborator): apply substitution before collecting local instances, closes #333 2014-11-23 17:30:46 -08:00
Leonardo de Moura
13fba433b0 feat(library/tactic/generalize): add 'generalizes' syntax sugar, closes #327 2014-11-23 17:30:22 -08:00
Leonardo de Moura
919007612a fix(tests/lean): adjust tests since module 'logic' depends on nat
We need that because of the definitional package
2014-11-22 17:34:05 -08:00
Leonardo de Moura
5db13da95f test(tests/lean/run/div_wf): cleanup div based on well founded recursion 2014-11-22 09:56:47 -08:00
Leonardo de Moura
064ecd3e3d refactor(library/data/nat): declare lt and le asap using inductive definitions, and make key theorems transparent for definitional package
We also define key theorems that will be used to generate the
automatically generated a well-founded subterm relation for inductive
datatypes.
We also prove decidability and wf theorems asap.
2014-11-22 00:19:39 -08:00
Leonardo de Moura
5d5fd2da50 fix(frontends/lean): tactic + section variables, fixes #332 2014-11-21 10:07:16 -08:00
Leonardo de Moura
7e7e7c241c test(tests/lean/run/gcd): gcd compiled by hand into wf recursion 2014-11-18 19:34:01 -08:00
Leonardo de Moura
4fbb5cfcca test(tests/lean/run/div_wf): cleanup 2014-11-18 17:59:14 -08:00
Leonardo de Moura
a065c7bf96 test(tests/lean/run/tree_height): experiment with wf relation based on the height
This is easier to generate than the subterm relation
2014-11-18 17:57:17 -08:00
Leonardo de Moura
5fbe990c7a test(tests/lean/run): define div using wf package 2014-11-18 13:55:58 -08:00
Leonardo de Moura
5daff18017 test(tests/lean/run): pre-quotient experiment 2014-11-17 18:30:11 -08:00
Leonardo de Moura
28c63e685b feat(frontends/lean): add '[local]' notation, closes #322 2014-11-16 21:15:04 -08:00
Leonardo de Moura
a171f8fbc3 test(tests/lean/run): simple diag for square matrices 2014-11-15 18:49:17 -08:00
Leonardo de Moura
1b95b69251 test(tests/lean/run): define subterm relation for vectors 2014-11-15 16:17:51 -08:00
Leonardo de Moura
ea640257bf feat(frontends/lean/structure_cmd): generate no_confusion for structures too 2014-11-15 16:00:09 -08:00
Leonardo de Moura
b87559dac5 test(tests/lean/run): define subterm relation for trees by hand 2014-11-15 13:29:23 -08:00
Leonardo de Moura
7685516d1e feat(frontends/lean): better default for atomic notation 2014-11-14 16:25:13 -08:00
Leonardo de Moura
00df34a1c4 feat(library/unifier): generalize method process_succ_eq_max_core 2014-11-14 14:25:41 -08:00
Leonardo de Moura
488f989c46 fix(frontends/lean/inductive_cmd): generate error for inductive datatype declarations that will produce an eliminator that can only eliminate to Prop 2014-11-14 13:57:42 -08:00
Leonardo de Moura
51719145f9 feat(library/unifier): solved universe constraints of the form succ^k1 a = max k2 ?m (when k1 >= k2) 2014-11-12 17:28:33 -08:00
Leonardo de Moura
edd04881ee fix(library/logic): import prod and unit declarations in logic
Reason: we need them for automatically generating constructions needed
by the definitional package
2014-11-12 16:54:50 -08:00
Leonardo de Moura
6bc89f0916 feat(library/definitional): define ibelow and below
These are helper definitions for brec_on and binduction_on
2014-11-12 16:38:46 -08:00
Leonardo de Moura
97609d1625 test(tests/lean/run/nateq): add example that triggered previous modification 2014-11-12 15:11:08 -08:00
Leonardo de Moura
b07b82cf43 fix(library/definitional): marking cases_on and rec_on as reducible
The idea is to avoid counter-intuitive behavior
2014-11-12 15:03:30 -08:00
Leonardo de Moura
a3066e3eaa fix(frontends/lean/inductive_cmd): bug in inductive datatype elaborator 2014-11-12 13:10:19 -08:00
Leonardo de Moura
463e70332d test(tests/lean/run): define brec_on and binduction_on for a reflexive type
We say an inductive type T is reflexive if it contains at least one constructor that
takes as an argument a function returning T.

For reflexive types it doesn't seen to be possible to define a single
brec_on that can eliminate to Type.{>=1} and Prop.
The universe level expressions get too complicated.
Even if we extend the universe constraint solver in the kernel, the
additional complexity might be a problem.

We workaround this issue by defining two versions of brec_on:
  - One (brec_on) that eliminates to Type.{>=1}, and
  - binduction_on that eliminates to Prop.

For non-reflexive types, we can combine both of them.
2014-11-12 10:52:32 -08:00
Leonardo de Moura
faf90c4b87 test(tests/lean/run): test brec_on on vectors 2014-11-11 17:23:59 -08:00
Leonardo de Moura
f6889951c6 fix(library/definitional/cases_on): bug in inductive datatypes with higher-order recursion 2014-11-11 15:14:08 -08:00
Leonardo de Moura
e65b5884e5 test(tests/lean/run/forest): define brec_on for forests
Almost everything explicit to get an idea of what needs to be generated automatically.
2014-11-11 13:16:23 -08:00
Leonardo de Moura
b3e4a689cf test(tests/lean/run): define ackermann function using recursors 2014-11-11 11:06:10 -08:00
Leonardo de Moura
1f92751c4d test(tests/lean/run): fibonacci using well_founded recursion 2014-11-10 12:46:55 -08:00
Leonardo de Moura
363d4a7577 fix(library/definitional/no_confusion): assertion violation 2014-11-10 10:32:03 -08:00
Leonardo de Moura
df5a17cdce feat(frontends/lean/placeholder_elaborator): include type in class-instance resolution trace 2014-11-09 12:06:16 -08:00
Leonardo de Moura
9b9ae128d5 feat(frontends/lean): include file-name and line/col numbers when displaying class-instance resolution trace 2014-11-09 11:47:01 -08:00
Leonardo de Moura
aef1dd9a04 test(tests/lean/run): fibonacci using below_rec_on (aka brec_on) 2014-11-08 22:19:18 -08:00
Leonardo de Moura
1b6e40d3d6 test(tests/lean/run): define below_rec_on (aka brec_on) for vectors 2014-11-08 22:19:18 -08:00
Leonardo de Moura
e8bc0f8249 feat(library/defitional): add no_confusion construction for inductive datatypes that are not propositions 2014-11-08 18:56:52 -08:00
Leonardo de Moura
b5da143fc0 feat(library/defitional): add no_confusion_type construction for inductive datatypes that are not propositions 2014-11-08 15:20:19 -08:00
Leonardo de Moura
f16f215c2a refactor(data/num/string): break into pieces to reduce dependencies 2014-11-07 08:53:14 -08:00
Leonardo de Moura
e993486301 refactor(library/data/num): break into pieces to reduce dependencies 2014-11-07 08:24:29 -08:00
Leonardo de Moura
b3ad8c704a feat(frontends/lean/structure_cmd): allow inheritance from two identical structures, closes #296 2014-11-05 15:01:05 -08:00
Leonardo de Moura
4650791108 feat(frontends/lean): add 'print fields' command 2014-11-05 14:06:54 -08:00
Leonardo de Moura
354baf4d13 test(tests/lean/run): add structure command test 2014-11-05 12:54:03 -08:00
Leonardo de Moura
677e0aeef6 fix(frontends/lean/structure_cmd): accept ': Type' when universe levels are not specified 2014-11-05 12:02:52 -08:00
Leonardo de Moura
defc2478b5 feat(frontends/lean): add 'record' as an alias for 'structure' command 2014-11-05 12:02:52 -08:00
Leonardo de Moura
6944c7d902 fix(frontends/lean/placeholder_elaborator): local context must be adjusted when performing class-instance resolution modulo Pi-abstraction, fixes #293 2014-11-04 18:41:27 -08:00
Leonardo de Moura
d58c3e498d feat(frontends/lean/builtin_cmds): add 'print prefix' command 2014-11-04 08:40:32 -08:00
Leonardo de Moura
b6722a5d33 feat(frontends/lean/structure_cmd): add 'private' modifier for parent structures
When it is used coercions/instances to parent structure are to registered
2014-11-03 23:16:49 -08:00
Leonardo de Moura
b24165dc7b feat(frontends/lean/structure_cmd): remove 'cases_on' for structures since it may confuse users, add 'destruct' as alternative name for 'rec_on' 2014-11-03 23:06:33 -08:00
Leonardo de Moura
7897e21a14 feat(frontends/lean/structure_cmd): allow fields to be suppresed, but constructor to be provided 2014-11-03 22:55:51 -08:00
Leonardo de Moura
08b4ce2db9 feat(frontends/lean/structure_cmd): use 'mk' as constructor name when it is not provided 2014-11-03 22:40:08 -08:00
Leonardo de Moura
8f3139231b feat(frontends/lean/structure_cmd): allow structure declarations that contains only a header 2014-11-03 22:17:43 -08:00
Leonardo de Moura
91749d2364 fix(frontends/lean/structure_cmd): modify coercion generation
The previous coercion was more efficient, but the computation was
getting stuck when processing algebraic structures
2014-11-03 19:37:11 -08:00
Leonardo de Moura
d2b5af237e refactor(library): use new 'structure' command to define prod and sigma 2014-11-03 18:57:55 -08:00
Leonardo de Moura
ea7470375f fix(tests/lean): to reflect changes in the standard library 2014-11-03 18:46:53 -08:00
Leonardo de Moura
c306bfa83c feat(frontends/lean/structure_cmd): add 'eta' theorem for structures 2014-11-03 18:33:44 -08:00
Leonardo de Moura
186d910d0b feat(frontends/lean/structure_cmd): mark coercion to parents as coercions and instances (when both structures as classes) 2014-11-03 17:55:59 -08:00
Leonardo de Moura
b112f3c582 feat(frontends/lean/structure_cmd): add coercions to parent structures 2014-11-03 17:39:52 -08:00
Leonardo de Moura
7afa69577e feat(frontends/lean/structure_cmd): add aliases for structure decls 2014-11-03 15:50:41 -08:00
Leonardo de Moura
efe1105eb9 fix(frontends/lean): alias generation for composite names was not working
This is an issue for declarations that generate composite names such as
the inductive datatype packacke.

The commit also fix a bug in the generate of aliases for recursors
2014-11-03 15:43:58 -08:00
Leonardo de Moura
0f56b5f5b7 test(tests/lean/run): add structure command test 2014-11-03 14:29:17 -08:00
Leonardo de Moura
a2e75159c8 fix(frontends/lean): process choice-exprs at check_constant_next 2014-11-02 19:42:30 -08:00
Leonardo de Moura
df008dc3c3 feat(frontends/lean/inductive_cmd): create a namespace for each declared datatype 2014-11-01 19:15:46 -07:00
Leonardo de Moura
ea55ec4090 feat(frontends/lean/decl_cmds): remove useless name from 'example' commad 2014-11-01 16:12:23 -07:00
Leonardo de Moura
1e6f7cdbb4 chore(frontends/lean/decl_cmds): add 'example' command
It is like a theorem, but it is discarded after checking
2014-11-01 11:37:39 -07:00
Leonardo de Moura
94cf10284a fix(frontends/lean/calc_proof_elaborator): bug when inserting symmetry proofs for heq, fixes #286
The problem was that heq type is
    Pi {A : Type} (a : A) {B : Type} (b : B), Prop

The calc_proof_elaborator was assuming that (a : A) (b : B) were the
last two arguments in any relation supported by calc.

The fix is to remove this assumption.
2014-11-01 07:30:04 -07:00
Leonardo de Moura
2688ca38bf feat(frontends/lean/inductive_cmd): notation for enumeration types 2014-10-31 19:01:32 -07:00
Leonardo de Moura
d7beabe91c fix(frontends/lean/calc_proof_elaborator): improve calc proof assistant 2014-10-31 09:49:45 -07:00
Leonardo de Moura
17df85f592 feat(frontends/lean/calc_proof_elaborator): add '{...}' if needed in calc proof steps
This is part of #268
2014-10-31 00:55:19 -07:00
Leonardo de Moura
591e566472 feat(frontends/lean): try to inject symmetry (if needed) in calc proofs, add calc_symm command for configuring the symmetry theorem for a given operator
This is part of #268
2014-10-30 23:24:09 -07:00
Leonardo de Moura
c5a62f8abb feat(frontends/lean): insert ! in calculational proofs when needed
This is part of #268
2014-10-30 22:22:04 -07:00
Leonardo de Moura
6107da05db fix(frontends/lean): universe variable is treated as parameter inside section, fixes #283 2014-10-29 19:47:14 -07:00
Leonardo de Moura
9547e2d077 feat(library/tactic): add rotate_left/rotate_right tactics, closes #278 2014-10-29 19:13:55 -07:00
Leonardo de Moura
fe4ea48381 feat(library/definitional/projection): add projection generator, closes #257 2014-10-29 13:13:05 -07:00
Leonardo de Moura
60f32fa709 fix(frontends/lean): begin-end automatic tactic notation bug, fixes #262 2014-10-27 17:12:25 -07:00
Leonardo de Moura
78bc3ef7e4 feat(library/unifier): improve FailLocal/FailCircular failures in the unifier by using normalization
This improvements was marked as TODO, and was preventing us from
elaborating the example in the new test vector3.lean
2014-10-27 16:49:29 -07:00
Leonardo de Moura
7516fcad97 feat(kernel/type_checker): add is_stuck method, and improve ensure_pi method, closes #261 2014-10-27 13:16:50 -07:00
Leonardo de Moura
49941ce35b test(tests/lean/run/sigma_no_confusion): define 'no_confusion' for sigma types 2014-10-27 07:26:01 -07:00
Leonardo de Moura
81dc201bab fix(frontends/lean/elaborator): nested begin-end bug 2014-10-26 18:23:30 -07:00
Leonardo de Moura
cc6a96e8ba fix(frontends/lean): improve begin-end construct 2014-10-26 15:47:29 -07:00
Leonardo de Moura
fd60cf6a79 feat(library/tactic/exact_tactic): modify 'exact' tactic semantics, use higher-order unification
See new node.inj4 theorem, we need the extra power to be able to avoid type information at
    exact (assume e₁ e₂, e₁)
2014-10-26 10:27:33 -07:00
Leonardo de Moura
8e6de93394 fix(frontends/lean/parser): add two kinds of no_undef_id behavior: to (global) constant; to local constant 2014-10-26 09:47:11 -07:00
Leonardo de Moura
c7f6a6b94e feat(library/definitional/cases_on): automatically add 'cases_on' 2014-10-25 17:22:02 -07:00
Leonardo de Moura
cdcde661ef feat(library/definitional/induction_on): automatically add 'induction_on' 2014-10-25 13:37:04 -07:00
Leonardo de Moura
a7a06ab0f8 feat(library/definitional/rec_on): automatically generate rec_on function for inductive datatypes 2014-10-25 13:08:59 -07:00
Leonardo de Moura
79d0347721 feat(library/tactic): add generalize tactic, closes #34
Remark: the intros tactic has been added in a different commit: 7d0100a340
2014-10-23 22:40:15 -07:00
Leonardo de Moura
b83b065d00 feat(library/tactic/apply_tactic): modify heuristic for adding arguments to apply tactic. 2014-10-23 22:36:32 -07:00
Leonardo de Moura
38a9aa2a98 feat(frontends/lean): automatically open 'tactic' namespace (if it is not already open) in 'by' and 'begin-end' expressions 2014-10-23 10:26:19 -07:00
Leonardo de Moura
00f9a10e82 refactor(library/tactic/unfold_tactic): use new 'tactic.expr' to implement 'unfold' tactic
This change also enabled us to remove hacks used in the tests modified
by this commit.
2014-10-23 10:26:19 -07:00
Leonardo de Moura
c50227ea6e feat(library/tactic): change apply tactic semantics: goals are not reversed; and dependent arguments are not included
This commit also adds the tactic rapply that corresponds to the previous
semantics we have been using.
2014-10-22 18:11:09 -07:00
Leonardo de Moura
e95c7c5f70 refactor(library/tactic/rename_tactic): use new 'tactic.expr' to implement 'intro/intros' tactic
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-10-22 17:29:50 -07:00
Leonardo de Moura
5e15ac0c92 feat(library/tactic): add new approach for embedding non-elaborated expressions into tactics 2014-10-22 17:29:50 -07:00
Leonardo de Moura
6b89080b1a feat(frontends/lean): do not allow user to define notation using tokens ! and @, closes #248 2014-10-21 16:28:36 -07:00
Leonardo de Moura
e24225fabf feat(frontends/lean): validate infixl/infixr/postfix/prefix declarations against reserved notations 2014-10-21 15:39:47 -07:00
Leonardo de Moura
6c7e23ecaa refactor(library): use 'reserve' notation in the standard library 2014-10-21 15:39:47 -07:00
Leonardo de Moura
bb953b80aa feat(frontends/lean): reserve notation, closes #95 2014-10-21 15:39:47 -07:00
Leonardo de Moura
e2fa981e89 fix(frontends/lean/pp): avoid parentheses around atomic notation 2014-10-20 18:08:13 -07:00
Leonardo de Moura
e68007a727 fix(frontends/lean/builtin_tactics): adjust tactics precedence 2014-10-20 17:10:16 -07:00