Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Beginner question

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Beginner question


Chronological Thread 
  • From: Saulo Araujo <saulo2 AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Beginner question
  • Date: Thu, 18 Dec 2014 13:05:37 -0300

Thans a lot Andrew. It works :

Theorem containsObj_t1 :
  forall (obj obj' : OBJ) (objs : list OBJ), 
  containsObj (obj :: objs) obj' = false -> containsObj objs obj' = false.
Proof.
  intros.
  simpl in H.
  destruct (objEq obj obj').
  inversion H.
  trivial.
Qed.

Now I am going to try to understand what inversion does. Thanks a lot!

On Thu, Dec 18, 2014 at 12:57 PM, Andrew Hirsch <akhirsch AT cs.cornell.edu> wrote:

Try destruct objEq obj obj'. Then you should get two goals, one where H has type true = false (which you can then invert) and one where H had the type of the goal.

-akh

On Dec 18, 2014 9:47 AM, "Saulo Araujo" <saulo2 AT gmail.com> wrote:
Hi,

I am trying to prove the following very simple theorem:

Require Import Arith.
Require Import List. Import ListNotations.

Inductive OBJ := Obj : nat -> OBJ.

Definition objEq obj obj' := let 'Obj id := obj 
  in let 'Obj id' := obj' 
  in beq_nat id id'.

Fixpoint containsObj objs obj := match objs with
    | [] => false
    | obj' :: objs' => if objEq obj' obj then true else containsObj objs' obj
  end.

Theorem containsObj_t1 :
  forall (obj obj' : OBJ) (objs : list OBJ), 
  containsObj (obj :: objs) obj' = false -> containsObj objs obj' = false.

When I try

Proof.
  intros.
  simpl in H.
Qed.

Coq shows that H is

(if objEq obj obj' then true else containsObj objs obj') = false

From where I believe it is safe to say that containsObj objs obj' = false. 

But no matter what I try, I cannot convince Coq that containsObj objs obj' = false :)

Any suggestions?

Thanks in advance,
Saulo



Archive powered by MHonArc 2.6.18.

Top of Page