Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] How to match several hypo. in Ltac

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] How to match several hypo. in Ltac


chronological Thread 
  • From: Pierre Casteran <pierre.casteran AT labri.fr>
  • To: Pierre Casteran <pierre.casteran AT labri.fr>
  • Cc: xiang sen <xiangsen AT ustc.edu>, coq-club AT pauillac.inria.fr
  • Subject: Re: [Coq-Club] How to match several hypo. in Ltac
  • Date: Sun, 26 Jun 2005 17:48:46 +0200
  • List-archive: <http://pauillac.inria.fr/pipermail/coq-club/>

Hi,

 This version with an auxiliary tactic clearloop is a little better
(wrt. the number of goal matchings).

Pierre


(* auxiliary tactic *)
Ltac clearloop h1:=
                  (clear h1 ;
                     match goal with | [h2 : heap |- _] => clearloop h2
                                     | _ => fail 1 end)
                  || idtac.

(* main tactic *)
Ltac clearheap2 :=
  match goal with |
    [h1 : heap |- _] => clearloop h1
  end.


Goal heap -> heap -> nat -> heap -> heap ->nat.
 intros.
 clearheap2.
 auto.
Qed.



>
> Hi,
>
>  Are you looking for a tactic which keeps only one hypothesis of
> type heap ?
>
>  If so, it seems that a tactic like that works :
>
>
> Parameter heap:Prop.
>
>
> Ltac clearheap :=
>   match goal with |
>     [h1 : heap |- _] =>
>                   (clear h1 ;
>                      match goal with | [h1 : heap |- _] => clearheap
>                                      | _ => fail 1 end)
>                   || idtac
>   end.
>
> Goal heap -> heap -> nat -> heap -> heap ->nat.
>  intros.
>  clearheap.
>  auto.
> Qed.
>
>
>
> Pierre
>
>
>
>
> Selon xiang sen 
> <xiangsen AT ustc.edu>:
>
> > Hi, everyone!
> >
> > (*I define indom as :*)
> > Ltac indom :=
> > match goal with
> > | [h1 : heap |- _] => clear h1
> > end.
> >
> > (*This is ok.*)
> > (*but *)
> > Ltac indom :=
> > match goal with
> > | [h1 : heap; h2 : heap] |- ] => clear h1
> > end.
> > (** doesn't work **)
> >
> > How to resolve?
> > Thanks
> >
> > All the best
> > Sen
> >
> >
> > --------------------------------------------------------
> > Bug reports: http://coq.inria.fr/bin/coq-bugs
> > Archives: http://pauillac.inria.fr/pipermail/coq-club
> >           http://pauillac.inria.fr/bin/wilma/coq-club
> > Info: http://pauillac.inria.fr/mailman/listinfo/coq-club
> >
>
>
> --
> Pierre Casteran
>
> http://www.labri.fr/Perso/~casteran/
>
> (+33) 540006931
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
> --------------------------------------------------------
> Bug reports: http://coq.inria.fr/bin/coq-bugs
> Archives: http://pauillac.inria.fr/pipermail/coq-club
>           http://pauillac.inria.fr/bin/wilma/coq-club
> Info: http://pauillac.inria.fr/mailman/listinfo/coq-club
>


-- 
Pierre Casteran

http://www.labri.fr/Perso/~casteran/

(+33) 540006931

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




Archive powered by MhonArc 2.6.16.

Top of Page