coq-club AT inria.fr
Subject: The Coq mailing list
List archive
Re: [Coq-Club] Applying a constructor/function to both sides of an equation -- is this possible?
Chronological Thread
- From: Abhishek Anand <abhishek.anand.iitg AT gmail.com>
- To: coq-club <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] Applying a constructor/function to both sides of an equation -- is this possible?
- Date: Sun, 16 Feb 2014 13:46:43 +0530
I find the following tactic very handy :
Ltac apply_eq f H := let Hn := fresh H "aeq" in
match type of H with
(?l = ?r) => assert (f l = f r) as Hn by (f_equal;auto)
end.
You don't need injectivity of f for this direction.
Here is an illustrative use of it:
Goal 1=2 -> True.
intro H.
apply_eq S H.
Abort.
-- Abhishek
http://www.cs.cornell.edu/~aa755/On Sun, Feb 16, 2014 at 4:06 AM, Vilhelm Sjöberg <vilhelm AT cis.upenn.edu> wrote:
On Sat, Feb 15, 2014 at 11:29:23PM +0200, Ömer Sinan A?acan wrote:For constructors yes, because constructors are injective. I don't know of any clever tactic for this, but if you prove injectivity as a lemma, then you can just "apply" the lemma.
> Hi all,
>
> Let's say I have `length tl = n - 1` as goal and `H: n <> 0`. Can I
> apply same constructor/function to both sides of the equation in goal?
> Like applying S and having:
>
> > S (length tl) = S (n - 1)
Lemma S_injective : forall n m, S n = S m -> n = m.
Proof.
intros n m H; injection H; auto.
Qed.
Hypothesis tl : list bool.
Hypothesis n : nat.
Goal length tl = n - 1.
apply S_injective.
(* goal is now
S (length tl) = S (n - 1) *)
Vilhelm Sjöberg
- [Coq-Club] Applying a constructor/function to both sides of an equation -- is this possible?, Ömer Sinan Ağacan, 02/15/2014
- Re: [Coq-Club] Applying a constructor/function to both sides of an equation -- is this possible?, AUGER Cédric, 02/15/2014
- Re: [Coq-Club] Applying a constructor/function to both sides of an equation -- is this possible?, Ömer Sinan Ağacan, 02/16/2014
- Re: [Coq-Club] Applying a constructor/function to both sides of an equation -- is this possible?, AUGER Cédric, 02/16/2014
- Re: [Coq-Club] Applying a constructor/function to both sides of an equation -- is this possible?, Ömer Sinan Ağacan, 02/16/2014
- Re: [Coq-Club] Applying a constructor/function to both sides of an equation -- is this possible?, Vilhelm Sjöberg, 02/15/2014
- Re: [Coq-Club] Applying a constructor/function to both sides of an equation -- is this possible?, Abhishek Anand, 02/16/2014
- Re: [Coq-Club] Applying a constructor/function to both sides of an equation -- is this possible?, Robbert Krebbers, 02/16/2014
- Re: [Coq-Club] Applying a constructor/function to both sides of an equation -- is this possible?, Ömer Sinan Ağacan, 02/16/2014
- Re: [Coq-Club] Applying a constructor/function to both sides of an equation -- is this possible?, Abhishek Anand, 02/16/2014
- Re: [Coq-Club] Applying a constructor/function to both sides of an equation -- is this possible?, Mitchell Wand, 02/16/2014
- Re: [Coq-Club] Applying a constructor/function to both sides of an equation -- is this possible?, Ömer Sinan Ağacan, 02/16/2014
- Re: [Coq-Club] Applying a constructor/function to both sides of an equation -- is this possible?, Jason Gross, 02/16/2014
- Re: [Coq-Club] Applying a constructor/function to both sides of an equation -- is this possible?, Ömer Sinan Ağacan, 02/16/2014
- Re: [Coq-Club] Applying a constructor/function to both sides of an equation -- is this possible?, AUGER Cédric, 02/15/2014
Archive powered by MHonArc 2.6.18.