Skip to Content.
Sympa Menu

coq-club - [Coq-Club] Tactic to collect hypothesis of given type in a list

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Tactic to collect hypothesis of given type in a list


Chronological Thread 
  • From: "Soegtrop, Michael" <michael.soegtrop AT intel.com>
  • To: "coq-club AT inria.fr" <coq-club AT inria.fr>
  • Subject: [Coq-Club] Tactic to collect hypothesis of given type in a list
  • Date: Wed, 14 Sep 2016 16:34:21 +0000
  • Accept-language: de-DE, en-US
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=michael.soegtrop AT intel.com; spf=Pass smtp.mailfrom=michael.soegtrop AT intel.com; spf=None smtp.helo=postmaster AT mga03.intel.com
  • Ironport-phdr: 9a23:SOqSGh9eUb9O8v9uRHKM819IXTAuvvDOBiVQ1KB90+wcTK2v8tzYMVDF4r011RmSDNydtKkP0LWe8/i5HzdfsdDZ6DFKWacPfiFGoP1epxYnDs+BBB+zB9/RRAt+Iv5/UkR49WqwK0lfFZW2TVTTpnqv8WxaQU2nZkImbtjyT8TZiN3y3OSv8bXSZR9JjXyze/k6eB6xtEDastQcqYpkMKc4jBXT9ChmYeNTkClTIl+cgwz7/oP42Z9o8y1dv7hpo8tBWqXzcqB+VrtVAyg8NHgd5cv3uB2FRgyKsChPGl4KmwZFVlCWpCrxWY3853P3

Dear Coq Users,

 

I need a tactic to collect all hypothesis of a given type in a list. The un-elegant and restricted version below somehow works, but I am looking for something which would work for any number of hypothesis.

 

I wanted to use a recursive function and clear the hypothesis in each step (this would be ok), but as far as I know an Ltac function can either return a value or manipulate the goal but not both.

 

Does someone have something similar?

 

Alternatively an example for constructing a list in a hypothesis by keeping the tail an evar would be useful. I tried a few things but always get typing errors, when I instantiate an existing evar with something like head :: newevar.

 

Thanks & best regards,

 

Michael

 

 

Open Scope list_scope.

 

Inductive PropWrap : Prop :=

| SomeProp {P : Prop} (p : P)

| NoneProp

.

 

Ltac CollectPropWrap :=

  lazymatch goal with

  | H1 := ?h1 : PropWrap, H2 := ?h2 : PropWrap, H3 := ?h3 : PropWrap |- _ => constr:(h1::h2::h3::nil)

  | H1 := ?h1 : PropWrap, H2 := ?h2 : PropWrap                       |- _ => constr:(h1::h2::nil)

  | H1 := ?h1 : PropWrap                                             |- _ => constr:(h1::nil)

  end.

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928




Archive powered by MHonArc 2.6.18.

Top of Page