Commit graph

65 commits

Author SHA1 Message Date
Joachim Breitner
98ee789990 refactor: InductiveVal.numNested instead of .isNested
right now, in order to find out how many auxilary datatype are in a
mutual group of inductive with nested data type, one has to jump
through hoops like this:

```
private def numNestedInducts (indName : Name) : MetaM Nat := do
  let .inductInfo indVal ← getConstInfo indName | panic! "{indName} is an inductive"
  let .recInfo recVal ← getConstInfo (mkRecName indName) | panic! "{indName} has a recursor"
  return recVal.numMotives - indVal.all.lengt
```

The `InductiveVal` data structure already has `.isNested : Bool`, so it
seems to be a natural extension to beef that up to `.numNested: Nat`.

This touched kernel code.
2024-07-08 21:18:50 +02:00
Leonardo de Moura
07c407ab82
feat: collect kernel diagnostic information (#4082)
We now also track which declarations have been unfolded by the kernel
when using
```lean
set_option diagnostics true
```
2024-05-06 21:53:16 +00:00
int-y1
ce4ae37c19 chore: fix more typos in comments 2023-10-08 14:37:34 -07:00
Joachim Breitner
06e057758e chore: Remove unused variables from kernel
when I build lean locally, I get a nice and warning-free build
experience with the exception of these two unused variables. They can
probably go?
2023-09-27 09:43:07 -07:00
Gabriel Ebner
0da281fab4 fix: reject occurrences of inductive type in index
Fixes #2125
2023-02-28 12:22:54 -08:00
Leonardo de Moura
decb08858f fix: kernel must ensure that safe functions cannot use partial ones.
Fix issue reported at https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/Meaning.20of.20.60DefinitionSafety.2Epartial.60
2023-01-27 12:17:37 -08:00
Leonardo de Moura
0ef8aaeda0 feat: make sure minor premises in recursors do not include auxiliary type annotations (e.g., autoParam and optParam) 2022-03-10 08:08:36 -08:00
Leonardo de Moura
0fc8c1da77 feat: eta for structures at recursors
see #777
2021-11-25 11:31:00 -08:00
Leonardo de Moura
50ac21d0a6 refactor: move is_constructor_app to inductive.cpp 2021-11-25 11:31:00 -08:00
Leonardo de Moura
e22bffa94f refactor: move is_structure_like to inductive.cpp 2021-11-25 11:31:00 -08:00
Leonardo de Moura
80a73dd903 feat: basic support for definitions at inductive declarations 2021-10-25 12:44:35 -07:00
Leonardo de Moura
c8406a301d chore: reduce src/include/lean 2021-09-07 08:24:54 -07:00
Leonardo de Moura
106952622a chore: modify induction hypotheses generated names 2021-05-01 16:21:12 -07:00
Leonardo de Moura
c71eebde8c chore: remove util/buffer.h dependency from runtime 2020-12-14 18:07:28 -08:00
Leonardo de Moura
612ef66bb4 feat: store whether inductive type is nested or not 2020-12-10 14:25:23 -08:00
Leonardo de Moura
b4012fdd71 chore: remove old comment that is not true anymore 2020-11-23 08:44:50 -08:00
Leonardo de Moura
ec17fcbc1a feat: use motive to name the kernel generated recursor
Motivation: users can use named arguments to provide them.
2020-10-23 05:31:28 -07:00
Sebastian Ullrich
7718795178 fix: mark Lean objects in C++ globals reachable from the new frontend as persistent
sed -Ei 's/(g_\w+)\s*= new (name|expr|format|level|string_ref)\W.*;/\0\n    mark_persistent(\1->raw());/' src/kernel/**/*.cpp src/util/**/*.cpp src/library/**/*.cpp
2020-10-11 17:43:28 +02:00
Leonardo de Moura
7c76a19885 chore: fix includes 2020-05-22 14:17:25 -07:00
Leonardo de Moura
8bdca35282 chore: use #include <lean/runtime/...> for runtime .h files 2020-05-18 11:30:07 -07:00
Leonardo de Moura
f4e06664c6 chore: fix debug build 2020-03-18 21:02:00 -07:00
Leonardo de Moura
72ec0ec3ad feat: string literal support on recursors and kernel isDefEq 2020-03-17 17:23:33 -07:00
Leonardo de Moura
b9dc76df35 feat: name minor premises using ctor names 2020-02-23 18:45:53 -08:00
Leonardo de Moura
56d6961529 fix: old constant names 2020-01-09 15:40:55 -08:00
Leonardo de Moura
6ae510cea4 fix: reject inductive datatypes with duplicate constructor names 2019-12-14 09:11:39 -08:00
Leonardo de Moura
0d5ac5288a feat(runtime): increase small nat size
In 64-bit machines, the max small nat value should now be (2^63 - 1), and on 32-bit
machines (2^32 - 1).

The main motivation for this modification are the array indexing
operations. With the new representation, if a Nat index is not small,
then it must not be a valid index. This was not true in 64-bit
machines. Example: an array of size 2^33 would fit in memory, and but
an index `i` > 2^32 - 1 would not be a small nat value.
2019-03-26 14:21:03 -07:00
Leonardo de Moura
0888dee25e chore(*): meta ==> unsafe 2019-03-15 15:04:40 -07:00
Leonardo de Moura
c74f4c16ca feat(library/kernel,library/compiler/csimp): make sure nat.rec and nat.cases_on reduce when major premise is a nat literal 2018-10-10 18:35:15 -07:00
Leonardo de Moura
4874e25715 feat(kernel): save constructor idx and nfields at constructor_val 2018-09-14 13:45:58 -07:00
Leonardo de Moura
3b07eeec47 fix(kernel/inductive): name generator was not being consistenly used 2018-09-08 16:21:33 -07:00
Leonardo de Moura
aa3292eb36 feat(kernel/type_checker): remove m_memoize
It is always `true`
2018-09-07 20:50:53 -07:00
Leonardo de Moura
1b81577d8b fix(kernel/inductive): remove unnecessary whnf
The frontend is responsible for unfolding reducible definitions before
sending inductive declarations to the kernel.
2018-09-07 17:27:08 -07:00
Leonardo de Moura
58e91559d0 feat(*): use new inductive datatype module 2018-09-06 18:09:22 -07:00
Leonardo de Moura
afb9584a63 feat(kernel): store at inductive_val whether the type is reflexive or not 2018-09-05 14:46:03 -07:00
Leonardo de Moura
9970019f76 fix(kernel/inductive): incorrect assertion
It fails on non parametric datatypes with nullary constructors.
2018-09-05 09:52:25 -07:00
Leonardo de Moura
176e0a3ed3 fix(kernel/inductive): typo 2018-09-04 17:32:18 -07:00
Leonardo de Moura
ccfcd8279f fix(kernel/inductive): bug 2018-09-03 16:41:51 -07:00
Leonardo de Moura
59fa70616a feat(kernel/inductive): add reduce 2018-09-03 15:22:15 -07:00
Leonardo de Moura
dd03747d22 chore(kernel): univ_param vs lparam, level_param_names ==> names, and other inconsistencies 2018-09-03 13:05:42 -07:00
Leonardo de Moura
7928dbb239 chore(kernel): get_constructor ==> get_cnstr 2018-09-03 12:30:49 -07:00
Leonardo de Moura
47bc71f4fa feat(kernel/inductive): postprocess recursors and their rules 2018-09-02 21:06:51 -07:00
Leonardo de Moura
f9d87e7a98 feat(kernel/inductive): add inductive postprocessor
We still need to restore recursors and their rules
2018-09-02 17:44:19 -07:00
Leonardo de Moura
41a87f6856 feat(kernel/inductive): normalize parameter names 2018-09-02 16:40:31 -07:00
Leonardo de Moura
7d4097818b feat(kernel/inductive): add recursor rules 2018-09-02 15:55:29 -07:00
Leonardo de Moura
f30cb0635f chore(kernel/inductive): cleanup 2018-09-02 09:26:58 -07:00
Leonardo de Moura
98f035088c chore(kernel/inductive): cleanup 2018-08-31 18:01:26 -07:00
Leonardo de Moura
517923d362 feat(kernel/inductive): generate recursors in the new inductive datatype module 2018-08-31 17:47:22 -07:00
Leonardo de Moura
2fb677f1d0 feat(kernel/inductive): add positivity check to new inductive datatype module 2018-08-31 09:52:38 -07:00
Leonardo de Moura
706d7045c3 feat(kernel/inductive): add nested => mutual preprocessor 2018-08-30 18:05:43 -07:00
Leonardo de Moura
f1105e108a fix(kernel/inductive): bug at check_inductive_types 2018-08-30 18:05:43 -07:00