lean4-htt/tests/playground
Joachim Breitner ccb8568756
feat: linear-size DecidableEq instance (#10152)
This PR introduces an alternative construction for `DecidableEq`
instances that avoids the quadratic overhead of the default
construction.

The usual construction uses a `match` statement that looks at each pair
of constructors, and thus is necessarily quadratic in size. For
inductive data type with dozens of constructors or more, this quickly
becomes slow to process.

The new construction first compares the constructor tags (using the
`.ctorIdx` introduced in #9951), and handles the case of a differing
constructor tag quickly. If the constructor tags match, it uses the
per-constructor-eliminators (#9952) to create a linear-size instance. It
does so by creating a custom “matcher” for a parallel match on the data
types and the `h : x1.ctorIdx = x2.ctorIdx` assumption; this behaves
(and delaborates) like a normal `match` statement, but is implemented in
a bespoke way. This same-constructor-matcher will be useful for
implementing other instances as well.

The new construction produces less efficient code at the moment, so we
use it only for inductive types with 10 or more constructors by default.
The option `deriving.decEq.linear_construction_threshold` can be used to
adjust the threshold; set it to 0 to always use the new construction.
2025-09-03 06:31:49 +00:00
..
forthelean chore: snake-case attributes (part 1) 2022-10-19 09:28:08 -07:00
parser feat: align take/drop/extract across List/Array/Vector (#6860) 2025-01-30 01:24:25 +00:00
pldi chore: snake-case attributes (part 1) 2022-10-19 09:28:08 -07:00
webserver chore: snake-case attributes (part 1) 2022-10-19 09:28:08 -07:00
.gitignore test(tests/playground): rbmap example 2019-02-19 19:01:51 -08:00
add_zeros.lean test: benchmarks for simp 2021-03-09 15:09:51 -08:00
arith_eval_nat.lean chore(*): update equation syntax in files and old parser 2019-08-09 11:11:34 +02:00
arith_eval_uint32.lean chore(*): update equation syntax in files and old parser 2019-08-09 11:11:34 +02:00
badreset.lean fix(library/init/lean/compiler/ir/resetreuse): must use livevars instead of freevars 2019-05-07 11:09:51 -07:00
badupdate1.lean fix(library/compiler/struct_cases_on): performance problem exposed by badupdate1.lean 2019-04-26 16:30:19 -07:00
bigctorfields.lean fix: allow bigger ctor objects 2021-01-29 18:23:38 -08:00
bool_exhaust_test.lean chore: remove save tactic (#7047) 2025-02-12 09:19:30 +00:00
cmdparsertest1.lean chore: avoid Has prefix in type classes 2020-10-27 18:29:19 -07:00
compile.sh feat: make LEAN_PATH a mapping from package names to root dirs, remove C++ impl 2019-11-20 16:39:53 +01:00
deriving.lean refactor: migrate all usages of old slice notation (#9000) 2025-06-27 18:52:07 +00:00
dir.lean feat(library/init/system/io): new primitives 2019-07-25 18:12:44 -07:00
DiscrTree.lean chore: avoid Has prefix in type classes 2020-10-27 18:29:19 -07:00
environment_extension.lean feat: subsume variables under variable 2021-01-22 14:36:05 +01:00
envtest.lean test(tests/playground/envtest): add small environment extension test 2019-05-11 17:53:27 -07:00
eval.lean chore: fix spelling mistakes in tests (#5439) 2024-09-24 03:22:53 +00:00
eval2.lean chore: HasToString => ToString 2020-10-27 16:11:48 -07:00
expander.lean test(tests/playground/expander): add Leo's direct transformation 2019-04-03 11:27:06 +02:00
file.lean feat(library/init/io): add IO.readTextFile 2019-07-18 17:31:31 -07:00
filemap.lean test(tests/playground/filemap): FileMap 2019-04-02 17:23:13 -07:00
fix.lean chore(library/init/io): we don't need fix anymore 2019-03-27 12:59:43 -07:00
fix1.lean chore(library/init,runtime,library/compiler): add fix primitive back 2019-03-27 17:13:53 -07:00
flat_parser.lean chore: snake-case attributes (part 1) 2022-10-19 09:28:08 -07:00
flat_parser2.lean perf: Use flat ByteArrays in Trie (#2529) 2023-09-20 13:22:37 +02:00
forIn.lean chore: avoid Has prefix in type classes 2020-10-27 18:29:19 -07:00
forIn2.lean chore: avoid Has prefix in type classes 2020-10-27 18:29:19 -07:00
frontend1.lean feat(library/init/lean/elaborator/term): add elabList, and fix elabTermAux 2019-09-14 08:41:49 -07:00
gen.lean chore(tests): port tests, fix at least compiler tests 2019-03-21 15:11:05 -07:00
hash.lean refactor(library/init/data/hashmap): use AssocList and HasBeq 2019-04-03 05:55:08 -07:00
hashable.lean chore: snake-case attributes (part 1) 2022-10-19 09:28:08 -07:00
ir.lean chore: avoid Expr constructors in tests 2019-11-14 16:54:36 -08:00
lazylist.lean feat: subsume variables under variable 2021-01-22 14:36:05 +01:00
levelparsertest1.lean fix(library/init/lean/parser/parser): prattParser 2019-07-01 16:00:58 -07:00
lowtech_expander.lean chore: avoid Has prefix in type classes 2020-10-27 18:29:19 -07:00
map_perf.lean chore(library/init): fold functions argument order consistency 2019-04-03 07:42:14 -07:00
mapVShmap.lean feat: top-down heuristic delaboration 2021-08-03 09:13:18 +02:00
matchEqs.lean chore: snake-case attributes (part 1) 2022-10-19 09:28:08 -07:00
moddata.lean feat(library/module, library/init/lean/environment): add primitives for reading/writing files as compacted regions 2019-05-13 17:26:28 -07:00
modtest1.lean chore(*): update equation syntax in files and old parser 2019-08-09 11:11:34 +02:00
nnf.lean chore: increase test size 2021-03-04 17:27:24 -08:00
noConfusionDecEqExp.lean feat: linear-size DecidableEq instance (#10152) 2025-09-03 06:31:49 +00:00
oldcompile.sh feat: make LEAN_PATH a mapping from package names to root dirs, remove C++ impl 2019-11-20 16:39:53 +01:00
oldrun.sh chore(tests/playground): scripts for using old IR compiler 2019-05-23 18:33:29 -07:00
opts.lean feat(library/compiler): special support for initialization functions of the form def initFn : IO Unit 2019-03-23 08:46:38 -07:00
parser1.lean feat(library/init/lean/parser): universe level parser and bug fixes 2019-06-30 09:02:06 -07:00
parser2.lean test(tests/playground/parser2): proof of concept 2019-06-20 16:48:17 -07:00
partial_eq_lemma.lean test(tests/playground/partial_eq_lemma): partial equation lemmas 2019-03-26 18:06:04 -07:00
patch.lean fix(library/playground/patch): updateArgs => modifyArgs 2019-08-09 16:05:29 -07:00
patcheqnspace.lean chore(library/init): eliminate whitespaces using another patch script 2019-08-09 09:01:39 -07:00
patcheqnspace2.lean chore(library/init): fix whitspaces before => 2019-08-09 09:13:49 -07:00
perf.lean chore(tests): port tests, fix at least compiler tests 2019-03-21 15:11:05 -07:00
persistentarray.lean feat(library/init/data/persistentarray/basic): PersistentArray.pop 2019-08-04 11:50:05 -07:00
pge.lean chore: eliminate uses of intros x y z (#9983) 2025-08-19 06:09:13 +00:00
phashmap.lean feat(library/init/data/persistenthashmap/basic): add PersistentHashMap.contains 2019-08-09 11:25:01 -07:00
primes.hs test(tests/playground/lazylist): perf tests 2019-04-26 13:12:39 -07:00
qsort64.lean perf(library/init/lean/compiler/ir/boxing): create auxiliary constants for caching the value of boxed/unboxed literals and constants 2019-09-11 10:37:35 -07:00
rand.lean feat(library/init/data/random): random numbers 2019-05-04 15:57:42 -07:00
reelab.lean chore: fix tests 2020-05-26 15:05:01 -07:00
ref2.lean chore(tests/playground): fix playground tests 2019-03-21 18:30:58 -07:00
run.sh test(tests/playground/run.sh): fix 2019-03-05 15:37:11 +01:00
seq1.lean test: perf experiments 2021-03-09 13:42:47 -08:00
seq2.lean test: perf experiments 2021-03-09 13:42:47 -08:00
simp_binders.lean test: benchmarks for simp 2021-03-09 15:09:51 -08:00
simpleTypes.lean feat: add inferType for LCNF 2022-08-09 17:33:24 -07:00
sizeof1.lean chore: update tests 2021-01-27 15:17:51 -08:00
sizeof2.lean chore: update tests 2021-01-27 15:17:51 -08:00
sizeof3.lean chore: update tests 2021-01-27 15:17:51 -08:00
sleep_save.lean fix: save when used as last tactic 2023-06-07 14:29:45 -07:00
smap.lean feat(util/map_foreach): add helper functions for traversing Lean maps 2019-05-13 12:27:59 -07:00
som.lean feat: sum of monomials normal form by reflection 2022-04-22 18:51:48 -07:00
split.lean feat(library/init/data/string/basic): add String.split 2019-03-22 17:26:43 -07:00
task_test.lean chore: fix test 2020-06-17 21:28:37 -07:00
task_test2.lean chore(tests/playground/task_testX): update syntax 2019-09-12 18:26:15 +02:00
task_test3.lean chore(tests/playground/task_testX): update syntax 2019-09-12 18:26:15 +02:00
task_test4.lean chore(tests/playground/task_testX): update syntax 2019-09-12 18:26:15 +02:00
termParserAttr.lean chore: snake-case attributes (part 1) 2022-10-19 09:28:08 -07:00
termparsertest1.lean chore: HasToString => ToString 2020-10-27 16:11:48 -07:00
tst.lean chore(tests): port tests, fix at least compiler tests 2019-03-21 15:11:05 -07:00
uf1.lean feat: subsume variables under variable 2021-01-22 14:36:05 +01:00
uf1_new.lean feat: subsume variables under variable 2021-01-22 14:36:05 +01:00
unsafe.lean feat(library/init/io): implement unsafeIO in Lean 2019-05-11 16:28:11 -07:00
usizeBug.lean test: interpreter bug 2019-11-18 18:12:33 -08:00
view_expander.lean test(tests/playground): expander performance tests 2019-04-01 17:23:14 +02:00