You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instance search for HSubst vl ?X picks an arbitrary solution instead of giving an ambiguity error, and that is only desirable for languages with one HSubst instance. So it's easy to accidentally declare lemmas for the wrong types and notice later.
This is a matter of design choice, but using Hint Mode seems fairly common practice among typeclass users.
Below's an excerpt from some development of mine:
Instance Subst_vl : Subst vl := vl_subst.
Instance HSubst_tm : HSubst vl tm := tm_hsubst.
Instance HSubst_ty : HSubst vl ty := ty_hsubst.
Goal ∀ s x, x.|[s] = x.
(* x is inferred to have type [ty] because that was the last declared instance — swapping the instances changes the type. *)
Abort.
Hint Mode HSubst - +: typeclass_instances.
(* [Hint Mode HSubst - !: typeclass_instances.] would also work in this test, but I can't think of a case where that's preferable. *)
Fail Goal ∀ s x , x.|[s] = x.
Goal ∀ s (x: ty) , x.|[s] = x. Abort.
I'm aware the library is not actively developed, but it is actively used, so this might be useful to other readers.
The text was updated successfully, but these errors were encountered:
Instance search for
HSubst vl ?X
picks an arbitrary solution instead of giving an ambiguity error, and that is only desirable for languages with one HSubst instance. So it's easy to accidentally declare lemmas for the wrong types and notice later.This is a matter of design choice, but using
Hint Mode
seems fairly common practice among typeclass users.Below's an excerpt from some development of mine:
I'm aware the library is not actively developed, but it is actively used, so this might be useful to other readers.
The text was updated successfully, but these errors were encountered: