Closed RandomActsOfGrammar closed 1 year ago
Not sure if this is a bug. Schematic theorems will have to be applied with explicit type instances as far as I recall. For instance, replacing your apply vars_equiv_left
with this will not trigger the unification failure:
apply vars_equiv_left[ground, ground] to Equiv App.
Am I missing something? (Also, the schematic polymorphism code comes from @yvting, so he may have some insights.)
It seems to me that it should find the type instances from the application. In the Equiv
hypothesis, G1
and G2
are known to have type list (pair ground ground)
. Then unifying the Equiv
and the first premise of vars_equiv_left
seems that it should work and fill the type instances.
In an example without an implication, it can find the type instances:
Theorem append_unique [A] : forall (L1 : list A) L2 L L',
append L1 L2 L -> append L1 L2 L' -> L = L'.
skip.
Theorem append_ground : forall (L1 : list ground) L2 L L',
append L1 L2 L -> append L1 L2 L' -> L = L'.
intros App1 App2. apply append_unique to App1 App2. search.
Even though we don't give the type instance for append_unique
, it succeeds in the application.
Interesting. Thanks for the report. Fixing now...
Can you try this potential fix that I just committed? It addresses this particular corner case of unification of formulas but I'm not sure if it breaks other things. May back it out if there are regressions.
The fix seems to work for me.
OK great. Holler if you discover anything broken and will reopen this issue.
It seems there is a problem unifying the premises of generic theorems when those premises contain implications.
Suppose we have these definitions:
We can prove a theorem about these for lists containing the
ground
type and use it fine:However, if we prove a generic version of
vars_equiv_left
and try to use it in the same theorem, we have a problem:This gives us the following error message: