Conversation
9c722c3 to
b0ea5a5
Compare
cd544dd to
4814d7c
Compare
…he recursive functions themselves.
…that removes ones that have reference to the return expression.
…e empty anymore (or have holes)
…lear measure to prove termination
…d many else relations into conjunctions.
…t length and inverse opt
…ion) for Rocq only.
…case coercions support projections with type parameters
…structors/fields.
… is generally complicated enough.
… atom for disambiguation.
|
@nomeata I've recently been working on something relevant to what you mentioned above (related to leanprover/lean4#2329 -- generating decidable equality instances for nested mutual recursive types in Lean (I'm trying to build something in Lean to reason about Wasm 3.0's type lattice structure and executing them, among other stuffs). I wonder if there's been any update on Lean's support on this matter. I've also had a custom workaround which almost works and might be applicable to your intention here as well, and I'm curious if you'd be happy to give some feedback. For the current status of Lean, I can see that the Lean's Currently I made a workaround and constructed a deriver for the The downside is that I have to mark the generated definition I think generating decidable equality for the mutual type lattice definition will also be an issue in the Rocq backend as well, as I don't think Rocq's |
|
This is maybe the wrong place to discuss, we should probably continue at leanprover/lean4#2329. Do you need your theory to even use A solution that implements decidable along the recursors at least helps if you want to use these definitions only in proofs or definitions you want to reduce in the kernel, but don’t need to compile. So it’s useful in that way. I don’t know of concrete plans to make recursors computable (leanprover/lean4#2049), unfortunately. Other options you can consider
Of these, 2 seems the most principled and modular. |
Thanks for the comments! Actually, using the recursors as input 'to know what to do' is a nice observation. There's no reason I need to apply the recursor which creates the dependency on it for compilation. I'll have a go in this direction. I'll post further replies directly under the Lean issue you linked if I can get something that works! |
Playing around with a new Lean4 backend (not based on #2) but rather fresh, adapting the Rocq backend from @DCupello1. Opening this PR to have a place for notes and comments, not meant for merging.
Status
IR-to-IR passes that may be useful
Issues with Lean that we might want to fix or work-around
deriving DecidableEqfor nested inductives (e.g.instr) Support for mutual and nested inductive types asDecidableEqinstance generator leanprover/lean4#2329.Using
BEqso far. (Or maybe we can do away with equality checks on instructions?)Nested inductive predicates with indices in parameters Nested inductives cannot have indices leanprover/lean4#1964
This is a big one, as this is a kernel issue. We have two work-arounds:
Use the lattice-based construction for predicates that is behind
coinduction, and can also do inductives. This can handle that kind of nested recursion.Write
which makes the nested induction go through. Conveniently we already generate
xs == yssie-conditions, so this works easily forForall₂as well.