Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] A Question

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] A Question


chronological Thread 
  • From: CHA Reeseo <reeseo AT formal.korea.ac.kr>
  • To: coq-club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] A Question
  • Date: Thu, 24 Dec 2009 14:44:34 +0900
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=E6LijMc6aP7EXDPOKTLcO0QqLGaxJq/XKfrfbMUYz+vOzd1TYr5DEs/HYudSEB8avz OiDg7WiO7EDpoaSWaWsIm/5MH3NWj4kauG8aSRt+F21Xm0PNgAKOdQPCAAbZBhZ81fSj MG25AsJt8dXGdxLu1Rm3rZbLD5MpDKn8XQFIk=

2009/12/24 Babak Moazzez 
<babakmoazzez AT yahoo.com>:
> I am trying to define a function in Coq that adds two lists together. for
> this purpose , I need to use a structure which is very familiar in any
> programming language:
> if (p=q) then do ....
> but in Coq I cannot use this since (p=q) is not a boolean value but just a
> proposition which needs to be proved if it is true.

Assuming both p and q have a specific type T, one of simple ways is
constructing an equality test function of type "T -> T -> bool" and using
it instead of eq (=).

Or, any proof of "forall (x y:T), {x = y}+{x <> y}" can also be used as a
test function with IF-THEN-ELSE, guaranteeing that it cannot go wrong.
Coq theories constain various theorems named "*_eq_dec" or something.

If you want a polymorphic union function of type "forall T, list T ->
list T -> list T", you may also need a polymorphic equality test function
of type "forall T, T -> T -> bool" or "forall T, forall (x y:T),
{x = y}+{x <> y}".  AFAIK, the latter cannot be proven (in intuitionistic
setting).  The former type is inhabited (e.g., fun _ _ _ => true) but will
not meet your requirement.

-- 
CHA Reeseo
http://www.reeseo.net/



Archive powered by MhonArc 2.6.16.

Top of Page