Skip to Content.
Sympa Menu

coq-club - [Coq-Club] type class instance inference

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] type class instance inference


Chronological Thread 
  • From: Gert Smolka <smolka AT ps.uni-saarland.de>
  • To: "coq-club AT inria.fr" <coq-club AT inria.fr>
  • Subject: [Coq-Club] type class instance inference
  • Date: Tue, 18 Jun 2013 14:41:43 +0200

I stumbled across a very strange behavior of type class inference.

Definition dec (X : Prop) : Type := {X} + {~ X}.
Definition decision (X : Prop) (D : dec X) : dec X := D.
Arguments decision X {D}.
Existing Class dec.

Instance False_dec : dec False :=
right (fun A => A).

Instance impl_dec (X Y : Prop) : dec X -> dec Y -> dec (X -> Y).
Proof. unfold dec ; tauto. Qed.

Set Printing Implicit.

Check (fun (X : Prop) (D : dec X) => decision (~ X)).

Require List.

Check (fun (X : Prop) (D : dec X) => decision (~ X)).

In the first Check the class argument is derived, in the second it is not.
Both Checks are identical, the difference stems from requiring List in
between.

Is this a bug or a feature? Gert




Archive powered by MHonArc 2.6.18.

Top of Page