Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] About mutual recursion

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] About mutual recursion


chronological Thread 
  • From: Adam Chlipala <adam AT chlipala.net>
  • To: Gyesik Lee <gslee AT ropas.snu.ac.kr>
  • Cc: Coq Club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] About mutual recursion
  • Date: Mon, 11 Oct 2010 15:25:29 -0400

Gyesik Lee wrote:
I just defined a boolean version of [VarIn] and used it to do a decision.
Here is my solution.

Fixpoint bVarIn (r:Rep) : bool :=
   match r with
     | Var        =>  true
     | Plus r0 r1 =>  if (bVarIn r0) then true else (bVarIn r1)
     | Unit          =>  false
   end.

Fixpoint VarIn (r:Rep) : Prop :=
   match r with
     | Var        =>  True
     | Plus r0 r1 =>  if (bVarIn r0) then VarIn r0 else VarIn r1
     | Unit         =>  False
   end.

My suggestion was more along the lines of replacing the second definition by:
    Definition VarIn r := bVarIn r = true.




Archive powered by MhonArc 2.6.16.

Top of Page