Skip to Content.
Sympa Menu

coq-club - [Coq-Club] Pattern matching while defining a type

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Pattern matching while defining a type


chronological Thread 
  • From: Lionel Elie Mamane <lionel AT mamane.lu>
  • To: coq-club AT pauillac.inria.fr
  • Subject: [Coq-Club] Pattern matching while defining a type
  • Date: Tue, 22 Oct 2002 15:01:05 +0200
  • List-archive: <http://pauillac.inria.fr/pipermail/coq-club/>

Hi,

Does Coq permit me to do pattern matching on a type while defining
this same type?

What I'm trying to do (with version 7.2) is something like:

Inductive Example : Type :=
   Example1: nat -> Example
 | Example2:
  let check = [e:Example]
    Cases e of
     (Example1 n) => (lt (S (S O)) n)
    |(Example2 e p) => false
    end
  in
 (e:Example) (check e)-> Example.


In the definition of check, Coq complains is not a constructor, while
it should:

Error: The symbol Example1 should be a constructor


Well... It is a constructor of the type I'm currently defining.

So is there a way around this?

Thank you for your help,

-- 
Lionel

Attachment: pgpsF1gBOQr0I.pgp
Description: PGP signature




Archive powered by MhonArc 2.6.16.

Top of Page