Lean 4 fork for HoTT-compatible kernel extensions (Path types, transport, HITs). Maintained against upstream leanprover/lean4.
Find a file
Joachim Breitner d975e4302e
feat: fine-grained equational lemmas for non-recursive functions (#4154)
This is part of #3983.

Fine-grained equational lemmas are useful even for non-recursive
functions, so this adds them.

The new option `eqns.nonrecursive` can be set to `false` to have the old
behavior.

### Breaking channge

This is a breaking change: Previously, `rw [Option.map]` would rewrite
`Option.map f o` to `match o with … `. Now this rewrite will fail
because the equational lemmas require constructors here (like they do
for, say, `List.map`).

Remedies:

 * Split on `o` before rewriting.
* Use `rw [Option.map.eq_def]`, which rewrites any (saturated)
application of `Option.map`
* Use `set_option eqns.nonrecursive false` when *defining* the function
in question.

### Interaction with simp

The `simp` tactic so far had a special provision for non-recursive
functions so that `simp [f]` will try to use the equational lemmas, but
will also unfold `f` else, so less breakage here (but maybe performance
improvements with functions with many cases when applied to a
constructor, as the simplifier will no longer unfold to a large
`match`-statement and then collapse it right away).

For projection functions and functions marked `[reducible]`, `simp [f]`
won’t use the equational theorems, and will only use its internal
unfolding machinery.

### Implementation notes

It uses the same `mkEqnTypes` function as for recursive functions, so we
are close to a consistency here. There is still the wrinkle that for
recursive functions we don't split matches without an interesting
recursive call inside. Unifying that is future work.
2024-08-22 13:26:58 +00:00
.github chore: restart-on-label: Also filter by commit SHA (#5099) 2024-08-20 07:45:43 +00:00
doc chore: add libuv to the required packages heading in macos docs (#5045) 2024-08-15 01:33:58 +00:00
images chore(CMakeLists.txt): move Lean logo to make sure we can test leanemacs without installing Lean 2015-01-31 17:38:49 -08:00
nix feat: link LibUV (#4963) 2024-08-12 12:33:24 +00:00
releases_drafts feat: omit (#5000) 2024-08-21 13:22:34 +00:00
script feat: link LibUV (#4963) 2024-08-12 12:33:24 +00:00
src feat: fine-grained equational lemmas for non-recursive functions (#4154) 2024-08-22 13:26:58 +00:00
stage0 chore: update stage0 2024-08-21 21:35:52 +00:00
tests feat: fine-grained equational lemmas for non-recursive functions (#4154) 2024-08-22 13:26:58 +00:00
.gitattributes chore: Do not hide stage0/src/stdlib_flags.h from diffs 2023-09-13 19:29:25 +02:00
.gitignore feat: support Lake for building Lean core oleans (#3886) 2024-06-13 16:18:24 +00:00
.ignore chore: ignore stage0/ (for rg etc.) 2022-03-18 15:28:20 +01:00
CMakeLists.txt chore: update-stage0-commit cmake target (#3692) 2024-04-04 13:35:53 +00:00
CMakePresets.json chore: modernize build instructions (#4032) 2024-05-23 10:55:07 +00:00
CODEOWNERS chore: update codeowners (#4681) 2024-07-08 07:57:54 +00:00
CONTRIBUTING.md doc: triage 2024-07-26 18:24:06 +02:00
flake.lock chore: deprecate Nix-based build, remove interactive components (#4895) 2024-08-02 09:57:34 +00:00
flake.nix feat: link LibUV (#4963) 2024-08-12 12:33:24 +00:00
lean-toolchain doc: VS Code dev setup (#2961) 2023-11-30 08:35:03 +00:00
lean.code-workspace chore: add the lean4 extension to the vscode workspace (#3059) 2023-12-14 08:58:21 +00:00
LICENSE chore: remove LICENSE header that confused GitHub 2021-11-18 09:42:35 +01:00
LICENSES chore: add GMP license for now 2021-11-18 09:42:35 +01:00
README.md doc: mention build doc source location (#4045) 2024-05-01 22:42:54 +00:00
RELEASES.md chore: begin development cycle for v4.12.0 (#4986) 2024-08-12 00:33:05 +00:00

This is the repository for Lean 4.

About

Installation

See Setting Up Lean.

Contributing

Please read our Contribution Guidelines first.

Building from Source

See Building Lean (documentation source: doc/make/index.md).