coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Jason Gross <jasongross9 AT gmail.com>
- To: coq-club <coq-club AT inria.fr>
- Cc: Matthieu Sozeau <matthieu.sozeau AT inria.fr>, "Paul A. Steckler" <steck AT stecksoft.com>
- Subject: [Coq-Club] Getting typeclass resolution to fail quickly?
- Date: Tue, 31 May 2016 17:33:11 -0400
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jasongross9 AT gmail.com; spf=Pass smtp.mailfrom=jasongross9 AT gmail.com; spf=None smtp.helo=postmaster AT mail-oi0-f45.google.com
- Ironport-phdr: 9a23:IYDyIB+2JTwUqP9uRHKM819IXTAuvvDOBiVQ1KB91OscTK2v8tzYMVDF4r011RmSDdSdtq8P0reL+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkItf6KuSt+U0pn8jr3vs7ToICx2xxOFKYtoKxu3qQiD/uI3uqBFbpgL9x3Sv3FTcP5Xz247bXianhL7+9vitMU7q3cYk7sb+sVBSaT3ebgjBfwdVWx+cjN92Mq+vh7aCACL+3FUBm4Ri19DBxXPxBD8RJb49CXg4LlTwi6faO//VrcyERu46LxwAEvqgTwAMTEj93rM2+R/iatapFSqoBkpkN2cW52cKPcrJvCVRtgdX2cUG58JDyE=
Hi,
Is there a way to get typeclass resolution to fail quickly? For example, if the search encounters
Proper (le ==> _ ==> impl) le
it should fail immediately, because instantiating the _ with any reflexive relation yields a contradiction, and instantiating it with any irreflexive relation yields a slow failure on searching for a ProperProxy (in setoid_rewriting). But I can't seem to get this to happen; typeclass resolution calls [proper_subrelation], and then tries to convert each Proper instance it finds for lt with (lt ==> _ ==> impl), which is, of course, impossible. This means I need to be extremely careful to not put any lemmas in my rewriting databases which can utterly fail to be respected by any other relation (so any facts about [le] or [lt] are right out). This is annoying, especially when I want facts of the form [forall x, lt x x <-> False] or [forall x, le x x <-> True],* so that I can use rewriting databases to find contradictions in the hypotheses.
Are there ways to fix this?
Thanks,
Jason
* The actual situation is a bit more complicated: I am using boolean-valued relations with a coercion to Sortclass (is_true), and the problem comes when I have something like [forall x, leb x x = true]. Since I've declared [leb : nat -> nat -> Prop] as a relation which can have instances, the setoid rewriting machinery tries both to replace [leb x x] with [true], and also to replace [x] with [x] via the [fun x y => is_true (leb x y)] relation, which is what causes the slowness.
- [Coq-Club] Getting typeclass resolution to fail quickly?, Jason Gross, 05/31/2016
Archive powered by MHonArc 2.6.18.