Zulip Chat Archive
Stream: lean4
Topic: getEqnsFor? non-recursive function
Marcus Rossel (Jan 08 2024 at 10:07):
Is there a way to get nicer equational lemmas for non-recursive functions than what is currently returned by docs4#Lean.Meta.getEqnsFor?? For example:
import Lean
def Bool.toNat : Bool → Nat
| false => 0
| true => 1
#eval Lean.Meta.getEqnsFor? ``Bool.toNat (nonRec := true)
#check Bool.toNat._eq_1
/-
Bool.toNat._eq_1 (x✝ : Bool) :
Bool.toNat x✝ =
match x✝ with
| false => 0
| true => 1
-/
When I was hoping it would return two equations:
Bool.toNat._eq_1 false = 0
Bool.toNat._eq_2 true = 1
Works great for recursive functions
Sidenote on doc-gen4
Marcus Rossel (Apr 18 2024 at 08:03):
Pinging this, as I haven't found a solution yet.
Joachim Breitner (Apr 18 2024 at 08:13):
It's on the roadmap. We want
- equation lemmas and induction principles for all functions, not just recursive ones
- use the same case-splittint heuristic for all of them
Marcus Rossel (Apr 18 2024 at 08:17):
(deleted)
Eric Wieser (Apr 18 2024 at 08:36):
Perhaps lean#2042 should be re-opened, which was intended to track this?
Last updated: May 02 2025 at 03:31 UTC