Skip to Content.
Sympa Menu

coq-club - [Coq-Club] Problems with basic Eval

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Problems with basic Eval


chronological Thread 
  • From: lando <lando2 AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: [Coq-Club] Problems with basic Eval
  • Date: Sat, 17 Apr 2010 20:04:07 -0400
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=ZkU3wUMACb7HwaZzcAop99lcAsUJz/q9qsTBfpf1cyNKQhUp+RFemjI2Er6GX3iuZs og1Gz9r50gyF75s4JzRBp1dzZJwxv4MCHpnWsuJ7W2AhMCQ0AMd36m06wfsBXSrLftXP xrdR4QabsTLxCRLoLsCVKnzjIYftPh7hzl+CY=

I'm just getting started with Coq and am having a couple of problems
in andb3 from basics.v.

Basic Functions:
Inductive bool : Set :=
  | true : bool
  | false : bool.
Definition ifb (b1 b2 b3:bool) : bool :=
  match b1 with
    | true => b2
    | false => b3
  end.
Definition andb (b1 b2:bool) : bool := ifb b1 b2 false.

My function:
Definition andb3 (b1:bool) (b2:bool) (b3:bool) : bool := andb (andb b1 b2) b3.

My Eval:
Eval simpl in (andb3 true true true).
Eval simpl in (andb3 false true true).

My Output:
= andb3 true true true
: bool
= andb3 false true true
: bool

Not sure why it is coming out like this. It should be
= true
: bool
= false
: bool

It works with the following:
Definition andb3 (b1:bool) (b2:bool) (b3:bool) : bool :=
match b1 with
|true => andb b2 b3
|false => false
end.

Which is great I guess, but it should work with my code as well. Not
sure what I am doing wrong here. Any help would be appreciated?



Archive powered by MhonArc 2.6.16.

Top of Page