Skip to Content.
Sympa Menu

coq-club - [Coq-Club]

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club]


Chronological Thread 
  • From: Math Prover <mathprover AT yahoo.com>
  • To: "coq-club AT inria.fr" <coq-club AT inria.fr>
  • Subject: [Coq-Club]
  • Date: Fri, 17 May 2013 18:36:03 -0700 (PDT)
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:To:MIME-Version:Content-Type; b=G0hezx2o38yXltlvIGyXPx9jZAb/VliOqVNEIfU9S2ed8Dk9gpeodXSotY26RMJ+v8vbeHMRuuEfHA8tpiYJbnAzCd98MK+O+ef//t4a2oRAilQUlcA7/kxMQSP6f6nD9IEPII8Tm/6msSEFm9xRxEgduvUOevcYELyfPLItiN4=;

I'm using Coq 8.4 (downloaded from the main Coq website).

In the following block of code (also attached), I get an "Error: Cannot infer the implicit parameter Keq of assocList_r." error.

I believe what I have is a minimal example.

What confuses me is that:

  * when I use "Check" on the same types, it works

  * when I define it as part of a Function, I get an "Cannot infer the implicit parameter" error


Can someone please help me with:

  1) Letting me know if there's anyway I can reformat my question to make it easier to answer. (Or any additional information I should provide.)

  2) Tell me what I'm doing wrong / misunderstanding?


===== Code ======


Require Import List Coq.Classes.EquivDec.


Section assocList.

  Variable K: Type.
  Variable V: Type.
 
  Variable Keq: forall k1 k2: K, {k1 = k2} + {k1 <> k2}.
  
  Function assocList_r (lst: list (K * V)) (k: K) : option V :=
    match lst with
    | nil => None
    | (k',v') :: xs =>
      if Keq k k' then Some v' else assocList_r xs k
    end.

End assocList.

Implicit Arguments assocList_r [K V Keq].

Definition lst1 := (1,2)::nil.

Check (assocList_r lst1 1).

(* Up until this line, all works *)


(* The following line gives me the error:
  Error: Cannot infer the implicit parameter Keq of assocList_r.    *)

Function f (lst: list (nat * nat)) (k: nat) :=
  assocList_r lst k.

Attachment: test.v
Description: Binary data




Archive powered by MHonArc 2.6.18.

Top of Page