feat(meta/environment): the equations that lead to a given definition are now accessible in Lean code#393
feat(meta/environment): the equations that lead to a given definition are now accessible in Lean code#393cipher1024 wants to merge 3 commits intomasterfrom
Conversation
are now accessible in Lean code
|
Written together with @DanielFabian |
e <- get_defn_spec ngives us a pre-term parsed from the equations typed in by the user. Those are distinct from the equations proved by the equation compiler as their can be fewer equations when multiple cases can be described by the same equation |
|
There are two issues here:
|
|
@gebner What we are after here are the equations you see in the pattern match. So if your pattern match contains 5 lines in the source code, we need a sorted list of 5 equations. And sorted, because at this point, the left hand sides are not yet disjoint. Rather, the equations need to be applied in order and the first match wins. The whole point of this is so that we get a target for something we would like to automatically prove. E.g.: def foo : nat -> nat :=
| 0 := 1
| n := 2in this case, we want an easy way to get two goals, in order: You'll notice, that the second theorem is false. But it becomes true, if you modify it slightly: The idea is that you get this ever-growing list of premises as you go through the pattern match cases where at every point, the universally quantified theorem is true, but only because you also know that any of the previous patterns were already handled and therefore are now known to be impossible. If this is our goal, are the elaborated equations the ones we need? |
Yes, I'd strongly suggest that. |
Co-authored-by: Daniel Fabian daniel.fabian@integral-it.ch