Skip to Content.
Sympa Menu

coq-club - [Coq-Club] Typeclasses and implicit arguments

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Typeclasses and implicit arguments


chronological Thread 
  • From: Daniel Schepler <dschepler AT gmail.com>
  • To: Coq Club <coq-club AT inria.fr>
  • Subject: [Coq-Club] Typeclasses and implicit arguments
  • Date: Thu, 10 Mar 2011 10:14:04 -0800
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:mime-version:content-type :content-transfer-encoding:message-id; b=GcJAb9LR2eN5ZHxLpqAEOMU7yrWLPb1CIzzBOvCKJgBI4lmPblauTL7/p7jZ52JtdD BgF+VnyZzToKUNLFWdfstt7mNmpK52O733LrYis6a7iigXyNgoAsE2yMV2qRkTuVMuNY anCpaHY0XQV75CmuCa/tuR8F3ZYs97cMCa740=

Let me add my own question on typeclasses:

Suppose I define

Generalizable All Variables.

Class ExtEqual {X Y} (f g:X->Y) : Prop :=
  extensional_equality : forall x:X, f x = g x.

Class injective `(f:X->Y) : Prop :=
  injectivity: forall x1 x2:X, f x1 = f x2 -> x1 = x2.

Instance injective_properness
  `{ExtEqual X Y f g} `{injective _ _ f} :
  injective g.

Here why do I have to fill in the implicit arguments for ExtEqual and 
injective?  Is that the intended behavior?

Also, it seems if I add too many instances along these lines (fg injective -> 
g injective, id injective and surjective, etc.) I tend to end up with the 
resolver failing in simple situations, and "typeclasses eauto" looping.
-- 
Daniel Schepler



Archive powered by MhonArc 2.6.16.

Top of Page